BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnPreparationECAL.C
Go to the documentation of this file.
1
2void BmnPreparationECAL(char* fname = "bmn_run4926_raw.root")
3{
4 gROOT->LoadMacro("$VMCWORKDIR/macro/run/bmnloadlibs.C");
5 bmnloadlibs();
6 /////////////////////////////////////////////////////////////////////////////////////
7 int RUN;
8 sscanf(&fname[strlen(fname) - 13], "%d", &RUN);
9
10 char mapping[128] = {"ECAL_map_period_7.txt"};
11
12 BmnECALRaw2Digit* ECAL = new BmnECALRaw2Digit(mapping, fname);
13 ECAL->print();
14
15 cout << "Process RUN: " << RUN << endl;
16
17 /////////////////////////////////////////////////////////////////////////////////////
18 TFile* _f_in = new TFile(fname, "READ");
19 TTree* _t_in = (TTree*)_f_in->Get("BMN_RAW");
20 TClonesArray* ecal_raw = new TClonesArray("BmnADCDigit");
21 _t_in->SetBranchAddress("ADC", &ecal_raw);
22 /////////////////////////////////////////////////////////////////////////////////////
23
24 for (int ev = 0; ev < _t_in->GetEntries(); ev++) {
25
26 if ((ev % 5000) == 0)
27 printf("Preparation ECAL, event %d\n", ev);
28
29 ecal_raw->Clear();
30
31 _t_in->GetEntry(ev);
32
33 ECAL->fillAmplitudes(ecal_raw);
34 ECAL->fillSampleProfilesAll(ecal_raw, 0., 0., 48.);
35 }
36 /////////////////////////////////////////////////////////////////////////////////////
37 ECAL->drawecal(1); // draw ECAL modules with module number and calibration coefficient
38 ECAL->drawprof(229); // average waveform for module 229
39 /////////////////////////////////////////////////////////////////////////////////////
40
41 _f_in->Close();
42}
43
45{
46 // example of macro called when a mouse event occurs in a pad.
47 // Example:
48 // Root > TFile f("hsimple.root");
49 // Root > hpxpy.Draw();
50 // Root > c1.AddExec("exsel","select_hist()");
51 // When moving the mouse in the canvas, a second canvas shows the
52 // projection along X of the bin corresponding to the Y position
53 // of the mouse. The resulting histogram is fitted with a gaussian.
54 // A "dynamic" line shows the current bin position in Y.
55 // This more elaborated example can be used as a starting point
56 // to develop more powerful interactive applications exploiting CINT
57 // as a development engine.
58 // Author: Rene Brun
59
60 int event = gPad->GetEvent();
61 if (event != 11)
62 return;
63
64 TObject* select = gPad->GetSelected();
65 if (!select)
66 return;
67 if (!(select->InheritsFrom("TH1")))
68 return;
69
70 // create or set the new canvas c2
71 TCanvas* csingle = 0;
72 if ((csingle = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("csingle")))
73 ;
74 else
75 csingle = new TCanvas("csingle");
76 csingle->cd();
77
78 // draw slice corresponding to mouse position
79 if (!(select->InheritsFrom("TH1F"))) {
80 TH1F* h = (TH1F*)select;
81 h->Draw();
82 } else if (!(select->InheritsFrom("TH2F"))) {
83 TH2F* h = (TH2F*)select;
84 h->Draw();
85 } else if (!(select->InheritsFrom("TProfile"))) {
86 TProfile* h = (TProfile*)select;
87 h->Draw();
88 } else if (!(select->InheritsFrom("TH1D"))) {
89 TH1D* h = (TH1D*)select;
90 h->Draw();
91 } else if (!(select->InheritsFrom("TH2D"))) {
92 TH2D* h = (TH2D*)select;
93 h->Draw();
94 } else if (!(select->InheritsFrom("TProfile2D"))) {
95 TProfile2D* h = (TProfile2D*)select;
96 h->Draw();
97 } else
98 return;
99 csingle->Update();
100}
#define gROOT
#define gPad
TVirtualPad * cd(Int_t subpadnumber=0) override
void Update() override
void Clear(Option_t *option="") override
T * Get(const char *namecycle)
void Close(Option_t *option="") override
void Draw(Option_t *option="") override
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
virtual Long64_t GetEntries() const
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
void BmnPreparationECAL(char *fname="bmn_run4926_raw.root")
void select_hist()