HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HarpoAnalyseBasic.cxx
Go to the documentation of this file.
1 //
2 // File HarpoAnalyseBasic.cxx
3 //
11 #include "TLinearFitter.h"
12 #include "HarpoAnalyseBasic.h"
13 #include "HarpoConfig.h"
14 #include "HarpoDetSet.h"
15 #include "HarpoDebug.h"
16 #include "HarpoDccEvent.h"
17 #include "HarpoEvent.h"
18 #include "Pmm2Event.h"
19 #include "HarpoRecoEvent.h"
20 #include "HarpoEvent.h"
21 //#include "HarpoMap.h"
22 #include "TFile.h"
23 #include "TStyle.h"
24 #include "TCanvas.h"
25 #include "TLegend.h"
26 #include "TLatex.h"
27 #include "TGraph.h"
28 #include "TH1F.h"
29 #include "TH2F.h"
30 #include "TArrayD.h"
31 #include "TMath.h"
32 #include "TLine.h"
33 #include "TROOT.h"
34 #include "TMath.h"
35 #include "TProfile.h"
36 #include <cstdlib>
37 #include <cstring>
38 #include <cassert>
39 #include <fstream>
40 #include <iostream>
41 
42 #include "TThread.h"
43 #include "TMethodCall.h"
44 
45 const int MaxTime = 16777216; // 2^24 Time Stamp overflow value
46 using namespace std;
47 ClassImp(HarpoAnalyseBasic)
48 
49 enum HarpoMonitorEventType {
50  E_OTHER,
51  E_EMPTY,
52  E_DEPOT,
53  E_CREATED,
54  E_CONTAINED,
55  E_TRAVERSING,
56  E_TTZ,
57  E_TWOTR_GAMMA,
58  E_TWOTR_DELTA,
59  E_TWOTR_OTHER,
60  E_SHOWER,
61  E_NOTTZ
62 };
63 
65 {
66  unsigned int nd; // number of detectors
67  HarpoEventHeader *hdr = fEvt->GetHeader();
68 
69  assert(hdr != NULL);
70  hdr->print();
71 
72  for (nd = 0; nd < gkNDetectors; nd++) {
73  // if (fEvt->isdataExist(nd)) {
74  HarpoDccMap *plane = fEvt->GetDccMap(nd);
75  if (plane != NULL )plane->print();
76  }
77 }
78 
80 {
81  //Bool_t drawEvent = kFALSE;
82  nEvents++;
83  //std::cout << " Processing Event " << nEvents<< std::endl;
84  FillHistograms();
85  FillHistogramsPMM2();
86  FillHistogramsTrigger();
87 }
88 
90 {
91  fNormTTz = 0;
92  fNormTTzX = 0;
93  fNormTTzY = 0;
94 
95  NEventEmpty=0;
96  NEventDEPOSIT=0;
97  NEventTTZ=0;
98  NEventTT=0;
99  NEventTCR=0;
100  NEventTCN=0;
101  NEventGAMMA=0;
102  NEventDELTA=0;
103  NEvent2TOTHER=0;
104  NEventSHOWER=0;
105  NEventOTHER=0;
106  NEvent=0;
107  //TimeSt=0;
108 
109  fXT= fYT=fXC= fYC = -1;
110  fXdT= fXdC=fYdT=fYdC= -500;
111  itsold = -1;
112 
113 
114 
115  fTree = new TTree("data","Harpo data");
116  fTree ->Branch("NEvent",&NEvent,"NEvent/I");
117  fTree ->Branch("TimeSt",&TimeSt,"TimeSt/I");
118 
119  fTree ->Branch("fAlignmentX",&fAlignmentX,"fAlignmentX/D");
120  fTree ->Branch("fAlignmentY",&fAlignmentY,"fAlignmentY/D");
121 
122  fTree ->Branch("fAlignmentZx",&fAlignmentZx,"fAlignmentZx/D");
123  fTree ->Branch("fAlignmentZy",&fAlignmentZy,"fAlignmentZy/D");
124  fTree ->Branch("fAlignmentZ",&fAlignmentZ,"fAlignmentZ/D");
125  fTree ->Branch("ftriggerType",&ftriggerType,"ftriggerType/I");
126 
127  fTree ->SetDirectory(0);
128 
129 
130 fQmin = 10000;
131  Long64_t qmin = 0;
132  if ( ! gHConfig->Lookup("monitor.Qmin",qmin) )
133  Info("Init","Use default fQmin %d",fQmin);
134  else
135  fQmin = qmin;
136 
137  fQmax = 300000;
138  Long64_t qmax = 0;
139  if ( ! gHConfig->Lookup("monitor.Qmax",qmax) )
140  Info("Init","Use default fQmax %d",fQmax);
141  else
142  fQmax = qmax;
143 
144  fTmin = 150;
145  Double_t tmin = 0;
146  if ( ! gHConfig->Lookup("monitor.Tmin",tmin) )
147  Info("InitCfg","Use default fTmin %g",fTmin);
148  else
149  fTmin = tmin;
150  fLTpc = 200;
151  Double_t lTpc = 0;
152  if ( ! gHConfig->Lookup("monitor.LTpc",lTpc) )
153  Info("InitCfg","Use default fLTpc %g",fLTpc);
154  else
155  fLTpc = lTpc;
156  // Int_t i;
157 
158 
159  char hname[1000];
160  // char htitle[1000];
161  // for(i=0;i<2;++i){
162  //clustering
163 
164  sprintf(hname,"h1_Qpix_x");
165  h1_Qpix_x = (TH1F *)gROOT->FindObject(hname);
166  if(h1_Qpix_x) delete h1_Qpix_x;
167  h1_Qpix_x = new TH1F(hname,"",500,50,5000);
168  h1_Qpix_x->SetStats(0);
169  h1_Qpix_x->SetXTitle("Q[ADC]");
170 
171  sprintf(hname,"h1_Q_time_x");
172  h1_Q_time_x = (TH1F *)gROOT->FindObject(hname);
173  if(h1_Q_time_x) delete h1_Q_time_x;
174  h1_Q_time_x = new TH1F(hname,"",511,0,511);
175  h1_Q_time_x->SetStats(0);
176  h1_Q_time_x->SetXTitle("t[time bin]");
177 
178  sprintf(hname,"h1_Q_channel_x");
179  h1_Q_channel_x = (TH1F *)gROOT->FindObject(hname);
180  if(h1_Q_channel_x) delete h1_Q_channel_x;
181  h1_Q_channel_x = new TH1F(hname,"",288,0,288);
182  h1_Q_channel_x->SetStats(0);
183  h1_Q_channel_x->SetXTitle("channel[bin]");
184 
185  sprintf(hname,"h1_QtAssocN_time_x");
186  h1_QtAssocN_time_x = (TH1F *)gROOT->FindObject(hname);
187  if(h1_QtAssocN_time_x) delete h1_QtAssocN_time_x;
188  h1_QtAssocN_time_x = new TH1F(hname,"",511,0,511);
189  h1_QtAssocN_time_x->SetStats(0);
190  h1_QtAssocN_time_x->SetXTitle("t[time bin]");
191 
192  sprintf(hname,"h1_QtAssocN_channel_x");
193  h1_QtAssocN_channel_x = (TH1F *)gROOT->FindObject(hname);
194  if(h1_QtAssocN_channel_x) delete h1_QtAssocN_channel_x;
195  h1_QtAssocN_channel_x = new TH1F(hname,"",288,0,288);
196  h1_QtAssocN_channel_x->SetStats(0);
197  h1_QtAssocN_channel_x->SetXTitle("channel[bin]");
198 
199 
200  sprintf(hname,"h1_QTcluster_x");
201  h1_QTcluster_x = (TH1F *)gROOT->FindObject(hname);
202  if(h1_QTcluster_x) delete h1_QTcluster_x;
203  h1_QTcluster_x = new TH1F(hname,"",5000,500,25000);
204  h1_QTcluster_x->SetStats(0);
205  h1_QTcluster_x->SetXTitle("Q[ADC]");
206 
207  sprintf(hname,"h1_QCcluster_x");
208  h1_QCcluster_x = (TH1F *)gROOT->FindObject(hname);
209  if(h1_QCcluster_x) delete h1_QCcluster_x;
210  h1_QCcluster_x = new TH1F(hname,"",2000,500,25000);
211  h1_QCcluster_x->SetStats(0);
212  h1_QCcluster_x->SetXTitle("Q[ADC]");
213 
214  sprintf(hname,"h1_SigTcluster_x");
215  h1_SigTcluster_x = (TH1F *)gROOT->FindObject(hname);
216  if(h1_SigTcluster_x) delete h1_SigTcluster_x;
217  h1_SigTcluster_x = new TH1F(hname,"",100,0.0,10.0);
218  h1_SigTcluster_x->SetStats(0);
219  h1_SigTcluster_x->SetXTitle("#sigma[mm]");
220 
221  sprintf(hname,"h1_SigCcluster_x");
222  h1_SigCcluster_x = (TH1F *)gROOT->FindObject(hname);
223  if(h1_SigCcluster_x) delete h1_SigCcluster_x;
224  h1_SigCcluster_x = new TH1F(hname,"",100,0.,10.0);
225  h1_SigCcluster_x->SetStats(0);
226  h1_SigCcluster_x->SetXTitle("#sigma[mm]");
227 
228  sprintf(hname,"h1_WidthTcluster_x");
229  h1_WidthTcluster_x = (TH1F *)gROOT->FindObject(hname);
230  if(h1_WidthTcluster_x) delete h1_WidthTcluster_x;
231  h1_WidthTcluster_x = new TH1F(hname,"",100,0.0,100.0);
232  h1_WidthTcluster_x->SetStats(0);
233  h1_WidthTcluster_x->SetXTitle("width[n]");
234 
235  sprintf(hname,"h1_WidthCcluster_x");
236  h1_WidthCcluster_x = (TH1F *)gROOT->FindObject(hname);
237  if(h1_WidthCcluster_x) delete h1_WidthCcluster_x;
238  h1_WidthCcluster_x = new TH1F(hname,"",100,0.0,100.0);
239  h1_WidthCcluster_x->SetStats(0);
240  h1_WidthCcluster_x->SetXTitle("width[n]");
241 
242  sprintf(hname,"h1_IndexTcluster_x");
243  h1_IndexTcluster_x = (TH1F *)gROOT->FindObject(hname);
244  if(h1_IndexTcluster_x) delete h1_IndexTcluster_x;
245  h1_IndexTcluster_x = new TH1F(hname,"",511,0,511);
246  h1_IndexTcluster_x->SetStats(0);
247  h1_IndexTcluster_x->SetXTitle("Index");
248 
249  sprintf(hname,"h1_IndexCcluster_x");
250  h1_IndexCcluster_x = (TH1F *)gROOT->FindObject(hname);
251  if(h1_IndexCcluster_x) delete h1_IndexCcluster_x;
252  h1_IndexCcluster_x = new TH1F(hname,"",288,0,288);
253  h1_IndexCcluster_x->SetStats(0);
254  h1_IndexCcluster_x->SetXTitle("Index");
255 
256  sprintf(hname,"h1_MeanTcluster_x");
257  h1_MeanTcluster_x = (TH1F *)gROOT->FindObject(hname);
258  if(h1_MeanTcluster_x) delete h1_MeanTcluster_x;
259  h1_MeanTcluster_x = new TH1F(hname,"",288,0.0,288.0);
260  h1_MeanTcluster_x->SetStats(0);
261  h1_MeanTcluster_x->SetXTitle("Mean");
262 
263  sprintf(hname,"h1_MeanCcluster_x");
264  h1_MeanCcluster_x = (TH1F *)gROOT->FindObject(hname);
265  if(h1_MeanCcluster_x) delete h1_MeanCcluster_x;
266  h1_MeanCcluster_x = new TH1F(hname,"",511,0.0,511.0);
267  h1_MeanCcluster_x->SetStats(0);
268  h1_MeanCcluster_x->SetXTitle("Mean");
269 
270  //tracking
271 
272  sprintf(hname,"h1_angleTrack_x");
273  h1_angleTrack_x = (TH1F *)gROOT->FindObject(hname);
274  if(h1_angleTrack_x) delete h1_angleTrack_x;
275  h1_angleTrack_x = new TH1F(hname,"",100,0.0,3.15);
276  h1_angleTrack_x->SetStats(0);
277  h1_angleTrack_x->SetXTitle("#theta_{track}[rad]");
278 
279  sprintf(hname,"h1_theta_x");
280  h1_theta_x = (TH1F *)gROOT->FindObject(hname);
281  if(h1_theta_x) delete h1_theta_x;
282  h1_theta_x = new TH1F(hname,"",50,-3.15,3.15);
283  h1_theta_x->SetStats(0);
284  h1_theta_x->SetXTitle("#theta[rad]");
285 
286  sprintf(hname,"h1_rho_x");
287  h1_rho_x = (TH1F *)gROOT->FindObject(hname);
288  if(h1_rho_x) delete h1_rho_x;
289  h1_rho_x = new TH1F(hname,"",200,0.0,200.0);
290  h1_rho_x->SetStats(0);
291  h1_rho_x->SetXTitle("#rho[mm]");
292 
293  sprintf(hname,"h1_sigtheta_x");
294  h1_sigtheta_x = (TH1F *)gROOT->FindObject(hname);
295  if(h1_sigtheta_x) delete h1_sigtheta_x;
296  h1_sigtheta_x = new TH1F(hname,"",50,0.0,0.1);
297  h1_sigtheta_x->SetStats(0);
298  h1_sigtheta_x->SetXTitle("#sigma_{#theta}[rad]");
299 
300  sprintf(hname,"h1_sigrho_x");
301  h1_sigrho_x = (TH1F *)gROOT->FindObject(hname);
302  if(h1_sigrho_x) delete h1_sigrho_x;
303  h1_sigrho_x = new TH1F(hname,"",200,0.0,10.0);
304  h1_sigrho_x->SetStats(0);
305  h1_sigrho_x->SetXTitle("#sigma_{#rho}[mm]");
306 
307  sprintf(hname,"h1_QcAssoc_x");
308  h1_QcAssoc_x = (TH1F *)gROOT->FindObject(hname);
309  if(h1_QcAssoc_x) delete h1_QcAssoc_x;
310  h1_QcAssoc_x = new TH1F(hname,"",5000,100,20000);
311  h1_QcAssoc_x->SetStats(0);
312  h1_QcAssoc_x->SetXTitle("Q[ADC]");
313 
314  sprintf(hname,"h1_QcNAssoc_x");
315  h1_QcNAssoc_x = (TH1F *)gROOT->FindObject(hname);
316  if(h1_QcNAssoc_x) delete h1_QcNAssoc_x;
317  h1_QcNAssoc_x = new TH1F(hname,"",5000,100,20000);
318  h1_QcNAssoc_x->SetStats(0);
319  h1_QcNAssoc_x->SetXTitle("Q[ADC]");
320 
321  sprintf(hname,"h1_QtAssoc_x");
322  h1_QtAssoc_x = (TH1F *)gROOT->FindObject(hname);
323  if(h1_QtAssoc_x) delete h1_QtAssoc_x;
324  h1_QtAssoc_x = new TH1F(hname,"",5000,1000,20000);
325  h1_QtAssoc_x->SetStats(0);
326  h1_QtAssoc_x->SetXTitle("Q[ADC]");
327 
328  sprintf(hname,"h1_QtAssocN_x");
329  h1_QtAssocN_x = (TH1F *)gROOT->FindObject(hname);
330  if(h1_QtAssocN_x) delete h1_QtAssocN_x;
331  h1_QtAssocN_x = new TH1F(hname,"",5000,100,20000);
332  h1_QtAssocN_x->SetStats(0);
333  h1_QtAssocN_x->SetXTitle("Q[ADC]");
334 
335  sprintf(hname,"h1_QtNAssoc_x");
336  h1_QtNAssoc_x = (TH1F *)gROOT->FindObject(hname);
337  if(h1_QtNAssoc_x) delete h1_QtNAssoc_x;
338  h1_QtNAssoc_x = new TH1F(hname,"",5000,100,20000);
339  h1_QtNAssoc_x->SetStats(0);
340  h1_QtNAssoc_x->SetXTitle("Q[ADC]");
341 
342 
343  sprintf(hname,"h1_TypeTrack_x");
344  h1_TypeTrack_x = (TH1F *)gROOT->FindObject(hname);
345  if(h1_TypeTrack_x) delete h1_TypeTrack_x;
346  h1_TypeTrack_x = new TH1F(hname,"",4,0,4);
347  h1_TypeTrack_x->SetStats(0);
348  h1_TypeTrack_x->SetXTitle("Type");
349 
350  sprintf(hname,"h1_distortion_dc_x");
351  // sprintf(htitle,"distorsion dc",i);
352  h1_distortion_dc_x = (TH1F *)gROOT->FindObject(hname);
353  if(h1_distortion_dc_x) delete h1_distortion_dc_x;
354  h1_distortion_dc_x = new TH1F(hname,"",200,-30.0,30.0);
355  h1_distortion_dc_x->SetStats(0);
356  // h1_distortion_dc_x->SetYTitle("dc[mm]");
357  h1_distortion_dc_x->SetXTitle("dc[mm]");
358 
359 
360  sprintf(hname,"h1_distortion_dt_x");
361  //sprintf(htitle,"distorsion dt",i);
362  h1_distortion_dt_x = (TH1F *)gROOT->FindObject(hname);
363  if(h1_distortion_dt_x) delete h1_distortion_dt_x;
364  h1_distortion_dt_x = new TH1F(hname,"",200,-1.0,1.0);
365  h1_distortion_dt_x->SetStats(0);
366  // h1_distortion_dc_x->SetYTitle("dc[mm]");
367  h1_distortion_dt_x->SetXTitle("dt[mm]");
368 
369  sprintf(hname,"h2_distortion_dc_t_x");
370  //sprintf(htitle,"distorsion dc_t",i);
371  h2_distortion_dc_t_x = (TH2F *)gROOT->FindObject(hname);
372  if(h2_distortion_dc_t_x) delete h2_distortion_dc_t_x;
373  h2_distortion_dc_t_x = new TH2F(hname,"",511,0.0,511.0,200,-30.0,30.0);
374  h2_distortion_dc_t_x->SetStats(0);
375  h2_distortion_dc_t_x->SetYTitle("dc[mm]");
376  h2_distortion_dc_t_x->SetXTitle("t[time bin]");
377 
378  sprintf(hname,"h2_distortion_dc_c_x");
379  // sprintf(htitle,"distorsion dc_c",i);
380  h2_distortion_dc_c_x = (TH2F *)gROOT->FindObject(hname);
381  if(h2_distortion_dc_c_x) delete h2_distortion_dc_c_x;
382  h2_distortion_dc_c_x = new TH2F(hname,"",288,0.0,288.0,200,-30.0,30.0);
383  h2_distortion_dc_c_x->SetStats(0);
384  h2_distortion_dc_c_x->SetYTitle("dc[mm]");
385  h2_distortion_dc_c_x->SetXTitle("c[channel bin]");
386 
387  sprintf(hname,"h2_distortion_dt_c_x");
388  //sprintf(htitle,"distorsion dt_c",i);
389  h2_distortion_dt_c_x = (TH2F *)gROOT->FindObject(hname);
390  if(h2_distortion_dt_c_x) delete h2_distortion_dt_c_x;
391  h2_distortion_dt_c_x = new TH2F(hname,"",288,0.0,288.0,200,-1.0,1.0);
392  h2_distortion_dt_c_x->SetStats(0);
393  h2_distortion_dt_c_x->SetYTitle("dt[mm]");
394  h2_distortion_dt_c_x->SetXTitle("c[channel bin]");
395 
396  sprintf(hname,"h2_distortion_dt_t_x");
397  //sprintf(htitle,"distorsion dt_t",i);
398  h2_distortion_dt_t_x = (TH2F *)gROOT->FindObject(hname);
399  if(h2_distortion_dt_t_x) delete h2_distortion_dt_t_x;
400  h2_distortion_dt_t_x = new TH2F(hname,"",511,0.0,511.0,200,-1.0,1.0);
401  h2_distortion_dt_t_x->SetStats(0);
402  h2_distortion_dt_t_x->SetYTitle("dt[mm]");
403  h2_distortion_dt_t_x->SetXTitle("t[time bin]");
404 
405  sprintf(hname,"h1_Qassoc_time_x");
406  h1_Qassoc_time_x = (TH1F *)gROOT->FindObject(hname);
407  if(h1_Qassoc_time_x) delete h1_Qassoc_time_x;
408  h1_Qassoc_time_x = new TH1F(hname,"",511,0,511);
409  h1_Qassoc_time_x->SetStats(0);
410  h1_Qassoc_time_x->SetXTitle("t[time bin]");
411 
412  //}
414 
415 
416 
417  sprintf(hname,"h1_Qpix_y");
418  h1_Qpix_y = (TH1F *)gROOT->FindObject(hname);
419  if(h1_Qpix_y) delete h1_Qpix_y;
420  h1_Qpix_y = new TH1F(hname,"",500,50,5000);
421  h1_Qpix_y->SetStats(0);
422  h1_Qpix_y->SetXTitle("Q[ADC]");
423 
424  sprintf(hname,"h1_Q_time_y");
425  h1_Q_time_y = (TH1F *)gROOT->FindObject(hname);
426  if(h1_Q_time_y) delete h1_Q_time_y;
427  h1_Q_time_y = new TH1F(hname,"",511,0,511);
428  h1_Q_time_y->SetStats(0);
429  h1_Q_time_y->SetXTitle("t[time bin]");
430 
431  sprintf(hname,"h1_Q_channel_y");
432  h1_Q_channel_y = (TH1F *)gROOT->FindObject(hname);
433  if(h1_Q_channel_y) delete h1_Q_channel_y;
434  h1_Q_channel_y = new TH1F(hname,"",288,0,288);
435  h1_Q_channel_y->SetStats(0);
436  h1_Q_channel_y->SetXTitle("channel[bin]");
437 
438  sprintf(hname,"h1_QtAssocN_time_y");
439  h1_QtAssocN_time_y = (TH1F *)gROOT->FindObject(hname);
440  if(h1_QtAssocN_time_y) delete h1_QtAssocN_time_y;
441  h1_QtAssocN_time_y = new TH1F(hname,"",511,0,511);
442  h1_QtAssocN_time_y->SetStats(0);
443  h1_QtAssocN_time_y->SetXTitle("t[time bin]");
444 
445  sprintf(hname,"h1_QtAssocN_channel_y");
446  h1_QtAssocN_channel_y = (TH1F *)gROOT->FindObject(hname);
447  if(h1_QtAssocN_channel_y) delete h1_QtAssocN_channel_y;
448  h1_QtAssocN_channel_y = new TH1F(hname,"",288,0,288);
449  h1_QtAssocN_channel_y->SetStats(0);
450  h1_QtAssocN_channel_y->SetXTitle("channel[bin]");
451 
452 
453  sprintf(hname,"h1_QTcluster_y");
454  h1_QTcluster_y = (TH1F *)gROOT->FindObject(hname);
455  if(h1_QTcluster_y) delete h1_QTcluster_y;
456  h1_QTcluster_y = new TH1F(hname,"",5000,500,25000);
457  h1_QTcluster_y->SetStats(0);
458  h1_QTcluster_y->SetXTitle("Q[ADC]");
459 
460  sprintf(hname,"h1_QCcluster_y");
461  h1_QCcluster_y = (TH1F *)gROOT->FindObject(hname);
462  if(h1_QCcluster_y) delete h1_QCcluster_y;
463  h1_QCcluster_y = new TH1F(hname,"",5000,500,25000);
464  h1_QCcluster_y->SetStats(0);
465  h1_QCcluster_y->SetXTitle("Q[ADC]");
466 
467  sprintf(hname,"h1_SigTcluster_y");
468  h1_SigTcluster_y = (TH1F *)gROOT->FindObject(hname);
469  if(h1_SigTcluster_y) delete h1_SigTcluster_y;
470  h1_SigTcluster_y = new TH1F(hname,"",100,0.0,10.0);
471  h1_SigTcluster_y->SetStats(0);
472  h1_SigTcluster_y->SetXTitle("#sigma[mm]");
473 
474  sprintf(hname,"h1_SigCcluster_y");
475  h1_SigCcluster_y = (TH1F *)gROOT->FindObject(hname);
476  if(h1_SigCcluster_y) delete h1_SigCcluster_y;
477  h1_SigCcluster_y = new TH1F(hname,"",100,0.,10.0);
478  h1_SigCcluster_y->SetStats(0);
479  h1_SigCcluster_y->SetXTitle("#sigma[mm]");
480 
481  sprintf(hname,"h1_WidthTcluster_y");
482  h1_WidthTcluster_y = (TH1F *)gROOT->FindObject(hname);
483  if(h1_WidthTcluster_y) delete h1_WidthTcluster_y;
484  h1_WidthTcluster_y = new TH1F(hname,"",100,0.0,100.0);
485  h1_WidthTcluster_y->SetStats(0);
486  h1_WidthTcluster_y->SetXTitle("width[n]");
487 
488  sprintf(hname,"h1_WidthCcluster_y");
489  h1_WidthCcluster_y = (TH1F *)gROOT->FindObject(hname);
490  if(h1_WidthCcluster_y) delete h1_WidthCcluster_y;
491  h1_WidthCcluster_y = new TH1F(hname,"",100,0.0,100.0);
492  h1_WidthCcluster_y->SetStats(0);
493  h1_WidthCcluster_y->SetXTitle("width[n]");
494 
495  sprintf(hname,"h1_IndexTcluster_y");
496  h1_IndexTcluster_y = (TH1F *)gROOT->FindObject(hname);
497  if(h1_IndexTcluster_y) delete h1_IndexTcluster_y;
498  h1_IndexTcluster_y = new TH1F(hname,"",511,0,511);
499  h1_IndexTcluster_y->SetStats(0);
500  h1_IndexTcluster_y->SetXTitle("Index");
501 
502  sprintf(hname,"h1_IndexCcluster_y");
503  h1_IndexCcluster_y = (TH1F *)gROOT->FindObject(hname);
504  if(h1_IndexCcluster_y) delete h1_IndexCcluster_y;
505  h1_IndexCcluster_y = new TH1F(hname,"",288,0,288);
506  h1_IndexCcluster_y->SetStats(0);
507  h1_IndexCcluster_y->SetXTitle("Index");
508 
509  sprintf(hname,"h1_MeanTcluster_y");
510  h1_MeanTcluster_y = (TH1F *)gROOT->FindObject(hname);
511  if(h1_MeanTcluster_y) delete h1_MeanTcluster_y;
512  h1_MeanTcluster_y = new TH1F(hname,"",288,0.0,288.0);
513  h1_MeanTcluster_y->SetStats(0);
514  h1_MeanTcluster_y->SetXTitle("Mean");
515 
516  sprintf(hname,"h1_MeanCcluster_y");
517  h1_MeanCcluster_y = (TH1F *)gROOT->FindObject(hname);
518  if(h1_MeanCcluster_y) delete h1_MeanCcluster_y;
519  h1_MeanCcluster_y = new TH1F(hname,"",511,0.0,511.0);
520  h1_MeanCcluster_y->SetStats(0);
521  h1_MeanCcluster_y->SetXTitle("Mean");
522 
523  //tracking
524 
525  sprintf(hname,"h1_angleTrack_y");
526  h1_angleTrack_y = (TH1F *)gROOT->FindObject(hname);
527  if(h1_angleTrack_y) delete h1_angleTrack_y;
528  h1_angleTrack_y = new TH1F(hname,"",100,0.0,3.15);
529  h1_angleTrack_y->SetStats(0);
530  h1_angleTrack_y->SetXTitle("#theta_{track}[rad]");
531 
532  sprintf(hname,"h1_theta_y");
533  h1_theta_y = (TH1F *)gROOT->FindObject(hname);
534  if(h1_theta_y) delete h1_theta_y;
535  h1_theta_y = new TH1F(hname,"",50,-3.15,3.15);
536  h1_theta_y->SetStats(0);
537  h1_theta_y->SetXTitle("#theta[rad]");
538 
539  sprintf(hname,"h1_rho_y");
540  h1_rho_y = (TH1F *)gROOT->FindObject(hname);
541  if(h1_rho_y) delete h1_rho_y;
542  h1_rho_y = new TH1F(hname,"",200,0.0,200.0);
543  h1_rho_y->SetStats(0);
544  h1_rho_y->SetXTitle("#rho[mm]");
545 
546  sprintf(hname,"h1_sigtheta_y");
547  h1_sigtheta_y = (TH1F *)gROOT->FindObject(hname);
548  if(h1_sigtheta_y) delete h1_sigtheta_y;
549  h1_sigtheta_y = new TH1F(hname,"",50,0.0,0.1);
550  h1_sigtheta_y->SetStats(0);
551  h1_sigtheta_y->SetXTitle("#sigma_{#theta}[rad]");
552 
553  sprintf(hname,"h1_sigrho_y");
554  h1_sigrho_y = (TH1F *)gROOT->FindObject(hname);
555  if(h1_sigrho_y) delete h1_sigrho_y;
556  h1_sigrho_y = new TH1F(hname,"",200,0.0,10.0);
557  h1_sigrho_y->SetStats(0);
558  h1_sigrho_y->SetXTitle("#sigma_{#rho}[mm]");
559 
560  sprintf(hname,"h1_QcAssoc_y");
561  h1_QcAssoc_y = (TH1F *)gROOT->FindObject(hname);
562  if(h1_QcAssoc_y) delete h1_QcAssoc_y;
563  h1_QcAssoc_y = new TH1F(hname,"",5000,0,20000);
564  h1_QcAssoc_y->SetStats(0);
565  h1_QcAssoc_y->SetXTitle("Q[ADC]");
566 
567  sprintf(hname,"h1_QcNAssoc_y");
568  h1_QcNAssoc_y = (TH1F *)gROOT->FindObject(hname);
569  if(h1_QcNAssoc_y) delete h1_QcNAssoc_y;
570  h1_QcNAssoc_y = new TH1F(hname,"",5000,100,20000);
571  h1_QcNAssoc_y->SetStats(0);
572  h1_QcNAssoc_y->SetXTitle("Q[ADC]");
573 
574  sprintf(hname,"h1_QtAssoc_y");
575  h1_QtAssoc_y = (TH1F *)gROOT->FindObject(hname);
576  if(h1_QtAssoc_y) delete h1_QtAssoc_y;
577  h1_QtAssoc_y = new TH1F(hname,"",5000,100,20000);
578  h1_QtAssoc_y->SetStats(0);
579  h1_QtAssoc_y->SetXTitle("Q[ADC]");
580 
581  sprintf(hname,"h1_QtAssocN_y");
582  h1_QtAssocN_y = (TH1F *)gROOT->FindObject(hname);
583  if(h1_QtAssocN_y) delete h1_QtAssocN_y;
584  h1_QtAssocN_y = new TH1F(hname,"",5000,0,20000);
585  h1_QtAssocN_y->SetStats(0);
586  h1_QtAssocN_y->SetXTitle("Q[ADC]");
587 
588  sprintf(hname,"h1_QtNAssoc_y");
589  h1_QtNAssoc_y = (TH1F *)gROOT->FindObject(hname);
590  if(h1_QtNAssoc_y) delete h1_QtNAssoc_y;
591  h1_QtNAssoc_y = new TH1F(hname,"",5000,100,20000);
592  h1_QtNAssoc_y->SetStats(0);
593  h1_QtNAssoc_y->SetXTitle("Q[ADC]");
594 
595 
596  sprintf(hname,"h1_TypeTrack_y");
597  h1_TypeTrack_y = (TH1F *)gROOT->FindObject(hname);
598  if(h1_TypeTrack_y) delete h1_TypeTrack_y;
599  h1_TypeTrack_y = new TH1F(hname,"",4,0,4);
600  h1_TypeTrack_y->SetStats(0);
601  h1_TypeTrack_y->SetXTitle("Type");
602 
603  sprintf(hname,"h1_distortion_dc_y");
604  // sprintf(htitle,"distorsion dc",i);
605  h1_distortion_dc_y = (TH1F *)gROOT->FindObject(hname);
606  if(h1_distortion_dc_y) delete h1_distortion_dc_y;
607  h1_distortion_dc_y = new TH1F(hname,"",200,-30.0,30.0);
608  h1_distortion_dc_y->SetStats(0);
609  // h1_distortion_dc_y->SetYTitle("dc[mm]");
610  h1_distortion_dc_y->SetXTitle("dc[mm]");
611 
612 
613  sprintf(hname,"h1_distortion_dt_y");
614  //sprintf(htitle,"distorsion dt",i);
615  h1_distortion_dt_y = (TH1F *)gROOT->FindObject(hname);
616  if(h1_distortion_dt_y) delete h1_distortion_dt_y;
617  h1_distortion_dt_y = new TH1F(hname,"",200,-1.0,1.0);
618  h1_distortion_dt_y->SetStats(0);
619  // h1_distortion_dc_y->SetYTitle("dc[mm]");
620  h1_distortion_dt_y->SetXTitle("dt[mm]");
621 
622  sprintf(hname,"h2_distortion_dc_t_y");
623  //sprintf(htitle,"distorsion dc_t",i);
624  h2_distortion_dc_t_y = (TH2F *)gROOT->FindObject(hname);
625  if(h2_distortion_dc_t_y) delete h2_distortion_dc_t_y;
626  h2_distortion_dc_t_y = new TH2F(hname,"",511,0.0,511.0,200,-30.0,30.0);
627  h2_distortion_dc_t_y->SetStats(0);
628  h2_distortion_dc_t_y->SetYTitle("dc[mm]");
629  h2_distortion_dc_t_y->SetXTitle("t[time bin]");
630 
631  sprintf(hname,"h2_distortion_dc_c_y");
632  // sprintf(htitle,"distorsion dc_c",i);
633  h2_distortion_dc_c_y = (TH2F *)gROOT->FindObject(hname);
634  if(h2_distortion_dc_c_y) delete h2_distortion_dc_c_y;
635  h2_distortion_dc_c_y = new TH2F(hname,"",288,0.0,288.0,200,-30.0,30.0);
636  h2_distortion_dc_c_y->SetStats(0);
637  h2_distortion_dc_c_y->SetYTitle("dc[mm]");
638  h2_distortion_dc_c_y->SetXTitle("c[channel bin]");
639 
640  sprintf(hname,"h2_distortion_dt_c_y");
641  //sprintf(htitle,"distorsion dt_c",i);
642  h2_distortion_dt_c_y = (TH2F *)gROOT->FindObject(hname);
643  if(h2_distortion_dt_c_y) delete h2_distortion_dt_c_y;
644  h2_distortion_dt_c_y = new TH2F(hname,"",288,0.0,288.0,200,-1.0,1.0);
645  h2_distortion_dt_c_y->SetStats(0);
646  h2_distortion_dt_c_y->SetYTitle("dt[mm]");
647  h2_distortion_dt_c_y->SetXTitle("c[channel bin]");
648 
649  sprintf(hname,"h2_distortion_dt_t_y");
650  //sprintf(htitle,"distorsion dt_t",i);
651  h2_distortion_dt_t_y = (TH2F *)gROOT->FindObject(hname);
652  if(h2_distortion_dt_t_y) delete h2_distortion_dt_t_y;
653  h2_distortion_dt_t_y = new TH2F(hname,"",511,0.0,511.0,200,-1.0,1.0);
654  h2_distortion_dt_t_y->SetStats(0);
655  h2_distortion_dt_t_y->SetYTitle("dt[mm]");
656  h2_distortion_dt_t_y->SetXTitle("t[time bin]");
657 
658  sprintf(hname,"h1_Qassoc_time_y");
659  h1_Qassoc_time_y = (TH1F *)gROOT->FindObject(hname);
660  if(h1_Qassoc_time_y) delete h1_Qassoc_time_y;
661  h1_Qassoc_time_y = new TH1F(hname,"",511,0,511);
662  h1_Qassoc_time_y->SetStats(0);
663  h1_Qassoc_time_y->SetXTitle("t[time bin]");
664 
665 
666 
667 
668 
669 
671  sprintf(hname,"h1_tmin");
672  h1_tmin = (TH1F *)gROOT->FindObject(hname);
673  if(h1_tmin) delete h1_tmin;
674  h1_tmin = new TH1F(hname,"",511,0,511);
675  h1_tmin->SetStats(0);
676  h1_tmin->SetXTitle("t_{min} [bin]");
677 
678  sprintf(hname,"h1_tmax");
679  h1_tmax = (TH1F *)gROOT->FindObject(hname);
680  if(h1_tmax) delete h1_tmax;
681  h1_tmax = new TH1F(hname,"",511,0,511);
682  h1_tmax->SetStats(0);
683  h1_tmax->SetXTitle("t_{max} [bin]");
684 
685  sprintf(hname,"h1_xmin");
686  h1_xmin = (TH1F *)gROOT->FindObject(hname);
687  if(h1_xmin) delete h1_xmin;
688  h1_xmin = new TH1F(hname,"",300,0,300);
689  h1_xmin->SetStats(0);
690  h1_xmin->SetXTitle("x[channel bin]");
691 
692  sprintf(hname,"h1_xmax");
693  h1_xmax = (TH1F *)gROOT->FindObject(hname);
694  if(h1_xmax) delete h1_xmax;
695  h1_xmax = new TH1F(hname,"",300,0,300);
696  h1_xmax->SetStats(0);
697  h1_xmax->SetXTitle("x[channel bin]");
698 
699  sprintf(hname,"h1_ymin");
700  h1_ymin = (TH1F *)gROOT->FindObject(hname);
701  if(h1_ymin) delete h1_ymin;
702  h1_ymin = new TH1F(hname,"",300,0,300);
703  h1_ymin->SetStats(0);
704  h1_ymin->SetXTitle("y[channel bin]");
705 
706  sprintf(hname,"h1_ymax");
707  h1_ymax = (TH1F *)gROOT->FindObject(hname);
708  if(h1_ymax) delete h1_ymax;
709  h1_ymax = new TH1F(hname,"",300,0,300);
710  h1_ymax->SetStats(0);
711  h1_ymax->SetXTitle("y[channel bin]");
712 
713 sprintf(hname,"h1_dtime");
714  h1_dtime = (TH1F *)gROOT->FindObject(hname);
715  if(h1_dtime) delete h1_dtime;
716  h1_dtime = new TH1F(hname,"",511,0,511);
717  h1_dtime->SetStats(0);
718  h1_dtime->SetXTitle("t_{drift} [bin]");
719 
720  sprintf(hname,"helen");
721  helen = (TH1F *)gROOT->FindObject(hname);
722  if(helen) delete helen;
723  helen = new TH1F(hname,"",20,0.0,19.0);
724  helen->SetStats(0);
725  helen->SetXTitle("n");
726 
727  sprintf(hname,"heprof");
728  heprof = (TH1F *)gROOT->FindObject(hname);
729  if(heprof) delete heprof;
730  heprof = new TH1F(hname,"",20,0.0,19.0);
731  heprof->SetStats(0);
732  heprof->SetXTitle("n");
733 
734  //PMM2
735  hPmm2 = new TH1F("hPmm2","",16,0,16);
736  hadc[0] = new TH1F("hAdcg0","All Adc counts Gain 0",256,0.0,1024.0);
737  hadc[1] = new TH1F("hAdcg1","All Adc counts Gain 1",256,0.0,1024.0);
738  // hpps = new TH2F("hPps","Time Stamp vs PPS",20,0.0,19.0,256,0.0,0.0);
739  htvse = new TH2F("hTvsE","Time Stamp vs Ev Num",512,0.0,0.0,512,0.0,0.0);
740  hramp = new TH2F("hRamp","Fine Time vs TDC Ramp",4,0.0,3.0,256,0.0,0.0);
741  htdiff = new TH1F("hTDiff","Time Diff",1024,0.0,1000000.0);
742  htdiff2 = new TH1F("hTDiff2","Time Diff low",1024,0.0,15000.0);
743  hPmm2Triggered = new TH1F("hPmm2Triggered",";PM_{channel}",12,1,13);
744  hPmm2Missed = new TH1F("hPmm2Missed",";PM_{channel}",12,1,13);
745  hPmm2Spectrum2D = new TH2F("hPmm2Spectrum2D",";Channel;Charge [ADC]",12,1,13,1024,0,1024);
746  hPmm2Coincidence = new TH2F("hPmm2Coincidence",";Channel;Channel",12,1,13,12,1,13);
747 
748  h2_QtAssocN_time_x= new TH2F("h2_QtAssocN_time_x",";t[time bin];<Q>[ADC]",511,0,511,3000,0,6000);
749  h2_QtAssocN_time_y= new TH2F("h2_QtAssocN_time_y",";t[time bin];<Q>[ADC]",511,0,511,3000,0,6000);
750 
751  sprintf(hname,"h2_prof_dt_c_x");
752  h2_prof_dt_c_x = (TProfile *)gROOT->FindObject(hname);
753  if(h2_prof_dt_c_x) delete h2_prof_dt_c_x;
754  h2_prof_dt_c_x = new TProfile(hname,"",288,0.0,288.0);
755  h2_prof_dt_c_x->SetStats(0);
756 
757  sprintf(hname,"h2_prof_dc_c_x");
758  h2_prof_dc_c_x = (TProfile *)gROOT->FindObject(hname);
759  if(h2_prof_dc_c_x) delete h2_prof_dc_c_x;
760  h2_prof_dc_c_x = new TProfile(hname,"",288,0.0,288.0);
761  h2_prof_dc_c_x->SetStats(0);
762 
763  sprintf(hname,"h2_prof_dt_t_x");
764  h2_prof_dt_t_x = (TProfile *)gROOT->FindObject(hname);
765  if(h2_prof_dt_t_x) delete h2_prof_dt_t_x;
766  h2_prof_dt_t_x = new TProfile(hname,"",511,0.0,511.0);
767  h2_prof_dt_t_x->SetStats(0);
768 
769  sprintf(hname,"h2_prof_dc_t_x");
770  h2_prof_dc_t_x = (TProfile *)gROOT->FindObject(hname);
771  if(h2_prof_dc_t_x) delete h2_prof_dc_t_x;
772  h2_prof_dc_t_x = new TProfile(hname,"",511,0.0,511.0);
773  h2_prof_dc_t_x->SetStats(0);
774 
775 
776 sprintf(hname,"h2_prof_dt_c_y");
777  h2_prof_dt_c_y = (TProfile *)gROOT->FindObject(hname);
778  if(h2_prof_dt_c_y) delete h2_prof_dt_c_y;
779  h2_prof_dt_c_y = new TProfile(hname,"",288,0.0,288.0);
780  h2_prof_dt_c_y->SetStats(0);
781 
782  sprintf(hname,"h2_prof_dc_c_y");
783  h2_prof_dc_c_y = (TProfile *)gROOT->FindObject(hname);
784  if(h2_prof_dc_c_y) delete h2_prof_dc_c_y;
785  h2_prof_dc_c_y = new TProfile(hname,"",288,0.0,288.0);
786  h2_prof_dc_c_y->SetStats(0);
787 
788  sprintf(hname,"h2_prof_dt_t_y");
789  h2_prof_dt_t_y = (TProfile *)gROOT->FindObject(hname);
790  if(h2_prof_dt_t_y) delete h2_prof_dt_t_y;
791  h2_prof_dt_t_y = new TProfile(hname,"",511,0.0,511.0);
792  h2_prof_dt_t_y->SetStats(0);
793 
794  sprintf(hname,"h2_prof_dc_t_y");
795  h2_prof_dc_t_y = (TProfile *)gROOT->FindObject(hname);
796  if(h2_prof_dc_t_y) delete h2_prof_dc_t_y;
797  h2_prof_dc_t_y = new TProfile(hname,"",511,0.0,511.0);
798  h2_prof_dc_t_y->SetStats(0);
799 
800 sprintf(hname,"h2_Qprof_x");
801 h2_Qprof_x = (TProfile *)gROOT->FindObject(hname);
802 if(h2_Qprof_x) delete h2_Qprof_x;
803 h2_Qprof_x = new TProfile(hname,"",511,0.0,511.0);
804 h2_Qprof_x->SetStats(0);
805 
806  sprintf(hname,"h2_Qprof_y");
807  h2_Qprof_y = (TProfile *)gROOT->FindObject(hname);
808  if(h2_Qprof_y) delete h2_Qprof_y;
809  h2_Qprof_y = new TProfile(hname,"",511,0.0,511.0);
810  h2_Qprof_y->SetStats(0);
811 
812 
813 // TMapFile::SetMapAddress(0x7fef1fc55000);
814 // mfile = TMapFile::Create("harpo1064.map","RECREATE", 10000000,
815 // "Memory mapped file with monitoring histograms");
816 
817  hTriggerCreated = new TH1F("hTriggerCreated",";",16,-1,15);
818  hTriggerTraversing = new TH1F("hTriggerTraversing",";",16,-1,15);
819  hTriggerEmpty = new TH1F("hTriggerEmpty",";",16,-1,15);
820  hTriggerShower = new TH1F("hTriggerShower",";",16,-1,15);
821  hTriggerOther = new TH1F("hTriggerOther","",16,-1,15);
822 
823  hTriggerTTZ=new TH1F("hTriggerTTZ",";",16,-1,15);
824  hTriggerContained = new TH1F("hTriggerContained",";",16,-1,15);
825  hTriggerDepot= new TH1F("hTriggerDepot",";",16,-1,15);
826  hTriggerTwoTrGamma=new TH1F("hTriggerTwoTrGamma",";",16,-1,15);
827  hTriggerTwoTrDelta=new TH1F("hTriggerTwoTrDelta",";",16,-1,15);
828  hTriggerTwoTrOther=new TH1F("hTriggerTwoTrOther",";",16,-1,15);
829 
830 
831  // mfile->Print();
832 
833  hTriggerType = new TH1F("hTriggerType",";",11,-1,10);
834 
835  h1Doca = new TH1F("h1Doca",";Doca[mm]",50,0.,20.);
836  h1Poca_x = new TH1F("h1Poca_x",";Poca x/y",40,123.5,163.5);
837  h1Poca_y = new TH1F("h1Poca_y",";Poca x/y",40,123.5,163.5);
838  h1Poca_z = new TH1F("h1Poca_z",";Poca z",511,0.,511.);
839 
840  h2Poca_xy = new TH2F("h2Poca_xy",";Poca x;Poca y",200,100.,200.,200,100.,200.);
841  h2Poca_xz = new TH2F("h2Poca_xz",";Poca z;Poca x",511,0.,511.,200,100.,200.);
842  h2Poca_yz = new TH2F("h2Poca_yz",";Poca z;Poca y",511,0.,511.,200,100.,200.);
843 
844  // h1Px = new TH1F("h1Px",";Px",100,-1.,1.);
845  sprintf(hname,"h1Px");
846  h1Px = (TH1F *)gROOT->FindObject(hname);
847  if(h1Px) delete h1Px;
848  h1Px = new TH1F(hname,"",100,-1.,1.);
849  h1Px->SetStats(0);
850  h1Px->SetXTitle("Px");
851 
852  h1Py = new TH1F("h1Py",";Py",100,-1.,1.);
853  h1Pz = new TH1F("h1Pz",";Pz",100,-1.,1.);
854 
855  h2Pxy = new TH2F("h2Pxy",";",100,-1.,1.,100,-1.,1.);
856  h2Pxz = new TH2F("h2Pxz",";",100,-1.,1.,100,-1.,1.);
857  h2Pyz = new TH2F("h2Pyz",";",100,-1.,1.,100,-1.,1.);
858 
859  //h1Azimutal = new TH1F("h1Azimutal",";Azimuth angle",50,-3.15,3.15);
860  // h1AOpen = new TH1F("h1AOpen",";Open angle",50,0.0,3.15);
861 
862  sprintf(hname,"h1AOpen");
863  h1AOpen = (TH1F *)gROOT->FindObject(hname);
864  if(h1AOpen) delete h1AOpen;
865  h1AOpen = new TH1F(hname,"",50,0.,3.15);
866  h1AOpen->SetStats(0);
867  h1AOpen->SetXTitle("#theta_{open}(rad)");
868 
869  sprintf(hname,"h1Azimutal");
870  h1Azimutal = (TH1F *)gROOT->FindObject(hname);
871  if(h1Azimutal) delete h1Azimutal;
872  h1Azimutal = new TH1F(hname,"",50,-3.15,3.15);
873  h1Azimutal->SetStats(0);
874  h1Azimutal->SetXTitle("#theta_{azimuth}(rad)");
875 
876 
877  sprintf(hname,"h1zxd");
878  h1zxd = (TH1F *)gROOT->FindObject(hname);
879  if(h1zxd) delete h1zxd;
880  h1zxd = new TH1F(hname,"",511,0.,511.);
881  h1zxd->SetStats(0);
882  h1zxd->SetXTitle("t_{0}[bin]");
883 
884  sprintf(hname,"h1zyd");
885  h1zyd = (TH1F *)gROOT->FindObject(hname);
886  if(h1zyd) delete h1zyd;
887  h1zyd = new TH1F(hname,"",511,0.,511.);
888  h1zyd->SetStats(0);
889  h1zyd->SetXTitle("t_{0}[bin]");
890 
891  sprintf(hname,"h1xd");
892  h1xd = (TH1F *)gROOT->FindObject(hname);
893  if(h1xd) delete h1xd;
894  h1xd = new TH1F(hname,"",100,114.,174.);
895  h1xd->SetStats(0);
896  h1xd->SetXTitle("x_{0}/y_{0}[bin]");
897 
898  sprintf(hname,"h1yd");
899  h1yd = (TH1F *)gROOT->FindObject(hname);
900  if(h1yd) delete h1yd;
901  h1yd = new TH1F(hname,"",100,114.,174.);
902  h1yd->SetStats(0);
903  h1yd->SetXTitle("x_{0}/y_{0}[bin]");
904 
905  sprintf(hname,"h2xz");
906  // sprintf(htitle,"distorsion dc_c",i);
907  h2xz = (TH2F *)gROOT->FindObject(hname);
908  if(h2xz) delete h2xz;
909  h2xz = new TH2F(hname,"",511,0.,511.,100,114.0,174.0);
910  h2xz->SetStats(0);
911  h2xz->SetXTitle("t_{0}[bin]");
912  h2xz->SetYTitle("x_{0}[bin]");
913 
914  sprintf(hname,"h2yz");
915  // sprintf(htitle,"distorsion dc_c",i);
916  h2yz = (TH2F *)gROOT->FindObject(hname);
917  if(h2yz) delete h2yz;
918  h2yz = new TH2F(hname,"",511,0.,511.,100,114.0,174.0);
919  h2yz->SetStats(0);
920  h2yz->SetXTitle("t_{0}[bin]");
921  h2yz->SetYTitle("y_{0}[bin]");
922 
923  sprintf(hname,"h2xzn");
924  // sprintf(htitle,"distorsion dc_c",i);
925  h2xzn = (TH2F *)gROOT->FindObject(hname);
926  if(h2xzn) delete h2xzn;
927  h2xzn = new TH2F(hname,"",100,-150.,150.,100,-30.0,30.0);
928  h2xzn->SetStats(0);
929  h2xzn->SetXTitle("t_{center}[bin]");
930  h2xzn->SetYTitle("x_{center}[bin]");
931 
932  sprintf(hname,"h2yzn");
933  // sprintf(htitle,"distorsion dc_c",i);
934  h2yzn = (TH2F *)gROOT->FindObject(hname);
935  if(h2yzn) delete h2yzn;
936  h2yzn = new TH2F(hname,"",100,-150.,150.,100,-30.,30.0);
937  h2yzn->SetStats(0);
938  h2yzn->SetXTitle("t_{center}[bin]");
939  h2yzn->SetYTitle("y_{center}[bin]");
940 
941  sprintf(hname,"h2xyn");
942  // sprintf(htitle,"distorsion dc_c",i);
943  h2xyn = (TH2F *)gROOT->FindObject(hname);
944  if(h2xyn) delete h2xyn;
945  h2xyn = new TH2F(hname,"",100,-150.,150.,100,-150.,150.0);
946  h2xyn->SetStats(0);
947  h2xyn->SetXTitle("x_{center}[bin]");
948  h2xyn->SetYTitle("y_{center}[bin]");
950 
951 
952  sprintf(hname,"h1zx3d");
953  h1zx3d = (TH1F *)gROOT->FindObject(hname);
954  if(h1zx3d) delete h1zx3d;
955  h1zx3d = new TH1F(hname,"",511,0.,511.);
956  h1zx3d->SetStats(0);
957  h1zx3d->SetXTitle("t_{0}[bin]");
958 
959  sprintf(hname,"h1zy3d");
960  h1zy3d = (TH1F *)gROOT->FindObject(hname);
961  if(h1zy3d) delete h1zy3d;
962  h1zy3d = new TH1F(hname,"",511,0.,511.);
963  h1zy3d->SetStats(0);
964  h1zy3d->SetXTitle("t_{0}[bin]");
965 
966  sprintf(hname,"h1x3d");
967  h1x3d = (TH1F *)gROOT->FindObject(hname);
968  if(h1x3d) delete h1x3d;
969  h1x3d = new TH1F(hname,"",100,114.,174.);
970  h1x3d->SetStats(0);
971  h1x3d->SetXTitle("x_{0}/y_{0}[bin]");
972 
973  sprintf(hname,"h1y3d");
974  h1y3d = (TH1F *)gROOT->FindObject(hname);
975  if(h1y3d) delete h1y3d;
976  h1y3d = new TH1F(hname,"",100,114.,174.);
977  h1y3d->SetStats(0);
978  h1y3d->SetXTitle("x_{0}/y_{0}[bin]");
979 
980 
981 
982  sprintf(hname,"h2xz3n");
983  // sprintf(htitle,"distorsion dc_c",i);
984  h2xz3n = (TH2F *)gROOT->FindObject(hname);
985  if(h2xz3n) delete h2xz3n;
986  h2xz3n = new TH2F(hname,"",100,-150.,150.,100,-30.0,30.0);
987  h2xz3n->SetStats(0);
988  h2xz3n->SetXTitle("t_{center}[bin]");
989  h2xz3n->SetYTitle("x_{center}[bin]");
990 
991  sprintf(hname,"h2yz3n");
992  // sprintf(htitle,"distorsion dc_c",i);
993  h2yz3n = (TH2F *)gROOT->FindObject(hname);
994  if(h2yz3n) delete h2yz3n;
995  h2yz3n = new TH2F(hname,"",100,-150.,150.,100,-30.,30.0);
996  h2yz3n->SetStats(0);
997  h2yz3n->SetXTitle("t_{center}[bin]");
998  h2yz3n->SetYTitle("y_{center}[bin]");
999 
1000  sprintf(hname,"h2xy3n");
1001  // sprintf(htitle,"distorsion dc_c",i);
1002  h2xy3n = (TH2F *)gROOT->FindObject(hname);
1003  if(h2xy3n) delete h2xy3n;
1004  h2xy3n = new TH2F(hname,"",100,-150.,150.,100,-150.,150.0);
1005  h2xy3n->SetStats(0);
1006  h2xy3n->SetXTitle("x_{center}[bin]");
1007  h2xy3n->SetYTitle("y_{center}[bin]");
1008 
1009 
1010 
1012 
1013 
1014  //cluster <-->track
1015  sprintf(hname,"h1NTrackX");
1016  h1NTrackX = (TH1F *)gROOT->FindObject(hname);
1017  if(h1NTrackX) delete h1NTrackX;
1018  h1NTrackX = new TH1F(hname,"",13,-1.,12.);
1019  h1NTrackX->SetStats(0);
1020  h1NTrackX->SetXTitle("Ntr");
1021 
1022 
1023  sprintf(hname,"h1NTrackXTest");
1024  h1NTrackXTest = (TH1F *)gROOT->FindObject(hname);
1025  if(h1NTrackXTest) delete h1NTrackXTest;
1026  h1NTrackXTest = new TH1F(hname,"",13,-1.,12.);
1027  h1NTrackXTest->SetStats(0);
1028  h1NTrackXTest->SetXTitle("Ntr");
1029 
1030 
1031  sprintf(hname,"h1NTrackY");
1032  h1NTrackY = (TH1F *)gROOT->FindObject(hname);
1033  if(h1NTrackY) delete h1NTrackY;
1034  h1NTrackY = new TH1F(hname,"",13,-1.,12.);
1035  h1NTrackY->SetStats(0);
1036  h1NTrackY->SetXTitle("Ntr");
1037 
1038  sprintf(hname,"h1NClusterX");
1039  h1NClusterX = (TH1F *)gROOT->FindObject(hname);
1040  if(h1NClusterX) delete h1NClusterX;
1041  h1NClusterX = new TH1F(hname,"",120,20,600);
1042  h1NClusterX->SetStats(0);
1043  h1NClusterX->SetXTitle("N_{cluster}");
1044 
1045  sprintf(hname,"h1NClusterY");
1046  h1NClusterY = (TH1F *)gROOT->FindObject(hname);
1047  if(h1NClusterY) delete h1NClusterY;
1048  h1NClusterY = new TH1F(hname,"",120,20,600);
1049  h1NClusterY->SetStats(0);
1050  h1NClusterY->SetXTitle("N_{cluster}");
1051 
1052  sprintf(hname,"h1NClusterNX");
1053  h1NClusterNX = (TH1F *)gROOT->FindObject(hname);
1054  if(h1NClusterNX) delete h1NClusterNX;
1055  h1NClusterNX = new TH1F(hname,"",20,0,20);
1056  h1NClusterNX->SetStats(0);
1057  h1NClusterNX->SetXTitle("N_{cluster}");
1058 
1059  sprintf(hname,"h1NClusterNY");
1060  h1NClusterNY = (TH1F *)gROOT->FindObject(hname);
1061  if(h1NClusterNY) delete h1NClusterNY;
1062  h1NClusterNY = new TH1F(hname,"",20,0,20);
1063  h1NClusterNY->SetStats(0);
1064  h1NClusterNY->SetXTitle("N_{cluster}");
1065 
1066  alignmentx= new TGraph();
1067  alignmenty= new TGraph();
1068 
1069  sprintf(hname,"total charges in time");
1070  h1_pro_timeX = (TH1F *)gROOT->FindObject(hname);
1071  if( h1_pro_timeX) delete h1_pro_timeX;
1072  h1_pro_timeX = new TH1F(hname,"",NADC,0.0,(float)NADC);
1073  h1_pro_timeX ->SetStats(0);
1074  h1_pro_timeX ->SetXTitle("t[bin]");
1075  h1_pro_timeX ->SetYTitle("Q");
1076 
1077  sprintf(hname,"total charges in time");
1078  h1_pro_timeY = (TH1F *)gROOT->FindObject(hname);
1079  if( h1_pro_timeY) delete h1_pro_timeY;
1080  h1_pro_timeY = new TH1F(hname,"",NADC,0.0,(float)NADC);
1081  h1_pro_timeY ->SetStats(0);
1082  h1_pro_timeY ->SetXTitle("t[bin]");
1083  h1_pro_timeY ->SetYTitle("Q");
1084 
1085  sprintf(hname,"h1_sigrho_gamma_x");
1086  h1_sigrho_gamma_x = (TH1F *)gROOT->FindObject(hname);
1087  if(h1_sigrho_gamma_x) delete h1_sigrho_gamma_x;
1088  h1_sigrho_gamma_x = new TH1F(hname,"",200,0.0,10.0);
1089  h1_sigrho_gamma_x->SetStats(0);
1090  h1_sigrho_gamma_x->SetXTitle("#sigma_{#rho}[mm]");
1091 
1092  sprintf(hname,"h1_sigrho_gamma_y");
1093  h1_sigrho_gamma_y = (TH1F *)gROOT->FindObject(hname);
1094  if(h1_sigrho_gamma_y) delete h1_sigrho_gamma_y;
1095  h1_sigrho_gamma_y = new TH1F(hname,"",200,0.0,10.0);
1096  h1_sigrho_gamma_y->SetStats(0);
1097  h1_sigrho_gamma_y->SetXTitle("#sigma_{#rho}[mm]");
1098 
1099 sprintf(hname,"h1_sigrho_TTZ_x");
1100  h1_sigrho_TTZ_x = (TH1F *)gROOT->FindObject(hname);
1101  if(h1_sigrho_TTZ_x) delete h1_sigrho_TTZ_x;
1102  h1_sigrho_TTZ_x = new TH1F(hname,"",200,0.0,10.0);
1103  h1_sigrho_TTZ_x->SetStats(0);
1104  h1_sigrho_TTZ_x->SetXTitle("#sigma_{#rho}[mm]");
1105 
1106  sprintf(hname,"h1_sigrho_TTZ_y");
1107  h1_sigrho_TTZ_y = (TH1F *)gROOT->FindObject(hname);
1108  if(h1_sigrho_TTZ_y) delete h1_sigrho_TTZ_y;
1109  h1_sigrho_TTZ_y = new TH1F(hname,"",200,0.0,10.0);
1110  h1_sigrho_TTZ_y->SetStats(0);
1111  h1_sigrho_TTZ_y->SetXTitle("#sigma_{#rho}[mm]");
1112 
1113 
1114  h1_NEvent = new TH1F("h1_NEvent",";",13,0,13);
1115  h1_TimeSt = new TH1F("h1_TimeSt",";",2,0,2);
1116 
1117  h1_vertex_tr1 = new TH1F("h1_vertex_tr1",";d_{min}[mm]",200,-1.,99.);
1118  h1_vertex_tr2 = new TH1F("h1_vertex_tr2",";d_{min}[mm]",200,-1.,99.);
1119  h2_vertex = new TH2F("h2_vertex",";d_{min}[mm];d_{min}[mm]",200,-1.,100.,200,-1.,99.);
1120 
1121  // sprintf(hname,"alignmentx");
1122  // alignmentx = (TH1F *)gROOT->FindObject(hname);
1123  // if(alignmentx) delete alignmentx;
1124  // alignmentx = new TH1F(hname,"",511,0.,511.);
1125  // alignmentx->SetStats(0);
1126  // alignmentx->SetXTitle("t0[bin]");
1127 
1128  // sprintf(hname,"alignmenty");
1129  // alignmenty = (TH1F *)gROOT->FindObject(hname);
1130  // if(alignmenty) delete alignmenty;
1131  // alignmenty = new TH1F(hname,"",511,0.,511.);
1132  // alignmenty->SetStats(0);
1133  // alignmenty->SetXTitle("t0[bin]");
1134 
1135 }
1136 
1138 {
1139  HarpoDccMap *harpodccmap;
1140  ULong_t ndet;
1141 
1142  Int_t EventType=fEvt->GetRecoEvent()->GetEventType();
1143  Int_t TTZType=0;//fEvt->GetRecoEvent()->GetEventTTZ();
1144 
1145  // Int_t triggerType = -1;
1146  Int_t NewIsTTZ =0;
1147  if(gHDetSet->isExist(PMM2)) {
1148  //Info("process","PMM2 data");
1149  Pmm2Event *anaEvt = static_cast<Pmm2Event *>(fEvt->GetDetEvent(PMM2));
1150  // triggerType = anaEvt->GetTriggerType();
1151 
1152  int imes;
1153  int esize = anaEvt->GetHeader()->eventSize;
1154  // int ievnum = anaEvt->GetHeader()->eventNumb;
1155 
1156  Pmm2MesVect * pm = anaEvt->GetMesurements();
1157  int hit[16];
1158  for(int ch = 0; ch<16; ch++) hit[ch] = 0;
1159  for(imes=0;imes<esize;imes++) {
1160  int ch = pm->at(imes).getChNum(); // channel
1161  // int q = pm->at(imes).getCharge(); // charge;
1162  hit[ch] = 1;
1163  }
1164 
1165  if(hit[3] && hit[4] && hit[5] && hit[6]){
1166  if(gHarpoDebug>1) Info("process","TT");
1167  NewIsTTZ = 1;
1168  }
1169 
1170 
1171  }
1172  Int_t ntr_y= fEvt->GetRecoEvent()->GetNtracksYEvt();
1173  // Int_t ntr_x= fEvt->GetRecoEvent()->GetNtracksXEvt();
1174  // h1NTrackY->Fill(ntr_x);
1175  h1NTrackY->Fill(ntr_y);
1176 
1177 
1178 
1179 
1180  //cout<<"NTr dans X ::"<<ntr_x<<endl;
1181 
1182  // h1NTrackXTest->Fill(ntr_x);
1183  //h1NTrackXTest->Draw();
1184  for(ndet=0;ndet<gkNDetectors;ndet++)
1185  {
1186  if(gHDetSet->isExist(ndet)==0 && gHDetSet->isSim()==0) continue;
1187  //
1188  harpodccmap = fEvt->GetDccMap(ndet);
1189  if(!harpodccmap) continue;
1190  for(Int_t i=0;i<511;i++){ //Time bins
1191  Int_t charge = 0;
1192  for(Int_t j=0;j<288;j++){ // Channels
1193  Double_t q = harpodccmap->GetData(j,i);
1194  if(ndet==0 &&q>0) h1_Qpix_x->Fill(q);
1195  if(ndet==1 &&q>0) h1_Qpix_y->Fill(q);
1196  if(q>50){
1197  charge+=q;
1198  }
1199  }
1200  if(ndet==0) h1_Q_time_x->Fill(i+1,charge);
1201  if(ndet==1) h1_Q_time_y->Fill(i+1,charge);
1202  }
1203 
1204  for(Int_t j=0;j<288;++j)
1205  {
1206  Int_t charge = 0;
1207  for(Int_t i=0;i<511;++i){
1208  Double_t q = harpodccmap->GetData(j,i);
1209  if(q>50){
1210  charge += q;
1211  }
1212  }
1213  if(ndet==0) h1_Q_channel_x->Fill(j+1,charge);
1214  if(ndet==1) h1_Q_channel_y->Fill(j+1,charge);
1215  }
1216 
1217  }
1218 
1219 
1220 
1221  Double_t t0= 600.,x0=400.,y0=400., t0x=600.,t0y=600.,t1x=-1, t2x=-1, t1y=-1,t2y=-1, x1=-1,y1=-1,x2=-1,q0x=-1,q0y=-1,q1x=-1,q1y=-1,q2x=-1,q2y=-1,t0x3=0.,t0y3=0.,x30=0,y30=0.;
1222  Int_t tmin = 600, tmax = -10, xmin = 400, xmax = -10, ymin = 400, ymax = -10;
1223  Int_t nclusternx=0;
1224  Int_t nclusterny=0;
1225 
1226  HarpoRecoEvent* reco = fEvt->GetRecoEvent();
1227  TClonesArray* clArray = reco->GetClustersArray();
1228  Int_t nCl = clArray->GetEntries();
1229  for(Int_t icl = 0; icl<nCl; icl++){
1230  HarpoRecoClusters* cluster = (HarpoRecoClusters*)clArray->At(icl);
1231  Double_t q = cluster->GetQ();
1232  Int_t ind = cluster->GetIndex();
1233  Double_t mean = cluster->GetMean();
1234  Int_t plane = cluster->GetPlane();
1235  Int_t type = cluster->GetType();
1236  Int_t idcluster = cluster->GetIdClusterTrack();
1237  Double_t sig = cluster->GetSig();
1238  Int_t width = cluster->GetWidth();
1239 
1240  Int_t Index = ind;
1241  Int_t Type = type;
1242 
1243  if(plane==0 &&idcluster<0) nclusternx++;
1244  if(plane==1 &&idcluster<0) nclusterny++;
1245 
1246  if(Type ==1){
1247  if(Index<tmin) tmin = Index;
1248  if(Index>tmax) tmax = Index;
1249  }
1250 
1251  if(Type ==1)
1252  {
1253  if(Index<t0) t0=Index;
1254  }
1255 
1256  if(Type ==0){
1257  if( plane == 0 && Index<xmin) xmin = Index;
1258  if( plane == 0 && Index>xmax) xmax = Index;
1259  if( plane == 1 && Index<ymin) ymin = Index;
1260  if( plane == 1 && Index>ymax) ymax = Index;
1261  }
1262 
1263  if(plane==0){
1264  if(type==0){
1265  h1_QCcluster_x->Fill(q);
1266  h1_IndexCcluster_x->Fill(ind);
1267  h1_WidthCcluster_x->Fill(width);
1268  h1_SigCcluster_x->Fill(sig);
1269  h1_MeanCcluster_x->Fill(mean);
1270  }
1271  if(type==1){
1272  h1_QTcluster_x->Fill(q);
1273  h1_IndexTcluster_x->Fill(ind);
1274  h1_WidthTcluster_x->Fill(width);
1275  h1_SigTcluster_x->Fill(sig);
1276  h1_MeanTcluster_x->Fill(mean);
1277  if(Index<t0x){
1278  x0=mean;
1279  t0x=Index;
1280  }
1281 
1282  }
1283  }
1284  if(plane==1){
1285  if(type==0){
1286  h1_QCcluster_y->Fill(q);
1287  h1_IndexCcluster_y->Fill(ind);
1288  h1_WidthCcluster_y->Fill(width);
1289  h1_SigCcluster_y->Fill(sig);
1290  h1_MeanCcluster_y->Fill(mean);
1291  }
1292  if(type==1){
1293  h1_QTcluster_y->Fill(q);
1294  h1_IndexTcluster_y->Fill(ind);
1295  h1_WidthTcluster_y->Fill(width);
1296  h1_SigTcluster_y->Fill(sig);
1297  h1_MeanTcluster_y->Fill(mean);
1298 
1299  if(Index<t0y){
1300  y0=mean;
1301  t0y=Index;
1302  }
1303  }
1304  }
1305  }
1306 
1307 
1308  h1NClusterNX->Fill(nclusternx);
1309  h1NClusterNY->Fill(nclusterny);
1310 
1312 
1313  for(Int_t icl = 0; icl<nCl; icl++){
1314  HarpoRecoClusters* cluster = (HarpoRecoClusters*)clArray->At(icl);
1315  Double_t q = cluster->GetQ();
1316  Int_t ind = cluster->GetIndex();
1317  Double_t mean = cluster->GetMean();
1318  Int_t plane = cluster->GetPlane();
1319  Int_t type = cluster->GetType();
1320 
1321  if(plane==0 && type==1) {
1322  if(ind-t0x==0) q0x=q;
1323  if(ind-t0x==1){
1324  q1x=q;
1325  t1x=ind;
1326  x1=mean;
1327  }
1328  if(ind-t0x==2){
1329  q2x=q;
1330  t2x=ind;
1331  x2=mean;
1332  }
1333 
1334  }
1335  if(plane==1 && type ==1){
1336 
1337  if(ind-t0y==0) q0y=q;
1338  if(ind-t0y==1){
1339  q1y=q;
1340  t1y=ind;
1341  y1=mean;
1342  }
1343  if(ind-t0y==2){
1344  q2y=q;
1345  t2y=ind;
1346  //y2=mean;
1347  }
1348  }
1349  }
1350 
1351  if(q1x>0&&q2x>0){
1352  t0x3=(t0x*q0x+t1x*q1x+t2x*q2x)/(q0x+q1x+q2x);
1353  x30=(x0*q0x+x1*q1x+x2*q2x)/(q0x+q1x+q2x);
1354  }
1355  else {
1356  t0x3=t0x;
1357  x30=x0;
1358  }
1359 
1360  if(q1y>0&&q2y>0){
1361  t0y3=(t0y*q0y+t1y*q1y+t2y*q2y)/(q0y+q1y+q2y);
1362  y30=(y0*q0y+y1*q1y+x2*q2y)/(q0y+q1y+q2y);
1363  }
1364 
1365  else {
1366  t0y3=t0y;
1367  y30=y0;
1368  }
1369 
1370 
1371  // if(EventType==6){
1372 
1373  if(t0<380&& t0>110) {
1374  h1zx3d->Fill(t0x3);
1375  h1zy3d->Fill(t0y3);
1376  }
1377  if(x30<174&& x30>114) h1x3d->Fill(x30);
1378  if(y30<174&& y30>114) h1y3d->Fill(y30);
1379 
1380 
1381  if(x30<174&&x30>114) {
1382  if(t0x3<380&& t0x3>110) {
1383  h2xz3n->Fill(t0x3-250,x30-143.5);
1384  }
1385  }
1386  if(y30<174&& y30>114) {
1387  if(t0y3<380&& t0y3>110) {
1388  h2yz3n->Fill(t0y3-250,y30-143.5);
1389  }
1390  }
1391  h2xy3n->Fill(x30-143.5,y30-143.5);
1392 
1393  fAlignmentZx=t0x3;
1394  fAlignmentX=x30;
1395 
1396  fAlignmentY=y30;
1397  fAlignmentZy=t0y3;
1398 
1399  fAlignmentZ=(fAlignmentZx+fAlignmentZy)/2;
1400 
1401  //}
1403 
1404 
1405  h1_tmin->Fill(tmin);
1406  h1_tmax->Fill(tmax);
1407  h1_xmin->Fill(xmin);
1408  h1_ymin->Fill(ymin);
1409  h1_xmax->Fill(xmax);
1410  h1_ymax->Fill(ymax);
1411  h1_dtime->Fill(tmax-tmin);
1412 
1413  //if(EventType==6){
1414  if(t0<380&& t0>110) {
1415  h1zxd->Fill(t0x3);
1416  h1zyd->Fill(t0y3);
1417  }
1418  if(x30<174&& x30>114) h1xd->Fill(x30);
1419  if(y30<174&& y30>114) h1yd->Fill(y30);
1420 
1421  if(x30<174&&x30>114) {
1422  if(t0x3<380&& t0x3>110) {
1423  h2xz->Fill(t0x3,x30);
1424  h2xzn->Fill(t0x3-250,x30-143.5);
1425  }
1426  //alignmentx->Fill(t0,x0);
1427  alignmentx->SetPoint(1,t0x3,x30);
1428  }
1429  if(y30<174&& y30>114) {
1430  if(t0y3<380&& t0y3>110) {
1431  h2yz->Fill(t0y3,y30);
1432  h2yzn->Fill(t0y3-250,y30-143.5);
1433  }
1434 
1435  h2xyn->Fill(x30-143.5,y30-143.5);
1436  //alignmenty->Fill(t0,y0);
1437  alignmenty->SetPoint(1,t0y3,y30);
1438  }
1439  //}
1440 
1441  TClonesArray* trArray = reco->GetHoughTracksArray();
1442  Int_t nTr = trArray->GetEntries();
1443 
1444 
1445  if(EventType==6){
1446  for(Int_t itr = 0; itr<nTr; itr++)
1447  {
1448  HarpoRecoHoughTracks* track = (HarpoRecoHoughTracks*)trArray->At(itr);
1449  Double_t sigrho = track->GetSigrho();
1450  Int_t plane = track->GetPlane();
1451  if(plane ==0) h1_sigrho_gamma_x->Fill(sigrho);
1452  if(plane ==1) h1_sigrho_gamma_y->Fill(sigrho);
1453  }
1454  }
1455 
1456  if(TTZType==1){
1457  for(Int_t itr = 0; itr<nTr; itr++)
1458  {
1459  HarpoRecoHoughTracks* track = (HarpoRecoHoughTracks*)trArray->At(itr);
1460  Double_t sigrho = track->GetSigrho();
1461  Int_t plane = track->GetPlane();
1462  if(plane ==0) h1_sigrho_TTZ_x->Fill(sigrho);
1463  if(plane ==1) h1_sigrho_TTZ_y->Fill(sigrho);
1464  }
1465  }
1466 
1467  // if(triggerType==4 || triggerType==0 ||triggerType==9 || triggerType==14){
1468  if(NewIsTTZ==1){
1469  if(TTZType==1) fNormTTz++;
1470  }
1471 
1472 
1473 
1474 
1475  for(Int_t itr = 0; itr<nTr; itr++)
1476  {
1477  HarpoRecoHoughTracks* track = (HarpoRecoHoughTracks*)trArray->At(itr);
1478  Int_t plane = track->GetPlane();
1479  Double_t theta = track->GetMtheta();
1480  Double_t rho = track->GetMrho();
1481  Double_t angletrack = track->GetAngleTrack();
1482  Double_t sigtheta = track->GetSigtheta();
1483  Double_t sigrho = track->GetSigrho();
1484  // Int_t qtrack = track->GetQtTrack();
1485  // Int_t idtrack = track->GetIdTrackMatching();
1486  Int_t typetrack = track->GetTypeTrack();
1487  Int_t nclustertrack = track-> GetNclusterTrack();
1488  Int_t IsTTZ = 0;//track->GetIsTTZ();
1489  // if(plane==0) ntr_x++;
1490 
1491  if(NewIsTTZ==1){
1492  if(plane==0&& IsTTZ==1){
1493  fNormTTzX++;
1494  }
1495  if(plane==1&& IsTTZ==1){
1496  fNormTTzY++;
1497  }
1498  }
1499 
1500  if(plane==0) h1NClusterX->Fill(nclustertrack);
1501  if(plane==1) h1NClusterY->Fill(nclustertrack);
1502 
1503  if(plane ==0){
1504  h1_theta_x->Fill(theta);
1505  h1_sigtheta_x->Fill(sigtheta);
1506  h1_rho_x->Fill(rho);
1507  h1_sigrho_x->Fill(sigrho);
1508  h1_TypeTrack_x->Fill(typetrack);
1509  h1_angleTrack_x->Fill(angletrack);
1510  }
1511 
1512  if(plane ==1){
1513  h1_theta_y->Fill(theta);
1514  h1_sigtheta_y->Fill(sigtheta);
1515  h1_rho_y->Fill(rho);
1516  h1_sigrho_y->Fill(sigrho);
1517  h1_TypeTrack_y->Fill(typetrack);
1518  h1_angleTrack_y->Fill(angletrack);
1519  }
1520  double pi=TMath::Pi();
1521  double rlambda;
1522  for(Int_t icl = 0; icl<nCl; icl++){
1523  HarpoRecoClusters* cluster = (HarpoRecoClusters*)clArray->At(icl);
1524  Int_t plane = cluster->GetPlane();
1525  Int_t type = cluster->GetType();
1526  Int_t idcluster = cluster->GetIdClusterTrack();
1527  Double_t q = cluster->GetQ();
1528  Int_t ind = cluster->GetIndex();
1529  // Double_t mean = cluster->GetMean();
1530 
1531  Double_t qn;
1532 
1533  // Int_t tminx=600,tminy=600,tmaxx=0,tmaxy=0;
1534  if(angletrack>pi/2) qn=-q*cos(angletrack);
1535  else qn=q*cos(angletrack);
1536 
1537  if(plane!=0 && plane !=1) continue;
1538  // if(plane==0 && idcluster==itr) nclusterx[itr]++;
1539  // if(plane==1 && idcluster==itr) nclusterny[itr]++;
1540  if(plane==0 && type == 0 &&idcluster>-1) h1_QcAssoc_x->Fill(q);
1541  if(plane==0 && type == 1 &&idcluster>-1) h1_QtAssoc_x->Fill(q);
1542  if(plane==1 && type == 0 &&idcluster>-1) h1_QcAssoc_y->Fill(q);
1543  if(plane==1 && type == 1 &&idcluster>-1) h1_QtAssoc_y->Fill(q);
1544  if(plane==0 && type == 0 &&idcluster<0) h1_QcNAssoc_x->Fill(q);
1545  if(plane==0 && type == 1 &&idcluster<0) h1_QtNAssoc_x->Fill(q);
1546  if(plane==1 && type == 0 &&idcluster<0) h1_QcNAssoc_y->Fill(q);
1547  if(plane==1 && type == 1 &&idcluster<0) h1_QtNAssoc_y->Fill(q);
1548 
1549  if(plane==0 && type==1 &&idcluster>-1) h1_Qassoc_time_x->Fill(ind,q);
1550  if(plane==1 && type==1 &&idcluster>-1) h1_Qassoc_time_y->Fill(ind,q);
1551  if(plane==0 && type==1) h1_QtAssocN_x->Fill(qn);
1552  if(plane==1 && type==1) h1_QtAssocN_y->Fill(qn);
1553  // if(plane==0 && type==1 &&IsTTZ==1 &&idcluster==itr && (triggerType==4 || triggerType==0 ||triggerType==9))
1554  //if(plane==0 && type==1 && IsTTZ==1 &&idcluster==itr && (triggerType==4 || triggerType==0 ||triggerType==9 || triggerType==14))
1555  if(NewIsTTZ==1){
1556  if(plane==0&& IsTTZ==1){
1557  if(type==1 &&idcluster==itr)
1558  h1_QtAssocN_time_x->Fill(ind,qn);
1559  }
1560  // if(plane==1 && type==1 &&IsTTZ==1 &&idcluster==itr && (triggerType==4 || triggerType==0 || triggerType==9)) h1_QtAssocN_time_y->Fill(ind,q);
1561  //if(plane==1 && type==1 && IsTTZ==1 &&idcluster==itr && (triggerType==4 || triggerType==0 || triggerType==9 || triggerType==14))
1562  if(plane==1&& IsTTZ==1){
1563  if(type==1 &&idcluster==itr)
1564  h1_QtAssocN_time_y->Fill(ind,qn);
1565  }
1566  }
1567  if(plane==0 &&type==0 && sigrho<2 &&IsTTZ==1) h1_QtAssocN_channel_x->Fill(ind,q*sin(angletrack));
1568  if(plane==1 &&type==0 && sigrho<2 &&IsTTZ==1) h1_QtAssocN_channel_y->Fill(ind,q*sin(angletrack));
1569  if(plane==0 &&type==1 && sigrho<2 &&IsTTZ==1){
1570  h2_QtAssocN_time_x->Fill(ind,qn);
1571  if(ind<450 && ind>90) h2_Qprof_x->Fill(ind,qn);
1572  }
1573 
1574  if(plane==1 &&type==1 && sigrho<1.5 && IsTTZ==1){
1575  h2_QtAssocN_time_y->Fill(ind,qn);
1576  if(ind<450 && ind>90) h2_Qprof_y->Fill(ind,qn);
1577  }
1578 
1579  if(NewIsTTZ==1){
1580  if(track->GetPlane()==0 && cluster->GetPlane()==0){
1581  rlambda = 0;
1582  if(type==0&& IsTTZ==1 &&idcluster==itr){
1583  rlambda = (cluster->GetMean()-511/2)*sin(theta) - (cluster->GetIndex()-288/2)*cos(theta);
1584  fXT = rho*cos(theta) +rlambda*sin(theta) + 511/2;
1585  fXC = rho*sin(theta)+rlambda*cos(theta) + 288/2;
1586  fXdC = cluster->GetIndex() - fXC;
1587  fXdT = cluster->GetMean() -fXT;
1588  }
1589  if(type==1&& IsTTZ==1 &&idcluster==itr){
1590  rlambda = (cluster->GetIndex()-511/2)*sin(theta) - (cluster->GetMean()-288/2)*cos(theta);
1591  fXT = rho*cos(theta) +rlambda*sin(theta) + 511/2;
1592  fXC = rho*sin(theta)+rlambda*cos(theta) + 288/2;
1593  fXdC = cluster->GetMean() - fXC;
1594  fXdT = cluster->GetIndex() -fXT;
1595  }
1596 
1597 
1598  if(fXdC<30&&fXdC>-30)
1599  {
1600  h1_distortion_dc_x->Fill(fXdC);
1601  h2_distortion_dc_t_x->Fill(fXT,fXdC);
1602  h2_distortion_dc_c_x->Fill(fXC,fXdC);
1603  h2_prof_dc_c_x->Fill(fXC,fXdC);
1604  if(fXT>100 &&fXT<440)
1605  h2_prof_dc_t_x->Fill(fXT,fXdC);
1606  }
1607  if(fXdT<2&&fXdT>-2)
1608  {
1609  h1_distortion_dt_x->Fill(fXdT);
1610  h2_distortion_dt_t_x->Fill(fXT,fXdT);
1611  h2_distortion_dt_c_x->Fill(fXC,fXdT);
1612  if(fXT>100 &&fXT<440)
1613  h2_prof_dt_t_x->Fill(fXT,fXdT);
1614  h2_prof_dt_c_x->Fill(fXC,fXdT);
1615  }
1616 
1617  }
1618 
1619 
1620  if(track->GetPlane()==1 && cluster->GetPlane()==1 ){
1621  rlambda = 0;
1622  if(type==0&& IsTTZ==1 &&idcluster==itr) {
1623  rlambda = (cluster->GetMean()-511/2)*sin(theta) - (cluster->GetIndex()-288/2)*cos(theta);
1624  fYT = rho*cos(theta) +rlambda*sin(theta) + 511/2;
1625  fYC = rho*sin(theta)+rlambda*cos(theta) + 288/2;
1626  fYdC = cluster->GetIndex() - fYC;
1627  fYdT = cluster->GetMean() -fYT;
1628  }
1629  if(type==1 && IsTTZ==1 &&idcluster==itr){
1630  rlambda = (cluster->GetIndex()-511/2)*sin(theta) - (cluster->GetMean()-288/2)*cos(theta);
1631  fYT = rho*cos(theta) +rlambda*sin(theta) + 511/2;
1632  fYC = rho*sin(theta)+rlambda*cos(theta) + 288/2;
1633  fYdC = cluster->GetMean() - fYC;
1634  fYdT = cluster->GetIndex() - fYT;
1635  }
1636 
1637  if(fYdC<30&&fYdC>-30){
1638  h1_distortion_dc_y->Fill(fYdC);
1639  h2_distortion_dc_t_y->Fill(fYT,fYdC);
1640  h2_distortion_dc_c_y->Fill(fYC,fYdC);
1641  if(fYT>100&&fYT<440)
1642  h2_prof_dc_t_y->Fill(fYT,fYdC);
1643  h2_prof_dc_c_y->Fill(fYC,fYdC);
1644  }
1645  if(fYdT<2&&fYdT>-2){
1646  h1_distortion_dt_y->Fill(fYdT);
1647  h2_distortion_dt_t_y->Fill(fYT,fYdT);
1648  h2_distortion_dt_c_y->Fill(fYC,fYdT);
1649  if(fYT>100&&fYT<440)
1650  h2_prof_dt_t_y->Fill(fYT,fYdT);
1651  h2_prof_dt_c_y->Fill(fYC,fYdT);
1652 
1653  }
1654  }
1655  }
1656  }
1657  char commentname[1000];
1658  sprintf(commentname,"Evt %ld",fEvt->GetHeader()->GetEvtNo());
1659  }
1660 
1661 
1662  TClonesArray* tr3dArray = reco->GetReco3DArray();
1663  Int_t nTr3d = tr3dArray->GetEntries();
1664  if(EventType==6){
1665  Double_t tr1dx=-1,tr1dy=-1,tr1dxz=600,tr1dyz=600,tr1fx=-1,tr1fy=-1,tr1fxz=-1,tr1fyz=-1;
1666 
1667  Double_t tr2dx=-1,tr2dy=-1,tr2dxz=600,tr2dyz=600,tr2fx=-1,tr2fy=-1,tr2fxz=-1,tr2fyz=-1;
1668 
1669  TClonesArray* matchArray = reco->GetMatchingArray();
1670  Int_t nMatch = matchArray->GetEntries();
1671  for(Int_t i=0;i<nMatch;i++){
1672  HarpoRecoMatching* matching = (HarpoRecoMatching*)matchArray->At(i);
1673  Int_t indexX = matching->GetiMatchTrX();
1674  Int_t indexY = matching->GetiMatchTrY();
1675 
1676  for(Int_t icl = 0; icl<nCl; icl++){
1677  HarpoRecoClusters* cluster = (HarpoRecoClusters*)clArray->At(icl);
1678  if(cluster->GetPlane()==0&&cluster->GetType()==1&&cluster->GetIdClusterTrack()==indexX){
1679  if(i==0){
1680  Int_t indX = cluster->GetIndex();
1681  Double_t meanX = cluster->GetMean();
1682  if(indX<tr1dxz){
1683  tr1dxz=indX;
1684  tr1dx = meanX;
1685  }
1686 
1687  if(indX>tr1fxz){
1688  tr1fxz=indX;
1689  tr1fx = meanX;
1690  }
1691  }
1692  if(i==1){
1693  Int_t indX = cluster->GetIndex();
1694  Double_t meanX = cluster->GetMean();
1695  if(indX<tr2dxz){
1696  tr2dxz=indX;
1697  tr2dx = meanX;
1698  }
1699  if(indX>tr2fxz){
1700  tr2fxz=indX;
1701  tr2fx = meanX;
1702  }
1703  }
1704  }
1705  if(cluster->GetPlane()==1&&cluster->GetType()==1&&cluster->GetIdClusterTrack()==indexY){
1706 
1707  if(i==0){
1708  Int_t indY = cluster->GetIndex();
1709  Double_t meanY = cluster->GetMean();
1710  if(indY<tr1dyz){
1711  tr1dyz=indY;
1712  tr1dy = meanY;
1713  }
1714  if(indY>tr1fyz){
1715  tr1fyz=indY;
1716  tr1fy = meanY;
1717  }
1718  }
1719  if(i==1){
1720  Int_t indY = cluster->GetIndex();
1721  Double_t meanY = cluster->GetMean();
1722  if(indY<tr2dyz){
1723  tr2dyz=indY;
1724  tr2dy = meanY;
1725  }
1726  if(indY>tr2fyz){
1727  tr2fyz=indY;
1728  tr2fy = meanY;
1729  }
1730  }
1731  }
1732  }
1733  }
1734 
1735 
1736  for(Int_t itr=0;itr<nTr3d;itr++){
1737  HarpoRecoReco3D* track3d = (HarpoRecoReco3D*)tr3dArray->At(itr);
1738  // HarpoRecoReco3D* track3d = (HarpoRecoReco3D*)tr3dArray;
1739  Double_t doca=track3d->GetDoca();
1740  Double_t poca_x = track3d->GetPoca_x();
1741  Double_t poca_y = track3d->GetPoca_y();
1742  Double_t poca_z = track3d->GetPoca_z();
1743 
1744  Double_t px = track3d->GetPx();
1745  Double_t py = track3d->GetPy();
1746  Double_t pz = track3d->GetPz();
1747 
1748  Double_t Aopen = track3d->GetAopen();
1749  Double_t Aazimutal = track3d->GetAazimutal();
1750 
1751  //if(EventType==6){
1752  h1Doca->Fill(doca);
1753  if(poca_z>110 &&poca_z<380)
1754  {
1755  if(poca_x<174&& poca_x>114) h1Poca_x->Fill(poca_x);
1756  if(poca_y<174&& poca_y>114) h1Poca_y->Fill(poca_y);
1757  h1Poca_z->Fill(poca_z);
1758  h2Poca_xy->Fill(poca_x,poca_y);
1759  if(poca_x<174&& poca_x>114) h2Poca_xz->Fill(poca_z,poca_x);
1760  if(poca_y<174&& poca_y>114) h2Poca_yz->Fill(poca_z,poca_y);
1761  }
1762 
1763  h1Px->Fill(px);
1764  h1Py->Fill(py);
1765  h1Pz->Fill(pz);
1766  h2Pxy->Fill(px,py);
1767  h2Pxz->Fill(pz,px);
1768  h2Pyz->Fill(pz,py);
1769 
1770  h1Azimutal->Fill(Aazimutal);
1771  h1AOpen->Fill(Aopen);
1772  // }
1773  // cout<<"doca="<<doca<<endl;
1774  //}
1775  if(tr1dxz<600 && tr1dyz<600 &&tr2dxz<600 && tr2dyz<600 &&tr1fxz>0 && tr1fyz>0 && tr2fxz>0 && tr2fyz>0){
1776  Double_t disd1 = sqrt((poca_x-tr1dx)*(poca_x-tr1dx)+(poca_y-tr1dy)*(poca_y-tr1dy)+(poca_z-tr1dxz)*(poca_z-tr1dxz));
1777  Double_t disf1 = sqrt((poca_x-tr1fx)*(poca_x-tr1fx)+(poca_y-tr1fy)*(poca_y-tr1fy)+(poca_z-tr1fxz)*(poca_z-tr1fxz));
1778  Double_t disd2 = sqrt((poca_x-tr2dx)*(poca_x-tr2dx)+(poca_y-tr2dy)*(poca_y-tr2dy)+(poca_z-tr2dxz)*(poca_z-tr2dxz));
1779  Double_t disf2 = sqrt((poca_x-tr2fx)*(poca_x-tr2fx)+(poca_y-tr2fy)*(poca_y-tr2fy)+(poca_z-tr2fxz)*(poca_z-tr2fxz));
1780  Double_t dmin1, dmin2;
1781  if(disd1<disf1) dmin1= disd1;
1782  else dmin1 = disf1;
1783  if(disd2<disf2) dmin2= disd2;
1784  else dmin2 = disf2;
1785 
1786  h1_vertex_tr1->Fill(dmin1);
1787  h1_vertex_tr2->Fill(dmin2);
1788  h2_vertex->Fill(dmin1,dmin2);
1789  }
1790  }
1791 
1792  }
1793 
1794  // for(Int_t itr = 0; itr<nTr3d; itr++){
1795  // HarpoRecoReco3D* track3d = (HarpoRecoReco3D*)tr3dArray->At(itr);
1796  // Int_t typetrack3d[itr] = track3d->GetTypeTrack3d(itr);
1797  // }
1798  Int_t triggerType = -1;
1799  if(gHDetSet->isExist(PMM2)) {
1800  //Info("process","PMM2 data");
1801  Pmm2Event *anaEvt = static_cast<Pmm2Event *>(fEvt->GetDetEvent(PMM2));
1802  triggerType = anaEvt->GetTriggerType();
1803  }
1804 
1805  ftriggerType=triggerType;
1806 
1807  // if(ftriggerType!=-1)
1808  // cout<<"line trigger:"<<ftriggerType<<endl;
1809  //cout<<"gHDetSet->isExist(PMM2)="<<gHDetSet->isExist(PMM2)<<endl;
1810  if(nEvents%100 == 0)
1811  cout << nEvents << endl;
1812 
1813  fTree->Fill();
1814 }
1815 
1817 {
1818 
1819  // Int_t triggerType = -1;
1820  if (gHDetSet->isExist(PMM2)){
1821  Pmm2Event *anaEvt = static_cast<Pmm2Event *>(fEvt->GetDetEvent(PMM2));
1822  // std::cout << "pmm2Event: " << anaEvt << std::endl;
1823  //triggerType = anaEvt->GetTriggerType();
1824  int itdiff; // Difference between times stamps in events N and N -1
1825  int imes;
1826  int esize = anaEvt->GetHeader()->eventSize;
1827  int ievnum = anaEvt->GetHeader()->eventNumb;
1828  // Info("process","ievnum = %d, esize = %d",ievnum,esize);
1829  // Info("process","esize = %d",esize);
1830 
1831  Pmm2MesVect * pm = anaEvt->GetMesurements();
1832  helen->Fill(esize+0.5);
1833  int hit[16];
1834  for(int ch = 0; ch<16; ch++) hit[ch] = 0;
1835  for(imes=0;imes<esize;imes++) {
1836  // i cann't use operator[] on pointer
1837  Pmm2MesVect &m = *pm;
1838 
1839  int ch = pm->at(imes).getChNum(); // channel
1840  int iadc = m[imes].getCharge(); // Charge in adc counts
1841  int ig = m[imes].getGain(); // Adc Gain bit
1842  // int ipps = m[imes].getPPS(); // PPS counter
1843  int its = m[imes].getTimeStamp(); // Time stamp not corrected
1844  int iramp = m[imes].getTRamp(); // TDC Ramp bit
1845  int iftime = m[imes].getFTime(); // Fine Time
1846  //Info("process","ch = %d, q = %d",ch,iadc);
1847  heprof->Fill(ch + 0.5); // Channel profile
1848  hadc[ig]->Fill(iadc + 0.5);
1849  // hpps->Fill(ipps + 0.5, its + 0.5);
1850  htvse->Fill(ievnum + 0.5, its + 0.5);
1851  hramp->Fill(iramp + 0.5, iftime + 0.5);
1852  hPmm2->SetBinContent(ch+1,iadc);
1853  hPmm2Spectrum2D->Fill(ch,iadc);
1854  hit[ch] = 1;
1855  if ( (imes == 0) && (itsold != -1) )
1856  {
1857  itdiff = its - itsold;
1858  if ( itdiff < 0 ) {
1859  itdiff = MaxTime - itdiff;
1860  }
1861  // std::cout << "e " << nEvents << " diff " << itdiff << std::endl;
1862  htdiff->Fill(itdiff + 0.5);
1863  htdiff2->Fill(itdiff + 0.5);
1864  }
1865  itsold = its;
1866  }
1867 
1868  for(int ch = 0; ch<16; ch++){
1869  int ch2 = ch%2 ? ch+1 : ch-1;
1870  if(hit[ch2]){
1871  if(!hit[ch])
1872  hPmm2Missed->Fill(ch);
1873  hPmm2Triggered->Fill(ch);
1874  }
1875  }
1876 
1877  for(int ch1 = 0; ch1<16; ch1++){
1878  for(int ch2 = 0; ch2<16; ch2++){
1879  // if(hit[ch1] && hit[ch2] && ch1 != ch2){
1880  if(hit[ch1] && hit[ch2]){
1881  hPmm2Coincidence->Fill(ch1,ch2);
1882  }
1883  }
1884  }
1885  }
1886  else{
1887  for(Int_t ch = 0; ch<16; ch++) hPmm2->SetBinContent(ch+1,-1);
1888  }
1889 
1890 }
1891 
1892 
1894 {
1895  Int_t ntr_x= fEvt->GetRecoEvent()->GetNtracksXEvt();
1896  h1NTrackX->Fill(ntr_x);
1897 
1898  NEvent++;
1899 
1900  ULong_t TempsX0 = 0;
1901  //Long_t TempsY0;
1902 
1903  ULong_t TempsX = fEvt->GetTimeStamp(0);
1904  //Long_t TempsY = fEvt->GetTimeStamp(1);
1905 
1906  if(nEvents==1){
1907  TempsX0=fEvt->GetTimeStamp(0);
1908  // TempsY0=fEvt->GetTimeStamp(1);
1909  }
1910 
1911  TimeSt = (TempsX - TempsX0)/100000000;
1912 
1913 
1914 HarpoMonitorEventType eventType = E_OTHER;
1915 Int_t EventType=fEvt->GetRecoEvent()->GetEventType();
1916 
1917  if(EventType==0) eventType = E_EMPTY;
1918  if(EventType==1) eventType = E_DEPOT;
1919 
1920  if(EventType==3) eventType = E_TRAVERSING;
1921  if(EventType==4) eventType = E_CREATED;
1922  if(EventType==5) eventType = E_CONTAINED;
1923  if(EventType==6) eventType = E_TWOTR_GAMMA;
1924  if(EventType==7) eventType = E_TWOTR_DELTA;
1925  if(EventType==8) eventType = E_TWOTR_OTHER;
1926  if(EventType==9) eventType = E_SHOWER;
1927  if(EventType==10) eventType = E_OTHER;
1928 
1929 
1930  if(EventType==0) NEventEmpty++;
1931  if(EventType==1) NEventDEPOSIT++;
1932 
1933  if(EventType==3) NEventTT ++;
1934  if(EventType==4) NEventTCR++;
1935  if(EventType==5) NEventTCN++;
1936  if(EventType==6) NEventGAMMA++;
1937  if(EventType==7) NEventDELTA++;
1938  if(EventType==8) NEvent2TOTHER ++;
1939  if(EventType==9) NEventSHOWER++;
1940  if(EventType==10) NEventOTHER++;
1941 
1942  HarpoMonitorEventType eventTTZ = E_NOTTZ;
1943  Int_t EventTTZ=0;//fEvt->GetRecoEvent()->GetEventTTZ();
1944  if(EventTTZ==1) eventTTZ = E_TTZ;
1945  if(EventTTZ==1) NEventTTZ++;
1946 
1947 
1948  h1_NEvent->SetBinContent(0,NEvent);
1949  h1_NEvent->SetBinContent(1,NEventEmpty);
1950  h1_NEvent->SetBinContent(2,NEventDEPOSIT);
1951  h1_NEvent->SetBinContent(3,NEventTTZ);
1952  h1_NEvent->SetBinContent(4,NEventTT);
1953  h1_NEvent->SetBinContent(5,NEventTCR);
1954  h1_NEvent->SetBinContent(6,NEventTCN);
1955  h1_NEvent->SetBinContent(7,NEventGAMMA);
1956  h1_NEvent->SetBinContent(8,NEventDELTA);
1957  h1_NEvent->SetBinContent(9,NEvent2TOTHER);
1958  h1_NEvent->SetBinContent(10,NEventSHOWER);
1959  h1_NEvent->SetBinContent(11,NEventOTHER);
1960  h1_TimeSt->SetBinContent(1,TimeSt);
1961 
1962 
1963 
1964 
1965 
1966  // Int_t NEventEmpty=fEvt->GetRecoEvent()->GetNEventEmpty();
1967  // Int_t NEventDEPOSIT=fEvt->GetRecoEvent()->GetNEventDEPOSIT();
1968  // Int_t NEventTTZ=fEvt->GetRecoEvent()->GetNEventTTZ();
1969  // Int_t NEventTT=fEvt->GetRecoEvent()->GetNEventTT();
1970  // Int_t NEventTCR=fEvt->GetRecoEvent()->GetNEventTCR();
1971  // Int_t NEventTCN=fEvt->GetRecoEvent()->GetNEventTCN();
1972  // Int_t NEventGAMMA=fEvt->GetRecoEvent()->GetNEventGAMMA();
1973  // Int_t NEventDELTA=fEvt->GetRecoEvent()->GetNEventDELTA();
1974  // Int_t NEvent2TOTHER=fEvt->GetRecoEvent()->GetNEvent2TOTHER();
1975  // Int_t NEventSHOWER=fEvt->GetRecoEvent()->GetNEventSHOWER();
1976  // Int_t NEventOTHER=fEvt->GetRecoEvent()->GetNEventOTHER();
1977 
1978  // std::cout << " Ngamma= " << NEventGAMMA<<std::endl;
1979  // std::cout << " timestampX " << TempsX-TempsX0<<std::endl;
1980 
1981  // HarpoMonitorEventType eventType = E_OTHER;
1982  // Double_t qtot[2] = {-1,-1};
1983  // Double_t qtb[NADC][2];
1984  // Int_t npix = 0, nch = 0, ntb = 0;
1985  // HarpoMonitorEventType eventType = E_OTHER;
1986  // for(Int_t ndet=0;ndet<2;ndet++) {
1987  // if (gHDetSet->isExist(ndet)) {
1988  // HarpoDccMap * m = fEvt->GetDccMap(ndet);
1989  // if ( m != NULL ) {
1990  // Int_t Qnoise = 0;
1991  // for(Int_t i=0;i<NADC;i++){ //Time bins
1992  // for(Int_t j=NCHAN;j<NALL;j++){ // Noise Channels
1993  // Double_t q = m->GetData(j,i);
1994  // Qnoise += q;
1995  // }
1996  // }
1997  // Bool_t isZS = Qnoise<100*NADC;
1998 
1999  // Double_t qTot = 0, qTotZs = 0, Tmin = -10, Tmax = -10;
2000  // for(Int_t i=0;i<NADC;i++){ //Time bins
2001  // qtb[i][ndet] = 0;
2002  // Double_t qTotT = 0, qTotTZs = 0, meanCh = 0;
2003  // Int_t nCh = 0;
2004  // for(Int_t j=0;j<NALL;j++){ // Channels
2005  // Double_t q = m->GetData(j,i);
2006  // qTotT += q;
2007  // nCh++;
2008  // meanCh += q*j;
2009  // qTot += q;
2010  // }
2011  // if(qTotT>0){
2012  // meanCh /= qTotT;
2013  // }
2014 
2015  // if(!isZS){
2016  // TLinearFitter* fFitCh = new TLinearFitter(1,"pol2","D");
2017  // Double_t qTotT = 0;
2018  // TArrayD* valuesTB = new TArrayD(NALL);
2019  // for(Int_t j=0;j<NCHAN;j++){ // Channels
2020  // Double_t q = m->GetData(j,i);
2021  // valuesTB->AddAt(q,j);
2022  // }
2023  // Double_t noiseTB = TruncMean(valuesTB,0.16,0.84);
2024  // //if(i>490) Info("process","t = %d, noiseTB = %g",i,noiseTB);
2025  // TGraph* gMinusCh = new TGraph();
2026  // for(Int_t j=0;j<NCHAN;j++){ // Channels
2027  // Double_t q = m->GetData(j,i);
2028  // q -= noiseTB;
2029  // m->map(j,i) = q;
2030  // gMinusCh->SetPoint(gMinusCh->GetN(),j,q);
2031  // }
2032  // fFitCh->AssignData(gMinusCh->GetN(), 1, gMinusCh->GetX(), gMinusCh->GetY());
2033  // fFitCh->Eval();
2034  // delete gMinusCh;
2035  // Double_t mean = 0, rms = 0;
2036  // Int_t nnoise = 0;
2037  // for(Int_t j=0;j<NCHAN;j++){ // Channels
2038  // Double_t q = m->GetData(j,i);
2039  // q -= fFitCh->GetParameter(0) + j*fFitCh->GetParameter(1) + j*j*fFitCh->GetParameter(2);
2040  // m->map(j,i) = q;
2041  // if(q<100){
2042  // mean += q;
2043  // rms += q*q;
2044  // nnoise++;
2045  // }
2046  // }
2047  // rms = TMath::Sqrt(rms/nnoise - mean*mean/nnoise/nnoise);
2048  // for(Int_t j=0;j<NALL;j++){ // Channels
2049  // Double_t q = m->GetData(j,i);
2050  // if(q>2*rms){
2051  // m->map(j,i) = q;
2052  // }else{
2053  // m->map(j,i) = 0;
2054  // }
2055  // }
2056  // fFitCh->Delete();
2057  // }
2058 
2059  // Double_t Qcl = 0;
2060  // for(Int_t j=0;j<NCHAN;j++){ // Channels
2061  // Double_t q = m->GetData(j,i);
2062  // if(q>40) Qcl += q;
2063  // }
2064  // if(Qcl>250 && Tmin == -10 && i>5) Tmin = i;
2065  // if(Qcl>250 && Tmin > 0) Tmax = i;;
2066  // }
2067  // qtot[ndet] = qTot;
2068  // if(Tmin>fTmin) eventType = E_CREATED;
2069  // if(Tmax-Tmin>fLTpc) eventType = E_TRAVERSING;
2070  // }
2071  // }
2072  // }
2073 
2074  // if(qtot[0]>fQmax || qtot[1]>fQmax) eventType = E_SATURATED;
2075  // if(qtot[0]<fQmin && qtot[1]<fQmin) eventType = E_EMPTY;
2076 
2077  Int_t triggerType = -1;
2078  if(gHDetSet->isExist(PMM2)) {
2079  //Info("process","PMM2 data");
2080  Pmm2Event *anaEvt = static_cast<Pmm2Event *>(fEvt->GetDetEvent(PMM2));
2081  triggerType = anaEvt->GetTriggerType();
2082  // ftriggerType=anaEvt->GetTriggerType();
2083  }
2084 
2085  switch(eventType){
2086  case E_CREATED:
2087  hTriggerCreated->Fill(triggerType);
2088  fNcreated[triggerType+1]++;
2089  break;
2090  case E_TRAVERSING:
2091  hTriggerTraversing->Fill(triggerType);
2092  fNtraversing[triggerType+1]++;
2093  break;
2094  case E_EMPTY:
2095  hTriggerEmpty->Fill(triggerType);
2096  fNempty[triggerType+1]++;
2097  break;
2098  case E_SHOWER:
2099  hTriggerShower->Fill(triggerType);
2100  fNshower[triggerType+1]++;
2101  break;
2102  case E_OTHER:
2103  hTriggerOther->Fill(triggerType);
2104  fNother[triggerType+1]++;
2105  break;
2106 
2107  case E_CONTAINED:
2108  hTriggerContained->Fill(triggerType);
2109  fNcontained[triggerType+1]++;
2110  break;
2111  case E_DEPOT:
2112  hTriggerDepot->Fill(triggerType);
2113  fNdepot[triggerType+1]++;
2114  break;
2115  case E_TWOTR_GAMMA:
2116  hTriggerTwoTrGamma->Fill(triggerType);
2117  fNtwotrgamma[triggerType+1]++;
2118  break;
2119  case E_TWOTR_DELTA:
2120  hTriggerTwoTrDelta->Fill(triggerType);
2121  fNtwotrdelta[triggerType+1]++;
2122  break;
2123  case E_TWOTR_OTHER:
2124  hTriggerTwoTrOther->Fill(triggerType);
2125  fNtwotrother[triggerType+1]++;
2126  break;
2127  default:
2128  break;
2129  }
2130 
2131  switch(eventTTZ){
2132 
2133  case E_TTZ:
2134  hTriggerTTZ->Fill(triggerType);
2135  fNtraversing[triggerType+1]++;
2136  break;
2137  default:
2138  break;
2139  }
2140  //mfile->Update();
2141 
2142 
2143 
2144 
2145  // Int_t kNtriggerTypes = 16;
2146 
2147  // TGraphErrors* gRate[kNtrackTypes];
2148  // Int_t triggerColors[kNtriggerTypes+1] = {kBlack,kGray,kWhite,kRed,kBlue,kGreen,kMagenta,kWhite,kRed,kBlue,kGreen,kMagenta,kCyan,kOrange,kWhite,kBlack,kWhite};
2149  // const char* triggerNames[kNtriggerTypes+1] = {"Unknown",
2150  // "Traversing Z",
2151  // "------",
2152  // "Gamma",
2153  // "No Mesh",
2154  // "Inv Mesh",
2155  // "No Up",
2156  // "------",
2157  // "Gamma, L",
2158  // "No Mesh, L",
2159  // "Inv Mesh, L",
2160  // "No Up, L",
2161  // "No PM, L",
2162  // "No L",
2163  // "------",
2164  // "Cosmic",
2165  // ""};
2166 
2167 }
2168 
2169 
2170 
2171 Double_t HarpoAnalyseBasic::TruncMean(TArrayD* vect, Double_t tl, Double_t th)
2172 {
2173  //
2174  // Calculates the truncated mean mean of the non zero value in vect
2175  // The truncation is done on the 100*tl% lowest and 100*(1-th) highest value
2176  //
2177  // debug(2,"truncated mean");
2178 
2179 
2180  Int_t size = vect->GetSize();
2181  Double_t truncMean = 0;
2182  Int_t* index = new Int_t[size];
2183  TMath::Sort(size,vect->GetArray(),index,kFALSE);
2184  Int_t t = 0, tLow, tHigh;
2185 
2186 
2187  while(vect->At(index[t])<10&&t<size-1) t++;
2188  tLow = TMath::FloorNint(t + (size - t)*tl);
2189  tHigh = TMath::FloorNint(t + (size - t)*th);
2190 
2191  for(Int_t tind = tLow; tind<tHigh; tind++) truncMean += vect->At(index[tind]);
2192  if(tHigh-tLow) {
2193  return truncMean/(tHigh-tLow);
2194  }
2195  else return 0;
2196 }
2197 
2198 void HarpoAnalyseBasic::Save(char * /* mode */)
2199 {
2200 
2201  OpenHistFile("basic");
2202 
2203  alignmentx->Write();
2204  alignmenty->Write();
2205  h1_NEvent->Write();
2206  h1_TimeSt->Write();
2207  helen->Write();
2208  heprof->Write();
2209  hadc[0]->Write();
2210  hadc[1]->Write();
2211  // hpps->Write();
2212  htvse->Write();
2213  hramp->Write();
2214  htdiff->Write();
2215  htdiff2->Write();
2216 
2217  hPmm2->Write();
2218  hPmm2Missed->Write();
2219  hPmm2Triggered->Write();
2220  hPmm2Spectrum2D->Write();
2221  hPmm2Coincidence->Write();
2222 
2223  h1_tmin->Write();
2224  h1_tmax->Write();
2225  h1_xmin->Write();
2226  h1_xmax->Write();
2227  h1_ymin->Write();
2228  h1_ymax->Write();
2229  h1_dtime->Write();
2230  h1_Qassoc_time_x->Write();
2231  h1_Qassoc_time_y->Write();
2232 
2234  h1_Qpix_x->Write();
2235  h1_Q_time_x->Write();
2236  h1_Q_channel_x->Write();
2237 
2238  //clustering
2239  h1_QTcluster_x->Write();
2240  h1_QCcluster_x->Write();
2241  h1_SigTcluster_x->Write();
2242  h1_SigCcluster_x->Write();
2243  h1_WidthTcluster_x->Write();
2244  h1_WidthCcluster_x->Write();
2245  h1_IndexTcluster_x->Write();
2246  h1_IndexCcluster_x->Write();
2247  h1_MeanTcluster_x->Write();
2248  h1_MeanCcluster_x->Write();
2249  //Tracking
2250  h1_theta_x->Write();
2251  h1_rho_x->Write();
2252  h1_sigtheta_x->Write();
2253  h1_sigrho_x->Write();
2254  h1_QcAssoc_x->Write();
2255  h1_QcNAssoc_x->Write();
2256  h1_QtAssoc_x->Write();
2257  h1_QtNAssoc_x->Write();
2258  h1_TypeTrack_x->Write();
2259  h1_angleTrack_x->Write();
2261 
2262  h1_Qpix_y->Write();
2263  h1_Q_time_y->Write();
2264  h1_Q_channel_y->Write();
2265 
2266  //clustering
2267  h1_QTcluster_y->Write();
2268  h1_QCcluster_y->Write();
2269 
2270  h1_SigTcluster_y->Write();
2271  h1_SigCcluster_y->Write();
2272  h1_WidthTcluster_y->Write();
2273  h1_WidthCcluster_y->Write();
2274  h1_IndexTcluster_y->Write();
2275  h1_IndexCcluster_y->Write();
2276  h1_MeanTcluster_y->Write();
2277  h1_MeanCcluster_y->Write();
2278  //Tracking
2279  h1_theta_y->Write();
2280  h1_rho_y->Write();
2281  h1_sigtheta_y->Write();
2282  h1_sigrho_y->Write();
2283  h1_QcAssoc_y->Write();
2284  h1_QcNAssoc_y->Write();
2285  h1_QtAssoc_y->Write();
2286  h1_QtNAssoc_y->Write();
2287  h1_TypeTrack_y->Write();
2288  h1_angleTrack_y->Write();
2289 
2290  h2_distortion_dc_t_x->Write();
2291  h2_distortion_dc_c_x->Write();
2292  h2_distortion_dt_t_x->Write();
2293  h2_distortion_dt_c_x->Write();
2294  h1_distortion_dt_x->Write();
2295  h1_distortion_dc_x->Write();
2296 
2297  h2_distortion_dc_t_y->Write();
2298  h2_distortion_dc_c_y->Write();
2299  h2_distortion_dt_t_y->Write();
2300  h2_distortion_dt_c_y->Write();
2301  h1_distortion_dt_y->Write();
2302  h1_distortion_dc_y->Write();
2303 
2304  h1_QtAssocN_x->Write();
2305  // h1_QtAssocN_time_x->Scale(1./fNormTTz);
2306  h1_QtAssocN_time_x->Scale(1./fNormTTzX);
2307  h1_QtAssocN_time_x->Write();
2308  h1_QtAssocN_y->Write();
2309  // h1_QtAssocN_time_y->Scale(1./fNormTTz);
2310  h1_QtAssocN_time_y->Scale(1./fNormTTzY);
2311  h1_QtAssocN_time_y->Write();
2312  h1_QtAssocN_channel_x->Write();
2313  h1_QtAssocN_channel_y->Write();
2314 
2315 
2316  // cout<<" fNormTTzX:"<<fNormTTzX<<" fNormTTzY:"<<fNormTTzY<<endl;
2317  hTriggerCreated->Write();
2318  hTriggerEmpty->Write();
2319  hTriggerTraversing->Write();
2320  hTriggerShower->Write();
2321  hTriggerOther->Write();
2322 
2323  hTriggerContained->Write();
2324  hTriggerDepot->Write();
2325  hTriggerTwoTrGamma->Write();
2326  hTriggerTwoTrDelta->Write();
2327  hTriggerTwoTrOther->Write();
2328  hTriggerTTZ->Write();
2329 
2330  hTriggerType->Write();
2331  h2_QtAssocN_time_x->Write();
2332  h2_QtAssocN_time_y->Write();
2333 
2334  h2_prof_dc_t_x->Write();
2335  h2_prof_dc_c_x->Write();
2336  h2_prof_dt_t_x->Write();
2337  h2_prof_dt_c_x->Write();
2338  h2_prof_dc_t_y->Write();
2339  h2_prof_dc_c_y->Write();
2340  h2_prof_dt_t_y->Write();
2341  h2_prof_dt_c_y->Write();
2342  h2_Qprof_x->Write();
2343  h2_Qprof_y->Write();
2344 
2345  h1zxd->Write();
2346  h1zyd->Write();
2347  h1xd->Write();
2348  h1yd->Write();
2349  h2xz->Write();
2350  h2yz->Write();
2351 
2352  h2xzn->Write();
2353  h2yzn->Write();
2354  h2xyn->Write();
2355  h1Doca->Write();
2356  h1Poca_x->Write();
2357  h1Poca_y->Write();
2358  h1Poca_z->Write();
2359  h2Poca_xy->Write();
2360  h2Poca_xz->Write();
2361  h2Poca_yz->Write();
2362  h1Px->Write();
2363  h1Py->Write();
2364  h1Pz->Write();
2365  h2Pxy->Write();
2366  h2Pxz->Write();
2367  h2Pyz->Write();
2368  h1Azimutal->Write();
2369  h1AOpen->Write();
2370  h1NTrackX->Write();
2371  h1NTrackY->Write();
2372  h1NClusterX->Write();
2373  h1NClusterY->Write();
2374  h1NClusterNX->Write();
2375  h1NClusterNY->Write();
2376 
2377 
2378  h1x3d->Write();
2379  h1y3d->Write();
2380  h1zx3d->Write();
2381  h1zy3d->Write();
2382  h2xz3n->Write();
2383  h2yz3n->Write();
2384  h2xy3n->Write();
2385 
2386  h1_sigrho_gamma_x->Write();
2387  h1_sigrho_gamma_y->Write();
2388  h1_sigrho_TTZ_x->Write();
2389  h1_sigrho_TTZ_y->Write();
2390 
2391  h1NTrackXTest->Write();
2392 
2393 
2394  h1_vertex_tr1->Write();
2395  h1_vertex_tr2->Write();
2396  h2_vertex->Write();
2397 
2398 }
2399 
2400 
2401 
2402 
2403 
2404 
2405 
2406 
2407 
2408 
Double_t GetPz()
Dcc Plane Y.
Definition: HarpoDet.h:20
Double_t GetAazimutal()
Double_t GetMean()
TClonesArray * GetHoughTracksArray()
Double_t GetData(Int_t i, Int_t j)
Set/Get Data Cell.
Definition: HarpoDccMap.cxx:84
const int MaxTime
Bool_t isExist(ULong_t det)
Detecror date exist //! Number of Real Detectors.
Definition: HarpoDetSet.h:33
Double_t GetAngleTrack()
Double_t GetPy()
Object containing the reconstruction information for one event (with array of HarpoRecoClusters Harpo...
Matching object, containing matched track number, and quality info.
UInt_t eventSize
Raw Event size.
Definition: HarpoDetEvent.h:28
TClonesArray * GetMatchingArray()
Double_t GetDoca()
virtual void print()
FullEvent Header not scecific to the detectors The class is ....
Int_t GetTriggerType()
Definition: Pmm2Event.h:29
Bool_t isSim()
Definition: HarpoDetSet.h:41
void Save(char *mode=NULL)
void print()
Ovreloaded medod whic do all job.
virtual void print()
Cluster object, containing position, charge and quality information.
Double_t GetAopen()
static int type
unpacked dcc data The class contains the data map for DCC or Feminos The data is stored as a 2D TMatr...
Definition: HarpoDccMap.h:29
Pmm2MesVect * GetMesurements()
Return pointer to decoded data.
Definition: Pmm2Event.cxx:78
Int_t GetIdClusterTrack()
#define NADC
Definition: HarpoDccMap.h:18
Double_t GetPoca_x()
TDirectory * OpenHistFile(Int_t run, const char *dir, const char *extra="", Int_t update=0)
Definition: HarpoTools.cxx:55
Long64_t gHarpoDebug
Definition: HarpoDebug.cxx:9
Bool_t Lookup(const char *path, Bool_t &val)
Lookup function for scalar values.
A class store HARPO raw PMM2 event buffer and header. End provide access metods to the row data...
Definition: Pmm2Event.h:19
Double_t GetPoca_z()
const ULong_t tmax
virtual const EventHeader_t * GetHeader() const
Definition: HarpoDetEvent.h:38
void FillHistograms()
Redefine empty default.
Double_t TruncMean(TArrayD *vect, Double_t tl, Double_t th)
Int_t getChNum() const
Definition: Pmm2Mes.h:28
Basic HARPO Event Analysis code. "Offline monitoring".
const ULong_t gkNDetectors
Definition: HarpoDet.h:14
TClonesArray * GetReco3DArray()
Double_t GetPoca_y()
HarpoConfig * gHConfig
A list of all mesurements in one Event for Pmm2 v2 card The class is place holder for all unpacked me...
Definition: Pmm2MesList.h:19
Pmm2Mes at(ULong_t idx)
Definition: Pmm2MesList.h:37
HarpoRecoTracks object, obtained with Hough tracking method.
TClonesArray * GetClustersArray()
R__EXTERN HarpoDetSet * gHDetSet
Definition: HarpoDetSet.h:71
UInt_t eventNumb
Event number in run.
Definition: HarpoDetEvent.h:29
Double_t GetPx()