31 #include <TCollection.h>
33 #include <TGeoManager.h>
36 #include <TObjArray.h>
39 #include <TSeqCollection.h>
53 LOG(info) <<
"*********** CTRL C PRESSED *************";
66 , fIsInitialized(kFALSE)
72 , fInFileIsOpen(kFALSE)
78 , fFinishProcessingLMDFile(kFALSE)
81 , fStoreEventHeader(kTRUE)
96 if (gROOT->GetVersionInt() >= 60602) {
97 gGeoManager->GetListOfVolumes()->Delete();
98 gGeoManager->GetListOfShapes()->Delete();
109 LOG(fatal) <<
"Geometry file has to be set before Run::Init !";
113 TFile* CurrentFile = gFile;
116 LOG(error) <<
"Error opening Geometry Input file";
119 LOG(info) <<
"Opening Geometry input file: " << GeoFileName;
131 LOG(fatal) <<
"Error Init is already called before!";
147 while ((key = dynamic_cast<TKey*>(next()))) {
148 if (strcmp(key->GetClassName(),
"TGeoManager") != 0) {
151 gGeoManager =
dynamic_cast<TGeoManager*
>(key->ReadObj());
163 LOG(info) <<
"Geometry was not found in the input file we will look in the friends if any!";
164 TFile* currentfile = gFile;
166 TSeqCollection* fileList = gROOT->GetListOfFiles();
167 for (Int_t k = 0; k < fileList->GetEntries(); k++) {
168 nextfile =
dynamic_cast<TFile*
>(fileList->At(k));
170 nextfile->Get(
"FAIRGeom");
184 while ((key = dynamic_cast<TKey*>(next()))) {
185 if (strcmp(key->GetClassName(),
"TGeoManager") != 0) {
188 gGeoManager =
dynamic_cast<TGeoManager*
>(key->ReadObj());
195 gROOT->GetListOfBrowsables()->Add(
fTask);
210 LOG(info) <<
"Parameter and input file are available, Assure that basic info is there for the run!";
224 LOG(info) <<
"--- Initialize with RunId --- " <<
fRunId;
231 LOG(info) <<
"Initializing without input file or Mixed input";
252 if (fieldfact && !
fField) {
290 if (MaxAllowed != -1) {
296 if (Ev_end > MaxAllowed) {
302 if (Ev_end > MaxAllowed) {
303 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;
308 cout <<
"-----------------------------------------------------" << endl;
312 LOG(info) <<
"FairRunAna::Run() After checking, the run will run from event " << Ev_start <<
" to "
315 LOG(info) <<
"FairRunAna::Run() continue running without stop";
322 Int_t readEventReturn = 0;
324 for (
int i = Ev_start; i < Ev_end || MaxAllowed == -1; i++) {
326 gSystem->IgnoreInterrupt();
331 LOG(warn) <<
"FairRunAna::Run() Event loop was interrupted by the user!";
337 if (readEventReturn != 0) {
338 LOG(warn) <<
"FairRunAna::Run() fRootManager->ReadEvent(" << i <<
") returned " << readEventReturn
339 <<
". Breaking the event loop";
385 if (MaxAllowed != -1) {
391 if (Ev_end > MaxAllowed) {
397 if (Ev_end > MaxAllowed) {
398 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;
403 cout <<
"-----------------------------------------------------" << endl;
407 LOG(info) <<
"FairRunAna::Run() After checking, the run will run from event " << Ev_start <<
" to " << Ev_end
410 LOG(info) <<
"FairRunAna::Run() continue running without stop";
417 for (
int i = Ev_start; i < Ev_end; i++) {
526 Int_t globalEvent = 0;
528 bool firstRun =
true;
531 if (globalEvent < fRootManager->CheckMaxEventNo(
554 if (NStart == 0 && NStop == 0) {
557 LOG(info) <<
" Maximum number of event is set to 1E9";
559 for (UInt_t i = NStart; i < NStop; i++) {
591 for (
int i = Ev_start; i < Ev_end; i++) {
627 LOG(warn) <<
"RunWithTimeStamps has to be set before Run::Init !";
641 LOG(info) <<
"Parameter Cont. initialisation is static";
643 LOG(info) <<
"Parameter Cont. initialisation is NOT static";
void AlignGeometry() const
virtual FairField * createFairField()
Int_t CheckMaxEventNo(Int_t EvtEnd=0)
virtual void ExecuteTask(Option_t *option="0")
Int_t ReadEvent(Int_t i=0)
void Reinit(UInt_t runId)
unsigned int generateId(void)
void RunOnLmdFiles(UInt_t NStart=0, UInt_t NStop=0)
FairRootManager * fRootManager
void WriteFileHeader(FairFileHeader *f)
Bool_t AllDataProcessed()
FairEventHeader * GetEventHeader()
FairEventHeader * fEvtHeader
ClassImp(FairEventBuilder)
void Run(Int_t NStart=0, Int_t NStop=0)
static FairFieldFactory * Instance()
Int_t ReadNonTimeBasedEventFromBranches(Int_t i=0)
FairParSet * getContainer(const Text_t *)
Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Bool_t initContainers(Int_t runId, Int_t refId=-1, const Text_t *fileName="")
void FRA_handler_ctrlc(int)
void RunMQ(Long64_t entry)
static FairRunAna * Instance()
void StoreAllWriteoutBufferData()
FairMQExParamsParOne * par
void SetContainerStatic(Bool_t tempBool=kTRUE)
FairFileHeader * fFileHeader
virtual void FinishTask()
static FairRunAna * fgRinstance
static FairTrajFilter * Instance()
void RunEventReco(Int_t NStart, Int_t NStop)
FairRuntimeDb * GetRuntimeDb(void)
Bool_t ReadNextEvent(Double_t dt)
FairRtdbRun * addRun(Int_t runId, Int_t refId=-1)
Bool_t fFinishProcessingLMDFile
void UpdateListOfTimebasedBranches()
void DummyRun(Int_t NStart, Int_t NStop)
virtual void FinishEvent()
void DeleteOldWriteoutBufferData()
void StoreWriteoutBufferData(Double_t eventTime)
void SetGeomFile(const char *GeoFileName)
FairTrajFilter * fTrajFilter
void Init(TString brName="GeoTracks", TString folderName="MCGeoTrack")
void FillEventHeader(FairEventHeader *feh)