BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
testRaw2Digit.C
Go to the documentation of this file.
1
using namespace
std
;
2
3
void
testRaw2Digit
(
char
* fname =
"bmn_run0648.root"
)
4
{
5
gROOT
->LoadMacro(
"$VMCWORKDIR/macro/run/bmnloadlibs.C"
);
6
bmnloadlibs();
7
/////////////////////////////////////////////////////////////////////////////////////
8
int
RUN;
9
sscanf(&fname[strlen(fname) - 8],
"%d"
, &RUN);
10
const
char
* mapping;
11
if
(RUN < 189)
12
mapping =
"DCH_map_Feb20_Feb25.txt"
;
13
else
if
(RUN >= 189 && RUN < 470)
14
mapping =
"DCH_map_Mar4.txt"
;
15
else
if
(RUN >= 470 && RUN < 689)
16
mapping =
"DCH_map_Mar11.txt"
;
17
else
18
mapping =
"DCH_map_Run4.txt"
;
19
BmnDchRaw2Digit
DCH(mapping);
20
DCH.print();
21
22
// BmnZDCRaw2Digit ZDC("ZDC_map_Feb20.txt"); ZDC.print();
23
BmnZDCRaw2Digit
ZDC(
"ZDC_map_Mar08.txt"
);
24
ZDC.
print
();
25
26
if
(RUN < 470)
27
mapping =
"TOF700_map_Feb20_Mar11.txt"
;
28
else
29
mapping =
"TOF700_map_Mar11.txt"
;
30
BmnTof2Raw2Digit TOF2(mapping);
31
TOF2.print();
32
33
if
(RUN < 470)
34
mapping =
"TOF400_map_Mar4.txt"
;
35
else
36
mapping =
"TOF400_map_Mar11.txt"
;
37
BmnTof1Raw2Digit
TOF1(mapping);
38
TOF1.print();
39
40
cout <<
"Process RUN: "
<< RUN << endl;
41
42
/////////////////////////////////////////////////////////////////////////////////////
43
TFile
* _f_in =
new
TFile
(fname,
"READ"
);
44
TTree
* _t_in = (
TTree
*)_f_in->
Get
(
"BMN_RAW"
);
45
TClonesArray
* t0_raw =
new
TClonesArray
(
"BmnTDCDigit"
);
46
TClonesArray
* sync_raw =
new
TClonesArray
(
"BmnSyncDigit"
);
47
TClonesArray
* dch_raw =
new
TClonesArray
(
"BmnTDCDigit"
);
48
TClonesArray
* tof1_raw =
new
TClonesArray
(
"BmnTDCDigit"
);
49
TClonesArray
* tof2_raw =
new
TClonesArray
(
"BmnTDCDigit"
);
50
TClonesArray
* zdc_raw =
new
TClonesArray
(
"BmnADCDigit"
);
51
TClonesArray
* ecal_raw =
new
TClonesArray
(
"BmnADCDigit"
);
52
_t_in->
SetBranchAddress
(
"bmn_t0"
, &t0_raw);
53
_t_in->
SetBranchAddress
(
"bmn_sync"
, &sync_raw);
54
_t_in->
SetBranchAddress
(
"bmn_dch"
, &dch_raw);
55
_t_in->
SetBranchAddress
(
"bmn_tof400"
, &tof1_raw);
56
_t_in->
SetBranchAddress
(
"bmn_tof700"
, &tof2_raw);
57
_t_in->
SetBranchAddress
(
"bmn_zdc"
, &zdc_raw);
58
_t_in->
SetBranchAddress
(
"bmn_ecal"
, &ecal_raw);
59
/////////////////////////////////////////////////////////////////////////////////////
60
unsigned
long
EVENT, TIME_SEC, TIME_NS;
61
float
T0;
62
char
str[100];
63
sprintf(str,
"bmn_run%04d_digit.root"
, RUN);
64
TFile
* _f_out =
new
TFile
(str,
"RECREATE"
);
65
_f_out->
SetCompressionLevel
(1);
66
TTree
* _t_out =
new
TTree
(
"BMN_DIGIT"
,
"test_bmn"
);
67
TClonesArray
* dch_digit =
new
TClonesArray
(
"BmnDchDigit"
);
68
TClonesArray
* zdc_digit =
new
TClonesArray
(
"BmnZDCDigit"
);
69
TClonesArray
* tof2_digit =
new
TClonesArray
(
"BmnTof2Digit"
);
70
TClonesArray
* tof1_digit =
new
TClonesArray
(
"BmnTof1Digit"
);
71
_t_out->
Branch
(
"bmn_run"
, &RUN,
"bmn_run/I"
);
72
_t_out->
Branch
(
"bmn_event"
, &EVENT,
"bmn_event/I"
);
73
_t_out->
Branch
(
"bmn_time_sec"
, &TIME_SEC,
"bmn_time_sec/I"
);
74
_t_out->
Branch
(
"bmn_time_ns"
, &TIME_NS,
"bmn_time_ns/I"
);
75
_t_out->
Branch
(
"bmn_t0"
, &T0,
"bmn_t0/F"
);
76
_t_out->
Branch
(
"bmn_dch_digit"
, &dch_digit);
77
_t_out->
Branch
(
"bmn_zdc_digit"
, &zdc_digit);
78
_t_out->
Branch
(
"bmn_tof2_digit"
, &tof2_digit);
79
_t_out->
Branch
(
"bmn_tof1_digit"
, &tof1_digit);
80
/////////////////////////////////////////////////////////////////////////////////////
81
82
for
(
int
ev = 0; ev < _t_in->
GetEntries
(); ev++) {
83
if
((ev % 100) == 0)
84
printf(
"%d\n"
, EVENT);
85
sync_raw->
Clear
();
86
t0_raw->
Clear
();
87
dch_raw->
Clear
();
88
tof1_raw->
Clear
();
89
tof2_raw->
Clear
();
90
zdc_raw->
Clear
();
91
ecal_raw->
Clear
();
92
93
dch_digit->
Clear
();
94
zdc_digit->
Clear
();
95
tof2_digit->
Clear
();
96
tof1_digit->
Clear
();
97
98
_t_in->
GetEntry
(ev);
99
100
DCH.fillEvent(dch_raw, sync_raw, t0_raw, dch_digit);
101
DCH.getEventInfo(&EVENT, &TIME_SEC, &TIME_NS);
102
TOF2.fillEvent(tof2_raw, sync_raw, t0_raw, tof2_digit);
103
TOF1.fillEvent(tof1_raw, sync_raw, t0_raw, tof1_digit);
104
ZDC.
FillEvent
(zdc_raw, zdc_digit);
105
T0 = DCH.get_t0();
106
if
(DCH.get_t0() == 0 || EVENT == 0)
107
continue
;
108
_t_out->
Fill
();
109
}
110
/////////////////////////////////////////////////////////////////////////////////////
111
112
_f_in->
Close
();
113
_t_out->
Print
();
114
_t_out->
Write
();
115
_f_out->
Close
();
116
}
gROOT
#define gROOT
BmnDchRaw2Digit
Definition
BmnDchRaw2Digit.h:21
BmnTof1Raw2Digit
Definition
BmnTof1Raw2Digit.h:59
BmnZDCRaw2Digit
Definition
BmnZDCRaw2Digit.h:65
BmnZDCRaw2Digit::print
void print()
Definition
BmnZDCRaw2Digit.cxx:320
BmnZDCRaw2Digit::FillEvent
void FillEvent(TClonesArray *data, TClonesArray *zdcdigit)
Definition
BmnZDCRaw2Digit.cxx:604
TClonesArray
TClonesArray::Clear
void Clear(Option_t *option="") override
TDirectoryFile::Get
T * Get(const char *namecycle)
TFile
TFile::SetCompressionLevel
virtual void SetCompressionLevel(Int_t level=ROOT::RCompressionSetting::ELevel::kUseMin)
TFile::Close
void Close(Option_t *option="") override
TTree
TTree::Fill
virtual Int_t Fill()
TTree::GetEntry
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
TTree::Print
void Print(Option_t *option="") const override
TTree::GetEntries
virtual Long64_t GetEntries() const
TTree::Write
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const override
TTree::SetBranchAddress
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
TTree::Branch
virtual Int_t Branch(const char *folder, Int_t bufsize=32000, Int_t splitlevel=99)
testRaw2Digit
void testRaw2Digit(char *fname="bmn_run0648.root")
Definition
testRaw2Digit.C:3
std
Definition
json.hpp:4446
macro
detectors
dch
testRaw2Digit.C
Generated on
for BmnRoot by
1.17.0