AliPhysics  6cf2591 (6cf2591)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnaCalorimeterQA.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 // --- ROOT system ---
17 #include <TObjArray.h>
18 #include <TParticle.h>
19 #include <TDatabasePDG.h>
20 #include <TH3F.h>
21 #include <TObjString.h>
22 
23 //---- AliRoot system ----
24 #include "AliAnaCalorimeterQA.h"
25 #include "AliCaloTrackReader.h"
26 #include "AliStack.h"
27 #include "AliVCaloCells.h"
28 #include "AliFiducialCut.h"
29 #include "AliVCluster.h"
30 #include "AliVTrack.h"
31 #include "AliVEvent.h"
32 #include "AliVEventHandler.h"
33 #include "AliAODMCParticle.h"
34 #include "AliMCAnalysisUtils.h"
35 
36 // --- Detectors ---
37 #include "AliPHOSGeoUtils.h"
38 #include "AliEMCALGeometry.h"
39 
43 
44 //__________________________________________
46 //__________________________________________
49 
50 // Switches
51 fFillAllCellTimeHisto(kTRUE),
52 fFillAllPosHisto(kFALSE), fFillAllPosHisto2(kFALSE),
53 fFillAllTH3(kFALSE),
54 fFillAllTMHisto(kTRUE),
55 fFillAllPi0Histo(kTRUE), fFillInvMassOpenAngle(kFALSE),
56 fFillPi0PairDiffTime(kFALSE), fFillInvMassInEMCALWithPHOSDCalAcc(kFALSE),
57 fFillEBinAcceptanceHisto(kFALSE),
58 fCorrelate(kTRUE), fStudyBadClusters(kFALSE),
59 fStudyClustersAsymmetry(kFALSE), fStudyExotic(kFALSE),
60 fStudyWeight(kFALSE),
61 fStudyFECCorrelation(kFALSE), fStudyTCardCorrelation(kFALSE),
62 fStudyM02Dependence (kFALSE),
63 
64 // Parameters and cuts
65 fNModules(12), fNRCU(2),
66 fNMaxCols(48), fNMaxRows(24),
67 fTimeCutMin(-10000), fTimeCutMax(10000),
68 fCellAmpMin(0),
69 fEMCALCellAmpMin(0), fPHOSCellAmpMin(0),
70 fEMCALClusterM02Min(0),
71 fEMCALClusterNCellMin(0), fPHOSClusterNCellMin(0),
72 fNEBinCuts(0),
73 
74 // Invariant mass
75 fInvMassMinECut(0), fInvMassMaxECut(0),
76 fInvMassMinM02Cut(0), fInvMassMaxM02Cut(0),
77 fInvMassMaxOpenAngle(0), fInvMassMaxTimeDifference(0),
78 
79 // Exotic
80 fExoNECrossCuts(0), fExoECrossCuts(),
81 fExoNDTimeCuts(0), fExoDTimeCuts(),
82 
83 fClusterMomentum(), fClusterMomentum2(),
84 fPrimaryMomentum(),
85 fConstantTimeShift(0),
86 // Histograms
87 fhE(0), fhPt(0),
88 fhPhi(0), fhEta(0),
89 fhEtaPhi(0), fhEtaPhiE(0),
90 fhECharged(0), fhPtCharged(0),
91 fhPhiCharged(0), fhEtaCharged(0),
92 fhEtaPhiCharged(0), fhEtaPhiECharged(0),
93 
94 // Invariant mass
95 fhIM(0), fhIMSame(0), fhIMDiff(0),
96 fhIMDCAL(0), fhIMDCALSame(0), fhIMDCALDiff(0),
97 fhIMDCALPHOS(0), fhIMDCALPHOSSame(0),
98 fhIMEMCALPHOS(0), fhIMEMCALPHOSSame(0),
99 fhAsym(0),
100 fhOpAngle(0), fhIMvsOpAngle(0),
101 fhNCellsPerCluster(0), fhNCellsPerClusterNoCut(0),
102 fhNCellsPerClusterWithWeight(0), fhNCellsPerClusterRatioWithWeight(0),
103 fhNClusters(0),
104 
105 // Timing
106 fhClusterTimeEnergy(0), fhCellTimeSpreadRespectToCellMax(0),
107 fhCellIdCellLargeTimeSpread(0), fhClusterPairDiffTimeE(0), fhClusterPairDiffTimeESameMod(0),
108 fhClusterMaxCellCloseCellRatio(0), fhClusterMaxCellCloseCellDiff(0),
109 fhClusterMaxCellDiff(0), fhClusterMaxCellDiffNoCut(0),
110 //fhClusterMaxCellDiffAverageTime(0), fhClusterMaxCellDiffWeightedTime(0),
111 fhClusterMaxCellECross(0),
112 fhLambda0(0), fhLambda1(0),
113 fhLambda0MaxFECPair(0), fhLambda1MaxFECPair(0),
114 fhLambda0MaxFECOdd(0), fhLambda1MaxFECOdd(0),
115 fhLambda0Max2FECPair(0), fhLambda1Max2FECPair(0),
116 fhLambda0Max2FECOdd(0), fhLambda1Max2FECOdd(0),
117 fhLambda0MaxFECPairLargeNCells(0), fhLambda1MaxFECPairLargeNCells(0),
118 fhLambda0MaxFECOddLargeNCells(0), fhLambda1MaxFECOddLargeNCells(0),
119 fhLambda0Max2FECPairLargeNCells(0), fhLambda1Max2FECPairLargeNCells(0),
120 fhLambda0Max2FECOddLargeNCells(0), fhLambda1Max2FECOddLargeNCells(0),
121 
122 // fhDispersion(0),
123 fhEtaPhiFECCorrControl(0),
124 fhEtaPhiTCardCorrNoSelection(0), fhLambda0TCardCorrNoSelection(0),
125 fhNCellsTCardCorrNoSelection(0), fhNCellsTCardCorrWithWeightNoSelection(0), fhNCellsTCardCorrRatioWithWeightNoSelection(0),
126 // bad clusters
127 fhBadClusterEnergy(0), fhBadClusterTimeEnergy(0), fhBadClusterEtaPhi(0),
128 fhBadClusterPairDiffTimeE(0), fhBadCellTimeSpreadRespectToCellMax(0),
129 fhBadClusterMaxCellCloseCellRatio(0), fhBadClusterMaxCellCloseCellDiff(0), fhBadClusterMaxCellDiff(0),
130 fhBadClusterMaxCellDiffAverageTime(0), fhBadClusterMaxCellDiffWeightedTime(0),
131 fhBadClusterMaxCellECross(0),
132 fhBadClusterLambda0(0), fhBadClusterLambda1(0),
133 fhBadClusterDeltaIEtaDeltaIPhiE0(0), fhBadClusterDeltaIEtaDeltaIPhiE2(0),
134 fhBadClusterDeltaIEtaDeltaIPhiE6(0), fhBadClusterDeltaIA(0),
135 
136 // Position
137 fhRNCells(0), fhXNCells(0),
138 fhYNCells(0), fhZNCells(0),
139 fhRE(0), fhXE(0),
140 fhYE(0), fhZE(0),
141 fhXYZ(0),
142 fhRCellE(0), fhXCellE(0),
143 fhYCellE(0), fhZCellE(0),
144 fhXYZCell(0),
145 fhDeltaCellClusterRNCells(0), fhDeltaCellClusterXNCells(0),
146 fhDeltaCellClusterYNCells(0), fhDeltaCellClusterZNCells(0),
147 fhDeltaCellClusterRE(0), fhDeltaCellClusterXE(0),
148 fhDeltaCellClusterYE(0), fhDeltaCellClusterZE(0),
149 
150 // Cells
151 fhNCells(0), fhNCellsCutAmpMin(0),
152 fhAmplitude(0), fhAmpId(0),
153 fhEtaPhiAmpCell(0), fhEtaPhiCell(0),
154 fhTime(0), //fhTimeVz(0),
155 fhTimeId(0), fhTimeAmp(0),
156 fhAmpIdLowGain(0), fhTimeIdLowGain(0), fhTimeAmpLowGain(0),
157 
158 fhCellECross(0),
159 
160 fhEMCALPHOSCorrNClusters(0), fhEMCALPHOSCorrEClusters(0),
161 fhEMCALPHOSCorrNCells(0), fhEMCALPHOSCorrECells(0),
162 fhEMCALDCALCorrNClusters(0), fhEMCALDCALCorrEClusters(0),
163 fhEMCALDCALCorrNCells(0), fhEMCALDCALCorrECells(0),
164 fhDCALPHOSCorrNClusters(0), fhDCALPHOSCorrEClusters(0),
165 fhDCALPHOSCorrNCells(0), fhDCALPHOSCorrECells(0),
166 fhCaloV0SCorrNClusters(0), fhCaloV0SCorrEClusters(0),
167 fhCaloV0SCorrNCells(0), fhCaloV0SCorrECells(0),
168 fhCaloV0MCorrNClusters(0), fhCaloV0MCorrEClusters(0),
169 fhCaloV0MCorrNCells(0), fhCaloV0MCorrECells(0),
170 fhCaloTrackMCorrNClusters(0), fhCaloTrackMCorrEClusters(0),
171 fhCaloTrackMCorrNCells(0), fhCaloTrackMCorrECells(0),
172 fhCaloCenNClusters(0), fhCaloCenEClusters(0),
173 fhCaloCenNCells(0), fhCaloCenECells(0),
174 fhCaloEvPNClusters(0), fhCaloEvPEClusters(0),
175 fhCaloEvPNCells(0), fhCaloEvPECells(0),
176 
177 // Super-Module dependent histograms
178 fhEMod(0), fhAmpMod(0),
179 fhEWeirdMod(0), fhAmpWeirdMod(0),
180 fhTimeMod(0),
181 fhNClustersMod(0), fhNCellsMod(0),
182 fhNCellsSumAmpPerMod(0), fhNClustersSumEnergyPerMod(0),
183 fhNCellsPerClusterMod(0), fhNCellsPerClusterModNoCut(0),
184 fhNCellsPerClusterWeirdMod(0), fhNCellsPerClusterWeirdModNoCut(0),
185 
186 fhGridCells(0), fhGridCellsE(0), fhGridCellsTime(0),
187 fhGridCellsLowGain(0), fhGridCellsELowGain(0), fhGridCellsTimeLowGain(0),
188 fhTimeAmpPerRCU(0), fhIMMod(0),
189 
190 // Weight studies
191 fhECellClusterRatio(0), fhECellClusterLogRatio(0),
192 fhEMaxCellClusterRatio(0), fhEMaxCellClusterLogRatio(0),
193 fhECellTotalRatio(0), fhECellTotalLogRatio(0),
194 fhECellTotalRatioMod(0), fhECellTotalLogRatioMod(0),
195 
196 fhExoL0ECross(0), fhExoL1ECross(0),
197 
198 // MC and reco
199 fhRecoMCE(), fhRecoMCPhi(), fhRecoMCEta(),
200 fhRecoMCDeltaE(), fhRecoMCRatioE(),
201 fhRecoMCDeltaPhi(), fhRecoMCDeltaEta(),
202 
203 // MC only
204 fhGenMCE(), fhGenMCPt(), fhGenMCEtaPhi(),
205 fhGenMCAccE(), fhGenMCAccPt(), fhGenMCAccEtaPhi(),
206 
207 // Matched MC
208 fhEMVxyz(0), fhEMR(0),
209 fhHaVxyz(0), fhHaR(0),
210 fh1EOverP(0), fh2dR(0),
211 fh2EledEdx(0), fh2MatchdEdx(0),
212 fh1EOverPR02(0), fh1EleEOverP(0),
213 fhMCEle1EOverP(0), fhMCEle1dR(0), fhMCEle2MatchdEdx(0),
214 fhMCChHad1EOverP(0), fhMCChHad1dR(0), fhMCChHad2MatchdEdx(0),
215 fhMCNeutral1EOverP(0), fhMCNeutral1dR(0), fhMCNeutral2MatchdEdx(0),
216 fhMCEle1EOverPR02(0), fhMCChHad1EOverPR02(0), fhMCNeutral1EOverPR02(0),
217 fhMCEle1EleEOverP(0), fhMCChHad1EleEOverP(0), fhMCNeutral1EleEOverP(0),
218 fhTrackMatchedDEtaNeg(0), fhTrackMatchedDPhiNeg(0), fhTrackMatchedDEtaDPhiNeg(0),
219 fhTrackMatchedDEtaPos(0), fhTrackMatchedDPhiPos(0), fhTrackMatchedDEtaDPhiPos(0),
220 fhTrackMatchedDEtaNegMod(0), fhTrackMatchedDPhiNegMod(0),
221 fhTrackMatchedDEtaPosMod(0), fhTrackMatchedDPhiPosMod(0),
222 fhClusterTimeEnergyM02(0), fhCellTimeSpreadRespectToCellMaxM02(0),
223 fhClusterMaxCellCloseCellRatioM02(0), fhClusterMaxCellCloseCellDiffM02(0),
224 fhClusterMaxCellDiffM02(0), fhClusterMaxCellECrossM02(0), fhNCellsPerClusterM02(0)
225 {
226  // Weight studies
227  for(Int_t i =0; i < 12; i++)
228  {
229  for(Int_t j = 0; j < 4; j++)
230  {
231  for(Int_t k = 0; k < 3; k++)
232  {
233  fhLambda0ForW0AndCellCuts [i][j][k] = 0;
234 // fhLambda1ForW0AndCellCuts [i][j][k] = 0;
235  fhLambda0ForW0AndCellCutsEta0[i][j][k] = 0;
236  }
237  }
238  for(Int_t j = 0; j < 5; j++)
239  {
240  fhLambda0ForW0MC[i][j] = 0;
241 // fhLambda1ForW0MC[i][j] = 0;
242  }
243  }
244 
245  // Cluster size
248  fhDeltaIA[0] = 0 ; fhDeltaIAL0[0] = 0; fhDeltaIAL1[0] = 0;
249  fhDeltaIA[1] = 0 ; fhDeltaIAL0[1] = 0; fhDeltaIAL1[1] = 0;
250  fhDeltaIANCells[0] = 0 ; fhDeltaIANCells[1] = 0;
251  fhDeltaIAMC[0] = 0 ; fhDeltaIAMC[1] = 0;
252  fhDeltaIAMC[2] = 0 ; fhDeltaIAMC[3] = 0;
253 
254  // Exotic
255  for (Int_t ie = 0; ie < 10 ; ie++)
256  {
257  fhExoDTime[ie] = 0;
258  for (Int_t idt = 0; idt < 5 ; idt++)
259  {
260  fhExoNCell [ie][idt] = 0;
261  fhExoL0 [ie][idt] = 0;
262  fhExoL1 [ie][idt] = 0;
263  fhExoECross [ie][idt] = 0;
264  fhExoTime [ie][idt] = 0;
265  fhExoL0NCell [ie][idt] = 0;
266  fhExoL1NCell [ie][idt] = 0;
267  }
268  }
269 
270  // MC
271 
272  for(Int_t i = 0; i < 7; i++)
273  {
274  fhRecoMCE[i][0] = 0; fhRecoMCE[i][1] = 0;
275  fhRecoMCPhi[i][0] = 0; fhRecoMCPhi[i][1] = 0;
276  fhRecoMCEta[i][0] = 0; fhRecoMCEta[i][1] = 0;
277  fhRecoMCDeltaE[i][0] = 0; fhRecoMCDeltaE[i][1] = 0;
278  fhRecoMCRatioE[i][0] = 0; fhRecoMCRatioE[i][1] = 0;
279  fhRecoMCDeltaPhi[i][0] = 0; fhRecoMCDeltaPhi[i][1] = 0;
280  fhRecoMCDeltaEta[i][0] = 0; fhRecoMCDeltaEta[i][1] = 0;
281  }
282 
283  for(Int_t i = 0; i < 4; i++)
284  {
285  fhGenMCE[i] = 0;
286  fhGenMCPt[i] = 0;
287  fhGenMCEtaPhi[i] = 0;
288  fhGenMCAccE[i] = 0;
289  fhGenMCAccPt[i] = 0;
290  fhGenMCAccEtaPhi[i] = 0;
291  }
292 
293  for(Int_t i = 0; i < 14; i++)
294  {
295  fhEBinClusterEtaPhi[i] = 0 ;
296  fhEBinClusterColRow[i] = 0 ;
297  fhEBinCellColRow [i] = 0 ;
298  }
299 
300  for(Int_t bc = 0; bc < 4; bc++) fhTimePerSMPerBC[bc] = 0 ;
301 
302  for(Int_t i = 0; i < 6; i++)
303  {
304  fhLambda0FECCorrel [i] = 0 ;
305  fhLambda1FECCorrel [i] = 0 ;
308  fhLambda0TCardCorrelN[i] = 0 ;
309  fhNCellsTCardCorrelN [i] = 0 ;
311  fhNCellsTCardCorrelNExotic [i] = 0 ;
313  fhNCellsTCardCorrelNearRow [i] = 0 ;
314  }
315  for(Int_t i = 0; i < 4; i++)
316  {
317  fhLambda0MaxFECCorrel[i] = 0 ;
318  fhLambda1MaxFECCorrel[i] = 0 ;
322  fhNCellsTCardCorrel2ndMax [i] = 0 ;
324  fhNCellsTCardCorrelExotic [i] = 0 ;
325  }
326 
327  for(Int_t i = 0; i < 7; i++)
328  {
329  fhLambda0TCardCorrel[i] = 0 ;
330  fhNCellsTCardCorrel [i] = 0 ;
333  }
334 
335  for(Int_t i = 0; i < 12; i++)
336  {
337  fhTCardCorrECellMaxDiff[i] = 0 ;
338  fhTCardCorrEClusterDiff[i] = 0 ;
339  fhTCardCorrECellMaxRat [i] = 0 ;
340  fhTCardCorrEClusterRat [i] = 0 ;
341  fhTCardCorrTCellMaxDiff[i] = 0 ;
342  }
343 
344  InitParameters();
345 }
346 
347 //______________________________________________________________________________________________________________________
357 //______________________________________________________________________________________________________________________
358 void AliAnaCalorimeterQA::BadClusterHistograms(AliVCluster* clus, const TObjArray *caloClusters, AliVCaloCells * cells,
359  Int_t absIdMax, Double_t maxCellFraction, Float_t eCrossFrac,
360  Double_t tmax)
361 {
362  // printf("AliAnaCalorimeterQA::BadClusterHistograms() - Event %d - Calorimeter %s \n \t E %f, n cells %d, max cell absId %d, maxCellFrac %f\n",
363  // GetReader()->GetEventNumber(), GetCalorimeterString().Data(),
364  // clus->E(),clus->GetNCells(),absIdMax,maxCellFraction);
365 
366  Double_t tof = clus->GetTOF()*1.e9;
367  if(tof > 400) tof-=fConstantTimeShift;
368 
369  Float_t energy = clus->E();
370 
371  fhBadClusterEnergy ->Fill(energy, GetEventWeight());
372  fhBadClusterTimeEnergy ->Fill(energy, tof , GetEventWeight());
373  fhBadClusterMaxCellDiff ->Fill(energy, maxCellFraction, GetEventWeight());
374  fhBadClusterMaxCellECross->Fill(energy, eCrossFrac , GetEventWeight());
375 
376  Float_t phi = fClusterMomentum.Phi();
377  if(phi < 0) phi += TMath::TwoPi();
378 
379  if(energy > 0.5) fhBadClusterEtaPhi->Fill(fClusterMomentum.Eta(), phi, GetEventWeight());
380 
381  fhBadClusterLambda0->Fill(energy, clus->GetM02());
382  fhBadClusterLambda1->Fill(energy, clus->GetM20());
383 
384  if(fStudyClustersAsymmetry) ClusterAsymmetryHistograms(clus,absIdMax,kFALSE);
385 
386  // Clusters in event time difference bad minus good
387 
388  for(Int_t iclus2 = 0; iclus2 < caloClusters->GetEntriesFast(); iclus2++ )
389  {
390  AliVCluster* clus2 = (AliVCluster*) caloClusters->At(iclus2);
391 
392  if(clus->GetID() == clus2->GetID()) continue;
393 
394  Float_t maxCellFraction2 = 0.;
395  Int_t absIdMax2 = GetCaloUtils()->GetMaxEnergyCell(cells, clus2,maxCellFraction2);
396 
397  if(IsGoodCluster(absIdMax2, clus->GetM02(), clus->GetNCells(), cells) && clus2->GetM02() > 0.1 )
398  {
399  Double_t tof2 = clus2->GetTOF()*1.e9;
400  if(tof2>400) tof2-=fConstantTimeShift;
401 
402  fhBadClusterPairDiffTimeE ->Fill(clus->E(), (tof-tof2), GetEventWeight());
403  }
404  } // loop
405 
406  // Max cell compared to other cells in cluster
408  {
409  // Get some time averages
410  Double_t timeAverages[2] = {0.,0.};
411  CalculateAverageTime(clus, cells, timeAverages);
412 
413  fhBadClusterMaxCellDiffAverageTime ->Fill(clus->E(), tmax-timeAverages[0], GetEventWeight());
414  fhBadClusterMaxCellDiffWeightedTime->Fill(clus->E(), tmax-timeAverages[1], GetEventWeight());
415  }
416 
417  for (Int_t ipos = 0; ipos < clus->GetNCells(); ipos++)
418  {
419  Int_t absId = clus->GetCellsAbsId()[ipos];
420  if(absId!=absIdMax && cells->GetCellAmplitude(absIdMax) > 0.01)
421  {
422  Float_t frac = cells->GetCellAmplitude(absId)/cells->GetCellAmplitude(absIdMax);
423 
424  fhBadClusterMaxCellCloseCellRatio->Fill(clus->E(), frac, GetEventWeight());
425  fhBadClusterMaxCellCloseCellDiff ->Fill(clus->E(), cells->GetCellAmplitude(absIdMax)-cells->GetCellAmplitude(absId), GetEventWeight());
426 
428  {
429  Double_t time = cells->GetCellTime(absId);
430  GetCaloUtils()->RecalibrateCellTime(time, GetCalorimeter(), absId,GetReader()->GetInputEvent()->GetBunchCrossNumber());
431 
432  Float_t diff = (tmax-(time*1e9-fConstantTimeShift));
433  fhBadCellTimeSpreadRespectToCellMax->Fill(clus->E(), diff, GetEventWeight());
434 
435  }
436  } // Not max
437  } // loop
438 }
439 
440 //______________________________________________________________________
445 //______________________________________________________________________
447  AliVCaloCells* cells,
448  Double_t timeAverages[2])
449 {
450  // First recalculate energy in case non linearity was applied
451  Float_t energy = 0;
452  Float_t ampMax = 0, amp = 0;
453 //Int_t absIdMax = -1;
454 
455  for (Int_t ipos = 0; ipos < clus->GetNCells(); ipos++)
456  {
457  Int_t id = clus->GetCellsAbsId()[ipos];
458 
459  // Recalibrate cell energy if needed
460  amp = cells->GetCellAmplitude(id);
462 
463  energy += amp;
464 
465  if(amp> ampMax)
466  {
467  ampMax = amp;
468 // absIdMax = id;
469  }
470  } // energy loop
471 
472  // Calculate average time of cells in cluster and weighted average
473  Double_t aTime = 0;
474  Double_t wTime = 0;
475  Float_t wTot = 0;
476  Double_t time = 0;
477  Int_t id =-1;
478  Double_t w = 0;
479  Int_t ncells = clus->GetNCells();
480 
481  for (Int_t ipos = 0; ipos < ncells; ipos++)
482  {
483  id = clus ->GetCellsAbsId()[ipos];
484  amp = cells->GetCellAmplitude(id);
485  time = cells->GetCellTime(id);
486 
487  // Recalibrate energy and time
489  GetCaloUtils()->RecalibrateCellTime (time, GetCalorimeter(), id, GetReader()->GetInputEvent()->GetBunchCrossNumber());
490 
491  w = GetCaloUtils()->GetEMCALRecoUtils()->GetCellWeight(cells->GetCellAmplitude(id),energy);
492  aTime += time*1e9;
493  wTime += time*1e9 * w;
494  wTot += w;
495  }
496 
497  if(ncells > 0) aTime /= ncells;
498  else aTime = 0;
499 
500  if(wTot > 0) wTime /= wTot;
501  else wTime = 0;
502 
503  timeAverages[0] = aTime;
504  timeAverages[1] = wTime;
505 }
506 
507 //____________________________________________________________
509 //____________________________________________________________
510 void AliAnaCalorimeterQA::CellHistograms(AliVCaloCells *cells)
511 {
512  Int_t ncells = cells->GetNumberOfCells();
513  if( ncells > 0 ) fhNCells->Fill(ncells, GetEventWeight()) ; // Not ok for PHOS with CPV
514 
515  Int_t ncellsCut = 0;
516  Float_t ecellsCut = 0;
517 
518  AliDebug(1,Form("%s cell entries %d", GetCalorimeterString().Data(), ncells));
519 
520  // Init arrays and used variables
521  Int_t *nCellsInModule = new Int_t [fNModules];
522  Float_t *eCellsInModule = new Float_t[fNModules];
523 
524  for(Int_t imod = 0; imod < fNModules; imod++ )
525  {
526  nCellsInModule[imod] = 0 ;
527  eCellsInModule[imod] = 0.;
528  }
529 
530  Int_t icol = -1, icolAbs = -1;
531  Int_t irow = -1, irowAbs = -1;
532  Int_t iRCU = -1;
533  Float_t amp = 0.;
534  Double_t time = 0.;
535  Int_t id = -1;
536  Bool_t highG = kFALSE;
537  Float_t recalF = 1.;
538  Int_t bc = GetReader()->GetInputEvent()->GetBunchCrossNumber();
539 
540  for (Int_t iCell = 0; iCell < cells->GetNumberOfCells(); iCell++)
541  {
542  if ( cells->GetCellNumber(iCell) < 0 ) continue; // CPV
543 
544  AliDebug(2,Form("Cell : amp %f, absId %d", cells->GetAmplitude(iCell), cells->GetCellNumber(iCell)));
545 
546  Int_t nModule = GetModuleNumberCellIndexesAbsCaloMap(cells->GetCellNumber(iCell),GetCalorimeter(),
547  icol , irow, iRCU,
548  icolAbs, irowAbs );
549 
550  AliDebug(2,Form("\t module %d, column %d (%d), row %d (%d)", nModule,icolAbs,icol,irowAbs,irow));
551 
552  if(nModule < fNModules)
553  {
554  //Check if the cell is a bad channel
555  if(GetCaloUtils()->IsBadChannelsRemovalSwitchedOn())
556  {
557  if(GetCalorimeter()==kEMCAL)
558  {
559  if(GetCaloUtils()->GetEMCALChannelStatus(nModule,icol,irow)) continue;
560  }
561  else
562  {
563  if(GetCaloUtils()->GetPHOSChannelStatus(nModule,icol,irow) ) continue;
564  }
565  } // use bad channel map
566 
567  amp = cells->GetAmplitude(iCell)*recalF;
568  time = cells->GetTime(iCell);
569  id = cells->GetCellNumber(iCell);
570  highG = cells->GetCellHighGain(id);
571  if(IsDataMC()) highG = kTRUE; // MC does not distinguish High and Low, put them all in high
572 
573  // Amplitude recalibration if set
575 
576  // Time recalibration if set
577  GetCaloUtils()->RecalibrateCellTime (time, GetCalorimeter(), id, GetReader()->GetInputEvent()->GetBunchCrossNumber());
578 
579  // Transform time to ns
580  time *= 1.0e9;
581  time-=fConstantTimeShift;
582 
583  if(time < fTimeCutMin || time > fTimeCutMax)
584  {
585  AliDebug(1,Form("Remove cell with Time %f",time));
586  continue;
587  }
588 
589  // Remove exotic cells, defined only for EMCAL
590  if(GetCalorimeter()==kEMCAL &&
591  GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCell(id, cells, bc)) continue;
592 
593  fhAmplitude->Fill(amp, GetEventWeight());
594  fhAmpId ->Fill(amp, id , GetEventWeight());
595  fhAmpMod ->Fill(amp, nModule, GetEventWeight());
596  fhAmpWeirdMod->Fill(amp, nModule, GetEventWeight());
597  if(!highG) fhAmpIdLowGain->Fill(amp, id, GetEventWeight());
598 
600  {
601  for(Int_t ie = 0; ie < fNEBinCuts; ie++)
602  {
603  if( amp >= fEBinCuts[ie] && amp < fEBinCuts[ie+1] )
604  {
605  fhEBinCellColRow[ie]->Fill(icolAbs,irowAbs,GetEventWeight()) ;
606  }
607  }
608  }
609 
610  // E cross for exotic cells
611  if(amp > 0.05)
612  {
613  fhCellECross->Fill(amp, 1-GetECross(id,cells)/amp, GetEventWeight());
614  ecellsCut+=amp ;
615  if(fStudyWeight) eCellsInModule[nModule]+=amp ;
616  }
617 
618  if ( amp > fCellAmpMin )
619  {
620  ncellsCut++ ;
621  nCellsInModule[nModule]++ ;
622 
623  if(!fStudyWeight) eCellsInModule[nModule]+=amp ;
624 
625  fhGridCells ->Fill(icolAbs, irowAbs, GetEventWeight());
626  fhGridCellsE->Fill(icolAbs, irowAbs, amp );
627 
628  if(!highG)
629  {
630  fhGridCellsLowGain ->Fill(icolAbs, irowAbs, GetEventWeight());
631  fhGridCellsELowGain->Fill(icolAbs, irowAbs, amp );
632  }
633 
635  {
636  //printf("%s: time %g\n",GetCalorimeterString().Data(), time);
637 
638 // Double_t v[3] = {0,0,0}; //vertex ;
639 // GetReader()->GetVertex(v);
640 // if(amp > 0.5) fhTimeVz ->Fill(TMath::Abs(v[2]), time, GetEventWeight());
641 
642  fhTime ->Fill(time, GetEventWeight());
643  fhTimeId ->Fill(time, id , GetEventWeight());
644  fhTimeAmp->Fill(amp , time, GetEventWeight());
645 
646  Int_t bc = (GetReader()->GetInputEvent()->GetBunchCrossNumber())%4;
647  fhTimePerSMPerBC[bc]->Fill(time, nModule, GetEventWeight());
648 
649  fhGridCellsTime->Fill(icolAbs, irowAbs, time);
650  if(!highG) fhGridCellsTimeLowGain->Fill(icolAbs, irowAbs, time);
651 
652  fhTimeMod->Fill(time, nModule, GetEventWeight());
653  fhTimeAmpPerRCU[nModule*fNRCU+iRCU]->Fill(amp, time, GetEventWeight());
654 
655  if(!highG)
656  {
657  fhTimeIdLowGain ->Fill(time, id , GetEventWeight());
658  fhTimeAmpLowGain->Fill(amp , time, GetEventWeight());
659  }
660  }
661  }
662 
663  // Get Eta-Phi position of Cell
664  if(fFillAllPosHisto)
665  {
666  if ( GetCalorimeter() == kEMCAL && GetCaloUtils()->IsEMCALGeoMatrixSet() )
667  {
668  Float_t celleta = 0.;
669  Float_t cellphi = 0.;
670  GetEMCALGeometry()->EtaPhiFromIndex(id, celleta, cellphi);
671 
672  if ( cellphi < 0 ) cellphi+=TMath::TwoPi();
673 
674  if(fFillAllTH3)
675  fhEtaPhiAmpCell->Fill(celleta, cellphi, amp, GetEventWeight());
676  else
677  fhEtaPhiCell ->Fill(celleta, cellphi, GetEventWeight());
678 
679  Double_t cellpos[] = {0, 0, 0};
680  GetEMCALGeometry()->GetGlobal(id, cellpos);
681 
682  fhXCellE->Fill(cellpos[0], amp, GetEventWeight()) ;
683  fhYCellE->Fill(cellpos[1], amp, GetEventWeight()) ;
684  fhZCellE->Fill(cellpos[2], amp, GetEventWeight()) ;
685 
686  Float_t rcell = TMath::Sqrt(cellpos[0]*cellpos[0]+cellpos[1]*cellpos[1]);//+cellpos[2]*cellpos[2]);
687  fhRCellE ->Fill(rcell, amp, GetEventWeight()) ;
688 
689  fhXYZCell->Fill(cellpos[0], cellpos[1], cellpos[2], GetEventWeight()) ;
690  } // EMCAL Cells
691  else if ( GetCalorimeter() == kPHOS && GetCaloUtils()->IsPHOSGeoMatrixSet() )
692  {
693  TVector3 xyz;
694  Int_t relId[4], module;
695  Float_t xCell, zCell;
696 
697  GetPHOSGeometry()->AbsToRelNumbering(id,relId);
698  module = relId[0];
699  GetPHOSGeometry()->RelPosInModule(relId,xCell,zCell);
700  GetPHOSGeometry()->Local2Global(module,xCell,zCell,xyz);
701 
702  Float_t rcell = TMath::Sqrt(xyz.X()*xyz.X()+xyz.Y()*xyz.Y());
703 
704  fhXCellE ->Fill(xyz.X(), amp, GetEventWeight()) ;
705  fhYCellE ->Fill(xyz.Y(), amp, GetEventWeight()) ;
706  fhZCellE ->Fill(xyz.Z(), amp, GetEventWeight()) ;
707  fhRCellE ->Fill(rcell , amp, GetEventWeight()) ;
708 
709  fhXYZCell->Fill(xyz.X(), xyz.Y(), xyz.Z(), GetEventWeight()) ;
710  } // PHOS cells
711  } // Fill cell position histograms
712 
713  } // N modules
714  } // Cell loop
715 
716  // Fill the cells after the cut on min amplitude and bad/exotic channels
717  if( ncellsCut > 0 ) fhNCellsCutAmpMin->Fill(ncellsCut, GetEventWeight()) ;
718 
719  // Number of cells per module
720  for(Int_t imod = 0; imod < fNModules; imod++ )
721  {
722  AliDebug(1,Form("Module %d, calo %s, N cells %d, sum Amp %f", imod, GetCalorimeterString().Data(), nCellsInModule[imod], eCellsInModule[imod]));
723 
724  fhNCellsMod ->Fill(nCellsInModule[imod], imod, GetEventWeight()) ;
725  fhSumCellsAmpMod->Fill(eCellsInModule[imod], imod, GetEventWeight()) ;
726 
727  fhNCellsSumAmpPerMod[imod]->Fill(eCellsInModule[imod], nCellsInModule[imod], GetEventWeight());
728  }
729 
730  // Check energy distribution in calorimeter for selected cells
731  if(fStudyWeight)
732  {
733  for (Int_t iCell = 0; iCell < cells->GetNumberOfCells(); iCell++)
734  {
735  if ( cells->GetCellNumber(iCell) < 0 ) continue; // CPV
736 
737  AliDebug(2,Form("Cell : amp %f, absId %d", cells->GetAmplitude(iCell), cells->GetCellNumber(iCell)));
738 
739  Int_t nModule = GetModuleNumberCellIndexes(cells->GetCellNumber(iCell),GetCalorimeter(), icol, irow, iRCU);
740 
741  AliDebug(2,Form("\t module %d, column %d, row %d", nModule,icol,irow));
742 
743  if(nModule < fNModules)
744  {
745  //Check if the cell is a bad channel
746  if(GetCaloUtils()->IsBadChannelsRemovalSwitchedOn())
747  {
748  if(GetCalorimeter()==kEMCAL)
749  {
750  if(GetCaloUtils()->GetEMCALChannelStatus(nModule, icol, irow)) continue;
751  }
752  else
753  {
754  if(GetCaloUtils()->GetPHOSChannelStatus (nModule, icol, irow) ) continue;
755  }
756  } // use bad channel map
757 
758  amp = cells->GetAmplitude(iCell)*recalF;
759  time = cells->GetTime(iCell);
760  id = cells->GetCellNumber(iCell);
761 
762  // Amplitude recalibration if set
764 
765  // Time recalibration if set
767  GetReader()->GetInputEvent()->GetBunchCrossNumber());
768 
769  // Transform time to ns
770  time *= 1.0e9;
771  time -= fConstantTimeShift;
772 
773  if(time < fTimeCutMin || time > fTimeCutMax)
774  {
775  AliDebug(1,Form("Remove cell with Time %f",time));
776  continue;
777  }
778 
779  // Remove exotic cells, defined only for EMCAL
780  if(GetCalorimeter()==kEMCAL &&
781  GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCell(id, cells, bc)) continue;
782 
783  // E cross for exotic cells
784  if(amp > 0.05)
785  {
786  if(ecellsCut > 0)
787  {
788  Float_t ratio = amp/ecellsCut;
789  fhECellTotalRatio ->Fill(ecellsCut, ratio , GetEventWeight());
790  fhECellTotalLogRatio ->Fill(ecellsCut,TMath::Log(ratio), GetEventWeight());
791  }
792 
793  if(eCellsInModule[nModule] > 0)
794  {
795  Float_t ratioMod = amp/eCellsInModule[nModule];
796  fhECellTotalRatioMod [nModule]->Fill(eCellsInModule[nModule], ratioMod , GetEventWeight());
797  fhECellTotalLogRatioMod[nModule]->Fill(eCellsInModule[nModule],TMath::Log(ratioMod), GetEventWeight());
798  }
799  } // amp > 0.5
800  } // nMod > 0 < Max
801  } // cell loop
802  } // weight studies
803 
804  delete [] nCellsInModule;
805  delete [] eCellsInModule;
806 }
807 
808 //__________________________________________________________________________
810 //__________________________________________________________________________
812 {
813  Int_t nCaloCellsPerCluster = clus->GetNCells();
814 
815  UShort_t * indexList = clus->GetCellsAbsId();
816 
817  Float_t pos[3];
818  clus->GetPosition(pos);
819 
820  Float_t clEnergy = clus->E();
821 
822  // Loop on cluster cells
823  for (Int_t ipos = 0; ipos < nCaloCellsPerCluster; ipos++)
824  {
825  // printf("Index %d\n",ipos);
826  Int_t absId = indexList[ipos];
827 
828  //Get position of cell compare to cluster
829 
830  if ( GetCalorimeter() == kEMCAL && GetCaloUtils()->IsEMCALGeoMatrixSet() )
831  {
832  Double_t cellpos[] = {0, 0, 0};
833  GetEMCALGeometry()->GetGlobal(absId, cellpos);
834 
835  fhDeltaCellClusterXNCells->Fill(pos[0]-cellpos[0], nCaloCellsPerCluster, GetEventWeight()) ;
836  fhDeltaCellClusterYNCells->Fill(pos[1]-cellpos[1], nCaloCellsPerCluster, GetEventWeight()) ;
837  fhDeltaCellClusterZNCells->Fill(pos[2]-cellpos[2], nCaloCellsPerCluster, GetEventWeight()) ;
838 
839  fhDeltaCellClusterXE->Fill(pos[0]-cellpos[0], clEnergy, GetEventWeight()) ;
840  fhDeltaCellClusterYE->Fill(pos[1]-cellpos[1], clEnergy, GetEventWeight()) ;
841  fhDeltaCellClusterZE->Fill(pos[2]-cellpos[2], clEnergy, GetEventWeight()) ;
842 
843  Float_t r = TMath::Sqrt(pos[0] *pos[0] + pos[1] * pos[1] );
844  Float_t rcell = TMath::Sqrt(cellpos[0]*cellpos[0] + cellpos[1]* cellpos[1]);
845 
846  fhDeltaCellClusterRNCells->Fill(r-rcell, nCaloCellsPerCluster, GetEventWeight()) ;
847  fhDeltaCellClusterRE ->Fill(r-rcell, clEnergy , GetEventWeight()) ;
848  } // EMCAL and its matrices are available
849  else if ( GetCalorimeter() == kPHOS && GetCaloUtils()->IsPHOSGeoMatrixSet() )
850  {
851  TVector3 xyz;
852  Int_t relId[4], module;
853  Float_t xCell, zCell;
854 
855  GetPHOSGeometry()->AbsToRelNumbering(absId,relId);
856  module = relId[0];
857  GetPHOSGeometry()->RelPosInModule(relId,xCell,zCell);
858  GetPHOSGeometry()->Local2Global(module,xCell,zCell,xyz);
859 
860  fhDeltaCellClusterXNCells->Fill(pos[0]-xyz.X(), nCaloCellsPerCluster, GetEventWeight()) ;
861  fhDeltaCellClusterYNCells->Fill(pos[1]-xyz.Y(), nCaloCellsPerCluster, GetEventWeight()) ;
862  fhDeltaCellClusterZNCells->Fill(pos[2]-xyz.Z(), nCaloCellsPerCluster, GetEventWeight()) ;
863 
864  fhDeltaCellClusterXE->Fill(pos[0]-xyz.X(), clEnergy, GetEventWeight()) ;
865  fhDeltaCellClusterYE->Fill(pos[1]-xyz.Y(), clEnergy, GetEventWeight()) ;
866  fhDeltaCellClusterZE->Fill(pos[2]-xyz.Z(), clEnergy, GetEventWeight()) ;
867 
868  Float_t r = TMath::Sqrt(pos[0] * pos[0] + pos[1] * pos[1] );
869  Float_t rcell = TMath::Sqrt(xyz.X() * xyz.X() + xyz.Y() * xyz.Y());
870 
871  fhDeltaCellClusterRNCells->Fill(r-rcell, nCaloCellsPerCluster, GetEventWeight()) ;
872  fhDeltaCellClusterRE ->Fill(r-rcell, clEnergy , GetEventWeight()) ;
873  } // PHOS and its matrices are available
874  } // cluster cell loop
875 }
876 
877 
878 //___________________________________________________
886 //___________________________________________________
887 void AliAnaCalorimeterQA::ChannelCorrelationInFEC(AliVCluster* clus, AliVCaloCells* cells,
888  Bool_t matched, Int_t absIdMax) const
889 {
890  // Clean the sample
891 
892  // select neutral
893  if ( matched ) return;
894 
895  // away from dead region
896  if ( clus->GetDistanceToBadChannel() < 5 ) return ;
897 
898  // in center of SM
899  Int_t etaRegion = -1, phiRegion = -1;
900  GetCaloUtils()->GetEMCALSubregion(clus,GetReader()->GetEMCALCells(),etaRegion,phiRegion);
901  // Region 0: center of SM ~0.18<|eta|<0.55
902  if ( etaRegion !=0 ) return ;
903 
905 
906  Float_t energy = clus->E();
907  Float_t m02 = clus->GetM02();
908  Float_t m20 = clus->GetM20();
909  Int_t ncells = clus->GetNCells();
910 
911  Int_t absIdCorr[] = {-1,-1,-1,-1};
912  Bool_t correlMaxOK = GetCaloUtils()->GetFECCorrelatedCellAbsId(absIdMax, absIdCorr);
913 
914  //
915  // Correlation to max
916  //
917  Int_t nCorr = 0;
918  Int_t nCellWithWeight = 1;
919  Bool_t near = kFALSE;
920  Bool_t far = kFALSE;
921  // Get second highest energy cell
922  Int_t absId2ndMax = -1;
923  Float_t emax = 0;
924  if(correlMaxOK)
925  {
926  for (Int_t ipos = 0; ipos < ncells; ipos++)
927  {
928  Int_t absId = clus->GetCellsAbsId()[ipos];
929 
930  Float_t eCell = cells->GetCellAmplitude(absId);
931  // consider cells with enough energy weight and not the reference one
932  Float_t weight = GetCaloUtils()->GetEMCALRecoUtils()->GetCellWeight(eCell, energy);
933 
934  if( absId == absIdMax || weight < 0.01 ) continue;
935 
936  nCellWithWeight++;
937 
938  if ( eCell > emax )
939  {
940  emax = eCell;
941  absId2ndMax = absId;
942  }
943 
944  for(Int_t id = 0; id < 4; id++)
945  {
946  if ( absId == absIdCorr[id] )
947  {
948  nCorr++;
949  Int_t diff = TMath::Abs(absId-absIdMax);
950  if ( diff == 1 ) near = kTRUE;
951  else if( diff >= 8 ) far = kTRUE;
952  }
953  }
954  }
955 
956  fhNCellsPerClusterWithWeight->Fill(energy, nCellWithWeight, GetEventWeight());
957  Float_t ratioNcells = nCellWithWeight/(ncells*1.);
958  //printf("E %2.2f, ncells %d, nCellWithWeight %d, ratio %2.2f\n",energy,ncells,nCellWithWeight,ratioNcells);
959  fhNCellsPerClusterRatioWithWeight->Fill(energy, ratioNcells, GetEventWeight());
960 
961  //if ( nCorr || close || far ) printf("nCorr = %d, close %d, far %d; E %2.2f, ncell %d\n",nCorr,close,far,e,nCaloCellsPerCluster);
962 
963  //if ( nCorr > 3) printf("More than 3 correlations: %d\n",nCorr);
964 
965  // Fill histograms assign index
966  Int_t index = -1;
967  if ( nCorr == 0 ) index = 0;
968  else
969  {
970  if ( near && !far ) index = 1;
971  else if (!near && far ) index = 2;
972  else if ( near && far ) index = 3;
973  }
974 
975  if ( index >= 0 )
976  {
977  fhLambda0MaxFECCorrel[index]->Fill(energy, m02, GetEventWeight());
978  fhLambda1MaxFECCorrel[index]->Fill(energy, m20, GetEventWeight());
979 
980  if(nCellWithWeight > 3)
981  {
982  fhLambda0MaxFECCorrelLargeNCells[index]->Fill(energy, m02, GetEventWeight());
983  fhLambda1MaxFECCorrelLargeNCells[index]->Fill(energy, m20, GetEventWeight());
984  }
985  }
986  } // list of correlated towers is found
987  else printf("Max cell correl cells not found\n");
988 
989  //
990  // Any cell correlation, excluding max and their associates
991  //
992  Int_t absIdCorrSecondary [] = {-1,-1,-1,-1};
993  Int_t counter = 0;
994  for (Int_t ipos = 0; ipos < ncells; ipos++)
995  {
996  Int_t absId = clus->GetCellsAbsId()[ipos];
997 
998  // consider cells with enough energy weight and not the reference one or their correlated
999  Float_t weight = GetCaloUtils()->GetEMCALRecoUtils()->GetCellWeight(cells->GetCellAmplitude(absId), energy);
1000 
1001  if( absId == absIdCorr[0] || absId == absIdCorr[1] ||
1002  absId == absIdCorr[2] || absId == absIdCorr[3] || weight < 0.01 ) continue;
1003 
1004  Bool_t correlOK = GetCaloUtils()->GetFECCorrelatedCellAbsId(absId, absIdCorrSecondary);
1005 
1006  if(!correlOK) continue;
1007 
1008  for (Int_t ipos2 = ipos+1; ipos2 < ncells; ipos2++)
1009  {
1010  Int_t absId2 = clus->GetCellsAbsId()[ipos2];
1011 
1012  // consider cells with enough energy weight and not the reference one or their correlated
1013  Float_t weight = GetCaloUtils()->GetEMCALRecoUtils()->GetCellWeight(cells->GetCellAmplitude(absId2), energy);
1014 
1015  if( absId2 == absIdCorr[0] || absId2 == absIdCorr[1] || absId2 == absId ||
1016  absId2 == absIdCorr[2] || absId2 == absIdCorr[3] || weight < 0.01 ) continue;
1017 
1018  for(Int_t id = 0; id < 4; id++)
1019  {
1020  if ( absId2 == absIdCorrSecondary[id] )
1021  counter++;
1022  }
1023  }
1024  }
1025 
1026  Int_t distCase = 0;
1027  if ( counter == 1 ) distCase = 1;
1028  else if ( counter >= 2 ) distCase = 2;
1029 
1030  if ( nCorr > 0 ) distCase+=3;
1031 
1032  fhLambda0FECCorrel[distCase]->Fill(energy, m02, GetEventWeight());
1033  fhLambda1FECCorrel[distCase]->Fill(energy, m20, GetEventWeight());
1034  if(nCellWithWeight > 3)
1035  {
1036  fhLambda0FECCorrelLargeNCells[distCase]->Fill(energy, m02, GetEventWeight());
1037  fhLambda1FECCorrelLargeNCells[distCase]->Fill(energy, m20, GetEventWeight());
1038  }
1039 
1040  //
1041  // Compare pair and odd eta
1042  //
1043  Int_t idMax = -1;
1044  Int_t idMax2 = -1;
1045  Bool_t pairCol = kFALSE;
1046  for(Int_t id = 0; id < 4; id++)
1047  {
1048  if ( absIdMax == absIdCorr[id]) idMax = id;
1049  else if( absId2ndMax == absIdCorr[id]) idMax2 = id;
1050  }
1051 
1052  if(idMax < 0)
1053  {
1054  printf("something wrong, absId max not found in correlated");
1055  return;
1056  }
1057 
1058  if(idMax == 0 || idMax == 3) pairCol = kTRUE; // n and n+8
1059  // else n+1 and n+9
1060 
1061  if(pairCol)
1062  {
1063  fhLambda0MaxFECPair->Fill(energy, m02, GetEventWeight());
1064  fhLambda1MaxFECPair->Fill(energy, m20, GetEventWeight());
1065  if ( idMax2 >=0 )
1066  {
1067  fhLambda0Max2FECPair->Fill(energy, m02, GetEventWeight());
1068  fhLambda1Max2FECPair->Fill(energy, m20, GetEventWeight());
1069  }
1070  }
1071  else
1072  {
1073  fhLambda0MaxFECOdd->Fill(energy, m02, GetEventWeight());
1074  fhLambda1MaxFECOdd->Fill(energy, m20, GetEventWeight());
1075  if ( idMax2 >=0 )
1076  {
1077  fhLambda0Max2FECOdd->Fill(energy, m02, GetEventWeight());
1078  fhLambda1Max2FECOdd->Fill(energy, m20, GetEventWeight());
1079  }
1080  }
1081 
1082  if(nCellWithWeight > 3)
1083  {
1084  if(pairCol)
1085  {
1086  fhLambda0MaxFECPairLargeNCells->Fill(energy, m02, GetEventWeight());
1087  fhLambda1MaxFECPairLargeNCells->Fill(energy, m20, GetEventWeight());
1088  if ( idMax2 >=0 )
1089  {
1090  fhLambda0Max2FECPairLargeNCells->Fill(energy, m02, GetEventWeight());
1091  fhLambda1Max2FECPairLargeNCells->Fill(energy, m20, GetEventWeight());
1092  }
1093  }
1094  else
1095  {
1096  fhLambda0MaxFECOddLargeNCells->Fill(energy, m02, GetEventWeight());
1097  fhLambda1MaxFECOddLargeNCells->Fill(energy, m20, GetEventWeight());
1098  if ( idMax2 >=0 )
1099  {
1100  fhLambda0Max2FECOddLargeNCells->Fill(energy, m02, GetEventWeight());
1101  fhLambda1Max2FECOddLargeNCells->Fill(energy, m20, GetEventWeight());
1102  }
1103  }
1104  }
1105 
1106 }
1107 
1108 
1109 //___________________________________________________
1117 //___________________________________________________
1118 void AliAnaCalorimeterQA::ChannelCorrelationInTCard(AliVCluster* clus, AliVCaloCells* cells,
1119  Bool_t matched, Int_t absIdMax, Float_t exoticity) const
1120 {
1121  // Clean the sample
1122 
1123  // select neutral
1124  if ( matched ) return;
1125 
1126  // away from dead region
1127  if ( clus->GetDistanceToBadChannel() < 5 ) return ;
1128 
1129  // in center of SM
1130  Int_t etaRegion = -1, phiRegion = -1;
1131  GetCaloUtils()->GetEMCALSubregion(clus,GetReader()->GetEMCALCells(),etaRegion,phiRegion);
1132  // Region 0: center of SM ~0.18<|eta|<0.55
1133  if ( etaRegion !=0 ) return ;
1134 
1135  Float_t energy = clus->E();
1136  Float_t m02 = clus->GetM02();
1137 //Float_t m20 = clus->GetM20();
1138  Int_t ncells = clus->GetNCells();
1139 
1140  //
1141  // Correlation to max
1142  //
1143  Int_t nCellWithWeight = 1;
1144  Bool_t nearRow = kFALSE;
1145  Bool_t nearCol = kFALSE;
1146  Int_t nCorr = 0;
1147  Int_t sameCol = 0;
1148  Int_t other = 0;
1149  Int_t sameRow = 0;
1150  Float_t eCellMax = cells->GetCellAmplitude(absIdMax);
1151  Double_t tCellMax = cells->GetCellTime(absIdMax);
1152  //printf("Org E %2.2f, t %2.2f\n",eCellMax,tCellMax*1e9);
1153  GetCaloUtils()->RecalibrateCellAmplitude(eCellMax, GetCalorimeter(), absIdMax);
1154  GetCaloUtils()->RecalibrateCellTime(tCellMax, GetCalorimeter(), absIdMax, GetReader()->GetInputEvent()->GetBunchCrossNumber());
1155  //printf("New E %2.2f, t %2.2f\n",eCellMax,tCellMax*1e9);
1156 
1157  tCellMax *= 1.0e9;
1158  tCellMax-=fConstantTimeShift;
1159 
1160  // correlation not max cells
1161  Int_t nCorr2 = 0;
1162  Int_t sameCol2 = 0;
1163  Int_t other2 = 0;
1164  Int_t sameRow2 = 0;
1165 
1166  // Get second highest energy cell
1167 //Int_t absId2ndMax = -1;
1168  Float_t emax = 0;
1169  Bool_t sameTCard2ndMax = kFALSE;
1170  Int_t rowDiff2 = -100;
1171  Int_t colDiff2 = -100;
1172 
1173  //printf("Cluster E %2.2f, ncells %d, absIdMax %d, eCell Max %2.2f\n", energy, ncells, absIdMax, cells->GetCellAmplitude(absIdMax));
1174 
1175  //
1176  // Loop on the cluster cells, define correlations
1177  //
1178  for (Int_t ipos = 0; ipos < ncells; ipos++)
1179  {
1180  Int_t absId = clus->GetCellsAbsId()[ipos];
1181 
1182  Float_t eCell = cells->GetCellAmplitude(absId);
1183  Double_t tCell = cells->GetCellTime(absId);
1184 
1186  GetCaloUtils()->RecalibrateCellTime(tCell, GetCalorimeter(), absId, GetReader()->GetInputEvent()->GetBunchCrossNumber());
1187  tCell *= 1.0e9;
1188  tCell-=fConstantTimeShift;
1189 
1190  // consider cells with enough energy weight and not the reference one
1191  Float_t weight = GetCaloUtils()->GetEMCALRecoUtils()->GetCellWeight(eCell, energy);
1192 
1193  if( absId == absIdMax || weight < 0.01 ) continue;
1194 
1195  if(eCellMax < eCell) printf("Check!!! E max %f (id %d), E sec %f (id %d)\n",eCellMax,absIdMax, eCell,absId);
1196 
1197  nCellWithWeight++;
1198 
1199  Int_t rowDiff = -100, colDiff = -100;
1200  Bool_t sameTCard = GetCaloUtils()->IsAbsIDsFromTCard(absIdMax,absId,rowDiff,colDiff);
1201 
1202  //printf("\t cell %d, absId %d, E %2.2f, w %2.2f, tcard %d\n", ipos, absId, eCell, weight, sameTCard);
1203 
1204  Int_t indexType = -1;
1205  if ( sameTCard )
1206  {
1207  nCorr++;
1208 
1209  if(TMath::Abs(rowDiff) == 1) nearRow = kTRUE;
1210  if(TMath::Abs(colDiff) == 1) nearCol = kTRUE;
1211 
1212  if ( rowDiff == 0 && colDiff != 0 )
1213  {
1214  if ( nearCol ) indexType = 6;
1215  else indexType = 7;
1216 
1217  sameRow++;
1218  /*printf("\t \t E %2.2f, Same row, diff row %d, col %d\n",eCell,rowDiff,colDiff);*/
1219  }
1220  else if ( rowDiff != 0 && colDiff == 0 )
1221  {
1222  if ( nearRow ) indexType = 8;
1223  else indexType = 9;
1224 
1225  sameCol++;
1226  /*printf("\t \t E %2.2f, Same col, diff row %d, col %d\n",eCell,rowDiff,colDiff);*/
1227  }
1228  else
1229  {
1230  if ( nearRow && nearCol) indexType = 10;
1231  else indexType = 11;
1232 
1233  other++;
1234  /*printf("\t \t E %2.2f, Diff row/col, diff row %d, col %d\n",eCell,rowDiff,colDiff);*/
1235  }
1236  }
1237  else
1238  {
1239  if ( rowDiff == 0 && colDiff != 0 )
1240  {
1241  if ( nearCol ) indexType = 0;
1242  else indexType = 1;
1243 
1244  }
1245  else if ( rowDiff != 0 && colDiff == 0 )
1246  {
1247  if ( nearRow ) indexType = 2;
1248  else indexType = 3;
1249  }
1250  else
1251  {
1252  if ( nearCol && nearRow ) indexType = 4;
1253  else indexType = 5;
1254  }
1255  }
1256 
1257  if( indexType >=0 )
1258  {
1259  Float_t eCellDiff = eCellMax - eCell;
1260  Float_t eClusDiff = energy - eCell;
1261  Float_t eCellRat = eCell / eCellMax;
1262  Float_t eClusRat = eCell / energy ;
1263 
1264  fhTCardCorrECellMaxDiff[indexType]->Fill(energy, eCellDiff, GetEventWeight());
1265  fhTCardCorrEClusterDiff[indexType]->Fill(energy, eClusDiff, GetEventWeight());
1266  fhTCardCorrECellMaxRat [indexType]->Fill(energy, eCellRat , GetEventWeight());
1267  fhTCardCorrEClusterRat [indexType]->Fill(energy, eClusRat , GetEventWeight());
1268 
1269  Float_t tCellDiff = tCellMax - tCell;
1270  fhTCardCorrTCellMaxDiff[indexType]->Fill(energy, tCellDiff, GetEventWeight());
1271  }
1272 
1273  if ( eCell > emax )
1274  {
1275  emax = eCell;
1276  //absId2ndMax = absId;
1277  if(sameTCard)
1278  {
1279  sameTCard2ndMax = kTRUE;
1280  rowDiff2 = rowDiff;
1281  colDiff2 = colDiff;
1282  }
1283  else
1284  {
1285  sameTCard2ndMax = kFALSE;
1286  rowDiff2 = -100;
1287  colDiff2 = -100;
1288  }
1289  }
1290 
1291  //
1292  // Other TCard correlations
1293  //
1294  if ( sameTCard ) continue;
1295 
1296  for (Int_t ipos2 = 0; ipos2 < ncells; ipos2++)
1297  {
1298  Int_t absId2 = clus->GetCellsAbsId()[ipos2];
1299 
1300  eCell = cells->GetCellAmplitude(absId2);
1301  // consider cells with enough energy weight and not the reference one
1302  weight = GetCaloUtils()->GetEMCALRecoUtils()->GetCellWeight(eCell, energy);
1303 
1304  if( absId2 == absIdMax || absId2 == absId || weight < 0.01 ) continue;
1305 
1306  rowDiff = -100, colDiff = -100;
1307  Bool_t sameTCard2 = GetCaloUtils()->IsAbsIDsFromTCard(absId,absId2,rowDiff,colDiff);
1308 
1309  if(sameTCard2)
1310  {
1311  nCorr2++;
1312  if ( rowDiff == 0 && colDiff != 0 ) sameRow2++;
1313  else if ( rowDiff != 0 && colDiff == 0 ) sameCol2++;
1314  else other2++;
1315  }
1316  //printf("\t cell %d, absId %d, E %2.2f, w %2.2f, tcard %d\n", ipos, absId, eCell, weight, sameTCard);
1317  } // second cluster cell lopp for secondary TCard correlations
1318  } // cluster cell loop
1319 
1320  Float_t ratioNcells = nCellWithWeight/(ncells*1.);
1321  fhNCellsTCardCorrRatioWithWeightNoSelection->Fill(energy, ratioNcells, GetEventWeight());
1322  //printf("E %2.2f, ncells %d, nCellWithWeight %d, ratio %2.2f\n",energy,ncells,nCellWithWeight,ratioNcells);
1323 
1324  // If only one relevant cell, it makes no sense to continue
1325  if ( nCellWithWeight <= 1 ) return;
1326 
1327  //printf("\t Same col %d, same row %d, diff other %d\n",sameCol,sameRow,other);
1328  //printf("\t Second cell: E %2.2f, absId %d, correl %d, rowDiff %d, rowCol %d\n",emax,absId2ndMax,sameTCard2,rowDiff2, colDiff2);
1329 
1330  //
1331  // Fill histograms for different cell correlation criteria
1332  //
1334  fhLambda0TCardCorrNoSelection->Fill(energy, m02, GetEventWeight());
1335 
1336  fhNCellsTCardCorrNoSelection ->Fill(energy, ncells, GetEventWeight());
1337  fhNCellsTCardCorrWithWeightNoSelection ->Fill(energy, nCellWithWeight, GetEventWeight());
1338 
1339  if(nCorr < 5)
1340  {
1341  fhLambda0TCardCorrelN[nCorr]->Fill(energy, m02, GetEventWeight());
1342  fhNCellsTCardCorrelN [nCorr]->Fill(energy, nCellWithWeight, GetEventWeight());
1343  }
1344  else
1345  {
1346  fhLambda0TCardCorrelN[5]->Fill(energy, m02, GetEventWeight());
1347  fhNCellsTCardCorrelN [5]->Fill(energy, nCellWithWeight, GetEventWeight());
1348  }
1349 
1350  if ( exoticity > 0.97 )
1351  {
1352  if(nCorr < 5)
1353  {
1354  fhLambda0TCardCorrelNExotic[nCorr]->Fill(energy, m02, GetEventWeight());
1355  fhNCellsTCardCorrelNExotic [nCorr]->Fill(energy, nCellWithWeight, GetEventWeight());
1356  }
1357  else
1358  {
1359  fhLambda0TCardCorrelNExotic[5]->Fill(energy, m02, GetEventWeight());
1360  fhNCellsTCardCorrelNExotic [5]->Fill(energy, nCellWithWeight, GetEventWeight());
1361  }
1362 
1363  Int_t indexExo = -1;
1364  if (!nearRow && nearCol ) indexExo = 0;
1365  else if (!nearRow && !nearCol ) indexExo = 1;
1366  else if ( nearRow && nearCol ) indexExo = 2;
1367  else if ( nearRow && !nearCol ) indexExo = 3;
1368 
1369  if(indexExo >= 0)
1370  {
1371  fhLambda0TCardCorrelExotic[indexExo]->Fill(energy, m02, GetEventWeight());
1372  fhNCellsTCardCorrelExotic [indexExo]->Fill(energy, nCellWithWeight, GetEventWeight());
1373  }
1374  }
1375 
1376  if(nCorr > 0)
1377  {
1378  Int_t index = -1;
1379  if (!sameRow && sameCol && !other ) index = 0;
1380  else if (!sameRow && !sameCol && other ) index = 1;
1381  else if (!sameRow && sameCol && other ) index = 2;
1382  else if ( sameRow && sameCol && !other ) index = 3;
1383  else if ( sameRow && !sameCol && other ) index = 4;
1384  else if ( sameRow && sameCol && other ) index = 5;
1385  else if ( sameRow && !sameCol && !other ) index = 6;
1386  else printf("case not considered!!!: sameRow %d, sameCol %d, other %d, nearRow %d\n",sameRow,sameCol,other,nearRow);
1387 
1388  if(index >= 0)
1389  {
1390  fhLambda0TCardCorrel[index]->Fill(energy, m02, GetEventWeight());
1391  fhNCellsTCardCorrel [index]->Fill(energy, nCellWithWeight, GetEventWeight());
1392  }
1393 
1394  Int_t indexNR = -1;
1395  if ( nearRow )
1396  {
1397  if (!sameRow && sameCol && !other ) indexNR = 0;
1398  else if (!sameRow && !sameCol && other ) indexNR = 1;
1399  else if (!sameRow && sameCol && other ) indexNR = 2;
1400  else if ( sameRow && sameCol && !other ) indexNR = 3;
1401  else if ( sameRow && !sameCol && other ) indexNR = 4;
1402  else if ( sameRow && sameCol && other ) indexNR = 5;
1403  else printf("\t near row case not considered!!!: sameRow %d, sameCol %d, other %d\n",sameRow,sameCol,other);
1404  }
1405 
1406  if ( indexNR >= 0 )
1407  {
1408  fhLambda0TCardCorrelNearRow[indexNR]->Fill(energy, m02, GetEventWeight());
1409  fhNCellsTCardCorrelNearRow [indexNR]->Fill(energy, nCellWithWeight, GetEventWeight());
1410  }
1411 
1412  if ( sameTCard2ndMax )
1413  {
1414  Int_t index2nd = -1;
1415  if ( TMath::Abs(rowDiff2) == 1 && TMath::Abs(colDiff2) != 1 ) index2nd = 0;
1416  else if( TMath::Abs(rowDiff2) != 1 && TMath::Abs(colDiff2) == 1 ) index2nd = 1;
1417  else if( TMath::Abs(rowDiff2) == 1 && TMath::Abs(colDiff2) == 1 ) index2nd = 2;
1418  else index2nd = 3;
1419 
1420  fhLambda0TCardCorrel2ndMax[index2nd]->Fill(energy, m02, GetEventWeight());
1421  fhNCellsTCardCorrel2ndMax [index2nd]->Fill(energy, nCellWithWeight, GetEventWeight());
1422  }
1423  }
1424 
1425  Int_t indexOtherTCard = -1;
1426  if ( nCorr == 0 && nCorr2 == 0 ) indexOtherTCard = 6;
1427  else if ( nCorr == 0 && nCorr2 > 0 )
1428  {
1429  if ( sameRow2 && !sameCol2 && !other2) indexOtherTCard = 0;
1430  else if ( !sameRow2 && sameCol2 && !other2) indexOtherTCard = 1;
1431  else indexOtherTCard = 2;
1432  }
1433  else if ( nCorr > 0 && nCorr2 > 0 )
1434  {
1435  if ( sameRow2 && !sameCol2 && !other2) indexOtherTCard = 3;
1436  else if ( !sameRow2 && sameCol2 && !other2) indexOtherTCard = 4;
1437  else indexOtherTCard = 5;
1438  }
1439 
1440  if ( indexOtherTCard >= 0 )
1441  {
1442  fhLambda0TCardCorrelOtherTCard[indexOtherTCard]->Fill(energy, m02, GetEventWeight());
1443  fhNCellsTCardCorrelOtherTCard [indexOtherTCard]->Fill(energy, nCellWithWeight, GetEventWeight());
1444  }
1445 
1446 }
1447 
1448 
1449 //_____________________________________________________________________________________
1450 // Study the shape of the cluster in cell units terms.
1451 //_____________________________________________________________________________________
1453  Bool_t goodCluster)
1454 {
1455  // No use to study clusters with less than 4 cells
1456  if( clus->GetNCells() <= 3 ) return;
1457 
1458  Int_t dIeta = 0;
1459  Int_t dIphi = 0;
1460 
1461  Int_t ietaMax=-1; Int_t iphiMax = 0; Int_t rcuMax = 0;
1462  Int_t smMax = GetModuleNumberCellIndexes(absIdMax,GetCalorimeter(), ietaMax, iphiMax, rcuMax);
1463 
1464  for (Int_t ipos = 0; ipos < clus->GetNCells(); ipos++)
1465  {
1466  Int_t absId = clus->GetCellsAbsId()[ipos];
1467 
1468  Int_t ieta=-1; Int_t iphi = 0; Int_t rcu = 0;
1469  Int_t sm = GetModuleNumberCellIndexes(absId,GetCalorimeter(), ieta, iphi, rcu);
1470 
1471  if(dIphi < TMath::Abs(iphi-iphiMax)) dIphi = TMath::Abs(iphi-iphiMax);
1472 
1473  if(smMax==sm)
1474  {
1475  if(dIeta < TMath::Abs(ieta-ietaMax)) dIeta = TMath::Abs(ieta-ietaMax);
1476  }
1477  else
1478  {
1479  Int_t ietaShift = ieta;
1480  Int_t ietaMaxShift = ietaMax;
1481  if (ieta > ietaMax) ietaMaxShift+=48;
1482  else ietaShift +=48;
1483  if(dIeta < TMath::Abs(ietaShift-ietaMaxShift)) dIeta = TMath::Abs(ietaShift-ietaMaxShift);
1484  }
1485  }// Fill cell-cluster histogram loop
1486 
1487  Float_t dIA = 1.*(dIphi-dIeta)/(dIeta+dIphi);
1488 
1489  if(goodCluster)
1490  {
1491  // Was cluster matched?
1492  Bool_t matched = GetCaloPID()->IsTrackMatched(clus,GetCaloUtils(),GetReader()->GetInputEvent());
1493 
1494  if (clus->E() < 2 ) fhDeltaIEtaDeltaIPhiE0[matched]->Fill(dIeta, dIphi, GetEventWeight());
1495  else if(clus->E() < 6 ) fhDeltaIEtaDeltaIPhiE2[matched]->Fill(dIeta, dIphi, GetEventWeight());
1496  else fhDeltaIEtaDeltaIPhiE6[matched]->Fill(dIeta, dIphi, GetEventWeight());
1497 
1498  fhDeltaIA[matched]->Fill(clus->E(), dIA, GetEventWeight());
1499 
1500  if(clus->E() > 0.5)
1501  {
1502  fhDeltaIAL0 [matched]->Fill(clus->GetM02() , dIA, GetEventWeight());
1503  fhDeltaIAL1 [matched]->Fill(clus->GetM20() , dIA, GetEventWeight());
1504  fhDeltaIANCells[matched]->Fill(clus->GetNCells(), dIA, GetEventWeight());
1505  }
1506 
1507  // Origin of clusters
1508  Int_t nLabel = clus->GetNLabels();
1509  Int_t* labels = clus->GetLabels();
1510 
1511  if(IsDataMC())
1512  {
1513  Int_t tag = GetMCAnalysisUtils()->CheckOrigin(labels,nLabel, GetReader(),GetCalorimeter());
1514  if( GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPhoton) &&
1515  !GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0) &&
1516  !GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta) &&
1517  !GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCConversion) ){
1518  fhDeltaIAMC[0]->Fill(clus->E(), dIA, GetEventWeight()); // Pure Photon
1519  }
1522  fhDeltaIAMC[1]->Fill(clus->E(), dIA, GetEventWeight()); // Pure electron
1523  }
1526  fhDeltaIAMC[2]->Fill(clus->E(), dIA, GetEventWeight()); // Converted cluster
1527  }
1529  fhDeltaIAMC[3]->Fill(clus->E(), dIA, GetEventWeight()); // Hadrons
1530  }
1531 
1532  } // MC
1533  } // good cluster
1534  else
1535  {
1536  if (clus->E() < 2 ) fhBadClusterDeltaIEtaDeltaIPhiE0->Fill(dIeta, dIphi, GetEventWeight());
1537  else if(clus->E() < 6 ) fhBadClusterDeltaIEtaDeltaIPhiE2->Fill(dIeta, dIphi, GetEventWeight());
1538  else fhBadClusterDeltaIEtaDeltaIPhiE6->Fill(dIeta, dIphi, GetEventWeight());
1539 
1540  fhBadClusterDeltaIA->Fill(clus->E(), dIA, GetEventWeight());
1541  }
1542 }
1543 
1544 //__________________________________________________________________________________________________________________
1553 //__________________________________________________________________________________________________________________
1554 void AliAnaCalorimeterQA::ClusterHistograms(AliVCluster* clus, const TObjArray *caloClusters, AliVCaloCells * cells,
1555  Int_t absIdMax, Double_t maxCellFraction, Float_t eCrossFrac,
1556  Double_t tmax)
1557 {
1558  Double_t tof = clus->GetTOF()*1.e9;
1559  if(tof>400) tof-=fConstantTimeShift;
1560 
1561  fhLambda0 ->Fill(clus->E(), clus->GetM02() , GetEventWeight());
1562  fhLambda1 ->Fill(clus->E(), clus->GetM20() , GetEventWeight());
1563  // fhDispersion ->Fill(clus->E(), clus->GetDispersion(), GetEventWeight());
1564 
1565  fhClusterMaxCellDiff ->Fill(clus->E(), maxCellFraction, GetEventWeight());
1566  fhClusterMaxCellECross->Fill(clus->E(), eCrossFrac , GetEventWeight());
1567  fhClusterTimeEnergy ->Fill(clus->E(), tof , GetEventWeight());
1568 
1570  {
1571  fhClusterMaxCellDiffM02 ->Fill(clus->E(), maxCellFraction, clus->GetM02(), GetEventWeight());
1572  fhClusterMaxCellECrossM02->Fill(clus->E(), eCrossFrac , clus->GetM02(), GetEventWeight());
1573  fhClusterTimeEnergyM02 ->Fill(clus->E(), tof , clus->GetM02(), GetEventWeight());
1574  }
1575 
1576  if(fStudyClustersAsymmetry) ClusterAsymmetryHistograms(clus,absIdMax,kTRUE);
1577 
1578  Int_t nModule = GetModuleNumber(clus);
1579  Int_t nCaloCellsPerCluster = clus->GetNCells();
1580 
1581  // Clusters in event time difference
1582  for(Int_t iclus2 = 0; iclus2 < caloClusters->GetEntriesFast(); iclus2++ )
1583  {
1584  AliVCluster* clus2 = (AliVCluster*) caloClusters->At(iclus2);
1585 
1586  if( clus->GetID() == clus2->GetID() ) continue;
1587 
1588  if( clus->GetM02() > 0.01 && clus2->GetM02() > 0.01 )
1589  {
1590  Int_t nModule2 = GetModuleNumber(clus2);
1591 
1592  Double_t tof2 = clus2->GetTOF()*1.e9;
1593  if(tof2>400) tof2-=fConstantTimeShift;
1594 
1595  fhClusterPairDiffTimeE ->Fill(clus->E(), tof-tof2, GetEventWeight());
1596 
1597  if ( nModule2 == nModule )
1598  fhClusterPairDiffTimeESameMod->Fill(clus->E(), tof-tof2, GetEventWeight());
1599  }
1600  }
1601 
1602  if(nCaloCellsPerCluster > 1)
1603  {
1604  // Check time of cells respect to max energy cell
1605 
1606 // if(fFillAllCellTimeHisto)
1607 // {
1608 // // Get some time averages
1609 // Double_t timeAverages[2] = {0.,0.};
1610 // CalculateAverageTime(clus, cells, timeAverages);
1611 //
1612 // fhClusterMaxCellDiffAverageTime ->Fill(clus->E(), tmax-timeAverages[0], GetEventWeight());
1613 // fhClusterMaxCellDiffWeightedTime ->Fill(clus->E(), tmax-timeAverages[1], GetEventWeight());
1614 // }
1615 
1616  for (Int_t ipos = 0; ipos < nCaloCellsPerCluster; ipos++)
1617  {
1618  Int_t absId = clus->GetCellsAbsId()[ipos];
1619  if( absId == absIdMax || cells->GetCellAmplitude(absIdMax) < 0.01 ) continue;
1620 
1621  Float_t frac = cells->GetCellAmplitude(absId)/cells->GetCellAmplitude(absIdMax);
1622  fhClusterMaxCellCloseCellRatio->Fill(clus->E(), frac, GetEventWeight());
1623  fhClusterMaxCellCloseCellDiff ->Fill(clus->E(), cells->GetCellAmplitude(absIdMax)-cells->GetCellAmplitude(absId), GetEventWeight());
1624 
1626  {
1627  fhClusterMaxCellCloseCellRatioM02->Fill(clus->E(), frac, clus->GetM02(), GetEventWeight());
1628  fhClusterMaxCellCloseCellDiffM02 ->Fill(clus->E(), cells->GetCellAmplitude(absIdMax)-cells->GetCellAmplitude(absId), clus->GetM02(),GetEventWeight());
1629  }
1630 
1632  {
1633  Double_t time = cells->GetCellTime(absId);
1634  GetCaloUtils()->RecalibrateCellTime(time, GetCalorimeter(), absId,GetReader()->GetInputEvent()->GetBunchCrossNumber());
1635 
1636  Float_t diff = (tmax-(time*1.0e9-fConstantTimeShift));
1637  fhCellTimeSpreadRespectToCellMax->Fill(clus->E(), diff, GetEventWeight());
1638  if(fStudyM02Dependence)
1639  fhCellTimeSpreadRespectToCellMaxM02->Fill(clus->E(), diff, clus->GetM02(), GetEventWeight());
1640 
1641  if(TMath::Abs(TMath::Abs(diff) > 100) && clus->E() > 1 ) fhCellIdCellLargeTimeSpread->Fill(absId, GetEventWeight());
1642  }
1643 
1644  } // Fill cell-cluster histogram loop
1645 
1646  } // Check time and energy of cells respect to max energy cell if cluster of more than 1 cell
1647 
1648  Float_t e = fClusterMomentum.E();
1649  Float_t pt = fClusterMomentum.Pt();
1650  Float_t eta = fClusterMomentum.Eta();
1651  Float_t phi = GetPhi(fClusterMomentum.Phi());
1652 
1653  AliDebug(1,Form("cluster: E %2.3f, pT %2.3f, eta %2.3f, phi %2.3f",e,pt,eta,phi*TMath::RadToDeg()));
1654 
1655  fhE ->Fill(e, GetEventWeight());
1656  if(nModule >=0 && nModule < fNModules)
1657  {
1658  fhEMod ->Fill(e, nModule, GetEventWeight());
1659  fhEWeirdMod->Fill(e, nModule, GetEventWeight()); // different binning
1660  }
1661 
1662  fhPt ->Fill(pt , GetEventWeight());
1663  fhPhi ->Fill(phi, GetEventWeight());
1664  fhEta ->Fill(eta, GetEventWeight());
1665 
1667  {
1668  Int_t icol = -1, irow = -1, iRCU = -1, icolAbs = -1, irowAbs = -1;
1669  GetModuleNumberCellIndexesAbsCaloMap(absIdMax,GetCalorimeter(), icol, irow, iRCU, icolAbs, irowAbs);
1670 
1671  for(Int_t ie = 0; ie < fNEBinCuts; ie++)
1672  {
1673  if( e >= fEBinCuts[ie] && e < fEBinCuts[ie+1] )
1674  {
1675  fhEBinClusterEtaPhi[ie]->Fill(eta,phi,GetEventWeight()) ;
1676 
1677  fhEBinClusterColRow[ie]->Fill(icolAbs,irowAbs,GetEventWeight()) ;
1678  }
1679  }
1680  }
1681  else if ( fFillAllTH3 ) fhEtaPhiE->Fill(eta, phi, e, GetEventWeight());
1682  else if ( e > 0.5 ) fhEtaPhi ->Fill(eta, phi, GetEventWeight());
1683 
1684  // Cells per cluster
1685  fhNCellsPerCluster->Fill(e, nCaloCellsPerCluster, GetEventWeight());
1686 
1688  fhNCellsPerClusterM02->Fill(e, nCaloCellsPerCluster, clus->GetM02(),GetEventWeight());
1689 
1690  if(e > 100)
1691  fhNCellsPerClusterWeirdMod->Fill(nCaloCellsPerCluster, nModule, GetEventWeight());
1692 
1693  // Position
1694  if(fFillAllPosHisto2)
1695  {
1696  Float_t pos[3] ;
1697  clus->GetPosition(pos);
1698 
1699  fhXE ->Fill(pos[0], e, GetEventWeight());
1700  fhYE ->Fill(pos[1], e, GetEventWeight());
1701  fhZE ->Fill(pos[2], e, GetEventWeight());
1702 
1703  fhXYZ ->Fill(pos[0], pos[1], pos[2], GetEventWeight());
1704 
1705  fhXNCells->Fill(pos[0], nCaloCellsPerCluster, GetEventWeight());
1706  fhYNCells->Fill(pos[1], nCaloCellsPerCluster, GetEventWeight());
1707  fhZNCells->Fill(pos[2], nCaloCellsPerCluster, GetEventWeight());
1708 
1709  Float_t rxyz = TMath::Sqrt(pos[0]*pos[0]+pos[1]*pos[1]);//+pos[2]*pos[2]);
1710 
1711  fhRE ->Fill(rxyz, e , GetEventWeight());
1712  fhRNCells->Fill(rxyz, nCaloCellsPerCluster, GetEventWeight());
1713  }
1714 
1715  if( nModule >= 0 && nModule < fNModules ) fhNCellsPerClusterMod[nModule]->Fill(e, nCaloCellsPerCluster, GetEventWeight());
1716 }
1717 
1718 //____________________________________________________________________________
1730 //____________________________________________________________________________
1732  AliVCaloCells* cells)
1733 {
1734  Int_t nLabel = 0 ;
1735  Int_t *labels = 0x0;
1736  Int_t nCaloClusters = caloClusters->GetEntriesFast() ;
1737  Int_t nCaloClustersAccepted = 0 ;
1738  Int_t nCaloCellsPerCluster = 0 ;
1739  Bool_t matched = kFALSE;
1740  Int_t nModule =-1 ;
1741 
1742  // Get vertex for photon momentum calculation and event selection
1743  Double_t v[3] = {0,0,0}; //vertex ;
1744 //GetReader()->GetVertex(v);
1745 
1746  Int_t *nClustersInModule = new Int_t [fNModules];
1747  Float_t *energyInModule = new Float_t[fNModules];
1748  for(Int_t imod = 0; imod < fNModules; imod++ )
1749  {
1750  nClustersInModule[imod] = 0;
1751  energyInModule [imod] = 0;
1752  }
1753 
1754  AliDebug(1,Form("In %s there are %d clusters", GetCalorimeterString().Data(), nCaloClusters));
1755 
1756  // Loop over CaloClusters
1757  for(Int_t iclus = 0; iclus < nCaloClusters; iclus++)
1758  {
1759  AliDebug(1,Form("Cluster: %d/%d, data %d",iclus+1,nCaloClusters,GetReader()->GetDataType()));
1760 
1761  AliVCluster* clus = (AliVCluster*) caloClusters->At(iclus);
1762 
1763  // Get the fraction of the cluster energy that carries the cell with highest energy and its absId
1764  Float_t maxCellFraction = 0.;
1765  Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(cells, clus,maxCellFraction);
1766 
1767  // Cut on time of clusters
1768  Double_t tof = clus->GetTOF()*1.e9;
1769  if(tof>400) tof-=fConstantTimeShift;
1770 
1771  if( tof < fTimeCutMin || tof > fTimeCutMax )
1772  {
1773  AliDebug(1,Form("Remove cluster with TOF %f",tof));
1774  continue;
1775  }
1776 
1777  // Get cluster kinematics
1778  clus->GetMomentum(fClusterMomentum,v);
1779 
1780  // Check only certain regions
1781  Bool_t in = kTRUE;
1783  if(!in) continue;
1784 
1785  // MC labels
1786  nLabel = clus->GetNLabels();
1787  labels = clus->GetLabels();
1788 
1789  // SuperModule number of cluster
1790  nModule = GetModuleNumber(clus);
1791 
1792  // Cells per cluster
1793  nCaloCellsPerCluster = clus->GetNCells();
1794 
1795  // Cluster mathed with track?
1796  matched = GetCaloPID()->IsTrackMatched(clus,GetCaloUtils(), GetReader()->GetInputEvent());
1797 
1798  // Get time of max cell
1799  Double_t tmax = cells->GetCellTime(absIdMax);
1800  GetCaloUtils()->RecalibrateCellTime(tmax, GetCalorimeter(), absIdMax,GetReader()->GetInputEvent()->GetBunchCrossNumber());
1801  tmax*=1.e9;
1802  tmax-=fConstantTimeShift;
1803  //
1804  // Fill histograms related to single cluster
1805  //
1806 
1807  // Fill some histograms before applying the exotic cell / bad map cut
1808  if(fStudyBadClusters)
1809  {
1810  fhNCellsPerClusterNoCut->Fill(clus->E(), nCaloCellsPerCluster, GetEventWeight());
1811 
1812  if(nModule >=0 && nModule < fNModules)
1813  {
1814  fhNCellsPerClusterModNoCut[nModule]->Fill(clus->E(), nCaloCellsPerCluster, GetEventWeight());
1815  if(clus->E() > 100) fhNCellsPerClusterWeirdModNoCut->Fill(nCaloCellsPerCluster, nModule, GetEventWeight());
1816  }
1817 
1818  fhClusterMaxCellDiffNoCut->Fill(clus->E(), maxCellFraction, GetEventWeight());
1819  }
1820 
1821  Float_t ampMax = cells->GetCellAmplitude(absIdMax);
1822  GetCaloUtils()->RecalibrateCellAmplitude(ampMax,GetCalorimeter(), absIdMax);
1823 
1824  if(fStudyExotic) ExoticHistograms(absIdMax, ampMax, clus, cells);
1825 
1826  // Check bad clusters if requested and rejection was not on
1827  Bool_t goodCluster = IsGoodCluster(absIdMax, clus->GetM02(), nCaloCellsPerCluster, cells);
1828 
1829  Float_t eCrossFrac = 0;
1830  if(ampMax > 0.01) eCrossFrac = 1-GetECross(absIdMax,cells)/ampMax;
1831 
1832  AliDebug(1,Form("Accept cluster? %d",goodCluster));
1833 
1834  if(!goodCluster)
1835  {
1836  if ( fStudyBadClusters ) BadClusterHistograms(clus, caloClusters,
1837  cells, absIdMax,
1838  maxCellFraction,
1839  eCrossFrac, tmax);
1840  continue;
1841  }
1842 
1843  //
1844  ClusterHistograms(clus, caloClusters, cells, absIdMax,
1845  maxCellFraction, eCrossFrac, tmax);
1846 
1847  nCaloClustersAccepted++;
1848 
1849  //
1850  if(fStudyFECCorrelation ) ChannelCorrelationInFEC (clus, cells, matched, absIdMax);
1851  if(fStudyTCardCorrelation) ChannelCorrelationInTCard(clus, cells, matched, absIdMax, eCrossFrac);
1852 
1853  //
1854  nModule = GetModuleNumber(clus);
1855  if(nModule >=0 && nModule < fNModules && fClusterMomentum.E() > 2*fCellAmpMin)
1856  {
1857  nClustersInModule[nModule]++;
1858  if(clus->E() > 0.5)
1859  energyInModule [nModule] += clus->E();
1860  }
1861 
1862  // Cluster weights
1863  if(fStudyWeight) WeightHistograms(clus, cells);
1864 
1865  // Cells in cluster position
1867 
1868  // Fill histograms related to single cluster, mc vs data
1869  Int_t mcOK = kFALSE;
1870  Int_t pdg = -1;
1871  if(IsDataMC() && nLabel > 0 && labels)
1872  mcOK = ClusterMCHistograms(matched, labels, nLabel, pdg);
1873 
1874  // Matched clusters with tracks, also do some MC comparison, needs input from ClusterMCHistograms
1875  if( matched && fFillAllTMHisto)
1876  ClusterMatchedWithTrackHistograms(clus,mcOK,pdg);
1877 
1878  // Invariant mass
1879  // Try to reduce background with a mild shower shape cut and no more than 1 maxima
1880  // in cluster and remove low energy clusters
1881 
1882  if ( fFillAllPi0Histo
1883  && nCaloClusters > 1
1884  && nCaloCellsPerCluster > 1
1885  && GetCaloUtils()->GetNumberOfLocalMaxima(clus,cells) == 1
1886  && clus->GetM02() < fInvMassMaxM02Cut
1887  && clus->GetM02() > fInvMassMinM02Cut
1888  && clus->E() > fInvMassMinECut
1889  && clus->E() < fInvMassMaxECut
1890  )
1891  InvariantMassHistograms(iclus, nModule, caloClusters,cells);
1892 
1893  } // Cluster loop
1894 
1895  // Number of clusters histograms
1896  if(nCaloClustersAccepted > 0) fhNClusters->Fill(nCaloClustersAccepted, GetEventWeight());
1897 
1898  // Number of clusters per module
1899  for(Int_t imod = 0; imod < fNModules; imod++ )
1900  {
1901  AliDebug(1,Form("Module %d calo %s clusters %d, sum E %f", imod, GetCalorimeterString().Data(), nClustersInModule[imod], energyInModule[imod]));
1902 
1903  fhNClustersMod ->Fill(nClustersInModule[imod], imod, GetEventWeight());
1904  fhSumClustersEnergyMod->Fill(energyInModule [imod], imod, GetEventWeight());
1905 
1906  fhNClustersSumEnergyPerMod[imod]->Fill(energyInModule[imod], nClustersInModule[imod], GetEventWeight());
1907  }
1908 
1909  delete [] nClustersInModule;
1910  delete [] energyInModule;
1911 }
1912 
1913 //__________________________________________________________________________________
1916 //__________________________________________________________________________________
1918  Int_t nLabels, Int_t & pdg )
1919 {
1920  if(!labels || nLabels<=0)
1921  {
1922  AliWarning(Form("Strange, labels array %p, n labels %d", labels,nLabels));
1923  return kFALSE;
1924  }
1925 
1926  AliDebug(1,Form("Primaries: nlabels %d",nLabels));
1927 
1928  Float_t e = fClusterMomentum.E();
1929  Float_t eta = fClusterMomentum.Eta();
1930  Float_t phi = fClusterMomentum.Phi();
1931  if(phi < 0) phi +=TMath::TwoPi();
1932 
1933  AliAODMCParticle * aodprimary = 0x0;
1934  TParticle * primary = 0x0;
1935 
1936  // Play with the MC stack if available
1937  Int_t label = labels[0];
1938 
1939  if(label < 0)
1940  {
1941  AliDebug(1,Form(" *** bad label ***: label %d", label));
1942  return kFALSE;
1943  }
1944 
1945  Int_t pdg0 =-1; Int_t status = -1; Int_t iMother = -1; Int_t iParent = -1;
1946  Float_t vxMC = 0; Float_t vyMC = 0;
1947  Float_t eMC = 0; //Float_t ptMC= 0;
1948  Float_t phiMC = 0; Float_t etaMC = 0;
1949  Int_t charge = 0;
1950 
1951  // Check the origin.
1952  Int_t tag = GetMCAnalysisUtils()->CheckOrigin(labels,nLabels, GetReader(),GetCalorimeter());
1953 
1954  if ( GetReader()->ReadStack() &&
1955  !GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCUnknown))
1956  { // If MC stack and known tag
1957 
1958  if( label >= GetMCStack()->GetNtrack())
1959  {
1960  AliDebug(1,Form("*** large label ***: label %d, n tracks %d", label, GetMCStack()->GetNtrack()));
1961  return kFALSE;
1962  }
1963 
1964  primary = GetMCStack()->Particle(label);
1965  iMother = label;
1966  pdg0 = TMath::Abs(primary->GetPdgCode());
1967  pdg = pdg0;
1968  status = primary->GetStatusCode();
1969  vxMC = primary->Vx();
1970  vyMC = primary->Vy();
1971  iParent = primary->GetFirstMother();
1972 
1973  AliDebug(1,"Cluster most contributing mother:");
1974  AliDebug(1,Form("\t Mother label %d, pdg %d, %s, status %d, parent %d",iMother, pdg0, primary->GetName(),status, iParent));
1975 
1976 
1977  // Get final particle, no conversion products
1978  if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCConversion))
1979  {
1980  // Get the parent
1981  primary = GetMCStack()->Particle(iParent);
1982  pdg = TMath::Abs(primary->GetPdgCode());
1983 
1984  AliDebug(2,"Converted cluster!. Find before conversion:");
1985 
1986  while((pdg == 22 || pdg == 11) && status != 1)
1987  {
1988  Int_t iMotherOrg = iMother;
1989  iMother = iParent;
1990  primary = GetMCStack()->Particle(iMother);
1991  status = primary->GetStatusCode();
1992  pdg = TMath::Abs(primary->GetPdgCode());
1993  iParent = primary->GetFirstMother();
1994 
1995  // If gone too back and non stable, assign the decay photon/electron
1996  // there are other possible decays, ignore them for the moment
1997  if(pdg==111 || pdg==221)
1998  {
1999  primary = GetMCStack()->Particle(iMotherOrg);
2000  break;
2001  }
2002 
2003  if( iParent < 0 )
2004  {
2005  iParent = iMother;
2006  break;
2007  }
2008 
2009  AliDebug(2,Form("\t pdg %d, index %d, %s, status %d",pdg, iMother, primary->GetName(),status));
2010  }
2011 
2012  AliDebug(1,"Converted Cluster mother before conversion:");
2013  AliDebug(1,Form("\t Mother label %d, pdg %d, %s, status %d, parent %d",iMother, pdg, primary->GetName(), status, iParent));
2014 
2015  }
2016 
2017  // Overlapped pi0 (or eta, there will be very few), get the meson
2018  if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0) ||
2019  GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta))
2020  {
2021  AliDebug(2,"Overlapped Meson decay!, Find it:");
2022 
2023  while(pdg != 111 && pdg != 221)
2024  {
2025  //printf("iMother %d, pdg %d, iParent %d, pdg %d\n",iMother,pdg,iParent,GetMCStack()->Particle(iParent)->GetPdgCode());
2026  iMother = iParent;
2027  primary = GetMCStack()->Particle(iMother);
2028  status = primary->GetStatusCode();
2029  pdg = TMath::Abs(primary->GetPdgCode());
2030  iParent = primary->GetFirstMother();
2031 
2032  if( iParent < 0 ) break;
2033 
2034  AliDebug(2,Form("\t pdg %d, %s, index %d",pdg, primary->GetName(),iMother));
2035 
2036  if(iMother==-1)
2037  {
2038  AliWarning("Tagged as Overlapped photon but meson not found, why?");
2039  //break;
2040  }
2041  }
2042 
2043  AliDebug(2,Form("Overlapped %s decay, label %d",primary->GetName(),iMother));
2044  }
2045 
2046  eMC = primary->Energy();
2047  //ptMC = primary->Pt();
2048  phiMC = primary->Phi();
2049  etaMC = primary->Eta();
2050  pdg = TMath::Abs(primary->GetPdgCode());
2051  charge = (Int_t) TDatabasePDG::Instance()->GetParticle(pdg)->Charge();
2052 
2053  }
2054  else if( GetReader()->ReadAODMCParticles() &&
2055  !GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCUnknown))
2056  {
2057  // If MC AOD and known tag
2058  // Get the list of MC particles
2059  if(!GetReader()->GetAODMCParticles())
2060  AliFatal("MCParticles not available!");
2061 
2062  aodprimary = (AliAODMCParticle*) (GetReader()->GetAODMCParticles())->At(label);
2063  iMother = label;
2064  pdg0 = TMath::Abs(aodprimary->GetPdgCode());
2065  pdg = pdg0;
2066  status = aodprimary->IsPrimary();
2067  vxMC = aodprimary->Xv();
2068  vyMC = aodprimary->Yv();
2069  iParent = aodprimary->GetMother();
2070 
2071  AliDebug(1,"Cluster most contributing mother:");
2072  AliDebug(1,Form("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d, parent %d",
2073  iMother, pdg0, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary(), iParent));
2074 
2075  //Get final particle, no conversion products
2076  if( GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCConversion) )
2077  {
2078  AliDebug(2,"Converted cluster!. Find before conversion:");
2079 
2080  // Get the parent
2081  aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles())->At(iParent);
2082  pdg = TMath::Abs(aodprimary->GetPdgCode());
2083 
2084  while ((pdg == 22 || pdg == 11) && !aodprimary->IsPhysicalPrimary())
2085  {
2086  Int_t iMotherOrg = iMother;
2087  iMother = iParent;
2088  aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles())->At(iMother);
2089  status = aodprimary->IsPrimary();
2090  iParent = aodprimary->GetMother();
2091  pdg = TMath::Abs(aodprimary->GetPdgCode());
2092 
2093  // If gone too back and non stable, assign the decay photon/electron
2094  // there are other possible decays, ignore them for the moment
2095  if( pdg == 111 || pdg == 221 )
2096  {
2097  aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles())->At(iMotherOrg);
2098  break;
2099  }
2100 
2101  if( iParent < 0 )
2102  {
2103  iParent = iMother;
2104  break;
2105  }
2106 
2107  AliDebug(2,Form("\t pdg %d, index %d, Primary? %d, Physical Primary? %d",
2108  pdg, iMother, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary()));
2109  }
2110 
2111  AliDebug(1,"Converted Cluster mother before conversion:");
2112  AliDebug(1,Form("\t Mother label %d, pdg %d, parent %d, Primary? %d, Physical Primary? %d",
2113  iMother, pdg, iParent, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary()));
2114 
2115  }
2116 
2117  //Overlapped pi0 (or eta, there will be very few), get the meson
2118  if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0) ||
2119  GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta))
2120  {
2121  AliDebug(2,Form("Overlapped Meson decay!, Find it: PDG %d, mom %d",pdg, iMother));
2122 
2123  while(pdg != 111 && pdg != 221)
2124  {
2125  iMother = iParent;
2126  aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles())->At(iMother);
2127  status = aodprimary->IsPrimary();
2128  iParent = aodprimary->GetMother();
2129  pdg = TMath::Abs(aodprimary->GetPdgCode());
2130 
2131  if( iParent < 0 ) break;
2132 
2133  AliDebug(2,Form("\t pdg %d, index %d",pdg, iMother));
2134 
2135  if(iMother==-1)
2136  {
2137  AliWarning("Tagged as Overlapped photon but meson not found, why?");
2138  //break;
2139  }
2140  }
2141 
2142  AliDebug(2,Form("Overlapped %s decay, label %d",aodprimary->GetName(),iMother));
2143  }
2144 
2145  status = aodprimary->IsPrimary();
2146  eMC = aodprimary->E();
2147  //ptMC = aodprimary->Pt();
2148  phiMC = aodprimary->Phi();
2149  etaMC = aodprimary->Eta();
2150  pdg = TMath::Abs(aodprimary->GetPdgCode());
2151  charge = aodprimary->Charge();
2152  }
2153 
2154  //Float_t vz = primary->Vz();
2155  Float_t rVMC = TMath::Sqrt(vxMC*vxMC + vyMC*vyMC);
2156  if( ( pdg == 22 || TMath::Abs(pdg) == 11 ) && status != 1 )
2157  {
2158  fhEMVxyz ->Fill(vxMC, vyMC, GetEventWeight());//,vz);
2159  fhEMR ->Fill(e , rVMC, GetEventWeight());
2160  }
2161 
2162  //printf("reco e %f, pt %f, phi %f, eta %f \n", e, pt, phi, eta);
2163  //printf("prim e %f, pt %f, phi %f, eta %f \n", eMC,ptMC,phiMC ,etaMC );
2164  //printf("vertex: vx %f, vy %f, vz %f, r %f \n", vxMC, vyMC, vz, r);
2165 
2166  // Overlapped pi0 (or eta, there will be very few)
2167  Int_t mcIndex = -1;
2168  if ( GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0 ) )
2169  {
2170  mcIndex = kmcPi0;
2171  } // Overlapped pizero decay
2172  else if( GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta ) )
2173  {
2174  mcIndex = kmcEta;
2175  } // Overlapped eta decay
2176  else if( GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPhoton ) )
2177  {
2178  if( GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCConversion))
2179  mcIndex = kmcPhotonConv ;
2180  else
2181  mcIndex = kmcPhoton ;
2182  } // photon
2183  else if( GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCElectron) )
2184  {
2185  mcIndex = kmcElectron;
2186  fhEMVxyz->Fill(vxMC, vyMC, GetEventWeight());//,vz);
2187  fhEMR ->Fill(e , rVMC, GetEventWeight());
2188  }
2189  else if(charge == 0)
2190  {
2191  mcIndex = kmcNeHadron;
2192  fhHaVxyz->Fill(vxMC, vyMC, GetEventWeight());//,vz);
2193  fhHaR ->Fill(e , rVMC, GetEventWeight());
2194  }
2195  else if(charge!=0)
2196  {
2197  mcIndex = kmcChHadron;
2198  fhHaVxyz->Fill(vxMC, vyMC, GetEventWeight());//,vz);
2199  fhHaR ->Fill(e , rVMC, GetEventWeight());
2200  }
2201 
2202  //printf("mc index %d\n",mcIndex);
2203 
2204  if( mcIndex >= 0 && mcIndex < 7 && e > 0.5 && eMC > 0.5)
2205  {
2206  fhRecoMCE [mcIndex][(matched)]->Fill(e , eMC , GetEventWeight());
2207  fhRecoMCEta [mcIndex][(matched)]->Fill(eta, etaMC , GetEventWeight());
2208  fhRecoMCPhi [mcIndex][(matched)]->Fill(phi, phiMC , GetEventWeight());
2209  fhRecoMCRatioE [mcIndex][(matched)]->Fill(e , e/eMC , GetEventWeight());
2210  fhRecoMCDeltaE [mcIndex][(matched)]->Fill(e , eMC-e , GetEventWeight());
2211  fhRecoMCDeltaPhi[mcIndex][(matched)]->Fill(e , phiMC-phi, GetEventWeight());
2212  fhRecoMCDeltaEta[mcIndex][(matched)]->Fill(e , etaMC-eta, GetEventWeight());
2213  }
2214 
2215  if( primary || aodprimary ) return kTRUE ;
2216  else return kFALSE;
2217 }
2218 
2219 //_________________________________________________________________________________________________________
2224 //_________________________________________________________________________________________________________
2226 {
2227  Float_t e = fClusterMomentum.E();
2228  Float_t pt = fClusterMomentum.Pt();
2229  Float_t eta = fClusterMomentum.Eta();
2230  Float_t phi = fClusterMomentum.Phi();
2231  if(phi < 0) phi +=TMath::TwoPi();
2232 
2233  fhECharged ->Fill(e , GetEventWeight());
2234  fhPtCharged ->Fill(pt , GetEventWeight());
2235  fhPhiCharged ->Fill(phi, GetEventWeight());
2236  fhEtaCharged ->Fill(eta, GetEventWeight());
2237 
2238  if ( fFillAllTH3 ) fhEtaPhiECharged->Fill(eta, phi, e, GetEventWeight());
2239  else if ( e > 0.5 ) fhEtaPhiCharged ->Fill(eta, phi, GetEventWeight());
2240 
2241  // Study the track and matched cluster if track exists.
2242 
2243  AliVTrack *track = GetCaloUtils()->GetMatchedTrack(clus, GetReader()->GetInputEvent());
2244 
2245  if(!track) return ;
2246 
2247  Double_t tpt = track->Pt();
2248  Double_t tmom = track->P();
2249  Double_t dedx = track->GetTPCsignal();
2250  Int_t nITS = track->GetNcls(0);
2251  Int_t nTPC = track->GetNcls(1);
2252  Bool_t positive = kFALSE;
2253  if(track) positive = (track->Charge()>0);
2254 
2255  // Residuals
2256  Float_t deta = clus->GetTrackDz();
2257  Float_t dphi = clus->GetTrackDx();
2258  Double_t dR = TMath::Sqrt(dphi*dphi + deta*deta);
2259  Int_t nModule = GetModuleNumber(clus);
2260 
2261  if( TMath::Abs(dphi) < 999 )
2262  {
2263  if(positive)
2264  {
2265  fhTrackMatchedDEtaPos->Fill(e, deta, GetEventWeight());
2266  fhTrackMatchedDPhiPos->Fill(e, dphi, GetEventWeight());
2267 
2268  if(e > 0.5)
2269  {
2270  fhTrackMatchedDEtaPosMod ->Fill(deta, nModule, GetEventWeight());
2271  fhTrackMatchedDPhiPosMod ->Fill(dphi, nModule, GetEventWeight());
2272  fhTrackMatchedDEtaDPhiPos->Fill(deta, dphi , GetEventWeight());
2273  }
2274  }
2275  else
2276  {
2277  fhTrackMatchedDEtaNeg->Fill(e, deta, GetEventWeight());
2278  fhTrackMatchedDPhiNeg->Fill(e, dphi, GetEventWeight());
2279 
2280  if(e > 0.5)
2281  {
2282  fhTrackMatchedDEtaNegMod ->Fill(deta, nModule, GetEventWeight());
2283  fhTrackMatchedDPhiNegMod ->Fill(dphi, nModule, GetEventWeight());
2284  fhTrackMatchedDEtaDPhiNeg->Fill(deta, dphi , GetEventWeight());
2285  }
2286  }
2287  }
2288 
2289  Double_t eOverP = e/tmom;
2290  fh1EOverP->Fill(tpt, eOverP, GetEventWeight());
2291  if(e > 0.5 && tpt > 0.5) fh1EOverPMod->Fill(eOverP, nModule, GetEventWeight());
2292 
2293  if(dR < 0.02)
2294  {
2295  fh1EOverPR02->Fill(tpt, eOverP, GetEventWeight());
2296  if(e > 0.5 && tpt > 0.5) fh1EOverPR02Mod->Fill(eOverP, nModule, GetEventWeight());
2297 
2298  if(dedx > 60 && dedx < 100)
2299  {
2300  fh1EleEOverP->Fill(tpt, eOverP, GetEventWeight());
2301  if(e > 0.5 && tpt > 0.5) fh1EleEOverPMod->Fill(eOverP, nModule, GetEventWeight());
2302  }
2303  }
2304 
2305  fh2dR->Fill(e, dR, GetEventWeight());
2306  fh2MatchdEdx->Fill(tmom, dedx, GetEventWeight());
2307 
2308  if(e > 0.5 && tmom > 0.5)
2309  {
2310  fh2dRMod->Fill(dR, nModule, GetEventWeight());
2311  fh2MatchdEdxMod->Fill(dedx, nModule, GetEventWeight());
2312  }
2313 
2314  if(dR < 0.02 && eOverP > 0.6 && eOverP < 1.2
2315  && clus->GetNCells() > 1 && nITS > 3 && nTPC > 20)
2316  {
2317  fh2EledEdx->Fill(tmom, dedx, GetEventWeight());
2318  if(e > 0.5 && tmom > 0.5) fh2EledEdxMod->Fill(dedx, nModule, GetEventWeight());
2319  }
2320 
2321  if(IsDataMC() && okPrimary)
2322  {
2323  Double_t charge = TDatabasePDG::Instance()->GetParticle(pdg)->Charge();
2324 
2325  if(TMath::Abs(pdg) == 11)
2326  {
2327  fhMCEle1EOverP ->Fill(tpt , eOverP, GetEventWeight());
2328  fhMCEle1dR ->Fill(dR , GetEventWeight());
2329  fhMCEle2MatchdEdx->Fill(tmom, dedx , GetEventWeight());
2330 
2331  if(dR < 0.02)
2332  {
2333  fhMCEle1EOverPR02->Fill(tpt, eOverP, GetEventWeight());
2334  if(dedx > 60 && dedx < 100) fhMCEle1EleEOverP->Fill(tpt, eOverP, GetEventWeight());
2335  }
2336  }
2337  else if(charge!=0)
2338  {
2339  fhMCChHad1EOverP ->Fill(tpt , eOverP, GetEventWeight());
2340  fhMCChHad1dR ->Fill(dR , GetEventWeight());
2341  fhMCChHad2MatchdEdx->Fill(tmom, dedx , GetEventWeight());
2342 
2343  if(dR < 0.02)
2344  {
2345  fhMCChHad1EOverPR02->Fill(tpt, eOverP, GetEventWeight());
2346  if(dedx > 60 && dedx < 100) fhMCChHad1EleEOverP->Fill(tpt, eOverP, GetEventWeight());
2347  }
2348  }
2349  else if(charge == 0)
2350  {
2351  fhMCNeutral1EOverP ->Fill(tpt , eOverP, GetEventWeight());
2352  fhMCNeutral1dR ->Fill(dR , GetEventWeight());
2353  fhMCNeutral2MatchdEdx->Fill(tmom, dedx , GetEventWeight());
2354 
2355  if(dR < 0.02)
2356  {
2357  fhMCNeutral1EOverPR02->Fill(tpt, eOverP, GetEventWeight());
2358  if(dedx > 60 && dedx < 100) fhMCNeutral1EleEOverP->Fill(tpt, eOverP, GetEventWeight());
2359  }
2360  }
2361  } // DataMC
2362 }
2363 
2364 //___________________________________
2367 //___________________________________
2369 {
2370  // Clusters arrays
2371  TObjArray * caloClustersEMCAL = GetEMCALClusters();
2372  TObjArray * caloClustersPHOS = GetPHOSClusters();
2373 
2374  if(!caloClustersEMCAL || !caloClustersPHOS)
2375  {
2376  AliDebug(1,Form("PHOS (%p) or EMCAL (%p) clusters array not available, do not correlate",caloClustersPHOS,caloClustersEMCAL));
2377  return ;
2378  }
2379 
2380  // Cells arrays
2381  AliVCaloCells * cellsEMCAL = GetEMCALCells();
2382  AliVCaloCells * cellsPHOS = GetPHOSCells();
2383 
2384  if(!cellsEMCAL || !cellsPHOS)
2385  {
2386  AliDebug(1,Form("PHOS (%p) or EMCAL (%p) cells array ot available, do not correlate",cellsPHOS,cellsEMCAL));
2387  return ;
2388  }
2389 
2390  // Clusters parameters
2391  Int_t nclEMCAL = 0;
2392  Int_t nclDCAL = 0;
2393  Int_t nclPHOS = 0;
2394 
2395  Float_t sumClusterEnergyEMCAL = 0;
2396  Float_t sumClusterEnergyDCAL = 0;
2397  Float_t sumClusterEnergyPHOS = 0;
2398 
2399  Int_t iclus = 0;
2400  Float_t energy = 0;
2401  AliVCluster* cluster = 0;
2402  for(iclus = 0 ; iclus < caloClustersEMCAL->GetEntriesFast() ; iclus++)
2403  {
2404  cluster = (AliVCluster*)caloClustersEMCAL->At(iclus);
2405  Float_t energy = cluster->E();
2406 
2407  if( energy < 0.5 ) continue;
2408 
2409  if(cluster->GetCellsAbsId()[0] < 12288)
2410  {
2411  nclEMCAL++;
2412  sumClusterEnergyEMCAL += energy;
2413  }
2414  else
2415  {
2416  nclDCAL++;
2417  sumClusterEnergyDCAL += energy;
2418  }
2419  }
2420 
2421  for(iclus = 0 ; iclus < caloClustersPHOS ->GetEntriesFast(); iclus++)
2422  {
2423  cluster = (AliVCluster*) caloClustersPHOS->At(iclus);
2424 
2425  energy = cluster->E();
2426 
2427  if( energy < 0.5 ) continue;
2428 
2429  nclPHOS++;
2430  sumClusterEnergyPHOS += energy;
2431  }
2432 
2433  // Cells parameters
2434  Int_t ncellsEMCAL = 0 ;
2435  Int_t ncellsDCAL = 0 ;
2436  Int_t ncellsPHOS = 0;
2437 
2438  Float_t sumCellEnergyEMCAL = 0;
2439  Float_t sumCellEnergyDCAL = 0;
2440  Float_t sumCellEnergyPHOS = 0;
2441  Int_t icell = 0;
2442  for(icell = 0 ; icell < cellsEMCAL->GetNumberOfCells() ; icell++)
2443  {
2444  Float_t amp = cellsEMCAL->GetAmplitude(icell);
2445  Int_t cellId = cellsEMCAL->GetCellNumber(icell);
2446 
2447  if (amp < fEMCALCellAmpMin) continue;
2448 
2449  if( cellId < 12288)
2450  {
2451  ncellsEMCAL++;
2452  sumCellEnergyEMCAL += amp;
2453  }
2454  else
2455  {
2456  ncellsDCAL++;
2457  sumCellEnergyDCAL += amp;
2458  }
2459  }
2460 
2461  for(icell = 0 ; icell < cellsPHOS->GetNumberOfCells(); icell++)
2462  {
2463  Float_t amp = cellsPHOS->GetAmplitude(icell);
2464  Int_t cellId = cellsPHOS->GetCellNumber(icell);
2465 
2466  if ( cellId < 0 ) continue ; // CPV
2467 
2468  if ( amp < fPHOSCellAmpMin ) continue;
2469 
2470  ncellsPHOS++;
2471  sumCellEnergyPHOS += amp;
2472  }
2473 
2474  // Fill Histograms
2475 
2476  fhEMCALPHOSCorrNClusters->Fill(nclEMCAL , nclPHOS , GetEventWeight());
2477  fhEMCALPHOSCorrEClusters->Fill(sumClusterEnergyEMCAL, sumClusterEnergyPHOS, GetEventWeight());
2478  fhEMCALPHOSCorrNCells ->Fill(ncellsEMCAL , ncellsPHOS , GetEventWeight());
2479  fhEMCALPHOSCorrECells ->Fill(sumCellEnergyEMCAL , sumCellEnergyPHOS , GetEventWeight());
2480 
2481  fhEMCALDCALCorrNClusters->Fill(nclEMCAL , nclDCAL , GetEventWeight());
2482  fhEMCALDCALCorrEClusters->Fill(sumClusterEnergyEMCAL, sumClusterEnergyDCAL, GetEventWeight());
2483  fhEMCALDCALCorrNCells ->Fill(ncellsEMCAL , ncellsDCAL , GetEventWeight());
2484  fhEMCALDCALCorrECells ->Fill(sumCellEnergyEMCAL , sumCellEnergyDCAL , GetEventWeight());
2485 
2486  fhDCALPHOSCorrNClusters ->Fill(nclDCAL , nclPHOS , GetEventWeight());
2487  fhDCALPHOSCorrEClusters ->Fill(sumClusterEnergyDCAL , sumClusterEnergyPHOS, GetEventWeight());
2488  fhDCALPHOSCorrNCells ->Fill(ncellsDCAL , ncellsPHOS , GetEventWeight());
2489  fhDCALPHOSCorrECells ->Fill(sumCellEnergyDCAL , sumCellEnergyPHOS , GetEventWeight());
2490 
2491  Int_t v0S = GetV0Signal(0) + GetV0Signal(1);
2493  Int_t trM = GetTrackMultiplicity();
2494  Float_t cen = GetEventCentrality();
2495  Float_t ep = GetEventPlaneAngle();
2496 
2497  Int_t ncl = nclPHOS;
2498  Float_t sumClusterEnergy = sumClusterEnergyPHOS;
2499  Int_t ncells = ncellsPHOS;
2500  Float_t sumCellEnergy = sumCellEnergyPHOS;
2501 
2502  if ( GetCalorimeter() == kEMCAL )
2503  {
2504  ncl = nclEMCAL + nclDCAL;
2505  sumClusterEnergy = sumClusterEnergyEMCAL + sumClusterEnergyDCAL;
2506  ncells = ncellsEMCAL + ncellsDCAL;
2507  sumCellEnergy = sumCellEnergyEMCAL + sumCellEnergyDCAL;
2508  }
2509 
2510  fhCaloV0MCorrNClusters ->Fill(v0M, ncl , GetEventWeight());
2511  fhCaloV0MCorrEClusters ->Fill(v0M, sumClusterEnergy, GetEventWeight());
2512  fhCaloV0MCorrNCells ->Fill(v0M, ncells , GetEventWeight());
2513  fhCaloV0MCorrECells ->Fill(v0M, sumCellEnergy , GetEventWeight());
2514 
2515  fhCaloV0SCorrNClusters ->Fill(v0S, ncl , GetEventWeight());
2516  fhCaloV0SCorrEClusters ->Fill(v0S, sumClusterEnergy, GetEventWeight());
2517  fhCaloV0SCorrNCells ->Fill(v0S, ncells , GetEventWeight());
2518  fhCaloV0SCorrECells ->Fill(v0S, sumCellEnergy , GetEventWeight());
2519 
2520  fhCaloTrackMCorrNClusters->Fill(trM, ncl , GetEventWeight());
2521  fhCaloTrackMCorrEClusters->Fill(trM, sumClusterEnergy, GetEventWeight());
2522  fhCaloTrackMCorrNCells ->Fill(trM, ncells , GetEventWeight());
2523  fhCaloTrackMCorrECells ->Fill(trM, sumCellEnergy , GetEventWeight());
2524 
2525  fhCaloCenNClusters ->Fill(cen, ncl , GetEventWeight());
2526  fhCaloCenEClusters ->Fill(cen, sumClusterEnergy, GetEventWeight());
2527  fhCaloCenNCells ->Fill(cen, ncells , GetEventWeight());
2528  fhCaloCenECells ->Fill(cen, sumCellEnergy , GetEventWeight());
2529 
2530  fhCaloEvPNClusters ->Fill(ep , ncl , GetEventWeight());
2531  fhCaloEvPEClusters ->Fill(ep , sumClusterEnergy, GetEventWeight());
2532  fhCaloEvPNCells ->Fill(ep , ncells , GetEventWeight());
2533  fhCaloEvPECells ->Fill(ep , sumCellEnergy , GetEventWeight());
2534 
2535  AliDebug(1,"Correlate():");
2536  AliDebug(1,Form("\t EMCAL: N cells %d, N clusters %d, summed E cells %f, summed E clusters %f",
2537  ncellsEMCAL,nclEMCAL, sumCellEnergyEMCAL,sumClusterEnergyEMCAL));
2538  AliDebug(1,Form("\t DCAL : N cells %d, N clusters %d, summed E cells %f, summed E clusters %f",
2539  ncellsDCAL,nclDCAL, sumCellEnergyDCAL,sumClusterEnergyDCAL));
2540  AliDebug(1,Form("\t PHOS : N cells %d, N clusters %d, summed E cells %f, summed E clusters %f",
2541  ncellsPHOS,nclPHOS,sumCellEnergyPHOS,sumClusterEnergyPHOS));
2542  AliDebug(1,Form("\t V0 : Signal %d, Multiplicity %d, Track Multiplicity %d", v0S,v0M,trM));
2543  AliDebug(1,Form("\t centrality : %f, Event plane angle %f", cen,ep));
2544 }
2545 
2546 //_________________________________________________
2548 //_________________________________________________
2550 {
2551  TString parList ; //this will be list of parameters used for this analysis.
2552  const Int_t buffersize = 255;
2553  char onePar[buffersize] ;
2554 
2555  snprintf(onePar,buffersize,"--- AliAnaCalorimeterQA ---:") ;
2556  parList+=onePar ;
2557  snprintf(onePar,buffersize,"Calorimeter: %s;",GetCalorimeterString().Data()) ;
2558  parList+=onePar ;
2559  snprintf(onePar,buffersize,"Time Cut : %2.2f < T < %2.2f ns;",fTimeCutMin, fTimeCutMax) ;
2560  parList+=onePar ;
2561  snprintf(onePar,buffersize,"Cell Amplitude: PHOS > %2.2f GeV, EMCAL > %2.2f GeV;",fPHOSCellAmpMin, fEMCALCellAmpMin) ;
2562  parList+=onePar ;
2563  snprintf(onePar,buffersize,"Cluster M02: EMCAL > %2.2f ;",fEMCALClusterM02Min) ;
2564  parList+=onePar ;
2565  snprintf(onePar,buffersize,"N cells per cluster: PHOS >= %d, EMCAL >= %d;",fPHOSClusterNCellMin, fEMCALClusterNCellMin) ;
2566  parList+=onePar ;
2567  snprintf(onePar,buffersize,"Inv. Mass %2.1f < E_cl < %2.1f GeV;",fInvMassMinECut, fInvMassMaxECut) ;
2568  parList+=onePar ;
2569  snprintf(onePar,buffersize,"Inv. Mass %2.1f < M02 < %2.1f GeV;",fInvMassMinM02Cut, fInvMassMaxM02Cut) ;
2570  parList+=onePar ;
2571  snprintf(onePar,buffersize,"Cluster pair opening angle < %2.1f rad;",fInvMassMaxOpenAngle) ;
2572  parList+=onePar ;
2573  snprintf(onePar,buffersize,"Cluster pair time difference < %2.1f rad;",fInvMassMaxTimeDifference) ;
2574  parList+=onePar ;
2575 
2576  //Get parameters set in base class.
2577  //parList += GetBaseParametersList() ;
2578 
2579  //Get parameters set in FiducialCut class (not available yet)
2580  //parlist += GetFidCut()->GetFidCutParametersList()
2581 
2582  return new TObjString(parList) ;
2583 }
2584 
2585 //_________________________________________________________________________________
2587 //_________________________________________________________________________________
2589  AliVCluster *clus, AliVCaloCells* cells)
2590 {
2591  if(ampMax < 0.01)
2592  {
2593  AliDebug(1,Form("Low amplitude energy %f",ampMax));
2594  return;
2595  }
2596 
2597  Float_t l0 = clus->GetM02();
2598  Float_t l1 = clus->GetM20();
2599  Float_t en = clus->E();
2600  Int_t nc = clus->GetNCells();
2601  Double_t tmax = clus->GetTOF()*1.e9-fConstantTimeShift; // recalibrated elsewhere
2602 
2603  Float_t eCrossFrac = 1-GetECross(absIdMax,cells, 10000000)/ampMax;
2604 
2605  if(en > 5)
2606  {
2607  fhExoL0ECross->Fill(eCrossFrac, l0, GetEventWeight());
2608  fhExoL1ECross->Fill(eCrossFrac, l1, GetEventWeight());
2609  }
2610 
2611  for(Int_t ie = 0; ie < fExoNECrossCuts; ie++)
2612  {
2613  for(Int_t idt = 0; idt < fExoNDTimeCuts; idt++)
2614  {
2615  eCrossFrac = 1-GetECross(absIdMax,cells, fExoDTimeCuts[idt])/ampMax;
2616 
2617  if(eCrossFrac > fExoECrossCuts[ie])
2618  {
2619  // Exotic
2620  fhExoL0 [ie][idt]->Fill(en,l0 , GetEventWeight());
2621  fhExoL1 [ie][idt]->Fill(en,l1 , GetEventWeight());
2622  fhExoTime [ie][idt]->Fill(en,tmax, GetEventWeight());
2623 
2624  if(en > 5)
2625  {
2626  fhExoL0NCell[ie][idt]->Fill(nc, l0, GetEventWeight());
2627  fhExoL1NCell[ie][idt]->Fill(nc, l1, GetEventWeight());
2628  }
2629 
2630  // Diff time, do for one cut in time
2631  if(idt == 0)
2632  {
2633  for (Int_t icell = 0; icell < clus->GetNCells(); icell++)
2634  {
2635  Int_t absId = clus->GetCellsAbsId()[icell];
2636  Double_t time = cells->GetCellTime(absId);
2637  GetCaloUtils()->RecalibrateCellTime(time, GetCalorimeter(), absId,GetReader()->GetInputEvent()->GetBunchCrossNumber());
2638  time *= 1e9;
2639  time -= fConstantTimeShift;
2640 
2641  Float_t diff = tmax-time;
2642  fhExoDTime[ie]->Fill(en, diff, GetEventWeight());
2643  }
2644  }
2645  }
2646  else
2647  {
2648  fhExoECross[ie][idt]->Fill(en, eCrossFrac, GetEventWeight());
2649  fhExoNCell [ie][idt]->Fill(en, nc , GetEventWeight());
2650  }
2651  } // D time cut loop
2652  } // e cross cut loop
2653 }
2654 
2655 //___________________________________________________
2658 //___________________________________________________
2660 {
2661  TList * outputContainer = new TList() ;
2662  outputContainer->SetName("QAHistos") ;
2663 
2664  // Init the number of modules, set in the class AliCalorimeterUtils
2665 
2667  if(GetCalorimeter()==kPHOS && fNModules > 4) fNModules = 4;
2668 
2669  // Histogram binning and ranges
2670 
2691 
2695 
2696  // Calorimeter grid
2697 
2698  // EMCAL
2699  fNMaxCols = 48;
2700  fNMaxRows = 24;
2701  fNRCU = 2 ;
2702  // PHOS
2703  if(GetCalorimeter()==kPHOS)
2704  {
2705  fNMaxCols = 56;
2706  fNMaxRows = 64;
2707  fNRCU = 4 ;
2708  }
2709 
2710 
2711  // Init histograms
2712 
2713  fhE = new TH1F ("hE","#it{E} reconstructed clusters ", nptbins*5,ptmin,ptmax*5);
2714  fhE->SetXTitle("#it{E} (GeV)");
2715  outputContainer->Add(fhE);
2716 
2717  fhPt = new TH1F ("hPt","#it{p}_{T} reconstructed clusters", nptbins,ptmin,ptmax);
2718  fhPt->SetXTitle("#it{p}_{T} (GeV/#it{c})");
2719  outputContainer->Add(fhPt);
2720 
2721  fhPhi = new TH1F ("hPhi","#varphi reconstructed clusters ",nphibins,phimin,phimax);
2722  fhPhi->SetXTitle("#varphi (rad)");
2723  outputContainer->Add(fhPhi);
2724 
2725  fhEta = new TH1F ("hEta","#eta reconstructed clusters ",netabins,etamin,etamax);
2726  fhEta->SetXTitle("#eta ");
2727  outputContainer->Add(fhEta);
2728 
2730  {
2731  if(fFillAllTH3)
2732  {
2733  fhEtaPhiE = new TH3F ("hEtaPhiE","#eta vs #varphi vs energy, reconstructed clusters",
2734  netabins,etamin,etamax,nphibins,phimin,phimax,nptbins,ptmin,ptmax);
2735  fhEtaPhiE->SetXTitle("#eta ");
2736  fhEtaPhiE->SetYTitle("#varphi (rad)");
2737  fhEtaPhiE->SetZTitle("#it{E} (GeV) ");
2738  outputContainer->Add(fhEtaPhiE);
2739  }
2740  else
2741  {
2742  fhEtaPhi = new TH2F ("hEtaPhi","#eta vs #varphi for #it{E} > 0.5 GeV, reconstructed clusters",
2743  netabins,etamin,etamax,nphibins,phimin,phimax);
2744  fhEtaPhi->SetXTitle("#eta ");
2745  fhEtaPhi->SetYTitle("#varphi (rad)");
2746  outputContainer->Add(fhEtaPhi);
2747  }
2748  }
2749 
2750  fhClusterTimeEnergy = new TH2F ("hClusterTimeEnergy","energy vs TOF, reconstructed clusters",
2751  nptbins,ptmin,ptmax, ntimebins,timemin,timemax);
2752  fhClusterTimeEnergy->SetXTitle("#it{E} (GeV) ");
2753  fhClusterTimeEnergy->SetYTitle("TOF (ns)");
2754  outputContainer->Add(fhClusterTimeEnergy);
2755 
2756  fhClusterPairDiffTimeE = new TH2F("hClusterPairDiffTimeE","cluster pair time difference vs E, only good clusters",
2757  nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
2758  fhClusterPairDiffTimeE->SetXTitle("#it{E}_{cluster} (GeV)");
2759  fhClusterPairDiffTimeE->SetYTitle("#Delta #it{t} (ns)");
2760  outputContainer->Add(fhClusterPairDiffTimeE);
2761 
2762  fhClusterPairDiffTimeESameMod = new TH2F("hClusterPairDiffTimeESameMod","cluster pair time difference vs E, only good clusters",
2763  nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
2764  fhClusterPairDiffTimeESameMod->SetXTitle("#it{E}_{cluster} (GeV)");
2765  fhClusterPairDiffTimeESameMod->SetYTitle("#Delta #it{t} (ns)");
2766  outputContainer->Add(fhClusterPairDiffTimeESameMod);
2767 
2768 //fhDispersion = new TH2F ("hDispersion","shower shape, Dispersion^{2} vs E for bad cluster ",
2769 // nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2770 //fhDispersion->SetXTitle("#it{E}_{cluster} (GeV)");
2771 //fhDispersion->SetYTitle("Dispersion");
2772 //outputContainer->Add(fhDispersion);
2773 
2774  fhLambda0 = new TH2F ("hLambda0","shower shape, #lambda^{2}_{0} vs E",
2775  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2776  fhLambda0->SetXTitle("#it{E}_{cluster} (GeV)");
2777  fhLambda0->SetYTitle("#lambda^{2}_{0}");
2778  outputContainer->Add(fhLambda0);
2779 
2780  fhLambda1 = new TH2F ("hLambda1","shower shape, #lambda^{2}_{1} vs E",
2781  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2782  fhLambda1->SetXTitle("#it{E}_{cluster} (GeV)");
2783  fhLambda1->SetYTitle("#lambda^{2}_{1}");
2784  outputContainer->Add(fhLambda1);
2785 
2787  {
2788  fhLambda0MaxFECPair = new TH2F ("hLambda0MaxFECPair","#lambda^{2}_{0} vs E, FEC pair eta column",
2789  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2790  fhLambda0MaxFECPair->SetXTitle("#it{E}_{cluster}");
2791  fhLambda0MaxFECPair->SetYTitle("#lambda^{2}_{0}");
2792  outputContainer->Add(fhLambda0MaxFECPair);
2793 
2794  fhLambda1MaxFECPair = new TH2F ("hLambda1MaxFECPair","#lambda^{2}_{1} vs E, FEC pair eta column",
2795  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2796  fhLambda1MaxFECPair->SetXTitle("#it{E}_{cluster}");
2797  fhLambda1MaxFECPair->SetYTitle("#lambda^{2}_{1}");
2798  outputContainer->Add(fhLambda1MaxFECPair);
2799 
2800  fhLambda0Max2FECPair = new TH2F ("hLambda0Max2FECPair","#lambda^{2}_{0} vs E, FEC pair eta column, 2 highest cells corr.",
2801  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2802  fhLambda0Max2FECPair->SetXTitle("#it{E}_{cluster}");
2803  fhLambda0Max2FECPair->SetYTitle("#lambda^{2}_{0}");
2804  outputContainer->Add(fhLambda0Max2FECPair);
2805 
2806  fhLambda1Max2FECPair = new TH2F ("hLambda1Max2FECPair","#lambda^{2}_{1} vs E, FEC pair eta column, 2 highest cells corr.",
2807  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2808  fhLambda1Max2FECPair->SetXTitle("#it{E}_{cluster}");
2809  fhLambda1Max2FECPair->SetYTitle("#lambda^{2}_{1}");
2810  outputContainer->Add(fhLambda1Max2FECPair);
2811 
2812  fhLambda0MaxFECOdd = new TH2F ("hLambda0MaxFECOdd","#lambda^{2}_{0} vs E, FEC odd eta column",
2813  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2814  fhLambda0MaxFECOdd->SetXTitle("#it{E}_{cluster}");
2815  fhLambda0MaxFECOdd->SetYTitle("#lambda^{2}_{0}");
2816  outputContainer->Add(fhLambda0MaxFECOdd);
2817 
2818  fhLambda1MaxFECOdd = new TH2F ("hLambda1MaxFECOdd","#lambda^{2}_{1} vs E, FEC odd eta column",
2819  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2820  fhLambda1MaxFECOdd->SetXTitle("#it{E}_{cluster}");
2821  fhLambda1MaxFECOdd->SetYTitle("#lambda^{2}_{1}");
2822  outputContainer->Add(fhLambda1MaxFECOdd);
2823 
2824  fhLambda0Max2FECOdd = new TH2F ("hLambda0Max2FECOdd","#lambda^{2}_{0} vs E, FEC odd eta column, 2 highest cells corr.",
2825  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2826  fhLambda0Max2FECOdd->SetXTitle("#it{E}_{cluster}");
2827  fhLambda0Max2FECOdd->SetYTitle("#lambda^{2}_{0}");
2828  outputContainer->Add(fhLambda0Max2FECOdd);
2829 
2830  fhLambda1Max2FECOdd = new TH2F ("hLambda1Max2FECOdd","#lambda^{2}_{1} vs E, FEC odd eta column, 2 highest cells corr.",
2831  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2832  fhLambda1Max2FECOdd->SetXTitle("#it{E}_{cluster}");
2833  fhLambda1Max2FECOdd->SetYTitle("#lambda^{2}_{1}");
2834  outputContainer->Add(fhLambda1Max2FECOdd);
2835 
2836  fhLambda0MaxFECPairLargeNCells = new TH2F ("hLambda0MaxFECPair_LargeNCells","#lambda^{2}_{0} vs E, FEC pair eta column, ncell>5",
2837  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2838  fhLambda0MaxFECPairLargeNCells->SetXTitle("#it{E}_{cluster}");
2839  fhLambda0MaxFECPairLargeNCells->SetYTitle("#lambda^{2}_{0}");
2840  outputContainer->Add(fhLambda0MaxFECPairLargeNCells);
2841 
2842  fhLambda1MaxFECPairLargeNCells = new TH2F ("hLambda1MaxFECPair_LargeNCells","#lambda^{2}_{1} vs E, FEC pair eta column, ncell>5",
2843  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2844  fhLambda1MaxFECPairLargeNCells->SetXTitle("#it{E}_{cluster}");
2845  fhLambda1MaxFECPairLargeNCells->SetYTitle("#lambda^{2}_{1}");
2846  outputContainer->Add(fhLambda1MaxFECPairLargeNCells);
2847 
2848  fhLambda0Max2FECPairLargeNCells = new TH2F ("hLambda0Max2FECPair_LargeNCells","#lambda^{2}_{0} vs E, FEC pair eta column, 2 highest cells corr., ncell>5",
2849  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2850  fhLambda0Max2FECPairLargeNCells->SetXTitle("#it{E}_{cluster}");
2851  fhLambda0Max2FECPairLargeNCells->SetYTitle("#lambda^{2}_{0}");
2852  outputContainer->Add(fhLambda0Max2FECPairLargeNCells);
2853 
2854  fhLambda1Max2FECPairLargeNCells = new TH2F ("hLambda1Max2FECPair_LargeNCells","#lambda^{2}_{1} vs E, FEC pair eta column, 2 highest cells corr., ncell>5",
2855  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2856  fhLambda1Max2FECPairLargeNCells->SetXTitle("#it{E}_{cluster}");
2857  fhLambda1Max2FECPairLargeNCells->SetYTitle("#lambda^{2}_{1}");
2858  outputContainer->Add(fhLambda1Max2FECPairLargeNCells);
2859 
2860  fhLambda0MaxFECOddLargeNCells = new TH2F ("hLambda0MaxFECOdd_LargeNCells","#lambda^{2}_{0} vs E, FEC odd eta column, ncell>5",
2861  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2862  fhLambda0MaxFECOddLargeNCells->SetXTitle("#it{E}_{cluster}");
2863  fhLambda0MaxFECOddLargeNCells->SetYTitle("#lambda^{2}_{0}");
2864  outputContainer->Add(fhLambda0MaxFECOddLargeNCells);
2865 
2866  fhLambda1MaxFECOddLargeNCells = new TH2F ("hLambda1MaxFECOdd_LargeNCells","#lambda^{2}_{1} vs E, FEC odd eta column, ncell>5",
2867  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2868  fhLambda1MaxFECOddLargeNCells->SetXTitle("#it{E}_{cluster}");
2869  fhLambda1MaxFECOddLargeNCells->SetYTitle("#lambda^{2}_{1}");
2870  outputContainer->Add(fhLambda1MaxFECOddLargeNCells);
2871 
2872  fhLambda0Max2FECOddLargeNCells = new TH2F ("hLambda0Max2FECOdd_LargeNCells","#lambda^{2}_{0} vs E, FEC odd eta column, 2 highest cells corr., ncell>5",
2873  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2874  fhLambda0Max2FECOddLargeNCells->SetXTitle("#it{E}_{cluster}");
2875  fhLambda0Max2FECOddLargeNCells->SetYTitle("#lambda^{2}_{0}");
2876  outputContainer->Add(fhLambda0Max2FECOddLargeNCells);
2877 
2878  fhLambda1Max2FECOddLargeNCells = new TH2F ("hLambda1Max2FECOdd_LargeNCells","#lambda^{2}_{1} vs E, FEC odd eta column, 2 highest cells corr., ncell>5",
2879  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2880  fhLambda1Max2FECOddLargeNCells->SetXTitle("#it{E}_{cluster}");
2881  fhLambda1Max2FECOddLargeNCells->SetYTitle("#lambda^{2}_{1}");
2882  outputContainer->Add(fhLambda1Max2FECOddLargeNCells);
2883 
2884 
2885  TString titleMaxFEC[] =
2886  {"No correlation with main cell", "Main cell corr. with near cell",
2887  "Main cell corr. with far cell", "Main cell corr. with near and far"};
2888 
2889  TString titleFEC[] =
2890  {"No main cell corr., no other inside cluster" , "No main cell corr., 1 cell correl in cluster" , "No main cell corr., >=2 cell correl in cluster",
2891  "Main cell corr. & no other inside cluster" , "Main cell corr. & 1 cell corr. inside cluster", "Main cell corr. & >=2 cell corr. inside cluster"};
2892 
2893  fhEtaPhiFECCorrControl = new TH2F ("hEtaPhiFECCorrControl","#eta vs #varphi for FEC correlation selected clusters",
2894  netabins,etamin,etamax,nphibins,phimin,phimax);
2895  fhEtaPhiFECCorrControl->SetXTitle("#eta ");
2896  fhEtaPhiFECCorrControl->SetYTitle("#varphi (rad)");
2897  outputContainer->Add(fhEtaPhiFECCorrControl);
2898 
2899  for(Int_t i = 0; i < 4; i++)
2900  {
2901  fhLambda0MaxFECCorrel[i] = new TH2F
2902  (Form("hLambda0MaxFECCorrel_Case%d",i),
2903  Form("#lambda^{2}_{0} vs E, Max FEC correl %s",titleMaxFEC[i].Data()),
2904  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2905  fhLambda0MaxFECCorrel[i]->SetXTitle("#it{E}_{cluster}");
2906  fhLambda0MaxFECCorrel[i]->SetYTitle("#lambda^{2}_{0}");
2907  outputContainer->Add(fhLambda0MaxFECCorrel[i]);
2908 
2909  fhLambda1MaxFECCorrel[i] = new TH2F
2910  (Form("hLambda1MaxFECCorrel_Case%d",i),
2911  Form("#lambda^{2}_{1} vs E for bad cluster, Max FEC correl %s",titleMaxFEC[i].Data()),
2912  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2913  fhLambda1MaxFECCorrel[i]->SetXTitle("#it{E}_{cluster}");
2914  fhLambda1MaxFECCorrel[i]->SetYTitle("#lambda^{2}_{1}");
2915  outputContainer->Add(fhLambda1MaxFECCorrel[i]);
2916 
2918  (Form("hLambda0MaxFECCorrel_Case%d_LargeNCells",i),
2919  Form("#lambda^{2}_{0} vs E, Max FEC correl %s, ncells>5",titleMaxFEC[i].Data()),
2920  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2921  fhLambda0MaxFECCorrelLargeNCells[i]->SetXTitle("#it{E}_{cluster}");
2922  fhLambda0MaxFECCorrelLargeNCells[i]->SetYTitle("#lambda^{2}_{0}");
2923  outputContainer->Add(fhLambda0MaxFECCorrelLargeNCells[i]);
2924 
2926  (Form("hLambda1MaxFECCorrel_Case%d_LargeNCells",i),
2927  Form("#lambda^{2}_{1} vs E for bad cluster, Max FEC correl %s, ncells>5",titleMaxFEC[i].Data()),
2928  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2929  fhLambda1MaxFECCorrelLargeNCells[i]->SetXTitle("#it{E}_{cluster}");
2930  fhLambda1MaxFECCorrelLargeNCells[i]->SetYTitle("#lambda^{2}_{1}");
2931  outputContainer->Add(fhLambda1MaxFECCorrelLargeNCells[i]);
2932  }
2933 
2934  for(Int_t i = 0; i < 6; i++)
2935  {
2936  fhLambda0FECCorrel[i] = new TH2F
2937  (Form("hLambda0FECCorrel_Case%d",i),
2938  Form("#lambda^{2}_{0} vs E, %s",titleFEC[i].Data()),
2939  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2940  fhLambda0FECCorrel[i]->SetXTitle("#it{E}_{cluster}");
2941  fhLambda0FECCorrel[i]->SetYTitle("#lambda^{2}_{0}");
2942  outputContainer->Add(fhLambda0FECCorrel[i]);
2943 
2944  fhLambda1FECCorrel[i] = new TH2F
2945  (Form("hLambda1FECCorrel_Case%d",i),
2946  Form("#lambda^{2}_{1} vs E for bad cluster, %s",titleFEC[i].Data()),
2947  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2948  fhLambda1FECCorrel[i]->SetXTitle("#it{E}_{cluster}");
2949  fhLambda1FECCorrel[i]->SetYTitle("#lambda^{2}_{1}");
2950  outputContainer->Add(fhLambda1FECCorrel[i]);
2951 
2953  (Form("hLambda0FECCorrel_Case%d_LargeNCells",i),
2954  Form("#lambda^{2}_{0} vs E, %s, ncells>5",titleFEC[i].Data()),
2955  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2956  fhLambda0FECCorrelLargeNCells[i]->SetXTitle("#it{E}_{cluster}");
2957  fhLambda0FECCorrelLargeNCells[i]->SetYTitle("#lambda^{2}_{0}");
2958  outputContainer->Add(fhLambda0FECCorrelLargeNCells[i]);
2959 
2961  (Form("hLambda1FECCorrel_Case%d_LargeNCells",i),
2962  Form("#lambda^{2}_{1} vs E for bad cluster, %s, ncells>5",titleFEC[i].Data()),
2963  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2964  fhLambda1FECCorrelLargeNCells[i]->SetXTitle("#it{E}_{cluster}");
2965  fhLambda1FECCorrelLargeNCells[i]->SetYTitle("#lambda^{2}_{1}");
2966  outputContainer->Add(fhLambda1FECCorrelLargeNCells[i]);
2967  }
2968 
2969  }
2970 
2972  {
2973  fhEtaPhiTCardCorrNoSelection = new TH2F ("hEtaPhiTCardCorrNoSelection","#eta vs #varphi for TCard correlation selected clusters",
2974  netabins,etamin,etamax,nphibins,phimin,phimax);
2975  fhEtaPhiTCardCorrNoSelection->SetXTitle("#eta ");
2976  fhEtaPhiTCardCorrNoSelection->SetYTitle("#varphi (rad)");
2977  outputContainer->Add(fhEtaPhiTCardCorrNoSelection);
2978 
2980  ("hNCellsTCardCorrNoSelection","# custer # cells vs #it{E}",nptbins,ptmin,ptmax, nceclbins,nceclmin,nceclmax);
2981  fhNCellsTCardCorrNoSelection->SetXTitle("#it{E} (GeV)");
2982  fhNCellsTCardCorrNoSelection->SetYTitle("#it{n}_{cells}");
2983  outputContainer->Add(fhNCellsTCardCorrNoSelection);
2984 
2986  ("hNCellsTCardCorrWithWeightNoSelection","custer # cells vs #it{E}, w > 0.01",nptbins,ptmin,ptmax, nceclbins,nceclmin,nceclmax);
2987  fhNCellsTCardCorrWithWeightNoSelection->SetXTitle("#it{E} (GeV)");
2988  fhNCellsTCardCorrWithWeightNoSelection->SetYTitle("#it{n}_{cells}");
2989  outputContainer->Add(fhNCellsTCardCorrWithWeightNoSelection);
2990 
2992  ("hNCellsTCardCorrRatioWithWeightNoSelection","custer # cells vs #it{E}, w > 0.01",nptbins,ptmin,ptmax, 100,0,1);
2993  fhNCellsTCardCorrRatioWithWeightNoSelection->SetXTitle("#it{E} (GeV)");
2994  fhNCellsTCardCorrRatioWithWeightNoSelection->SetYTitle("#it{n}^{w>0.01]_{cells} / #it{n}_{cells}");
2995  outputContainer->Add(fhNCellsTCardCorrRatioWithWeightNoSelection);
2996 
2997  fhLambda0TCardCorrNoSelection = new TH2F ("hLambda0TCardCorrNoSelection","#lambda^{2}_{0} vs #it{E}",
2998  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
2999  fhLambda0TCardCorrNoSelection->SetXTitle("#it{E} (GeV)");
3000  fhLambda0TCardCorrNoSelection->SetYTitle("#lambda^{2}_{0}");
3001  outputContainer->Add(fhLambda0TCardCorrNoSelection);
3002 
3003  for(Int_t i = 0; i < 6; i++)
3004  {
3005  fhLambda0TCardCorrelN[i] = new TH2F
3006  (Form("hLambda0TCardCorrelN_Case%d",i),
3007  Form("#lambda^{2}_{0} vs #it{E}, max E cell correl with TCard cell, N corr = %d",i),
3008  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3009  fhLambda0TCardCorrelN[i]->SetXTitle("#it{E} (GeV)");
3010  fhLambda0TCardCorrelN[i]->SetYTitle("#lambda^{2}_{0}");
3011  outputContainer->Add(fhLambda0TCardCorrelN[i]);
3012 
3013  fhNCellsTCardCorrelN[i] = new TH2F
3014  (Form("hNCellsTCardCorrelN_Case%d",i),
3015  Form("custer # cells vs #it{E}, w > 0.01, max E cell correl with TCard cell, N corr = %d", i),
3016  nptbins,ptmin,ptmax, nceclbins,nceclmin,nceclmax);
3017  fhNCellsTCardCorrelN[i]->SetXTitle("#it{E} (GeV)");
3018  fhNCellsTCardCorrelN[i]->SetYTitle("#it{n}_{cells}");
3019  outputContainer->Add(fhNCellsTCardCorrelN[i]);
3020 
3022  (Form("hLambda0TCardCorrelN_Exotic_Case%d",i),
3023  Form("#lambda^{2}_{0} vs #it{E}, max E cell correl with TCard cell, exo > 0.97, N corr = %d",i),
3024  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3025  fhLambda0TCardCorrelNExotic[i]->SetXTitle("#it{E} (GeV)");
3026  fhLambda0TCardCorrelNExotic[i]->SetYTitle("#lambda^{2}_{0}");
3027  outputContainer->Add(fhLambda0TCardCorrelNExotic[i]);
3028 
3030  (Form("hNCellsTCardCorrelN_Exotic_Case%d",i),
3031  Form("custer # cells vs #it{E}, w > 0.01, max E cell correl with TCard cell, exo > 0.97, N corr = %d", i),
3032  nptbins,ptmin,ptmax, nceclbins,nceclmin,nceclmax);
3033  fhNCellsTCardCorrelNExotic[i]->SetXTitle("#it{E} (GeV)");
3034  fhNCellsTCardCorrelNExotic[i]->SetYTitle("#it{n}_{cells}");
3035  outputContainer->Add(fhNCellsTCardCorrelNExotic[i]);
3036  }
3037 
3038  for(Int_t i = 0; i < 7; i++)
3039  {
3040  fhLambda0TCardCorrel[i] = new TH2F
3041  (Form("hLambda0TCardCorrel_Case%d",i),
3042  Form("#lambda^{2}_{0} vs #it{E}, max E cell correl with TCard cell, case %d",i),
3043  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3044  fhLambda0TCardCorrel[i]->SetXTitle("#it{E} (GeV)");
3045  fhLambda0TCardCorrel[i]->SetYTitle("#lambda^{2}_{0}");
3046  outputContainer->Add(fhLambda0TCardCorrel[i]);
3047 
3048  fhNCellsTCardCorrel[i] = new TH2F
3049  (Form("hNCellsTCardCorrel_Case%d",i),
3050  Form("custer # cells vs #it{E}, w > 0.01, max E cell correl with TCard cell, case %d", i),
3051  nptbins,ptmin,ptmax, nceclbins,nceclmin,nceclmax);
3052  fhNCellsTCardCorrel[i]->SetXTitle("#it{E} (GeV)");
3053  fhNCellsTCardCorrel[i]->SetYTitle("#it{n}_{cells}");
3054  outputContainer->Add(fhNCellsTCardCorrel[i]);
3055  }
3056 
3057  for(Int_t i = 0; i < 4; i++)
3058  {
3060  (Form("hLambda0TCardCorrel_Exotic_Case%d",i),
3061  Form("#lambda^{2}_{0} vs #it{E}, max E cell correl with TCard cell, exo>0.97, case %d",i),
3062  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3063  fhLambda0TCardCorrelExotic[i]->SetXTitle("#it{E} (GeV)");
3064  fhLambda0TCardCorrelExotic[i]->SetYTitle("#lambda^{2}_{0}");
3065  outputContainer->Add(fhLambda0TCardCorrelExotic[i]);
3066 
3068  (Form("hNCellsTCardCorrel_Exotic_Case%d",i),
3069  Form("custer # cells vs #it{E}, w > 0.01, max E cell correl with TCard cell, exot > 0.97,case %d", i),
3070  nptbins,ptmin,ptmax, nceclbins,nceclmin,nceclmax);
3071  fhNCellsTCardCorrelExotic[i]->SetXTitle("#it{E} (GeV)");
3072  fhNCellsTCardCorrelExotic[i]->SetYTitle("#it{n}_{cells}");
3073  outputContainer->Add(fhNCellsTCardCorrelExotic[i]);
3074  }
3075 
3076  for(Int_t i = 0; i < 6; i++)
3077  {
3079  (Form("hLambda0TCardCorrelNearRow_Case%d",i),
3080  Form("#lambda^{2}_{0} vs #it{E}, max E cell correl with TCard cell, one TCard cell is 1 row away, case %d",i),
3081  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3082  fhLambda0TCardCorrelNearRow[i]->SetXTitle("#it{E} (GeV)");
3083  fhLambda0TCardCorrelNearRow[i]->SetYTitle("#lambda^{2}_{0}");
3084  outputContainer->Add(fhLambda0TCardCorrelNearRow[i]);
3085 
3087  (Form("hNCellsTCardCorrelNearRow_Case%d",i),
3088  Form("custer # cells vs #it{E}, w > 0.01, max E cell correl with TCard cell, case %d", i),
3089  nptbins,ptmin,ptmax, nceclbins,nceclmin,nceclmax);
3090  fhNCellsTCardCorrelNearRow[i]->SetXTitle("#it{E} (GeV)");
3091  fhNCellsTCardCorrelNearRow[i]->SetYTitle("#it{n}_{cells}");
3092  outputContainer->Add(fhNCellsTCardCorrelNearRow[i]);
3093  }
3094 
3095  for(Int_t i = 0; i < 4; i++)
3096  {
3098  (Form("hLambda0TCardCorrel2ndMax_Case%d",i),
3099  Form("#lambda^{2}_{0} vs #it{E}, max E cell correl with 2nd max TCard cell, case %d",i),
3100  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3101  fhLambda0TCardCorrel2ndMax[i]->SetXTitle("#it{E} (GeV)");
3102  fhLambda0TCardCorrel2ndMax[i]->SetYTitle("#lambda^{2}_{0}");
3103  outputContainer->Add(fhLambda0TCardCorrel2ndMax[i]);
3104 
3106  (Form("hNCellsTCardCorrel2ndMax_Case%d",i),
3107  Form("custer # cells vs #it{E}, w > 0.01, max E cell correl with 2nd max TCard cell, case %d", i),
3108  nptbins,ptmin,ptmax, nceclbins,nceclmin,nceclmax);
3109  fhNCellsTCardCorrel2ndMax[i]->SetXTitle("#it{E} (GeV)");
3110  fhNCellsTCardCorrel2ndMax[i]->SetYTitle("#it{n}_{cells}");
3111  outputContainer->Add(fhNCellsTCardCorrel2ndMax[i]);
3112  }
3113 
3114  for(Int_t i = 0; i < 7; i++)
3115  {
3117  (Form("hLambda0TCardCorrelOtherTCard_Case%d",i),
3118  Form("#lambda^{2}_{0} vs #it{E}, correlation of cells in different TCards, case %d",i),
3119  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3120  fhLambda0TCardCorrelOtherTCard[i]->SetXTitle("#it{E} (GeV)");
3121  fhLambda0TCardCorrelOtherTCard[i]->SetYTitle("#lambda^{2}_{0}");
3122  outputContainer->Add(fhLambda0TCardCorrelOtherTCard[i]);
3123 
3125  (Form("hNCellsTCardCorrelOtherTCard_Case%d",i),
3126  Form("custer # cells vs #it{E}, w > 0.01, correlation of cells in different TCards, case %d", i),
3127  nptbins,ptmin,ptmax, nceclbins,nceclmin,nceclmax);
3128  fhNCellsTCardCorrelOtherTCard[i]->SetXTitle("#it{E} (GeV)");
3129  fhNCellsTCardCorrelOtherTCard[i]->SetYTitle("#it{n}_{cells}");
3130  outputContainer->Add(fhNCellsTCardCorrelOtherTCard[i]);
3131  }
3132 
3133  for(Int_t i = 0; i < 12; i++)
3134  {
3135  fhTCardCorrECellMaxDiff[i] = new TH2F
3136  (Form("hTCardCorrECellMaxDiff_Case%d",i),
3137  Form("#it{E}_{cell}^{max}-#it{E}_{cell} vs #it{E}_{cluster}, for (un)correlated cells in TCard, case %d",i),
3138  nptbins,ptmin,ptmax,210,-1,20);
3139  fhTCardCorrECellMaxDiff[i]->SetXTitle("#it{E} (GeV)");
3140  fhTCardCorrECellMaxDiff[i]->SetYTitle("#it{E}_{cell}^{max}-#it{E}_{cell} (GeV)");
3141  outputContainer->Add(fhTCardCorrECellMaxDiff[i]);
3142 
3143  fhTCardCorrEClusterDiff[i] = new TH2F
3144  (Form("hTCardCorrEClusterDiff_Case%d",i),
3145  Form("#it{E}_{cluster}-#it{E}_{cell} vs #it{E}_{cluster}, for (un)correlated cells in TCard, case %d",i),
3146  nptbins,ptmin,ptmax,210,-1,20);
3147  fhTCardCorrEClusterDiff[i]->SetXTitle("#it{E} (GeV)");
3148  fhTCardCorrEClusterDiff[i]->SetYTitle("#it{E}_{cluster}-#it{E}_{cell} (GeV)");
3149  outputContainer->Add(fhTCardCorrEClusterDiff[i]);
3150 
3151  fhTCardCorrECellMaxRat[i] = new TH2F
3152  (Form("hTCardCorrECellMaxRat_Case%d",i),
3153  Form("#it{E}_{cell}/#it{E}_{cell}^{max} vs #it{E}_{cluster}, for (un)correlated cells in TCard, case %d",i),
3154  nptbins,ptmin,ptmax,110,0,1.1);
3155  fhTCardCorrECellMaxRat[i]->SetXTitle("#it{E} (GeV)");
3156  fhTCardCorrECellMaxRat[i]->SetYTitle("#it{E}_{cell}/#it{E}^{max}_{cell}");
3157  outputContainer->Add(fhTCardCorrECellMaxRat[i]);
3158 
3159  fhTCardCorrEClusterRat[i] = new TH2F
3160  (Form("hTCardCorrEClusterRat_Case%d",i),
3161  Form("#it{E}_{cell}/#it{E}_{cluster} vs #it{E}_{cluster}, for (un)correlated cells in TCard, case %d",i),
3162  nptbins,ptmin,ptmax,110,0,1.1);
3163  fhTCardCorrEClusterRat[i]->SetXTitle("#it{E} (GeV)");
3164  fhTCardCorrEClusterRat[i]->SetYTitle("#it{E}_{cell}/#it{E}_{cluster}");
3165  outputContainer->Add(fhTCardCorrEClusterRat[i]);
3166 
3167  fhTCardCorrTCellMaxDiff[i] = new TH2F
3168  (Form("hTCardCorrTCellMaxDiff_Case%d",i),
3169  Form("#it{t}_{cell}^{max}-#it{t}_{cell} vs #it{E}_{cluster}, for (un)correlated cells in TCard, case %d",i),
3170  nptbins,ptmin,ptmax,1000,-100,100);
3171  fhTCardCorrTCellMaxDiff[i]->SetXTitle("#it{E} (GeV)");
3172  fhTCardCorrTCellMaxDiff[i]->SetYTitle("#it{t}_{cell}^{max}-#it{t}_{cell} (ns)");
3173  outputContainer->Add(fhTCardCorrTCellMaxDiff[i]);
3174  }
3175  } // TCard correlation studies
3176 
3177 
3178  fhClusterMaxCellCloseCellRatio = new TH2F ("hClusterMaxCellCloseCellRatio","energy vs ratio of max cell / neighbour cell, reconstructed clusters",
3179  nptbins,ptmin,ptmax, 100,0,1.);
3180  fhClusterMaxCellCloseCellRatio->SetXTitle("#it{E}_{cluster} (GeV) ");
3181  fhClusterMaxCellCloseCellRatio->SetYTitle("#it{E}_{cell i}/#it{E}_{cell max}");
3182  outputContainer->Add(fhClusterMaxCellCloseCellRatio);
3183 
3184  fhClusterMaxCellCloseCellDiff = new TH2F ("hClusterMaxCellCloseCellDiff","energy vs ratio of max cell / neighbour cell, reconstructed clusters",
3185  nptbins,ptmin,ptmax, 500,0,100.);
3186  fhClusterMaxCellCloseCellDiff->SetXTitle("#it{E}_{cluster} (GeV) ");
3187  fhClusterMaxCellCloseCellDiff->SetYTitle("#it{E}_{cell max}-#it{E}_{cell i} (GeV)");
3188  outputContainer->Add(fhClusterMaxCellCloseCellDiff);
3189 
3190  fhClusterMaxCellDiff = new TH2F ("hClusterMaxCellDiff","energy vs difference of cluster energy - max cell energy / cluster energy, good clusters",
3191  nptbins,ptmin,ptmax, 500,0,1.);
3192  fhClusterMaxCellDiff->SetXTitle("#it{E}_{cluster} (GeV) ");
3193  fhClusterMaxCellDiff->SetYTitle("(#it{E}_{cluster} - #it{E}_{cell max})/ #it{E}_{cluster}");
3194  outputContainer->Add(fhClusterMaxCellDiff);
3195 
3196  if(fStudyBadClusters)
3197  {
3198  fhClusterMaxCellDiffNoCut = new TH2F ("hClusterMaxCellDiffNoCut","energy vs difference of cluster energy - max cell energy / cluster energy",
3199  nptbins,ptmin,ptmax, 500,0,1.);
3200  fhClusterMaxCellDiffNoCut->SetXTitle("#it{E}_{cluster} (GeV) ");
3201  fhClusterMaxCellDiffNoCut->SetYTitle("(#it{E}_{cluster} - #it{E}_{cell max})/ #it{E}_{cluster}");
3202  outputContainer->Add(fhClusterMaxCellDiffNoCut);
3203  }
3204 
3205  fhClusterMaxCellECross = new TH2F ("hClusterMaxCellECross","1 - Energy in cross around max energy cell / max energy cell vs cluster energy, good clusters",
3206  nptbins,ptmin,ptmax, 400,-1,1.);
3207  fhClusterMaxCellECross->SetXTitle("#it{E}_{cluster} (GeV) ");
3208  fhClusterMaxCellECross->SetYTitle("1- #it{E}_{cross}/#it{E}_{cell max}");
3209  outputContainer->Add(fhClusterMaxCellECross);
3210 
3211  if(fStudyBadClusters)
3212  {
3213  fhNCellsPerClusterNoCut = new TH2F ("hNCellsPerClusterNoCut","# cells per cluster vs energy, no bad clusters cut",
3214  nptbins,ptmin,ptmax, nceclbins,nceclmin,nceclmax);
3215  fhNCellsPerClusterNoCut->SetXTitle("#it{E} (GeV)");
3216  fhNCellsPerClusterNoCut->SetYTitle("#it{n}_{cells}");
3217  outputContainer->Add(fhNCellsPerClusterNoCut);
3218  }
3219 
3220  fhNCellsPerCluster = new TH2F ("hNCellsPerCluster","# cells per cluster vs energy",nptbins,ptmin,ptmax, nceclbins,nceclmin,nceclmax);
3221  fhNCellsPerCluster->SetXTitle("#it{E} (GeV)");
3222  fhNCellsPerCluster->SetYTitle("#it{n}_{cells}");
3223  outputContainer->Add(fhNCellsPerCluster);
3224 
3226  {
3228  ("hNCellsPerClusterWithWeight","# cells per cluster vs energy",nptbins,ptmin,ptmax, nceclbins,nceclmin,nceclmax);
3229  fhNCellsPerClusterWithWeight->SetXTitle("#it{E} (GeV)");
3230  fhNCellsPerClusterWithWeight->SetYTitle("#it{n}_{cells}");
3231  outputContainer->Add(fhNCellsPerClusterWithWeight);
3232 
3234  ("hNCellsPerClusterRatioWithWeight","# cells per cluster vs energy",nptbins,ptmin,ptmax, 100,0,1);
3235  fhNCellsPerClusterRatioWithWeight->SetXTitle("#it{E} (GeV)");
3236  fhNCellsPerClusterRatioWithWeight->SetYTitle("#it{n}^{w>0.01]_{cells}/#it{n}_{cells}");
3237  outputContainer->Add(fhNCellsPerClusterRatioWithWeight);
3238  }
3239 
3240  if(fStudyBadClusters)
3241  {
3242  fhNCellsPerClusterWeirdModNoCut = new TH2F ("hNCellsPerClusterWeirdNoCutMod","# cells per cluster vs energy, E > 100, no bad clusters cut, per SM",
3243  nceclbins,nceclmin,nceclmax,fNModules,0,fNModules);
3244  fhNCellsPerClusterWeirdModNoCut->SetYTitle("SM number");
3245  fhNCellsPerClusterWeirdModNoCut->SetXTitle("#it{n}_{cells}");
3246  outputContainer->Add(fhNCellsPerClusterWeirdModNoCut);
3247  }
3248 
3249  fhNCellsPerClusterWeirdMod = new TH2F ("hNCellsPerClusterWeirdMod","# cells per cluster, E > 100 GeV, per SM",
3250  nceclbins*2,nceclmin,nceclmax*2,fNModules,0,fNModules);
3251  fhNCellsPerClusterWeirdMod->SetYTitle("SM number");
3252  fhNCellsPerClusterWeirdMod->SetXTitle("#it{n}_{cells}");
3253  outputContainer->Add(fhNCellsPerClusterWeirdMod);
3254 
3255  fhNClusters = new TH1F ("hNClusters","# clusters", nclbins,nclmin,nclmax);
3256  fhNClusters->SetXTitle("#it{n}_{clusters}");
3257  outputContainer->Add(fhNClusters);
3258 
3259  if(fStudyBadClusters)
3260  {
3261  fhBadClusterEnergy = new TH1F ("hBadClusterEnergy","Bad cluster energy", nptbins,ptmin,ptmax);
3262  fhBadClusterEnergy->SetXTitle("#it{E}_{cluster} (GeV) ");
3263  outputContainer->Add(fhBadClusterEnergy);
3264 
3265  fhBadClusterEtaPhi = new TH2F ("hBadClusterEtaPhi","Bad cluster, #eta vs #varphi, #it{E} > 0.5 GeV",
3266  netabins,etamin,etamax,nphibins,phimin,phimax);
3267  fhBadClusterEtaPhi->SetXTitle("#eta ");
3268  fhBadClusterEtaPhi->SetXTitle("#varphi (rad) ");
3269  outputContainer->Add(fhBadClusterEtaPhi);
3270 
3271  fhBadClusterLambda0 = new TH2F ("hBadClusterLambda0","Bad cluster,shower shape, #lambda^{2}_{0} vs E",
3272  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3273  fhBadClusterLambda0->SetXTitle("#it{E}_{cluster}");
3274  fhBadClusterLambda0->SetYTitle("#lambda^{2}_{0}");
3275  outputContainer->Add(fhBadClusterLambda0);
3276 
3277  fhBadClusterLambda1 = new TH2F ("hBadClusterLambda1","Bad cluster,shower shape, #lambda^{2}_{1} vs E for bad cluster ",
3278  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3279  fhBadClusterLambda1->SetXTitle("#it{E}_{cluster}");
3280  fhBadClusterLambda1->SetYTitle("#lambda^{2}_{1}");
3281  outputContainer->Add(fhBadClusterLambda1);
3282 
3283  fhBadClusterMaxCellCloseCellRatio = new TH2F ("hBadClusterMaxCellCloseCellRatio","energy vs ratio of max cell / neighbour cell constributing cell, reconstructed bad clusters",
3284  nptbins,ptmin,ptmax, 100,0,1.);
3285  fhBadClusterMaxCellCloseCellRatio->SetXTitle("#it{E}_{cluster} (GeV) ");
3286  fhBadClusterMaxCellCloseCellRatio->SetYTitle("ratio");
3287  outputContainer->Add(fhBadClusterMaxCellCloseCellRatio);
3288 
3289  fhBadClusterMaxCellCloseCellDiff = new TH2F ("hBadClusterMaxCellCloseCellDiff","energy vs ratio of max cell - neighbour cell constributing cell, reconstructed bad clusters",
3290  nptbins,ptmin,ptmax, 500,0,100);
3291  fhBadClusterMaxCellCloseCellDiff->SetXTitle("#it{E}_{cluster} (GeV) ");
3292  fhBadClusterMaxCellCloseCellDiff->SetYTitle("#it{E}_{cell max} - #it{E}_{cell i} (GeV)");
3293  outputContainer->Add(fhBadClusterMaxCellCloseCellDiff);
3294 
3295  fhBadClusterMaxCellDiff = new TH2F ("hBadClusterMaxCellDiff","energy vs difference of cluster energy - max cell energy / cluster energy for bad clusters",
3296  nptbins,ptmin,ptmax, 500,0,1.);
3297  fhBadClusterMaxCellDiff->SetXTitle("#it{E}_{cluster} (GeV) ");
3298  fhBadClusterMaxCellDiff->SetYTitle("(#it{E}_{cluster} - #it{E}_{cell max}) / #it{E}_{cluster}");
3299  outputContainer->Add(fhBadClusterMaxCellDiff);
3300 
3301  fhBadClusterTimeEnergy = new TH2F ("hBadClusterTimeEnergy","energy vs TOF of reconstructed bad clusters",
3302  nptbins,ptmin,ptmax, ntimebins,timemin,timemax);
3303  fhBadClusterTimeEnergy->SetXTitle("#it{E}_{cluster} (GeV) ");
3304  fhBadClusterTimeEnergy->SetYTitle("#it{t} (ns)");
3305  outputContainer->Add(fhBadClusterTimeEnergy);
3306 
3307  fhBadClusterPairDiffTimeE = new TH2F("hBadClusterPairDiffTimeE","cluster pair time difference (bad - good) vs E from bad cluster",nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
3308  fhBadClusterPairDiffTimeE->SetXTitle("#it{E}_{bad cluster} (GeV)");
3309  fhBadClusterPairDiffTimeE->SetYTitle("#Delta #it{t} (ns)");
3310  outputContainer->Add(fhBadClusterPairDiffTimeE);
3311 
3312  fhBadClusterMaxCellECross = new TH2F ("hBadClusterMaxCellECross","1 - #it{E}_{+} around max energy cell / max energy cell vs cluster energy, bad clusters",
3313  nptbins,ptmin,ptmax, 400,-1,1.);
3314  fhBadClusterMaxCellECross->SetXTitle("#it{E}_{cluster} (GeV) ");
3315  fhBadClusterMaxCellECross->SetYTitle("1- #it{E}_{cross}/#it{E}_{cell max}");
3316  outputContainer->Add(fhBadClusterMaxCellECross);
3317 
3319  {
3320  fhBadCellTimeSpreadRespectToCellMax = new TH2F ("hBadCellTimeSpreadRespectToCellMax","#it{t}_{cell max}-#it{t}_{cell i} from bad cluster", nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
3321  fhBadCellTimeSpreadRespectToCellMax->SetXTitle("#it{E} (GeV)");
3322  fhBadCellTimeSpreadRespectToCellMax->SetYTitle("#Delta #it{t}_{cell max - i} (ns)");
3323  outputContainer->Add(fhBadCellTimeSpreadRespectToCellMax);
3324 
3325  fhBadClusterMaxCellDiffAverageTime = new TH2F ("hBadClusterMaxCellDiffAverageTime","#it{t}_{cell max}-#it{t}_{average} from bad cluster", nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
3326  fhBadClusterMaxCellDiffAverageTime->SetXTitle("#it{E} (GeV)");
3327  fhBadClusterMaxCellDiffAverageTime->SetYTitle("#Delta #it{t}_{cell max - average} (ns)");
3328  outputContainer->Add(fhBadClusterMaxCellDiffAverageTime);
3329 
3330  fhBadClusterMaxCellDiffWeightedTime = new TH2F ("hBadClusterMaxCellDiffWeightedTime","#it{t}_{cell max}-#it{t}_{weighted} from bad cluster", nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
3331  fhBadClusterMaxCellDiffWeightedTime->SetXTitle("#it{E} (GeV)");
3332  fhBadClusterMaxCellDiffWeightedTime->SetYTitle("#Delta #it{t}_{cell max - weighted} (ns)");
3333  outputContainer->Add(fhBadClusterMaxCellDiffWeightedTime);
3334 
3335  }
3336 
3337  }
3338 
3339  if(fStudyExotic)
3340  {
3341  fhExoL0ECross = new TH2F("hExoL0_ECross",
3342  "#lambda^{2}_{0} vs 1-#it{E}_{+}/#it{E}_{max} for E > 5 GeV",
3343  400,0,1,ssbins,ssmin,ssmax);
3344  fhExoL0ECross ->SetXTitle("1-#it{E}_{+}/#it{E}_{cell max}");
3345  fhExoL0ECross ->SetYTitle("#lambda^{2}_{0}");
3346  outputContainer->Add(fhExoL0ECross) ;
3347 
3348  fhExoL1ECross = new TH2F("hExoL1_ECross",
3349  "#lambda^{2}_{1} vs 1-#it{E}_{+}/#it{E}_{max} for E > 5 GeV",
3350  400,0,1,ssbins,ssmin,ssmax);
3351  fhExoL1ECross ->SetXTitle("1-#it{E}_{+}/#it{E}_{cell max}");
3352  fhExoL1ECross ->SetYTitle("#lambda^{2}_{1}");
3353  outputContainer->Add(fhExoL1ECross) ;
3354 
3355  for(Int_t ie = 0; ie <fExoNECrossCuts; ie++)
3356  {
3357 
3358  fhExoDTime[ie] = new TH2F(Form("hExoDTime_ECross%d",ie),
3359  Form("#Delta time = t_{max}-t_{cells} vs #it{E}_{cluster} for exotic, 1-#it{E}_{+}/#it{E}_{max} < %2.2f",fExoECrossCuts[ie]),
3360  nptbins,ptmin,ptmax,tdbins,tdmin,tdmax);
3361  fhExoDTime[ie] ->SetYTitle("#Delta #it{t} (ns)");
3362  fhExoDTime[ie] ->SetXTitle("#it{E} (GeV)");
3363  outputContainer->Add(fhExoDTime[ie]) ;
3364 
3365  for(Int_t idt = 0; idt < fExoNDTimeCuts; idt++)
3366  {
3367  fhExoNCell[ie][idt] = new TH2F(Form("hExoNCell_ECross%d_DT%d",ie,idt),
3368  Form("N cells per cluster vs E cluster, 1-#it{E}_{+}/#it{E}_{max} < %2.2f, #Delta t < %2.0f",fExoECrossCuts[ie],fExoDTimeCuts[idt]),
3369  nptbins,ptmin,ptmax,nceclbins,nceclmin,nceclmax);
3370  fhExoNCell[ie][idt] ->SetYTitle("#it{n}_cells");
3371  fhExoNCell[ie][idt] ->SetXTitle("#it{E} (GeV)");
3372  outputContainer->Add(fhExoNCell[ie][idt]) ;
3373 
3374  fhExoL0 [ie][idt] = new TH2F(Form("hExoL0_ECross%d_DT%d",ie,idt),
3375  Form("#lambda^{2}_{0} vs E cluster for exotic, 1-#it{E}_{+}/#it{E}_{max} < %2.2f, #Delta t = %2.0f",fExoECrossCuts[ie],fExoDTimeCuts[idt]),
3376  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3377  fhExoL0 [ie][idt] ->SetYTitle("#lambda^{2}_{0}");
3378  fhExoL0 [ie][idt] ->SetXTitle("#it{E} (GeV)");
3379  outputContainer->Add(fhExoL0[ie][idt]) ;
3380 
3381  fhExoL1 [ie][idt] = new TH2F(Form("hExoL1_ECross%d_DT%d",ie,idt),
3382  Form("#lambda^{2}_{1} vs E cluster for exotic, 1-#it{E}_{+}/#it{E}_{max} < %2.2f, #Delta t = %2.0f",fExoECrossCuts[ie],fExoDTimeCuts[idt]),
3383  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3384  fhExoL1 [ie][idt] ->SetYTitle("#lambda^{2}_{1}");
3385  fhExoL1 [ie][idt] ->SetXTitle("#it{E} (GeV)");
3386  outputContainer->Add(fhExoL1[ie][idt]) ;
3387 
3388  fhExoECross[ie][idt] = new TH2F(Form("hExoECross_ECross%d_DT%d",ie,idt),
3389  Form("#it{E} cross for cells vs E cell, 1-#it{E}_{+}/#it{E}_{max} < %2.2f, #Delta t < %2.0f",fExoECrossCuts[ie],fExoDTimeCuts[idt]),
3390  nptbins,ptmin,ptmax,400,0,1);
3391  fhExoECross[ie][idt] ->SetYTitle("1-#it{E}_{+}/#it{E}_{cell max}");
3392  fhExoECross[ie][idt] ->SetXTitle("#it{E}_{cell} (GeV)");
3393  outputContainer->Add(fhExoECross[ie][idt]) ;
3394 
3395  fhExoTime [ie][idt] = new TH2F(Form("hExoTime_ECross%d_DT%d",ie,idt),
3396  Form("Time of cluster (max cell) vs E cluster for exotic, 1-#it{E}_{+}/#it{E}_{max} < %2.2f, #Delta t = %2.0f",fExoECrossCuts[ie],fExoDTimeCuts[idt]),
3397  nptbins,ptmin,ptmax,ntimebins,timemin,timemax);
3398  fhExoTime [ie][idt] ->SetYTitle("#it{t}_{max} (ns)");
3399  fhExoTime [ie][idt] ->SetXTitle("#it{E} (GeV)");
3400  outputContainer->Add(fhExoTime[ie][idt]) ;
3401 
3402  fhExoL0NCell[ie][idt] = new TH2F(Form("hExoL0_NCell%d_DT%d",ie,idt),
3403  Form("#lambda^{2}_{0} vs N cells per clusters for E > 5 GeV, 1-#it{E}_{+}/#it{E}_{max} < %2.2f, #Delta t = %2.0f",fExoECrossCuts[ie],fExoDTimeCuts[idt]),
3404  nptbins,ptmin,ptmax,ntimebins,timemin,timemax);
3405  fhExoL0NCell[ie][idt] ->SetYTitle("#it{n}_{cells}");
3406  fhExoL0NCell[ie][idt] ->SetXTitle("#lambda^{2}_{0}");
3407  outputContainer->Add(fhExoL0NCell[ie][idt]) ;
3408 
3409  fhExoL1NCell[ie][idt] = new TH2F(Form("hExoL1_NCell%d_DT%d",ie,idt),
3410  Form("#lambda^{2}_{1} vs N cells per clusters for E > 5 GeV, 1-#it{E}_{+}/#it{E}_{max} < %2.2f, #Delta t = %2.0f",fExoECrossCuts[ie],fExoDTimeCuts[idt]),
3411  nptbins,ptmin,ptmax,ntimebins,timemin,timemax);
3412  fhExoL1NCell[ie][idt] ->SetYTitle("#it{n}_{cells}");
3413  fhExoL1NCell[ie][idt] ->SetXTitle("#lambda^{2}_{1}");
3414  outputContainer->Add(fhExoL1NCell[ie][idt]) ;
3415  }
3416  }
3417  }
3418 
3419  // Cluster size in terms of cells
3420 
3422  {
3423  fhDeltaIEtaDeltaIPhiE0[0] = new TH2F ("hDeltaIEtaDeltaIPhiE0"," Cluster size in columns vs rows for E < 2 GeV, #it{n}_{cells} > 3",
3424  50,0,50,50,0,50);
3425  fhDeltaIEtaDeltaIPhiE0[0]->SetXTitle("#Delta Column");
3426  fhDeltaIEtaDeltaIPhiE0[0]->SetYTitle("#Delta Row");
3427  outputContainer->Add(fhDeltaIEtaDeltaIPhiE0[0]);
3428 
3429  fhDeltaIEtaDeltaIPhiE2[0] = new TH2F ("hDeltaIEtaDeltaIPhiE2"," Cluster size in columns vs rows for 2 <E < 6 GeV, #it{n}_{cells} > 3",
3430  50,0,50,50,0,50);
3431  fhDeltaIEtaDeltaIPhiE2[0]->SetXTitle("#Delta Column");
3432  fhDeltaIEtaDeltaIPhiE2[0]->SetYTitle("#Delta Row");
3433  outputContainer->Add(fhDeltaIEtaDeltaIPhiE2[0]);
3434 
3435  fhDeltaIEtaDeltaIPhiE6[0] = new TH2F ("hDeltaIEtaDeltaIPhiE6"," Cluster size in columns vs rows for E > 6 GeV, #it{n}_{cells} > 3",
3436  50,0,50,50,0,50);
3437  fhDeltaIEtaDeltaIPhiE6[0]->SetXTitle("#Delta Column");
3438  fhDeltaIEtaDeltaIPhiE6[0]->SetYTitle("#Delta Row");
3439  outputContainer->Add(fhDeltaIEtaDeltaIPhiE6[0]);
3440 
3441  fhDeltaIA[0] = new TH2F ("hDeltaIA"," Cluster *asymmetry* in cell units vs E",
3442  nptbins,ptmin,ptmax,21,-1.05,1.05);
3443  fhDeltaIA[0]->SetXTitle("#it{E}_{cluster}");
3444  fhDeltaIA[0]->SetYTitle("#it{A}_{cell in cluster}");
3445  outputContainer->Add(fhDeltaIA[0]);
3446 
3447  fhDeltaIAL0[0] = new TH2F ("hDeltaIAL0"," Cluster *asymmetry* in cell units vs #lambda^{2}_{0}",
3448  ssbins,ssmin,ssmax,21,-1.05,1.05);
3449  fhDeltaIAL0[0]->SetXTitle("#lambda^{2}_{0}");
3450  fhDeltaIAL0[0]->SetYTitle("#it{A}_{cell in cluster}");
3451  outputContainer->Add(fhDeltaIAL0[0]);
3452 
3453  fhDeltaIAL1[0] = new TH2F ("hDeltaIAL1"," Cluster *asymmetry* in cell units vs #lambda^{2}_{1}",
3454  ssbins,ssmin,ssmax,21,-1.05,1.05);
3455  fhDeltaIAL1[0]->SetXTitle("#lambda^{2}_{1}");
3456  fhDeltaIAL1[0]->SetYTitle("#it{A}_{cell in cluster}");
3457  outputContainer->Add(fhDeltaIAL1[0]);
3458 
3459  fhDeltaIANCells[0] = new TH2F ("hDeltaIANCells"," Cluster *asymmetry* in cell units vs N cells in cluster",
3460  nceclbins,nceclmin,nceclmax,21,-1.05,1.05);
3461  fhDeltaIANCells[0]->SetXTitle("#it{n}_{cell in cluster}");
3462  fhDeltaIANCells[0]->SetYTitle("#it{A}_{cell in cluster}");
3463  outputContainer->Add(fhDeltaIANCells[0]);
3464 
3465 
3466  fhDeltaIEtaDeltaIPhiE0[1] = new TH2F ("hDeltaIEtaDeltaIPhiE0Charged"," Cluster size in columns vs rows for E < 2 GeV, #it{n}_{cells} > 3, matched with track",
3467  50,0,50,50,0,50);
3468  fhDeltaIEtaDeltaIPhiE0[1]->SetXTitle("#Delta Column");
3469  fhDeltaIEtaDeltaIPhiE0[1]->SetYTitle("#Delta Row");
3470  outputContainer->Add(fhDeltaIEtaDeltaIPhiE0[1]);
3471 
3472  fhDeltaIEtaDeltaIPhiE2[1] = new TH2F ("hDeltaIEtaDeltaIPhiE2Charged"," Cluster size in columns vs rows for 2 <E < 6 GeV, #it{n}_{cells} > 3, matched with track",
3473  50,0,50,50,0,50);
3474  fhDeltaIEtaDeltaIPhiE2[1]->SetXTitle("#Delta Column");
3475  fhDeltaIEtaDeltaIPhiE2[1]->SetYTitle("#Delta Row");
3476  outputContainer->Add(fhDeltaIEtaDeltaIPhiE2[1]);
3477 
3478  fhDeltaIEtaDeltaIPhiE6[1] = new TH2F ("hDeltaIEtaDeltaIPhiE6Charged"," Cluster size in columns vs rows for E > 6 GeV, #it{n}_{cells} > 3, matched with track",
3479  50,0,50,50,0,50);
3480  fhDeltaIEtaDeltaIPhiE6[1]->SetXTitle("#Delta Column");
3481  fhDeltaIEtaDeltaIPhiE6[1]->SetYTitle("#Delta Row");
3482  outputContainer->Add(fhDeltaIEtaDeltaIPhiE6[1]);
3483 
3484  fhDeltaIA[1] = new TH2F ("hDeltaIACharged"," Cluster *asymmetry* in cell units vs E, matched with track",
3485  nptbins,ptmin,ptmax,21,-1.05,1.05);
3486  fhDeltaIA[1]->SetXTitle("#it{E}_{cluster}");
3487  fhDeltaIA[1]->SetYTitle("#it{A}_{cell in cluster}");
3488  outputContainer->Add(fhDeltaIA[1]);
3489 
3490  fhDeltaIAL0[1] = new TH2F ("hDeltaIAL0Charged"," Cluster *asymmetry* in cell units vs #lambda^{2}_{0}, matched with track",
3491  ssbins,ssmin,ssmax,21,-1.05,1.05);
3492  fhDeltaIAL0[1]->SetXTitle("#lambda^{2}_{0}");
3493  fhDeltaIAL0[1]->SetYTitle("#it{A}_{cell in cluster}");
3494  outputContainer->Add(fhDeltaIAL0[1]);
3495 
3496  fhDeltaIAL1[1] = new TH2F ("hDeltaIAL1Charged"," Cluster *asymmetry* in cell units vs #lambda^{2}_{1}, matched with track",
3497  ssbins,ssmin,ssmax,21,-1.05,1.05);
3498  fhDeltaIAL1[1]->SetXTitle("#lambda^{2}_{1}");
3499  fhDeltaIAL1[1]->SetYTitle("#it{A}_{cell in cluster}");
3500  outputContainer->Add(fhDeltaIAL1[1]);
3501 
3502  fhDeltaIANCells[1] = new TH2F ("hDeltaIANCellsCharged"," Cluster *asymmetry* in cell units vs N cells in cluster, matched with track",
3503  nceclbins,nceclmin,nceclmax,21,-1.05,1.05);
3504  fhDeltaIANCells[1]->SetXTitle("#it{n}_{cell in cluster}");
3505  fhDeltaIANCells[1]->SetYTitle("#it{A}_{cell in cluster}");
3506  outputContainer->Add(fhDeltaIANCells[1]);
3507 
3508  if(IsDataMC()){
3509  TString particle[]={"Photon","Electron","Conversion","Hadron"};
3510  for (Int_t iPart = 0; iPart < 4; iPart++) {
3511 
3512  fhDeltaIAMC[iPart] = new TH2F (Form("hDeltaIA_MC%s",particle[iPart].Data()),Form(" Cluster *asymmetry* in cell units vs E, from %s",particle[iPart].Data()),
3513  nptbins,ptmin,ptmax,21,-1.05,1.05);
3514  fhDeltaIAMC[iPart]->SetXTitle("#it{E}_{cluster}");
3515  fhDeltaIAMC[iPart]->SetYTitle("#it{A}_{cell in cluster}");
3516  outputContainer->Add(fhDeltaIAMC[iPart]);
3517  }
3518  }
3519 
3520  if(fStudyBadClusters)
3521  {
3522  fhBadClusterDeltaIEtaDeltaIPhiE0 = new TH2F ("hBadClusterDeltaIEtaDeltaIPhiE0"," Cluster size in columns vs rows for E < 2 GeV, #it{n}_{cells} > 3",
3523  50,0,50,50,0,50);
3524  fhBadClusterDeltaIEtaDeltaIPhiE0->SetXTitle("#Delta Column");
3525  fhBadClusterDeltaIEtaDeltaIPhiE0->SetYTitle("#Delta Row");
3526  outputContainer->Add(fhBadClusterDeltaIEtaDeltaIPhiE0);
3527 
3528  fhBadClusterDeltaIEtaDeltaIPhiE2 = new TH2F ("hBadClusterDeltaIEtaDeltaIPhiE2"," Cluster size in columns vs rows for 2 <E < 6 GeV, #it{n}_{cells} > 3",
3529  50,0,50,50,0,50);
3530  fhBadClusterDeltaIEtaDeltaIPhiE2->SetXTitle("#Delta Column");
3531  fhBadClusterDeltaIEtaDeltaIPhiE2->SetYTitle("#Delta Row");
3532  outputContainer->Add(fhBadClusterDeltaIEtaDeltaIPhiE2);
3533 
3534  fhBadClusterDeltaIEtaDeltaIPhiE6 = new TH2F ("hBadClusterDeltaIEtaDeltaIPhiE6"," Cluster size in columns vs rows for E > 6 GeV, #it{n}_{cells} > 3",
3535  50,0,50,50,0,50);
3536  fhBadClusterDeltaIEtaDeltaIPhiE6->SetXTitle("#Delta Column");
3537  fhBadClusterDeltaIEtaDeltaIPhiE6->SetYTitle("#Delta Row");
3538  outputContainer->Add(fhBadClusterDeltaIEtaDeltaIPhiE6);
3539 
3540  fhBadClusterDeltaIA = new TH2F ("hBadClusterDeltaIA"," Cluster *asymmetry* in cell units vs E",
3541  nptbins,ptmin,ptmax,21,-1.05,1.05);
3542  fhBadClusterDeltaIA->SetXTitle("#it{E}_{cluster}");
3543  fhBadClusterDeltaIA->SetYTitle("#it{A}_{cell in cluster}");
3544  outputContainer->Add(fhBadClusterDeltaIA);
3545  }
3546  }
3547 
3548  if(fStudyWeight)
3549  {
3550  fhECellClusterRatio = new TH2F ("hECellClusterRatio"," cell energy / cluster energy vs cluster energy",
3551  nptbins,ptmin,ptmax, 100,0,1.);
3552  fhECellClusterRatio->SetXTitle("#it{E}_{cluster} (GeV) ");
3553  fhECellClusterRatio->SetYTitle("#it{E}_{cell i}/#it{E}_{cluster}");
3554  outputContainer->Add(fhECellClusterRatio);
3555 
3556  fhECellClusterLogRatio = new TH2F ("hECellClusterLogRatio"," Log(cell energy / cluster energy) vs cluster energy",
3557  nptbins,ptmin,ptmax, 100,-10,0);
3558  fhECellClusterLogRatio->SetXTitle("#it{E}_{cluster} (GeV) ");
3559  fhECellClusterLogRatio->SetYTitle("Log(#it{E}_{cell i}/#it{E}_{cluster})");
3560  outputContainer->Add(fhECellClusterLogRatio);
3561 
3562  fhEMaxCellClusterRatio = new TH2F ("hEMaxCellClusterRatio"," max cell energy / cluster energy vs cluster energy",
3563  nptbins,ptmin,ptmax, 100,0,1.);
3564  fhEMaxCellClusterRatio->SetXTitle("#it{E}_{cluster} (GeV) ");
3565  fhEMaxCellClusterRatio->SetYTitle("#it{E}_{max cell}/#it{E}_{cluster}");
3566  outputContainer->Add(fhEMaxCellClusterRatio);
3567 
3568  fhEMaxCellClusterLogRatio = new TH2F ("hEMaxCellClusterLogRatio"," Log(max cell energy / cluster energy) vs cluster energy",
3569  nptbins,ptmin,ptmax, 100,-10,0);
3570  fhEMaxCellClusterLogRatio->SetXTitle("#it{E}_{cluster} (GeV) ");
3571  fhEMaxCellClusterLogRatio->SetYTitle("Log (#it{E}_{max cell}/#it{E}_{cluster})");
3572  outputContainer->Add(fhEMaxCellClusterLogRatio);
3573 
3574  fhECellTotalRatio = new TH2F ("hECellTotalRatio"," cell energy / sum all energy vs all energy",
3575  nptbins*2,ptmin,ptmax*2, 100,0,1.);
3576  fhECellTotalRatio->SetXTitle("#it{E}_{total} (GeV) ");
3577  fhECellTotalRatio->SetYTitle("#it{E}_{cell i}/#it{E}_{total}");
3578  outputContainer->Add(fhECellTotalRatio);
3579 
3580  fhECellTotalLogRatio = new TH2F ("hECellTotalLogRatio"," Log(cell energy / sum all energy) vs all energy",
3581  nptbins*2,ptmin,ptmax*2, 100,-10,0);
3582  fhECellTotalLogRatio->SetXTitle("#it{E}_{total} (GeV) ");
3583  fhECellTotalLogRatio->SetYTitle("Log(#it{E}_{cell i}/#it{E}_{total})");
3584  outputContainer->Add(fhECellTotalLogRatio);
3585 
3588 
3589  for(Int_t imod = 0; imod < fNModules; imod++)
3590  {
3591  fhECellTotalRatioMod[imod] = new TH2F (Form("hECellTotalRatio_Mod%d",imod),
3592  Form("#cell energy / sum all energy vs all energy in Module %d",imod),
3593  nptbins*2,ptmin,ptmax*2, 100,0,1.);
3594  fhECellTotalRatioMod[imod]->SetXTitle("#it{E} (GeV)");
3595  fhECellTotalRatioMod[imod]->SetYTitle("#it{n}_{cells}");
3596  outputContainer->Add(fhECellTotalRatioMod[imod]);
3597 
3598  fhECellTotalLogRatioMod[imod] = new TH2F (Form("hECellTotalLogRatio_Mod%d",imod),
3599  Form("Log(cell energy / sum all energy) vs all energy in Module %d",imod),
3600  nptbins*2,ptmin,ptmax*2, 100,-10,0);
3601  fhECellTotalLogRatioMod[imod]->SetXTitle("#it{E} (GeV)");
3602  fhECellTotalLogRatioMod[imod]->SetYTitle("#it{n}_{cells}");
3603  outputContainer->Add(fhECellTotalLogRatioMod[imod]);
3604  }
3605 
3606  // To be done properly with setters and data members ...
3607  Float_t cellEmin [] = {0.05,0.1,0.15,0.2};
3608  Float_t cellTmin [] = {50.,100.,1000000.};
3609 
3610  for(Int_t iw = 0; iw < 12; iw++)
3611  {
3612  Float_t w0 = 4+0.05*iw; // 3+0.25*iw;
3613  for(Int_t iEmin = 0; iEmin < 4; iEmin++)
3614  {
3615  for(Int_t iTmin = 0; iTmin < 3; iTmin++)
3616  {
3617  fhLambda0ForW0AndCellCuts[iw][iEmin][iTmin] = new TH2F (Form("hLambda0ForW0%d_CellEMin%d_TimeMax%d",iw,iEmin,iTmin),
3618  Form("#lambda^{2}_{0} vs E, w0=%1.2f, cell E>%2.2f MeV, |t|<%2.0f ns",
3619  w0, cellEmin[iEmin], cellTmin[iTmin]),
3620  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3621  fhLambda0ForW0AndCellCuts[iw][iEmin][iTmin]->SetXTitle("#it{E}_{cluster}");
3622  fhLambda0ForW0AndCellCuts[iw][iEmin][iTmin]->SetYTitle("#lambda^{2}_{0}");
3623  outputContainer->Add(fhLambda0ForW0AndCellCuts[iw][iEmin][iTmin]);
3624 
3625 
3626 // fhLambda1ForW0AndCellCuts[iw][iEmin][iTmin] = new TH2F (Form("hLambda1ForW0%d_CellEMin%d_TimeMax%d",iw,iEmin,iTmin),
3627 // Form("#lambda^{2}_{1} vs E, w0=%1.2f, cell E>%2.2f MeV, |t|<%2.0f ns"",
3628 // w0, cellEmin[iEmin], cellTmin[iTmin]),
3629 // nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3630 // fhLambda1ForW0AndCellCuts[iw][iEmin][iTmin]->SetXTitle("#it{E}_{cluster}");
3631 // fhLambda1ForW0AndCellCuts[iw][iEmin][iTmin]->SetYTitle("#lambda^{2}_{1}");
3632 // outputContainer->Add(fhLambda1ForW0AndCellCuts[iw][iEmin][iTmin]);
3633 
3634  fhLambda0ForW0AndCellCutsEta0[iw][iEmin][iTmin] = new TH2F (Form("hLambda0ForW0%d_CellEMin%d_TimeMax%d_Eta0",iw,iEmin,iTmin),
3635  Form("#lambda^{2}_{0} vs E, w0=%1.2f, cell E>%2.2f MeV, |t|<%2.0f ns, |#eta| < 0.15",
3636  w0, cellEmin[iEmin], cellTmin[iTmin]),
3637  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3638  fhLambda0ForW0AndCellCutsEta0[iw][iEmin][iTmin]->SetXTitle("#it{E}_{cluster}");
3639  fhLambda0ForW0AndCellCutsEta0[iw][iEmin][iTmin]->SetYTitle("#lambda^{2}_{0}");
3640  outputContainer->Add(fhLambda0ForW0AndCellCutsEta0[iw][iEmin][iTmin]);
3641  }
3642  }
3643 
3644  if(IsDataMC())
3645  {
3646  TString mcnames[] = {"Photon", "Electron","Conversion","Pi0","Hadron"};
3647  for(Int_t imc = 0; imc < 5; imc++)
3648  {
3649  fhLambda0ForW0MC[iw][imc] = new TH2F (Form("hLambda0ForW0%d_MC%s",iw,mcnames[imc].Data()),
3650  Form("shower shape, #lambda^{2}_{0} vs E, w0 = %1.1f, for MC %s",w0,mcnames[imc].Data()),
3651  nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3652  fhLambda0ForW0MC[iw][imc]->SetXTitle("#it{E}_{cluster}");
3653  fhLambda0ForW0MC[iw][imc]->SetYTitle("#lambda^{2}_{0}");
3654  outputContainer->Add(fhLambda0ForW0MC[iw][imc]);
3655 
3656 // fhLambda1ForW0MC[iw][imc] = new TH2F (Form("hLambda1ForW0%d_MC%s",iw,mcnames[imc].Data()),
3657 // Form("shower shape, #lambda^{2}_{1} vs E, w0 = %1.1f, for MC %s",w0,mcnames[imc].Data()),
3658 // nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3659 // fhLambda1ForW0MC[iw][imc]->SetXTitle("#it{E}_{cluster}");
3660 // fhLambda1ForW0MC[iw][imc]->SetYTitle("#lambda^{2}_{1}");
3661 // outputContainer->Add(fhLambda1ForW0MC[iw][imc]);
3662  }
3663  }
3664  }
3665  }
3666 
3667  // Track Matching
3668  if(fFillAllTMHisto)
3669  {
3676 
3677  fhTrackMatchedDEtaNeg = new TH2F("hTrackMatchedDEtaNeg","d#eta of cluster-negative track vs cluster energy",
3678  nptbins,ptmin,ptmax,nresetabins,resetamin,resetamax);
3679  fhTrackMatchedDEtaNeg->SetYTitle("d#eta");
3680  fhTrackMatchedDEtaNeg->SetXTitle("#it{E}_{cluster} (GeV)");
3681 
3682  fhTrackMatchedDPhiNeg = new TH2F("hTrackMatchedDPhiNeg","d#varphi of cluster-negative track vs cluster energy",
3683  nptbins,ptmin,ptmax,nresphibins,resphimin,resphimax);
3684  fhTrackMatchedDPhiNeg->SetYTitle("d#varphi (rad)");
3685  fhTrackMatchedDPhiNeg->SetXTitle("#it{E}_{cluster} (GeV)");
3686 
3687  fhTrackMatchedDEtaDPhiNeg = new TH2F("hTrackMatchedDEtaDPhiNeg","d#eta vs d#varphi of cluster- negative track vs cluster energy",
3688  nresetabins,resetamin,resetamax,nresphibins,resphimin,resphimax);
3689  fhTrackMatchedDEtaDPhiNeg->SetYTitle("d#varphi (rad)");
3690  fhTrackMatchedDEtaDPhiNeg->SetXTitle("d#eta");
3691 
3692  fhTrackMatchedDEtaPos = new TH2F("hTrackMatchedDEtaPos","d#eta of cluster-positive track vs cluster energy",
3693  nptbins,ptmin,ptmax,nresetabins,resetamin,resetamax);
3694  fhTrackMatchedDEtaPos->SetYTitle("d#eta");
3695  fhTrackMatchedDEtaPos->SetXTitle("#it{E}_{cluster} (GeV)");
3696 
3697  fhTrackMatchedDPhiPos = new TH2F("hTrackMatchedDPhiPos","d#varphi of cluster-positive track vs cluster energy",
3698  nptbins,ptmin,ptmax,nresphibins,resphimin,resphimax);
3699  fhTrackMatchedDPhiPos->SetYTitle("d#varphi (rad)");
3700  fhTrackMatchedDPhiPos->SetXTitle("#it{E}_{cluster} (GeV)");
3701 
3702  fhTrackMatchedDEtaDPhiPos = new TH2F("hTrackMatchedDEtaDPhiPos","d#eta vs d#varphi of cluster-positive track vs cluster energy",
3703  nresetabins,resetamin,resetamax,nresphibins,resphimin,resphimax);
3704  fhTrackMatchedDEtaDPhiPos->SetYTitle("d#varphi (rad)");
3705  fhTrackMatchedDEtaDPhiPos->SetXTitle("d#eta");
3706 
3707 
3708  fhTrackMatchedDEtaNegMod = new TH2F("hTrackMatchedDEtaNegPerModule","d#eta of cluster-negative track vs module, E > 0.5 GeV",
3709  nresetabins,resetamin,resetamax,fNModules,0,fNModules);
3710  fhTrackMatchedDEtaNegMod->SetXTitle("d#eta");
3711  fhTrackMatchedDEtaNegMod->SetYTitle("Module");
3712 
3713  fhTrackMatchedDPhiNegMod = new TH2F("hTrackMatchedDPhiNegPerModule","d#varphi of cluster-negative track vs module, E > 0.5 GeV",
3714  nresetabins,resetamin,resetamax,fNModules,0,fNModules);
3715  fhTrackMatchedDPhiNegMod->SetXTitle("d#varphi (rad)");
3716  fhTrackMatchedDPhiNegMod->SetYTitle("Module");
3717 
3718  fhTrackMatchedDEtaPosMod = new TH2F("hTrackMatchedDEtaPosPerModule","d#eta of cluster-positive track vs module, E > 0.5 GeV",
3719  nresetabins,resetamin,resetamax,fNModules,0,fNModules);
3720  fhTrackMatchedDEtaPosMod->SetXTitle("d#eta");
3721  fhTrackMatchedDEtaPosMod->SetYTitle("Module");
3722 
3723  fhTrackMatchedDPhiPosMod = new TH2F("hTrackMatchedDPhiPosPerModule","d#varphi of cluster-positive track vs module, E > 0.5 GeV",
3724  nresetabins,resetamin,resetamax,fNModules,0,fNModules);
3725  fhTrackMatchedDPhiPosMod->SetXTitle("d#varphi (rad)");
3726  fhTrackMatchedDPhiPosMod->SetYTitle("Module");
3727 
3728  outputContainer->Add(fhTrackMatchedDEtaNeg) ;
3729  outputContainer->Add(fhTrackMatchedDPhiNeg) ;
3730  outputContainer->Add(fhTrackMatchedDEtaPos) ;
3731  outputContainer->Add(fhTrackMatchedDPhiPos) ;
3732  outputContainer->Add(fhTrackMatchedDEtaDPhiNeg) ;
3733  outputContainer->Add(fhTrackMatchedDEtaDPhiPos) ;
3734 
3735  outputContainer->Add(fhTrackMatchedDEtaNegMod) ;
3736  outputContainer->Add(fhTrackMatchedDPhiNegMod) ;
3737  outputContainer->Add(fhTrackMatchedDEtaPosMod) ;
3738  outputContainer->Add(fhTrackMatchedDPhiPosMod) ;
3739 
3740  fhECharged = new TH1F ("hECharged","#it{E} reconstructed clusters, matched with track", nptbins,ptmin,ptmax);
3741  fhECharged->SetXTitle("#it{E} (GeV)");
3742  outputContainer->Add(fhECharged);
3743 
3744  fhPtCharged = new TH1F ("hPtCharged","#it{p}_{T} reconstructed clusters, matched with track", nptbins,ptmin,ptmax);
3745  fhPtCharged->SetXTitle("#it{p}_{T} (GeV/#it{c})");
3746  outputContainer->Add(fhPtCharged);
3747 
3748  fhPhiCharged = new TH1F ("hPhiCharged","#varphi reconstructed clusters, matched with track",nphibins,phimin,phimax);
3749  fhPhiCharged->SetXTitle("#varphi (rad)");
3750  outputContainer->Add(fhPhiCharged);
3751 
3752  fhEtaCharged = new TH1F ("hEtaCharged","#eta reconstructed clusters, matched with track",netabins,etamin,etamax);
3753  fhEtaCharged->SetXTitle("#eta ");
3754  outputContainer->Add(fhEtaCharged);
3755 
3756  if(fFillAllTH3)
3757  {
3758  fhEtaPhiECharged = new TH3F ("hEtaPhiECharged","#eta vs #varphi, reconstructed clusters, matched with track",
3759  netabins,etamin,etamax,nphibins,phimin,phimax,nptbins,ptmin,ptmax);
3760  fhEtaPhiECharged->SetXTitle("#eta ");
3761  fhEtaPhiECharged->SetYTitle("#varphi ");
3762  fhEtaPhiECharged->SetZTitle("#it{E} (GeV) ");
3763  outputContainer->Add(fhEtaPhiECharged);
3764  }
3765  else
3766  {
3767  fhEtaPhiCharged = new TH2F ("hEtaPhiCharged","#eta vs #varphi for #it{E} > 0.5 GeV, reconstructed clusters, with matched track",
3768  netabins,etamin,etamax,nphibins,phimin,phimax);
3769  fhEtaPhiCharged->SetXTitle("#eta ");
3770  fhEtaPhiCharged->SetYTitle("#varphi (rad)");
3771  outputContainer->Add(fhEtaPhiCharged);
3772  }
3773 
3774  fh1EOverP = new TH2F("h1EOverP","TRACK matches #it{E}/#it{p}",nptbins,ptmin,ptmax, nPoverEbins,eOverPmin,eOverPmax);
3775  fh1EOverP->SetYTitle("#it{E}/#it{p}");
3776  fh1EOverP->SetXTitle("#it{p}_{T} (GeV/#it{c})");
3777  outputContainer->Add(fh1EOverP);
3778 
3779  fh2dR = new TH2F("h2dR","TRACK matches #Delta #it{R}",nptbins,ptmin,ptmax,ndRbins,dRmin,dRmax);
3780  fh2dR->SetYTitle("#Delta #it{R} (rad)");
3781  fh2dR->SetXTitle("#it{E} cluster (GeV)");
3782  outputContainer->Add(fh2dR) ;
3783 
3784  fh2MatchdEdx = new TH2F("h2MatchdEdx","#it{dE/dx} vs. #it{p} for all matches",nptbins,ptmin,ptmax,ndedxbins,dedxmin,dedxmax);
3785  fh2MatchdEdx->SetXTitle("p (GeV/#it{c})");
3786  fh2MatchdEdx->SetYTitle("<#it{dE/dx}>");
3787  outputContainer->Add(fh2MatchdEdx);
3788 
3789  fh2EledEdx = new TH2F("h2EledEdx","#it{dE/dx} vs. #it{p} for electrons",nptbins,ptmin,ptmax,ndedxbins,dedxmin,dedxmax);
3790  fh2EledEdx->SetXTitle("p (GeV/#it{c})");
3791  fh2EledEdx->SetYTitle("<#it{dE/dx}>");
3792  outputContainer->Add(fh2EledEdx) ;
3793 
3794  fh1EOverPR02 = new TH2F("h1EOverPR02","TRACK matches #it{E}/#it{p}, all",nptbins,ptmin,ptmax, nPoverEbins,eOverPmin,eOverPmax);
3795  fh1EOverPR02->SetYTitle("#it{E}/#it{p}");
3796  fh1EOverPR02->SetXTitle("#it{p}_{T} (GeV/#it{c})");
3797  outputContainer->Add(fh1EOverPR02);
3798 
3799  fh1EleEOverP = new TH2F("h1EleEOverP","Electron candidates #it{E}/#it{p} (60<#it{dE/dx}<100)",nptbins,ptmin,ptmax, nPoverEbins,eOverPmin,eOverPmax);
3800  fh1EleEOverP->SetYTitle("#it{E}/#it{p}");
3801  fh1EleEOverP->SetXTitle("#it{p}_{T} (GeV/#it{c})");
3802  outputContainer->Add(fh1EleEOverP);
3803 
3804 
3805  // Projections per SM
3806 
3807  fh1EOverPMod = new TH2F("h1EOverP_PerModule","TRACK matches #it{E}/#it{p}, #it{E}_{cl}&#it{p}_{tr}>0.5 Gev/#it{c}",nPoverEbins,eOverPmin,eOverPmax,fNModules,0,fNModules);
3808  fh1EOverPMod->SetXTitle("#it{E}/#it{p}");
3809  fh1EOverPMod->SetYTitle("Module");
3810  outputContainer->Add(fh1EOverPMod);
3811 
3812  fh2dRMod = new TH2F("h2dR_PerModule","TRACK matches #Delta #it{R}, #it{E}_{cl}&#it{p}_{tr}>0.5 Gev/#it{c}",ndRbins,dRmin,dRmax,fNModules,0,fNModules);
3813  fh2dRMod->SetXTitle("#Delta #it{R} (rad)");
3814  fh2dRMod->SetYTitle("Module");
3815  outputContainer->Add(fh2dRMod) ;
3816 
3817  fh2MatchdEdxMod = new TH2F("h2MatchdEdx_PerModule","#it{dE/dx} vs. #it{p} for all matches, #it{E}_{cl}&#it{p}_{tr}>0.5 Gev/#it{c}",ndedxbins,dedxmin,dedxmax,fNModules,0,fNModules);
3818  fh2MatchdEdxMod->SetYTitle("Module");
3819  fh2MatchdEdxMod->SetXTitle("<#it{dE/dx}>");
3820  outputContainer->Add(fh2MatchdEdxMod);
3821 
3822  fh2EledEdxMod = new TH2F("h2EledEdx_PerModule","#it{dE/dx} vs. #it{p} for electrons, #it{E}_{cl}&#it{p}_{tr}>0.5 Gev/#it{c}",ndedxbins,dedxmin,dedxmax,fNModules,0,fNModules);
3823  fh2EledEdxMod->SetYTitle("Module");
3824  fh2EledEdxMod->SetXTitle("<#it{dE/dx}>");
3825  outputContainer->Add(fh2EledEdxMod) ;
3826 
3827  fh1EOverPR02Mod = new TH2F("h1EOverPR02_PerModule","TRACK matches #it{E}/#it{p}, all, #it{E}_{cl}&#it{p}_{tr}>0.5 Gev/#it{c}",nPoverEbins,eOverPmin,eOverPmax,fNModules,0,fNModules);
3828  fh1EOverPR02Mod->SetXTitle("#it{E}/#it{p}");
3829  fh1EOverPR02Mod->SetYTitle("Module");
3830  outputContainer->Add(fh1EOverPR02Mod);
3831 
3832  fh1EleEOverPMod = new TH2F("h1EleEOverP_PerModule","Electron candidates #it{E}/#it{p} (60<#it{dE/dx}<100), #it{E}_{cl}&#it{p}_{tr}>0.5 Gev/#it{c}",nPoverEbins,eOverPmin,eOverPmax,fNModules,0,fNModules);
3833  fh1EleEOverPMod->SetXTitle("#it{E}/#it{p}");
3834  fh1EleEOverPMod->SetYTitle("Module");
3835  outputContainer->Add(fh1EleEOverPMod);
3836  }
3837 
3838  if(fFillAllPi0Histo)
3839  {
3840  fhIM = new TH2F ("hIM","Cluster pairs (EMCAL or PHOS) Invariant mass vs reconstructed pair #it{p}_{T}, ncell > 1",
3841  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
3842  fhIM->SetXTitle("#it{p}_{T, cluster pairs} (GeV) ");
3843  fhIM->SetYTitle("M_{cluster pairs} (GeV/#it{c}^{2})");
3844  outputContainer->Add(fhIM);
3845 
3846  fhIMDiff = new TH2F ("hIMDiff","Cluster pairs (EMCAL or PHOS) Invariant mass vs reconstructed pair #it{p}_{T}, ncell > 1, different SM",
3847  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
3848  fhIMDiff->SetXTitle("#it{p}_{T, cluster pairs} (GeV) ");
3849  fhIMDiff->SetYTitle("M_{cluster pairs} (GeV/#it{c}^{2})");
3850  outputContainer->Add(fhIMDiff);
3851 
3852  fhIMSame = new TH2F ("hIMSame","Cluster pairs (EMCAL or PHOS) Invariant mass vs reconstructed pair #it{p}_{T}, ncell > 1, same SM",
3853  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
3854  fhIMSame->SetXTitle("#it{p}_{T, cluster pairs} (GeV) ");
3855  fhIMSame->SetYTitle("M_{cluster pairs} (GeV/#it{c}^{2})");
3856  outputContainer->Add(fhIMSame);
3857 
3858  if(fNModules > 12 && (GetCalorimeter() == kEMCAL || GetCalorimeter() == kDCAL))
3859  {
3860  fhIMDCAL = new TH2F ("hIMDCAL","Cluster pairs in DCAL Invariant mass vs reconstructed pair #it{p}_{T}, ncell > 1",
3861  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
3862  fhIMDCAL->SetXTitle("#it{p}_{T, cluster pairs} (GeV) ");
3863  fhIMDCAL->SetYTitle("M_{cluster pairs} (GeV/#it{c}^{2})");
3864  outputContainer->Add(fhIMDCAL);
3865 
3866  fhIMDCALDiff = new TH2F ("hIMDCALDiff","Cluster pairs in DCAL Invariant mass vs reconstructed pair #it{p}_{T}, ncell > 1, different SM",
3867  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
3868  fhIMDCALDiff->SetXTitle("#it{p}_{T, cluster pairs} (GeV) ");
3869  fhIMDCALDiff->SetYTitle("M_{cluster pairs} (GeV/#it{c}^{2})");
3870  outputContainer->Add(fhIMDCALDiff);
3871 
3872  fhIMDCALSame = new TH2F ("hIMDCALSame","Cluster pairs in DCAL Invariant mass vs reconstructed pair #it{p}_{T}, ncell > 1, same SM",
3873  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
3874  fhIMDCALSame->SetXTitle("#it{p}_{T, cluster pairs} (GeV) ");
3875  fhIMDCALSame->SetYTitle("M_{cluster pairs} (GeV/#it{c}^{2})");
3876  outputContainer->Add(fhIMDCALSame);
3877 
3878  fhIMDCALPHOS = new TH2F ("hIMDCALPHOS","Cluster pairs in DCAL-PHOS Invariant mass vs reconstructed pair #it{p}_{T}, ncell > 1",
3879  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
3880  fhIMDCALPHOS->SetXTitle("#it{p}_{T, cluster pairs} (GeV) ");
3881  fhIMDCALPHOS->SetYTitle("M_{cluster pairs} (GeV/#it{c}^{2})");
3882  outputContainer->Add(fhIMDCALPHOS);
3883 
3884  fhIMDCALPHOSSame = new TH2F ("hIMDCALPHOSSame","Cluster pairs in DCAL-PHOS Invariant mass vs reconstructed pair #it{p}_{T}, ncell > 1, same #varphi sector",
3885  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
3886  fhIMDCALPHOSSame->SetXTitle("#it{p}_{T, cluster pairs} (GeV) ");
3887  fhIMDCALPHOSSame->SetYTitle("M_{cluster pairs} (GeV/#it{c}^{2})");
3888  outputContainer->Add(fhIMDCALPHOSSame);
3889  }
3890 
3892  {
3893  fhIMEMCALPHOS = new TH2F ("hIMEMCALPHOS","Cluster pairs in DCAL-PHOS Invariant mass vs reconstructed pair #it{p}_{T}, ncell > 1",
3894  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
3895  fhIMEMCALPHOS->SetXTitle("#it{p}_{T, cluster pairs} (GeV) ");
3896  fhIMEMCALPHOS->SetYTitle("M_{cluster pairs} (GeV/#it{c}^{2})");
3897  outputContainer->Add(fhIMEMCALPHOS);
3898 
3899  fhIMEMCALPHOSSame = new TH2F ("hIMEMCALPHOSSame","Cluster pairs in DCAL-PHOS Invariant mass vs reconstructed pair #it{p}_{T}, ncell > 1, same #varphi sector",
3900  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
3901  fhIMEMCALPHOSSame->SetXTitle("#it{p}_{T, cluster pairs} (GeV) ");
3902  fhIMEMCALPHOSSame->SetYTitle("M_{cluster pairs} (GeV/#it{c}^{2})");
3903  outputContainer->Add(fhIMEMCALPHOSSame);
3904  }
3905 
3907  {
3908  fhClusterPairDiffTimeEPi0Mass = new TH2F("hClusterPairDiffTimeEPi0Mass","cluster pair time difference vs E, only good clusters",
3909  nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
3910  fhClusterPairDiffTimeEPi0Mass->SetXTitle("#it{E}_{cluster} (GeV)");
3911  fhClusterPairDiffTimeEPi0Mass->SetYTitle("#Delta #it{t} (ns)");
3912  outputContainer->Add(fhClusterPairDiffTimeEPi0Mass);
3913 
3914  fhClusterPairDiffTimeEPi0MassSame = new TH2F("hClusterPairDiffTimeEPi0MassSame","cluster pair time difference vs E, only good clusters",
3915  nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
3916  fhClusterPairDiffTimeEPi0MassSame->SetXTitle("#it{E}_{cluster} (GeV)");
3917  fhClusterPairDiffTimeEPi0MassSame->SetYTitle("#Delta #it{t} (ns)");
3918  outputContainer->Add(fhClusterPairDiffTimeEPi0MassSame);
3919 
3920  if(fNModules > 12 && (GetCalorimeter() == kEMCAL || GetCalorimeter() == kDCAL))
3921  {
3922  fhClusterPairDiffTimeEPi0MassDCal = new TH2F("hClusterPairDiffTimeEPi0MassDCal","cluster pair time difference vs E, only good clusters",
3923  nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
3924  fhClusterPairDiffTimeEPi0MassDCal->SetXTitle("#it{E}_{cluster} (GeV)");
3925  fhClusterPairDiffTimeEPi0MassDCal->SetYTitle("#Delta #it{t} (ns)");
3926  outputContainer->Add(fhClusterPairDiffTimeEPi0MassDCal);
3927 
3928  fhClusterPairDiffTimeEPi0MassDCalSame = new TH2F("hClusterPairDiffTimeEPi0MassDCalSame","cluster pair time difference vs E, only good clusters",
3929  nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
3930  fhClusterPairDiffTimeEPi0MassDCalSame->SetXTitle("#it{E}_{cluster} (GeV)");
3931  fhClusterPairDiffTimeEPi0MassDCalSame->SetYTitle("#Delta #it{t} (ns)");
3932  outputContainer->Add(fhClusterPairDiffTimeEPi0MassDCalSame);
3933  }
3934  }
3935 
3936  fhAsym = new TH2F ("hAssym","Cluster pairs Asymmetry vs reconstructed pair energy",nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax);
3937  fhAsym->SetXTitle("#it{p}_{T, cluster pairs} (GeV) ");
3938  fhAsym->SetYTitle("#it{Asymmetry}");
3939  outputContainer->Add(fhAsym);
3940 
3942  {
3943  fhOpAngle = new TH2F ("hOpeningAngle","Cluster pairs opening angle vs reconstructed pair #it{p}_{T}, ncell > 1",
3944  nptbins,ptmin,ptmax, 180,0,TMath::Pi());
3945  fhOpAngle->SetXTitle("#it{p}_{T, cluster pairs} (GeV) ");
3946  fhOpAngle->SetYTitle("Opening angle (degrees)");
3947  outputContainer->Add(fhOpAngle);
3948 
3949  Int_t nBinOpAngle = TMath::Nint(fInvMassMaxOpenAngle*TMath::RadToDeg()); // bin of 1 degree size
3950  fhIMvsOpAngle = new TH2F ("hIMvsOpAngle","Cluster pairs Invariant mass vs reconstructed pair opening angle, ncell > 1",
3951  nBinOpAngle,0.,fInvMassMaxOpenAngle,nmassbins,massmin,massmax);
3952  fhIMvsOpAngle->SetXTitle("Opening angle (degrees)");
3953  fhIMvsOpAngle->SetYTitle("M_{cluster pairs} (GeV/#it{c}^{2})");
3954  outputContainer->Add(fhIMvsOpAngle);
3955  }
3956  }
3957 
3958  if(fFillAllPosHisto2)
3959  {
3960  fhXYZ = new TH3F ("hXYZ","Cluster: #it{x} vs #it{y} vs #it{z}",xbins,xmin,xmax,ybins,ymin,ymax,zbins,zmin,zmax);
3961  fhXYZ->SetXTitle("#it{x} (cm)");
3962  fhXYZ->SetYTitle("#it{y} (cm)");
3963  fhXYZ->SetZTitle("#it{z} (cm) ");
3964  outputContainer->Add(fhXYZ);
3965 
3966  fhXE = new TH2F ("hXE","Cluster X position vs cluster energy",xbins,xmin,xmax,nptbins,ptmin,ptmax);
3967  fhXE->SetXTitle("#it{x} (cm)");
3968  fhXE->SetYTitle("#it{E} (GeV)");
3969  outputContainer->Add(fhXE);
3970 
3971  fhYE = new TH2F ("hYE","Cluster Y position vs cluster energy",ybins,ymin,ymax,nptbins,ptmin,ptmax);
3972  fhYE->SetXTitle("#it{y} (cm)");
3973  fhYE->SetYTitle("#it{E} (GeV)");
3974  outputContainer->Add(fhYE);
3975 
3976  fhZE = new TH2F ("hZE","Cluster Z position vs cluster energy",zbins,zmin,zmax,nptbins,ptmin,ptmax);
3977  fhZE->SetXTitle("#it{z} (cm)");
3978  fhZE->SetYTitle("#it{E} (GeV)");
3979  outputContainer->Add(fhZE);
3980 
3981  fhRE = new TH2F ("hRE","Cluster R position vs cluster energy",rbins,rmin,rmax,nptbins,ptmin,ptmax);
3982  fhRE->SetXTitle("r = #sqrt{x^{2}+y^{2}} (cm)");
3983  fhRE->SetYTitle("#it{E} (GeV)");
3984  outputContainer->Add(fhRE);
3985 
3986  fhXNCells = new TH2F ("hXNCells","Cluster X position vs N Cells per Cluster",xbins,xmin,xmax,nceclbins,nceclmin,nceclmax);
3987  fhXNCells->SetXTitle("#it{x} (cm)");
3988  fhXNCells->SetYTitle("N cells per cluster");
3989  outputContainer->Add(fhXNCells);
3990 
3991  fhYNCells = new TH2F ("hYNCells","Cluster Y position vs N Cells per Cluster",ybins,ymin,ymax,nceclbins,nceclmin,nceclmax);
3992  fhYNCells->SetXTitle("#it{y} (cm)");
3993  fhYNCells->SetYTitle("N cells per cluster");
3994  outputContainer->Add(fhYNCells);
3995 
3996  fhZNCells = new TH2F ("hZNCells","Cluster Z position vs N Cells per Cluster",zbins,zmin,zmax,nceclbins,nceclmin,nceclmax);
3997  fhZNCells->SetXTitle("#it{z} (cm)");
3998  fhZNCells->SetYTitle("N cells per cluster");
3999  outputContainer->Add(fhZNCells);
4000 
4001  fhRNCells = new TH2F ("hRNCells","Cluster R position vs N Cells per Cluster",rbins,rmin,rmax,nceclbins,nceclmin,nceclmax);
4002  fhRNCells->SetXTitle("r = #sqrt{x^{2}+y^{2}} (cm)");
4003  fhRNCells->SetYTitle("N cells per cluster");
4004  outputContainer->Add(fhRNCells);
4005  }
4006 
4007  if(fFillAllPosHisto)
4008  {
4009  fhRCellE = new TH2F ("hRCellE","Cell R position vs cell energy",rbins,rmin,rmax,nptbins,ptmin,ptmax);
4010  fhRCellE->SetXTitle("r = #sqrt{x^{2}+y^{2}} (cm)");
4011  fhRCellE->SetYTitle("#it{E} (GeV)");
4012  outputContainer->Add(fhRCellE);
4013 
4014  fhXCellE = new TH2F ("hXCellE","Cell X position vs cell energy",xbins,xmin,xmax,nptbins,ptmin,ptmax);
4015  fhXCellE->SetXTitle("#it{x} (cm)");
4016  fhXCellE->SetYTitle("#it{E} (GeV)");
4017  outputContainer->Add(fhXCellE);
4018 
4019  fhYCellE = new TH2F ("hYCellE","Cell Y position vs cell energy",ybins,ymin,ymax,nptbins,ptmin,ptmax);
4020  fhYCellE->SetXTitle("#it{y} (cm)");
4021  fhYCellE->SetYTitle("#it{E} (GeV)");
4022  outputContainer->Add(fhYCellE);
4023 
4024  fhZCellE = new TH2F ("hZCellE","Cell Z position vs cell energy",zbins,zmin,zmax,nptbins,ptmin,ptmax);
4025  fhZCellE->SetXTitle("#it{z} (cm)");
4026  fhZCellE->SetYTitle("#it{E} (GeV)");
4027  outputContainer->Add(fhZCellE);
4028 
4029  fhXYZCell = new TH3F ("hXYZCell","Cell : #it{x} vs #it{y} vs #it{z}",xbins,xmin,xmax,ybins,ymin,ymax,zbins,zmin,zmax);
4030  fhXYZCell->SetXTitle("#it{x} (cm)");
4031  fhXYZCell->SetYTitle("#it{y} (cm)");
4032  fhXYZCell->SetZTitle("#it{z} (cm)");
4033  outputContainer->Add(fhXYZCell);
4034 
4035  Float_t dx = TMath::Abs(xmin)+TMath::Abs(xmax);
4036  Float_t dy = TMath::Abs(ymin)+TMath::Abs(ymax);
4037  Float_t dz = TMath::Abs(zmin)+TMath::Abs(zmax);
4038  Float_t dr = TMath::Abs(rmin)+TMath::Abs(rmax);
4039 
4040  fhDeltaCellClusterRNCells = new TH2F ("hDeltaCellClusterRNCells","Cluster-Cell R position vs N Cells per Cluster",rbins*2,-dr,dr,nceclbins,nceclmin,nceclmax);
4041  fhDeltaCellClusterRNCells->SetXTitle("#it{r} = #sqrt{x^{2}+y^{2}}, #it{r}_{clus}-#it{r}_{cell} (cm)");
4042  fhDeltaCellClusterRNCells->SetYTitle("#it{n}_{cells per cluster}");
4043  outputContainer->Add(fhDeltaCellClusterRNCells);
4044 
4045  fhDeltaCellClusterXNCells = new TH2F ("hDeltaCellClusterXNCells","Cluster-Cell X position vs N Cells per Cluster",xbins*2,-dx,dx,nceclbins,nceclmin,nceclmax);
4046  fhDeltaCellClusterXNCells->SetXTitle("#it{x}_{clus}-#it{x}_{cell} (cm)");
4047  fhDeltaCellClusterXNCells->SetYTitle("#it{n}_{cells per cluster}");
4048  outputContainer->Add(fhDeltaCellClusterXNCells);
4049 
4050  fhDeltaCellClusterYNCells = new TH2F ("hDeltaCellClusterYNCells","Cluster-Cell Y position vs N Cells per Cluster",ybins*2,-dy,dy,nceclbins,nceclmin,nceclmax);
4051  fhDeltaCellClusterYNCells->SetXTitle("#it{y}_{clus}-#it{y}_{cell} (cm)");
4052  fhDeltaCellClusterYNCells->SetYTitle("N cells per cluster");
4053  outputContainer->Add(fhDeltaCellClusterYNCells);
4054 
4055  fhDeltaCellClusterZNCells = new TH2F ("hDeltaCellClusterZNCells","Cluster-Cell Z position vs N Cells per Cluster",zbins*2,-dz,dz,nceclbins,nceclmin,nceclmax);
4056  fhDeltaCellClusterZNCells->SetXTitle("#it{z}_{clus}-#it{z}_{cell} (cm)");
4057  fhDeltaCellClusterZNCells->SetYTitle("#it{n}_{cells per cluster}");
4058  outputContainer->Add(fhDeltaCellClusterZNCells);
4059 
4060  fhDeltaCellClusterRE = new TH2F ("hDeltaCellClusterRE","Cluster-Cell R position vs cluster energy",rbins*2,-dr,dr,nptbins,ptmin,ptmax);
4061  fhDeltaCellClusterRE->SetXTitle("#it{r} = #sqrt{x^{2}+y^{2}}, #it{r}_{clus}-#it{r}_{cell} (cm)");
4062  fhDeltaCellClusterRE->SetYTitle("#it{E} (GeV)");
4063  outputContainer->Add(fhDeltaCellClusterRE);
4064 
4065  fhDeltaCellClusterXE = new TH2F ("hDeltaCellClusterXE","Cluster-Cell X position vs cluster energy",xbins*2,-dx,dx,nptbins,ptmin,ptmax);
4066  fhDeltaCellClusterXE->SetXTitle("#it{x}_{clus}-#it{x}_{cell} (cm)");
4067  fhDeltaCellClusterXE->SetYTitle("#it{E} (GeV)");
4068  outputContainer->Add(fhDeltaCellClusterXE);
4069 
4070  fhDeltaCellClusterYE = new TH2F ("hDeltaCellClusterYE","Cluster-Cell Y position vs cluster energy",ybins*2,-dy,dy,nptbins,ptmin,ptmax);
4071  fhDeltaCellClusterYE->SetXTitle("#it{y}_{clus}-#it{y}_{cell} (cm)");
4072  fhDeltaCellClusterYE->SetYTitle("#it{E} (GeV)");
4073  outputContainer->Add(fhDeltaCellClusterYE);
4074 
4075  fhDeltaCellClusterZE = new TH2F ("hDeltaCellClusterZE","Cluster-Cell Z position vs cluster energy",zbins*2,-dz,dz,nptbins,ptmin,ptmax);
4076  fhDeltaCellClusterZE->SetXTitle("#it{z}_{clus}-#it{z}_{cell} (cm)");
4077  fhDeltaCellClusterZE->SetYTitle("#it{E} (GeV)");
4078  outputContainer->Add(fhDeltaCellClusterZE);
4079 
4080  if(fFillAllTH3)
4081  {
4082  fhEtaPhiAmpCell = new TH3F ("hEtaPhiAmpCell","Cell #eta vs cell #varphi vs cell energy",
4083  netabins,etamin,etamax,nphibins,phimin,phimax,nptbins,ptmin,ptmax);
4084  fhEtaPhiAmpCell->SetXTitle("#eta ");
4085  fhEtaPhiAmpCell->SetYTitle("#varphi (rad)");
4086  fhEtaPhiAmpCell->SetZTitle("#it{E} (GeV) ");
4087  outputContainer->Add(fhEtaPhiAmpCell);
4088  }
4089  else
4090  {
4091  fhEtaPhiCell = new TH2F ("hEtaPhiCell","Cell #eta vs cell #varphi vs cell energy",
4092  netabins,etamin,etamax,nphibins,phimin,phimax);
4093  fhEtaPhiCell->SetXTitle("#eta ");
4094  fhEtaPhiCell->SetYTitle("#varphi (rad)");
4095  outputContainer->Add(fhEtaPhiCell);
4096  }
4097  }
4098 
4099  // Calorimeter cells
4100 
4101  fhNCells = new TH1F ("hNCells","# cells", ncebins,ncemin+0.5,ncemax);
4102  fhNCells->SetXTitle("#it{n}_{cells}");
4103  outputContainer->Add(fhNCells);
4104 
4105  fhNCellsCutAmpMin = new TH1F ("hNCellsCutAmpMin",Form("# cells amp > %1.2f-%1.2f",fEMCALCellAmpMin,fPHOSCellAmpMin), ncebins,ncemin+0.5,ncemax);
4106  fhNCellsCutAmpMin->SetXTitle("#it{n}_{cells}");
4107  outputContainer->Add(fhNCellsCutAmpMin);
4108 
4109  fhAmplitude = new TH1F ("hAmplitude","#it{E}_{cell}", nptbins*2,ptmin,ptmax);
4110  fhAmplitude->SetXTitle("#it{E}_{cell} (GeV)");
4111  outputContainer->Add(fhAmplitude);
4112 
4113  fhAmpId = new TH2F ("hAmpId","#it{E}_{cell}", nfineptbins,ptfinemin,ptfinemax,fNMaxRows*fNMaxCols*fNModules,0,fNMaxRows*fNMaxCols*fNModules);
4114  fhAmpId->SetXTitle("#it{E}_{cell} (GeV)");
4115  outputContainer->Add(fhAmpId);
4116 
4117  fhAmpIdLowGain = new TH2F ("hAmpIdLG","Low gain: #it{E}_{cell}", nfineptbins,15,ptfinemax+15,fNMaxRows*fNMaxCols*fNModules,0,fNMaxRows*fNMaxCols*fNModules);
4118  fhAmpIdLowGain->SetXTitle("#it{E}_{cell} (GeV)");
4119  outputContainer->Add(fhAmpIdLowGain);
4120 
4122  {
4123  fhCellTimeSpreadRespectToCellMax = new TH2F ("hCellTimeSpreadRespectToCellMax","t_{cell max}-t_{cell i} per cluster", nptbins,ptmin,ptmax,tdbins,tdmin,tdmax);
4124  fhCellTimeSpreadRespectToCellMax->SetXTitle("#it{E} (GeV)");
4125  fhCellTimeSpreadRespectToCellMax->SetYTitle("#Delta #it{t}_{cell max-i} (ns)");
4126  outputContainer->Add(fhCellTimeSpreadRespectToCellMax);
4127 
4128 // fhClusterMaxCellDiffAverageTime = new TH2F ("hClusterMaxCellDiffAverageTime","t_{cell max}-t_{average} per cluster", nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
4129 // fhClusterMaxCellDiffAverageTime->SetXTitle("#it{E} (GeV)");
4130 // fhClusterMaxCellDiffAverageTime->SetYTitle("#Delta #it{t}_{cell max - average} (ns)");
4131 // outputContainer->Add(fhClusterMaxCellDiffAverageTime);
4132 //
4133 // fhClusterMaxCellDiffWeightedTime = new TH2F ("hClusterMaxCellDiffWeightedTime","t_{cell max}-t_{weighted} per cluster", nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
4134 // fhClusterMaxCellDiffWeightedTime->SetXTitle("#it{E} (GeV)");
4135 // fhClusterMaxCellDiffWeightedTime->SetYTitle("#Delta #it{t}_{cell max - weighted} (ns)");
4136 // outputContainer->Add(fhClusterMaxCellDiffWeightedTime);
4137 
4138  fhCellIdCellLargeTimeSpread= new TH1F ("hCellIdCellLargeTimeSpread","Cells with time 100 ns larger than cell max in cluster ",
4139  fNMaxCols*fNMaxRows*fNModules,0,fNMaxCols*fNMaxRows*fNModules);
4140  fhCellIdCellLargeTimeSpread->SetXTitle("Absolute Cell Id");
4141  outputContainer->Add(fhCellIdCellLargeTimeSpread);
4142 
4143  fhTime = new TH1F ("hTime","#it{t}_{cell}",ntimebins,timemin,timemax);
4144  fhTime->SetXTitle("#it{t}_{cell} (ns)");
4145  outputContainer->Add(fhTime);
4146 
4147 // fhTimeVz = new TH2F ("hTimeVz","#it{t}_{cell} vs vertex, amplitude > 0.5 GeV",100, 0, 50,ntimebins,timemin,timemax);
4148 // fhTimeVz->SetXTitle("|v_{z}| (cm)");
4149 // fhTimeVz->SetYTitle("#it{t}_{cell} (ns)");
4150 // outputContainer->Add(fhTimeVz);
4151 
4152  fhTimeId = new TH2F ("hTimeId","#it{t}_{cell} vs Absolute Id",
4153  ntimebins,timemin,timemax,fNMaxRows*fNMaxCols*fNModules,0,fNMaxRows*fNMaxCols*fNModules);
4154  fhTimeId->SetXTitle("#it{t}_{cell} (ns)");
4155  fhTimeId->SetYTitle("Cell Absolute Id");
4156  outputContainer->Add(fhTimeId);
4157 
4158  fhTimeAmp = new TH2F ("hTimeAmp","#it{t}_{cell} vs #it{E}_{cell}",nptbins*2,ptmin,ptmax,ntimebins,timemin,timemax);
4159  fhTimeAmp->SetYTitle("#it{t}_{cell} (ns)");
4160  fhTimeAmp->SetXTitle("#it{E}_{cell} (GeV)");
4161  outputContainer->Add(fhTimeAmp);
4162 
4163  for(Int_t bc = 0; bc < 4; bc++)
4164  {
4165  fhTimePerSMPerBC[bc] = new TH2F (Form("hTimePerSM_BC%d",bc),
4166  Form("#it{t}_{cell} vs super-module, for BC/4=%d",bc),
4167  ntimebins,timemin,timemax,fNModules,0,fNModules);
4168  fhTimePerSMPerBC[bc]->SetXTitle("#it{t}_{cell} (ns)");
4169  fhTimePerSMPerBC[bc]->SetYTitle("Module");
4170  outputContainer->Add(fhTimePerSMPerBC[bc]);
4171  }
4172 
4173  fhTimeIdLowGain = new TH2F ("hTimeIdLG","Low gain: #it{t}_{cell} vs Absolute Id",
4174  ntimebins,timemin,timemax,fNMaxRows*fNMaxCols*fNModules,0,fNMaxRows*fNMaxCols*fNModules);
4175  fhTimeIdLowGain->SetXTitle("#it{t}_{cell} (ns)");
4176  fhTimeIdLowGain->SetYTitle("Cell Absolute Id");
4177  outputContainer->Add(fhTimeIdLowGain);
4178 
4179  fhTimeAmpLowGain = new TH2F ("hTimeAmpLG","Low gain: #it{t}_{cell} vs #it{E}_{cell}",nptbins*2,ptmin,ptmax,ntimebins,timemin,timemax);
4180  fhTimeAmpLowGain->SetYTitle("#it{t}_{cell} (ns)");
4181  fhTimeAmpLowGain->SetXTitle("#it{E}_{cell} (GeV)");
4182  outputContainer->Add(fhTimeAmpLowGain);
4183  }
4184 
4185  fhCellECross = new TH2F ("hCellECross","1 - Energy in cross around cell / cell energy",
4186  nptbins,ptmin,ptmax, 400,-1,1.);
4187  fhCellECross->SetXTitle("#it{E}_{cell} (GeV) ");
4188  fhCellECross->SetYTitle("1- #it{E}_{cross}/#it{E}_{cell}");
4189  outputContainer->Add(fhCellECross);
4190 
4191 
4192  if(fCorrelate)
4193  {
4194  // PHOS vs EMCAL
4195  fhEMCALPHOSCorrNClusters = new TH2F ("hEMCALPHOSCorrNClusters","# clusters in EMCAL vs PHOS", nclbins,nclmin,nclmax,nclbins,nclmin,nclmax);
4196  fhEMCALPHOSCorrNClusters->SetXTitle("number of clusters in EMCAL");
4197  fhEMCALPHOSCorrNClusters->SetYTitle("number of clusters in PHOS");
4198  outputContainer->Add(fhEMCALPHOSCorrNClusters);
4199 
4200  fhEMCALPHOSCorrEClusters = new TH2F ("hEMCALPHOSCorrEClusters","summed energy of clusters in EMCAL vs PHOS", nptbins,ptmin,ptmax*2,nptbins,ptmin,ptmax*2);
4201  fhEMCALPHOSCorrEClusters->SetXTitle("#Sigma #it{E} of clusters in EMCAL (GeV)");
4202  fhEMCALPHOSCorrEClusters->SetYTitle("#Sigma #it{E} of clusters in PHOS (GeV)");
4203  outputContainer->Add(fhEMCALPHOSCorrEClusters);
4204 
4205  fhEMCALPHOSCorrNCells = new TH2F ("hEMCALPHOSCorrNCells","# Cells in EMCAL vs PHOS", ncebins,ncemin,ncemax, ncebins,ncemin,ncemax);
4206  fhEMCALPHOSCorrNCells->SetXTitle("number of Cells in EMCAL");
4207  fhEMCALPHOSCorrNCells->SetYTitle("number of Cells in PHOS");
4208  outputContainer->Add(fhEMCALPHOSCorrNCells);
4209 
4210  fhEMCALPHOSCorrECells = new TH2F ("hEMCALPHOSCorrECells","summed energy of Cells in EMCAL vs PHOS", nptbins*2,ptmin,ptmax*4,nptbins*2,ptmin,ptmax*4);
4211  fhEMCALPHOSCorrECells->SetXTitle("#Sigma #it{E} of Cells in EMCAL (GeV)");
4212  fhEMCALPHOSCorrECells->SetYTitle("#Sigma #it{E} of Cells in PHOS (GeV)");
4213  outputContainer->Add(fhEMCALPHOSCorrECells);
4214 
4215  // DCal vs EMCAL
4216  fhEMCALDCALCorrNClusters = new TH2F ("hEMCALDCALCorrNClusters","# clusters in EMCAL vs DCAL", nclbins,nclmin,nclmax,nclbins,nclmin,nclmax);
4217  fhEMCALDCALCorrNClusters->SetXTitle("number of clusters in EMCAL");
4218  fhEMCALDCALCorrNClusters->SetYTitle("number of clusters in DCAL");
4219  outputContainer->Add(fhEMCALDCALCorrNClusters);
4220 
4221  fhEMCALDCALCorrEClusters = new TH2F ("hEMCALDCALCorrEClusters","summed energy of clusters in EMCAL vs DCAL", nptbins,ptmin,ptmax*2,nptbins,ptmin,ptmax*2);
4222  fhEMCALDCALCorrEClusters->SetXTitle("#Sigma #it{E} of clusters in EMCAL (GeV)");
4223  fhEMCALDCALCorrEClusters->SetYTitle("#Sigma #it{E} of clusters in DCAL (GeV)");
4224  outputContainer->Add(fhEMCALDCALCorrEClusters);
4225 
4226  fhEMCALDCALCorrNCells = new TH2F ("hEMCALDCALCorrNCells","# Cells in EMCAL vs DCAL", ncebins,ncemin,ncemax, ncebins,ncemin,ncemax);
4227  fhEMCALDCALCorrNCells->SetXTitle("number of Cells in EMCAL");
4228  fhEMCALDCALCorrNCells->SetYTitle("number of Cells in DCAL");
4229  outputContainer->Add(fhEMCALDCALCorrNCells);
4230 
4231  fhEMCALDCALCorrECells = new TH2F ("hEMCALDCALCorrECells","summed energy of Cells in EMCAL vs DCAL", nptbins*2,ptmin,ptmax*4,nptbins*2,ptmin,ptmax*4);
4232  fhEMCALDCALCorrECells->SetXTitle("#Sigma #it{E} of Cells in EMCAL (GeV)");
4233  fhEMCALDCALCorrECells->SetYTitle("#Sigma #it{E} of Cells in DCAL (GeV)");
4234  outputContainer->Add(fhEMCALDCALCorrECells);
4235 
4236 
4237  // DCAL vs PHOS
4238  fhDCALPHOSCorrNClusters = new TH2F ("hDCALPHOSCorrNClusters","# clusters in DCAL vs PHOS", nclbins,nclmin,nclmax,nclbins,nclmin,nclmax);
4239  fhDCALPHOSCorrNClusters->SetXTitle("number of clusters in DCAL");
4240  fhDCALPHOSCorrNClusters->SetYTitle("number of clusters in PHOS");
4241  outputContainer->Add(fhDCALPHOSCorrNClusters);
4242 
4243  fhDCALPHOSCorrEClusters = new TH2F ("hDCALPHOSCorrEClusters","summed energy of clusters in DCAL vs PHOS", nptbins,ptmin,ptmax*2,nptbins,ptmin,ptmax*2);
4244  fhDCALPHOSCorrEClusters->SetXTitle("#Sigma #it{E} of clusters in DCAL (GeV)");
4245  fhDCALPHOSCorrEClusters->SetYTitle("#Sigma #it{E} of clusters in PHOS (GeV)");
4246  outputContainer->Add(fhDCALPHOSCorrEClusters);
4247 
4248  fhDCALPHOSCorrNCells = new TH2F ("hDCALPHOSCorrNCells","# Cells in DCAL vs PHOS", ncebins,ncemin,ncemax, ncebins,ncemin,ncemax);
4249  fhDCALPHOSCorrNCells->SetXTitle("number of Cells in DCAL");
4250  fhDCALPHOSCorrNCells->SetYTitle("number of Cells in PHOS");
4251  outputContainer->Add(fhDCALPHOSCorrNCells);
4252 
4253  fhDCALPHOSCorrECells = new TH2F ("hDCALPHOSCorrECells","summed energy of Cells in DCAL vs PHOS", nptbins*2,ptmin,ptmax*4,nptbins*2,ptmin,ptmax*4);
4254  fhDCALPHOSCorrECells->SetXTitle("#Sigma #it{E} of Cells in DCAL (GeV)");
4255  fhDCALPHOSCorrECells->SetYTitle("#Sigma #it{E} of Cells in PHOS (GeV)");
4256  outputContainer->Add(fhDCALPHOSCorrECells);
4257 
4258  // Calorimeter vs. V0 signal
4259 
4260  fhCaloV0SCorrNClusters = new TH2F ("hCaloV0SNClusters",Form("# clusters in %s vs V0 signal",GetCalorimeterString().Data()), nv0sbins,nv0smin,nv0smax,nclbins,nclmin,nclmax);
4261  fhCaloV0SCorrNClusters->SetXTitle("V0 signal");
4262  fhCaloV0SCorrNClusters->SetYTitle(Form("number of clusters in %s",GetCalorimeterString().Data()));
4263  outputContainer->Add(fhCaloV0SCorrNClusters);
4264 
4265  fhCaloV0SCorrEClusters = new TH2F ("hCaloV0SEClusters",Form("summed energy of clusters in %s vs V0 signal",GetCalorimeterString().Data()), nv0sbins,nv0smin,nv0smax,nptbins,ptmin,ptmax*2);
4266  fhCaloV0SCorrEClusters->SetXTitle("V0 signal");
4267  fhCaloV0SCorrEClusters->SetYTitle(Form("#Sigma #it{E} of clusters in %s (GeV)",GetCalorimeterString().Data()));
4268  outputContainer->Add(fhCaloV0SCorrEClusters);
4269 
4270  fhCaloV0SCorrNCells = new TH2F ("hCaloV0SNCells",Form("# Cells in %s vs V0 signal",GetCalorimeterString().Data()), nv0sbins,nv0smin,nv0smax, ncebins,ncemin,ncemax);
4271  fhCaloV0SCorrNCells->SetXTitle("V0 signal");
4272  fhCaloV0SCorrNCells->SetYTitle(Form("number of Cells in %s",GetCalorimeterString().Data()));
4273  outputContainer->Add(fhCaloV0SCorrNCells);
4274 
4275  fhCaloV0SCorrECells = new TH2F ("hCaloV0SECells",Form("summed energy of Cells in %s vs V0 signal",GetCalorimeterString().Data()), nv0sbins,nv0smin,nv0smax,nptbins,ptmin,ptmax*2);
4276  fhCaloV0SCorrECells->SetXTitle("V0 signal");
4277  fhCaloV0SCorrECells->SetYTitle(Form("#Sigma #it{E} of Cells in %s (GeV)",GetCalorimeterString().Data()));
4278  outputContainer->Add(fhCaloV0SCorrECells);
4279 
4280  // Calorimeter vs V0 multiplicity
4281 
4282  fhCaloV0MCorrNClusters = new TH2F ("hCaloV0MNClusters",Form("# clusters in %s vs V0 signal",GetCalorimeterString().Data()), nv0mbins,nv0mmin,nv0mmax,nclbins,nclmin,nclmax);
4283  fhCaloV0MCorrNClusters->SetXTitle("V0 signal");
4284  fhCaloV0MCorrNClusters->SetYTitle(Form("number of clusters in %s",GetCalorimeterString().Data()));
4285  outputContainer->Add(fhCaloV0MCorrNClusters);
4286 
4287  fhCaloV0MCorrEClusters = new TH2F ("hCaloV0MEClusters",Form("summed energy of clusters in %s vs V0 signal",GetCalorimeterString().Data()), nv0mbins,nv0mmin,nv0mmax,nptbins,ptmin,ptmax*2);
4288  fhCaloV0MCorrEClusters->SetXTitle("V0 signal");
4289  fhCaloV0MCorrEClusters->SetYTitle(Form("#Sigma #it{E} of clusters in %s (GeV)",GetCalorimeterString().Data()));
4290  outputContainer->Add(fhCaloV0MCorrEClusters);
4291 
4292  fhCaloV0MCorrNCells = new TH2F ("hCaloV0MNCells",Form("# Cells in %s vs V0 signal",GetCalorimeterString().Data()), nv0mbins,nv0mmin,nv0mmax, ncebins,ncemin,ncemax);
4293  fhCaloV0MCorrNCells->SetXTitle("V0 signal");
4294  fhCaloV0MCorrNCells->SetYTitle(Form("number of Cells in %s",GetCalorimeterString().Data()));
4295  outputContainer->Add(fhCaloV0MCorrNCells);
4296 
4297  fhCaloV0MCorrECells = new TH2F ("hCaloV0MECells",Form("summed energy of Cells in %s vs V0 signal",GetCalorimeterString().Data()), nv0mbins,nv0mmin,nv0mmax,nptbins,ptmin,ptmax*2);
4298  fhCaloV0MCorrECells->SetXTitle("V0 signal");
4299  fhCaloV0MCorrECells->SetYTitle(Form("#Sigma #it{E} of Cells in %s (GeV)",GetCalorimeterString().Data()));
4300  outputContainer->Add(fhCaloV0MCorrECells);
4301 
4302  //Calorimeter VS Track multiplicity
4303  fhCaloTrackMCorrNClusters = new TH2F ("hCaloTrackMNClusters",Form("# clusters in %s vs # tracks",GetCalorimeterString().Data()), ntrmbins,ntrmmin,ntrmmax,nclbins,nclmin,nclmax);
4304  fhCaloTrackMCorrNClusters->SetXTitle("# tracks");
4305  fhCaloTrackMCorrNClusters->SetYTitle(Form("number of clusters in %s",GetCalorimeterString().Data()));
4306  outputContainer->Add(fhCaloTrackMCorrNClusters);
4307 
4308  fhCaloTrackMCorrEClusters = new TH2F ("hCaloTrackMEClusters",Form("summed energy of clusters in %s vs # tracks",GetCalorimeterString().Data()), ntrmbins,ntrmmin,ntrmmax,nptbins,ptmin,ptmax*2);
4309  fhCaloTrackMCorrEClusters->SetXTitle("# tracks");
4310  fhCaloTrackMCorrEClusters->SetYTitle(Form("#Sigma #it{E} of clusters in %s (GeV)",GetCalorimeterString().Data()));
4311  outputContainer->Add(fhCaloTrackMCorrEClusters);
4312 
4313  fhCaloTrackMCorrNCells = new TH2F ("hCaloTrackMNCells",Form("# Cells in %s vs # tracks",GetCalorimeterString().Data()), ntrmbins,ntrmmin,ntrmmax, ncebins,ncemin,ncemax);
4314  fhCaloTrackMCorrNCells->SetXTitle("# tracks");
4315  fhCaloTrackMCorrNCells->SetYTitle(Form("number of Cells in %s",GetCalorimeterString().Data()));
4316  outputContainer->Add(fhCaloTrackMCorrNCells);
4317 
4318  fhCaloTrackMCorrECells = new TH2F ("hCaloTrackMECells",Form("summed energy of Cells in %s vs # tracks",GetCalorimeterString().Data()), ntrmbins,ntrmmin,ntrmmax,nptbins,ptmin,ptmax*2);
4319  fhCaloTrackMCorrECells->SetXTitle("# tracks");
4320  fhCaloTrackMCorrECells->SetYTitle(Form("#Sigma #it{E} of Cells in %s (GeV)",GetCalorimeterString().Data()));
4321  outputContainer->Add(fhCaloTrackMCorrECells);
4322 
4323  fhCaloCenNClusters = new TH2F ("hCaloCenNClusters","# clusters in calorimeter vs centrality",100,0,100,nclbins,nclmin,nclmax);
4324  fhCaloCenNClusters->SetYTitle("number of clusters in calorimeter");
4325  fhCaloCenNClusters->SetXTitle("Centrality");
4326  outputContainer->Add(fhCaloCenNClusters);
4327 
4328  fhCaloCenEClusters = new TH2F ("hCaloCenEClusters","summed energy of clusters in calorimeter vs centrality",100,0,100,nptbins,ptmin,ptmax*2);
4329  fhCaloCenEClusters->SetYTitle("#Sigma #it{E} of clusters in calorimeter (GeV)");
4330  fhCaloCenEClusters->SetXTitle("Centrality");
4331  outputContainer->Add(fhCaloCenEClusters);
4332 
4333  fhCaloCenNCells = new TH2F ("hCaloCenNCells","# Cells in calorimeter vs centrality",100,0,100,ncebins,ncemin,ncemax);
4334  fhCaloCenNCells->SetYTitle("number of Cells in calorimeter");
4335  fhCaloCenNCells->SetXTitle("Centrality");
4336  outputContainer->Add(fhCaloCenNCells);
4337 
4338  fhCaloCenECells = new TH2F ("hCaloCenECells","summed energy of Cells in calorimeter vs centrality",100,0,100,nptbins*2,ptmin,ptmax*4);
4339  fhCaloCenECells->SetYTitle("#Sigma #it{E} of Cells in calorimeter (GeV)");
4340  fhCaloCenECells->SetXTitle("Centrality");
4341  outputContainer->Add(fhCaloCenECells);
4342 
4343  fhCaloEvPNClusters = new TH2F ("hCaloEvPNClusters","# clusters in calorimeter vs event plane angle",100,0,TMath::Pi(),nclbins,nclmin,nclmax);
4344  fhCaloEvPNClusters->SetYTitle("number of clusters in calorimeter");
4345  fhCaloEvPNClusters->SetXTitle("Event plane angle (rad)");
4346  outputContainer->Add(fhCaloEvPNClusters);
4347 
4348  fhCaloEvPEClusters = new TH2F ("hCaloEvPEClusters","summed energy of clusters in calorimeter vs event plane angle",100,0,TMath::Pi(),nptbins,ptmin,ptmax*2);
4349  fhCaloEvPEClusters->SetYTitle("#Sigma #it{E} of clusters in calorimeter (GeV)");
4350  fhCaloEvPEClusters->SetXTitle("Event plane angle (rad)");
4351  outputContainer->Add(fhCaloEvPEClusters);
4352 
4353  fhCaloEvPNCells = new TH2F ("hCaloEvPNCells","# Cells in calorimeter vs event plane angle",100,0,TMath::Pi(),ncebins,ncemin,ncemax);
4354  fhCaloEvPNCells->SetYTitle("number of Cells in calorimeter");
4355  fhCaloEvPNCells->SetXTitle("Event plane angle (rad)");
4356  outputContainer->Add(fhCaloEvPNCells);
4357 
4358  fhCaloEvPECells = new TH2F ("hCaloEvPECells","summed energy of Cells in calorimeter vs event plane angle",100,0,TMath::Pi(),nptbins*2,ptmin,ptmax*4);
4359  fhCaloEvPECells->SetYTitle("#Sigma #it{E} of Cells in calorimeter (GeV)");
4360  fhCaloEvPECells->SetXTitle("Event plane angle (rad)");
4361  outputContainer->Add(fhCaloEvPECells);
4362  } // correlate calorimeters
4363 
4364  // Module histograms
4365 
4366  fhEMod = new TH2F ("hE_Mod","Cluster reconstructed Energy in each present Module",nptbins,ptmin,ptmax,fNModules,0,fNModules);
4367  fhEMod->SetXTitle("#it{E} (GeV)");
4368  fhEMod->SetYTitle("Module");
4369  outputContainer->Add(fhEMod);
4370 
4371  fhAmpMod = new TH2F ("hAmp_Mod","Cell energy in each present Module",nptbins,ptmin,ptmax,fNModules,0,fNModules);
4372  fhAmpMod->SetXTitle("#it{E} (GeV)");
4373  fhAmpMod->SetYTitle("Module");
4374  outputContainer->Add(fhAmpMod);
4375 
4376  fhEWeirdMod = new TH2F ("hEWeird_Mod","Cluster reconstructed Energy in each present Module, ridiculously large E",200,0,10000,fNModules,0,fNModules);
4377  fhEWeirdMod->SetXTitle("#it{E} (GeV)");
4378  fhEWeirdMod->SetYTitle("Module");
4379  outputContainer->Add(fhEWeirdMod);
4380 
4381  fhAmpWeirdMod = new TH2F ("hAmpWeird_Mod","Cell energy in each present Module, ridiculously large E",200,0,10000,fNModules,0,fNModules);
4382  fhAmpWeirdMod->SetXTitle("#it{E} (GeV)");
4383  fhAmpWeirdMod->SetYTitle("Module");
4384  outputContainer->Add(fhAmpWeirdMod);
4385 
4387  {
4388  fhTimeMod = new TH2F ("hTime_Mod","Cell time in each present Module",ntimebins,timemin,timemax,fNModules,0,fNModules);
4389  fhTimeMod->SetXTitle("t (ns)");
4390  fhTimeMod->SetYTitle("Module");
4391  outputContainer->Add(fhTimeMod);
4392  }
4393 
4394  fhNClustersMod = new TH2F ("hNClusters_Mod","# clusters vs Module", nclbins,nclmin+0.5,nclmax,fNModules,0,fNModules);
4395  fhNClustersMod->SetXTitle("number of clusters");
4396  fhNClustersMod->SetYTitle("Module");
4397  outputContainer->Add(fhNClustersMod);
4398 
4399  fhNCellsMod = new TH2F ("hNCells_Mod","# cells vs Module", ncebins,ncemin+0.5,ncemax,fNModules,0,fNModules);
4400  fhNCellsMod->SetXTitle("#it{n}_{cells}");
4401  fhNCellsMod->SetYTitle("Module");
4402  outputContainer->Add(fhNCellsMod);
4403 
4404  fhSumClustersEnergyMod = new TH2F ("hSumClustersEnergy_Mod","# clusters vs Module", 1000, 0, 2000,fNModules,0,fNModules);
4405  fhSumClustersEnergyMod->SetXTitle("#Sigma_{clusters} #it{E} (GeV)");
4406  fhSumClustersEnergyMod->SetYTitle("Module");
4407  outputContainer->Add(fhSumClustersEnergyMod);
4408 
4409  fhSumCellsAmpMod = new TH2F ("hSumCellsAmp_Mod","# cells vs Module", 1000, 0, 2000,fNModules,0,fNModules);
4410  fhSumCellsAmpMod->SetXTitle("#Sigma_{cells} #it{Amp} (GeV)");
4411  fhSumCellsAmpMod->SetYTitle("Module");
4412  outputContainer->Add(fhSumCellsAmpMod);
4413 
4414  Int_t colmaxs = fNMaxCols;
4415  Int_t rowmaxs = fNMaxRows;
4416  if(GetCalorimeter()==kEMCAL)
4417  {
4418  colmaxs=2*fNMaxCols;
4419  rowmaxs=Int_t(fNModules/2)*fNMaxRows;
4420  }
4421  else
4422  {
4423  rowmaxs=fNModules*fNMaxRows;
4424  }
4425 
4426  fhGridCells = new TH2F ("hGridCells",Form("Entries in grid of cells"),
4427  colmaxs+2,-1.5,colmaxs+0.5, rowmaxs+2,-1.5,rowmaxs+0.5);
4428  fhGridCells->SetYTitle("row (phi direction)");
4429  fhGridCells->SetXTitle("column (eta direction)");
4430  outputContainer->Add(fhGridCells);
4431 
4432  fhGridCellsE = new TH2F ("hGridCellsE","Accumulated energy in grid of cells",
4433  colmaxs+2,-1.5,colmaxs+0.5, rowmaxs+2,-1.5,rowmaxs+0.5);
4434  fhGridCellsE->SetYTitle("row (phi direction)");
4435  fhGridCellsE->SetXTitle("column (eta direction)");
4436  outputContainer->Add(fhGridCellsE);
4437 
4438  fhGridCellsLowGain = new TH2F ("hGridCellsLG",Form("Low gain: Entries in grid of cells"),
4439  colmaxs+2,-1.5,colmaxs+0.5, rowmaxs+2,-1.5,rowmaxs+0.5);
4440  fhGridCellsLowGain->SetYTitle("row (phi direction)");
4441  fhGridCellsLowGain->SetXTitle("column (eta direction)");
4442  outputContainer->Add(fhGridCellsLowGain);
4443 
4444  fhGridCellsELowGain = new TH2F ("hGridCellsELG","Low gain: Accumulated energy in grid of cells",
4445  colmaxs+2,-1.5,colmaxs+0.5, rowmaxs+2,-1.5,rowmaxs+0.5);
4446  fhGridCellsELowGain->SetYTitle("row (phi direction)");
4447  fhGridCellsELowGain->SetXTitle("column (eta direction)");
4448  outputContainer->Add(fhGridCellsELowGain);
4449 
4451  {
4452  fhGridCellsTime = new TH2F ("hGridCellsTime","Accumulated time in grid of cells",
4453  colmaxs+2,-1.5,colmaxs+0.5, rowmaxs+2,-1.5,rowmaxs+0.5);
4454  fhGridCellsTime->SetYTitle("row (phi direction)");
4455  fhGridCellsTime->SetXTitle("column (eta direction)");
4456  outputContainer->Add(fhGridCellsTime);
4457 
4458  fhGridCellsTimeLowGain = new TH2F ("hGridCellsTimeLG","Low gain: Accumulated time in grid of cells",
4459  colmaxs+2,-1.5,colmaxs+0.5, rowmaxs+2,-1.5,rowmaxs+0.5);
4460  fhGridCellsTimeLowGain->SetYTitle("row (phi direction)");
4461  fhGridCellsTimeLowGain->SetXTitle("column (eta direction)");
4462  outputContainer->Add(fhGridCellsTimeLowGain);
4463  }
4464 
4466 
4468 
4469  fhIMMod = new TH2F*[fNModules];
4470 
4472 
4473  if(fStudyBadClusters)
4475 
4477  fhTimeAmpPerRCU = new TH2F*[fNModules*fNRCU];
4478 
4479  for(Int_t imod = 0; imod < fNModules; imod++)
4480  {
4481  fhNCellsSumAmpPerMod[imod] = new TH2F (Form("hNCellsSumAmp_Mod%d",imod),
4482  Form("# cells in SM vs sum of cells energy in Module %d",imod),
4483  nptbins,ptmin,ptmax*4, ncebins,ncemin,ncemax);
4484  fhNCellsSumAmpPerMod[imod]->SetXTitle("#Sigma #it{Amplitude} (GeV)");
4485  fhNCellsSumAmpPerMod[imod]->SetYTitle("#Sigma #it{n}_{cells}");
4486  outputContainer->Add(fhNCellsSumAmpPerMod[imod]);
4487 
4488  fhNClustersSumEnergyPerMod[imod] = new TH2F (Form("hNClustersSumEnergy_Mod%d",imod),
4489  Form("# clusters in SM vs sum of clusters energy in Module %d",imod),
4490  nptbins,ptmin,ptmax*4, nclbins,nclmin,nclmax);
4491  fhNClustersSumEnergyPerMod[imod]->SetXTitle("#Sigma #it{E} (GeV)");
4492  fhNClustersSumEnergyPerMod[imod]->SetYTitle("#Sigma #it{n}_{clusters}");
4493  outputContainer->Add(fhNClustersSumEnergyPerMod[imod]);
4494 
4495  fhNCellsPerClusterMod[imod] = new TH2F (Form("hNCellsPerCluster_Mod%d",imod),
4496  Form("# cells per cluster vs cluster energy in Module %d",imod),
4497  nptbins,ptmin,ptmax, nceclbins,nceclmin,nceclmax);
4498  fhNCellsPerClusterMod[imod]->SetXTitle("#it{E} (GeV)");
4499  fhNCellsPerClusterMod[imod]->SetYTitle("#it{n}_{cells per cluster}");
4500  outputContainer->Add(fhNCellsPerClusterMod[imod]);
4501 
4502  if(fStudyBadClusters)
4503  {
4504  fhNCellsPerClusterModNoCut[imod] = new TH2F (Form("hNCellsPerClusterNoCut_Mod%d",imod),
4505  Form("# cells per cluster vs cluster energy in Module %d, no cut",imod),
4506  nptbins,ptmin,ptmax, nceclbins,nceclmin,nceclmax);
4507  fhNCellsPerClusterModNoCut[imod]->SetXTitle("#it{E} (GeV)");
4508  fhNCellsPerClusterModNoCut[imod]->SetYTitle("#it{n}_{cells per cluster}");
4509  outputContainer->Add(fhNCellsPerClusterModNoCut[imod]);
4510  }
4511 
4513  {
4514  for(Int_t ircu = 0; ircu < fNRCU; ircu++)
4515  {
4516  fhTimeAmpPerRCU[imod*fNRCU+ircu] = new TH2F (Form("hTimeAmp_Mod%d_RCU%d",imod,ircu),
4517  Form("#it{E}_{cell} vs #it{t}_{cell} in Module %d, RCU %d ",imod,ircu),
4518  nptbins,ptmin,ptmax,ntimebins,timemin,timemax);
4519  fhTimeAmpPerRCU[imod*fNRCU+ircu]->SetXTitle("#it{E} (GeV)");
4520  fhTimeAmpPerRCU[imod*fNRCU+ircu]->SetYTitle("#it{t} (ns)");
4521  outputContainer->Add(fhTimeAmpPerRCU[imod*fNRCU+ircu]);
4522  }
4523  }
4524 
4525  if(fFillAllPi0Histo)
4526  {
4527  fhIMMod[imod] = new TH2F (Form("hIM_Mod%d",imod),
4528  Form("Cluster pairs Invariant mass vs reconstructed pair energy in Module %d, n cell > 1",imod),
4529  nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
4530  fhIMMod[imod]->SetXTitle("#it{p}_{T, cluster pairs} (GeV) ");
4531  fhIMMod[imod]->SetYTitle("#it{M}_{cluster pairs} (GeV/#it{c}^{2})");
4532  outputContainer->Add(fhIMMod[imod]);
4533  }
4534  }
4535 
4536  // Monte Carlo Histograms
4537 
4538  TString particleName[] = {
4539  "Photon", "Pi0", "Eta",
4540  "Electron", "PhotonConv",
4541  "NeutralHadron", "ChargedHadron" };
4542 
4543  if(IsDataMC())
4544  {
4545  for(Int_t iPart = 0; iPart < 7; iPart++)
4546  {
4547  for(Int_t iCh = 0; iCh < 2; iCh++)
4548  {
4549  fhRecoMCRatioE[iPart][iCh] = new TH2F (Form("hRecoMCRatioE_%s_Match%d",particleName[iPart].Data(),iCh),
4550  Form("Reconstructed/Generated E, %s, Matched %d",particleName[iPart].Data(),iCh),
4551  nptbins, ptmin, ptmax, 200,0,2);
4552  fhRecoMCRatioE[iPart][iCh]->SetYTitle("#it{E}_{reconstructed}/#it{E}_{generated}");
4553  fhRecoMCRatioE[iPart][iCh]->SetXTitle("#it{E}_{reconstructed} (GeV)");
4554  outputContainer->Add(fhRecoMCRatioE[iPart][iCh]);
4555 
4556 
4557  fhRecoMCDeltaE[iPart][iCh] = new TH2F (Form("hRecoMCDeltaE_%s_Match%d",particleName[iPart].Data(),iCh),
4558  Form("Generated - Reconstructed E, %s, Matched %d",particleName[iPart].Data(),iCh),
4559  nptbins, ptmin, ptmax, nptbins*2,-ptmax,ptmax);
4560  fhRecoMCDeltaE[iPart][iCh]->SetYTitle("#Delta #it{E} (GeV)");
4561  fhRecoMCDeltaE[iPart][iCh]->SetXTitle("#it{E}_{reconstructed} (GeV)");
4562  outputContainer->Add(fhRecoMCDeltaE[iPart][iCh]);
4563 
4564  fhRecoMCDeltaPhi[iPart][iCh] = new TH2F (Form("hRecoMCDeltaPhi_%s_Match%d",particleName[iPart].Data(),iCh),
4565  Form("Generated - Reconstructed #varphi, %s, Matched %d",particleName[iPart].Data(),iCh),
4566  nptbins, ptmin, ptmax, nphibins*2,-phimax,phimax);
4567  fhRecoMCDeltaPhi[iPart][iCh]->SetYTitle("#Delta #varphi (rad)");
4568  fhRecoMCDeltaPhi[iPart][iCh]->SetXTitle("#it{E}_{reconstructed} (GeV)");
4569  outputContainer->Add(fhRecoMCDeltaPhi[iPart][iCh]);
4570 
4571  fhRecoMCDeltaEta[iPart][iCh] = new TH2F (Form("hRecoMCDeltaEta_%s_Match%d",particleName[iPart].Data(),iCh),
4572  Form("Generated - Reconstructed #eta, %s, Matched %d",particleName[iPart].Data(),iCh),
4573  nptbins, ptmin, ptmax,netabins*2,-etamax,etamax);
4574  fhRecoMCDeltaEta[iPart][iCh]->SetYTitle("#Delta #eta ");
4575  fhRecoMCDeltaEta[iPart][iCh]->SetXTitle("#it{E}_{reconstructed} (GeV)");
4576  outputContainer->Add(fhRecoMCDeltaEta[iPart][iCh]);
4577 
4578  fhRecoMCE[iPart][iCh] = new TH2F (Form("hRecoMCE_%s_Match%d",particleName[iPart].Data(),iCh),
4579  Form("#it{E} distribution, reconstructed vs generated, %s, Matched %d",particleName[iPart].Data(),iCh),
4580  nptbins,ptmin,ptmax,nptbins,ptmin,ptmax);
4581  fhRecoMCE[iPart][iCh]->SetXTitle("#it{E}_{rec} (GeV)");
4582  fhRecoMCE[iPart][iCh]->SetYTitle("#it{E}_{gen} (GeV)");
4583  outputContainer->Add(fhRecoMCE[iPart][iCh]);
4584 
4585  fhRecoMCPhi[iPart][iCh] = new TH2F (Form("hRecoMCPhi_%s_Match%d",particleName[iPart].Data(),iCh),
4586  Form("#varphi distribution, reconstructed vs generated, %s, Matched %d",particleName[iPart].Data(),iCh),
4587  nphibins,phimin,phimax, nphibins,phimin,phimax);
4588  fhRecoMCPhi[iPart][iCh]->SetXTitle("#varphi_{reconstructed} (rad)");
4589  fhRecoMCPhi[iPart][iCh]->SetYTitle("#varphi_{generated} (rad)");
4590  outputContainer->Add(fhRecoMCPhi[iPart][iCh]);
4591 
4592  fhRecoMCEta[iPart][iCh] = new TH2F (Form("hRecoMCEta_%s_Match%d",particleName[iPart].Data(),iCh),
4593  Form("#eta distribution, reconstructed vs generated, %s, Matched %d",particleName[iPart].Data(),iCh),
4594  netabins,etamin,etamax,netabins,etamin,etamax);
4595  fhRecoMCEta[iPart][iCh]->SetXTitle("#eta_{reconstructed} ");
4596  fhRecoMCEta[iPart][iCh]->SetYTitle("#eta_{generated} ");
4597  outputContainer->Add(fhRecoMCEta[iPart][iCh]);
4598  }
4599  }
4600 
4601  // Pure MC
4602 
4603  for(Int_t iPart = 0; iPart < 4; iPart++)
4604  {
4605  fhGenMCE [iPart] = new TH1F(Form("hGenMCE_%s",particleName[iPart].Data()) ,
4606  Form("#it{E} of generated %s",particleName[iPart].Data()),
4607  nptbins,ptmin,ptmax);
4608 
4609  fhGenMCPt[iPart] = new TH1F(Form("hGenMCPt_%s",particleName[iPart].Data()) ,
4610  Form("#it{p}_{T} of generated %s",particleName[iPart].Data()),
4611  nptbins,ptmin,ptmax);
4612 
4613  fhGenMCEtaPhi[iPart] = new TH2F(Form("hGenMCEtaPhi_%s",particleName[iPart].Data()),
4614  Form("Y vs #varphi of generated %s",particleName[iPart].Data()),
4615  200,-1,1,360,0,TMath::TwoPi());
4616 
4617  fhGenMCE [iPart] ->SetXTitle("#it{E} (GeV)");
4618  fhGenMCPt[iPart] ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
4619  fhGenMCEtaPhi[iPart]->SetXTitle("#eta");
4620  fhGenMCEtaPhi[iPart]->SetYTitle("#varphi (rad)");
4621 
4622  outputContainer->Add(fhGenMCE [iPart]);
4623  outputContainer->Add(fhGenMCPt [iPart]);
4624  outputContainer->Add(fhGenMCEtaPhi[iPart]);
4625 
4626 
4627  fhGenMCAccE [iPart] = new TH1F(Form("hGenMCAccE_%s",particleName[iPart].Data()) ,
4628  Form("#it{E} of generated %s",particleName[iPart].Data()),
4629  nptbins,ptmin,ptmax);
4630  fhGenMCAccPt[iPart] = new TH1F(Form("hGenMCAccPt_%s",particleName[iPart].Data()) ,
4631  Form("#it{p}_{T} of generated %s",particleName[iPart].Data()),
4632  nptbins,ptmin,ptmax);
4633  fhGenMCAccEtaPhi[iPart] = new TH2F(Form("hGenMCAccEtaPhi_%s",particleName[iPart].Data()),
4634  Form("Y vs #varphi of generated %s",particleName[iPart].Data()),
4635  netabins,etamin,etamax,nphibins,phimin,phimax);
4636 
4637  fhGenMCAccE [iPart] ->SetXTitle("#it{E} (GeV)");
4638  fhGenMCAccPt[iPart] ->SetXTitle("#it{p}_{T} (GeV/#it{c})");
4639  fhGenMCAccEtaPhi[iPart]->SetXTitle("#eta");
4640  fhGenMCAccEtaPhi[iPart]->SetYTitle("#varphi (rad)");
4641 
4642  outputContainer->Add(fhGenMCAccE [iPart]);
4643  outputContainer->Add(fhGenMCAccPt [iPart]);
4644  outputContainer->Add(fhGenMCAccEtaPhi[iPart]);
4645 
4646  }
4647 
4648  // Vertex of generated particles
4649 
4650  fhEMVxyz = new TH2F ("hEMVxyz","Production vertex of reconstructed ElectroMagnetic particles",nvdistbins,vdistmin,vdistmax,nvdistbins,vdistmin,vdistmax);//,100,0,500);
4651  fhEMVxyz->SetXTitle("#it{v}_{x}");
4652  fhEMVxyz->SetYTitle("#it{v}_{y}");
4653  //fhEMVxyz->SetZTitle("v_{z}");
4654  outputContainer->Add(fhEMVxyz);
4655 
4656  fhHaVxyz = new TH2F ("hHaVxyz","Production vertex of reconstructed hadrons",nvdistbins,vdistmin,vdistmax,nvdistbins,vdistmin,vdistmax);//,100,0,500);
4657  fhHaVxyz->SetXTitle("#it{v}_{x}");
4658  fhHaVxyz->SetYTitle("#it{v}_{y}");
4659  //fhHaVxyz->SetZTitle("v_{z}");
4660  outputContainer->Add(fhHaVxyz);
4661 
4662  fhEMR = new TH2F ("hEMR","Distance to production vertex of reconstructed ElectroMagnetic particles vs E rec",nptbins,ptmin,ptmax,nvdistbins,vdistmin,vdistmax);
4663  fhEMR->SetXTitle("#it{E} (GeV)");
4664  fhEMR->SetYTitle("TMath::Sqrt(v_{x}^{2}+v_{y}^{2})");
4665  outputContainer->Add(fhEMR);
4666 
4667  fhHaR = new TH2F ("hHaR","Distance to production vertex of reconstructed Hadrons vs E rec",nptbins,ptmin,ptmax,nvdistbins,vdistmin,vdistmax);
4668  fhHaR->SetXTitle("#it{E} (GeV)");
4669  fhHaR->SetYTitle("TMath::Sqrt(v_{x}^{2}+v_{y}^{2})");
4670  outputContainer->Add(fhHaR);
4671 
4672  // Track Matching
4673 
4674  fhMCEle1EOverP = new TH2F("hMCEle1EOverP","TRACK matches #it{E}/#it{p}, MC electrons",nptbins,ptmin,ptmax, nPoverEbins,eOverPmin,eOverPmax);
4675  fhMCEle1EOverP->SetYTitle("#it{E}/#it{p}");
4676  fhMCEle1EOverP->SetXTitle("#it{p}_{T} (GeV/#it{c})");
4677  outputContainer->Add(fhMCEle1EOverP);
4678 
4679  fhMCEle1dR = new TH1F("hMCEle1dR","TRACK matches dR, MC electrons",ndRbins,dRmin,dRmax);
4680  fhMCEle1dR->SetXTitle("#Delta #it{R} (rad)");
4681  outputContainer->Add(fhMCEle1dR) ;
4682 
4683  fhMCEle2MatchdEdx = new TH2F("hMCEle2MatchdEdx","#it{dE/dx} vs. #it{p} for all matches, MC electrons",nptbins,ptmin,ptmax,ndedxbins,dedxmin,dedxmax);
4684  fhMCEle2MatchdEdx->SetXTitle("#it{p} (GeV/#it{c})");
4685  fhMCEle2MatchdEdx->SetYTitle("<#it{dE/dx}>");
4686  outputContainer->Add(fhMCEle2MatchdEdx);
4687 
4688  fhMCChHad1EOverP = new TH2F("hMCChHad1EOverP","TRACK matches #it{E}/#it{p}, MC charged hadrons",nptbins,ptmin,ptmax, nPoverEbins,eOverPmin,eOverPmax);
4689  fhMCChHad1EOverP->SetYTitle("#it{E}/#it{p}");
4690  fhMCChHad1EOverP->SetXTitle("#it{p}_{T} (GeV/#it{c})");
4691  outputContainer->Add(fhMCChHad1EOverP);
4692 
4693  fhMCChHad1dR = new TH1F("hMCChHad1dR","TRACK matches dR, MC charged hadrons",ndRbins,dRmin,dRmax);
4694  fhMCChHad1dR->SetXTitle("#Delta R (rad)");
4695  outputContainer->Add(fhMCChHad1dR) ;
4696 
4697  fhMCChHad2MatchdEdx = new TH2F("hMCChHad2MatchdEdx","#it{dE/dx} vs. #it{p} for all matches, MC charged hadrons",nptbins,ptmin,ptmax,ndedxbins,dedxmin,dedxmax);
4698  fhMCChHad2MatchdEdx->SetXTitle("#it{p} (GeV/#it{c})");
4699  fhMCChHad2MatchdEdx->SetYTitle("#it{dE/dx}>");
4700  outputContainer->Add(fhMCChHad2MatchdEdx);
4701 
4702  fhMCNeutral1EOverP = new TH2F("hMCNeutral1EOverP","TRACK matches #it{E}/#it{p}, MC neutrals",nptbins,ptmin,ptmax, nPoverEbins,eOverPmin,eOverPmax);
4703  fhMCNeutral1EOverP->SetYTitle("#it{E}/#it{p}");
4704  fhMCNeutral1EOverP->SetXTitle("#it{p}_{T} (GeV/#it{c})");
4705  outputContainer->Add(fhMCNeutral1EOverP);
4706 
4707  fhMCNeutral1dR = new TH1F("hMCNeutral1dR","TRACK matches dR, MC neutrals",ndRbins,dRmin,dRmax);
4708  fhMCNeutral1dR->SetXTitle("#Delta #it{R} (rad)");
4709  outputContainer->Add(fhMCNeutral1dR) ;
4710 
4711  fhMCNeutral2MatchdEdx = new TH2F("hMCNeutral2MatchdEdx","#it{dE/dx} vs. #it{p} for all matches, MC neutrals",nptbins,ptmin,ptmax,ndedxbins,dedxmin,dedxmax);
4712  fhMCNeutral2MatchdEdx->SetXTitle("#it{p} (GeV/#it{c})");
4713  fhMCNeutral2MatchdEdx->SetYTitle("#it{dE/dx}>");
4714  outputContainer->Add(fhMCNeutral2MatchdEdx);
4715 
4716  fhMCEle1EOverPR02 = new TH2F("hMCEle1EOverPR02","TRACK matches #it{E}/#it{p}, MC electrons",nptbins,ptmin,ptmax, nPoverEbins,eOverPmin,eOverPmax);
4717  fhMCEle1EOverPR02->SetYTitle("#it{E}/#it{p}");
4718  fhMCEle1EOverPR02->SetXTitle("#it{p}_{T} (GeV/#it{c})");
4719  outputContainer->Add(fhMCEle1EOverPR02);
4720 
4721  fhMCChHad1EOverPR02 = new TH2F("hMCChHad1EOverPR02","TRACK matches #it{E}/#it{p}, MC charged hadrons",nptbins,ptmin,ptmax, nPoverEbins,eOverPmin,eOverPmax);
4722  fhMCChHad1EOverPR02->SetYTitle("#it{E}/#it{p}");
4723  fhMCChHad1EOverPR02->SetXTitle("#it{p}_{T} (GeV/#it{c})");
4724  outputContainer->Add(fhMCChHad1EOverPR02);
4725 
4726  fhMCNeutral1EOverPR02 = new TH2F("hMCNeutral1EOverPR02","TRACK matches #it{E}/#it{p}, MC neutrals",nptbins,ptmin,ptmax, nPoverEbins,eOverPmin,eOverPmax);
4727  fhMCNeutral1EOverPR02->SetYTitle("#it{E}/#it{p}");
4728  fhMCNeutral1EOverPR02->SetXTitle("#it{p}_{T} (GeV/#it{c})");
4729  outputContainer->Add(fhMCNeutral1EOverPR02);
4730 
4731  fhMCEle1EleEOverP = new TH2F("hMCEle1EleEOverP","Electron candidates #it{E}/#it{p} (60<dEdx<100), MC electrons",nptbins,ptmin,ptmax, nPoverEbins,eOverPmin,eOverPmax);
4732  fhMCEle1EleEOverP->SetYTitle("#it{E}/#it{p}");
4733  fhMCEle1EleEOverP->SetXTitle("#it{p}_{T} (GeV/#it{c})");
4734  outputContainer->Add(fhMCEle1EleEOverP);
4735 
4736  fhMCChHad1EleEOverP = new TH2F("hMCEle1EleEOverP","Electron candidates #it{E}/#it{p} (60<dEdx<100), MC charged hadrons",nptbins,ptmin,ptmax, nPoverEbins,eOverPmin,eOverPmax);
4737  fhMCChHad1EleEOverP->SetYTitle("#it{E}/#it{p}");
4738  fhMCChHad1EleEOverP->SetXTitle("#it{p}_{T} (GeV/#it{c})");
4739  outputContainer->Add(fhMCChHad1EleEOverP);
4740 
4741  fhMCNeutral1EleEOverP = new TH2F("hMCNeutral1EleEOverP","Electron candidates #it{E}/#it{p} (60<dEdx<100), MC neutrals",nptbins,ptmin,ptmax, nPoverEbins,eOverPmin,eOverPmax);
4742  fhMCNeutral1EleEOverP->SetYTitle("#it{E}/#it{p}");
4743  fhMCNeutral1EleEOverP->SetXTitle("#it{p}_{T} (GeV/#it{c})");
4744  outputContainer->Add(fhMCNeutral1EleEOverP);
4745  }
4746 
4747 
4749  {
4750  for(Int_t ie=0; ie<fNEBinCuts; ie++)
4751  {
4752  fhEBinClusterEtaPhi[ie] = new TH2F
4753  (Form("hEBin%d_Cluster_EtaPhi",ie),
4754  Form("#eta vs #varphi, cluster, %2.2f<#it{p}_{T}<%2.2f GeV/#it{c}",fEBinCuts[ie],fEBinCuts[ie+1]),
4755  netabins,etamin,etamax,nphibins,phimin,phimax);
4756  fhEBinClusterEtaPhi[ie]->SetYTitle("#varphi (rad)");
4757  fhEBinClusterEtaPhi[ie]->SetXTitle("#eta");
4758  outputContainer->Add(fhEBinClusterEtaPhi[ie]) ;
4759 
4760  fhEBinClusterColRow[ie] = new TH2F
4761  (Form("hEBin%d_Cluster_ColRow",ie),
4762  Form("column vs row, cluster max E cell, %2.2f<#it{p}_{T}<%2.2f GeV/#it{c}",fEBinCuts[ie],fEBinCuts[ie+1]),
4763  96+2,-1.5,96+0.5,(8*24+2*8)+2,-1.5,(8*24+2*8)+0.5);
4764  fhEBinClusterColRow[ie]->SetYTitle("row");
4765  fhEBinClusterColRow[ie]->SetXTitle("column");
4766  outputContainer->Add(fhEBinClusterColRow[ie]) ;
4767 
4768  fhEBinCellColRow[ie] = new TH2F
4769  (Form("hEBin%d_Cell_ColRow",ie),
4770  Form("column vs row, cell, %2.2f<#it{p}_{T}<%2.2f GeV/#it{c}",fEBinCuts[ie],fEBinCuts[ie+1]),