Skip to content

Commit b7402a6

Browse files
committed
Use EntryID type in FairRun and derived classes
Replaced `Int_t` with the new type `EntryID` in `FairRun` and derived classes. Depracated `void FairRunAna::Run(Long64_t entry)`, which internally calls introduced `void RunSingle(FairRoot::EntryID entry);`.
1 parent 600333f commit b7402a6

File tree

10 files changed

+116
-84
lines changed

10 files changed

+116
-84
lines changed

fairroot/base/steer/FairRun.cxx

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232

3333
TMCThreadLocal FairRun* FairRun::fRunInstance = nullptr;
3434

35-
FairRun* FairRun::Instance() { return fRunInstance; }
35+
FairRun* FairRun::Instance()
36+
{
37+
return fRunInstance;
38+
}
3639

3740
FairRun::FairRun(Bool_t isMaster)
3841
: TNamed()
@@ -137,7 +140,10 @@ void FairRun::SetTask(FairTask* task)
137140
}
138141
}
139142

140-
void FairRun::CreateGeometryFile(const char* geofile) { fRootManager->CreateGeometryFile(geofile); }
143+
void FairRun::CreateGeometryFile(const char* geofile)
144+
{
145+
fRootManager->CreateGeometryFile(geofile);
146+
}
141147

142148
FairTask* FairRun::GetTask(const char* taskName)
143149
{
@@ -154,7 +160,10 @@ FairEventHeader* FairRun::GetEventHeader()
154160
return fEvtHeader;
155161
}
156162

157-
void FairRun::SetUseFairLinks(Bool_t val) { fRootManager->SetUseFairLinks(val); }
163+
void FairRun::SetUseFairLinks(Bool_t val)
164+
{
165+
fRootManager->SetUseFairLinks(val);
166+
}
158167

159168
void FairRun::SetWriteRunInfoFile(Bool_t write)
160169
{
@@ -221,11 +230,20 @@ TFile* FairRun::GetOutputFile()
221230
return rootFileSink->GetRootFile();
222231
}
223232

224-
void FairRun::SetUserOutputFileName(const TString& name) { fUserOutputFileName = name; }
233+
void FairRun::SetUserOutputFileName(const TString& name)
234+
{
235+
fUserOutputFileName = name;
236+
}
225237

226-
TString FairRun::GetUserOutputFileName() const { return fUserOutputFileName; }
238+
TString FairRun::GetUserOutputFileName() const
239+
{
240+
return fUserOutputFileName;
241+
}
227242

228-
void FairRun::AlignGeometry() const { fAlignmentHandler.AlignGeometry(); }
243+
void FairRun::AlignGeometry() const
244+
{
245+
fAlignmentHandler.AlignGeometry();
246+
}
229247

230248
void FairRun::AddAlignmentMatrices(const std::map<std::string, TGeoHMatrix>& alignmentMatrices, bool invertMatrices)
231249
{

fairroot/base/steer/FairRun.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "FairLinkManager.h"
1414
#include "FairSink.h"
1515
#include "FairSource.h"
16+
#include "FairTypes.h"
1617

1718
#include <Rtypes.h> // for Int_t, Bool_t, etc
1819
#include <TFile.h> //
@@ -70,7 +71,7 @@ class FairRun : public TNamed
7071
/**
7172
* run the analysis or simulation
7273
*/
73-
virtual void Run(Int_t NStart = 0, Int_t NStop = 0) = 0;
74+
virtual void Run(FairRoot::EntryID NEntry = 0, int NStop = 0) = 0;
7475
/**
7576
* Set the experiment dependent run header
7677
* for each run

fairroot/base/steer/FairRunAna.cxx

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ void FRA_handler_ctrlc(int)
5959
//_____________________________________________________________________________
6060
FairRunAna* FairRunAna::fgRinstance = nullptr;
6161
//_____________________________________________________________________________
62-
FairRunAna* FairRunAna::Instance() { return fgRinstance; }
62+
FairRunAna* FairRunAna::Instance()
63+
{
64+
return fgRinstance;
65+
}
6366
//_____________________________________________________________________________
6467
FairRunAna::FairRunAna()
6568
: FairRun()
@@ -273,7 +276,7 @@ void FairRunAna::Init()
273276
//_____________________________________________________________________________
274277

275278
//_____________________________________________________________________________
276-
void FairRunAna::Run(Int_t Ev_start, Int_t Ev_end)
279+
void FairRunAna::Run(FairRoot::EntryID NEntry, int NStop)
277280
{
278281
gFRAIsInterrupted = kFALSE;
279282

@@ -282,35 +285,35 @@ void FairRunAna::Run(Int_t Ev_start, Int_t Ev_end)
282285
} else {
283286
// if (fInputFile==0) {
284287
if (!fInFileIsOpen) {
285-
DummyRun(Ev_start, Ev_end);
288+
DummyRun(NEntry, NStop);
286289
return;
287290
}
288291

289-
Int_t MaxAllowed = fRootManager->CheckMaxEventNo(Ev_end);
290-
if (MaxAllowed != -1) {
291-
if (Ev_end == 0) {
292-
if (Ev_start == 0) {
293-
Ev_end = MaxAllowed;
292+
FairRoot::EntryID MaxAllowed = fRootManager->CheckMaxEventNo(NStop);
293+
if (MaxAllowed != FairRoot::EntryID::None) {
294+
if (NStop == 0) {
295+
if (NEntry == 0) {
296+
NStop = MaxAllowed;
294297
} else {
295-
Ev_end = Ev_start;
296-
if (Ev_end > MaxAllowed) {
297-
Ev_end = MaxAllowed;
298+
NStop = NEntry;
299+
if (NStop > MaxAllowed) {
300+
NStop = MaxAllowed;
298301
}
299-
Ev_start = 0;
302+
NEntry = 0;
300303
}
301304
} else {
302-
if (Ev_end > MaxAllowed) {
305+
if (NStop > MaxAllowed) {
303306
cout << "-------------------Warning---------------------------" << endl;
304-
cout << " -W FairRunAna : File has less events than requested!!" << endl;
305-
cout << " File contains : " << MaxAllowed << " Events" << endl;
306-
cout << " Requested number of events = " << Ev_end << " Events" << endl;
307-
cout << " The number of events is set to " << MaxAllowed << " Events" << endl;
307+
cout << " -W FairRunAna : File has less entries than requested!!" << endl;
308+
cout << " File contains : " << MaxAllowed << " entries" << endl;
309+
cout << " Requested number of entries = " << NStop << " entries" << endl;
310+
cout << " The number of entries is set to " << MaxAllowed << " entries" << endl;
308311
cout << "-----------------------------------------------------" << endl;
309-
Ev_end = MaxAllowed;
312+
NStop = MaxAllowed;
310313
}
311314
}
312-
LOG(info) << "FairRunAna::Run() After checking, the run will run from event " << Ev_start << " to "
313-
<< Ev_end << ".";
315+
LOG(info) << "FairRunAna::Run() After checking, the run will run from entry " << NEntry << " to " << NStop
316+
<< ".";
314317
} else {
315318
LOG(info) << "FairRunAna::Run() continue running without stop";
316319
}
@@ -321,7 +324,7 @@ void FairRunAna::Run(Int_t Ev_start, Int_t Ev_end)
321324

322325
Int_t readEventReturn = 0;
323326

324-
for (int i = Ev_start; i < Ev_end || MaxAllowed == -1; i++) {
327+
for (FairRoot::EntryID i = NEntry; i < NStop || MaxAllowed == -1; i++) {
325328

326329
gSystem->IgnoreInterrupt();
327330
// gFRAIsInterrupted = kFALSE;
@@ -377,34 +380,34 @@ void FairRunAna::Run(Int_t Ev_start, Int_t Ev_end)
377380
//_____________________________________________________________________________
378381

379382
//_____________________________________________________________________________
380-
void FairRunAna::RunEventReco(Int_t Ev_start, Int_t Ev_end)
383+
void FairRunAna::RunEventReco(FairRoot::EntryID NEntry, Int_t NStop)
381384
{
382385
UInt_t tmpId = 0;
383386

384-
Int_t MaxAllowed = fRootManager->CheckMaxEventNo(Ev_end);
385-
if (MaxAllowed != -1) {
386-
if (Ev_end == 0) {
387-
if (Ev_start == 0) {
388-
Ev_end = MaxAllowed;
387+
Int_t MaxAllowed = fRootManager->CheckMaxEventNo(NStop);
388+
if (MaxAllowed != FairRoot::EntryID::None) {
389+
if (NStop == 0) {
390+
if (NEntry == 0) {
391+
NStop = MaxAllowed;
389392
} else {
390-
Ev_end = Ev_start;
391-
if (Ev_end > MaxAllowed) {
392-
Ev_end = MaxAllowed;
393+
NStop = NEntry;
394+
if (NStop > MaxAllowed) {
395+
NStop = MaxAllowed;
393396
}
394-
Ev_start = 0;
397+
NEntry = 0;
395398
}
396399
} else {
397-
if (Ev_end > MaxAllowed) {
400+
if (NStop > MaxAllowed) {
398401
cout << "-------------------Warning---------------------------" << endl;
399-
cout << " -W FairRunAna : File has less events than requested!!" << endl;
400-
cout << " File contains : " << MaxAllowed << " Events" << endl;
401-
cout << " Requested number of events = " << Ev_end << " Events" << endl;
402-
cout << " The number of events is set to " << MaxAllowed << " Events" << endl;
402+
cout << " -W FairRunAna : File has less entries than requested!!" << endl;
403+
cout << " File contains : " << MaxAllowed << " entries" << endl;
404+
cout << " Requested number of entries = " << NStop << " entries" << endl;
405+
cout << " The number of entries is set to " << MaxAllowed << " entries" << endl;
403406
cout << "-----------------------------------------------------" << endl;
404-
Ev_end = MaxAllowed;
407+
NStop = MaxAllowed;
405408
}
406409
}
407-
LOG(info) << "FairRunAna::Run() After checking, the run will run from event " << Ev_start << " to " << Ev_end
410+
LOG(info) << "FairRunAna::Run() After checking, the run will run from entry " << NEntry << " to " << NStop
408411
<< ".";
409412
} else {
410413
LOG(info) << "FairRunAna::Run() continue running without stop";
@@ -414,7 +417,7 @@ void FairRunAna::RunEventReco(Int_t Ev_start, Int_t Ev_end)
414417
fRunInfo.Reset();
415418
}
416419

417-
for (int i = Ev_start; i < Ev_end; i++) {
420+
for (FairRoot::EntryID i = NEntry; i < NStop; i++) {
418421
fRootManager->ReadEvent(i);
419422
/**
420423
* if we have simulation files then they have MC Event Header and the Run Id is in it, any way it
@@ -475,11 +478,11 @@ void FairRunAna::Run(Double_t delta_t)
475478
//_____________________________________________________________________________
476479

477480
//_____________________________________________________________________________
478-
void FairRunAna::RunMQ(Long64_t entry)
481+
void FairRunAna::RunMQ(FairRoot::EntryID entry)
479482
{
480483
/**
481484
This methode is only needed and used with ZeroMQ
482-
it read a certain event and call the task exec, but no output is written
485+
it read a certain entry and call the task exec, but no output is written
483486
*/
484487
fRootManager->ReadEvent(entry);
485488
auto const tmpId = GetEvtHeaderRunId();
@@ -497,7 +500,7 @@ void FairRunAna::RunMQ(Long64_t entry)
497500
//_____________________________________________________________________________
498501

499502
//_____________________________________________________________________________
500-
void FairRunAna::Run(Long64_t entry)
503+
void FairRunAna::RunSingle(FairRoot::EntryID entry)
501504
{
502505
fRootManager->ReadEvent(entry);
503506
auto const tmpId = GetEvtHeaderRunId();
@@ -547,7 +550,7 @@ void FairRunAna::RunTSBuffers()
547550
//_____________________________________________________________________________
548551
//_____________________________________________________________________________
549552

550-
void FairRunAna::RunOnLmdFiles(UInt_t NStart, UInt_t NStop)
553+
void FairRunAna::RunOnLmdFiles(FairRoot::EntryID NStart, FairRoot::EntryID NStop)
551554
{
552555
if (NStart == 0 && NStop == 0) {
553556
NStart = 0;
@@ -582,10 +585,10 @@ void FairRunAna::RunOnTBData()
582585
fRootManager->Write();
583586
}
584587
//_____________________________________________________________________________
585-
void FairRunAna::DummyRun(Int_t Ev_start, Int_t Ev_end)
588+
void FairRunAna::DummyRun(FairRoot::EntryID NStart, FairRoot::EntryID NStop)
586589
{
587590
/** This methode is just for testing, if you are not sure about what you do, don't use it */
588-
for (int i = Ev_start; i < Ev_end; i++) {
591+
for (FairRoot::EntryID i = NStart; i < NStop; i++) {
589592
fTask->ExecuteTask("");
590593
FillEventHeader();
591594
Fill();

fairroot/base/steer/FairRunAna.h

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,34 @@ class FairRunAna : public FairRun
3535
FairRunAna();
3636
/**initialize the run manager*/
3737
void Init() override;
38-
/**Run from event number NStart to event number NStop */
39-
void Run(Int_t NStart = 0, Int_t NStop = 0) override;
38+
/**Run analysis:
39+
* for the whole input if NEntry == NStop == 0,
40+
* for NEntry entries if NStop == 0,
41+
* from NEntry until NStop entry is reached
42+
* from NEntry to the end of input, if NStop = -1 */
43+
void Run(FairRoot::EntryID NEntry = 0, int NStop = 0) override;
4044
/**Run over the whole input file with timpe window delta_t as unit (entry)*/
4145
void Run(Double_t delta_t);
46+
/** \deprecated Deprecated in v19, will be removed in v20. */
47+
[[deprecated("Replaced by RunSingle(), which has an unambiguous name")]] void Run(Long64_t entry)
48+
{
49+
RunSingle(entry);
50+
}
4251
/**Run for the given single entry*/
43-
void Run(Long64_t entry);
44-
/**Run event reconstruction from event number NStart to event number NStop */
45-
void RunEventReco(Int_t NStart, Int_t NStop);
52+
void RunSingle(FairRoot::EntryID entry);
53+
/**Run event reconstruction from entry number NEntry to entry number NStop */
54+
void RunEventReco(FairRoot::EntryID NEntry, Int_t NStop);
4655
/**Run over all TSBuffers until the data is processed*/
4756
void RunTSBuffers();
4857
/** the dummy run does not check the evt header or the parameters!! */
49-
void DummyRun(Int_t NStart, Int_t NStop);
58+
void DummyRun(FairRoot::EntryID NStart, FairRoot::EntryID NStop);
5059
/** This methode is only needed and used with ZeroMQ
51-
* it read a certain event and call the task exec, but no output is written
60+
* it read a certain entry and call the task exec, but no output is written
5261
* @param entry : entry number in the tree
5362
*/
54-
void RunMQ(Long64_t entry);
63+
void RunMQ(FairRoot::EntryID entry);
5564
/** Run on a list of lmd files*/
56-
void RunOnLmdFiles(UInt_t NStart = 0, UInt_t NStop = 0);
65+
void RunOnLmdFiles(FairRoot::EntryID NStart = 0, FairRoot::EntryID NStop = 0);
5766

5867
void RunOnTBData();
5968
/** finish tasks, write output*/

fairroot/base/steer/FairRunAnaProof.cxx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232

3333
FairRunAnaProof* FairRunAnaProof::fRAPInstance = nullptr;
3434

35-
FairRunAnaProof* FairRunAnaProof::Instance() { return fRAPInstance; }
35+
FairRunAnaProof* FairRunAnaProof::Instance()
36+
{
37+
return fRAPInstance;
38+
}
3639

3740
FairRunAnaProof::FairRunAnaProof(const char* proofName)
3841
: FairRunAna()
@@ -262,13 +265,13 @@ void FairRunAnaProof::SetSource(FairSource* tempSource)
262265
fProofFileSource = static_cast<FairFileSource*>(tempSource);
263266
}
264267

265-
void FairRunAnaProof::Run(Int_t Ev_start, Int_t Ev_end)
268+
void FairRunAnaProof::Run(FairRoot::EntryID NEntry, int NStop)
266269
{
267-
RunOnProof(Ev_start, Ev_end);
270+
RunOnProof(NEntry, NStop);
268271
return;
269272
}
270273

271-
void FairRunAnaProof::RunOneEvent(Long64_t entry)
274+
void FairRunAnaProof::RunOneEvent(FairRoot::EntryID entry)
272275
{
273276
if (fTimeStamps) {
274277
RunTSBuffers();
@@ -294,7 +297,7 @@ void FairRunAnaProof::RunOneEvent(Long64_t entry)
294297
}
295298
}
296299

297-
void FairRunAnaProof::RunOnProof(Int_t NStart, Int_t NStop)
300+
void FairRunAnaProof::RunOnProof(FairRoot::EntryID NStart, int NStop)
298301
{
299302
fProofOutputStatus.ToLower();
300303
if (!fProofOutputStatus.Contains("copy") && !fProofOutputStatus.Contains("merge")) {

fairroot/base/steer/FairRunAnaProof.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ class FairRunAnaProof : public FairRunAna
3434
/** Init containers executed on PROOF, which is part of Init when running locally*/
3535
void InitContainers();
3636

37-
/**Run from event number NStart to event number NStop */
38-
void Run(Int_t NStart = 0, Int_t NStop = 0) override;
39-
/**Run for one event, used on PROOF nodes*/
40-
void RunOneEvent(Long64_t entry);
41-
/**Run on proof from event NStart to event NStop*/
42-
void RunOnProof(Int_t NStart, Int_t NStop);
37+
/**Run from entry number NEntry to entry number NStop */
38+
void Run(FairRoot::EntryID NEntry = 0, int NStop = 0) override;
39+
/**Run for one entry, used on PROOF nodes*/
40+
void RunOneEvent(FairRoot::EntryID entry);
41+
/**Run on proof from entry NStart to entry NStop*/
42+
void RunOnProof(FairRoot::EntryID NStart, int NStop);
4343

4444
/** set the input tree of fRootManager when running on PROOF worker*/
4545
/* void SetInTree (TTree* tempTree) { */

fairroot/base/steer/FairRunSim.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ void FairRunSim::SetMCConfig()
307307
}
308308
}
309309

310-
void FairRunSim::Run(Int_t NEvents, Int_t)
310+
void FairRunSim::Run(FairRoot::EntryID NEvents, int)
311311
{
312312
fApp->RunMC(NEvents);
313313
fWasMT = fApp->GetIsMT();

fairroot/base/steer/FairRunSim.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class FairRunSim : public FairRun
7272
/**
7373
* run the simulation
7474
*/
75-
void Run(Int_t NEvents = 0, Int_t NotUsed = 0) override;
75+
void Run(FairRoot::EntryID NEvents = 0, int NotUsed = 0) override;
7676
/**
7777
* Set the magnetic that has to be used for simulation field
7878
*/

0 commit comments

Comments
 (0)