BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
run_mon_custom.C
Go to the documentation of this file.
1
2
R__ADD_INCLUDE_PATH
($VMCWORKDIR)
3
4
void
run_mon_custom
(
5
TString
inputFileName =
"tcp://localhost:6666"
,
6
// TString inputFileName = "/ncx/eos/nica/bmn/exp/dst/run7/prerelease/3590-4707_BMN_Argon/bmn_run4649_dst.root",
7
TString
padConfName =
"pad-sample.json"
,
8
Int_t
nStartEvent = 0,
9
Int_t
nEvents = 0,
10
Int_t
webPort = 8090)
11
{
12
gDebug
= 0;
// Debug option
13
// Verbosity level (0 = quiet (progress bar), 1 = event-level, 2 = track-level, 3 = full debug)
14
Int_t
iVerbose = 1;
15
Int_t
period = 9;
16
Bool_t
isPrimary =
kFALSE
;
17
bool
isNetworkSource =
true
;
18
TString
gPathConfig =
gSystem
->Getenv(
"VMCWORKDIR"
);
19
20
// ----- Timer ---------------------------------------------------------
21
TStopwatch
timer;
22
timer.
Start
();
23
24
if
(!isNetworkSource) {
25
// check input file exists
26
if
(!
BmnFunctionSet::CheckFileExist
(inputFileName, 1))
27
exit(-1);
28
}
29
30
// FairRunAna* fRunAna = new FairRunAna();
31
FairRunOnline* fRunAna =
new
FairRunOnline();
32
33
FairSource
* source = isNetworkSource ?
static_cast<
FairSource
*
>
(
new
BmnMQSource
(inputFileName.Data(),
kTRUE
))
34
:
static_cast<
FairSource
*
>
(
new
BmnFileSource
(inputFileName));
35
/* FairSource* source = nullptr;
36
if (isNetworkSource)
37
source = new BmnMQSource("tcp://localhost:6666", kTRUE);
38
source = new BmnFileSource(inputFileName); */
39
fRunAna->SetSource(source);
40
41
// if directory for the output file does not exist, then create
42
// if (BmnFunctionSet::CreateDirectoryTree(bmndstFileName, 1) < 0) exit(-2);
43
// fRunAna->SetSink(new FairRootFileSink(bmndstFileName));
44
// fRunAna->SetSink(new BmnMQSink());
45
46
BmnCustomQa
* trQaAll =
new
BmnCustomQa
(
"custom_qa"
,
string
(padConfName.Data()));
47
trQaAll->
SetMonitorMode
(
kTRUE
);
48
TString
mode =
"http"
;
// "http"
49
TString
cgiStr =
Form
(
"%s:%d;noglobal;cors"
, mode.
Data
(), webPort);
50
THttpServer
* fServer =
new
THttpServer
(cgiStr.
Data
());
51
fServer->
SetTimer
(50,
kTRUE
);
52
trQaAll->
SetObjServer
(fServer);
53
// source->SetObjServer(fServer);
54
fRunAna->AddTask(trQaAll);
55
// -------------------------------------------------------------------------
56
// ----- Initialize and run --------------------------------------------
57
fRunAna->GetMainTask()->SetVerbose(iVerbose);
58
fRunAna->Init();
59
cout <<
"Starting run"
<< endl;
60
if
(nEvents == 0)
61
nEvents =
MpdGetNumEvents::GetNumROOTEvents
((
char
*)inputFileName.Data()) - nStartEvent;
62
if
(isNetworkSource)
63
fRunAna->Run(-1, -1);
64
else
65
fRunAna->Run(nStartEvent, nStartEvent + nEvents);
66
// -------------------------------------------------------------------------
67
// ----- Finish --------------------------------------------------------
68
timer.
Stop
();
69
Double_t
rtime = timer.
RealTime
();
70
Double_t
ctime = timer.
CpuTime
();
71
cout << endl << endl;
72
cout <<
"Macro finished successfully."
<< endl;
// marker of successful execution for CDASH
73
cout <<
"Input file is "
+ inputFileName << endl;
74
// cout << "Output file is " + bmndstFileName << endl;
75
cout <<
"Real time "
<< rtime <<
" s, CPU time "
<< ctime <<
" s"
<< endl;
76
cout << endl;
77
fServer->
SetTimer
(50,
false
);
78
// ------------------------------------------------------------------------
79
// getchar();
80
delete
fRunAna;
81
}
Bool_t
bool Bool_t
Int_t
int Int_t
gDebug
Int_t gDebug
kFALSE
constexpr Bool_t kFALSE
Double_t
double Double_t
kTRUE
constexpr Bool_t kTRUE
R__ADD_INCLUDE_PATH
#define R__ADD_INCLUDE_PATH(PATH)
Form
char * Form(const char *fmt,...)
gSystem
R__EXTERN TSystem * gSystem
BmnCustomQa
Definition
BmnCustomQa.h:22
BmnFileSource
BmnFileSource.h.
Definition
BmnFileSource.h:30
BmnFunctionSet::CheckFileExist
static int CheckFileExist(TString &fileName, int iVerbose=0, EAccessMode mode=kFileExists)
Definition
BmnFunctionSet.cxx:25
BmnMQSource
Definition
BmnMQSource.h:27
BmnQaBase::SetMonitorMode
void SetMonitorMode(const Bool_t mm)
Definition
BmnQaBase.h:68
BmnQaBase::SetObjServer
void SetObjServer(THttpServer *s)
Definition
BmnQaBase.h:71
FairSource
MpdGetNumEvents::GetNumROOTEvents
static Int_t GetNumROOTEvents(const char *filename, const char *treename="", int iVerbose=2)
Definition
MpdGetNumEvents.cxx:511
THttpServer
THttpServer::SetTimer
void SetTimer(Long_t milliSec=100, Bool_t mode=kTRUE)
TStopwatch
TStopwatch::RealTime
Double_t RealTime()
TStopwatch::Start
void Start(Bool_t reset=kTRUE)
TStopwatch::CpuTime
Double_t CpuTime()
TStopwatch::Stop
void Stop()
TString
TString::Data
const char * Data() const
run_mon_custom
void run_mon_custom(TString inputFileName="tcp://localhost:6666", TString padConfName="pad-sample.json", Int_t nStartEvent=0, Int_t nEvents=0, Int_t webPort=8090)
Definition
run_mon_custom.C:4
macro
monitor
run_mon_custom.C
Generated on
for BmnRoot by
1.17.0