Skip to content
Snippets Groups Projects
Commit 86f8b581 authored by Volker Friese's avatar Volker Friese Committed by David Emschermann
Browse files

Changed specification of number of timeslices to process. Adjust timeslice counter.

parent a0f9dd42
No related branches found
No related tags found
1 merge request!768Execution of reconstruction from timeslice with steering class and minimal run macro. Refs #2275.
Pipeline #16601 passed
...@@ -22,8 +22,8 @@ using std::string; ...@@ -22,8 +22,8 @@ using std::string;
** @author Volker Friese <v.friese@gsi.de> ** @author Volker Friese <v.friese@gsi.de>
** @since 12 March 2022 ** @since 12 March 2022
** @param tsaFile Name of input file (w/o extension .tsa) ** @param tsaFile Name of input file (w/o extension .tsa)
** @param numTs Number of timeslice to process. If -1, all available will be used.
** @param outFile Name of output file (w/o extension .digi.root) ** @param outFile Name of output file (w/o extension .digi.root)
** @param numTs Number of timeslices to process. If not specified, all available will be used.
** **
** Reconstruction from timeslice level, making use of the steering class CbmReco. ** Reconstruction from timeslice level, making use of the steering class CbmReco.
** Currently included stages: ** Currently included stages:
...@@ -36,7 +36,7 @@ using std::string; ...@@ -36,7 +36,7 @@ using std::string;
** the extension .tsa by .digi.root ** the extension .tsa by .digi.root
**/ **/
void reco_steer(TString tsaFile = "", int32_t numTs = -1, TString outFile = "") void reco_steer(TString tsaFile = "", TString outFile = "", int32_t numTs = std::numeric_limits<int32_t>::max())
{ {
// ======================================================================== // ========================================================================
......
...@@ -129,19 +129,22 @@ int32_t CbmReco::Run() ...@@ -129,19 +129,22 @@ int32_t CbmReco::Run()
// --- Run log // --- Run log
std::cout << std::endl; std::cout << std::endl;
auto src = dynamic_cast<CbmSourceTs*>(run.GetSource());
assert(src);
size_t numTs = src->GetNumTs();
double timeTotal = timeSetup + timeInit + timeRun; double timeTotal = timeSetup + timeInit + timeRun;
LOG(info) << "====================================="; LOG(info) << "=====================================";
LOG(info) << "Reco: Run summary"; LOG(info) << "Reco: Run summary";
LOG(info) << "Timeslices : " << fNumTs; LOG(info) << "Timeslices : " << numTs;
LOG(info) << "Time setup : " << timeSetup << " s"; LOG(info) << "Time setup : " << timeSetup << " s";
LOG(info) << "Time init : " << timeInit << " s"; LOG(info) << "Time init : " << timeInit << " s";
LOG(info) << "Time run : " << timeRun << " s"; LOG(info) << "Time run : " << timeRun << " s";
LOG(info) << "Time total : " << timeTotal << " s" LOG(info) << "Time total : " << timeTotal << " s"
<< " (" << timeTotal / fNumTs << " s/ts)"; << " (" << timeTotal / numTs << " s/ts)";
LOG(info) << "Output file : " << fOutputFileName; LOG(info) << "Output file : " << fOutputFileName;
LOG(info) << "====================================="; LOG(info) << "=====================================";
return fNumTs; return numTs;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
......
...@@ -95,9 +95,9 @@ public: ...@@ -95,9 +95,9 @@ public:
private: private:
std::vector<std::string> fSourceNames = {}; ///< Sources (input files or stream) std::vector<std::string> fSourceNames = {}; ///< Sources (input files or stream)
TString fOutputFileName = ""; TString fOutputFileName = ""; ///< Output file
int32_t fNumTs = -1; int32_t fNumTs = 0; ///< Number of timeslices to process
CbmRecoConfig fConfig = {}; CbmRecoConfig fConfig = {}; ///< Configuration parameters
ClassDef(CbmReco, 1); ClassDef(CbmReco, 1);
}; };
......
...@@ -54,15 +54,22 @@ Bool_t CbmSourceTs::Init() ...@@ -54,15 +54,22 @@ Bool_t CbmSourceTs::Init()
// ----- Read one time slice from archive --------------------------------- // ----- Read one time slice from archive ---------------------------------
Int_t CbmSourceTs::ReadEvent(UInt_t) Int_t CbmSourceTs::ReadEvent(UInt_t)
{ {
// Timeslices can only be read sequentially, so the argument is ignored.
// It appears that the first call to this method from FairRunOnline is in the
// init stage. In order not to always lose the first timeslice, a call to
// TimesliceSource::get is avoided in the first call.
std::cout << std::endl; std::cout << std::endl;
fFlesTs = fFlesSource->get(); if (fNumCalls == 0) LOG(info) << "SourceTs: Init call to ReadEvent";
if (!fFlesTs) { else {
LOG(info) << "SourceTs: End of archive reached; stopping run."; fFlesTs = fFlesSource->get();
return 1; if (!fFlesTs) {
LOG(info) << "SourceTs: End of archive reached; stopping run.";
return 1;
}
LOG(info) << "SourceTs: Reading time slice " << GetNumTs() << " (index " << fFlesTs->index()
<< ") at t = " << fFlesTs->start_time() << " ns";
} }
LOG(info) << "SourceTs: Reading time slice " << fNumTs << " (index " << fFlesTs->index() fNumCalls++;
<< ") at t = " << fFlesTs->start_time() << " ns";
fNumTs++;
return 0; return 0;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
......
...@@ -64,6 +64,14 @@ public: ...@@ -64,6 +64,14 @@ public:
virtual void Close(); virtual void Close();
/** @brief Number of processed timeslices
** @return Number of timeslices
**
** The first call to ReadEvent is in Init, so not timeslice is processed.
**/
size_t GetNumTs() const { return fNumCalls - 1; }
/** @brief Demanded by base class **/ /** @brief Demanded by base class **/
virtual Source_Type GetSourceType() { return kFILE; } virtual Source_Type GetSourceType() { return kFILE; }
...@@ -111,8 +119,8 @@ private: // member variables ...@@ -111,8 +119,8 @@ private: // member variables
/** Pointer to current time slice **/ /** Pointer to current time slice **/
std::unique_ptr<fles::Timeslice> fFlesTs = nullptr; //! std::unique_ptr<fles::Timeslice> fFlesTs = nullptr; //!
/** Time-slice counter **/ /** ReadEvent call counter **/
size_t fNumTs = 0; size_t fNumCalls = 0;
ClassDef(CbmSourceTs, 1) ClassDef(CbmSourceTs, 1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment