@@ -163,7 +163,8 @@ public:
163163 m_CCFlag(CCFlag),
164164 m_collectionName(aCollectionName),
165165 m_collectionID(-1 ),
166- m_signlesCommands(0 ){}
166+ m_singlesCommands(0 ),
167+ m_coinsCommands(0 ){}
167168
168169 virtual inline ~VOutputChannel () {}
169170
@@ -179,8 +180,9 @@ public:
179180 inline G4bool GetCCFlag (){return m_CCFlag;};
180181
181182
182- inline void AddSinglesCommand () { m_signlesCommands ++; };
183+ inline void AddSinglesCommand () { m_singlesCommands ++; };
183184
185+ inline void AddCoincidencesCommand () { m_coinsCommands++; };
184186
185187 inline void SetVerboseLevel (G4int val) { nVerboseLevel = val; };
186188
@@ -190,7 +192,8 @@ public:
190192
191193 G4String m_collectionName;
192194 G4int m_collectionID;
193- G4int m_signlesCommands;
195+ G4int m_singlesCommands;
196+ G4int m_coinsCommands;
194197
195198 };
196199
@@ -218,7 +221,7 @@ public:
218221 if ( digitizerMgr->m_SDlist .size ()==1 )
219222 {
220223
221- if (m_signlesCommands ==0 )
224+ if (m_singlesCommands ==0 )
222225 {
223226
224227 treeName = m_collectionName.substr (0 , m_collectionName.find (" _" ));
@@ -234,7 +237,7 @@ public:
234237 if (runID>0 )
235238 treeName = treeName+" _run" +std::to_string (runID);
236239
237-
240+ // G4cout<<"!!!! "<< runID <<" "<<treeName<<G4endl;
238241 m_tree = new GateSingleTree (treeName);
239242
240243 m_buffer.SetCCFlag (GetCCFlag ());
@@ -262,8 +265,33 @@ public:
262265
263266 inline void Book () {
264267 m_collectionID = -1 ;
265- if (m_outputFlag) {
266- m_tree = new GateCoincTree (m_collectionName);
268+
269+ // OK GND 2024 multiSD backward compatibility
270+ GateDigitizerMgr* digitizerMgr = GateDigitizerMgr::GetInstance ();
271+
272+ if (m_outputFlag) {
273+ G4String treeName;
274+
275+ if ( digitizerMgr->m_SDlist .size ()==1 )
276+ {
277+
278+ if (m_coinsCommands==0 )
279+ {
280+
281+ treeName = m_collectionName.substr (0 , m_collectionName.find (" _" ));
282+
283+ }
284+ else
285+ treeName = m_collectionName;
286+ }
287+ else
288+ treeName = m_collectionName;
289+
290+ G4int runID=GateRunManager::GetRunManager ()->GetCurrentRun ()->GetRunID ();
291+ if (runID>0 )
292+ treeName = treeName+" _run" +std::to_string (runID);
293+
294+ m_tree = new GateCoincTree (treeName);
267295 m_tree->Init (m_buffer);
268296 }
269297 }
0 commit comments