BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
Draw_ZDC.C
Go to the documentation of this file.
1
2using namespace std;
3
4void Draw_ZDC(char* fname = "bmn_run0522.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
12 const char* mapping;
13 if (RUN < 470)
14 mapping = "ZDC_map_Feb20.txt";
15 else
16 mapping = "ZDC_map_Mar08.txt";
17
18 BmnZDCRaw2Digit ZDC(mapping, fname);
19 ZDC.print();
20 ZDC.drawzdc(1);
21}
22
24{
25 // example of macro called when a mouse event occurs in a pad.
26 // Example:
27 // Root > TFile f("hsimple.root");
28 // Root > hpxpy.Draw();
29 // Root > c1.AddExec("exsel","select_hist()");
30 // When moving the mouse in the canvas, a second canvas shows the
31 // projection along X of the bin corresponding to the Y position
32 // of the mouse. The resulting histogram is fitted with a gaussian.
33 // A "dynamic" line shows the current bin position in Y.
34 // This more elaborated example can be used as a starting point
35 // to develop more powerful interactive applications exploiting CINT
36 // as a development engine.
37 // Author: Rene Brun
38
39 int event = gPad->GetEvent();
40 if (event != 11)
41 return;
42
43 TObject* select = gPad->GetSelected();
44 if (!select)
45 return;
46 if (!(select->InheritsFrom("TH1")))
47 return;
48
49 // create or set the new canvas c2
50 TCanvas* csingle = 0;
51 if ((csingle = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("csingle")))
52 ;
53 else
54 csingle = new TCanvas("csingle");
55 csingle->cd();
56
57 // draw slice corresponding to mouse position
58 if (!(select->InheritsFrom("TH1F"))) {
59 TH1F* h = (TH1F*)select;
60 h->Draw();
61 } else if (!(select->InheritsFrom("TH2F"))) {
62 TH2F* h = (TH2F*)select;
63 h->Draw();
64 } else if (!(select->InheritsFrom("TProfile"))) {
65 TProfile* h = (TProfile*)select;
66 h->Draw();
67 } else if (!(select->InheritsFrom("TH1D"))) {
68 TH1D* h = (TH1D*)select;
69 h->Draw();
70 } else if (!(select->InheritsFrom("TH2D"))) {
71 TH2D* h = (TH2D*)select;
72 h->Draw();
73 } else if (!(select->InheritsFrom("TProfile2D"))) {
74 TProfile2D* h = (TProfile2D*)select;
75 h->Draw();
76 } else
77 return;
78 csingle->Update();
79}
#define gROOT
#define gPad
void drawzdc(int nohist=0)
TVirtualPad * cd(Int_t subpadnumber=0) override
void Update() override
void Draw(Option_t *option="") override
void Draw_ZDC(char *fname="bmn_run0522.root")
Definition Draw_ZDC.C:4
void select_hist()
Definition Draw_ZDC.C:23
Definition json.hpp:4446