BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnXTIdentificationTOF700.C
Go to the documentation of this file.
1#include <Rtypes.h>
2#include <fstream>
3R__ADD_INCLUDE_PATH($VMCWORKDIR)
4#include "bmndata/BmnEnums.h"
5#include "macro/run/bmnloadlibs.C"
6
7#define XYCALIBRATION false
8#define MINSTAT 50
9#define WRITE_NEW_CALIBRATION_FILES 0
10#define WRITE_CALIBRATION_X false
11#define WRITE_CALIBRATION_Y false
12#define WRITE_CALIBRATION_X_CHAMBER false
13#define WRITE_CALIBRATION_Y_CHAMBER false
14
15#define CALRUNNAME 1
16#define CALIBFILE "bmn_run9687_digi_calibration.root"
17#define CORRECTIONFILE "bmn_argon_protonbased_time_corrections.root"
18
19#define GEMTYPE 2
20
21// Gleb_SIGEM_v1_*.root - Gem + SILICON треки версия Глеба с damount = dx * dx / (ddxgem + ddxdch) + dy * dy / (ddygem
22// + ddydch);
23#if GEMTYPE == 0
24#define DTXDCH +0.0
25#define DTYDCH +0.0
26#define DXDCH -9.2454
27#define DYDCH +3.7912
28#define DZDCH -0.1655
29#define MINGEMNDF 4
30#define MINSIHITS 2
31#define TRACKFILE "argon_tracks_gleb_chi2_files.txt"
32
33// Gleb_SIGEM_v1_filtered_*.root - Отфильтрованный Gem + SILICON треки версия Глеба с damount = dx * dx / (ddxgem +
34// ddxdch) + dy * dy / (ddygem + ddydch);
35#elif GEMTYPE == 1
36#define DTXDCH +0.0
37#define DTYDCH +0.0
38#define DXDCH -10.2734
39#define DYDCH +3.6434
40#define DZDCH -4.26
41#define MINGEMNDF 4
42#define MINSIHITS 2
43#define TRACKFILE "argon_tracks_gleb_chi2_filter_files.txt"
44
45// Gleb_SIGEM_v2_*.root - Gem + SILICON треки версия Глеба с damount = dx * dx + dy * dy;
46#elif GEMTYPE == 2
47/*
48#define DTXDCH +0.0
49#define DTYDCH +0.0
50#define DXDCH -9.2454
51#define DYDCH +3.7912
52#define DZDCH -0.1655
53#define MINGEMNDF 6
54#define TRACKFILE "argon_tracks_gleb_files.txt"
55*/
56#define DTXDCH +0.0
57#define DTYDCH +0.0
58#define DXDCH -9.1845
59#define DYDCH +3.143
60#define DZDCH -0.1655
61#define MINGEMNDF 4
62#define MINSIHITS 2
63#define TRACKFILE "argon_tracks_lalyo_files_full.txt"
64
65// Merts_SIGEM_v1_*.root - Gem + SILICON треки версия Merts с damount = dx * dx / (ddxgem + ddxdch) + dy * dy / (ddygem
66// + ddydch);
67#elif GEMTYPE == 3
68#define DTXDCH +0.0065589
69#define DTYDCH -0.0004069
70#define DXDCH -8.00097
71#define DYDCH -3.1156
72#define DZDCH -2.32
73#define MINGEMNDF 4
74#define MINSIHITS 2
75#define TRACKFILE "argon_tracks_merts_chi2_files.txt"
76
77// Merts_SIGEM_v2_*.root - Gem + SILICON треки версия Merts с damount = dx * dx + dy * dy;
78#elif GEMTYPE == 4
79#define DTXDCH +0.0065589
80#define DTYDCH -0.0004069
81#define DXDCH -8.00097
82#define DYDCH -3.1156
83#define DZDCH -2.32
84#define MINGEMNDF 4
85#define MINSIHITS 2
86#define TRACKFILE "argon_tracks_merts_files.txt"
87
88#endif
89
90// Old Gleb
91#define DTX0DCH +0.0
92#define DTY0DCH +0.0
93#define DX0DCH -10.3038
94#define DY0DCH +2.55
95#define DZ0DCH +1.94
96
97#define MINTIME true
98
99#define GEMDEBUG false
100
101#define XYPANIN 0
102#define XYPETNEW 1
103
104// #define DXGEMDCHMAX 5.
105// #define DYGEMDCHMAX 3.
106#define DXGEMDCHMAX 2.5
107#define DYGEMDCHMAX 1.5
108
109#define USE_CLUSTERS 1
110
111#define STRIP_CORRECTIONS 1
112#define LIST_STRIP_CORRECTIONS 0
113
114// CALIBRATION - 0 - read corrections from root file *calibration.root, main time peak from TOF700_MC_time_run7.txt
115// 1 - no calibration correction on input, calculation and store corrections in *calibration.root file,
116// mean time peak from beam momentum 2 - no calibration correction on input, calculation and store
117// corrections in *calibration.root file, mean time peak from TOF700_MC_time_run7.txt 3 - no calibration
118// correction on input, calculation and store corrections in *calibration.root file, mean time peak from
119// TOF700_MC_time_run7.txt
120#define CALIBRATION 0
121
122// PRIMARY_VERTEX_CUTS = 0 - don't use additional cuts on primary vertex, 1 - use additional cuts
123#define PRIMARY_VERTEX_CUTS 1
124
125// GEMCUTS = 0 - don't use additional cuts on GEM tracks, 1 - use additional cuts
126#define GEMCUTS 1
127
128// CVERS=0 - use last calibration tables, 1 - use *;1 version
129#define CVERS 1
130
131// CFACTOR - beta factor for main time peak particles
132#define CFACTOR 0.97f
133
134// FLAG -1 - (GEM+DCH1+DCH2), 0 - all, +1 (GEM+DCH1)
135#define FLAG 0
136
137// BETAMAX max velocity for proton selection
138#define BETAMAX 1.00f
139
140// PMIN min momentum for track selection
141#define PMIN 0.5f
142
143// PMAX max momentum for track selection
144#define PMAX 5.0f
145
146// PMAX1 max momentum for proton mass limits for calculate corrections
147#define PMAX1 3.0f
148
149// PMAX2 max momentum for proton mass limits for resolution hists
150#define PMAX2 2.5f
151
152// PRES min momentum for resolution hists
153#define PRES 2.0f
154
155// PRES1 another min momentum for resolution hists
156#define PRES1 3.0f
157
158// PMAXPI max momentum for pion track selection for calculate corrections
159#define PMAXPI 3.0f
160
161// MPIMAX max limit pion mass
162#define MPIMAX 0.2f
163
164// MP proton mass
165#define MP 0.938f
166
167// MP2 proton mass sqare
168#define MP2 (MP * MP)
169
170// pion mass
171#define MPI 0.139
172
173// pion mass square
174#define MPI2 (MPI * MPI)
175
176// scale factor for min mass proton region selection
177#define DMPSCALE1 1.
178
179// scale factor for max mass proton region selection
180#define DMPSCALE2 1.
181
182// scale factor for min mass proton region selection for time hist
183#define DMPSCALET1 1.
184
185// scale factor for max mass proton region selection for time hist
186#define DMPSCALET2 1.5
187
188// scale factor for pion region selection
189#define DMPISCALE 1.
190
191// PSCALE - momentum scale factor
192// #define PSCALE 0.96f
193#define PSCALE 0.99f
194// #define PSCALE 1.00f
195
196#define WRITE_CALIBRATION 0
197
198// #define XFACTOR 5.0f
199#define XFACTOR 1.0f
200#define DISTMAX 20.0f
201#define DXMAX 5.0f
202#define DYMAX 3.0f
203#define DXMAXPAN 5.0f
204#define DYMAXPAN 5.0f
205
206#define TOFMAX 39.0f
207
208#define IN_WIDTH_LIMITS 0
209#define WMIN 2900
210#define WMAX 9000
211
212#define NUMBER_CHAMBERS 59
213
216
217int wmi[NUMBER_CHAMBERS] = {2900};
218int wma[NUMBER_CHAMBERS] = {9000};
219
220int nhi = 0;
222int nhits[NUMBER_CHAMBERS][32] = {{0}};
223float tof[NUMBER_CHAMBERS][32] = {{0.}};
224float tofWidths[NUMBER_CHAMBERS][32] = {{0.}};
225double xhi[1000], yhi[1000], zhi[1000];
226double lrd[1000];
227double xhic[1000], yhic[1000], zhic[1000];
228using namespace std;
229using namespace TMath;
230
232
235TFile *fcalc = 0, *fcals = 0;
236
237// X calibration
238
239void FitChambersX();
240void FitStripsX();
260
261float idchambers[59] = {27.1, 28.1, 3.1, 1.1, 29.1, 4.1, 33.1, 30.1, 5.1, 19.3, 31.1, 6.1,
262 2.1, 32.1, 15.2, 16.2, 17.2, 18.2, 19.2, 20.2, 7.1, 115.2, 113.1, 117.1,
263 35.1, 9.1, 37.1, 11.1, 39.1, 13.1, 34.1, 8.1, 36.1, 10.1, 38.1, 12.1,
264 21.2, 23.2, 25.2, 22.2, 24.2, 26.2, 107.2, 108.2, 109.2, 110.2, 111.2, 112.2,
265 114.1, 116.2, 118.1, 14.1, 40.1, 119.2, 120.2, 121.2, 122.2, 123.2, 124.2};
266
270
271Int_t readMCTimeFile(const char* MCTimeFile = "TOF700_MC_argon_qgsm_time_run7.txt");
272
279
280char fnametof700[256];
281
282void BmnXTIdentificationTOF700(const char* TracksGemDch = TRACKFILE,
283 const char* DigitsTOF700 = "argon_tof700_digits_files_pro_full.txt")
284{
285
286 /* Load basic libraries */
287#if ROOT_VERSION_CODE < ROOT_VERSION(5, 99, 99)
288 gROOT->LoadMacro("$VMCWORKDIR/macro/run/bmnloadlibs.C");
289#endif
290 bmnloadlibs(); // load BmnRoot libraries
291
292 int RunPeriod = 7;
293 char mapping[256];
294 if (RunPeriod >= 1 && RunPeriod <= 7) {
295 sprintf(mapping, "TOF700_map_period_%d.txt", RunPeriod);
296 } else {
297 printf("Non-existing run period number %d!", RunPeriod);
298 return;
299 }
300
301 BmnEventHeader* eventHeadertof700 = NULL;
302 TClonesArray *tof700Digits = NULL, *eventHeader = NULL;
303 TClonesArray *tracks = NULL, *mtracks = NULL;
304 CbmVertex* primaryVertex = NULL;
305 TString filename;
306
307 TChain* bmnTree = new TChain("bmndata");
308 if (strstr(TracksGemDch, ".root")) {
309 bmnTree->Add(TracksGemDch);
310 } else {
311 ifstream fin(TracksGemDch);
312 if (fin.is_open()) {
313 for (int idx = 0; idx < 1000; idx++) {
314 if (fin.eof())
315 break;
316 fin >> filename;
317 if (strlen(filename.Data()) == 0)
318 break;
319 if ((filename.Data())[0] == '#')
320 continue;
321 cout << " GEM+DCH tracks file #" << idx + 1 << " " << filename.Data() << endl;
322 bmnTree->Add(filename);
323 }
324 fin.close();
325 } else {
326 printf("Non-existing run list file: %s!", TracksGemDch);
327 return;
328 }
329 }
330 bmnTree->SetBranchAddress("EventHeader", &eventHeader);
331 bmnTree->SetBranchAddress("GemDchTracks", &mtracks);
332 bmnTree->SetBranchAddress("PrimaryVertex", &primaryVertex);
333
334 TChain* bmnTreetof700 = new TChain("bmndata");
335 if (strstr(DigitsTOF700, ".root")) {
336 bmnTreetof700->Add(DigitsTOF700); //
337 strcpy(fnametof700, DigitsTOF700);
338 } else {
339 ifstream fin(DigitsTOF700);
340 if (fin.is_open()) {
341 for (int idx = 0; idx < 1000; idx++) {
342 if (fin.eof())
343 break;
344 fin >> filename;
345 if (strlen(filename.Data()) == 0)
346 break;
347 if ((filename.Data())[0] == '#')
348 continue;
349 cout << " TOF digits file #" << idx + 1 << " " << filename.Data() << endl;
350 bmnTreetof700->Add(filename);
351 strcpy(fnametof700, filename.Data());
352 }
353 fin.close();
354 } else {
355 printf("Non-existing run list file: %s!", DigitsTOF700);
356 return;
357 }
358 }
359 bmnTreetof700->SetBranchAddress("BmnEventHeader.", &eventHeadertof700);
360 bmnTreetof700->SetBranchAddress("TOF700", &tof700Digits);
361
362 char fnametof700raw[256];
363 strcpy(fnametof700raw, fnametof700);
364 strcpy(strstr(fnametof700raw, "digi.root"), "raw.root");
365 if (XYPANIN)
366 TOF2 = new BmnTof2Raw2DigitNew(mapping, fnametof700raw, 0, 0, "TOF700_geometry_run7_panin.txt");
367 else
368 TOF2 = new BmnTof2Raw2DigitNew(mapping, fnametof700raw, 0, 0, "TOF700_geometry_run7.txt");
369
370 for (int c = 0; c < NUMBER_CHAMBERS; c++) {
371 halfwidthy[c] = 0.5f;
372 if (idchambers[c] < 100.f) {
373 halfwidthx[c] = 8.0f;
374 } else {
375 halfwidthx[c] = 28.0f;
376 }
377 wmi[c] = WMIN;
378 wma[c] = WMAX;
379 }
380
381 char name[128], title[128];
382
383 gStyle->SetOptFit(111);
384 gStyle->SetOptStat(111111);
385
386 // if (XYPETNEW) if (!ReadXYCalibration()) return;
388
389 if (CALIBRATION == 0) {
390 char fname_calib_root[128];
391#if CALRUNNAME == 0
392 TString dir = getenv("VMCWORKDIR");
393#ifdef CORRECTIONFILE
394 TString path = dir + "/input/" + CORRECTIONFILE;
395#else
396 TString path = dir + "/input/" + CALIBFILE;
397#endif
398 strcpy(fname_calib_root, path.Data());
399#else
400 char* delim = 0;
401 strcpy(fname_calib_root, gSystem->BaseName(fnametof700));
402 if ((delim = strrchr(fname_calib_root, (int)'.')))
403 *delim = '\0';
404 strcat(fname_calib_root, "_calibration.root");
405#endif
406 TFile* fc = new TFile(fname_calib_root, "READ", "Proton mass based calibration of BmnTOF700");
407 if (CVERS == 0) {
408 itcalibr = (TProfile2D*)fc->Get("tcalibr");
409 itcalibrc = (TProfile*)fc->Get("tcalibrc");
410 } else {
411 itcalibr = (TProfile2D*)fc->Get("tcalibr;1");
412 itcalibrc = (TProfile*)fc->Get("tcalibrc;1");
413 }
414 printf("\n ******************* Time offsets for whole chamber **********************\n");
415 for (int c = 0; c < NUMBER_CHAMBERS; c++) {
416 tofcalc[c] = itcalibrc->GetBinContent(c + 1);
417 printf("%d %f\n", c, tofcalc[c]);
418 }
419 if (STRIP_CORRECTIONS) {
421 printf("\n ******************* Time offsets for one strip **************************\n");
422 for (int c = 0; c < NUMBER_CHAMBERS; c++) {
424 printf("\n Chamber %d %.1f\n", c, idchambers[c]);
425 int smax = 32;
426 if (idchambers[c] >= 100.f)
427 smax = 16;
428 for (int s = 0; s < smax; s++) {
429 tofcals[c][s] = itcalibr->GetBinContent(c + 1, s + 1);
431 printf(" strip %d %f\n", s, tofcals[c][s]);
432 }
434 printf("\n *************************************************************************\n");
435 }
436 }
437 }
438
439 TFile* f = NULL;
440 if (strlen(fnametof700)) {
441 char fname_root[128], *delim = 0;
442 strcpy(fname_root, gSystem->BaseName(fnametof700));
443 if ((delim = strrchr(fname_root, (int)'.')))
444 *delim = '\0';
445 strcat(fname_root, "_identification_results.root");
446 f = new TFile(fname_root, "RECREATE", "Results of BmnTOF700");
447 }
448
449 TH1F* hntr = new TH1F("hntr", "Number of all tracks", 200, 0, 200);
450 TH1F* hntr0 = new TH1F("hntr0", "Number of selected tracks", 200, 0, 200);
451 TH1F* hntr1 = new TH1F("hntr1", "Number of tracks with FLAG conditions", 200, 0, 200);
452 TH2F* hxytr = new TH2F("hxytr", "XY tracks", 1500, -150, 150, 1000, -100, 100);
453 TH1F* hptr = new TH1F("hptr", "Momentum of tracks", 1000, -10, 10);
454 TH1F* hp0 = new TH1F("hp0", "Momentum of tracks (all)", 1000, -10, 10);
455 TH1F* hltr = new TH1F("hltr", "Lenght of GEM tracks", 100, 500, 700);
456 TH1F* hltra = new TH1F("hltra", "Lenght of GEM+DCH tracks", 100, 500, 700);
457 TH2F* hxytrtof = new TH2F("hxytrtof", "XY tracks with TOF700 hits", 1500, -150, 150, 1000, -100, 100);
458 TH2F* hxyhit = new TH2F("hxyhit", "XY track hit distance from TOF700 hit", 200, -50, 50, 40, -10, 10);
459 TH2F* hxyhitlr = new TH2F("hxyhitlr", "XY track hit distance from TOF700 hit (lr cut)", 200, -50, 50, 40, -10, 10);
460 TH1F* hlrdiffs = new TH1F("hlrdiffs", "LR difference for TOF700 hits with track (small chamber)", 100, -5, +5);
461 TH1F* hlrdiffb = new TH1F("hlrdiffb", "LR difference for TOF700 hits with track (big chamber)", 100, -5, +5);
462 TH1F* hxdiff = new TH1F("hxdiff", "X difference for TOF700 hits with track", 100, -50, +50);
463 TH2F* hxxhits = new TH2F("hxxhits", "X track hit vs TOF700 hit (small chambers)", 200, -100, 100, 200, -100, 100);
464 TH2F* hxxhitb = new TH2F("hxxhitb", "X track hit vs TOF700 hit (big chambers)", 200, -100, 100, 200, -100, 100);
465 TH2F* hlrxhits = new TH2F("hlrxhits", "X TOF700 hit vs LR difference (small chamber)", 100, -5, 5, 200, -100, 100);
466 TH2F* hlrxhitb = new TH2F("hlrxhitb", "X TOF700 hit vs LR difference (big chamber)", 100, -5, 5, 200, -100, 100);
467
468 TH2F* hlrxtrs = new TH2F("hlrxtrs", "X TOF700 tr vs LR difference (small chamber)", 100, -5, 5, 200, -100, 100);
469 TH2F* hlrxtrb = new TH2F("hlrxtrb", "X TOF700 tr vs LR difference (big chamber)", 100, -5, 5, 200, -100, 100);
470
471 TH1F* hcsignp = new TH1F("hsignp", "Chambers with right correlation (x vs lr)", 60, 0, 60);
472 TH1F* hcsignm = new TH1F("hsignm", "Chambers with wrong correlation (x vs lr)", 60, 0, 60);
473
474 TH1F* htoftr = new TH1F("htoftr", "TOF of tracks with TOF700 hits", 600, -20, 40);
475 TH1F* htof = new TH1F("htof", "TOF for hits", 600, -20, 40);
476 TH1F* hntof = new TH1F("hntof", "Number of hits", 100, 0, 100);
477 TH1F* hnhit = new TH1F("hnhit", "Number of hits in width limits", 100, 0, 100);
478 TH2F* hxytof = new TH2F("hxytof", "XY TOF700 hits", 1500, -150, 150, 1000, -100, 100);
479 TH2F* hpbeta = new TH2F("hpbeta", "Beta vs momentum", 200, 0, 10, 220, 0, 1.1f);
480 hpbeta->SetOption("COLZ");
481 TH2F* hpbetac = new TH2F("hpbetac", "Beta vs momentum, chamber corrections", 200, 0, 10, 220, 0, 1.1f);
482 hpbetac->SetOption("COLZ");
483 TH2F* hpbetas = new TH2F("hpbetas", "Beta vs momentum, strip corrections", 200, 0, 10, 220, 0, 1.1f);
484 hpbetas->SetOption("COLZ");
485 TH2F* hpbetacm = new TH2F("hpbetacm", "Beta vs momentum, Z<0, chamber corrections", 200, 0, 10, 220, 0, 1.1f);
486 hpbetacm->SetOption("COLZ");
487 TH2F* hpbetasm = new TH2F("hpbetasm", "Beta vs momentum, Z<0, strip corrections", 200, 0, 10, 220, 0, 1.1f);
488 hpbetasm->SetOption("COLZ");
489 TH1F* hmass = new TH1F("hmass", "Mass, p<2", 400, -0.5, 9.5);
490 TH1F* hmassc = new TH1F("hmassc", "Mass, chamber corrections", 400, -0.5, 9.5);
491 TH1F* hmassc15 = new TH1F("hmassc15", "Mass, chamber corrections, p<1.5", 400, -0.5, 9.5);
492 TH1F* hmassc20 = new TH1F("hmassc20", "Mass, chamber corrections, p<2.0", 400, -0.5, 9.5);
493 TH1F* hmasss = new TH1F("hmasss", "Mass, strip corrections", 400, -0.5, 9.5);
494 TH1F* hmasss15 = new TH1F("hmasss15", "Mass, strip corrections, p<1.5", 400, -0.5, 9.5);
495 TH1F* hmasss20 = new TH1F("hmasss20", "Mass, strip corrections, p<2.0", 400, -0.5, 9.5);
496 TH1F* hmasscm = new TH1F("hmasscm", "Mass, Z<0, chamber corrections", 200, -1, 4);
497 TH1F* hmasssm = new TH1F("hmasssm", "Mass, Z<0, strip corrections", 200, -1, 4);
498
499 TH1F* hdtps = new TH1F("hdtps", "Time resolution, protons, strip corrections", 200, -1., +1.);
500 TH2F* hdtpsvsp =
501 new TH2F("hdtpsvsp", "Time resolution vs momentum, protons, strip corrections", 240, 0., 6., 200, -1., +1.);
502 hdtpsvsp->SetOption("COLZ");
503 TH1F* hdtpc = new TH1F("hdtpc", "Time resolution, protons, chamber corrections", 200, -1., +1.);
504 TH2F* hdtpcvsp =
505 new TH2F("hdtpcvsp", "Time resolution vs momentum, protons, chamber corrections", 240, 0., 6., 200, -1., +1.);
506 hdtpcvsp->SetOption("COLZ");
507 TH2F* hdtpcvspwlim = new TH2F("hdtpcvspwlim", "Time resolution vs momentum, protons, chamber corrections, w>3000",
508 240, 0., 6., 200, -1., +1.);
509 hdtpcvspwlim->SetOption("COLZ");
510 TH1F* hdtpcplim = new TH1F("hdtpcplim", "Time resolution, protons, p>3", 200, -1., +1.);
511 TH1F* hdtpcp1lim = new TH1F("hdtpcp1lim", "Time resolution, protons, p>4", 200, -1., +1.);
512 TH1F* hdtpcp2lim = new TH1F("hdtpcp2lim", "Time resolution, protons, p<2", 200, -1., +1.);
513 TH1F* hdtpcp3lim = new TH1F("hdtpcp3lim", "Time resolution, protons, 2<p<5", 200, -1., +1.);
514 TH1F* hdtpcwlim = new TH1F("hdtpcwlim", "Time resolution, protons, w>3000", 200, -1., +1.);
515 TH1F* hdtpcwplim = new TH1F("hdtpcwplim", "Time resolution, protons, p>3, w>3000", 200, -1., +1.);
516 TH1F* hdtpcwp1lim = new TH1F("hdtpcwp1lim", "Time resolution, protons, p>4, w>3000", 200, -1., +1.);
517
518 TH2F* hmassvsp = new TH2F("hmassvsp", "Mass vs momentum", 240, 0., 6., 200, -0.2, 4.8);
519 hmassvsp->SetOption("COLZ");
520 TH2F* hmasssvsp = new TH2F("hmasssvsp", "Mass vs momentum, strip correction", 240, 0., 6., 200, -0.2, 4.8);
521 hmasssvsp->SetOption("COLZ");
522 TH2F* hmasscvsp = new TH2F("hmasscvsp", "Mass vs momentum, chamber corrections", 240, 0., 6., 200, -0.2, 4.8);
523 hmasscvsp->SetOption("COLZ");
524 TH2F* hmasssmvsp = new TH2F("hmasssmvsp", "Mass vs momentum, Z<0, strip correction", 240, 0., 6., 200, -0.2, 4.8);
525 hmasssmvsp->SetOption("COLZ");
526 TH2F* hmasscmvsp =
527 new TH2F("hmasscmvsp", "Mass vs momentum, Z<0, chamber corrections", 240, 0., 6., 200, -0.2, 4.8);
528 hmasscmvsp->SetOption("COLZ");
529
530 TH1F* htofp = new TH1F("htofp", "TOF for proton hits, p<2", 600, -20, 40);
531 TH1F* hstr = new TH1F("hstr", "Strips", 32, 0, 32);
532 TH1F* hcha = new TH1F("hcha", "Chambers", 60, 0, 60);
533 TH1F* hstrtr = new TH1F("hstrtr", "Strips with tracks", 32, 0, 32);
534 TH1F* hchatr = new TH1F("hchatr", "Chambers with tracks", 60, 0, 60);
535
536 TH2F* hdxy0 = new TH2F("hdxy0", "DxDy all", 40, -10, +10, 40, -10, +10);
537 TH1F* hdx = new TH1F("hdx", "dx all", 40, -10, +10);
538 TH1F* hdy = new TH1F("hdy", "dy all", 40, -10, +10);
539 TH2F* hdxy = new TH2F("hdxy", "DxDy selected", 40, -10, +10, 40, -10, +10);
540 TH2F* hdxytof = new TH2F("hdxytof", "DxDy with TOF700 hits", 40, -10, +10, 40, -10, +10);
541 TH2F* hdxyeff = new TH2F("hdxyeff", "Efficiency vs DxDy", 40, -10, +10, 40, -10, +10);
542 hdxyeff->SetOption("COLZ");
543 TH1F* hdxeff = new TH1F("hdxeff", "Efficiency vs Dx", 40, -10, +10);
544 TH1F* hdyeff = new TH1F("hdyeff", "Efficiency vs Dy", 40, -10, +10);
545 TH2F* hxygoodtr = new TH2F("hxygoodtr", "XY good tracks", 70, -140, 140, 60, -90, 90);
546 TH2F* hxygoodhit = new TH2F("hxygoodhit", "XY good tracks with good hits", 70, -140, 140, 60, -90, 90);
547 TH2F* hxyeff = new TH2F("hxyeff", "Efficiency vs XY good tracks", 70, -140, 140, 60, -90, 90);
548 hxyeff->SetOption("COLZ");
549 TH1F* hxeff = new TH1F("hxeff", "Efficiency vs X good tracks", 70, -140, 140);
550 TH1F* hyeff = new TH1F("hyeff", "Efficiency vs Y good tracks", 60, -90, 90);
551 TH1F* hdtx = new TH1F("hdtx", "dtx", 100, -0.25, +0.25);
552 TH1F* hdty = new TH1F("hdty", "dty", 100, -0.25, +0.25);
553 TH1F* hDdx = new TH1F("hDdx", "Err dx", 100, 0, 10);
554 TH1F* hDdy = new TH1F("hDdy", "Err dy", 100, 0, 10);
555 TH1F* hDdtx = new TH1F("hDdtx", "Err dtx", 100, 0, 0.05);
556 TH1F* hDdty = new TH1F("hDdty", "Err dty", 100, 0, 0.05);
557 TH1F* hpdx = new TH1F("hpdx", "Pull dx", 500, -2.5, +2.5);
558 TH1F* hpdy = new TH1F("hpdy", "Pull dy", 500, -2.5, +2.5);
559 TH1F* hpdtx = new TH1F("hpdtx", "Pull dtx", 500, -25., +25.);
560 TH1F* hpdty = new TH1F("hpdty", "Pull dty", 500, -25., +25.);
561 TH1F* hchi2m = new TH1F("hChi2m", "Chi2 GemDch track", 1000, 0, 100);
562 TH1F* hchi2 = new TH1F("hchi2", "Chi2 tracks matching", 1000, 0, 100);
563
564 TProfile2D* tcalibrs = new TProfile2D("tcalibr", "Time calibration based on proton mass, strips", NUMBER_CHAMBERS,
565 0, NUMBER_CHAMBERS, 32, 0, 32, -1., +1., "e");
566 TProfile* tcalibrc = new TProfile("tcalibrc", "Time calibration based on proton mass, chambers", NUMBER_CHAMBERS, 0,
567 NUMBER_CHAMBERS, -1., +1., "e");
568
569 TProfile* tpeak = new TProfile("tpeak", "Peak time vs chamber", NUMBER_CHAMBERS, 0, NUMBER_CHAMBERS, 0., +30., "e");
570 TProfile* bpeak =
571 new TProfile("bpeak", "Peak velosity vs chamber", NUMBER_CHAMBERS, 0, NUMBER_CHAMBERS, 0., +1.5, "e");
572
573 char nam[64], tit[64];
574
575 // X calibration
576
577 if (XYCALIBRATION) {
578 XvsLR = new TProfile2D("xvslr", "X calibration, chambers", NUMBER_CHAMBERS, 0, NUMBER_CHAMBERS, 80, -4, 4, -40.,
579 +40., "e");
580 YvsY = new TProfile2D("yvsy", "Y calibration, chambers & strips", NUMBER_CHAMBERS, 0, NUMBER_CHAMBERS, 32, 0,
581 32, -4., +4., "e");
582 for (int i = 0; i < 10; i++) {
583 sprintf(nam, "xvslrvsrun%d", i);
584 sprintf(tit, "X calibration, events %d - %d", i * 30000 + 1, (i + 1) * 30000);
585 XvsLRvsRun[i] = new TProfile2D(nam, tit, NUMBER_CHAMBERS, 0, NUMBER_CHAMBERS, 80, -4, 4, -40., +40., "e");
586 }
587 for (int i = 0; i < NUMBER_CHAMBERS; i++) {
588 sprintf(nam, "xvslrvss%d", i);
589 sprintf(tit, "X calibration, strips, chamber %.1f", idchambers[i]);
590 XvsLRvsStrip[i] = new TProfile2D(nam, tit, 32, 0, 32, 80, -4, 4, -40., +40., "e");
591 sprintf(nam, "xglobvslrvss%d", i);
592 sprintf(tit, "X global calibration, strips, chamber %.1f", idchambers[i]);
593 XvsLRvsStrip1[i] = new TProfile2D(nam, tit, 32, 0, 32, 80, -4, 4, -150., +150., "e");
594 }
595 for (int i = 0; i < NUMBER_CHAMBERS; i++) {
596 sprintf(nam, "xvslrp%d", i);
597 sprintf(tit, "X vs LR plot, chamber %.1f", idchambers[i]);
598 XvsLRp[i] = new TH2F(nam, tit, 80, -4, 4, 80, -40., +40.);
599 }
600
601 hfitx0 = new TH1F("hfitx0", "X vs LR constant", 200, -5, +5);
602 hfitx1 = new TH1F("hfitx1", "X vs LR slope", 200, -20, 20);
603 hfitx0run = new TH1F("hfitx0run", "X vs LR constant vs run", 20, 0, 20);
604 hfitx1run = new TH1F("hfitx1run", "X vs LR slope vs run", 20, 0, 20);
605 hfitxs0 = new TH1F("hfitxs0", "X vs LR constant", 100, -5, +5);
606 hfitxs1 = new TH1F("hfitxs1", "X vs LR slope", 200, -20, 20);
607 hfitxs0a = new TH1F("hfitxs0a", "X vs LR constant", 100, -5, +5);
608 hfitxs1a = new TH1F("hfitxs1a", "X vs LR slope", 200, -20, 20);
609 hfitx1s0 = new TH1F("hfitx1s0", "X vs LR constant", 600, -150, +150);
610 hfitx1s1 = new TH1F("hfitx1s1", "X vs LR slope", 200, -20, 20);
611 hfitx1s1a = new TH1F("hfitx1s1a", "X vs LR slope", 200, -20, 20);
612 hfity = new TH1F("hfity", "Y shift", 100, -5, +5);
613 hfityc = new TH1F("hfityc", "Y shift (chambers average)", 100, -5, 5);
614 }
615 //
616 float cvel = 29.97925f;
617 float ekin = 3.2f, ebeam = ekin + MP, pbeam = TMath::Sqrt(ebeam * ebeam + MP * MP);
618 float cbeam = pbeam / ebeam;
619 float cpeak = cbeam * CFACTOR * cvel;
620 float ztarg = -2.2f;
621 float zc[NUMBER_CHAMBERS] = {0.f};
622 for (int i = 0; i < NUMBER_CHAMBERS; i++) {
623 TOF2->get_chamber_z(i, &zc[i]);
624 }
625
626 Int_t startEvent = 0;
627 Int_t nEvents = bmnTree->GetEntries();
628 Int_t nEventstof700 = bmnTreetof700->GetEntries();
629 printf("\nNumber of events in tracks chain is %d (tof700 chain %d)\n", nEvents, nEventstof700);
630
631 int Ntr = 0, Ntr1 = 0, Ntr1g = 0, Ntr0 = 0;
632 Int_t iEv = 0, iEvtof700 = 0, fCurrent = -1, nevs = 0;
633 UInt_t trackEvId = 0, tof700EvId = 0;
634 UInt_t trackRunId = 0, tof700RunId = 0;
635 //
636 // printf("Run Header content:\n");
637 // DigiRunHeader * rh = (DigiRunHeader *) (bmnTreetof700->GetFile())->Get("DigiRunHeader");
638 // UInt_t PeriodId = rh->GetPeriodId();
639 // UInt_t RunId = rh->GetRunId();
640 // printf("\tPeriod: %u Run: %u\n", PeriodId, RunId);
641 //
642 TH1D *projtmp = 0, *projtmp1 = 0;
643 for (Int_t iEv0 = startEvent; iEv0 < startEvent + nEvents; iEv0++) {
644 if (iEv % 10000 == 0) {
645 cout << "Event: " << iEv << "/" << startEvent + nEvents << " ( Run " << trackRunId << " EvId " << trackEvId
646 << " )" << endl;
647 }
648 BmnGemDchTrack* gemdchtrack0 = NULL;
649 do {
650 if (iEv >= nEvents)
651 break;
652 bmnTree->GetEntry(iEv);
653 if (mtracks == NULL) {
654 iEv++;
655 continue;
656 };
657 gemdchtrack0 = (BmnGemDchTrack*)(mtracks->UncheckedAt(0));
658 // gemdchtrack0 = (BmnGemDchTrack*)(mtracks->At(0));
659 // printf("First attempt, iEv = %d, iEv0 = %d\n",iEv,iEv0);
660 iEv++;
661 } while (gemdchtrack0 == NULL);
662 // printf("Point 0, iEv = %d\n",iEv);
663 if (iEv >= nEvents)
664 break;
665 // trackEvId = gemdchtrack0->GetEventId();
666 trackEvId = ((BmnEventHeader*)eventHeader)->GetEventId();
667 // printf("Point 1, iEv = %d, trackEvId = %d\n",iEv,trackEvId);
668 if (eventHeader == NULL)
669 continue;
670 // trackRunId = ((BmnEventHeader*)eventHeader->UncheckedAt(0))->GetRunId();
671 trackRunId = ((BmnEventHeader*)eventHeader)->GetRunId();
672 // printf("Point 2, iEv = %d, trackRunId = %d\n",iEv,trackRunId);
673 if (tof700RunId == trackRunId && tof700EvId > trackEvId)
674 continue;
675 if (tof700RunId > trackRunId)
676 continue;
677 // printf("Point 3, iEv = %d\n",iEv);
678 if (!(tof700EvId == trackEvId && tof700RunId == trackRunId)) {
679 do {
680 bmnTreetof700->GetEntry(iEvtof700);
681 if (eventHeadertof700 == NULL)
682 break;
683 tof700EvId = eventHeadertof700->GetEventId();
684 // tof700RunId = ((BmnEventHeader*) eventHeadertof700->UncheckedAt(0))->GetRunId();
685 tof700RunId = eventHeadertof700->GetRunId();
686 // cout << "Tracks Event: " << iEv << ", TOF700 Event: " << iEvtof700 << endl;
687 // cout << "Tracks EventId: " << trackEvId << ", TOF700 EventId: " << tof700EvId << endl;
688 // cout << "Tracks RunId: " << trackRunId << ", TOF700 RunId: " << tof700RunId << endl;
689 iEvtof700++;
690 if (iEvtof700 >= nEventstof700)
691 break;
692 if (tof700RunId > trackRunId)
693 break;
694 if (tof700RunId == trackRunId && tof700EvId > trackEvId)
695 break;
696 } while (!(tof700EvId == trackEvId && tof700RunId == trackRunId));
697 }
698 if (eventHeadertof700 == NULL)
699 continue;
700 if (!(tof700EvId == trackEvId && tof700RunId == trackRunId)) {
701 cout << "Not found EventId " << trackEvId << " in tof700 digits file" << endl;
702 cout << "Tracks Event: " << iEv << ", TOF700 Event: " << iEvtof700 << endl;
703 cout << "Tracks RunId: " << trackRunId << ", TOF700 RunId: " << tof700RunId << endl;
704 cout << "Tracks EventId: " << trackEvId << ", TOF700 EventId: " << tof700EvId << endl;
705 if (iEvtof700 >= nEventstof700)
706 break;
707 if (tof700RunId > trackRunId)
708 continue;
709 if (tof700RunId == trackRunId && tof700EvId > trackEvId)
710 continue;
711 break;
712 // continue;
713 }
714 float wmax[NUMBER_CHAMBERS] = {0.};
715 float tmax[NUMBER_CHAMBERS] = {-10000000.};
716 int smax[NUMBER_CHAMBERS] = {-1};
717 int smax1[NUMBER_CHAMBERS] = {-1};
718 int istr[NUMBER_CHAMBERS] = {-1};
719
720 for (int i = 0; i < NUMBER_CHAMBERS; i++) {
721 wmax[i] = 0.;
722 tmax[i] = -1000000.;
723 smax[i] = -1;
724 smax1[i] = -1;
725 nhit[i] = 0;
726 for (int j = 0; j < 32; j++)
727 nhits[i][j] = 0;
728 for (int j = 0; j < 32; j++)
729 tofWidths[i][j] = 0.;
730 for (int j = 0; j < 32; j++)
731 tof[i][j] = 0.;
732 }
733 nhi = 0;
734
735 int ntof = tof700Digits->GetEntriesFast();
736 hntof->Fill(ntof);
737 float x = 0., y = 0., z = 0.;
738 float x0 = 0., y0 = 0., z0 = 0.;
739 int hchamb[1000] = {0}, hstrip[1000] = {0};
740 int clchamb[1000] = {0}, clstrip[1000] = {0};
741 Bool_t usedstrip[1000] = {false};
742 Int_t numhit[NUMBER_CHAMBERS][32] = {{0}};
743 for (Int_t iDig = 0; iDig < ntof; ++iDig) {
744 BmnTof2Digit* digit = (BmnTof2Digit*)tof700Digits->At(iDig);
745 if (digit == NULL)
746 continue;
747 Short_t plane = digit->GetPlane();
748 Short_t strip = digit->GetStrip();
749 Float_t time = digit->GetTime();
750 Float_t width = digit->GetAmplitude();
751 Float_t lrdiff = digit->GetDiff();
752 // if (iEv % 10 == 0) cout << "plane = " << plane << " strip = " << strip << " time = " << time <<
753 // " width = " << width << endl; if (iEv % 10 == 0) cout << "wmi = " << wmi[plane] << " wma = "
754 // << wma[plane] << endl;
755 if (plane >= NUMBER_CHAMBERS)
756 continue;
757 if (XYPANIN && (TOF2->get_hit_xp(plane, strip, lrdiff) == 0.))
758 continue;
759 // if (lrdiff < -0.5 || lrdiff > 0.5) continue;
760 if (IN_WIDTH_LIMITS)
761 if (width < wmi[plane] || width > wma[plane])
762 continue;
763 if (XYPANIN)
764 TOF2->get_hit_xyzp(plane, strip, lrdiff, &x, &y, &z);
765 else if (XYPETNEW) {
766 TOF2->get_hit_xyzng(plane, strip, lrdiff, &x, &y, &z);
767 if (z == 0.)
768 continue;
769 } else
770 TOF2->get_hit_xyz(plane, strip, lrdiff, &x, &y, &z);
771 smax1[plane] = strip;
772 if (width > wmax[plane]) {
773 wmax[plane] = width;
774 tmax[plane] = time;
775 smax[plane] = strip;
776 }
777 htof->Fill(time);
778 hchamb[nhi] = plane;
779 hstrip[nhi] = strip;
780 nhit[plane]++;
781 nhits[plane][strip]++;
782 tof[plane][strip] = time;
783 tofWidths[plane][strip] = width;
784 istr[plane] = strip;
785 xhi[nhi] = x;
786 yhi[nhi] = y;
787 zhi[nhi] = z;
788 lrd[nhi] = lrdiff;
789 hxytof->Fill(x, y);
790 TOF2->get_strip_xyz(plane, strip, &x, &y, &z);
791 xhic[nhi] = x;
792 yhic[nhi] = y;
793 zhic[nhi] = z;
794 hstr->Fill(strip);
795 hcha->Fill(plane);
796 numhit[plane][strip] = nhi;
797 nhi++;
798 } // tof700Digits loop
799 hnhit->Fill(nhi);
800
801 float xyz[3] = {0.}, cxyz[3] = {0.}, xrpc = 0., yrpc = 0., dz = 100., tx = 0., ty = 0., zcha = 0.;
802 float beta = 1.0f, mass = 1.0f, mass2 = 1.0f, tcor = 0., tcorc = 0., tcors = 0., tcorspi = 0., tcorcpi = 0.;
803 int nh = 0;
804 int ntr = mtracks->GetEntriesFast();
805 hntr->Fill(ntr);
806 Ntr += ntr;
807 int ntr0 = 0;
808 int ntr1 = 0, ntr1g = 0;
809 int iflag = 0, igem = 0, idch = 0;
810 float chi2 = 0.f;
811 BmnGemDchTrack* gemdchtrack = NULL;
812 BmnTrack* track = NULL;
813#if GEMTYPE > 2
814 BmnTrack* gtrack = NULL; // Merts GEM tracks
815#else
816 CbmStsTrack* gtrack = NULL; // Gleb GEM tracks
817#endif
818 Double_t xGem = 0.;
819 Double_t yGem = 0.;
820 Double_t txGem = 0.;
821 Double_t tyGem = 0.;
822 Double_t QpGem = 0.;
823 Double_t QpDch = 0.;
824 Int_t nGemHits = 0;
825 Int_t nSiHits = 0;
826 Double_t Xpv = 0.;
827 Double_t Ypv = 0.;
828 Double_t dxm = 0.;
829 Double_t dym = 0.;
830 Double_t dtx = 0.;
831 Double_t dty = 0.;
832 Double_t Ddx = 0.;
833 Double_t Ddy = 0.;
834 Double_t Ddtx = 0.;
835 Double_t Ddty = 0.;
836 Double_t Chi2m = 0.;
837 Double_t xgoodtr = 0.;
838 Double_t ygoodtr = 0.;
839 Double_t le = 0., p = 0., ps = 0., pmod = 0., lenr = 0.;
840 int himin = -1;
841 double dx, dy, dl;
842 double dist = 0., distmin = 1000000000.0f;
843 Float_t xc, yc, zc;
844 int ic;
845 int is;
846 double cosa = 0.;
847 float hidist = 0.;
848 Double_t tofr0 = 0.f;
849 Double_t tofr = 0.f;
850 Double_t tofp = 0.f;
851 Double_t tofpi = 0.f;
852 float massmin1 = 0.;
853 float massmax1 = 0.;
854 float massmin2 = 0.;
855 float massmax2 = 0.;
856
857 float massmaxpi = 0.;
858 float massminpi = 0.;
859 float tcorpi = 0.;
860 float tofrc = 0.;
861 float tofrs = 0.;
862 float betac = 0.;
863 float betas = 0.;
864 float masss2 = 0.;
865 float masss = 0.;
866 float massc2 = 0.;
867 float massc = 0.;
868 double timepeak = 0., betapeak = 0.;
869
870 for (Int_t iTr = 0; iTr < ntr; ++iTr) {
871 gemdchtrack = (BmnGemDchTrack*)mtracks->At(iTr);
872 if (gemdchtrack == NULL)
873 continue;
874 track = (BmnTrack*)gemdchtrack->GetDchTrack();
875 if (track == NULL)
876 continue;
877 if (track->GetUniqueID() != 100)
878 continue;
879 if (FLAG < 0 && track->GetFlag() >= 0)
880 continue;
881 if (FLAG > 0 && track->GetFlag() < 0)
882 continue;
883#if GEMTYPE > 2
884 gtrack = (BmnTrack*)gemdchtrack->GetGemTrack(); // Merts GEM tracks
885#else
886 gtrack = (CbmStsTrack*)gemdchtrack->GetGemTrack(); // Gleb GEM tracks
887#endif
888 if (gtrack == NULL)
889 continue;
890 // Selection criteria
891 QpGem = gtrack->GetParamLast()->GetQp();
892 QpDch = track->GetParamLast()->GetQp();
893 if (TMath::IsNaN(QpGem)) { /*printf("NaN of INF inv. momentum %f, momentum %f\n",ps,p);*/
894 continue;
895 }
896 if (TMath::IsNaN(QpDch)) { /*printf("NaN of INF inv. momentum %f, momentum %f\n",ps,p);*/
897 continue;
898 }
899 if (QpGem != 0.) {
900 hp0->Fill(1. / QpGem);
901 } else {
902 // hp0->Fill(0.);
903 }
904 // ntr1++;
905 xGem = gtrack->GetParamLast()->GetX();
906 yGem = gtrack->GetParamLast()->GetY();
907 txGem = gtrack->GetParamLast()->GetTx();
908 tyGem = gtrack->GetParamLast()->GetTy();
909#if GEMTYPE > 2
910 nGemHits = gtrack->GetNHits(); // Merts GEM tracks
911#else
912 // nGemHits = gtrack->GetNDF(); // Gleb GEM tracks
913 nGemHits = gemdchtrack->GetGemHits(); // Gleb GEM tracks
914 nSiHits = gemdchtrack->GetSiHits(); // Gleb GEM tracks
915#endif
916 Xpv = gemdchtrack->GetXpv();
917 Ypv = gemdchtrack->GetYpv();
918
919 Bool_t goodpv = true;
921 if (ntr < 2)
922 goodpv = false;
923 if (primaryVertex->GetX() < -2 || primaryVertex->GetX() > 2.5 || primaryVertex->GetY() < 1
924 || primaryVertex->GetY() > 4 || primaryVertex->GetZ() < -1 || primaryVertex->GetZ() > 2)
925 goodpv = false;
926 }
927 if (GEMCUTS)
928 if ((!goodpv) || nGemHits < MINGEMNDF || nSiHits < MINSIHITS || xGem < -140.f || xGem > 240.f
929 || yGem < -40.f || yGem > 200.f || txGem < -0.5f || txGem > 1.0f || tyGem < -0.1f || tyGem > 0.5f
930 || Xpv < -3.5f || Xpv > 4.0f || Ypv < -1.0f || Ypv > 6.0f || QpGem == 0.0f
931 || 1.0f / TMath::Abs(QpGem) > 15.0f || 1.0f / TMath::Abs(QpGem) < 0.15f)
932 {
933 if (GEMDEBUG)
934 printf("Reject: NDF %d xGem %f yGem %f txGem %f tyGem %f Xpv %f Ypv %f QpGem %f\n", nGemHits,
935 xGem, yGem, txGem, tyGem, Xpv, Ypv, QpGem);
936 continue;
937 }
938 if (GEMDEBUG)
939 printf("Accept: NDF %d xGem %f yGem %f txGem %f tyGem %f Xpv %f Ypv %f QpGem %f\n", nGemHits, xGem,
940 yGem, txGem, tyGem, Xpv, Ypv, QpGem);
941
942 ntr1++;
943 // fill matching parameters
944 dxm = gemdchtrack->GetDx();
945 dym = gemdchtrack->GetDy();
946 dtx = gemdchtrack->GetDtx();
947 dty = gemdchtrack->GetDty();
948 Ddx = gemdchtrack->GetDdx();
949 Ddy = gemdchtrack->GetDdy();
950 Ddtx = gemdchtrack->GetDdtx();
951 Ddty = gemdchtrack->GetDdty();
952 Chi2m = gemdchtrack->GetChi2();
953 hdx->Fill(dxm);
954 hdy->Fill(dym);
955 hdxy0->Fill(dxm, dym);
956 hdtx->Fill(dtx);
957 hdty->Fill(dty);
958 hDdx->Fill(sqrt(Ddx));
959 hDdy->Fill(sqrt(Ddy));
960 hDdtx->Fill(sqrt(Ddtx));
961 hDdty->Fill(sqrt(Ddty));
962 hpdx->Fill(dxm / sqrt(Ddx));
963 hpdy->Fill(dym / sqrt(Ddy));
964 hpdtx->Fill(dtx / sqrt(Ddtx));
965 hpdty->Fill(dty / sqrt(Ddty));
966 xyz[0] = track->GetParamLast()->GetX() + (DX0DCH) - (DXDCH);
967 xyz[1] = track->GetParamLast()->GetY() + (DY0DCH) - (DYDCH);
968 xyz[2] = track->GetParamLast()->GetZ() + (DZ0DCH) - (DZDCH);
969 tx = track->GetParamLast()->GetTx() + (DTX0DCH) - (DTXDCH);
970 ty = track->GetParamLast()->GetTy() + (DTY0DCH) - (DTYDCH);
971 xgoodtr = xyz[0] + tx * 100.;
972 ygoodtr = xyz[1] + ty * 100.;
973 hxytr->Fill(xgoodtr, ygoodtr);
974 // Selection criteria - x and y tracks matching
975 if (dxm < -DXGEMDCHMAX || dxm > +DXGEMDCHMAX)
976 continue;
977 if (dym < -DYGEMDCHMAX || dym > +DYGEMDCHMAX)
978 continue;
979 // if (dxm > -DXGEMDCHMAX && dxm < +DXGEMDCHMAX)
980 // if (dym > -DYGEMDCHMAX && dym < +DYGEMDCHMAX) continue;
981 hchi2m->Fill(Chi2m);
982 // if (Chi2m > 30.f) continue;
983 chi2 = dxm * dxm / Ddx + dym * dym / Ddy;
984 hchi2->Fill(chi2);
985 // if (chi2 > 30.f) continue;
986 ntr1g++;
987 hdxy->Fill(dxm, dym);
988 le = gemdchtrack->GetLength() - ztarg;
989 p = QpGem;
990 ps = p;
991 if (p == 0.)
992 continue;
993 p = 1. / p;
994 p *= PSCALE;
995 hptr->Fill(p); // GeV/c
996 hltr->Fill(le); // cm
997 pmod = TMath::Abs(p);
998 // get xyz and cxyz here
999 hxygoodtr->Fill(xgoodtr, ygoodtr);
1000 cxyz[0] = tx / TMath::Sqrt(1. + tx * tx + ty * ty);
1001 cxyz[1] = ty / TMath::Sqrt(1. + tx * tx + ty * ty);
1002 cxyz[2] = 1. / TMath::Sqrt(1. + tx * tx + ty * ty);
1003
1004 int ncl0 = 0, ncl[NUMBER_CHAMBERS] = {0};
1005 Float_t tcl[NUMBER_CHAMBERS][32] = {{0}};
1006 Int_t acl[NUMBER_CHAMBERS][32] = {{0}};
1007 Int_t wcl[NUMBER_CHAMBERS][32] = {{0}};
1008 if (USE_CLUSTERS) {
1009 for (int i = 0; i < NUMBER_CHAMBERS; i++) {
1010 ncl[i] = 0;
1011 // if (nhit[i] == 0) continue;
1012 int clstart = -1, clwidth = -1, cstr = -1;
1013 float samps = 0., timemin = 1000000000.;
1014 float widthmax = 0.;
1015 int nstr = 32;
1016 if (idchambers[i] > 100.f)
1017 nstr = 16;
1018 for (int j = 0; j < nstr && nhit[i] > 0; j++) {
1019 // if (nhits[i][j] == 0) continue;
1020 if (tofWidths[i][j] > 0.) {
1021 if (clstart < 0) {
1022 clstart = j;
1023 cstr = j;
1024 timemin = tof[i][j];
1025 widthmax = tofWidths[i][j];
1026 } else {
1027 if (MINTIME) {
1028 if (tof[i][j] < timemin) {
1029 timemin = tof[i][j];
1030 cstr = j;
1031 }
1032 } else {
1033 if (tofWidths[i][j] > widthmax) {
1034 widthmax = tofWidths[i][j];
1035 cstr = j;
1036 }
1037 }
1038 }
1039 samps += tofWidths[i][j];
1040 if (j == (nstr - 1)) {
1041 clchamb[ncl0] = i;
1042 clstrip[ncl0] = cstr;
1043 clwidth = (j + 1 - clstart);
1044 tcl[i][ncl[i]] = timemin;
1045 acl[i][ncl[i]] = samps;
1046 wcl[i][ncl[i]] = clwidth;
1047 ncl0++;
1048 ncl[i]++;
1049 samps = 0.;
1050 timemin = 1000000000.;
1051 widthmax = 0.;
1052 }
1053 } else if (clstart >= 0) {
1054 clchamb[ncl0] = i;
1055 clstrip[ncl0] = cstr;
1056 clwidth = (j - clstart);
1057 tcl[i][ncl[i]] = timemin;
1058 acl[i][ncl[i]] = samps;
1059 wcl[i][ncl[i]] = clwidth;
1060 ncl0++;
1061 ncl[i]++;
1062 samps = 0.;
1063 timemin = 1000000000.;
1064 widthmax = 0.;
1065 clstart = -1;
1066 }
1067 }
1068 }
1069 himin = -1;
1070 dist = 0.;
1071 distmin = 1000000000.0f;
1072 for (int icl = 0; icl < ncl0; icl++) {
1073 ic = clchamb[icl];
1074 is = clstrip[icl];
1075 int ih = numhit[ic][is];
1076 if (usedstrip[ih])
1077 continue;
1078 dz = zhi[ih] - xyz[2];
1079 xrpc = xyz[0] + dz * tx;
1080 yrpc = xyz[1] + dz * ty;
1081 if (!XYPANIN) {
1082 if ((xrpc - xhic[ih]) < -(halfwidthx[ic] + DXMAX)
1083 || (xrpc - xhic[ih]) > +(halfwidthx[ic] + DXMAX))
1084 continue;
1085 if ((yrpc - yhic[ih]) < -(halfwidthy[ic] + DYMAX)
1086 || (yrpc - yhic[ih]) > +(halfwidthy[ic] + DYMAX))
1087 continue;
1088 }
1089 dx = xrpc - xhi[ih];
1090 dy = yrpc - yhi[ih];
1091 if (XYPANIN) {
1092 if (TMath::Abs(dx) > DXMAXPAN)
1093 continue;
1094 if (TMath::Abs(dy) > DYMAXPAN)
1095 continue;
1096 dist = TMath::Sqrt(dx * dx + dy * dy);
1097 } else {
1098 dist = TMath::Sqrt(dx * dx / XFACTOR + dy * dy);
1099 }
1100 if (dist < distmin) {
1101 distmin = dist;
1102 himin = numhit[ic][is];
1103 }
1104 }
1105 } else {
1106 nh = nhi;
1107 himin = -1;
1108 dist = 0.;
1109 distmin = 1000000000.0f;
1110 for (int ih = 0; ih < nh; ih++) {
1111 if (usedstrip[ih])
1112 continue;
1113 ic = hchamb[ih];
1114 is = hstrip[ih];
1115 dz = zhi[ih] - xyz[2];
1116 xrpc = xyz[0] + dz * tx;
1117 yrpc = xyz[1] + dz * ty;
1118 if (!XYPANIN) {
1119 if ((xrpc - xhic[ih]) < -(halfwidthx[ic] + DXMAX)
1120 || (xrpc - xhic[ih]) > +(halfwidthx[ic] + DXMAX))
1121 continue;
1122 if ((yrpc - yhic[ih]) < -(halfwidthy[ic] + DYMAX)
1123 || (yrpc - yhic[ih]) > +(halfwidthy[ic] + DYMAX))
1124 continue;
1125 }
1126 dx = xrpc - xhi[ih];
1127 dy = yrpc - yhi[ih];
1128 if (XYPANIN) {
1129 if (TMath::Abs(dx) > DXMAXPAN)
1130 continue;
1131 if (TMath::Abs(dy) > DYMAXPAN)
1132 continue;
1133 dist = TMath::Sqrt(dx * dx + dy * dy);
1134 } else {
1135 dist = TMath::Sqrt(dx * dx / XFACTOR + dy * dy);
1136 }
1137 if (dist < distmin) {
1138 distmin = dist;
1139 himin = ih;
1140 }
1141 }
1142 }
1143 if (himin < 0)
1144 continue;
1145 // Selection criteria on minimal distance track-hit
1146 if (distmin > DISTMAX)
1147 continue;
1148 ntr0++;
1149 usedstrip[himin] = true;
1150 hdxytof->Fill(dxm, dym);
1151 hxygoodhit->Fill(xgoodtr, ygoodtr);
1152 ic = hchamb[himin];
1153 is = hstrip[himin];
1154 xc = xhic[himin];
1155 yc = yhic[himin];
1156 zc = zhic[himin];
1157 dz = zhi[himin] - xyz[2];
1158 xrpc = xyz[0] + dz * tx;
1159 yrpc = xyz[1] + dz * ty;
1160
1161 hxyhit->Fill(xrpc - xhi[himin], yrpc - yhi[himin]);
1162 if (idchambers[ic] < 100.f && fabs(lrd[himin]) < 1.)
1163 hxyhitlr->Fill(xrpc - xhi[himin], yrpc - yhi[himin]);
1164 if (idchambers[ic] > 100.f && fabs(lrd[himin]) < 2.)
1165 hxyhitlr->Fill(xrpc - xhi[himin], yrpc - yhi[himin]);
1166 if (idchambers[ic] < 100.f)
1167 hlrdiffs->Fill(lrd[himin]);
1168 if (idchambers[ic] > 100.f)
1169 hlrdiffb->Fill(lrd[himin]);
1170 hxdiff->Fill(xhi[himin] - xc);
1171 if (idchambers[ic] < 100.f)
1172 hxxhits->Fill(xhi[himin] - xc, xrpc - xc);
1173 if (idchambers[ic] > 100.f)
1174 hxxhitb->Fill(xhi[himin] - xc, xrpc - xc);
1175 if (idchambers[ic] < 100.f)
1176 hlrxhits->Fill(lrd[himin], xhi[himin] - xc);
1177 if (idchambers[ic] > 100.f)
1178 hlrxhitb->Fill(lrd[himin], xhi[himin] - xc);
1179
1180 if (idchambers[ic] < 100.f)
1181 hlrxtrs->Fill(lrd[himin], xrpc - xc);
1182 if (idchambers[ic] > 100.f)
1183 hlrxtrb->Fill(lrd[himin], xrpc - xc);
1184
1185 if (lrd[himin] > 0. && (xhi[himin] - xc) > 0.)
1186 hcsignp->Fill(ic);
1187 if (lrd[himin] < 0. && (xhi[himin] - xc) < 0.)
1188 hcsignp->Fill(ic);
1189 if (lrd[himin] > 0. && (xhi[himin] - xc) < 0.)
1190 hcsignm->Fill(ic);
1191 if (lrd[himin] < 0. && (xhi[himin] - xc) > 0.)
1192 hcsignm->Fill(ic);
1193
1194 // X calibration
1195 if (XYCALIBRATION) {
1196 XvsLRvsStrip[ic]->Fill(is, lrd[himin], xrpc - xc);
1197 XvsLRvsStrip1[ic]->Fill(is, lrd[himin], xrpc);
1198 XvsLR->Fill(ic, lrd[himin], xrpc - xc);
1199 XvsLRp[ic]->Fill(lrd[himin], xrpc - xc);
1200 YvsY->Fill(ic, is, yrpc - yc);
1201 Int_t numrun = nevs / 30000;
1202 if (numrun < 10)
1203 XvsLRvsRun[numrun]->Fill(ic, lrd[himin], xrpc - xc);
1204 nevs++;
1205 }
1206 //
1207 cosa = sqrt(1. + tx * tx + ty * ty);
1208 dl = dz * cosa;
1209 lenr = le + dl;
1210 hltra->Fill(lenr);
1211 hidist = TMath::Sqrt(xc * xc + yc * yc + (zc - ztarg) * (zc - ztarg));
1212 // Selection criteria time-of-flight
1213 if (tof[ic][is] > TOFMAX)
1214 continue;
1215 hstrtr->Fill(is);
1216 hchatr->Fill(ic);
1217 hxytrtof->Fill(xrpc, yrpc);
1218
1219 htoftr->Fill(tof[ic][is]);
1220 //
1221 tofr = 0.f;
1222 if (CALIBRATION == 0) {
1223 tofr = tof[ic][is] + tofcalmc[ic];
1224 } else if (CALIBRATION == 1) {
1225 tofr = tof[ic][is] + lenr / cpeak;
1226 } else if (CALIBRATION == 2) {
1227 tofr = tof[ic][is] + tofcalmc[ic];
1228 } else if (CALIBRATION == 3) {
1229 tofr = tof[ic][is] + tofcalmc[ic];
1230 } else {
1231 continue;
1232 }
1233 tofr0 = tof[ic][is];
1234 tofp = 0.f;
1235 tofpi = 0.f;
1236 beta = lenr / tofr / cvel;
1237 // Selection criteria
1238 if (beta <= 0.)
1239 continue;
1240 mass2 = p * p * (1.f / beta / beta - 1.f);
1241 mass = TMath::Sqrt(mass2);
1242 hpbeta->Fill(fabs(p), beta);
1243 hmass->Fill(mass2);
1244 hmassvsp->Fill(fabs(p), mass2);
1245
1246 massmin1 = MP2 - MP2 / (DMPSCALE1 * PMAX1) * (p - 0.5);
1247 massmax1 = MP2 + MP2 / (DMPSCALE2 * PMAX1) * (p - 0.5);
1248 if (p > 0.f && mass2 > massmin1 && mass2 < massmax1 && pmod > PMIN && pmod < PMAX) {
1249 tofp = (lenr / 29.97925f) * TMath::Sqrt(MP2 + p * p) / p;
1250 tcor = tofp - tofr;
1251 tcorc = tcor - tofcalc[ic];
1252 tcors = tcor - tofcals[ic][is];
1253 tcalibrc->Fill(ic, tcorc);
1254 tcalibrs->Fill(ic, is, tcors);
1255 htofp->Fill(tofr0);
1256 massmin2 = MP2 - MP2 / (DMPSCALET1 * PMAX2) * (p - 0.5);
1257 massmax2 = MP2 + MP2 / (DMPSCALET2 * PMAX2) * (p - 0.5);
1258 if (mass2 > massmin2 && mass2 < massmax2) {
1259 hdtpc->Fill(tcorc);
1260 hdtpcvsp->Fill(p, tcorc);
1261 hdtps->Fill(tcors);
1262 hdtpsvsp->Fill(p, tcors);
1263 if (p > PRES)
1264 hdtpcplim->Fill(tcorc);
1265 if (p > PRES1)
1266 hdtpcp1lim->Fill(tcorc);
1267 if (p < 2.0f)
1268 hdtpcp2lim->Fill(tcorc);
1269 if (p >= 2.0f && p < 5.0f)
1270 hdtpcp3lim->Fill(tcorc);
1271 if (tofWidths[ic][is] > WMIN && tofWidths[ic][is] < WMAX) {
1272 hdtpcwlim->Fill(tcorc);
1273 hdtpcvspwlim->Fill(p, tcorc);
1274 if (p > PRES)
1275 hdtpcwplim->Fill(tcorc);
1276 if (p > PRES1)
1277 hdtpcwp1lim->Fill(tcorc);
1278 }
1279 }
1280 }
1281 // massmaxpi = 0.1 + MPIMAX*TMath::Abs(p-0.5)/PMAXPI/DMPISCALE; // Kapishin
1282 massmaxpi = 0.1 + MPIMAX * TMath::Abs(pmod - 0.5) / PMAXPI;
1283 if (p > 0 && massmaxpi > massmin1)
1284 massmaxpi = massmin1;
1285 // massminpi =-0.1 - MPIMAX*TMath::Abs(p-0.5)/PMAXPI/DMPISCALE; // Kapishin
1286 massminpi = -0.1 - MPIMAX * TMath::Abs(pmod - 0.5) / PMAXPI;
1287 if (mass2 < massmaxpi && mass2 > massminpi && pmod > PMIN && pmod < PMAXPI) {
1288 tofpi = (lenr / 29.97925f) * TMath::Sqrt(MPI2 + p * p) / pmod;
1289 tcorpi = tofpi - tofr;
1290 tcorcpi = tcorpi - tofcalc[ic];
1291 tcorspi = tcorpi - tofcals[ic][is];
1292 tcalibrc->Fill(ic, tcorcpi);
1293 tcalibrs->Fill(ic, is, tcorspi);
1294 }
1295 timepeak = tofcalmc[ic] + tofcalc[ic];
1296 betapeak = lenr / timepeak / cvel;
1297 tpeak->Fill(ic, timepeak);
1298 bpeak->Fill(ic, betapeak);
1299 tofrc = tofr + tofcalc[ic];
1300 tofrs = tofr + tofcals[ic][is];
1301 betac = lenr / tofrc / cvel;
1302 betas = lenr / tofrs / cvel;
1303 masss2 = p * p * (1.f / betas / betas - 1.f);
1304 masss = TMath::Sqrt(masss2);
1305 massc2 = p * p * (1.f / betac / betac - 1.f);
1306 massc = TMath::Sqrt(massc2);
1307 if (p > 0) {
1308 hpbetac->Fill(p, betac);
1309 hmassc->Fill(massc2);
1310 hmasscvsp->Fill(p, massc2);
1311 hpbetas->Fill(p, betas);
1312 hmasss->Fill(masss2);
1313 hmasssvsp->Fill(p, masss2);
1314 if (p < 1.5) {
1315 hmasss15->Fill(masss2);
1316 hmassc15->Fill(massc2);
1317 }
1318 if (p < 2.0) {
1319 hmasss20->Fill(masss2);
1320 hmassc20->Fill(massc2);
1321 }
1322 } else {
1323 hpbetacm->Fill(fabs(p), betac);
1324 hmasscm->Fill(massc2);
1325 hmasscmvsp->Fill(fabs(p), massc2);
1326 hpbetasm->Fill(fabs(p), betas);
1327 hmasssm->Fill(masss2);
1328 hmasssmvsp->Fill(fabs(p), masss2);
1329 }
1330 } // tracks loop
1331 hntr1->Fill(ntr1);
1332 Ntr1 += ntr1;
1333 Ntr1g += ntr1g;
1334 hntr0->Fill(ntr0);
1335 Ntr0 += ntr0;
1336 // t_out->Fill();
1337 if (iEv % 50000 == 0) {
1338 hdxyeff->Divide(hdxytof, hdxy);
1339 hdxeff->Divide((projtmp = hdxytof->ProjectionX()), (projtmp1 = hdxy->ProjectionX()));
1340 if (projtmp)
1341 delete projtmp;
1342 if (projtmp1)
1343 delete projtmp1;
1344 hdyeff->Divide((projtmp = hdxytof->ProjectionY()), (projtmp1 = hdxy->ProjectionY()));
1345 if (projtmp)
1346 delete projtmp;
1347 if (projtmp1)
1348 delete projtmp1;
1349 hxyeff->Divide(hxygoodhit, hxygoodtr);
1350 hxeff->Divide((projtmp = hxygoodhit->ProjectionX()), (projtmp1 = hxygoodtr->ProjectionX()));
1351 if (projtmp)
1352 delete projtmp;
1353 if (projtmp1)
1354 delete projtmp1;
1355 hyeff->Divide((projtmp = hxygoodhit->ProjectionY()), (projtmp1 = hxygoodtr->ProjectionY()));
1356 if (projtmp)
1357 delete projtmp;
1358 if (projtmp1)
1359 delete projtmp1;
1360
1361 if (FLAG < 0) {
1362 printf("Number of tracks %d, per event %f\n", Ntr, (float)Ntr / nEvents);
1363 printf("GEM+DCH1+DCH2 tracks %d, per event %f (%f%% per track)\n", Ntr1, (float)Ntr1 / nEvents,
1364 (float)Ntr1 / Ntr * 100.f);
1365 printf("Good GEM+DCH1+DCH2 tracks %d, per event %f (%f%% per track)\n", Ntr0, (float)Ntr0 / nEvents,
1366 (float)Ntr0 / Ntr * 100.f);
1367 } else if (FLAG > 0) {
1368 printf("Number of tracks %d, per event %f\n", Ntr, (float)Ntr / nEvents);
1369 printf("GEM+DCH1 tracks %d, per event %f (%f%% per track)\n", Ntr1, (float)Ntr1 / nEvents,
1370 (float)Ntr1 / Ntr * 100.f);
1371 printf("Good GEM+DCH1 tracks %d, per event %f (%f%% per track)\n", Ntr0, (float)Ntr0 / nEvents,
1372 (float)Ntr0 / Ntr * 100.f);
1373 } else {
1374 printf("Number of tracks %d, per event %f\n", Ntr, (float)Ntr / nEvents);
1375 printf("GEM+DCH tracks %d, per event %f (%f%% per track)\n", Ntr1, (float)Ntr1 / nEvents,
1376 Ntr > 0 ? (float)Ntr1 / Ntr * 100.f : 0.f);
1377 printf("Good GEM+DCH tracks %d, per event %f (%f%% per valid track)\n", Ntr1g, (float)Ntr1g / nEvents,
1378 Ntr1 > 0 ? (float)Ntr1g / Ntr1 * 100.f : 0.f);
1379 printf("Matched GEM+DCH tracks %d, per event %f (%f%% per good track)\n", Ntr0, (float)Ntr0 / nEvents,
1380 Ntr1g > 0 ? (float)Ntr0 / Ntr1g * 100.f : 0.f);
1381 }
1382
1383 if (CALIBRATION != 0 && XYCALIBRATION) {
1384 FitChambersX();
1385 FitStripsX();
1386 }
1387
1388 if (f) {
1389 f->Write(NULL, TObject::kOverwrite);
1390 }
1391
1392 if (WRITE_CALIBRATION) {
1393 char fname_calibr_root[128], *delim = 0;
1394 strcpy(fname_calibr_root, gSystem->BaseName(fnametof700));
1395 if ((delim = strrchr(fname_calibr_root, (int)'.')))
1396 *delim = '\0';
1397 strcat(fname_calibr_root, "_calibration.root");
1398 TFile* fc = new TFile(fname_calibr_root, "RECREATE", "Proton mass based calibration of BmnTOF700");
1399 tcalibrs->Write();
1400 tcalibrc->Write();
1401 fc->Close();
1402 }
1403 }
1404 } // event loop
1405
1406 hdxyeff->Divide(hdxytof, hdxy);
1407 hdxeff->Divide((projtmp = hdxytof->ProjectionX()), (projtmp1 = hdxy->ProjectionX()));
1408 if (projtmp)
1409 delete projtmp;
1410 if (projtmp1)
1411 delete projtmp1;
1412 hdyeff->Divide((projtmp = hdxytof->ProjectionY()), (projtmp1 = hdxy->ProjectionY()));
1413 if (projtmp)
1414 delete projtmp;
1415 if (projtmp1)
1416 delete projtmp1;
1417 hxyeff->Divide(hxygoodhit, hxygoodtr);
1418 hxeff->Divide((projtmp = hxygoodhit->ProjectionX()), (projtmp1 = hxygoodtr->ProjectionX()));
1419 if (projtmp)
1420 delete projtmp;
1421 if (projtmp1)
1422 delete projtmp1;
1423 hyeff->Divide((projtmp = hxygoodhit->ProjectionY()), (projtmp1 = hxygoodtr->ProjectionY()));
1424 if (projtmp)
1425 delete projtmp;
1426 if (projtmp1)
1427 delete projtmp1;
1428
1429 if (FLAG < 0) {
1430 printf("Number of tracks %d, per event %f\n", Ntr, (float)Ntr / nEvents);
1431 printf("GEM+DCH1+DCH2 tracks %d, per event %f (%f%% per track)\n", Ntr1, (float)Ntr1 / nEvents,
1432 (float)Ntr1 / Ntr * 100.f);
1433 printf("Good GEM+DCH1+DCH2 tracks %d, per event %f (%f%% per track)\n", Ntr0, (float)Ntr0 / nEvents,
1434 (float)Ntr0 / Ntr * 100.f);
1435 } else if (FLAG > 0) {
1436 printf("Number of tracks %d, per event %f\n", Ntr, (float)Ntr / nEvents);
1437 printf("GEM+DCH1 tracks %d, per event %f (%f%% per track)\n", Ntr1, (float)Ntr1 / nEvents,
1438 (float)Ntr1 / Ntr * 100.f);
1439 printf("Good GEM+DCH1 tracks %d, per event %f (%f%% per track)\n", Ntr0, (float)Ntr0 / nEvents,
1440 (float)Ntr0 / Ntr * 100.f);
1441 } else {
1442 printf("Number of tracks %d, per event %f\n", Ntr, (float)Ntr / nEvents);
1443 printf("GEM+DCH tracks %d, per event %f (%f%% per track)\n", Ntr1, (float)Ntr1 / nEvents,
1444 Ntr > 0 ? (float)Ntr1 / Ntr * 100.f : 0.f);
1445 printf("Good GEM+DCH tracks %d, per event %f (%f%% per valid track)\n", Ntr1g, (float)Ntr1g / nEvents,
1446 Ntr1 > 0 ? (float)Ntr1g / Ntr1 * 100.f : 0.f);
1447 printf("Matched GEM+DCH tracks %d, per event %f (%f%% per good track)\n", Ntr0, (float)Ntr0 / nEvents,
1448 Ntr1g > 0 ? (float)Ntr0 / Ntr1g * 100.f : 0.f);
1449 }
1450
1451 if (CALIBRATION != 0 && XYCALIBRATION) {
1452 FitChambersX();
1453 FitStripsX();
1454 }
1455
1456 if (f) {
1457 f->Write(NULL, TObject::kOverwrite);
1458 }
1459
1460 if (WRITE_CALIBRATION) {
1461 char fname_calibr_root[128], *delim = 0;
1462 strcpy(fname_calibr_root, gSystem->BaseName(fnametof700));
1463 if ((delim = strrchr(fname_calibr_root, (int)'.')))
1464 *delim = '\0';
1465 strcat(fname_calibr_root, "_calibration.root");
1466 TFile* fc = new TFile(fname_calibr_root, "RECREATE", "Proton mass based calibration of BmnTOF700");
1467 tcalibrs->Write();
1468 tcalibrc->Write();
1469 fc->Close();
1470 }
1471
1472 return;
1473}
1474
1476{
1477 // example of macro called when a mouse event occurs in a pad.
1478 // Example:
1479 // Root > TFile f("hsimple.root");
1480 // Root > hpxpy.Draw();
1481 // Root > c1.AddExec("exsel","select_hist()");
1482 // When moving the mouse in the canvas, a second canvas shows the
1483 // projection along X of the bin corresponding to the Y position
1484 // of the mouse. The resulting histogram is fitted with a gaussian.
1485 // A "dynamic" line shows the current bin position in Y.
1486 // This more elaborated example can be used as a starting point
1487 // to develop more powerful interactive applications exploiting CINT
1488 // as a development engine.
1489 // Author: Rene Brun
1490
1491 int event = gPad->GetEvent();
1492 if (event != 11)
1493 return;
1494
1495 TObject* select = gPad->GetSelected();
1496 if (!select)
1497 return;
1498 if (!(select->InheritsFrom("TH1")))
1499 return;
1500
1501 // create or set the new canvas c2
1502 TCanvas* csingle = 0;
1503 if ((csingle = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("csingle")))
1504 ;
1505 else
1506 csingle = new TCanvas("csingle");
1507 csingle->cd();
1508
1509 // draw slice corresponding to mouse position
1510 if (!(select->InheritsFrom("TH1F"))) {
1511 TH1F* h = (TH1F*)select;
1512 h->Draw();
1513 } else if (!(select->InheritsFrom("TH2F"))) {
1514 TH2F* h = (TH2F*)select;
1515 h->Draw();
1516 } else if (!(select->InheritsFrom("TProfile"))) {
1517 TProfile* h = (TProfile*)select;
1518 h->Draw();
1519 } else if (!(select->InheritsFrom("TH1D"))) {
1520 TH1D* h = (TH1D*)select;
1521 h->Draw();
1522 } else if (!(select->InheritsFrom("TH2D"))) {
1523 TH2D* h = (TH2D*)select;
1524 h->Draw();
1525 } else if (!(select->InheritsFrom("TProfile2D"))) {
1526 TProfile2D* h = (TProfile2D*)select;
1527 h->Draw();
1528 } else
1529 return;
1530 csingle->Update();
1531}
1532
1533int readMCTimeFile(const char* MCTimeFile)
1534{
1535 // cout << "readMCTimeFile: " << MCTimeFile << endl;
1536 float idchambers[59] = {27.1, 28.1, 3.1, 1.1, 29.1, 4.1, 33.1, 30.1, 5.1, 19.3, 31.1, 6.1,
1537 2.1, 32.1, 15.2, 16.2, 17.2, 18.2, 19.2, 20.2, 7.1, 115.2, 113.1, 117.1,
1538 35.1, 9.1, 37.1, 11.1, 39.1, 13.1, 34.1, 8.1, 36.1, 10.1, 38.1, 12.1,
1539 21.2, 23.2, 25.2, 22.2, 24.2, 26.2, 107.2, 108.2, 109.2, 110.2, 111.2, 112.2,
1540 114.1, 116.2, 118.1, 14.1, 40.1, 119.2, 120.2, 121.2, 122.2, 123.2, 124.2};
1541 bool notused[59] = {true};
1542 int order[59] = {-1};
1543 int c = 0, cmin = -1, c0 = 0;
1544 float idmin = 200.f;
1545 for (c0 = 0; c0 < 59; c0++) {
1546 notused[c0] = true;
1547 order[c0] = -1;
1548 }
1549 for (c0 = 0; c0 < 59; c0++) {
1550 cmin = -1;
1551 idmin = 200.f;
1552 for (c = 0; c < 59; c++) {
1553 if (notused[c] && (idchambers[c] < idmin)) {
1554 idmin = idchambers[c];
1555 cmin = c;
1556 }
1557 }
1558 // printf("c0 %d cmin %d notused %d\n",c0,cmin,(int)notused[cmin]);
1559 if (cmin >= 0) {
1560 notused[cmin] = false;
1561 order[c0] = cmin;
1562 }
1563 }
1564 char fname[128];
1565 FILE* ft = 0;
1566 float time = 0.f, timesigma = 0.f;
1567 if (MCTimeFile == NULL) {
1568 printf("TOF700 MC time-of-flight file name not defined!\n");
1569 return 0;
1570 }
1571 if (strlen(MCTimeFile) == 0) {
1572 printf("TOF700 MC time-of-flight file name not defined!\n");
1573 return 0;
1574 }
1575 TString dir = getenv("VMCWORKDIR");
1576 sprintf(fname, "%s/geometry/%s", dir.Data(), MCTimeFile);
1577 ft = fopen(fname, "r");
1578 if (ft == NULL) {
1579 printf("TOF700 MC time-of-flight file %s open error!\n", fname);
1580 return 0;
1581 }
1582 int cexp = 0, ic = -1;
1583 while (fscanf(ft, "%d %f %f\n", &ic, &time, &timesigma) == 3) {
1584 if (ic > 0 && ic <= 59) {
1585 cexp = order[ic - 1];
1586 tofcalmc[cexp] = time;
1587 if (1)
1588 printf("Chamber %.1f (MC %d, EXP %d) average time-of-flight %f with sigma %f\n", idchambers[cexp], ic,
1589 cexp, time, timesigma);
1590 }
1591 }
1592 fclose(ft);
1593 return 1;
1594}
1595
1597{
1598 FILE *fdeb = 0, *fcalx = 0;
1599 TProfile* proj[NUMBER_CHAMBERS][32] = {{0}};
1600 TProfile* proj1[NUMBER_CHAMBERS][32] = {{0}};
1601 TF1 *li = 0, *li1 = 0;
1602 Int_t ncon = 0;
1603 Char_t namp[128];
1604 Char_t namf[128];
1605 Char_t filn[128];
1606 if (WRITE_CALIBRATION_X) {
1607 char fname_xcalibr_root[128], *delim = 0;
1608 strcpy(fname_xcalibr_root, gSystem->BaseName(fnametof700));
1609 if ((delim = strrchr(fname_xcalibr_root, (int)'.')))
1610 *delim = '\0';
1612 strcat(fname_xcalibr_root, "_x_calibration_new.txt");
1613 else
1614 strcat(fname_xcalibr_root, "_x_calibration.txt");
1615 fcalx = fopen(fname_xcalibr_root, "w");
1616 }
1617 sprintf(filn, "Xcalibration_strips.txt");
1619 sprintf(filn, "Xcalibration_strips_new.txt");
1620 fdeb = fopen(filn, "w");
1622 fcals = new TFile("FitPicturesStrips_new.root", "recreate");
1623 else
1624 fcals = new TFile("FitPicturesStrips.root", "recreate");
1625
1626 Double_t inter[NUMBER_CHAMBERS][32], slope[NUMBER_CHAMBERS][32];
1627 Double_t inter1[NUMBER_CHAMBERS][32], slope1[NUMBER_CHAMBERS][32];
1628 for (int ip = 0; ip < NUMBER_CHAMBERS; ip++) {
1629 int nstr = 32;
1630 Double_t lrmin = -1., lrmax = +1.;
1631 if (idchambers[ip] > 100.f) {
1632 nstr = 16;
1633 lrmin = -2.;
1634 lrmax = +2.;
1635 }
1636 for (int is = 0; is < nstr; is++) {
1637 // Local X
1638 sprintf(namp, "Chamber_%d_strip_%d_calibration", ip, is);
1639 proj[ip][is] = XvsLRvsStrip[ip]->ProfileY(namp, is + 1, is + 1);
1640 ncon = proj[ip][is]->GetEntries();
1641 if (ncon > MINSTAT) {
1642 sprintf(namf, "Chamber_%d_strip_%d_line", ip + 1, is + 1);
1643 li = new TF1(namf, "pol1", lrmin, lrmax);
1644 proj[ip][is]->Fit(namf, "QR");
1645 if (!(proj[ip][is]->GetFunction(namf))) {
1646 inter[ip][is] = 0;
1647 slope[ip][is] = 0;
1648 if (ip == 18 && fdeb) {
1649 fprintf(fdeb, "Err: Chamber %d strip %d statistic %d\n", ip, is, ncon);
1650 }
1651 } else {
1652 inter[ip][is] = proj[ip][is]->GetFunction(namf)->GetParameter(0);
1653 slope[ip][is] = proj[ip][is]->GetFunction(namf)->GetParameter(1);
1654 proj[ip][is]->Write();
1655 hfitxs0->Fill(inter[ip][is]);
1656 hfitxs1->Fill(slope[ip][is]);
1657 if (slope[ip][is] > 0.) {
1658 hfitxs0a->Fill(-inter[ip][is] / slope[ip][is]);
1659 hfitxs1a->Fill(slope[ip][is]);
1660 } else {
1661 hfitxs0a->Fill(+inter[ip][is] / slope[ip][is]);
1662 hfitxs1a->Fill(-slope[ip][is]);
1663 }
1664 if (ip == 18 && fdeb) {
1665 fprintf(fdeb, "Fit: Chamber %d strip %d statistic %d x0 %f x1 %f\n", ip, is, ncon,
1666 inter[ip][is], slope[ip][is]);
1667 }
1668 }
1669 } else {
1670 inter[ip][is] = 0;
1671 slope[ip][is] = 0;
1672 if (ip == 18 && fdeb) {
1673 fprintf(fdeb, "Non: Chamber %d strip %d statistic %d\n", ip, is, ncon);
1674 }
1675 }
1676 fprintf(fcalx, " l %3d %3d %7.2f %7.2f\n", ip, is, inter[ip][is], slope[ip][is]);
1677 // Global X
1678 sprintf(namp, "Chamber_%d_strip_%d_global_calibration", ip, is);
1679 proj1[ip][is] = XvsLRvsStrip1[ip]->ProfileY(namp, is + 1, is + 1);
1680 ncon = proj1[ip][is]->GetEntries();
1681 if (ncon > MINSTAT) {
1682 sprintf(namf, "Chamber_%d_strip_%d_global_line", ip + 1, is + 1);
1683 li1 = new TF1(namf, "pol1", lrmin, lrmax);
1684 proj1[ip][is]->Fit(namf, "QR");
1685 if (!(proj1[ip][is]->GetFunction(namf))) {
1686 inter1[ip][is] = 0;
1687 slope1[ip][is] = 0;
1688 if (ip == 18 && fdeb) {
1689 fprintf(fdeb, "Err1: Chamber %d strip %d statistic %d\n", ip, is, ncon);
1690 }
1691 } else {
1692 inter1[ip][is] = proj1[ip][is]->GetFunction(namf)->GetParameter(0);
1693 slope1[ip][is] = proj1[ip][is]->GetFunction(namf)->GetParameter(1);
1694 proj1[ip][is]->Write();
1695 hfitx1s0->Fill(inter1[ip][is]);
1696 hfitx1s1->Fill(slope1[ip][is]);
1697 if (slope1[ip][is] >= 0.) {
1698 hfitx1s1a->Fill(slope1[ip][is]);
1699 } else {
1700 hfitx1s1a->Fill(-slope1[ip][is]);
1701 }
1702 if (ip == 18 && fdeb) {
1703 fprintf(fdeb, "Fit1: Chamber %d strip %d statistic %d x0 %f x1 %f\n", ip, is, ncon,
1704 inter1[ip][is], slope1[ip][is]);
1705 }
1706 }
1707 } else {
1708 inter1[ip][is] = 0;
1709 slope1[ip][is] = 0;
1710 if (ip == 18 && fdeb) {
1711 fprintf(fdeb, "Non1: Chamber %d strip %d statistic %d\n", ip, is, ncon);
1712 }
1713 }
1714 fprintf(fcalx, " g %3d %3d %7.2f %7.2f\n", ip, is, inter1[ip][is], slope1[ip][is]);
1715 } // loop on strips
1716 } // loop on chambers
1717 fclose(fdeb);
1718 fcals->Close();
1719 if (fcalx)
1720 fclose(fcalx);
1721}
1722
1724{
1725 FILE *fdeb = 0, *fcaly = 0, *fcalyc = 0, *fcalxc = 0;
1726 TProfile *proj[NUMBER_CHAMBERS] = {0}, *projr = 0;
1727 TProfile* proj1[NUMBER_CHAMBERS] = {0};
1728 TF1 *li = 0, *lir = 0;
1729 Int_t ncon = 0;
1730 Char_t namp[128];
1731 Char_t namf[128];
1732 Char_t filn[128];
1733 char fname_ycalibr_root[128], *delim = 0;
1734 if (WRITE_CALIBRATION_Y) {
1735 strcpy(fname_ycalibr_root, gSystem->BaseName(fnametof700));
1736 if ((delim = strrchr(fname_ycalibr_root, (int)'.')))
1737 *delim = '\0';
1739 strcat(fname_ycalibr_root, "_y_calibration_new.txt");
1740 else
1741 strcat(fname_ycalibr_root, "_y_calibration.txt");
1742 fcaly = fopen(fname_ycalibr_root, "w");
1743 }
1745 strcpy(fname_ycalibr_root, gSystem->BaseName(fnametof700));
1746 if ((delim = strrchr(fname_ycalibr_root, (int)'.')))
1747 *delim = '\0';
1749 strcat(fname_ycalibr_root, "_y_calibration_chamber_new.txt");
1750 else
1751 strcat(fname_ycalibr_root, "_y_calibration_chamber.txt");
1752 fcalyc = fopen(fname_ycalibr_root, "w");
1753 }
1755 strcpy(fname_ycalibr_root, gSystem->BaseName(fnametof700));
1756 if ((delim = strrchr(fname_ycalibr_root, (int)'.')))
1757 *delim = '\0';
1759 strcat(fname_ycalibr_root, "_x_calibration_chamber_new.txt");
1760 else
1761 strcat(fname_ycalibr_root, "_x_calibration_chamber.txt");
1762 fcalxc = fopen(fname_ycalibr_root, "w");
1763 }
1764
1765 sprintf(filn, "XYcalibration_chambers.txt");
1767 sprintf(filn, "XYcalibration_chambers_new.txt");
1768 fdeb = fopen(filn, "w");
1770 fcalc = new TFile("FitPicturesChambers_new.root", "recreate");
1771 else
1772 fcalc = new TFile("FitPicturesChambers.root", "recreate");
1773
1776 for (int ip = 0; ip < NUMBER_CHAMBERS; ip++) {
1777 Int_t nstr = 32;
1778 Double_t lrmin = -1., lrmax = +1.;
1779 if (idchambers[ip] > 100.f) {
1780 nstr = 16;
1781 lrmin = -2.;
1782 lrmax = +2.;
1783 }
1784 sprintf(namp, "Chamber_%d_calibration", ip);
1785 proj[ip] = XvsLR->ProfileY(namp, ip + 1, ip + 1);
1786 ncon = proj[ip]->GetEntries();
1787 if (ncon > MINSTAT) {
1788 sprintf(namf, "Chamber_%d_line", ip);
1789 li = new TF1(namf, "pol1", lrmin, lrmax);
1790 proj[ip]->Fit(namf, "QR");
1791 if (!(proj[ip]->GetFunction(namf))) {
1792 inter[ip] = 0;
1793 slope[ip] = 0;
1794 if (fdeb) {
1795 fprintf(fdeb, "Err: Chamber %d statistic %d\n", ip, ncon);
1796 }
1797 } else {
1798 inter[ip] = proj[ip]->GetFunction(namf)->GetParameter(0);
1799 slope[ip] = proj[ip]->GetFunction(namf)->GetParameter(1);
1800 proj[ip]->Write();
1801 hfitx0->Fill(inter[ip]);
1802 hfitx1->Fill(slope[ip]);
1803 if (fdeb) {
1804 fprintf(fdeb, "Fit: Chamber %d statistic %d x0 %f x1 %f\n", ip, ncon, inter[ip], slope[ip]);
1805 }
1806 }
1807 } else {
1808 inter[ip] = 0;
1809 slope[ip] = 0;
1810 if (fdeb) {
1811 fprintf(fdeb, "Non: Chamber %d statistic %d\n", ip, ncon);
1812 }
1813 }
1814 fprintf(fcalxc, " %3d %7.2f %7.2f\n", ip, inter[ip], slope[ip]);
1815 // X vs Run
1816 for (int ir = 0; (ir < 10) && (ip == 22); ir++) {
1817 sprintf(namp, "Chamber_%d_calibration_run%d", ip, ir);
1818 projr = XvsLRvsRun[ir]->ProfileY(namp, ip + 1, ip + 1);
1819 ncon = projr->GetEntries();
1820 if (ncon > MINSTAT) {
1821 sprintf(namf, "Chamber_%d_line_run%d", ip, ir);
1822 lir = new TF1(namf, "pol1", lrmin, lrmax);
1823 projr->Fit(namf, "QR");
1824 if (projr->GetFunction(namf)) {
1825 Double_t inters = projr->GetFunction(namf)->GetParameter(0);
1826 Double_t slopes = projr->GetFunction(namf)->GetParameter(1);
1827 Double_t einters = projr->GetFunction(namf)->GetParError(0);
1828 Double_t eslopes = projr->GetFunction(namf)->GetParError(1);
1829 // projr->Write();
1830 hfitx0run->SetBinContent(ir + 1, inters);
1831 hfitx1run->SetBinContent(ir + 1, slopes);
1832 hfitx0run->SetBinError(ir + 1, einters);
1833 hfitx1run->SetBinError(ir + 1, eslopes);
1834 }
1835 }
1836 delete projr;
1837 }
1838 // Y calibration
1839 sprintf(namp, "Chamber_%d_Y_calibration", ip);
1840 proj1[ip] = YvsY->ProfileY(namp, ip + 1, ip + 1);
1841 ncon = proj1[ip]->GetEntries();
1842 if (ncon > MINSTAT) {
1843 sprintf(namf, "Chamber_%d_Y_line", ip);
1844 li = new TF1(namf, "pol0");
1845 proj1[ip]->Fit(namf, "Q");
1846 if (!(proj1[ip]->GetFunction(namf))) {
1847 shiftyc[ip] = 0;
1848 for (int is = 0; is < nstr; is++) {
1849 shift[ip][is] = 0.;
1850 fprintf(fcaly, " %3d %3d %7.2f\n", ip, is, shift[ip][is]);
1851 }
1852 if (fdeb) {
1853 fprintf(fdeb, "Err: Chamber %d statistic %d\n", ip, ncon);
1854 }
1855 } else {
1856 shiftyc[ip] = proj1[ip]->GetFunction(namf)->GetParameter(0);
1857 proj1[ip]->Write();
1858 hfityc->Fill(shiftyc[ip]);
1859 if (fdeb) {
1860 fprintf(fdeb, "Fit: Chamber %d statistic %d shiftY %f\n", ip, ncon, shiftyc[ip]);
1861 }
1862 for (int is = 0; is < nstr; is++) {
1863 shift[ip][is] = proj1[ip]->GetBinContent(is + 1);
1864 hfity->Fill(shift[ip][is]);
1865 fprintf(fcaly, " %3d %3d %7.2f\n", ip, is, shift[ip][is]);
1866 if (ip == 18 && fdeb) {
1867 fprintf(fdeb, " Strip %d statistic %d shiftY %f\n", is,
1868 (int)(proj1[ip]->GetBinEntries(is + 1)), shift[ip][is]);
1869 }
1870 }
1871 }
1872 } else {
1873 for (int is = 0; is < nstr; is++) {
1874 shift[ip][is] = 0;
1875 fprintf(fcaly, " %3d %3d %7.2f\n", ip, is, shift[ip][is]);
1876 }
1877 shiftyc[ip] = 0;
1878 if (fdeb) {
1879 fprintf(fdeb, "Non: Chamber %d statistic %d\n", ip, ncon);
1880 }
1881 }
1882 fprintf(fcalyc, " %3d %7.2f\n", ip, shiftyc[ip]);
1883 } // loop on chambers
1884 fclose(fdeb);
1885 fcalc->Close();
1886 if (fcaly)
1887 fclose(fcaly);
1888 if (fcalyc)
1889 fclose(fcalyc);
1890 if (fcalxc)
1891 fclose(fcalxc);
1892}
1894{
1895 FILE* fcalx = 0;
1896 FILE *fcaly = 0, *fcalyc = 0, *fcalxc = 0;
1897 char fname_calibr[128], *delim = 0;
1898 strcpy(fname_calibr, gSystem->BaseName(fnametof700));
1899 if ((delim = strrchr(fname_calibr, (int)'.')))
1900 *delim = '\0';
1901 strcat(fname_calibr, "_x_calibration.txt");
1902 fcalx = fopen(fname_calibr, "r");
1903 if (fcalx == NULL) {
1904 printf("File %s open error!\n", fname_calibr);
1905 return 0;
1906 }
1907 strcpy(fname_calibr, gSystem->BaseName(fnametof700));
1908 if ((delim = strrchr(fname_calibr, (int)'.')))
1909 *delim = '\0';
1910 strcat(fname_calibr, "_y_calibration.txt");
1911 fcaly = fopen(fname_calibr, "r");
1912 if (fcaly == NULL) {
1913 printf("File %s open error!\n", fname_calibr);
1914 return 0;
1915 }
1916 strcpy(fname_calibr, gSystem->BaseName(fnametof700));
1917 if ((delim = strrchr(fname_calibr, (int)'.')))
1918 *delim = '\0';
1919 strcat(fname_calibr, "_y_calibration_chamber.txt");
1920 fcalyc = fopen(fname_calibr, "r");
1921 if (fcalyc == NULL) {
1922 printf("File %s open error!\n", fname_calibr);
1923 return 0;
1924 }
1925 strcpy(fname_calibr, gSystem->BaseName(fnametof700));
1926 if ((delim = strrchr(fname_calibr, (int)'.')))
1927 *delim = '\0';
1928 strcat(fname_calibr, "_x_calibration_chamber.txt");
1929 fcalxc = fopen(fname_calibr, "r");
1930 if (fcalxc == NULL) {
1931 printf("File %s open error!\n", fname_calibr);
1932 return 0;
1933 }
1934 //
1935 Int_t nx = 0, ny = 0, nxc = 0, nyc = 0, ip = 0, is = 0;
1936 while (fscanf(fcalx, " l %d %d %lf %lf\n", &ip, &is, &interxl[ip][is], &slopexl[ip][is]) == 4) {
1937 fscanf(fcalx, " g %d %d %lf %lf\n", &ip, &is, &interxg[ip][is], &slopexg[ip][is]);
1938 nx++;
1939 };
1940 while (fscanf(fcalxc, " %d %lf %lf\n", &ip, &interxc[ip], &slopexc[ip]) == 3) {
1941 nxc++;
1942 };
1943 while (fscanf(fcaly, " %d %d %lf\n", &ip, &is, &shifty[ip][is]) == 3) {
1944 ny++;
1945 };
1946 while (fscanf(fcalyc, " %d %lf\n", &ip, &shiftyc[ip]) == 2) {
1947 nyc++;
1948 };
1949 //
1950 printf(" Read TOF700 X calibration parameters - %d strips\n", nx);
1951 printf(" Read TOF700 X calibration parameters - %d chambers\n", nxc);
1952 printf(" Read TOF700 Y calibration parameters - %d strips\n", ny);
1953 printf(" Read TOF700 Y calibration parameters - %d chambers\n", nyc);
1954 if (fcalx)
1955 fclose(fcalx);
1956 if (fcaly)
1957 fclose(fcaly);
1958 if (fcalxc)
1959 fclose(fcalxc);
1960 if (fcalyc)
1961 fclose(fcalyc);
1962 return nx;
1963}
vector< Double_t > dist(vector< Double_t > qp, Double_t mu)
Definition BmnMath.cxx:869
friend F32vec4 fabs(const F32vec4 &a)
Definition P4_F32vec4.h:52
int i
Definition P4_F32vec4.h:22
bool Bool_t
int Int_t
char Char_t
unsigned int UInt_t
float Float_t
short Short_t
double Double_t
#define R__ADD_INCLUDE_PATH(PATH)
#define gROOT
R__EXTERN TStyle * gStyle
R__EXTERN TSystem * gSystem
#define gPad
UInt_t GetEventId()
Get the event ID for this event.
Double_t GetDdtx() const
Double_t GetDtx() const
Double_t GetYpv() const
Double_t GetChi2() const
Double_t GetDdx() const
Int_t GetSiHits() const
CbmStsTrack * GetGemTrack()
Int_t GetEventId() const
Double_t GetDdty() const
Double_t GetLength() const
Double_t GetXpv() const
Double_t GetDdy() const
Double_t GetDx() const
Double_t GetDty() const
Double_t GetDy() const
Int_t GetGemHits() const
BmnTrack * GetDchTrack()
Short_t GetPlane() const
Short_t GetStrip() const
Float_t GetTime() const
Float_t GetAmplitude() const
Int_t GetNHits() const
Accessors.
Definition BmnTrack.h:49
FairTrackParam * GetParamLast()
Definition BmnTrack.h:65
Int_t GetFlag() const
Definition BmnTrack.h:53
CbmVertex.h.
Definition CbmVertex.h:21
Double_t GetZ() const
Definition CbmVertex.h:60
Double_t GetX() const
Accessors.
Definition CbmVertex.h:58
Double_t GetY() const
Definition CbmVertex.h:59
TVirtualPad * cd(Int_t subpadnumber=0) override
void Update() override
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
virtual Int_t Add(const char *name, Long64_t nentries=TTree::kMaxEntries)
Long64_t GetEntries() const override
Int_t GetEntry(Long64_t entry=0, Int_t getall=0) override
T * Get(const char *namecycle)
virtual Double_t GetParameter(const TString &name) const
void Close(Option_t *option="") override
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
void Draw(Option_t *option="") override
virtual Int_t Fill(const char *name, Double_t w)
virtual Double_t GetEntries() const
virtual TF1 * GetFunction(const char *name) const
virtual Bool_t Divide(const TH1 *h1)
virtual void SetOption(Option_t *option=" ")
TH1D * ProjectionY(const char *name="_py", Int_t firstxbin=0, Int_t lastxbin=-1, Option_t *option="") const
virtual Int_t Fill(const char *namex, const char *namey, Double_t w)
TH1D * ProjectionX(const char *name="_px", Int_t firstybin=0, Int_t lastybin=-1, Option_t *option="") const
Int_t GetEntriesFast() const
TObject * At(Int_t idx) const override
virtual UInt_t GetUniqueID() const
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Int_t Fill(const char *namex, const char *namey, Double_t z) override
Double_t GetBinContent(Int_t bin) const override
Int_t Fill(const char *namex, Double_t y) override
const char * Data() const
double beta(double x, double y)
RVec< PromoteType< T > > sqrt(const RVec< T > &v)
#define IN_WIDTH_LIMITS
int wma[NUMBER_CHAMBERS]
#define NUMBER_CHAMBERS
float idchambers[59]
int wmi[NUMBER_CHAMBERS]
#define PMAX2
int nhits[NUMBER_CHAMBERS][32]
#define CVERS
float tofWidths[NUMBER_CHAMBERS][32]
#define MPIMAX
#define DMPSCALET2
double yhi[1000]
#define GEMDEBUG
#define XYPANIN
Double_t tofcalc[NUMBER_CHAMBERS]
TProfile * itcalibrc
#define DYMAXPAN
#define DISTMAX
Float_t halfwidthy[NUMBER_CHAMBERS]
#define CALIBRATION
#define XFACTOR
Float_t halfwidthx[NUMBER_CHAMBERS]
double zhic[1000]
#define DXMAXPAN
float tof[NUMBER_CHAMBERS][32]
#define USE_CLUSTERS
double lrd[1000]
#define LIST_STRIP_CORRECTIONS
double xhi[1000]
#define STRIP_CORRECTIONS
#define DXGEMDCHMAX
double yhic[1000]
#define WRITE_CALIBRATION
#define DMPSCALE2
Double_t tofcals[NUMBER_CHAMBERS][32]
#define DXMAX
#define GEMCUTS
#define PMAXPI
#define PSCALE
Double_t tofcalmc[NUMBER_CHAMBERS]
double zhi[1000]
#define PRES1
#define DMPSCALE1
#define MINGEMNDF
#define MINTIME
#define DYMAX
double xhic[1000]
#define CFACTOR
int nhit[NUMBER_CHAMBERS]
#define PMAX1
#define DYGEMDCHMAX
#define TOFMAX
TProfile2D * itcalibr
#define DMPSCALET1
#define DXDCH
#define DTYDCH
#define DY0DCH
#define CALIBFILE
#define DTXDCH
#define DZ0DCH
#define DX0DCH
#define DYDCH
#define CORRECTIONFILE
#define PRIMARY_VERTEX_CUTS
#define MINSIHITS
#define DTX0DCH
#define TRACKFILE
#define DTY0DCH
#define DZDCH
#define XYPETNEW
Double_t slopexc[NUMBER_CHAMBERS]
Double_t slopexg[NUMBER_CHAMBERS][32]
#define WRITE_CALIBRATION_Y_CHAMBER
TFile * fcalc
TH1F * hfitx1s1
#define WRITE_CALIBRATION_X_CHAMBER
#define WRITE_CALIBRATION_Y
#define WRITE_CALIBRATION_X
TH1F * hfitx0run
TH1F * hfitx1run
#define XYCALIBRATION
Double_t slopexl[NUMBER_CHAMBERS][32]
TProfile2D * XvsLRvsRun[10]
TProfile2D * YvsY
Double_t shiftyc[NUMBER_CHAMBERS]
#define WRITE_NEW_CALIBRATION_FILES
TH2F * XvsLRp[NUMBER_CHAMBERS]
TProfile2D * XvsLR
#define MINSTAT
char fnametof700[256]
TH1F * hfitx1s1a
TProfile2D * XvsLRvsStrip1[NUMBER_CHAMBERS]
TH1F * hfitxs0a
Double_t interxg[NUMBER_CHAMBERS][32]
TProfile2D * XvsLRvsStrip[NUMBER_CHAMBERS]
Double_t interxc[NUMBER_CHAMBERS]
Double_t shifty[NUMBER_CHAMBERS][32]
TH1F * hfitxs1a
TH1F * hfitx1s0
Double_t interxl[NUMBER_CHAMBERS][32]
TFile * fcals
void FitChambersX()
void BmnXTIdentificationTOF700(const char *TracksGemDch=TRACKFILE, const char *DigitsTOF700="argon_tof700_digits_files_pro_full.txt")
int ReadXYCalibration()
Int_t readMCTimeFile(const char *MCTimeFile="TOF700_MC_argon_qgsm_time_run7.txt")
void FitStripsX()
void select_hist()
Bool_t IsNaN(Double_t x)
Double_t Sqrt(Double_t x)
Double_t Abs(Double_t d)
Definition json.hpp:4446