Skip to content
Open
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
2 changes: 1 addition & 1 deletion source/digits_hits/include/GateOutputMgr.hh
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public:

//! Static getter and setter to know the current mode of the digitizer
inline static DigiMode GetDigiMode() { return m_digiMode;}
inline static void SetDigiMode(DigiMode mode) { m_digiMode = mode; }
inline static void SetDigiMode(DigiMode mode) { m_digiMode = mode;}
GateVOutputModule* GetModule(G4String);

//! Call in startDAQ, this function search for all output module inserted
Expand Down
34 changes: 30 additions & 4 deletions source/digits_hits/src/GateCoincidenceSorter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,27 @@ void GateCoincidenceSorter::Digitize()


//------ put input digis in sorted input buffer----------
if (nVerboseLevel > 1) {
G4cout<<"GateCoincidenceSorter::Digitize. Putting input digis in sorted input buffer"<<G4endl;

}
for(gpl_iter = IDCvector->begin();gpl_iter != IDCvector->end();gpl_iter++)
{
// make a copy of the digi
digi = new GateDigi(**gpl_iter);
if (nVerboseLevel > 1) {
G4cout<<"[GateCoincidenceSorter::Digitize] EventID "<< digi->GetEventID()<<G4endl;

}

if (nVerboseLevel > 2) {
G4cout << "[GateCoincidenceSorter::Digitize] Input digi \n"
<< *digi << Gateendl << Gateendl ;

}

if(m_presortBuffer.empty())
m_presortBuffer.push_back(digi);
m_presortBuffer.push_back(digi);
else if(digi->GetTime() < m_presortBuffer.back()->GetTime()) // check that even isn't earlier than the earliest event in the buffer
{
if(!m_presortWarning)
Expand All @@ -298,13 +312,18 @@ void GateCoincidenceSorter::Digitize()
while(digi->GetTime() < (*buf_iter)->GetTime())
buf_iter++;
m_presortBuffer.insert(buf_iter, digi);
// G4cout<<"presortBuffer filled in position "<<std::distance(m_presortBuffer.begin(),buf_iter)<<G4endl;
// G4cout<<"digiTime "<<digi->GetTime()<<G4endl;
// G4cout<<"digiTime "<<digi->GetTime()/ns<<G4endl;
if (nVerboseLevel > 3)
{
G4cout<<"presortBuffer filled in position "<<std::distance(m_presortBuffer.begin(),buf_iter)<<G4endl;
G4cout<<"digiTime "<<digi->GetTime()<<G4endl;
G4cout<<"digiTime "<<digi->GetTime()/ns<<G4endl;
}
}

}

if (nVerboseLevel > 1)
G4cout<<"[GateCoincidenceSorter::Digitize] Analyzing the presort buffer..."<<G4endl;

// once buffer reaches the specified size look for coincidences
for(G4int i = m_presortBuffer.size();i > m_presortBufferSize;i--)
Expand Down Expand Up @@ -375,6 +394,13 @@ void GateCoincidenceSorter::Digitize()
delete digi;
}

if (nVerboseLevel>1) {
G4cout << "[GateCoincidenceSorter::Digitizer]: returning output coincidence digi collection with " << m_OutputCoincidenceDigiCollection->GetSize () << " entries\n";
//for (iter=m_OutputCoincidenceDigiCollection->begin(); iter!= m_OutputCoincidenceDigiCollection->end() ; ++iter)
//G4cout << **iter << Gateendl;
//G4cout << Gateendl;
}

StoreDigiCollection(m_OutputCoincidenceDigiCollection);
}

Expand Down
23 changes: 15 additions & 8 deletions source/digits_hits/src/GateOutputMgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,10 @@ GateOutputMgr::GateOutputMgr(const G4String name)
AddOutputModule((GateVOutputModule*)gateFastAnalysis);
}
#endif

if (m_digiMode==kruntimeMode) {
GateAnalysis* gateAnalysis = new GateAnalysis("analysis", this,m_digiMode);
//commented for offline digi by OK for GND feb 2026 if (m_digiMode==kruntimeMode) {
GateAnalysis* gateAnalysis = new GateAnalysis("analysis", this,m_digiMode);
AddOutputModule((GateVOutputModule*)gateAnalysis);

}
//}


#ifdef G4ANALYSIS_USE_FILE
Expand Down Expand Up @@ -160,7 +158,6 @@ GateVOutputModule* GateOutputMgr::FindOutputModule(G4String name)
for(G4int i=0;i<int(m_outputModules.size());i++)
{
G4String moduleName = m_outputModules[i]->GetName();
//G4cout << moduleName << " "<< name<< G4endl;
if(moduleName == name)
return m_outputModules[i];
}
Expand Down Expand Up @@ -262,14 +259,24 @@ void GateOutputMgr::RecordBeginOfAcquisition()
G4cout << "GateOutputMgr::RecordBeginOfAcquisition\n";
//OK GND
GateDigitizerMgr* digitizerMgr=GateDigitizerMgr::GetInstance();
/*if (m_digiMode==kruntimeMode)
{*/
if((digitizerMgr->m_recordSingles|| digitizerMgr->m_recordCoincidences)
&& !this->FindOutputModule("analysis")->IsEnabled()
&& !this->FindOutputModule("fastanalysis")->IsEnabled())
{
GateError("***ERROR*** Digitizer Manager is not initialized properly. Please, enable analysis or fastanalysis Output Modules to write down Singles or Coincidences.\n Use, /gate/output/analysis/enable or /gate/output/fastanalysis/enable.\n");
}


/*}
else
{
G4cout<<"**************************"<<digitizerMgr->m_recordSingles << " "<< digitizerMgr->m_recordCoincidences<<G4endl;
if(!digitizerMgr->m_recordSingles|| !digitizerMgr->m_recordCoincidences)
{
GateError("***ERROR: Digi MODE *** Digitizer Manager is not initialized properly. The output flag is set to 0 for both Signles and Coincidences. \n");
}
}
*/
#ifdef G4ANALYSIS_USE_ROOT
if (m_digiMode==kofflineMode)
GateHitFileReader::GetInstance()->PrepareAcquisition();
Expand Down
Loading