BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
run_mon_reco.C
Go to the documentation of this file.
1void run_mon_reco(TString inputFileName = "tcp://localhost:6666",
2 TString bmndstFileName = "bmndst.root",
3 Int_t nStartEvent = 0,
4 Int_t nEvents = 0,
5 bool isOnline = true)
6{
7 gDebug = 0; // Debug option
8 // Verbosity level (0 = quiet (progress bar), 1 = event-level, 2 = track-level, 3 = full debug)
9 Int_t iVerbose = 0;
10 Int_t period = 9;
11
12 // ----- Timer ---------------------------------------------------------
13 TStopwatch timer;
14 timer.Start();
15
16 FairRunOnline* fRunAna = new FairRunOnline();
17
18 FairSource* source = nullptr;
19 if (isOnline)
20 source = new BmnMQSource(string(inputFileName), kFALSE);
21 else {
22 if (!BmnFunctionSet::CheckFileExist(inputFileName, 1))
23 exit(-1);
24 source = new BmnFileSource(inputFileName);
25 }
26 fRunAna->SetSource(source);
27 // if nEvents is equal 0 then all events of the given file starting with "nStartEvent" should be processed
28 if (source->GetSourceType() == kFILE) {
29 if (nEvents == 0)
30 nEvents = MpdGetNumEvents::GetNumROOTEvents((char*)inputFileName.Data()) - nStartEvent;
31 } else {
32 nStartEvent = -1;
33 nEvents = -1;
34 }
35
36 // if directory for the output file does not exist, then create
37 if (BmnFunctionSet::CreateDirectoryTree(bmndstFileName, 1) < 0)
38 exit(-2);
39 // fRunAna->SetSink(new FairRootFileSink(bmndstFileName));
40 // fRunAna->SetSink(new BmnMQSink());
41 // fRunAna->SetGenerateRunInfo(false);
42 BmnTrackingQaExp* trQaAll = new BmnTrackingQaExp("TrackingQa", period);
43
49 THttpServer* fServer = nullptr;
50 if (isOnline) {
51 trQaAll->SetMonitorMode(kTRUE);
52 fServer = new THttpServer("http:8081;noglobal;cors");
53 fServer->SetTimer(50, kTRUE);
54 trQaAll->SetObjServer(fServer);
55 }
56 TString innerTrackBranchName; // use different track container
57#ifdef L1Tracking
58 innerTrackBranchName = "StsTrack";
59#else
60 innerTrackBranchName = "StsVector";
61#endif
62 trQaAll->SetInnerTracksBranchName(innerTrackBranchName);
63 fRunAna->AddTask(trQaAll);
64 // -------------------------------------------------------------------------
65 // ----- Initialize and run --------------------------------------------
66 fRunAna->GetMainTask()->SetVerbose(iVerbose);
67 fRunAna->Init();
68 cout << "Starting run" << endl;
69 if (isOnline) {
70 fRunAna->Run(-1, -1);
71 fServer->SetTimer(50, kFALSE);
72 } else
73 fRunAna->Run(nStartEvent, nStartEvent + nEvents);
74 // -------------------------------------------------------------------------
75 // ----- Finish --------------------------------------------------------
76 timer.Stop();
77 Double_t rtime = timer.RealTime();
78 Double_t ctime = timer.CpuTime();
79 cout << endl << endl;
80 cout << "Macro finished successfully." << endl; // marker of successful execution for CDASH
81 cout << "Input file is " + inputFileName << endl;
82 cout << "Output file is " + bmndstFileName << endl;
83 cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
84 cout << endl;
85 // ------------------------------------------------------------------------
86 getchar();
87}
int Int_t
Int_t gDebug
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
@ kSILICON
@ kGEM
@ kVSP
@ kSSD
@ kCSC
BmnFileSource.h.
static int CreateDirectoryTree(TString &fileName, int iVerbose=0, EAccessMode mode=kWritePermission)
static int CheckFileExist(TString &fileName, int iVerbose=0, EAccessMode mode=kFileExists)
void SetMonitorMode(const Bool_t mm)
Definition BmnQaBase.h:68
void SetObjServer(THttpServer *s)
Definition BmnQaBase.h:71
void SetDetectorPresence(DetectorId det, Bool_t use=true)
void SetInnerTracksBranchName(TString name)
static Int_t GetNumROOTEvents(const char *filename, const char *treename="", int iVerbose=2)
void SetTimer(Long_t milliSec=100, Bool_t mode=kTRUE)
Double_t RealTime()
void Start(Bool_t reset=kTRUE)
Double_t CpuTime()
void Stop()
void run_mon_reco(TString inputFileName="tcp://localhost:6666", TString bmndstFileName="bmndst.root", Int_t nStartEvent=0, Int_t nEvents=0, bool isOnline=true)
Definition run_mon_reco.C:1