CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
CgemCosmicRayQA.h
Go to the documentation of this file.
1#ifndef CGEMCOSMICRAYQA
2#define CGEMCOSMICRAYQA
3
4
11
12/* #include "RealizationSvc/RealizationSvc.h"
13#include "RealizationSvc/IRealizationSvc.h"
14#include <vector>
15#include <string>
16#include "TFile.h"
17#include "TTree.h"
18#include "TString.h"
19#include "Identifier/Identifier.h"
20#include "TH1F.h"
21*/
22#include "TFile.h"
23#include "TTree.h"
24#include "TH1.h"
25#include "TH1F.h"
26#include "TH1D.h"
27#include "TF1.h"
28#include "TH2.h"
29#include "TH2F.h"
30#include "TH2D.h"
31#include "TArc.h"
32#include "TLine.h"
33#include "TCanvas.h"
34#include "TGraph2D.h"
35#include <Math/Functor.h>
36#include <TPolyLine3D.h>
37#include <Math/Vector3D.h>
38#include <Fit/Fitter.h>
39#include "TMath.h"
40#include "TCanvas.h"
41#include "TGraphErrors.h"
42
43class IDataProviderSvc;
44
45#define MAXNOFTRACKS 5
46#define MAXNOFCLUSTERS 500 // HACK THIS 10000
47
48#define MAXNOFHITS 2400
49#define MAXNOFFITPOINT 6
50#define MAXNOFLAYER 3
51#define MAXNOFSHEET 2
52// stripID
53#define MAXNOFSTRIP_L1_x 856
54#define MAXNOFSTRIP_L1_v 1174
55#define MAXNOFSTRIP_L2_x 630
56#define MAXNOFSTRIP_L2_v 1077
57#define MAXNOFSTRIP_L3_x 832
58#define MAXNOFSTRIP_L3_v 1395
59// strip max length
60#define MAXLENGTH_L1_x 532
61#define MAXLENGTH_L2_x 690
62#define MAXLENGTH_L3_x 847
63#define MAXLENGTH_L1_v 532/TMath::Cos(TMath::DegToRad()*46.6877)
64#define MAXLENGTH_L2_v 690/TMath::Cos(TMath::DegToRad()*31.0337)
65#define MAXLENGTH_L3_v 847/TMath::Cos(TMath::DegToRad()*32.9244)
66
67#define MIN_PHI -180
68#define MIN_Z -350
69#define MIN_V 0
70#define CHI_MIN 0
71#define ANG_MIN 0
72
73#define MAX_PHI 180
74#define MAX_Z 350
75#define MAX_V 856
76#define CHI_MAX 50
77#define ANG_MAX 90
78
79#define MAX_PHI_BIN 1440//360 //720 //120
80#define MAX_Z_BIN 350//700 //100
81#define MAX_V_BIN 856
82#define CHI_BIN 50
83#define ANG_BIN 90 // 27
84
85#define PHI_STEP 0.25//1// 0.5 // 360/MAX_PHI_BIN = 360/120
86#define Z_STEP 2//1 //2*MAX_Z/MAX_Z_BIN = 1000/100
87#define V_STEP 1
88#define MIN_ENTRIES 30
89
90#define maxclusize 10
91// -----------------------------------------------------------------------
92class CgemCosmicRayQA : public Algorithm{
93public:
94 // Constructor
95 CgemCosmicRayQA(const std::string& name, ISvcLocator* pSvcLocator);
97 // Executable
98 StatusCode initialize();
99 StatusCode execute ();
100 StatusCode finalize ();
101
102 bool read_file(TString name);
103 void define_output();
104 void define_hit_histo();
107 void define_track_histo();
108 //
112
113 void fill_hit_histo();
116 void fill_track_histo();
117 //
120
121
122 int find_closest_exp_cluster2d(double fphi, double fz);
123 int find_closest_exp_cluster1dx(double fphi);
124 int find_closest_exp_cluster1dv(double fphi, double fz);
125 bool apply_cuts();
126
127 void analyze();
128 void histo_cosmetics();
129
130 //
131 bool plot_debug_tpc(int id_2D);
132 void calibration_tpc(int id_2D);
133 void tpc_finalize();
134
135private:
136
137 // A data server
138 IDataProviderSvc* m_evtSvc;
139
140 CgemLUTReader *lutreader;
141 string lutfile;
142
143 CgemGeoReadoutPlane *anode;
144 double anode_mid_gap_L1;
145 double anode_mid_gap_L2;
146
147 ICgemGeomSvc *m_SvcCgem;
148 CgemMidDriftPlane* middleplane;
149 CgemGeoAlign* alignment;
150
151 double minDigiTime ;
152 double maxDigiTime;
153 double select_size;
154 double cut_chi2;
155 double cut_ene_L1_x;
156 double cut_ene_L1_v;
157 double cut_ene_L2_x;
158 double cut_ene_L2_v;
159 double cut_ene_L3_x;
160 double cut_ene_L3_v;
161 int cut_size_L1_x;
162 int cut_size_L1_v;
163 int cut_size_L2_x;
164 int cut_size_L2_v;
165 int cut_size_L3_x;
166 int cut_size_L3_v;
167 double cut_phi_min_L1;
168 double cut_phi_min_L2;
169 double cut_phi_min_L3;
170 double cut_phi_max_L1;
171 double cut_phi_max_L2;
172 double cut_phi_max_L3;
173 double cut_z_min_L1;
174 double cut_z_min_L2;
175 double cut_z_min_L3;
176 double cut_z_max_L1;
177 double cut_z_max_L2;
178 double cut_z_max_L3;
179
180 bool align_flag;
181 int NSIGMA_INSIDE;
182
183 double anode_mid_gap_radius[3];
184
185 string filename;
186 TFile *input;
187 TFile *output;
188 TTree *tree;
189
190 // hit
191 int event;
192 int nhit;
193 int hit_strip[MAXNOFHITS];
194 int hit_view[MAXNOFHITS];
195 int hit_layer[MAXNOFHITS];
196 int hit_sheet[MAXNOFHITS];
197 double hit_length[MAXNOFHITS];
198 int hit_channel[MAXNOFHITS];
199 int hit_roc[MAXNOFHITS];
200 int hit_feb[MAXNOFHITS];
201 int hit_tiger[MAXNOFHITS];
202 int hit_chip[MAXNOFHITS];
203 double hit_t[MAXNOFHITS];
204 double hit_q[MAXNOFHITS];
205 double hit_x_tpc[MAXNOFHITS];
206 double hit_z_tpc[MAXNOFHITS];
207 double hit_ex_tpc[MAXNOFHITS];
208 double hit_ez_tpc[MAXNOFHITS];
209 double hit_deltax_tpc[MAXNOFHITS];
210 double hit_deltaz_tpc[MAXNOFHITS];
211 int hit_order[MAXNOFHITS];
212 int hit_quality[MAXNOFHITS];
213 int hit_selgooddigi[MAXNOFHITS];
214
215 // cluster
216 int ncluster;
217 int ncluster_1d;
218 int ncluster_2d;
219 int ncluster_2d_L1_S1;
220 int ncluster_2d_L2_S1;
221 int ncluster_2d_L2_S2;
222 int ncluster_2d_L3_S1;
223 int ncluster_2d_L3_S2;
224 int ncluster_1d_L1_S1_x;
225 int ncluster_1d_L2_S1_x;
226 int ncluster_1d_L2_S2_x;
227 int ncluster_1d_L3_S1_x;
228 int ncluster_1d_L3_S2_x;
229 int ncluster_1d_L1_S1_v;
230 int ncluster_1d_L2_S1_v;
231 int ncluster_1d_L2_S2_v;
232 int ncluster_1d_L3_S1_v;
233 int ncluster_1d_L3_S2_v;
234
235
236 // 1D cluster
237 double cluster_1d_t[MAXNOFCLUSTERS];
238 double cluster_1d_q[MAXNOFCLUSTERS];
239 double cluster_1d_r[MAXNOFCLUSTERS];
240 double cluster_1d_phi[MAXNOFCLUSTERS];
241 double cluster_1d_v[MAXNOFCLUSTERS];
242 double cluster_1d_v_cc[MAXNOFCLUSTERS];
243 double cluster_1d_phi_cc[MAXNOFCLUSTERS];
244 double cluster_1d_v_tpc[MAXNOFCLUSTERS];
245 double cluster_1d_phi_tpc[MAXNOFCLUSTERS];
246 double cluster_1d_slope_tpc[MAXNOFCLUSTERS];
247 double cluster_1d_inter_tpc[MAXNOFCLUSTERS];
248 double cluster_1d_size_tpc[MAXNOFCLUSTERS];
249 int cluster_1d_layerid[MAXNOFCLUSTERS];
250 int cluster_1d_sheetid[MAXNOFCLUSTERS];
251 int cluster_1d_view[MAXNOFCLUSTERS];
252 int cluster_1d_ID[MAXNOFCLUSTERS];
253 int cluster_1d_strip1[MAXNOFCLUSTERS];
254 int cluster_1d_strip2[MAXNOFCLUSTERS];
255 int cluster_1d_size[MAXNOFCLUSTERS];
256 int cluster_1d_hitindex[MAXNOFCLUSTERS][50];
257
258 // 2D cluster
259 double cluster_2d_t[MAXNOFCLUSTERS];
260 double cluster_2d_q[MAXNOFCLUSTERS];
261 double cluster_2d_r[MAXNOFCLUSTERS];
262 double cluster_2d_phi[MAXNOFCLUSTERS];
263 double cluster_2d_z[MAXNOFCLUSTERS];
264 double cluster_2d_z_cc[MAXNOFCLUSTERS];
265 double cluster_2d_phi_cc[MAXNOFCLUSTERS];
266 double cluster_2d_z_tpc[MAXNOFCLUSTERS];
267 double cluster_2d_phi_tpc[MAXNOFCLUSTERS];
268 int cluster_2d_layerid[MAXNOFCLUSTERS];
269 int cluster_2d_sheetid[MAXNOFCLUSTERS];
270 int cluster_2d_view[MAXNOFCLUSTERS];
271 int cluster_2d_ID[MAXNOFCLUSTERS];
272 int cluster_2d_idx[MAXNOFCLUSTERS];
273 int cluster_2d_idv[MAXNOFCLUSTERS];
274 int cluster_2d_highest[MAXNOFCLUSTERS];
275
276 // track
277 double track_dr;
278 double track_phi0;
279 double track_dz;
280 double track_tanL;
281 double track_chi2;
282 int track_nfitpoint;
283 int track_clusterid[MAXNOFFITPOINT];
284 int track_layerid[MAXNOFFITPOINT];
285 int track_sheetid[MAXNOFFITPOINT];
286 int track_test_layerid;
287 int track_test_sheetid;
288 double track_xpoca_glo;
289 double track_ypoca_glo;
290 double track_zpoca_glo;
291 double track_x1top_glo;
292 double track_y1top_glo;
293 double track_z1top_glo;
294 double track_phi1top_loc;
295 double track_v1top_loc;
296 double track_x1bot_glo;
297 double track_y1bot_glo;
298 double track_z1bot_glo;
299 double track_phi1bot_loc;
300 double track_v1bot_loc;
301
302 double track_x2top_glo;
303 double track_y2top_glo;
304 double track_z2top_glo;
305 double track_phi2top_loc;
306 double track_v2top_loc;
307 double track_x2bot_glo;
308 double track_y2bot_glo;
309 double track_z2bot_glo;
310 double track_phi2bot_loc;
311 double track_v2bot_loc;
312
313 double track_x3top_glo;
314 double track_y3top_glo;
315 double track_z3top_glo;
316 double track_phi3top_loc;
317 double track_v3top_loc;
318 double track_x3bot_glo;
319 double track_y3bot_glo;
320 double track_z3bot_glo;
321 double track_phi3bot_loc;
322 double track_v3bot_loc;
323
324 // Intersection angles
325 // L1
326 double ang_xy_L1;
327 double ang_yz_L1;
328 // L2
329 double ang_xy_L2;
330 double ang_yz_L2;
331 //L3
332 double ang_xy_L3;
333 double ang_yz_L3;
334
335 // histograms ---------------------------------------
336 // HIT
337 // nof hits
338 // x
339 TH1F *h_nofhit_L1_S1_x;
340 TH1F *h_nofhit_L1_S2_x;
341 TH1F *h_nofhit_L2_S1_x;
342 TH1F *h_nofhit_L2_S2_x;
343 TH1F *h_nofhit_L3_S1_x;
344 TH1F *h_nofhit_L3_S2_x;
345 // v
346 TH1F *h_nofhit_L1_S1_v;
347 TH1F *h_nofhit_L2_S1_v;
348 TH1F *h_nofhit_L2_S2_v;
349 TH1F *h_nofhit_L3_S1_v;
350 TH1F *h_nofhit_L3_S2_v;
351
352 // charge
353 // x
354 TH1F *h_hit_charge_L1_S1_x;
355 TH1F *h_hit_charge_L1_S2_x;
356 TH1F *h_hit_charge_L2_S1_x;
357 TH1F *h_hit_charge_L2_S2_x;
358 TH1F *h_hit_charge_L3_S1_x;
359 TH1F *h_hit_charge_L3_S2_x;
360 // v
361 TH1F *h_hit_charge_L1_S1_v;
362 TH1F *h_hit_charge_L2_S1_v;
363 TH1F *h_hit_charge_L2_S2_v;
364 TH1F *h_hit_charge_L3_S1_v;
365 TH1F *h_hit_charge_L3_S2_v;
366 // time
367 // x
368 TH1F *h_hit_time_L1_S1_x;
369 TH1F *h_hit_time_L1_S2_x;
370 TH1F *h_hit_time_L2_S1_x;
371 TH1F *h_hit_time_L2_S2_x;
372 TH1F *h_hit_time_L3_S1_x;
373 TH1F *h_hit_time_L3_S2_x;
374 // v
375 TH1F *h_hit_time_L1_S1_v;
376 TH1F *h_hit_time_L2_S1_v;
377 TH1F *h_hit_time_L2_S2_v;
378 TH1F *h_hit_time_L3_S1_v;
379 TH1F *h_hit_time_L3_S2_v;
380 // charge vs strip ID
381 // x
382 TH2F *h_hit_charge_vs_strip_L1_S1_x;
383 TH2F *h_hit_charge_vs_strip_L1_S2_x;
384 TH2F *h_hit_charge_vs_strip_L2_S1_x;
385 TH2F *h_hit_charge_vs_strip_L2_S2_x;
386 TH2F *h_hit_charge_vs_strip_L3_S1_x;
387 TH2F *h_hit_charge_vs_strip_L3_S2_x;
388 // v
389 TH2F *h_hit_charge_vs_strip_L1_S1_v;
390 TH2F *h_hit_charge_vs_strip_L2_S1_v;
391 TH2F *h_hit_charge_vs_strip_L2_S2_v;
392 TH2F *h_hit_charge_vs_strip_L3_S1_v;
393 TH2F *h_hit_charge_vs_strip_L3_S2_v;
394 // time vs strip ID
395 // x
396 TH2F *h_hit_time_vs_strip_L1_S1_x;
397 TH2F *h_hit_time_vs_strip_L1_S2_x;
398 TH2F *h_hit_time_vs_strip_L2_S1_x;
399 TH2F *h_hit_time_vs_strip_L2_S2_x;
400 TH2F *h_hit_time_vs_strip_L3_S1_x;
401 TH2F *h_hit_time_vs_strip_L3_S2_x;
402 // v
403 TH2F *h_hit_time_vs_strip_L1_S1_v;
404 TH2F *h_hit_time_vs_strip_L2_S1_v;
405 TH2F *h_hit_time_vs_strip_L2_S2_v;
406 TH2F *h_hit_time_vs_strip_L3_S1_v;
407 TH2F *h_hit_time_vs_strip_L3_S2_v;
408 // charge vs time
409 // x
410 TH2F *h_hit_charge_vs_time_L1_S1_x;
411 TH2F *h_hit_charge_vs_time_L1_S2_x;
412 TH2F *h_hit_charge_vs_time_L2_S1_x;
413 TH2F *h_hit_charge_vs_time_L2_S2_x;
414 TH2F *h_hit_charge_vs_time_L3_S1_x;
415 TH2F *h_hit_charge_vs_time_L3_S2_x;
416 // v
417 TH2F *h_hit_charge_vs_time_L1_S1_v;
418 TH2F *h_hit_charge_vs_time_L2_S1_v;
419 TH2F *h_hit_charge_vs_time_L2_S2_v;
420 TH2F *h_hit_charge_vs_time_L3_S1_v;
421 TH2F *h_hit_charge_vs_time_L3_S2_v;
422 // charge vs length
423 // v
424 TH2F *h_hit_charge_vs_length_L1_S1_v;
425 TH2F *h_hit_charge_vs_length_L2_S1_v;
426 TH2F *h_hit_charge_vs_length_L2_S2_v;
427 TH2F *h_hit_charge_vs_length_L3_S1_v;
428 TH2F *h_hit_charge_vs_length_L3_S2_v;
429 // HIT IN TIME WINDOW
430 TH1F *h_hit_in_time_charge_L1_S1_x;
431 TH1F *h_hit_in_time_charge_L1_S2_x;
432 TH1F *h_hit_in_time_charge_L2_S1_x;
433 TH1F *h_hit_in_time_charge_L2_S2_x;
434 TH1F *h_hit_in_time_charge_L3_S1_x;
435 TH1F *h_hit_in_time_charge_L3_S2_x;
436 // v
437 TH1F *h_hit_in_time_charge_L1_S1_v;
438 TH1F *h_hit_in_time_charge_L2_S1_v;
439 TH1F *h_hit_in_time_charge_L2_S2_v;
440 TH1F *h_hit_in_time_charge_L3_S1_v;
441 TH1F *h_hit_in_time_charge_L3_S2_v;
442 // count on each strip
443 // x
444 TH1F *h_hit_in_time_strip_L1_S1_x;
445 TH1F *h_hit_in_time_strip_L1_S2_x;
446 TH1F *h_hit_in_time_strip_L2_S1_x;
447 TH1F *h_hit_in_time_strip_L2_S2_x;
448 TH1F *h_hit_in_time_strip_L3_S1_x;
449 TH1F *h_hit_in_time_strip_L3_S2_x;
450 // v
451 TH1F *h_hit_in_time_strip_L1_S1_v;
452 TH1F *h_hit_in_time_strip_L2_S1_v;
453 TH1F *h_hit_in_time_strip_L2_S2_v;
454 TH1F *h_hit_in_time_strip_L3_S1_v;
455 TH1F *h_hit_in_time_strip_L3_S2_v;
456 // charge vs strip ID
457 // x
458 TH2F *h_hit_in_time_charge_vs_strip_L1_S1_x;
459 TH2F *h_hit_in_time_charge_vs_strip_L1_S2_x;
460 TH2F *h_hit_in_time_charge_vs_strip_L2_S1_x;
461 TH2F *h_hit_in_time_charge_vs_strip_L2_S2_x;
462 TH2F *h_hit_in_time_charge_vs_strip_L3_S1_x;
463 TH2F *h_hit_in_time_charge_vs_strip_L3_S2_x;
464 // v
465 TH2F *h_hit_in_time_charge_vs_strip_L1_S1_v;
466 TH2F *h_hit_in_time_charge_vs_strip_L2_S1_v;
467 TH2F *h_hit_in_time_charge_vs_strip_L2_S2_v;
468 TH2F *h_hit_in_time_charge_vs_strip_L3_S1_v;
469 TH2F *h_hit_in_time_charge_vs_strip_L3_S2_v;
470 // CLUSTER 1d
471 // nof cluster 1d
472 // x
473 TH1F *h_nofcluster1d_L1_S1_x;
474 TH1F *h_nofcluster1d_L1_S2_x;
475 TH1F *h_nofcluster1d_L2_S1_x;
476 TH1F *h_nofcluster1d_L2_S2_x;
477 TH1F *h_nofcluster1d_L3_S1_x;
478 TH1F *h_nofcluster1d_L3_S2_x;
479 // v
480 TH1F *h_nofcluster1d_L1_S1_v;
481 TH1F *h_nofcluster1d_L2_S1_v;
482 TH1F *h_nofcluster1d_L2_S2_v;
483 TH1F *h_nofcluster1d_L3_S1_v;
484 TH1F *h_nofcluster1d_L3_S2_v;
485 // cl. size
486 // x
487 TH1F *h_cluster1d_size_L1_S1_x;
488 TH1F *h_cluster1d_size_L1_S2_x;
489 TH1F *h_cluster1d_size_L2_S1_x;
490 TH1F *h_cluster1d_size_L2_S2_x;
491 TH1F *h_cluster1d_size_L3_S1_x;
492 TH1F *h_cluster1d_size_L3_S2_x;
493 // v
494 TH1F *h_cluster1d_size_L1_S1_v;
495 TH1F *h_cluster1d_size_L2_S1_v;
496 TH1F *h_cluster1d_size_L2_S2_v;
497 TH1F *h_cluster1d_size_L3_S1_v;
498 TH1F *h_cluster1d_size_L3_S2_v;
499 // charge vs phi (x view)
500 TH2F *h_cluster1d_charge_vs_phi_L1_S1_x;
501 TH2F *h_cluster1d_charge_vs_phi_L1_S2_x;
502 TH2F *h_cluster1d_charge_vs_phi_L2_S1_x;
503 TH2F *h_cluster1d_charge_vs_phi_L2_S2_x;
504 TH2F *h_cluster1d_charge_vs_phi_L3_S1_x;
505 TH2F *h_cluster1d_charge_vs_phi_L3_S2_x;
506 // cherge vs v (v view)
507 TH2F *h_cluster1d_charge_vs_v_L1_S1_v;
508 TH2F *h_cluster1d_charge_vs_v_L2_S1_v;
509 TH2F *h_cluster1d_charge_vs_v_L2_S2_v;
510 TH2F *h_cluster1d_charge_vs_v_L3_S1_v;
511 TH2F *h_cluster1d_charge_vs_v_L3_S2_v;
512 // charge of cluster used in the fit (x view)
513 TH1F *h_cluster1d_charge_fitted_L1_S1_x;
514 TH1F *h_cluster1d_charge_fitted_L1_S2_x;
515 TH1F *h_cluster1d_charge_fitted_L2_S1_x;
516 TH1F *h_cluster1d_charge_fitted_L2_S2_x;
517 TH1F *h_cluster1d_charge_fitted_L3_S1_x;
518 TH1F *h_cluster1d_charge_fitted_L3_S2_x;
519 // charge of cluster used in the fit (v view)
520 TH1F *h_cluster1d_charge_fitted_L1_S1_v;
521 TH1F *h_cluster1d_charge_fitted_L1_S2_v;
522 TH1F *h_cluster1d_charge_fitted_L2_S1_v;
523 TH1F *h_cluster1d_charge_fitted_L2_S2_v;
524 TH1F *h_cluster1d_charge_fitted_L3_S1_v;
525 TH1F *h_cluster1d_charge_fitted_L3_S2_v;
526 // CLUSTER 2d
527 // nof cluster 2d
528 TH1F *h_nofcluster2d_L1_S1;
529 TH1F *h_nofcluster2d_L1_S2;
530 TH1F *h_nofcluster2d_L2_S1;
531 TH1F *h_nofcluster2d_L2_S2;
532 TH1F *h_nofcluster2d_L3_S1;
533 TH1F *h_nofcluster2d_L3_S2;
534 // total cl. size
535 TH1F *h_cluster2d_size_L1_S1;
536 TH1F *h_cluster2d_size_L1_S2;
537 TH1F *h_cluster2d_size_L2_S1;
538 TH1F *h_cluster2d_size_L2_S2;
539 TH1F *h_cluster2d_size_L3_S1;
540 TH1F *h_cluster2d_size_L3_S2;
541 // charge vs phi
542 TH2F *h_cluster2d_charge_vs_phi_L1_S1;
543 TH2F *h_cluster2d_charge_vs_phi_L1_S2;
544 TH2F *h_cluster2d_charge_vs_phi_L2_S1;
545 TH2F *h_cluster2d_charge_vs_phi_L2_S2;
546 TH2F *h_cluster2d_charge_vs_phi_L3_S1;
547 TH2F *h_cluster2d_charge_vs_phi_L3_S2;
548 // cherge vs z
549 TH2F *h_cluster2d_charge_vs_z_L1_S1;
550 TH2F *h_cluster2d_charge_vs_z_L1_S2;
551 TH2F *h_cluster2d_charge_vs_z_L2_S1;
552 TH2F *h_cluster2d_charge_vs_z_L2_S2;
553 TH2F *h_cluster2d_charge_vs_z_L3_S1;
554 TH2F *h_cluster2d_charge_vs_z_L3_S2;
555 // z vs phi
556 TH2F *h_cluster2d_z_vs_phi_L1_S1;
557 TH2F *h_cluster2d_z_vs_phi_L1_S2;
558 TH2F *h_cluster2d_z_vs_phi_L2_S1;
559 TH2F *h_cluster2d_z_vs_phi_L2_S2;
560 TH2F *h_cluster2d_z_vs_phi_L3_S1;
561 TH2F *h_cluster2d_z_vs_phi_L3_S2;
562 // CLUSTER 1d SELECTED
563 // charge
564 TH1F *h_cluster1d_charge_selected_L1_S1_x;
565 TH1F *h_cluster1d_charge_selected_L1_S2_x;
566 TH1F *h_cluster1d_charge_selected_L2_S1_x;
567 TH1F *h_cluster1d_charge_selected_L2_S2_x;
568 TH1F *h_cluster1d_charge_selected_L3_S1_x;
569 TH1F *h_cluster1d_charge_selected_L3_S2_x;
570 TH1F *h_cluster1d_charge_selected_L1_S1_v;
571 TH1F *h_cluster1d_charge_selected_L1_S2_v;
572 TH1F *h_cluster1d_charge_selected_L2_S1_v;
573 TH1F *h_cluster1d_charge_selected_L2_S2_v;
574 TH1F *h_cluster1d_charge_selected_L3_S1_v;
575 TH1F *h_cluster1d_charge_selected_L3_S2_v;
576 // cl. size
577 TH1F *h_cluster1d_size_selected_L1_S1_x;
578 TH1F *h_cluster1d_size_selected_L1_S2_x;
579 TH1F *h_cluster1d_size_selected_L2_S1_x;
580 TH1F *h_cluster1d_size_selected_L2_S2_x;
581 TH1F *h_cluster1d_size_selected_L3_S1_x;
582 TH1F *h_cluster1d_size_selected_L3_S2_x;
583 TH1F *h_cluster1d_size_selected_L1_S1_v;
584 TH1F *h_cluster1d_size_selected_L1_S2_v;
585 TH1F *h_cluster1d_size_selected_L2_S1_v;
586 TH1F *h_cluster1d_size_selected_L2_S2_v;
587 TH1F *h_cluster1d_size_selected_L3_S1_v;
588 TH1F *h_cluster1d_size_selected_L3_S2_v;
589 //Charge maxQ hit in lcuster
590 TH1F *h_cl_hitmaxQ_charge_selected_L1_S1_x;
591 TH1F *h_cl_hitmaxQ_charge_selected_L1_S2_x;
592 TH1F *h_cl_hitmaxQ_charge_selected_L2_S1_x;
593 TH1F *h_cl_hitmaxQ_charge_selected_L2_S2_x;
594 TH1F *h_cl_hitmaxQ_charge_selected_L3_S1_x;
595 TH1F *h_cl_hitmaxQ_charge_selected_L3_S2_x;
596 TH1F *h_cl_hitmaxQ_charge_selected_L1_S1_v;
597 TH1F *h_cl_hitmaxQ_charge_selected_L1_S2_v;
598 TH1F *h_cl_hitmaxQ_charge_selected_L2_S1_v;
599 TH1F *h_cl_hitmaxQ_charge_selected_L2_S2_v;
600 TH1F *h_cl_hitmaxQ_charge_selected_L3_S1_v;
601 TH1F *h_cl_hitmaxQ_charge_selected_L3_S2_v;
602 // CLUSTER 2d SELECTED
603 TH1F *h_cluster2d_charge_selected_L1_S1;
604 TH1F *h_cluster2d_charge_selected_L1_S2;
605 TH1F *h_cluster2d_charge_selected_L2_S1;
606 TH1F *h_cluster2d_charge_selected_L2_S2;
607 TH1F *h_cluster2d_charge_selected_L3_S1;
608 TH1F *h_cluster2d_charge_selected_L3_S2;
609 // TRACK
610 // nof fitted tracks
611 TH1F *h_noftrack;
612
613 // chi2 distro
614 TH1F *h_track_chi2;
615
616 // xpoca, ypoca, zpoca distro
617 TH1F *h_track_xpoca;
618 TH1F *h_track_ypoca;
619 TH1F *h_track_zpoca;
620
621 // TEST PLANE
622 // residual in phi
623 TH1F *h_test_residual_rphi;
624 TH1F *h_test_residual_rphi_tpc;
625
626 // residual in phi vs chi2
627 TH2F *h_test_res_rphi_vs_chi2;
628 TH2F *h_test_res_rphi_vs_chi2_tpc;
629
630 // residual in z
631 TH1F *h_test_residual_z;
632 TH1F *h_test_residual_z_tpc;
633
634 // residual in z vs chi2
635 TH2F *h_test_res_z_vs_chi2;
636 TH2F *h_test_res_z_vs_chi2_tpc;
637
638 // TRACKER
639 // residual in phi
640 TH1F *h_residual_rphi_L1_S1;
641 TH1F *h_residual_rphi_L1_S2;
642 TH1F *h_residual_rphi_L2_S1;
643 TH1F *h_residual_rphi_L2_S2;
644 TH1F *h_residual_rphi_L3_S1;
645 TH1F *h_residual_rphi_L3_S2;
646
647 TH2F *h_res_rphi_vs_chi2_L1_S1;
648 TH2F *h_res_rphi_vs_chi2_L1_S2;
649 TH2F *h_res_rphi_vs_chi2_L2_S1;
650 TH2F *h_res_rphi_vs_chi2_L2_S2;
651 TH2F *h_res_rphi_vs_chi2_L3_S1;
652 TH2F *h_res_rphi_vs_chi2_L3_S2;
653
654 // TPC residual in phi
655 TH1F *h_residual_rphi_L1_S1_tpc;
656 TH1F *h_residual_rphi_L1_S2_tpc;
657 TH1F *h_residual_rphi_L2_S1_tpc;
658 TH1F *h_residual_rphi_L2_S2_tpc;
659 TH1F *h_residual_rphi_L3_S1_tpc;
660 TH1F *h_residual_rphi_L3_S2_tpc;
661
662 TH2F *h_res_rphi_vs_chi2_L1_S1_tpc;
663 TH2F *h_res_rphi_vs_chi2_L1_S2_tpc;
664 TH2F *h_res_rphi_vs_chi2_L2_S1_tpc;
665 TH2F *h_res_rphi_vs_chi2_L2_S2_tpc;
666 TH2F *h_res_rphi_vs_chi2_L3_S1_tpc;
667 TH2F *h_res_rphi_vs_chi2_L3_S2_tpc;
668
669 // residual in z
670 TH1F *h_residual_z_L1_S1;
671 TH1F *h_residual_z_L1_S2;
672 TH1F *h_residual_z_L2_S1;
673 TH1F *h_residual_z_L2_S2;
674 TH1F *h_residual_z_L3_S1;
675 TH1F *h_residual_z_L3_S2;
676
677 TH2F *h_res_z_vs_chi2_L1_S1;
678 TH2F *h_res_z_vs_chi2_L1_S2;
679 TH2F *h_res_z_vs_chi2_L2_S1;
680 TH2F *h_res_z_vs_chi2_L2_S2;
681 TH2F *h_res_z_vs_chi2_L3_S1;
682 TH2F *h_res_z_vs_chi2_L3_S2;
683
684 // TPC residual in z
685 TH1F *h_residual_z_L1_S1_tpc;
686 TH1F *h_residual_z_L1_S2_tpc;
687 TH1F *h_residual_z_L2_S1_tpc;
688 TH1F *h_residual_z_L2_S2_tpc;
689 TH1F *h_residual_z_L3_S1_tpc;
690 TH1F *h_residual_z_L3_S2_tpc;
691
692 TH2F *h_res_z_vs_chi2_L1_S1_tpc;
693 TH2F *h_res_z_vs_chi2_L1_S2_tpc;
694 TH2F *h_res_z_vs_chi2_L2_S1_tpc;
695 TH2F *h_res_z_vs_chi2_L2_S2_tpc;
696 TH2F *h_res_z_vs_chi2_L3_S1_tpc;
697 TH2F *h_res_z_vs_chi2_L3_S2_tpc;
698
699 // signal
700 TH1F *h_signal_charge_2d;
701 TH1F *h_signal_charge_1d_x;
702 TH1F *h_signal_charge_1d_v;
703 TH1F *h_signal_size_1d_x;
704 TH1F *h_signal_size_1d_v;
705
706 TH1F *h_signal_charge_2d_chi2cut;
707 TH1F *h_signal_charge_1d_x_chi2cut;
708 TH1F *h_signal_charge_1d_v_chi2cut;
709 TH1F *h_signal_size_1d_x_chi2cut;
710 TH1F *h_signal_size_1d_v_chi2cut;
711
712 // background
713 TH1F *h_background_charge_2d;
714 TH1F *h_background_charge_1d_x;
715 TH1F *h_background_charge_1d_v;
716 TH1F *h_background_size_1d_x;
717 TH1F *h_background_size_1d_v;
718
719 // efficiencies
720 TH1F *h_eff_vs_phi;
721 TH1F *h_eff_vs_z;
722
723 TH1F *h_eff_vs_phi_1d;
724 TH1F *h_eff_vs_v_1d;
725
726 TH2F *h_eff_vs_phi_vs_z;
727
728 TH2F *h_eff_vs_phi_vs_chi2;
729 TH2F *h_eff_vs_z_vs_chi2;
730
731 TH1F *h_eff_vs_FEB;
732
733 TH1F *h_track_selection_vs_phi;
734 TH1F *h_track_selection_vs_z;
735 TH2F *h_track_selection_vs_phi_vs_z;
736
737 // Resolution vs Chi2 Plots
738 TH1F *h_resolution_rphi_vs_chi2;
739 TH1F *h_resolution_rphi_tpc_vs_chi2;
740
741 TH1F *h_resolution_z_vs_chi2;
742 TH1F *h_resolution_z_tpc_vs_chi2;
743
744 // Incident Angles
745 TH2F *h_test_residual_rphi_vs_angxy_L1_cc;
746 TH2F *h_test_residual_rphi_vs_angxy_L1_tpc;
747 TH2F *h_test_residual_rphi_vs_angxy_L2_cc;
748 TH2F *h_test_residual_rphi_vs_angxy_L2_tpc;
749 TH2F *h_test_residual_rphi_vs_angxy_L3_cc;
750 TH2F *h_test_residual_rphi_vs_angxy_L3_tpc;
751
752 TH1F *h_resolution_vs_ang_xy_L1;
753 TH1F *h_resolution_vs_ang_xy_L2;
754 TH1F *h_resolution_vs_ang_xy_L3;
755 TH1F *h_resolution_tpc_vs_ang_xy_L1;
756 TH1F *h_resolution_tpc_vs_ang_xy_L2;
757 TH1F *h_resolution_tpc_vs_ang_xy_L3;
758
759 //TPC debug
760 string output_path_tpc;
761 bool bool_plot_tpc;
762 TH2F *h_map_xy_event_trk;
763 TH2F *h_map_xz_event_trk;
764 TH2F *h_map_xy_2d;
765 TH2F *h_map_xz_2d;
766 TH2F *h_map_xy_1d_tpc;
767 TH2F *h_map_xz_1d_tpc;
768 TH2F *h_map_xy_tpc_eff;
769 TH2F *h_map_xz_tpc_eff;
770 TH2F *h_map_xy_tpc_fail;
771 TH2F *h_map_xz_tpc_fail;
772 TH2F *h_map_xy_cc_eff;
773 TH2F *h_map_xz_cc_eff;
774 TH2F *h_map_xy_cc_tpc_diff;
775 TH2F *h_map_xz_cc_tpc_diff;
776 TH2F *h_map_xy_cc_tpc_diff2;
777 TH2F *h_map_xz_cc_tpc_diff2;
778 TH2F *h_ang_trk_meas;
779 TH1F *h_ang_diff;
780 TH2F *h_ang_diff_vs_trk;
781 TH2F *h_map_xy_q2d;
782 TH2F *h_map_xz_q2d;
783 TH2F *h_map_xy_dT;
784 TH2F *h_map_xz_dT;
785 vector <float> vector_time_xy[1000][1000];
786 vector <float> vector_time_xz[1000][1000];
787
788
789 //TPC calibration and correction
790 TH1F *h_deltaX_order_size[maxclusize][maxclusize];
791 TH1F *h_deltaZ_order_size[maxclusize][maxclusize];
792 TGraphErrors *deltaX_order_L1[maxclusize];
793 TGraphErrors *deltaZ_order_L1[maxclusize];
794 TGraphErrors *deltaX_par0, *deltaX_par1, *deltaZ_par0,*deltaZ_par1, *shift0;
795 TF1 *f_deltaX[maxclusize];
796 TF1 *f_deltaZ[maxclusize];
797 float x_order[maxclusize], xx_order[maxclusize], y_deltaX[maxclusize], ey_deltaX[maxclusize], y_deltaZ[maxclusize], ey_deltaZ[maxclusize];
798 float y_deltaX_par0[maxclusize], ey_deltaX_par0[maxclusize], y_deltaX_par1[maxclusize], ey_deltaX_par1[maxclusize];
799 float y_deltaZ_par0[maxclusize], ey_deltaZ_par0[maxclusize], y_deltaZ_par1[maxclusize], ey_deltaZ_par1[maxclusize];
800 float y_shift0[maxclusize], ey_shift0[maxclusize];
801 TH1F *h_ang_tpc;
802
803
804
805 // for analysis --------------------------
806 int nfittedtrack;
807 int nchi2;
808 int nstopped;
809 int nvalidtrack;
810 int ninside;
811 int ninside1Dx;
812 int ninside1Dz;
813 int noutside;
814 int nentries_residual_rphi;
815 double mean_residual_rphi;
816 double sigma_residual_rphi;
817 int nentries_residual_z;
818 double mean_residual_z;
819 double sigma_residual_z;
820
821
822 // For Efficiency
823 int n_validtrack_phi_arr[MAX_PHI_BIN];
824 int n_insidetrack_phi_arr[MAX_PHI_BIN];
825
826 int n_validtrack_z_arr[MAX_Z_BIN];
827 int n_insidetrack_z_arr[MAX_Z_BIN];
828
829 int n_validtrack_v_arr[MAX_V_BIN];
830 int n_insidetrack_v_arr[MAX_V_BIN];
831
832 int n_validtrack_phi_chi2_mat[CHI_BIN][MAX_PHI_BIN];
833 int n_insidetrack_phi_chi2_mat[CHI_BIN][MAX_PHI_BIN];
834
835 int n_validtrack_phi_z_mat[MAX_PHI_BIN][MAX_Z_BIN];
836 int n_insidetrack_phi_z_mat[MAX_PHI_BIN][MAX_Z_BIN];
837
838 int n_validtrack_z_chi2_mat[CHI_BIN][MAX_Z_BIN];
839 int n_insidetrack_z_chi2_mat[CHI_BIN][MAX_Z_BIN];
840
841 int n_validtrack_feb_arr[80];
842 int n_insidetrack_feb_arr[80];
843
844 //Efficiency 1D
845 int n_validtrack_phi_1d_arr[MAX_PHI_BIN];
846 int n_insidetrack_phi_1d_arr[MAX_PHI_BIN];
847 int n_validtrack_v_1d_arr[MAX_PHI_BIN];
848 int n_insidetrack_v_1d_arr[MAX_PHI_BIN];
849
850
851 double chi2_cut_arr[CHI_BIN];
852
853 int test_l;
854 int test_ml;
855 int test_mh;
856 int test_h;
857 int test_p;
858
859 //
860
861 std::vector< double > vector_test_residual_rphi;
862 std::vector< double > vector_test_residual_z;
863 std::vector< double > vector_test_charge;
864 std::vector< double > vector_test_charge_x;
865 std::vector< double > vector_test_charge_v;
866
867 std::vector< double > vector_test_phi;
868 std::vector< double > vector_test_z;
869 std::vector< double > vector_fit_phi;
870 std::vector< double > vector_fit_z;
871 std::vector< double > vector_fit_v;
872 std::vector< double > vector_chi2;
873
874 std::vector< int > vector_test_size_x;
875 std::vector< int > vector_test_size_v;
876 std::vector< int > vector_test_clusterid;
877 std::vector< int > vector_test_idx;
878 std::vector< int > vector_test_idv;
879
880 std::vector< double > vector_test_phi_1d;
881 std::vector< double > vector_fit_phi_1d;
882 std::vector< double > vector_test_residual_rphi_1d;
883 std::vector< double > vector_test_v_1d;
884 std::vector< double > vector_fit_v_1d;
885 std::vector< double > vector_test_residual_v_1d;
886
887
888 int test_layer_id_all;
889 int test_sheet_id_all;
890
891};
892#endif
#define MAXNOFFITPOINT
#define CHI_BIN
#define MAX_V_BIN
#define MAXNOFCLUSTERS
#define MAX_PHI_BIN
#define maxclusize
#define MAX_Z_BIN
#define MAXNOFHITS
CgemCosmicRayQA(const std::string &name, ISvcLocator *pSvcLocator)
void calibration_tpc(int id_2D)
void define_cluster_selected_histo()
bool plot_debug_tpc(int id_2D)
int find_closest_exp_cluster1dx(double fphi)
int find_closest_exp_cluster2d(double fphi, double fz)
StatusCode initialize()
void define_cluster1d_from_fit_histo()
int find_closest_exp_cluster1dv(double fphi, double fz)
bool read_file(TString name)