28 #include <TCollection.h>
29 #include <TGeoManager.h>
30 #include <THttpServer.h>
32 #include <TObjArray.h>
33 #include <TObjString.h>
50 , fAutomaticFinish(kTRUE)
51 , fIsInitialized(kFALSE)
56 , fServerRefreshRate(0)
60 LOG(info) <<
"FairRunOnline constructed at " <<
this;
65 , fAutomaticFinish(kTRUE)
66 , fIsInitialized(kFALSE)
71 , fServerRefreshRate(0)
76 LOG(info) <<
"FairRunOnline constructed at " <<
this;
84 if (gROOT->GetVersionInt() >= 60602) {
85 gGeoManager->GetListOfVolumes()->Delete();
86 gGeoManager->GetListOfShapes()->Delete();
99 LOG(info) <<
"FairRunOnline::Init";
101 LOG(fatal) <<
"Error Init is already called before!";
156 TIter next(containerList);
158 TObjArray* ContList =
new TObjArray();
159 while ((cont = dynamic_cast<FairParSet*>(next()))) {
160 ContList->Add(
new TObjString(cont->
GetName()));
181 LOG(fatal) <<
"FairRunOnline::InitContainers:No event header in run!";
184 LOG(info) <<
"FairRunOnline::InitContainers: event header at " <<
fEvtHeader;
204 LOG(info) <<
"FairRunOnline::InitContainers: par = " <<
par;
206 LOG(warn) <<
"FairRunOnline::InitContainers: no 'FairBaseParSet' container !";
229 LOG(fatal) <<
"FairRunOnline::InitContainers:No event header in run!";
232 LOG(info) <<
"FairRunOnline::InitContainers: event header at " <<
fEvtHeader;
237 Int_t FairRunOnline::EventLoop()
239 gSystem->IgnoreInterrupt();
245 if (tmpId != -1 && tmpId !=
fRunId) {
246 LOG(info) <<
"FairRunOnline::EventLoop() Call Reinit due to changed RunID (from " <<
fRunId <<
" to " << tmpId;
278 if (MaxAllowed != -1) {
284 if (Ev_end > MaxAllowed) {
290 if (Ev_end > MaxAllowed) {
291 cout <<
"-------------------Warning---------------------------" << endl;
292 cout <<
" -W FairRunAna : File has less events than requested!!" << endl;
293 cout <<
" File contains : " << MaxAllowed <<
" Events" << endl;
294 cout <<
" Requested number of events = " << Ev_end <<
" Events" << endl;
295 cout <<
" The number of events is set to " << MaxAllowed <<
" Events" << endl;
296 cout <<
"-----------------------------------------------------" << endl;
306 status = EventLoop();
310 }
else if (2 == status) {
318 for (Int_t i = Ev_start; i < Ev_end; i++) {
321 status = EventLoop();
325 }
else if (2 == status) {
337 if (fAutomaticFinish) {
354 TString serverAddress =
"http:";
355 serverAddress += httpServer;
356 fServer =
new THttpServer(serverAddress);
357 fServerRefreshRate = refreshRate;
363 TString path =
"/Objects/HISTO";
364 fServer->RegisterCommand(name, path + command);
378 LOG(info) <<
"Parameter Cont. initialisation is static";
380 LOG(info) <<
"Parameter Cont. initialisation is NOT static";
386 if (
nullptr ==
object) {
390 TString classname = TString(object->ClassName());
391 if (classname.EqualTo(
"TCanvas")) {
392 fServer->Register(
"CANVAS",
object);
393 }
else if (classname.EqualTo(
"TFolder")) {
394 fServer->Register(
"/",
object);
395 }
else if (classname.Contains(
"TH1") || classname.Contains(
"TH2")) {
396 fServer->Register(
"HISTO",
object);
398 LOG(warn) <<
"FairRunOnline::AddObject : unrecognized object type : " << classname;
virtual void SetParUnpackers()=0
void ActivateHttpServer(Int_t refreshRate=10000, Int_t httpPort=8080)
virtual const char * GetName() const
Int_t CheckMaxEventNo(Int_t EvtEnd=0)
virtual void ExecuteTask(Option_t *option="0")
virtual Source_Type GetSourceType()=0
Int_t ReadEvent(Int_t i=0)
unsigned int generateId(void)
FairRootManager * fRootManager
void SetRunId(Int_t runId)
void setChanged(Bool_t flag=kTRUE)
void WriteFileHeader(FairFileHeader *f)
virtual void FillParContainer()
FairEventHeader * GetEventHeader()
void SetContainerStatic(Bool_t tempBool=kTRUE)
FairEventHeader * fEvtHeader
ClassImp(FairEventBuilder)
TObject * GetObject(const char *BrName)
virtual Bool_t InitUnpackers()=0
void SetContListStr(TObjArray *list)
TList * getListOfContainers()
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 AddObject(TObject *object)
void Reinit(UInt_t runId)
void StoreAllWriteoutBufferData()
FairMQExParamsParOne * par
FairFileHeader * fFileHeader
virtual void FinishTask()
void setInputVersion(Int_t v=-1, Int_t i=0)
virtual Bool_t ReInitUnpackers()=0
void Run(Int_t Ev_start, Int_t Ev_end)
FairRuntimeDb * GetRuntimeDb(void)
void Register(const char *name, const char *Foldername, TNamed *obj, Bool_t toFile)
static FairRunOnline * fgRinstance
FairRtdbRun * addRun(Int_t runId, Int_t refId=-1)
void RegisterHttpCommand(TString name, TString command)
void SetSource(FairSource *tempSource)
static FairRunOnline * Instance()
virtual void FinishEvent()
void DeleteOldWriteoutBufferData()
void StoreWriteoutBufferData(Double_t eventTime)
void SetGeometry(TGeoManager *Geom)
void FillEventHeader(FairEventHeader *feh)