BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
testRaw2Digit_only_ZDC.C
Go to the documentation of this file.
1
2using namespace std;
3
4void testRaw2Digit_only_ZDC(char* fname = "bmn_run0527.root")
5{
6 gROOT->LoadMacro("$VMCWORKDIR/macro/run/bmnloadlibs.C");
7 bmnloadlibs();
8 /////////////////////////////////////////////////////////////////////////////////////
9 int RUN;
10 sscanf(&fname[strlen(fname) - 8], "%d", &RUN);
11 const char* mapping;
12
13 BmnZDCRaw2Digit ZDC("ZDC_map_Mar08.txt");
14 ZDC.print();
15
16 cout << "Process RUN: " << RUN << endl;
17
18 /////////////////////////////////////////////////////////////////////////////////////
19 TFile* _f_in = new TFile(fname, "READ");
20 TTree* _t_in = (TTree*)_f_in->Get("BMN_RAW");
21 TClonesArray* t0_raw = new TClonesArray("BmnTDCDigit");
22 TClonesArray* sync_raw = new TClonesArray("BmnSyncDigit");
23 TClonesArray* zdc_raw = new TClonesArray("BmnADCDigit");
24 _t_in->SetBranchAddress("bmn_t0", &t0_raw);
25 _t_in->SetBranchAddress("bmn_sync", &sync_raw);
26 _t_in->SetBranchAddress("bmn_zdc", &zdc_raw);
27 /////////////////////////////////////////////////////////////////////////////////////
28 unsigned long EVENT, TIME_SEC, TIME_NS;
29 float T0;
30 char str[100];
31 sprintf(str, "bmn_run%04d_digit_only_zdc.root", RUN);
32 TFile* _f_out = new TFile(str, "RECREATE");
33 _f_out->SetCompressionLevel(1);
34 TTree* _t_out = new TTree("BMN_DIGIT", "test_bmn");
35 TClonesArray* zdc_digit = new TClonesArray("BmnZDCDigit");
36 _t_out->Branch("bmn_run", &RUN, "bmn_run/I");
37 _t_out->Branch("bmn_event", &EVENT, "bmn_event/I");
38 _t_out->Branch("bmn_time_sec", &TIME_SEC, "bmn_time_sec/I");
39 _t_out->Branch("bmn_time_ns", &TIME_NS, "bmn_time_ns/I");
40 _t_out->Branch("bmn_t0", &T0, "bmn_t0/F");
41 _t_out->Branch("bmn_zdc_digit", &zdc_digit);
42 /////////////////////////////////////////////////////////////////////////////////////
43
44 for (int ev = 0; ev < _t_in->GetEntries(); ev++) {
45 if ((ev % 100) == 0)
46 printf("%d\n", EVENT);
47 sync_raw->Clear();
48 t0_raw->Clear();
49 zdc_raw->Clear();
50
51 zdc_digit->Clear();
52
53 _t_in->GetEntry(ev);
54
55 ZDC.FillEvent(zdc_raw, zdc_digit);
56 _t_out->Fill();
57 }
58 /////////////////////////////////////////////////////////////////////////////////////
59
60 _f_in->Close();
61 _t_out->Print();
62 _t_out->Write();
63 _f_out->Close();
64}
#define gROOT
void FillEvent(TClonesArray *data, TClonesArray *zdcdigit)
void Clear(Option_t *option="") override
T * Get(const char *namecycle)
virtual void SetCompressionLevel(Int_t level=ROOT::RCompressionSetting::ELevel::kUseMin)
void Close(Option_t *option="") override
virtual Int_t Fill()
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
void Print(Option_t *option="") const override
virtual Long64_t GetEntries() const
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const override
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
virtual Int_t Branch(const char *folder, Int_t bufsize=32000, Int_t splitlevel=99)
void testRaw2Digit_only_ZDC(char *fname="bmn_run0527.root")
Definition json.hpp:4446