BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnSlewingTOF700.C
Go to the documentation of this file.
1// file: full path to raw-file
2// nEvents: if 0 then decode all events
3
4void BmnSlewingTOF700(TString file = "mpd_run_trigCode_8760.data", Long_t nEvents = 0)
5{
6
7 gSystem->ExpandPathName(file);
8 gSystem->ExpandPathName(outfile);
9
10 Int_t iVerbose = 1; ///<- Verbosity level: 0 - Progress Bar; 1 - short info on passed events
11 UInt_t period = 7;
12
13 TStopwatch timer;
14 timer.Start();
15
16 BmnRawDataDecoder* decoder = new BmnRawDataDecoder(file, outfile, nEvents, period);
17 // use kSRCSETUP for Short-Range Correlation program and kBMNSETUP otherwise
18 BmnSetup stp = (decoder->GetRunId() >= 2041 && decoder->GetRunId() <= 3588) ? kSRCSETUP : kBMNSETUP;
19 decoder->SetBmnSetup(stp);
20 decoder->SetVerbose(iVerbose);
21 decoder->SetAdcDecoMode(period < 6 ? kBMNADCSM : kBMNADCMK);
22
23 TString PeriodSetupExt = Form("%d%s.txt", period, ((stp == kBMNSETUP) ? "" : "_SRC"));
24 decoder->SetTrigPlaceMapping(TString("Trig_PlaceMap_Run") + PeriodSetupExt);
25 decoder->SetTrigChannelMapping(TString("Trig_map_Run") + PeriodSetupExt);
26 decoder->SetTOF700ReferenceRun(-1);
27 decoder->SetTof700Geom(TString("TOF700_geometry_run") + PeriodSetupExt);
28 if (decoder->GetRunId() >= 4278 && decoder->GetPeriodId() == 7)
29 decoder->SetTof700Mapping(TString("TOF700_map_period_") + Form("%d_from_run_4278.txt", period));
30 else
31 decoder->SetTof700Mapping(TString("TOF700_map_period_") + Form("%d.txt", period));
32
33 decoder->SlewingTOF700Init(); // Decode data into detector-digits using current mappings.
34
35 BmnTof2Raw2DigitNew* tof700m = decoder->GetTof700Mapper();
36
37 if (period <= 7) {
38 if (stp == kSRCSETUP) {
39 tof700m->SetT0shift(-15000.);
40 } else {
41 tof700m->SetT0shift(+147000.);
42 }
43 } else if (period == 8) {
44 tof700m->SetT0shift(+10000.);
45 } else {
46 printf
47 {"wrong perion number - %d !\n", period);
48 }
49
50 tof700m->SetW(2800, 9000); // Argon
51 // tof700m->SetW(2600,5300); // SRC
52 tof700m->SetWT0(670, 970); // BMN BC2
53 // tof700m->SetWT0(650,1100); // SRC BC2
54 // tof700m->SetWT0(200,1400); // BMN BC2 (noises?)
55 // tof700m->SetWT0(390,420); // BMN VETO
56
57 decoder->SlewingTOF700(); // obtain slewing parameters
58
59 // draw quality control histogram - comment out if not neccessary
60 tof700m->drawproft0();
61 tof700m->drawprof();
62
63 delete decoder;
64 }
65
66 void select_hist()
67 {
68 // example of macro called when a mouse event occurs in a pad.
69 // Example:
70 // Root > TFile f("hsimple.root");
71 // Root > hpxpy.Draw();
72 // Root > c1.AddExec("exsel","select_hist()");
73 // When moving the mouse in the canvas, a second canvas shows the
74 // projection along X of the bin corresponding to the Y position
75 // of the mouse. The resulting histogram is fitted with a gaussian.
76 // A "dynamic" line shows the current bin position in Y.
77 // This more elaborated example can be used as a starting point
78 // to develop more powerful interactive applications exploiting CINT
79 // as a development engine.
80 // Author: Rene Brun
81
82 int event = gPad->GetEvent();
83 if (event != 11)
84 return;
85
86 TObject* select = gPad->GetSelected();
87 if (!select)
88 return;
89 if (!(select->InheritsFrom("TH1")))
90 return;
91
92 // create or set the new canvas c2
93 TCanvas* csingle = 0;
94 if ((csingle = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("csingle")))
95 ;
96 else
97 csingle = new TCanvas("csingle");
98 csingle->cd();
99
100 // draw slice corresponding to mouse position
101 if (!(select->InheritsFrom("TH1F"))) {
102 TH1F* h = (TH1F*)select;
103 h->Draw();
104 } else if (!(select->InheritsFrom("TH2F"))) {
105 TH2F* h = (TH2F*)select;
106 h->Draw();
107 } else if (!(select->InheritsFrom("TProfile"))) {
108 TProfile* h = (TProfile*)select;
109 h->Draw();
110 } else if (!(select->InheritsFrom("TH1D"))) {
111 TH1D* h = (TH1D*)select;
112 h->Draw();
113 } else if (!(select->InheritsFrom("TH2D"))) {
114 TH2D* h = (TH2D*)select;
115 h->Draw();
116 } else if (!(select->InheritsFrom("TProfile2D"))) {
117 TProfile2D* h = (TProfile2D*)select;
118 h->Draw();
119 } else
120 return;
121 csingle->Update();
122 }
int Int_t
long Long_t
unsigned int UInt_t
#define gROOT
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
#define gPad
BmnSetup
Define experimental setup.
Definition BmnEnums.h:165
@ kSRCSETUP
Definition BmnEnums.h:167
@ kBMNSETUP
Definition BmnEnums.h:166
void SetVerbose(Int_t v)
void SetBmnSetup(BmnSetup v)
UInt_t GetRunId() const
UInt_t GetPeriodId() const
void SetW(int wcut, int wm)
void SetT0shift(float shift)
void SetWT0(int wt1, int wt2)
TVirtualPad * cd(Int_t subpadnumber=0) override
void Update() override
void Draw(Option_t *option="") override
void Start(Bool_t reset=kTRUE)
void BmnSlewingTOF700(TString file="mpd_run_trigCode_8760.data", Long_t nEvents=0)