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;
** @author Volker Friese <v.friese@gsi.de>
** @since 12 March 2022
** @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 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.
** Currently included stages:
......@@ -36,7 +36,7 @@ using std::string;
** 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()
// --- Run log
std::cout << std::endl;
auto src = dynamic_cast<CbmSourceTs*>(run.GetSource());
assert(src);
size_t numTs = src->GetNumTs();
double timeTotal = timeSetup + timeInit + timeRun;
LOG(info) << "=====================================";
LOG(info) << "Reco: Run summary";
LOG(info) << "Timeslices : " << fNumTs;
LOG(info) << "Timeslices : " << numTs;
LOG(info) << "Time setup : " << timeSetup << " s";
LOG(info) << "Time init : " << timeInit << " s";
LOG(info) << "Time run : " << timeRun << " s";
LOG(info) << "Time total : " << timeTotal << " s"
<< " (" << timeTotal / fNumTs << " s/ts)";
<< " (" << timeTotal / numTs << " s/ts)";
LOG(info) << "Output file : " << fOutputFileName;
LOG(info) << "=====================================";
return fNumTs;
return numTs;
}
// ----------------------------------------------------------------------------
......
......@@ -95,9 +95,9 @@ public:
private:
std::vector<std::string> fSourceNames = {}; ///< Sources (input files or stream)
TString fOutputFileName = "";
int32_t fNumTs = -1;
CbmRecoConfig fConfig = {};
TString fOutputFileName = ""; ///< Output file
int32_t fNumTs = 0; ///< Number of timeslices to process
CbmRecoConfig fConfig = {}; ///< Configuration parameters
ClassDef(CbmReco, 1);
};
......
......@@ -54,15 +54,22 @@ Bool_t CbmSourceTs::Init()
// ----- Read one time slice from archive ---------------------------------
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;
fFlesTs = fFlesSource->get();
if (!fFlesTs) {
LOG(info) << "SourceTs: End of archive reached; stopping run.";
return 1;
if (fNumCalls == 0) LOG(info) << "SourceTs: Init call to ReadEvent";
else {
fFlesTs = fFlesSource->get();
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()
<< ") at t = " << fFlesTs->start_time() << " ns";
fNumTs++;
fNumCalls++;
return 0;
}
// ----------------------------------------------------------------------------
......
......@@ -64,6 +64,14 @@ public:
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 **/
virtual Source_Type GetSourceType() { return kFILE; }
......@@ -111,8 +119,8 @@ private: // member variables
/** Pointer to current time slice **/
std::unique_ptr<fles::Timeslice> fFlesTs = nullptr; //!
/** Time-slice counter **/
size_t fNumTs = 0;
/** ReadEvent call counter **/
size_t fNumCalls = 0;
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