From bfcb5effe524fffda84f7608433fe10fc5ccd23b Mon Sep 17 00:00:00 2001 From: kochebina Date: Wed, 24 Jan 2024 16:36:46 +0100 Subject: [PATCH] Merger simplification --- .../include/GateDigitizerMerger.hh | 4 +- .../include/GateSinglesDigitizer.hh | 6 +- source/digits_hits/src/GateDigitizerMerger.cc | 59 ++++++++++++++++++- .../src/GateDigitizerMergerMessenger.cc | 2 +- .../digits_hits/src/GateSinglesDigitizer.cc | 2 + 5 files changed, 66 insertions(+), 7 deletions(-) diff --git a/source/digits_hits/include/GateDigitizerMerger.hh b/source/digits_hits/include/GateDigitizerMerger.hh index a4af5fc39..d014292b7 100755 --- a/source/digits_hits/include/GateDigitizerMerger.hh +++ b/source/digits_hits/include/GateDigitizerMerger.hh @@ -41,6 +41,8 @@ public: void AddInputCollection(const G4String& ); void DescribeMyself(size_t indent ); + void SetInputCollectionID(); + protected: std::vector m_names; std::vector m_inputCollectionIDs; @@ -54,7 +56,7 @@ private: GateDigiCollection* m_OutputDigiCollection; GateSinglesDigitizer *m_digitizer; - + G4int m_DigiCollectionID; }; diff --git a/source/digits_hits/include/GateSinglesDigitizer.hh b/source/digits_hits/include/GateSinglesDigitizer.hh index 6ab6625ec..b4bda2dec 100644 --- a/source/digits_hits/include/GateSinglesDigitizer.hh +++ b/source/digits_hits/include/GateSinglesDigitizer.hh @@ -91,14 +91,15 @@ class GateSinglesDigitizer : public GateModuleListManager void SetOutputCollectionID(); - protected: GateSinglesDigitizerMessenger* m_messenger; GateVSystem *m_system; //!< System to which the digitizer is attached - G4String m_outputName; + //G4String m_outputName; G4String m_inputName; public: + + G4String m_outputName; G4bool m_recordFlag; std::vector m_DMlist; //!< List of DigitizerModules for this digitizer @@ -106,6 +107,7 @@ public: G4String m_digitizerName; G4int m_outputDigiCollectionID; + G4int m_digiCollectionID4merger; }; #endif diff --git a/source/digits_hits/src/GateDigitizerMerger.cc b/source/digits_hits/src/GateDigitizerMerger.cc index 22aed3159..ac436c926 100755 --- a/source/digits_hits/src/GateDigitizerMerger.cc +++ b/source/digits_hits/src/GateDigitizerMerger.cc @@ -75,10 +75,31 @@ void GateDigitizerMerger::Digitize() //Do only in the first event as it is time consuming procedure if(isFirstEvent) { - for(G4int i=0; iGetDigiCollectionID(m_names[i])<GetDigiCollectionID(m_names[i])); + for(G4int k=0; km_SingleDigitizersList.size();k++) + { + + if(mgr->m_SingleDigitizersList[k]->m_outputName != outputCollName) + { + if(mgr->m_SingleDigitizersList[k]->m_outputName == m_names[i]) + { + G4int size=mgr->m_SingleDigitizersList[k]->m_DMlist.size(); + //G4cout<<"size "<m_SingleDigitizersList[k]->m_outputName <m_SingleDigitizersList[k]->m_DMlist[size-1]->GetName(); + //G4cout<< inputDMname <GetDigiCollectionID(name)); + } + + } + } + } isFirstEvent=false; @@ -151,11 +172,43 @@ void GateDigitizerMerger::Digitize() void GateDigitizerMerger::AddInputCollection(const G4String& name) { + //adder/Singles_crystal + //name m_names.push_back(name); +} + + +void GateDigitizerMerger::SetInputCollectionID() +{ + + //Save the ID of the last digitizer module for current digitizer + //G4cout<<"GateSinglesDigitizer::SetOuptputCollectionID"<m_DMlist.size()>1) + { + GateVDigitizerModule *DM = (GateVDigitizerModule*)(m_digitizer->m_DMlist[m_digitizer->m_DMlist.size()-2]); + name=DM->GetName()+"/"+m_digitizer->GetName()+"_"+m_SD->GetName(); + + } + else if (m_digitizer->m_DMlist.size()==1) + { + name="DigiInit/"+m_digitizer->GetName()+"_"+m_SD->GetName(); + } + else + G4cout<<"error"<GetDigiCollectionID(name); + + G4cout<<"output collecionID "<GetName()<<" "<GetDigiCollectionID(name)<SetGuidance("How to generate position"); + addCollCmd->SetGuidance("Select input collection"); } diff --git a/source/digits_hits/src/GateSinglesDigitizer.cc b/source/digits_hits/src/GateSinglesDigitizer.cc index 11885471b..595951f38 100644 --- a/source/digits_hits/src/GateSinglesDigitizer.cc +++ b/source/digits_hits/src/GateSinglesDigitizer.cc @@ -170,6 +170,8 @@ void GateSinglesDigitizer::SetOutputCollectionID() { GateVDigitizerModule *DM = (GateVDigitizerModule*)m_DMlist[m_DMlist.size()-1]; name=DM->GetName()+"/"+m_digitizerName+"_"+m_SD->GetName(); + + } else name="DigiInit/"+m_digitizerName+"_"+m_SD->GetName();