diff --git a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp index b31b62d8332777e396ce835ee96e814476465b65..cfbf31dfca17462043695237e78e6a7af5caba41 100644 --- a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp +++ b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp @@ -19,6 +19,11 @@ DECLARE_COMPONENT(Edm4hepWriterAnaElemTool) void Edm4hepWriterAnaElemTool::BeginOfRunAction(const G4Run*) { + auto msglevel = msgLevel(); + if (msglevel == MSG::VERBOSE || msglevel == MSG::DEBUG) { + verboseOutput = true; + } + G4cout << "Begin Run of detector simultion..." << G4endl; // access geometry service @@ -52,7 +57,9 @@ Edm4hepWriterAnaElemTool::BeginOfEventAction(const G4Event* anEvent) { m_userinfo = nullptr; if (anEvent->GetUserInformation()) { m_userinfo = dynamic_cast<CommonUserEventInfo*>(anEvent->GetUserInformation()); - m_userinfo->dumpIdxG4Track2Edm4hep(); + if (verboseOutput) { + m_userinfo->dumpIdxG4Track2Edm4hep(); + } } auto mcGenCol = m_mcParGenCol.get(); @@ -84,6 +91,8 @@ Edm4hepWriterAnaElemTool::BeginOfEventAction(const G4Event* anEvent) { void Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) { + + msg() << "mcCol size (after simulation) : " << mcCol->size() << endmsg; // save all data // create collections. @@ -452,14 +461,14 @@ Edm4hepWriterAnaElemTool::PostUserTrackingAction(const G4Track* track) { // select the necessary processes if (creatorProcess==proc_decay) { - info() << "Creator Process is Decay for secondary particle: " - << " idx: " << i - << " trkid: " << sectrk->GetTrackID() // not valid until track - << " particle: " << secparticle->GetParticleName() - << " pdg: " << secparticle->GetPDGEncoding() - << " at position: " << sectrk->GetPosition() // - << " time: " << sectrk->GetGlobalTime() - << " momentum: " << sectrk->GetMomentum() // + debug() << "Creator Process is Decay for secondary particle: " + << " idx: " << i + << " trkid: " << sectrk->GetTrackID() // not valid until track + << " particle: " << secparticle->GetParticleName() + << " pdg: " << secparticle->GetPDGEncoding() + << " at position: " << sectrk->GetPosition() // + << " time: " << sectrk->GetGlobalTime() + << " momentum: " << sectrk->GetMomentum() // << endmsg; is_decay = true; @@ -496,9 +505,9 @@ Edm4hepWriterAnaElemTool::PostUserTrackingAction(const G4Track* track) { auto trackinfo = new CommonUserTrackInfo(); trackinfo->setIdxEdm4hep(mcp.getObjectID().index); sectrk->SetUserInformation(trackinfo); - info() << " Appending MCParticle: (id: " - << mcp.getObjectID().index << ")" - << endmsg; + debug() << " Appending MCParticle: (id: " + << mcp.getObjectID().index << ")" + << endmsg; } } } @@ -541,9 +550,9 @@ Edm4hepWriterAnaElemTool::UserSteppingAction(const G4Step* aStep) { // set back scattering auto idxedm4hep = trackinfo->idxEdm4hep(); mcCol->at(idxedm4hep).setBackscatter(true); - info() << " set back scatter for MCParticle " - << " (ID: " << idxedm4hep << ")" - << endmsg; + debug() << " set back scatter for MCParticle " + << " (ID: " << idxedm4hep << ")" + << endmsg; } } } diff --git a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h index 9782cf5f5bd0fbbcca105f9d24b2eb25387ac915..e4415b17899012530817186c0428581b585bad62 100644 --- a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h +++ b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h @@ -151,6 +151,7 @@ private: double R = 0; double Z = 0; + bool verboseOutput = false; }; #endif