BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
readHeaders.C
Go to the documentation of this file.
1
#include <
Rtypes.h
>
2
#include <
TClonesArray.h
>
3
#include <
TFile.h
>
4
#include <
TMathBase.h
>
5
#include <
TString.h
>
6
#include <
TTimeStamp.h
>
7
#include <
TTree.h
>
8
9
R__ADD_INCLUDE_PATH
($VMCWORKDIR)
10
#include "macro/run/bmnloadlibs.C"
11
12
/**
13
* readHeaders
14
* Example of reading valuable content of the DigiRunHeader and BmnEventHeader
15
* @param fileName
16
* @param examples number of events to show
17
*/
18
void
readHeaders
(
TString
fileName =
""
,
Int_t
examples = 10)
19
{
20
if
(fileName ==
""
) {
21
cout <<
"File not specified!"
<< endl;
22
return
;
23
}
24
bmnloadlibs();
// load libraries
25
26
TFile
* file =
new
TFile
(fileName,
"READ"
);
27
if
(file->
IsOpen
() ==
false
) {
28
printf(
"\nCannot open file %s !\n"
, fileName.Data());
29
return
;
30
}
31
/**
32
* Reading Run Header for the whole run statistics:
33
* beam counters, run start/end time
34
*/
35
printf(
"Run Header content:\n"
);
36
DigiRunHeader
* rh = (
DigiRunHeader
*)file->
Get
(
"DigiRunHeader"
);
37
38
UInt_t
PeriodId = rh->
GetPeriodId
();
39
UInt_t
RunId = rh->
GetRunId
();
40
printf(
"\tPeriod: %u Run: %u\n"
, PeriodId, RunId);
41
42
Double_t
BT = rh->
GetBT
();
// Beam Trigger
43
Double_t
BTnBusy = rh->
GetBTnBusy
();
// BT & not Busy
44
// (BT & not Busy) normalized by Before&After protection ratio
45
Double_t
TotalFlux = rh->
GetBTAccepted
();
46
printf(
"\tBeam Trigger : %f\n"
, BT);
47
printf(
"\tBeam Trigger and Not Busy : %f\n"
, BTnBusy);
48
printf(
"\tBeam Trigger Accepted Events (Flux): %f\n"
, TotalFlux);
49
TTimeStamp
RunStartTime = rh->
GetRunStartTime
();
50
TTimeStamp
RunEndTime = rh->
GetRunEndTime
();
51
printf(
"\tSTART : %s\n"
, RunStartTime.
AsString
());
52
printf(
"\tFINISH : %s\n"
, RunEndTime.
AsString
());
53
/**
54
* Reading Event Header for each event in the range:
55
* current spill statistics,
56
*/
57
TTree
* tree = (
TTree
*)file->
Get
(
"bmndata"
);
58
BmnEventHeader
* eh =
nullptr
;
59
tree->
SetBranchAddress
(
"BmnEventHeader."
, &eh);
60
Long64_t
NEvents = tree->
GetEntries
();
61
Long64_t
NExamples = examples;
// Examples to show
62
NExamples = Min(NEvents, NExamples);
63
for
(
Int_t
i
= 0;
i
< NExamples;
i
++) {
64
tree->
GetEntry
(
i
);
65
BmnTrigInfo
* ti = eh->
GetTrigInfo
();
66
printf(
"Event %u\n"
, eh->
GetEventId
());
67
printf(
"\tU40VE:\tCandidates %6u, Accepted %6u, Before %4u, After %6u, Rejected %6u\n"
, ti->
GetTrigCand
(),
68
ti->
GetTrigAccepted
(), ti->
GetTrigBefo
(), ti->
GetTrigAfter
(), ti->
GetTrigRjct
());
69
}
70
71
printf(
" %lld events shown.\n To see more events change the second argument of the macro.\n"
, NExamples);
72
}
i
int i
Definition
P4_F32vec4.h:22
Int_t
int Int_t
UInt_t
unsigned int UInt_t
Double_t
double Double_t
Long64_t
long long Long64_t
Rtypes.h
R__ADD_INCLUDE_PATH
#define R__ADD_INCLUDE_PATH(PATH)
TClonesArray.h
TFile.h
TMathBase.h
TString.h
TTimeStamp.h
TTree.h
BmnEventHeader
Definition
BmnEventHeader.h:24
BmnEventHeader::GetEventId
UInt_t GetEventId()
Get the event ID for this event.
Definition
BmnEventHeader.h:89
BmnEventHeader::GetTrigInfo
BmnTrigInfo & GetTrigInfo()
Get the spill statistics.
Definition
BmnEventHeader.h:114
BmnTrigInfo
Class BmnTrigInfo Trigger counters of the current spill from U40VE card.
Definition
BmnTrigInfo.h:15
BmnTrigInfo::GetTrigAfter
UInt_t GetTrigAfter()
Definition
BmnTrigInfo.h:38
BmnTrigInfo::GetTrigRjct
UInt_t GetTrigRjct()
Definition
BmnTrigInfo.h:42
BmnTrigInfo::GetTrigBefo
UInt_t GetTrigBefo()
Definition
BmnTrigInfo.h:34
BmnTrigInfo::GetTrigAccepted
UInt_t GetTrigAccepted()
Definition
BmnTrigInfo.h:30
BmnTrigInfo::GetTrigCand
UInt_t GetTrigCand()
Definition
BmnTrigInfo.h:26
DigiRunHeader
Definition
DigiRunHeader.h:21
DigiRunHeader::GetPeriodId
uint64_t GetPeriodId()
Get the period ID for this run.
Definition
DigiRunHeader.h:75
DigiRunHeader::GetRunId
uint64_t GetRunId()
Get the run ID.
Definition
DigiRunHeader.h:77
DigiRunHeader::GetRunEndTime
TTimeStamp GetRunEndTime()
Definition
DigiRunHeader.h:135
DigiRunHeader::GetRunStartTime
TTimeStamp GetRunStartTime()
Definition
DigiRunHeader.h:133
DigiRunHeader::GetBTAccepted
Double_t GetBTAccepted()
Get the (BT and not Busy) by live time.
Definition
DigiRunHeader.h:85
DigiRunHeader::GetBT
uint64_t GetBT()
Get the BeamTrigger counter.
Definition
DigiRunHeader.h:81
DigiRunHeader::GetBTnBusy
uint64_t GetBTnBusy()
Get the BT and not Busy.
Definition
DigiRunHeader.h:83
TDirectoryFile::Get
T * Get(const char *namecycle)
TFile
TFile::IsOpen
virtual Bool_t IsOpen() const
TString
TTimeStamp
TTimeStamp::AsString
const char * AsString(const Option_t *option="") const
TTree
TTree::GetEntry
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
TTree::GetEntries
virtual Long64_t GetEntries() const
TTree::SetBranchAddress
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
readHeaders
void readHeaders(TString fileName="", Int_t examples=10)
readHeaders Example of reading valuable content of the DigiRunHeader and BmnEventHeader
Definition
readHeaders.C:18
install
macro
howTo
readHeaders.C
Generated on
for BmnRoot by
1.17.0