Skip to content

Commit bf93e76

Browse files
authored
Merge pull request #717 from kochebina/RunIDCoins
Add diff runs for Coincidences
2 parents 7e510e5 + c3f43c2 commit bf93e76

File tree

3 files changed

+39
-9
lines changed

3 files changed

+39
-9
lines changed

source/digits_hits/include/GateToRoot.hh

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

source/digits_hits/src/GateToRoot.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ void GateToRoot::RecordDigitizer(const G4Event *) {
10531053
if(m_outputChannelList[i]->m_collectionID<0)
10541054
m_outputChannelList[i]->m_collectionID=GetCollectionID(m_outputChannelList[i]->m_collectionName);
10551055

1056-
//G4cout<<m_outputChannelList[i]->m_collectionName<<" "<< m_outputChannelList[i]->m_collectionID<<" "<< m_outputChannelList[i]->m_outputFlag<<G4endl;
1056+
//G4cout<<"!!!! "<<m_outputChannelList[i]->m_collectionName<<" "<< m_outputChannelList[i]->m_collectionID<<" "<< m_outputChannelList[i]->m_outputFlag<<G4endl;
10571057
m_outputChannelList[i]->RecordDigitizer();
10581058

10591059
}

source/digits_hits/src/GateToRootMessenger.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ void GateToRootMessenger::ExecuteOutputChannelCmd(G4UIcommand* command, G4String
339339
digitizer->m_recordFlag=true;
340340

341341
//Setting flag in the digitizerMgr
342-
//G4cout<<"ExecuteOutputChannelCmd "<<m_outputChannelList[i]->m_collectionName<<G4endl;
342+
G4cout<<"ExecuteOutputChannelCmd "<<m_outputChannelList[i]->m_collectionName<<G4endl;
343343
if (G4StrUtil::contains(m_outputChannelList[i]->m_collectionName, "Singles"))
344344
{
345345
m_outputChannelList[i]->AddSinglesCommand();
@@ -348,6 +348,8 @@ void GateToRootMessenger::ExecuteOutputChannelCmd(G4UIcommand* command, G4String
348348
}
349349
if (G4StrUtil::contains(m_outputChannelList[i]->m_collectionName, "Coincidences"))
350350
{
351+
m_outputChannelList[i]->AddCoincidencesCommand();
352+
if(OutputChannelCmdList[i]->GetNewBoolValue(newValue))
351353
digitizerMgr->m_recordCoincidences=OutputChannelCmdList[i]->GetNewBoolValue(newValue);
352354
}
353355

0 commit comments

Comments
 (0)