Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add diff runs for Coincidences #717

Merged
merged 1 commit into from
Feb 5, 2025
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
42 changes: 35 additions & 7 deletions source/digits_hits/include/GateToRoot.hh
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ public:
m_CCFlag(CCFlag),
m_collectionName(aCollectionName),
m_collectionID(-1),
m_signlesCommands(0){}
m_singlesCommands(0),
m_coinsCommands(0){}

virtual inline ~VOutputChannel() {}

Expand All @@ -179,8 +180,9 @@ public:
inline G4bool GetCCFlag(){return m_CCFlag;};


inline void AddSinglesCommand() { m_signlesCommands++; };
inline void AddSinglesCommand() { m_singlesCommands++; };

inline void AddCoincidencesCommand() { m_coinsCommands++; };

inline void SetVerboseLevel(G4int val) { nVerboseLevel = val; };

Expand All @@ -190,7 +192,8 @@ public:

G4String m_collectionName;
G4int m_collectionID;
G4int m_signlesCommands;
G4int m_singlesCommands;
G4int m_coinsCommands;

};

Expand Down Expand Up @@ -218,7 +221,7 @@ public:
if( digitizerMgr->m_SDlist.size()==1 )
{

if(m_signlesCommands==0)
if(m_singlesCommands==0)
{

treeName = m_collectionName.substr(0, m_collectionName.find("_"));
Expand All @@ -234,7 +237,7 @@ public:
if(runID>0)
treeName = treeName+"_run"+std::to_string(runID);


//G4cout<<"!!!! "<< runID <<" "<<treeName<<G4endl;
m_tree = new GateSingleTree(treeName);

m_buffer.SetCCFlag(GetCCFlag());
Expand Down Expand Up @@ -262,8 +265,33 @@ public:

inline void Book() {
m_collectionID = -1;
if (m_outputFlag) {
m_tree = new GateCoincTree(m_collectionName);

//OK GND 2024 multiSD backward compatibility
GateDigitizerMgr* digitizerMgr = GateDigitizerMgr::GetInstance();

if (m_outputFlag) {
G4String treeName;

if( digitizerMgr->m_SDlist.size()==1 )
{

if(m_coinsCommands==0)
{

treeName = m_collectionName.substr(0, m_collectionName.find("_"));

}
else
treeName = m_collectionName;
}
else
treeName = m_collectionName;

G4int runID=GateRunManager::GetRunManager()->GetCurrentRun()->GetRunID();
if(runID>0)
treeName = treeName+"_run"+std::to_string(runID);

m_tree = new GateCoincTree(treeName);
m_tree->Init(m_buffer);
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/digits_hits/src/GateToRoot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ void GateToRoot::RecordDigitizer(const G4Event *) {
if(m_outputChannelList[i]->m_collectionID<0)
m_outputChannelList[i]->m_collectionID=GetCollectionID(m_outputChannelList[i]->m_collectionName);

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

}
Expand Down
4 changes: 3 additions & 1 deletion source/digits_hits/src/GateToRootMessenger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void GateToRootMessenger::ExecuteOutputChannelCmd(G4UIcommand* command, G4String
digitizer->m_recordFlag=true;

//Setting flag in the digitizerMgr
//G4cout<<"ExecuteOutputChannelCmd "<<m_outputChannelList[i]->m_collectionName<<G4endl;
G4cout<<"ExecuteOutputChannelCmd "<<m_outputChannelList[i]->m_collectionName<<G4endl;
if (G4StrUtil::contains(m_outputChannelList[i]->m_collectionName, "Singles"))
{
m_outputChannelList[i]->AddSinglesCommand();
Expand All @@ -348,6 +348,8 @@ void GateToRootMessenger::ExecuteOutputChannelCmd(G4UIcommand* command, G4String
}
if (G4StrUtil::contains(m_outputChannelList[i]->m_collectionName, "Coincidences"))
{
m_outputChannelList[i]->AddCoincidencesCommand();
if(OutputChannelCmdList[i]->GetNewBoolValue(newValue))
digitizerMgr->m_recordCoincidences=OutputChannelCmdList[i]->GetNewBoolValue(newValue);
}

Expand Down
Loading