BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnPreparationTOF700.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 BmnPreparationTOF700(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->PreparationTOF700Init(); // Decode data into detector-digits using current mappings.
34 BmnTof2Raw2DigitNew* tof700m = decoder->GetTof700Mapper();
35
36 if (period <= 7) {
37 if (stp == kSRCSETUP) {
38 tof700m->SetT0shift(-15000.);
39 } else {
40 tof700m->SetT0shift(+147000.);
41 }
42 } else if (period == 8) {
43 tof700m->SetT0shift(+10000.);
44 } else {
45 printf
46 {"wrong perion number - %d !\n", period);
47 }
48
49 tof700m->Book();
50 decoder->PreparationTOF700(); // Analyze TOF700 data for slewing time limits.
51 // draw quality control histogram - comment if not neccessary
52 tof700m->WritePreparationHists();
53 tof700m->drawprep();
54 delete decoder;
55 }
56
57 void select_hist()
58 {
59 // example of macro called when a mouse event occurs in a pad.
60 // Example:
61 // Root > TFile f("hsimple.root");
62 // Root > hpxpy.Draw();
63 // Root > c1.AddExec("exsel","select_hist()");
64 // When moving the mouse in the canvas, a second canvas shows the
65 // projection along X of the bin corresponding to the Y position
66 // of the mouse. The resulting histogram is fitted with a gaussian.
67 // A "dynamic" line shows the current bin position in Y.
68 // This more elaborated example can be used as a starting point
69 // to develop more powerful interactive applications exploiting CINT
70 // as a development engine.
71 // Author: Rene Brun
72
73 int event = gPad->GetEvent();
74 if (event != 11)
75 return;
76
77 TObject* select = gPad->GetSelected();
78 if (!select)
79 return;
80 if (!(select->InheritsFrom("TH1")))
81 return;
82
83 // create or set the new canvas c2
84 TCanvas* csingle = 0;
85 if ((csingle = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("csingle")))
86 ;
87 else
88 csingle = new TCanvas("csingle");
89 csingle->cd();
90
91 // draw slice corresponding to mouse position
92 if (!(select->InheritsFrom("TH1F"))) {
93 TH1F* h = (TH1F*)select;
94 h->Draw();
95 } else if (!(select->InheritsFrom("TH2F"))) {
96 TH2F* h = (TH2F*)select;
97 h->Draw();
98 } else if (!(select->InheritsFrom("TProfile"))) {
99 TProfile* h = (TProfile*)select;
100 h->Draw();
101 } else if (!(select->InheritsFrom("TH1D"))) {
102 TH1D* h = (TH1D*)select;
103 h->Draw();
104 } else if (!(select->InheritsFrom("TH2D"))) {
105 TH2D* h = (TH2D*)select;
106 h->Draw();
107 } else if (!(select->InheritsFrom("TProfile2D"))) {
108 TProfile2D* h = (TProfile2D*)select;
109 h->Draw();
110 } else
111 return;
112 csingle->Update();
113 }
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 SetT0shift(float shift)
TVirtualPad * cd(Int_t subpadnumber=0) override
void Update() override
void Draw(Option_t *option="") override
void Start(Bool_t reset=kTRUE)
void BmnPreparationTOF700(TString file="mpd_run_trigCode_8760.data", Long_t nEvents=0)