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
4 changes: 4 additions & 0 deletions fairroot/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ endif()

fair_change_extensions_if_exists(.cxx .h FILES "${sources}" OUTVAR headers)

list(APPEND headers
steer/FairTypes.h
)

add_library(${target} SHARED ${sources} ${headers})
fairroot_library_settings(${target})

Expand Down
30 changes: 24 additions & 6 deletions fairroot/base/steer/FairRun.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

TMCThreadLocal FairRun* FairRun::fRunInstance = nullptr;

FairRun* FairRun::Instance() { return fRunInstance; }
FairRun* FairRun::Instance()
{
return fRunInstance;
}

FairRun::FairRun(Bool_t isMaster)
: TNamed()
Expand Down Expand Up @@ -137,7 +140,10 @@ void FairRun::SetTask(FairTask* task)
}
}

void FairRun::CreateGeometryFile(const char* geofile) { fRootManager->CreateGeometryFile(geofile); }
void FairRun::CreateGeometryFile(const char* geofile)
{
fRootManager->CreateGeometryFile(geofile);
}

FairTask* FairRun::GetTask(const char* taskName)
{
Expand All @@ -154,7 +160,10 @@ FairEventHeader* FairRun::GetEventHeader()
return fEvtHeader;
}

void FairRun::SetUseFairLinks(Bool_t val) { fRootManager->SetUseFairLinks(val); }
void FairRun::SetUseFairLinks(Bool_t val)
{
fRootManager->SetUseFairLinks(val);
}

void FairRun::SetWriteRunInfoFile(Bool_t write)
{
Expand Down Expand Up @@ -221,11 +230,20 @@ TFile* FairRun::GetOutputFile()
return rootFileSink->GetRootFile();
}

void FairRun::SetUserOutputFileName(const TString& name) { fUserOutputFileName = name; }
void FairRun::SetUserOutputFileName(const TString& name)
{
fUserOutputFileName = name;
}

TString FairRun::GetUserOutputFileName() const { return fUserOutputFileName; }
TString FairRun::GetUserOutputFileName() const
{
return fUserOutputFileName;
}

void FairRun::AlignGeometry() const { fAlignmentHandler.AlignGeometry(); }
void FairRun::AlignGeometry() const
{
fAlignmentHandler.AlignGeometry();
}

void FairRun::AddAlignmentMatrices(const std::map<std::string, TGeoHMatrix>& alignmentMatrices, bool invertMatrices)
{
Expand Down
3 changes: 2 additions & 1 deletion fairroot/base/steer/FairRun.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "FairLinkManager.h"
#include "FairSink.h"
#include "FairSource.h"
#include "FairTypes.h"

#include <Rtypes.h> // for Int_t, Bool_t, etc
#include <TFile.h> //
Expand Down Expand Up @@ -70,7 +71,7 @@ class FairRun : public TNamed
/**
* run the analysis or simulation
*/
virtual void Run(Int_t NStart = 0, Int_t NStop = 0) = 0;
virtual void Run(FairRoot::EntryID NEntry = 0, int NStop = 0) = 0;
/**
* Set the experiment dependent run header
* for each run
Expand Down
93 changes: 48 additions & 45 deletions fairroot/base/steer/FairRunAna.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ void FRA_handler_ctrlc(int)
//_____________________________________________________________________________
FairRunAna* FairRunAna::fgRinstance = nullptr;
//_____________________________________________________________________________
FairRunAna* FairRunAna::Instance() { return fgRinstance; }
FairRunAna* FairRunAna::Instance()
{
return fgRinstance;
}
//_____________________________________________________________________________
FairRunAna::FairRunAna()
: FairRun()
Expand Down Expand Up @@ -273,7 +276,7 @@ void FairRunAna::Init()
//_____________________________________________________________________________

//_____________________________________________________________________________
void FairRunAna::Run(Int_t Ev_start, Int_t Ev_end)
void FairRunAna::Run(FairRoot::EntryID NEntry, int NStop)
{
gFRAIsInterrupted = kFALSE;

Expand All @@ -282,35 +285,35 @@ void FairRunAna::Run(Int_t Ev_start, Int_t Ev_end)
} else {
// if (fInputFile==0) {
if (!fInFileIsOpen) {
DummyRun(Ev_start, Ev_end);
DummyRun(NEntry, NStop);
return;
}

Int_t MaxAllowed = fRootManager->CheckMaxEventNo(Ev_end);
if (MaxAllowed != -1) {
if (Ev_end == 0) {
if (Ev_start == 0) {
Ev_end = MaxAllowed;
FairRoot::EntryID MaxAllowed = fRootManager->CheckMaxEventNo(NStop);
if (MaxAllowed != FairRoot::EntryID::None) {
if (NStop == 0) {
if (NEntry == 0) {
NStop = MaxAllowed;
} else {
Ev_end = Ev_start;
if (Ev_end > MaxAllowed) {
Ev_end = MaxAllowed;
NStop = NEntry;
if (NStop > MaxAllowed) {
NStop = MaxAllowed;
}
Ev_start = 0;
NEntry = 0;
}
} else {
if (Ev_end > MaxAllowed) {
if (NStop > MaxAllowed) {
cout << "-------------------Warning---------------------------" << endl;
cout << " -W FairRunAna : File has less events than requested!!" << endl;
cout << " File contains : " << MaxAllowed << " Events" << endl;
cout << " Requested number of events = " << Ev_end << " Events" << endl;
cout << " The number of events is set to " << MaxAllowed << " Events" << endl;
cout << " -W FairRunAna : File has less entries than requested!!" << endl;
cout << " File contains : " << MaxAllowed << " entries" << endl;
cout << " Requested number of entries = " << NStop << " entries" << endl;
cout << " The number of entries is set to " << MaxAllowed << " entries" << endl;
cout << "-----------------------------------------------------" << endl;
Ev_end = MaxAllowed;
NStop = MaxAllowed;
}
}
LOG(info) << "FairRunAna::Run() After checking, the run will run from event " << Ev_start << " to "
<< Ev_end << ".";
LOG(info) << "FairRunAna::Run() After checking, the run will run from entry " << NEntry << " to " << NStop
<< ".";
} else {
LOG(info) << "FairRunAna::Run() continue running without stop";
}
Expand All @@ -321,7 +324,7 @@ void FairRunAna::Run(Int_t Ev_start, Int_t Ev_end)

Int_t readEventReturn = 0;

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

gSystem->IgnoreInterrupt();
// gFRAIsInterrupted = kFALSE;
Expand Down Expand Up @@ -377,34 +380,34 @@ void FairRunAna::Run(Int_t Ev_start, Int_t Ev_end)
//_____________________________________________________________________________

//_____________________________________________________________________________
void FairRunAna::RunEventReco(Int_t Ev_start, Int_t Ev_end)
void FairRunAna::RunEventReco(FairRoot::EntryID NEntry, Int_t NStop)
{
UInt_t tmpId = 0;

Int_t MaxAllowed = fRootManager->CheckMaxEventNo(Ev_end);
if (MaxAllowed != -1) {
if (Ev_end == 0) {
if (Ev_start == 0) {
Ev_end = MaxAllowed;
Int_t MaxAllowed = fRootManager->CheckMaxEventNo(NStop);
if (MaxAllowed != FairRoot::EntryID::None) {
if (NStop == 0) {
if (NEntry == 0) {
NStop = MaxAllowed;
} else {
Ev_end = Ev_start;
if (Ev_end > MaxAllowed) {
Ev_end = MaxAllowed;
NStop = NEntry;
if (NStop > MaxAllowed) {
NStop = MaxAllowed;
}
Ev_start = 0;
NEntry = 0;
}
} else {
if (Ev_end > MaxAllowed) {
if (NStop > MaxAllowed) {
cout << "-------------------Warning---------------------------" << endl;
cout << " -W FairRunAna : File has less events than requested!!" << endl;
cout << " File contains : " << MaxAllowed << " Events" << endl;
cout << " Requested number of events = " << Ev_end << " Events" << endl;
cout << " The number of events is set to " << MaxAllowed << " Events" << endl;
cout << " -W FairRunAna : File has less entries than requested!!" << endl;
cout << " File contains : " << MaxAllowed << " entries" << endl;
cout << " Requested number of entries = " << NStop << " entries" << endl;
cout << " The number of entries is set to " << MaxAllowed << " entries" << endl;
cout << "-----------------------------------------------------" << endl;
Ev_end = MaxAllowed;
NStop = MaxAllowed;
}
}
LOG(info) << "FairRunAna::Run() After checking, the run will run from event " << Ev_start << " to " << Ev_end
LOG(info) << "FairRunAna::Run() After checking, the run will run from entry " << NEntry << " to " << NStop
<< ".";
} else {
LOG(info) << "FairRunAna::Run() continue running without stop";
Expand All @@ -414,7 +417,7 @@ void FairRunAna::RunEventReco(Int_t Ev_start, Int_t Ev_end)
fRunInfo.Reset();
}

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

//_____________________________________________________________________________
void FairRunAna::RunMQ(Long64_t entry)
void FairRunAna::RunMQ(FairRoot::EntryID entry)
{
/**
This methode is only needed and used with ZeroMQ
it read a certain event and call the task exec, but no output is written
it read a certain entry and call the task exec, but no output is written
*/
fRootManager->ReadEvent(entry);
auto const tmpId = GetEvtHeaderRunId();
Expand All @@ -497,7 +500,7 @@ void FairRunAna::RunMQ(Long64_t entry)
//_____________________________________________________________________________

//_____________________________________________________________________________
void FairRunAna::Run(Long64_t entry)
void FairRunAna::RunSingle(FairRoot::EntryID entry)
{
fRootManager->ReadEvent(entry);
auto const tmpId = GetEvtHeaderRunId();
Expand Down Expand Up @@ -547,7 +550,7 @@ void FairRunAna::RunTSBuffers()
//_____________________________________________________________________________
//_____________________________________________________________________________

void FairRunAna::RunOnLmdFiles(UInt_t NStart, UInt_t NStop)
void FairRunAna::RunOnLmdFiles(FairRoot::EntryID NStart, FairRoot::EntryID NStop)
{
if (NStart == 0 && NStop == 0) {
NStart = 0;
Expand Down Expand Up @@ -582,10 +585,10 @@ void FairRunAna::RunOnTBData()
fRootManager->Write();
}
//_____________________________________________________________________________
void FairRunAna::DummyRun(Int_t Ev_start, Int_t Ev_end)
void FairRunAna::DummyRun(FairRoot::EntryID NStart, FairRoot::EntryID NStop)
{
/** This methode is just for testing, if you are not sure about what you do, don't use it */
for (int i = Ev_start; i < Ev_end; i++) {
for (FairRoot::EntryID i = NStart; i < NStop; i++) {
fTask->ExecuteTask("");
FillEventHeader();
Fill();
Expand Down
27 changes: 18 additions & 9 deletions fairroot/base/steer/FairRunAna.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,34 @@ class FairRunAna : public FairRun
FairRunAna();
/**initialize the run manager*/
void Init() override;
/**Run from event number NStart to event number NStop */
void Run(Int_t NStart = 0, Int_t NStop = 0) override;
/**Run analysis:
* for the whole input if NEntry == NStop == 0,
* for NEntry entries if NStop == 0,
* from NEntry until NStop entry is reached
* from NEntry to the end of input, if NStop = -1 */
void Run(FairRoot::EntryID NEntry = 0, int NStop = 0) override;
/**Run over the whole input file with timpe window delta_t as unit (entry)*/
void Run(Double_t delta_t);
/** \deprecated Deprecated in v19, will be removed in v20. */
[[deprecated("Replaced by RunSingle(), which has an unambiguous name")]] void Run(Long64_t entry)
{
RunSingle(entry);
}
/**Run for the given single entry*/
void Run(Long64_t entry);
/**Run event reconstruction from event number NStart to event number NStop */
void RunEventReco(Int_t NStart, Int_t NStop);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also should deprecated the int, int overloads first before removing them, right?

void RunSingle(FairRoot::EntryID entry);
/**Run event reconstruction from entry number NEntry to entry number NStop */
void RunEventReco(FairRoot::EntryID NEntry, Int_t NStop);
/**Run over all TSBuffers until the data is processed*/
void RunTSBuffers();
/** the dummy run does not check the evt header or the parameters!! */
void DummyRun(Int_t NStart, Int_t NStop);
void DummyRun(FairRoot::EntryID NStart, FairRoot::EntryID NStop);
/** This methode is only needed and used with ZeroMQ
* it read a certain event and call the task exec, but no output is written
* it read a certain entry and call the task exec, but no output is written
* @param entry : entry number in the tree
*/
void RunMQ(Long64_t entry);
void RunMQ(FairRoot::EntryID entry);
/** Run on a list of lmd files*/
void RunOnLmdFiles(UInt_t NStart = 0, UInt_t NStop = 0);
void RunOnLmdFiles(FairRoot::EntryID NStart = 0, FairRoot::EntryID NStop = 0);

void RunOnTBData();
/** finish tasks, write output*/
Expand Down
13 changes: 8 additions & 5 deletions fairroot/base/steer/FairRunAnaProof.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@

FairRunAnaProof* FairRunAnaProof::fRAPInstance = nullptr;

FairRunAnaProof* FairRunAnaProof::Instance() { return fRAPInstance; }
FairRunAnaProof* FairRunAnaProof::Instance()
{
return fRAPInstance;
}

FairRunAnaProof::FairRunAnaProof(const char* proofName)
: FairRunAna()
Expand Down Expand Up @@ -262,13 +265,13 @@ void FairRunAnaProof::SetSource(FairSource* tempSource)
fProofFileSource = static_cast<FairFileSource*>(tempSource);
}

void FairRunAnaProof::Run(Int_t Ev_start, Int_t Ev_end)
void FairRunAnaProof::Run(FairRoot::EntryID NEntry, int NStop)
{
RunOnProof(Ev_start, Ev_end);
RunOnProof(NEntry, NStop);
return;
}

void FairRunAnaProof::RunOneEvent(Long64_t entry)
void FairRunAnaProof::RunOneEvent(FairRoot::EntryID entry)
{
if (fTimeStamps) {
RunTSBuffers();
Expand All @@ -294,7 +297,7 @@ void FairRunAnaProof::RunOneEvent(Long64_t entry)
}
}

void FairRunAnaProof::RunOnProof(Int_t NStart, Int_t NStop)
void FairRunAnaProof::RunOnProof(FairRoot::EntryID NStart, int NStop)
{
fProofOutputStatus.ToLower();
if (!fProofOutputStatus.Contains("copy") && !fProofOutputStatus.Contains("merge")) {
Expand Down
12 changes: 6 additions & 6 deletions fairroot/base/steer/FairRunAnaProof.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ class FairRunAnaProof : public FairRunAna
/** Init containers executed on PROOF, which is part of Init when running locally*/
void InitContainers();

/**Run from event number NStart to event number NStop */
void Run(Int_t NStart = 0, Int_t NStop = 0) override;
/**Run for one event, used on PROOF nodes*/
void RunOneEvent(Long64_t entry);
/**Run on proof from event NStart to event NStop*/
void RunOnProof(Int_t NStart, Int_t NStop);
/**Run from entry number NEntry to entry number NStop */
void Run(FairRoot::EntryID NEntry = 0, int NStop = 0) override;
/**Run for one entry, used on PROOF nodes*/
void RunOneEvent(FairRoot::EntryID entry);
/**Run on proof from entry NStart to entry NStop*/
void RunOnProof(FairRoot::EntryID NStart, int NStop);

/** set the input tree of fRootManager when running on PROOF worker*/
/* void SetInTree (TTree* tempTree) { */
Expand Down
2 changes: 1 addition & 1 deletion fairroot/base/steer/FairRunSim.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ void FairRunSim::SetMCConfig()
}
}

void FairRunSim::Run(Int_t NEvents, Int_t)
void FairRunSim::Run(FairRoot::EntryID NEvents, int)
{
fApp->RunMC(NEvents);
fWasMT = fApp->GetIsMT();
Expand Down
2 changes: 1 addition & 1 deletion fairroot/base/steer/FairRunSim.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class FairRunSim : public FairRun
/**
* run the simulation
*/
void Run(Int_t NEvents = 0, Int_t NotUsed = 0) override;
void Run(FairRoot::EntryID NEvents = 0, int NotUsed = 0) override;
/**
* Set the magnetic that has to be used for simulation field
*/
Expand Down
Loading