Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/MGUIExpoDepthCalibration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void MGUIExpoDepthCalibration::SetDepthHistogramArrangement(vector<unsigned int>
unsigned int max_columns = 4;

unsigned int NDetectors = DetIDs->size();
cout<<"MGUIExpoDepthCalibration::SetDepthHistogramArrangement: Number of detectors:" << NDetectors<<endl;
if (g_Verbosity >= c_Info) cout<<"MGUIExpoDepthCalibration::SetDepthHistogramArrangement: Number of detectors:" << NDetectors<<endl;

for ( unsigned int i=0; i< NDetectors; ++i ){
// iterate over detector IDs, make the map from ID to plot position, and initialize the histograms
Expand Down
2 changes: 1 addition & 1 deletion src/MGUIExpoTACcut.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void MGUIExpoTACcut::SetTACHistogramArrangement(const vector<unsigned int> DetID
unsigned int max_columns = 4;

unsigned int NDetectors = DetIDs.size();
cout<<"MGUIExpoTACcut::SetTACHistogramArrangement: Number of detectors:"<< NDetectors<<endl;
if (g_Verbosity >= c_Info) cout<<"MGUIExpoTACcut::SetTACHistogramArrangement: Number of detectors:"<< NDetectors<<endl;

for (unsigned int i=0; i < NDetectors; ++i) {
// iterate over detector IDs, make the map from ID to plot position, and initialize the histograms
Expand Down
99 changes: 54 additions & 45 deletions src/MModuleDepthCalibration.cxx

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/MModuleEnergyCalibration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ double MModuleEnergyCalibration::GetEnergy(MReadOutElementDoubleStrip R, double
Energy = 0.0;
}
} else {
cout << m_Name << ": GetEnergy: Error unable to find calibration" << endl;
if (g_Verbosity >= c_Warning) cout << m_XmlTag << ": GetEnergy: Error unable to find calibration" << endl;
return 0;
}

Expand All @@ -303,7 +303,7 @@ double MModuleEnergyCalibration::GetADC(MReadOutElementDoubleStrip R, double Ene
if (Fit != nullptr) {
return Fit->GetX(Energy);
} else {
cout << m_Name << ": GetADC: Error unable to find calibration" << endl;
if (g_Verbosity >= c_Warning) cout << m_XmlTag << ": GetADC: Error unable to find calibration" << endl;
return 0;
}
}
Expand Down Expand Up @@ -638,12 +638,12 @@ double MModuleEnergyCalibration::LookupEnergyResolution(MStripHit* SH, double En

MReadOutElementDoubleStrip* ROE = dynamic_cast<MReadOutElementDoubleStrip*>(SH->GetReadOutElement());
if (ROE == nullptr) {
cout << m_Name << ": LookupEnergyResolution: Error unable to get read-out element" << endl;
if (g_Verbosity >= c_Error) cout << m_Name << ": ERROR: LookupEnergyResolution unable to get read-out element" << endl;
return -1;
}
TF1* FitRes = m_ResolutionCalibration[*ROE];
if (FitRes == nullptr) {
cout << m_Name << ": LookupEnergyResolutio: Error: Couldn't locate energy resolution" << endl;
if (g_Verbosity >= c_Error) cout << m_Name << ": ERROR: LookupEnergyResolution couldn't locate energy resolution" << endl;
return -1.0;
} else {
return FitRes->Eval(Energy);
Expand Down
20 changes: 11 additions & 9 deletions src/MModuleLoaderMeasurementsHDF.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ bool MModuleLoaderMeasurementsHDF::OpenHDF5File(MString FileName)
Config.read(Config.getStrType(), ConfigJSON);
}

cout<<m_XmlTag<<": HDF5 hit version found: "<<m_HDFStripHitVersion<<endl;
if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": HDF5 hit version found: "<<m_HDFStripHitVersion<<endl;

// Read ASIC polarities from the JSON config string (if existent)
m_ASICPolarities.clear();
Expand Down Expand Up @@ -596,7 +596,7 @@ bool MModuleLoaderMeasurementsHDF::ReadBatchHits()
m_CurrentBatchIndex = 0;

} catch (const H5::Exception& E) {
cout<<m_XmlTag<<": HDF5 read error: "<<E.getDetailMsg()<<endl;
if (g_Verbosity >= c_Error) cout<<m_XmlTag<<": HDF5 read error: "<<E.getDetailMsg()<<endl;
m_CurrentBatchSize = 0;
m_Buffer_1_0.resize(0);
m_Buffer_1_2.resize(0);
Expand Down Expand Up @@ -632,20 +632,20 @@ bool MModuleLoaderMeasurementsHDF::AnalyzeEvent(MReadOutAssembly* Event)
FileName.ReplaceAllInPlace(".hdf5", NextSuffix);
if (MFile::Exists(FileName) == true) {
if (OpenHDF5File(FileName) == false) {
cout<<m_XmlTag<<": No more events!"<<endl;
if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": No more events!"<<endl;
m_IsFinished = true;
return false;
} else {
cout<<m_XmlTag<<": Switched to file: "<<FileName<<endl;
if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": Switched to file: "<<FileName<<endl;
m_ContinuationFileID++;
}
} else {
cout<<m_XmlTag<<": No more events!"<<endl;
if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": No more events!"<<endl;
m_IsFinished = true;
return false;
}
} else {
cout<<m_XmlTag<<": No more events!"<<endl;
if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": No more events!"<<endl;
m_IsFinished = true;
return false;
}
Expand Down Expand Up @@ -905,9 +905,11 @@ void MModuleLoaderMeasurementsHDF::Finalize()

MModule::Finalize();

cout<<"MModuleLoaderMeasurementsHDF: "<<endl;
cout<<" * all events on file: "<<m_NEventsInFile<<endl;
cout<<" * good events on file: "<<m_NGoodEventsInFile<<endl;
if (g_Verbosity >= c_Info) {
cout<<"MModuleLoaderMeasurementsHDF: "<<endl;
cout<<" * all events on file: "<<m_NEventsInFile<<endl;
cout<<" * good events on file: "<<m_NGoodEventsInFile<<endl;
}

m_HDFFile.close();
}
Expand Down
2 changes: 1 addition & 1 deletion src/MModuleLoaderMeasurementsL0.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ bool MModuleLoaderMeasurementsL0::OpenL0File(MString FileName)
bool MModuleLoaderMeasurementsL0::AnalyzeEvent(MReadOutAssembly* Event)
{
if (ReadNextPacket(Event) == false) {
if (g_Verbosity >= c_Info) cout<<m_Name<<": No more packets!"<<endl;
if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": No more packets!"<<endl;
m_IsFinished = true;
return false;
}
Expand Down
16 changes: 9 additions & 7 deletions src/MModuleLoaderMeasurementsROA.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ bool MModuleLoaderMeasurementsROA::AnalyzeEvent(MReadOutAssembly* Event)
// Here: Just read it.

if (ReadNextEvent(Event) == false) {
cout<<m_Name<<": No more events!"<<endl;
if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": No more events!"<<endl;
m_IsFinished = true;
return false;
}
Expand All @@ -139,10 +139,12 @@ void MModuleLoaderMeasurementsROA::Finalize()

MModule::Finalize();

cout<<"MModuleLoaderMeasurementsROA: "<<endl;
cout<<" * all events on file: "<<m_NEventsInFile<<endl;
cout<<" * good events on file: "<<m_NGoodEventsInFile<<endl;

if (g_Verbosity >= c_Info) {
cout<<"MModuleLoaderMeasurementsROA: "<<endl;
cout<<" * all events on file: "<<m_NEventsInFile<<endl;
cout<<" * good events on file: "<<m_NGoodEventsInFile<<endl;
}

m_ROAFile.Close();
}

Expand Down Expand Up @@ -170,14 +172,14 @@ bool MModuleLoaderMeasurementsROA::Open(MString FileName, unsigned int Way)

bool MModuleLoaderMeasurementsROA::ReadNextEvent(MReadOutAssembly* Event)
{
// Return next single event from file... or 0 if there are no more.
// Populate next single event with ROA elements from file... or return false if there are no more.

Event->Clear();

m_ROAFile.ReadNext(*Event);

if (Event->GetNumberOfReadOuts() == 0) {
cout<<m_Name<<": No more read-outs available in File"<<endl;
if (g_Verbosity >= c_Info) cout<<m_XmlTag<<": No more read-outs available in File"<<endl;
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/MModuleLoaderSimulationsCosima.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ bool MModuleLoaderSimulationsCosima::Initialize()

m_Reader = new MFileEventsSim(m_Geometry);
if (m_Reader->Open(m_SimulationFileName) == false) {
cout<<"Unable to open sim file "<<m_SimulationFileName<<" - Aborting!"<<endl;
if (g_Verbosity >= c_Error) cout<<m_XmlTag<<": Unable to open sim file "<<m_SimulationFileName<<" - Aborting!"<<endl;
return false;
}
m_StartAreaFarField = m_Reader->GetSimulationStartAreaFarField();
Expand Down
4 changes: 2 additions & 2 deletions src/MModuleResponseGenerator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ bool MModuleResponseGenerator::AnalyzeEvent(MReadOutAssembly* Event)
Event->StreamEvta(Out);

if (m_Response->SetEvent(MString(Out.str()), false, 25) == false) {
cout<<"Unable to set event"<<endl;
if (g_Verbosity >= c_Error) cout<<m_XmlTag<<": Unable to set event"<<endl;
return true;
}

if (m_Response->Analyze() == false) {
cout<<"Analysis failed"<<endl;
if (g_Verbosity >= c_Error) cout<<m_XmlTag << ": Analysis failed"<<endl;
}

return true;
Expand Down
4 changes: 2 additions & 2 deletions src/MModuleRevan.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ bool MModuleRevan::Initialize()
delete m_ReconstructionGeometry;
m_ReconstructionGeometry = new MGeometryRevan();
if (m_ReconstructionGeometry->ScanSetupFile(m_Geometry->GetFileName(), false) == false) {
cout<<"Loading of geometry "<<m_ReconstructionGeometry->GetName()<<" failed!!"<<endl;
if (g_Verbosity >= c_Error) cout<<m_XmlTag<<": Loading of geometry "<<m_ReconstructionGeometry->GetName()<<" failed!!"<<endl;
return false;
}

Expand All @@ -128,7 +128,7 @@ bool MModuleRevan::Initialize()
m_RawEventAnalyzer->SetTrackingAlgorithm(MRawEventAnalyzer::c_TrackingAlgoNone);

if (m_RawEventAnalyzer->PreAnalysis() == false) {
cout<<"Revan pre-analysis failed!"<<endl;
if (g_Verbosity >= c_Error) cout<<m_XmlTag<<": Revan pre-analysis failed!"<<endl;
return false;
}

Expand Down
14 changes: 7 additions & 7 deletions src/MModuleTACCalibration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ bool MModuleTACCalibration::Initialize()
// Initialize the module

if (LoadTACCalFile(m_TACCalFile) == false) {
cout<<m_XmlTag<<": Error: TAC Calibration file could not be loaded."<<endl;
if (g_Verbosity >= c_Error) cout<<m_XmlTag<<": Error: TAC Calibration file could not be loaded."<<endl;
return false;
}

// Some sanity checks:
if (m_TACCal.size() == 0) {
cout<<m_XmlTag<<": The TAC calibration data set is empty"<<endl;
if (g_Verbosity >= c_Error) cout<<m_XmlTag<<": The TAC calibration data set is empty"<<endl;
return false;
}

Expand Down Expand Up @@ -229,7 +229,7 @@ bool MModuleTACCalibration::ApplyTACCal(MReadOutAssembly* Event)

// Check that this detector exists in the TAC calibration
if (m_TACCal.find(DetID) == m_TACCal.end()) {
cout<<m_XmlTag
if (g_Verbosity >= c_Warning) cout<<m_XmlTag
<<": Error: DetID "<<DetID
<<" has no TAC calibration entries - skipping event"
<<endl;
Comment on lines +232 to 235

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement says Error, but it's being run for every MReadOutAssembly* Event and would spam the terminal output, that's why I chose c_Warning here.

Expand All @@ -238,7 +238,7 @@ bool MModuleTACCalibration::ApplyTACCal(MReadOutAssembly* Event)

// Check that this side is understood
if (m_SideToIndex.find(Side) == m_SideToIndex.end()) {
cout<<m_XmlTag
if (g_Verbosity >= c_Warning) cout<<m_XmlTag
<<": Error: Unable to identify Side "<<Side
<<" - skipping event"
<<endl;
Comment on lines +241 to 244

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement says Error, but it's being run for every MReadOutAssembly* Event and would spam the terminal output, that's why I chose c_Warning here.

Expand Down Expand Up @@ -429,7 +429,7 @@ bool MModuleTACCalibration::LoadTACCalFile(MString FName)
// ReadOutID, Detector, Side, Strip, TAC cal, TAC cal error, TAC offset, TAC offset error
MFile F;
if (F.Open(FName) == false) {
cout<<m_XmlTag<<": Error: failed to open TAC Calibration file."<<endl;
if (g_Verbosity >= c_Error) cout<<m_XmlTag<<": Error: failed to open TAC Calibration file."<<endl;
return false;
}
MString Line;
Expand All @@ -442,7 +442,7 @@ bool MModuleTACCalibration::LoadTACCalFile(MString FName)
MString SideString = Tokens[1+IndexOffset].Trim();
char Side;
if (SideString.Length()!=1) {
cout<<m_XmlTag<<": Error: Expected 1 character Side, got string \""<<SideString<<"\" in TAC calibration file."<<endl;
if (g_Verbosity >= c_Error) cout<<m_XmlTag<<": Error: Expected 1 character Side, got string \""<<SideString<<"\" in TAC calibration file."<<endl;
return false;
}
else {
Expand Down Expand Up @@ -475,7 +475,7 @@ bool MModuleTACCalibration::LoadTACCalFile(MString FName)
if (m_SideToIndex.find(Side) != m_SideToIndex.end()) {
m_TACCal[DetID][m_SideToIndex[Side]][StripID] = CalValues;
} else {
cout<<m_XmlTag<<": Error: Unable to identify Side \""<<Side<<"\" in TAC calibration file."<<endl;
if (g_Verbosity >= c_Error) cout<<m_XmlTag<<": Error: Unable to identify Side \""<<Side<<"\" in TAC calibration file."<<endl;
return false;
}
}
Expand Down
14 changes: 9 additions & 5 deletions src/MSubModuleChargeTransport.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ bool MSubModuleChargeTransport::Initialize()
DetectorName.RemoveAllInPlace("GeD_"); // The number after GeD is the COSI detector ID
if (DetID != DetectorName.ToUnsignedInt()) {
if (g_Verbosity >= c_Error) {
cout << "ERROR in MModuleDepthCalibration::Initialize: Non-matching DetID="<<DetID<<" for detector "<<DetName<<endl;
cout << "ERROR in MSubModuleChargeTransport::Initialize: Non-matching DetID="<<DetID<<" for detector "<<DetName<<endl;
}
// Return false if this is running with the COSI SMEX payload mass model
if (m_Geometry->GetName() == "COSI-SMEX-Payload"){
Expand All @@ -105,7 +105,7 @@ bool MSubModuleChargeTransport::Initialize()
}
} else if (m_Geometry->GetName() == "COSI-SMEX-Payload") {
if (g_Verbosity >= c_Error) {
cout << "ERROR in MModuleDepthCalibration::Initialize: COSI-SMEX-Payload expects all Strip3D detectors to follow the name scheme GeD_X"<<endl;
cout << "ERROR in MSubModuleChargeTransport::Initialize: COSI-SMEX-Payload expects all Strip3D detectors to follow the name scheme GeD_X"<<endl;
}
return false;
}
Expand Down Expand Up @@ -147,16 +147,20 @@ bool MSubModuleChargeTransport::Initialize()
m_Detectors[DetID] = det;
DetID += 1;
} else {
cout << "ERROR in MSubModuleChargeTransport::Initialize: Found a duplicate detector: " << DetName << endl;
if (g_Verbosity >= c_Error) {
cout << "ERROR in MSubModuleChargeTransport::Initialize: Found a duplicate detector: " << DetName << endl;
}
}
} else {
cout << "ERROR in MSubModuleChargeTransport::Initialize: Found a Strip3D detector with " << det->GetNSensitiveVolumes() << " Sensitive Volumes." << endl;
if (g_Verbosity >= c_Error) {
cout << "ERROR in MSubModuleChargeTransport::Initialize: Found a Strip3D detector with " << det->GetNSensitiveVolumes() << " Sensitive Volumes." << endl;
}
}
}
}

if (m_DetectorIDs.size() == 0) {
cout<<"No Strip3D detectors were found."<<endl;
if (g_Verbosity >= c_Error) cout<<"ERROR in MSubModuleChargeTransport::Initialize: No Strip3D detectors were found in the geometry."<<endl;
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions src/MSubModuleShieldTrigger.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -269,18 +269,18 @@ bool MSubModuleShieldTrigger::ParseDeadtimeFile()

MParser Parser;
if (Parser.Open(m_DeadtimeFileName) == false) {
cout << m_Name << ": Unable to open deadtime parameters file: " << m_DeadtimeFileName << endl;
if (g_Verbosity >= c_Error) cout << m_Name << ": Unable to open deadtime parameters file: " << m_DeadtimeFileName << endl;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add e.g. "ERROR in src/MSubModuleShieldTrigger:ParseDeadtimeFile: " for the DEE submodules without the XmlTags, like you have for MSubModuleShieldTrigger?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine doing whatever for the DEE SubModules 😃
Should this be part of this PR or of a follow-up PR?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to you, if you want to handle this in a follow-on PR, then I'd call this good to go once you rebase again.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this to a follow-up PR

return false;
}

if (Parser.GetNLines() < 4) {
cout << m_Name << ": Deadtime file does not have enough data" << endl;
if (g_Verbosity >= c_Error) cout << m_Name << ": Deadtime file does not have enough data" << endl;
return false;
}

MTokenizer* ShieldTokenizer = Parser.GetTokenizerAt(3);
if (ShieldTokenizer->GetNTokens() != 5) {
cout << m_Name << ": Shield deadtime row must contain exactly 5 values" << endl;
if (g_Verbosity >= c_Error) cout << m_Name << ": Shield deadtime row must contain exactly 5 values" << endl;
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/MSubModuleStripTrigger.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,12 @@ bool MSubModuleStripTrigger::ParseDeadtimeFile()

MParser Parser;
if (Parser.Open(m_DeadtimeFileName) == false) {
cout << m_Name << ": Unable to open deadtime parameters file: " << m_DeadtimeFileName << endl;
if (g_Verbosity >= c_Error) cout << m_Name << ": ERROR: Unable to open deadtime parameters file: " << m_DeadtimeFileName << endl;
return false;
}

if (Parser.GetNLines() < 2) {
cout << m_Name << ": Deadtime file does not have enough data" << endl;
if (g_Verbosity >= c_Error) cout << m_Name << ": ERROR: Deadtime file does not have enough data" << endl;
return false;
}

Expand Down
Loading