]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/PartCorrDep/AliAnaCalorimeterQA.cxx
coverity FORWARD_NULL corrected
[u/mrichter/AliRoot.git] / PWG4 / PartCorrDep / AliAnaCalorimeterQA.cxx
CommitLineData
9725fd2a 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/* $Id: $ */
16
a6f26052 17//_________________________________________________________________________
18// Class to check results from simulations or reconstructed real data.
19// Fill few histograms and do some checking plots
20//
21//-- Author: Gustavo Conesa (INFN-LNF)
22//_________________________________________________________________________
9725fd2a 23
24
a6f26052 25// --- ROOT system ---
26//#include "Riostream.h"
591cc579 27#include "TObjArray.h"
9725fd2a 28#include "TParticle.h"
c180f65d 29#include "TDatabasePDG.h"
9725fd2a 30#include "TCanvas.h"
31#include "TPad.h"
32#include "TROOT.h"
a5fafd85 33#include "TH3F.h"
9725fd2a 34#include "TH2F.h"
35#include "TLegend.h"
a5fafd85 36#include "TStyle.h"
0c1383b5 37#include <TObjString.h>
9725fd2a 38
a6f26052 39//---- AliRoot system ----
9725fd2a 40#include "AliAnaCalorimeterQA.h"
41#include "AliCaloTrackReader.h"
42#include "AliStack.h"
c8fe2783 43#include "AliVCaloCells.h"
ff45398a 44#include "AliFiducialCut.h"
c8fe2783 45#include "AliVTrack.h"
46#include "AliVCluster.h"
47#include "AliVEvent.h"
902aa95c 48#include "AliVEventHandler.h"
49#include "AliAnalysisManager.h"
50#include "AliAODMCParticle.h"
51#include "AliMCAnalysisUtils.h"
6fa7d352 52#include "AliAODPid.h"
c8fe2783 53#include "AliExternalTrackParam.h"
9725fd2a 54
55ClassImp(AliAnaCalorimeterQA)
c8fe2783 56
a6f26052 57//____________________________________________________________________________
c8fe2783 58AliAnaCalorimeterQA::AliAnaCalorimeterQA() :
59AliAnaPartCorrBaseClass(), fCalorimeter(""), fStyleMacro(""),
a6f26052 60fMakePlots(kFALSE), fFillAllPosHisto(kFALSE), fFillAllTH12(kFALSE),
61fCorrelateCalos(kFALSE), fNModules(12), fNRCU(2),
c8fe2783 62fTimeCutMin(-1), fTimeCutMax(9999999),
2302a644 63fEMCALCellAmpMin(0),fPHOSCellAmpMin(0),
b8187de4 64fHistoFinePtBins(1000), fHistoFinePtMax(5.), fHistoFinePtMin(0.),
a6f26052 65fHistoPOverEBins(100), fHistoPOverEMax(100.), fHistoPOverEMin(0.),
66fHistodEdxBins(100), fHistodEdxMax(100.), fHistodEdxMin(0.),
67fHistodRBins(100), fHistodRMax(100.), fHistodRMin(0.),
68fHistoTimeBins(100), fHistoTimeMax(100.), fHistoTimeMin(0.),
69fHistoNBins(100), fHistoNMax(100), fHistoNMin(0),
70fHistoRatioBins(100), fHistoRatioMax(100.), fHistoRatioMin(0.),
71fHistoVertexDistBins(100), fHistoVertexDistMax(100.), fHistoVertexDistMin(0.),
c8fe2783 72fHistoRBins(100), fHistoRMax(1000), fHistoRMin(-1000),
73fHistoXBins(100), fHistoXMax(1000), fHistoXMin(-1000),
74fHistoYBins(100), fHistoYMax(1000), fHistoYMin(-1000),
75fHistoZBins(100), fHistoZMax(1000), fHistoZMin(-1000),
a6f26052 76fHistoSSBins(25), fHistoSSMax(5), fHistoSSMin(0),
c8fe2783 77fhE(0),fhPt(0),fhPhi(0),fhEta(0), fhEtaPhiE(0),
78fhECharged(0),fhPtCharged(0),fhPhiCharged(0),fhEtaCharged(0), fhEtaPhiECharged(0),
c8fe2783 79fhDeltaE(0), fhDeltaPt(0),fhDeltaPhi(0),fhDeltaEta(0), fhRatioE(0), fhRatioPt(0),fhRatioPhi(0),fhRatioEta(0),
80fh2E(0),fh2Pt(0),fh2Phi(0),fh2Eta(0),
81fhLambda(0), fhDispersion(0),
82fhIM(0), fhIMCellCut(0),fhAsym(0),
83fhNCellsPerCluster(0),fhNCellsPerClusterMIP(0), fhNCellsPerClusterMIPCharged(0), fhNClusters(0),
84fhClusterTimeEnergy(0),fhCellTimeSpreadRespectToCellMax(0),fhCellIdCellLargeTimeSpread(0),
85fhRNCells(0),fhXNCells(0),fhYNCells(0),fhZNCells(0),
86fhRE(0), fhXE(0), fhYE(0), fhZE(0), fhXYZ(0),
87fhRCellE(0), fhXCellE(0), fhYCellE(0), fhZCellE(0),fhXYZCell(0),
88fhDeltaCellClusterRNCells(0),fhDeltaCellClusterXNCells(0),fhDeltaCellClusterYNCells(0),fhDeltaCellClusterZNCells(0),
89fhDeltaCellClusterRE(0), fhDeltaCellClusterXE(0), fhDeltaCellClusterYE(0), fhDeltaCellClusterZE(0),
90fhNCells(0), fhAmplitude(0), fhAmpId(0), fhEtaPhiAmp(0),
91fhTime(0), fhTimeId(0), fhTimeAmp(0), //fhT0Time(0), fhT0TimeId(0), fhT0TimeAmp(0),
92fhCaloCorrNClusters(0), fhCaloCorrEClusters(0), fhCaloCorrNCells(0), fhCaloCorrECells(0),
93fhEMod(0), fhNClustersMod(0), fhNCellsPerClusterMod(0), fhNCellsMod(0),
94fhGridCellsMod(0), fhGridCellsEMod(0), fhGridCellsTimeMod(0),
a6f26052 95fhAmplitudeMod(0), fhAmplitudeModFraction(0),fhTimeAmpPerRCU(0), //fhT0TimeAmpPerRCU(0), fhTimeCorrRCU(0),
c8fe2783 96fhIMMod(0), fhIMCellCutMod(0),
97fhGenGamPt(0),fhGenGamEta(0),fhGenGamPhi(0),fhGenPi0Pt(0),fhGenPi0Eta(0),fhGenPi0Phi(0),
98fhGenEtaPt(0),fhGenEtaEta(0),fhGenEtaPhi(0),fhGenOmegaPt(0),fhGenOmegaEta(0),fhGenOmegaPhi(0),
99fhGenElePt(0),fhGenEleEta(0),fhGenElePhi(0), fhEMVxyz(0), fhEMR(0), fhHaVxyz(0), fhHaR(0),
100fhGamE(0),fhGamPt(0),fhGamPhi(0),fhGamEta(0),
101fhGamDeltaE(0), fhGamDeltaPt(0),fhGamDeltaPhi(0),fhGamDeltaEta(0),
102fhGamRatioE(0), fhGamRatioPt(0),fhGamRatioPhi(0),fhGamRatioEta(0),
103fhEleE(0),fhElePt(0),fhElePhi(0),fhEleEta(0),
104fhPi0E(0),fhPi0Pt(0),fhPi0Phi(0),fhPi0Eta(0),
105fhNeHadE(0),fhNeHadPt(0),fhNeHadPhi(0),fhNeHadEta(0),
106fhChHadE(0),fhChHadPt(0),fhChHadPhi(0),fhChHadEta(0),
107fhGamECharged(0),fhGamPtCharged(0),fhGamPhiCharged(0),fhGamEtaCharged(0),
108fhEleECharged(0),fhElePtCharged(0),fhElePhiCharged(0),fhEleEtaCharged(0),
109fhPi0ECharged(0),fhPi0PtCharged(0),fhPi0PhiCharged(0),fhPi0EtaCharged(0),
110fhNeHadECharged(0),fhNeHadPtCharged(0),fhNeHadPhiCharged(0),fhNeHadEtaCharged(0),
111fhChHadECharged(0),fhChHadPtCharged(0),fhChHadPhiCharged(0),fhChHadEtaCharged(0),
112fhGenGamAccE(0),fhGenGamAccPt(0),fhGenGamAccEta(0),fhGenGamAccPhi(0),
113fhGenPi0AccE(0),fhGenPi0AccPt(0),fhGenPi0AccEta(0),fhGenPi0AccPhi(0),
114fh1pOverE(0),fh1dR(0),fh2EledEdx(0), fh2MatchdEdx(0),fhMCEle1pOverE(0),fhMCEle1dR(0),fhMCEle2MatchdEdx(0),
115fhMCChHad1pOverE(0), fhMCChHad1dR(0), fhMCChHad2MatchdEdx(0),
116fhMCNeutral1pOverE(0),fhMCNeutral1dR(0),fhMCNeutral2MatchdEdx(0),
117fh1pOverER02(0), fhMCEle1pOverER02(0), fhMCChHad1pOverER02(0), fhMCNeutral1pOverER02(0)
9725fd2a 118{
a6f26052 119 //Default Ctor
afabc52f 120
a6f26052 121 //Initialize parameters
9725fd2a 122 InitParameters();
123}
a5fafd85 124
a6f26052 125//________________________________________________________________________
0c1383b5 126TObjString * AliAnaCalorimeterQA::GetAnalysisCuts()
127{
a6f26052 128 //Save parameters used for analysis
2302a644 129 TString parList ; //this will be list of parameters used for this analysis.
f8006433 130 const Int_t buffersize = 255;
2302a644 131 char onePar[buffersize] ;
c8fe2783 132
2302a644 133 snprintf(onePar,buffersize,"--- AliAnaCalorimeterQA ---\n") ;
134 parList+=onePar ;
135 snprintf(onePar,buffersize,"Calorimeter: %s\n",fCalorimeter.Data()) ;
136 parList+=onePar ;
137 snprintf(onePar,buffersize,"Time Cut : %2.2f < T < %2.2f ns \n",fTimeCutMin, fTimeCutMax) ;
138 parList+=onePar ;
139 snprintf(onePar,buffersize,"PHOS Cell Amplitude > %2.2f GeV, EMCAL Cell Amplitude > %2.2f GeV \n",fPHOSCellAmpMin, fEMCALCellAmpMin) ;
140 parList+=onePar ;
a6f26052 141 //Get parameters set in base class.
142 //parList += GetBaseParametersList() ;
2302a644 143
a6f26052 144 //Get parameters set in FiducialCut class (not available yet)
145 //parlist += GetFidCut()->GetFidCutParametersList()
0c1383b5 146
2302a644 147 return new TObjString(parList) ;
0c1383b5 148}
149
a5fafd85 150
a6f26052 151//________________________________________________________________________
9725fd2a 152TList * AliAnaCalorimeterQA::GetCreateOutputObjects()
153{
a6f26052 154 // Create histograms to be saved in output file and
155 // store them in outputContainer
c8fe2783 156
2302a644 157 TList * outputContainer = new TList() ;
158 outputContainer->SetName("QAHistos") ;
159
a6f26052 160 //Histograms
2302a644 161 Int_t nptbins = GetHistoPtBins(); Float_t ptmax = GetHistoPtMax(); Float_t ptmin = GetHistoPtMin();
b8187de4 162 Int_t nfineptbins = GetHistoFinePtBins(); Float_t ptfinemax = GetHistoFinePtMax(); Float_t ptfinemin = GetHistoFinePtMin();
2302a644 163 Int_t nphibins = GetHistoPhiBins(); Float_t phimax = GetHistoPhiMax(); Float_t phimin = GetHistoPhiMin();
164 Int_t netabins = GetHistoEtaBins(); Float_t etamax = GetHistoEtaMax(); Float_t etamin = GetHistoEtaMin();
165 Int_t nmassbins = GetHistoMassBins(); Float_t massmax = GetHistoMassMax(); Float_t massmin = GetHistoMassMin();
166 Int_t nasymbins = GetHistoAsymmetryBins(); Float_t asymmax = GetHistoAsymmetryMax(); Float_t asymmin = GetHistoAsymmetryMin();
167 Int_t nPoverEbins = GetHistoPOverEBins(); Float_t pOverEmax = GetHistoPOverEMax(); Float_t pOverEmin = GetHistoPOverEMin();
168 Int_t ndedxbins = GetHistodEdxBins(); Float_t dedxmax = GetHistodEdxMax(); Float_t dedxmin = GetHistodEdxMin();
169 Int_t ndRbins = GetHistodRBins(); Float_t dRmax = GetHistodRMax(); Float_t dRmin = GetHistodRMin();
170 Int_t ntimebins = GetHistoTimeBins(); Float_t timemax = GetHistoTimeMax(); Float_t timemin = GetHistoTimeMin();
171 Int_t nbins = GetHistoNClusterCellBins(); Int_t nmax = GetHistoNClusterCellMax(); Int_t nmin = GetHistoNClusterCellMin();
172 Int_t nratiobins = GetHistoRatioBins(); Float_t ratiomax = GetHistoRatioMax(); Float_t ratiomin = GetHistoRatioMin();
173 Int_t nvdistbins = GetHistoVertexDistBins(); Float_t vdistmax = GetHistoVertexDistMax(); Float_t vdistmin = GetHistoVertexDistMin();
174 Int_t rbins = GetHistoRBins(); Float_t rmax = GetHistoRMax(); Float_t rmin = GetHistoRMin();
175 Int_t xbins = GetHistoXBins(); Float_t xmax = GetHistoXMax(); Float_t xmin = GetHistoXMin();
176 Int_t ybins = GetHistoYBins(); Float_t ymax = GetHistoYMax(); Float_t ymin = GetHistoYMin();
177 Int_t zbins = GetHistoZBins(); Float_t zmax = GetHistoZMax(); Float_t zmin = GetHistoZMin();
178 Int_t ssbins = GetHistoShowerShapeBins(); Float_t ssmax = GetHistoShowerShapeMax(); Float_t ssmin = GetHistoShowerShapeMin();
179
a6f26052 180 //EMCAL
2302a644 181 Int_t colmax = 48;
182 Int_t rowmax = 24;
183 fNRCU = 2 ;
a6f26052 184 //PHOS
2302a644 185 if(fCalorimeter=="PHOS"){
186 colmax = 56;
187 rowmax = 64;
188 fNRCU = 4 ;
189 }
190
a6f26052 191
2302a644 192 fhE = new TH1F ("hE","E reconstructed clusters ", nptbins*5,ptmin,ptmax*5);
193 fhE->SetXTitle("E (GeV)");
194 outputContainer->Add(fhE);
195
196 if(fFillAllTH12){
a6f26052 197 fhPt = new TH1F ("hPt","p_{T} reconstructed clusters", nptbins,ptmin,ptmax);
198 fhPt->SetXTitle("p_{T} (GeV/c)");
199 outputContainer->Add(fhPt);
200
201 fhPhi = new TH1F ("hPhi","#phi reconstructed clusters ",nphibins,phimin,phimax);
202 fhPhi->SetXTitle("#phi (rad)");
203 outputContainer->Add(fhPhi);
204
205 fhEta = new TH1F ("hEta","#eta reconstructed clusters ",netabins,etamin,etamax);
206 fhEta->SetXTitle("#eta ");
207 outputContainer->Add(fhEta);
2302a644 208 }
a6f26052 209
2302a644 210 fhEtaPhiE = new TH3F ("hEtaPhiE","#eta vs #phi vs energy, reconstructed clusters",
c8fe2783 211 netabins,etamin,etamax,nphibins,phimin,phimax,nptbins,ptmin,ptmax);
2302a644 212 fhEtaPhiE->SetXTitle("#eta ");
213 fhEtaPhiE->SetYTitle("#phi (rad)");
214 fhEtaPhiE->SetZTitle("E (GeV) ");
215 outputContainer->Add(fhEtaPhiE);
216
217 fhClusterTimeEnergy = new TH2F ("hClusterTimeEnergy","energy vs TOF, reconstructed clusters",
c8fe2783 218 nptbins,ptmin,ptmax, ntimebins,timemin,timemax);
2302a644 219 fhClusterTimeEnergy->SetXTitle("E (GeV) ");
220 fhClusterTimeEnergy->SetYTitle("TOF (ns)");
221 outputContainer->Add(fhClusterTimeEnergy);
222
223
a6f26052 224 //Shower shape
2302a644 225 fhLambda = new TH3F ("hLambda","#lambda_{0}^{2} vs #lambda_{1}^{2} vs energy, reconstructed clusters",
c8fe2783 226 ssbins,ssmin,ssmax,ssbins,ssmin,ssmax,nptbins,ptmin,ptmax);
2302a644 227 fhLambda->SetXTitle("#lambda_{0}^{2} ");
228 fhLambda->SetYTitle("#lambda_{1}^{2} ");
229 fhLambda->SetZTitle("E (GeV) ");
230 outputContainer->Add(fhLambda);
231
232 fhDispersion = new TH2F ("hDispersion"," dispersion vs energy, reconstructed clusters",
c8fe2783 233 ssbins,ssmin,ssmax,nptbins,ptmin,ptmax);
2302a644 234 fhDispersion->SetXTitle("Dispersion ");
235 fhDispersion->SetYTitle("E (GeV) ");
236 outputContainer->Add(fhDispersion);
237
a6f26052 238 //Track Matching
239 if(fFillAllTH12){
240 fhECharged = new TH1F ("hECharged","E reconstructed clusters, matched with track", nptbins,ptmin,ptmax);
241 fhECharged->SetXTitle("E (GeV)");
242 outputContainer->Add(fhECharged);
243
244 fhPtCharged = new TH1F ("hPtCharged","p_{T} reconstructed clusters, matched with track", nptbins,ptmin,ptmax);
245 fhPtCharged->SetXTitle("p_{T} (GeV/c)");
246 outputContainer->Add(fhPtCharged);
247
248 fhPhiCharged = new TH1F ("hPhiCharged","#phi reconstructed clusters, matched with track",nphibins,phimin,phimax);
249 fhPhiCharged->SetXTitle("#phi (rad)");
250 outputContainer->Add(fhPhiCharged);
251
252 fhEtaCharged = new TH1F ("hEtaCharged","#eta reconstructed clusters, matched with track",netabins,etamin,etamax);
253 fhEtaCharged->SetXTitle("#eta ");
254 outputContainer->Add(fhEtaCharged);
255 }
c8fe2783 256
2302a644 257 fhEtaPhiECharged = new TH3F ("hEtaPhiECharged","#eta vs #phi, reconstructed clusters, matched with track",
c8fe2783 258 netabins,etamin,etamax,nphibins,phimin,phimax,nptbins,ptmin,ptmax);
2302a644 259 fhEtaPhiECharged->SetXTitle("#eta ");
260 fhEtaPhiECharged->SetYTitle("#phi ");
261 fhEtaPhiECharged->SetZTitle("E (GeV) ");
262 outputContainer->Add(fhEtaPhiECharged);
263
264 fh1pOverE = new TH2F("h1pOverE","TRACK matches p/E",nptbins,ptmin,ptmax, nPoverEbins,pOverEmin,pOverEmax);
265 fh1pOverE->SetYTitle("p/E");
266 fh1pOverE->SetXTitle("p_{T} (GeV/c)");
267 outputContainer->Add(fh1pOverE);
268
269 fh1dR = new TH1F("h1dR","TRACK matches dR",ndRbins,dRmin,dRmax);
270 fh1dR->SetXTitle("#Delta R (rad)");
271 outputContainer->Add(fh1dR) ;
272
273 fh2MatchdEdx = new TH2F("h2MatchdEdx","dE/dx vs. p for all matches",nptbins,ptmin,ptmax,ndedxbins,dedxmin,dedxmax);
274 fh2MatchdEdx->SetXTitle("p (GeV/c)");
275 fh2MatchdEdx->SetYTitle("<dE/dx>");
276 outputContainer->Add(fh2MatchdEdx);
277
278 fh2EledEdx = new TH2F("h2EledEdx","dE/dx vs. p for electrons",nptbins,ptmin,ptmax,ndedxbins,dedxmin,dedxmax);
279 fh2EledEdx->SetXTitle("p (GeV/c)");
280 fh2EledEdx->SetYTitle("<dE/dx>");
281 outputContainer->Add(fh2EledEdx) ;
282
283 fh1pOverER02 = new TH2F("h1pOverER02","TRACK matches p/E, all",nptbins,ptmin,ptmax, nPoverEbins,pOverEmin,pOverEmax);
284 fh1pOverER02->SetYTitle("p/E");
285 fh1pOverER02->SetXTitle("p_{T} (GeV/c)");
286 outputContainer->Add(fh1pOverER02);
287
288 fhIM = new TH2F ("hIM","Cluster pairs Invariant mass vs reconstructed pair energy",nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
289 fhIM->SetXTitle("p_{T, cluster pairs} (GeV) ");
290 fhIM->SetYTitle("M_{cluster pairs} (GeV/c^{2})");
291 outputContainer->Add(fhIM);
292
293 fhIMCellCut = new TH2F ("hIMCellCut","Cluster (n cell > 1) pairs Invariant mass vs reconstructed pair energy",nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
294 fhIMCellCut->SetXTitle("p_{T, cluster pairs} (GeV) ");
295 fhIMCellCut->SetYTitle("M_{cluster pairs} (GeV/c^{2})");
296 outputContainer->Add(fhIMCellCut);
a6f26052 297
b8187de4 298 fhAsym = new TH2F ("hAssym","Cluster pairs Asymmetry vs reconstructed pair energy",nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax);
299 fhAsym->SetXTitle("p_{T, cluster pairs} (GeV) ");
300 fhAsym->SetYTitle("Asymmetry");
301 outputContainer->Add(fhAsym);
302
a6f26052 303
b8187de4 304 Int_t nlargeetabins = 3;
2302a644 305 if(fCalorimeter=="EMCAL") nlargeetabins = 8;
b8187de4 306
2302a644 307 fhNCellsPerCluster = new TH3F ("hNCellsPerCluster","# cells per cluster vs energy vs #eta",nptbins,ptmin,ptmax, nbins,nmin,nmax, nlargeetabins,etamin,etamax);
308 fhNCellsPerCluster->SetXTitle("E (GeV)");
309 fhNCellsPerCluster->SetYTitle("n cells");
310 fhNCellsPerCluster->SetZTitle("#eta");
311 outputContainer->Add(fhNCellsPerCluster);
312
313
314 fhNCellsPerClusterMIP = new TH3F ("hNCellsPerClusterMIP","# cells per cluster vs energy vs #eta, smaller bin for MIP search",
b8187de4 315 40,0.,2., 11,0,10,nlargeetabins,etamin,etamax);
2302a644 316 fhNCellsPerClusterMIP->SetXTitle("E (GeV)");
317 fhNCellsPerClusterMIP->SetYTitle("n cells");
318 fhNCellsPerClusterMIP->SetZTitle("#eta");
319 outputContainer->Add(fhNCellsPerClusterMIP);
320
321
322 fhNCellsPerClusterMIPCharged = new TH3F ("hNCellsPerClusterMIPCharged","# cells per track-matched cluster vs energy vs #eta, smaller bin for MIP search",
b8187de4 323 40,0.,2., 11,0,10,nlargeetabins,etamin,etamax);
2302a644 324 fhNCellsPerClusterMIPCharged->SetXTitle("E (GeV)");
325 fhNCellsPerClusterMIPCharged->SetYTitle("n cells");
326 fhNCellsPerClusterMIPCharged->SetZTitle("#eta");
327 outputContainer->Add(fhNCellsPerClusterMIPCharged);
0866d83a 328
8b5f17b6 329
2302a644 330 fhNClusters = new TH1F ("hNClusters","# clusters", nbins,nmin,nmax);
331 fhNClusters->SetXTitle("number of clusters");
332 outputContainer->Add(fhNClusters);
c8fe2783 333
b8187de4 334 fhXYZ = new TH3F ("hXYZ","Cluster: x vs y vs z",xbins,xmin,xmax,ybins,ymin,ymax,zbins,zmin,zmax);
335 fhXYZ->SetXTitle("x (cm)");
336 fhXYZ->SetYTitle("y (cm)");
337 fhXYZ->SetZTitle("z (cm) ");
338 outputContainer->Add(fhXYZ);
339
340 fhXNCells = new TH2F ("hXNCells","Cluster X position vs N Clusters per Cell",xbins,xmin,xmax,nbins,nmin,nmax);
341 fhXNCells->SetXTitle("x (cm)");
342 fhXNCells->SetYTitle("N cells per cluster");
343 outputContainer->Add(fhXNCells);
344
345 fhZNCells = new TH2F ("hZNCells","Cluster Z position vs N Clusters per Cell",zbins,zmin,zmax,nbins,nmin,nmax);
346 fhZNCells->SetXTitle("z (cm)");
347 fhZNCells->SetYTitle("N cells per cluster");
348 outputContainer->Add(fhZNCells);
349
350 fhXE = new TH2F ("hXE","Cluster X position vs cluster energy",xbins,xmin,xmax,nptbins,ptmin,ptmax);
351 fhXE->SetXTitle("x (cm)");
352 fhXE->SetYTitle("E (GeV)");
353 outputContainer->Add(fhXE);
354
355 fhZE = new TH2F ("hZE","Cluster Z position vs cluster energy",zbins,zmin,zmax,nptbins,ptmin,ptmax);
356 fhZE->SetXTitle("z (cm)");
357 fhZE->SetYTitle("E (GeV)");
358 outputContainer->Add(fhZE);
359
360
361 fhRNCells = new TH2F ("hRNCells","Cluster R position vs N Clusters per Cell",rbins,rmin,rmax,nbins,nmin,nmax);
362 fhRNCells->SetXTitle("r = #sqrt{x^{2}+y^{2}} (cm)");
363 fhRNCells->SetYTitle("N cells per cluster");
364 outputContainer->Add(fhRNCells);
365
366
367 fhYNCells = new TH2F ("hYNCells","Cluster Y position vs N Clusters per Cell",ybins,ymin,ymax,nbins,nmin,nmax);
368 fhYNCells->SetXTitle("y (cm)");
369 fhYNCells->SetYTitle("N cells per cluster");
370 outputContainer->Add(fhYNCells);
371
372 fhRE = new TH2F ("hRE","Cluster R position vs cluster energy",rbins,rmin,rmax,nptbins,ptmin,ptmax);
373 fhRE->SetXTitle("r = #sqrt{x^{2}+y^{2}} (cm)");
374 fhRE->SetYTitle("E (GeV)");
375 outputContainer->Add(fhRE);
376
377 fhYE = new TH2F ("hYE","Cluster Y position vs cluster energy",ybins,ymin,ymax,nptbins,ptmin,ptmax);
378 fhYE->SetXTitle("y (cm)");
379 fhYE->SetYTitle("E (GeV)");
380 outputContainer->Add(fhYE);
a6f26052 381
b8187de4 382 if(fFillAllPosHisto){
383
a6f26052 384 fhRCellE = new TH2F ("hRCellE","Cell R position vs cell energy",rbins,rmin,rmax,nptbins,ptmin,ptmax);
385 fhRCellE->SetXTitle("r = #sqrt{x^{2}+y^{2}} (cm)");
386 fhRCellE->SetYTitle("E (GeV)");
387 outputContainer->Add(fhRCellE);
388
389 fhXCellE = new TH2F ("hXCellE","Cell X position vs cell energy",xbins,xmin,xmax,nptbins,ptmin,ptmax);
390 fhXCellE->SetXTitle("x (cm)");
391 fhXCellE->SetYTitle("E (GeV)");
392 outputContainer->Add(fhXCellE);
393
394 fhYCellE = new TH2F ("hYCellE","Cell Y position vs cell energy",ybins,ymin,ymax,nptbins,ptmin,ptmax);
395 fhYCellE->SetXTitle("y (cm)");
396 fhYCellE->SetYTitle("E (GeV)");
397 outputContainer->Add(fhYCellE);
398
399 fhZCellE = new TH2F ("hZCellE","Cell Z position vs cell energy",zbins,zmin,zmax,nptbins,ptmin,ptmax);
400 fhZCellE->SetXTitle("z (cm)");
401 fhZCellE->SetYTitle("E (GeV)");
402 outputContainer->Add(fhZCellE);
403
404 fhXYZCell = new TH3F ("hXYZCell","Cell : x vs y vs z",xbins,xmin,xmax,ybins,ymin,ymax,zbins,zmin,zmax);
405 fhXYZCell->SetXTitle("x (cm)");
406 fhXYZCell->SetYTitle("y (cm)");
407 fhXYZCell->SetZTitle("z (cm)");
408 outputContainer->Add(fhXYZCell);
409
410
411 Float_t dx = TMath::Abs(xmin)+TMath::Abs(xmax);
412 Float_t dy = TMath::Abs(ymin)+TMath::Abs(ymax);
413 Float_t dz = TMath::Abs(zmin)+TMath::Abs(zmax);
414 Float_t dr = TMath::Abs(rmin)+TMath::Abs(rmax);
415
416 fhDeltaCellClusterRNCells = new TH2F ("hDeltaCellClusterRNCells","Cluster-Cell R position vs N Clusters per Cell",rbins*2,-dr,dr,nbins,nmin,nmax);
417 fhDeltaCellClusterRNCells->SetXTitle("r = #sqrt{x^{2}+y^{2}} (cm)");
418 fhDeltaCellClusterRNCells->SetYTitle("N cells per cluster");
419 outputContainer->Add(fhDeltaCellClusterRNCells);
420
421 fhDeltaCellClusterXNCells = new TH2F ("hDeltaCellClusterXNCells","Cluster-Cell X position vs N Clusters per Cell",xbins*2,-dx,dx,nbins,nmin,nmax);
422 fhDeltaCellClusterXNCells->SetXTitle("x (cm)");
423 fhDeltaCellClusterXNCells->SetYTitle("N cells per cluster");
424 outputContainer->Add(fhDeltaCellClusterXNCells);
425
426 fhDeltaCellClusterYNCells = new TH2F ("hDeltaCellClusterYNCells","Cluster-Cell Y position vs N Clusters per Cell",ybins*2,-dy,dy,nbins,nmin,nmax);
427 fhDeltaCellClusterYNCells->SetXTitle("y (cm)");
428 fhDeltaCellClusterYNCells->SetYTitle("N cells per cluster");
429 outputContainer->Add(fhDeltaCellClusterYNCells);
430
431 fhDeltaCellClusterZNCells = new TH2F ("hDeltaCellClusterZNCells","Cluster-Cell Z position vs N Clusters per Cell",zbins*2,-dz,dz,nbins,nmin,nmax);
432 fhDeltaCellClusterZNCells->SetXTitle("z (cm)");
433 fhDeltaCellClusterZNCells->SetYTitle("N cells per cluster");
434 outputContainer->Add(fhDeltaCellClusterZNCells);
435
436 fhDeltaCellClusterRE = new TH2F ("hDeltaCellClusterRE","Cluster-Cell R position vs cluster energy",rbins*2,-dr,dr,nptbins,ptmin,ptmax);
437 fhDeltaCellClusterRE->SetXTitle("r = #sqrt{x^{2}+y^{2}} (cm)");
438 fhDeltaCellClusterRE->SetYTitle("E (GeV)");
439 outputContainer->Add(fhDeltaCellClusterRE);
440
441 fhDeltaCellClusterXE = new TH2F ("hDeltaCellClusterXE","Cluster-Cell X position vs cluster energy",xbins*2,-dx,dx,nptbins,ptmin,ptmax);
442 fhDeltaCellClusterXE->SetXTitle("x (cm)");
443 fhDeltaCellClusterXE->SetYTitle("E (GeV)");
444 outputContainer->Add(fhDeltaCellClusterXE);
445
446 fhDeltaCellClusterYE = new TH2F ("hDeltaCellClusterYE","Cluster-Cell Y position vs cluster energy",ybins*2,-dy,dy,nptbins,ptmin,ptmax);
447 fhDeltaCellClusterYE->SetXTitle("y (cm)");
448 fhDeltaCellClusterYE->SetYTitle("E (GeV)");
449 outputContainer->Add(fhDeltaCellClusterYE);
450
451 fhDeltaCellClusterZE = new TH2F ("hDeltaCellClusterZE","Cluster-Cell Z position vs cluster energy",zbins*2,-dz,dz,nptbins,ptmin,ptmax);
452 fhDeltaCellClusterZE->SetXTitle("z (cm)");
453 fhDeltaCellClusterZE->SetYTitle("E (GeV)");
454 outputContainer->Add(fhDeltaCellClusterZE);
455
456 fhEtaPhiAmp = new TH3F ("hEtaPhiAmp","Cell #eta vs cell #phi vs cell energy",netabins,etamin,etamax,nphibins,phimin,phimax,nptbins,ptmin,ptmax);
457 fhEtaPhiAmp->SetXTitle("#eta ");
458 fhEtaPhiAmp->SetYTitle("#phi (rad)");
459 fhEtaPhiAmp->SetZTitle("E (GeV) ");
460 outputContainer->Add(fhEtaPhiAmp);
461
2302a644 462 }
c8fe2783 463
a6f26052 464 //Calo cells
2302a644 465 fhNCells = new TH1F ("hNCells","# cells", colmax*rowmax*fNModules,0,colmax*rowmax*fNModules);
466 fhNCells->SetXTitle("n cells");
467 outputContainer->Add(fhNCells);
468
469 fhAmplitude = new TH1F ("hAmplitude","Cell Energy", nptbins*2,ptmin,ptmax);
470 fhAmplitude->SetXTitle("Cell Energy (GeV)");
471 outputContainer->Add(fhAmplitude);
472
473 fhAmpId = new TH2F ("hAmpId","Cell Energy", nfineptbins,ptfinemin,ptfinemax,rowmax*colmax*fNModules,0,rowmax*colmax*fNModules);
474 fhAmpId->SetXTitle("Cell Energy (GeV)");
475 outputContainer->Add(fhAmpId);
476
c8fe2783 477
a6f26052 478 //Cell Time histograms, time only available in ESDs
2302a644 479 if(GetReader()->GetDataType()==AliCaloTrackReader::kESD) {
480
481 fhCellTimeSpreadRespectToCellMax = new TH1F ("hCellTimeSpreadRespectToCellMax","t_{cell max}-t_{cell i} per cluster", 100,-200,200);
482 fhCellTimeSpreadRespectToCellMax->SetXTitle("#Delta t (ns)");
483 outputContainer->Add(fhCellTimeSpreadRespectToCellMax);
484
485 fhCellIdCellLargeTimeSpread= new TH1F ("hCellIdCellLargeTimeSpread","", colmax*rowmax*fNModules,0,colmax*rowmax*fNModules);
486 fhCellIdCellLargeTimeSpread->SetXTitle("Absolute Cell Id");
487 outputContainer->Add(fhCellIdCellLargeTimeSpread);
488
489 fhTime = new TH1F ("hTime","Cell Time",ntimebins,timemin,timemax);
490 fhTime->SetXTitle("Cell Time (ns)");
491 outputContainer->Add(fhTime);
492
493 fhTimeId = new TH2F ("hTimeId","Cell Time vs Absolute Id",ntimebins,timemin,timemax,rowmax*colmax*fNModules,0,rowmax*colmax*fNModules);
494 fhTimeId->SetXTitle("Cell Time (ns)");
495 fhTimeId->SetYTitle("Cell Absolute Id");
496 outputContainer->Add(fhTimeId);
497
498 fhTimeAmp = new TH2F ("hTimeAmp","Cell Time vs Cell Energy",nptbins*2,ptmin,ptmax,ntimebins,timemin,timemax);
499 fhTimeAmp->SetYTitle("Cell Time (ns)");
500 fhTimeAmp->SetXTitle("Cell Energy (GeV)");
501 outputContainer->Add(fhTimeAmp);
502
a6f26052 503 // fhT0Time = new TH1F ("hT0Time","Cell Time",ntimebins,timemin,timemax);
504 // fhT0Time->SetXTitle("T_{0} - T_{EMCal} (ns)");
505 // outputContainer->Add(fhT0Time);
506 //
507 // fhT0TimeId = new TH2F ("hT0TimeId","Cell Time vs Absolute Id",ntimebins,timemin,timemax,rowmax*colmax*fNModules,0,rowmax*colmax*fNModules);
508 // fhT0TimeId->SetXTitle("T_{0} - T_{EMCal} (ns)");
509 // fhT0TimeId->SetYTitle("Cell Absolute Id");
510 // outputContainer->Add(fhT0TimeId);
511 //
512 // fhT0TimeAmp = new TH2F ("hT0TimeAmp","Cell Time vs Cell Energy",nptbins*2,ptmin,ptmax,ntimebins,timemin,timemax);
513 // fhT0TimeAmp->SetYTitle("T_{0} - T_{EMCal} (ns)");
514 // fhT0TimeAmp->SetXTitle("Cell Energy (GeV)");
515 // outputContainer->Add(fhT0TimeAmp);
2302a644 516 }
a0bb4dc0 517
2302a644 518 if(fCorrelateCalos){
519 fhCaloCorrNClusters = new TH2F ("hCaloCorrNClusters","# clusters in EMCAL vs PHOS", nbins,nmin,nmax,nbins,nmin,nmax);
520 fhCaloCorrNClusters->SetXTitle("number of clusters in EMCAL");
521 fhCaloCorrNClusters->SetYTitle("number of clusters in PHOS");
522 outputContainer->Add(fhCaloCorrNClusters);
523
524 fhCaloCorrEClusters = new TH2F ("hCaloCorrEClusters","summed energy of clusters in EMCAL vs PHOS", nptbins*2,ptmin,ptmax*2,nptbins,ptmin,ptmax*2);
525 fhCaloCorrEClusters->SetXTitle("#Sigma E of clusters in EMCAL (GeV)");
526 fhCaloCorrEClusters->SetYTitle("#Sigma E of clusters in PHOS (GeV)");
527 outputContainer->Add(fhCaloCorrEClusters);
528
529 fhCaloCorrNCells = new TH2F ("hCaloCorrNCells","# Cells in EMCAL vs PHOS", nbins,nmin,nmax, nbins,nmin,nmax);
530 fhCaloCorrNCells->SetXTitle("number of Cells in EMCAL");
531 fhCaloCorrNCells->SetYTitle("number of Cells in PHOS");
532 outputContainer->Add(fhCaloCorrNCells);
533
534 fhCaloCorrECells = new TH2F ("hCaloCorrECells","summed energy of Cells in EMCAL vs PHOS", nptbins*2,ptmin,ptmax*2,nptbins,ptmin,ptmax*2);
535 fhCaloCorrECells->SetXTitle("#Sigma E of Cells in EMCAL (GeV)");
536 fhCaloCorrECells->SetYTitle("#Sigma E of Cells in PHOS (GeV)");
537 outputContainer->Add(fhCaloCorrECells);
538 }//correlate calorimeters
539
a6f26052 540 //Module histograms
2302a644 541 fhEMod = new TH1F*[fNModules];
542 fhNClustersMod = new TH1F*[fNModules];
543 fhNCellsPerClusterMod = new TH2F*[fNModules];
544 fhNCellsMod = new TH1F*[fNModules];
545 fhGridCellsMod = new TH2F*[fNModules];
546 fhGridCellsEMod = new TH2F*[fNModules];
547 fhGridCellsTimeMod = new TH2F*[fNModules];
548 fhAmplitudeMod = new TH1F*[fNModules];
549 if(fCalorimeter=="EMCAL")
550 fhAmplitudeModFraction = new TH1F*[fNModules*3];
551
552 fhTimeAmpPerRCU = new TH2F*[fNModules*fNRCU];
a6f26052 553 //fhT0TimeAmpPerRCU = new TH2F*[fNModules*fNRCU];
554 //fhTimeCorrRCU = new TH2F*[fNModules*fNRCU*fNModules*fNRCU];
c8fe2783 555
2302a644 556 fhIMMod = new TH2F*[fNModules];
557 fhIMCellCutMod = new TH2F*[fNModules];
558
559 for(Int_t imod = 0; imod < fNModules; imod++){
560
561 fhEMod[imod] = new TH1F (Form("hE_Mod%d",imod),Form("Cluster reconstructed Energy in Module %d ",imod), nptbins,ptmin,ptmax);
562 fhEMod[imod]->SetXTitle("E (GeV)");
563 outputContainer->Add(fhEMod[imod]);
564
565 fhNClustersMod[imod] = new TH1F (Form("hNClusters_Mod%d",imod),Form("# clusters in Module %d",imod), nbins,nmin,nmax);
566 fhNClustersMod[imod]->SetXTitle("number of clusters");
567 outputContainer->Add(fhNClustersMod[imod]);
568
569 fhNCellsPerClusterMod[imod] = new TH2F (Form("hNCellsPerCluster_Mod%d",imod),
c8fe2783 570 Form("# cells per cluster vs cluster energy in Module %d",imod),
571 nptbins,ptmin,ptmax, nbins,nmin,nmax);
2302a644 572 fhNCellsPerClusterMod[imod]->SetXTitle("E (GeV)");
573 fhNCellsPerClusterMod[imod]->SetYTitle("n cells");
574 outputContainer->Add(fhNCellsPerClusterMod[imod]);
575
576 fhNCellsMod[imod] = new TH1F (Form("hNCells_Mod%d",imod),Form("# cells in Module %d",imod), colmax*rowmax,0,colmax*rowmax);
577 fhNCellsMod[imod]->SetXTitle("n cells");
578 outputContainer->Add(fhNCellsMod[imod]);
579 fhGridCellsMod[imod] = new TH2F (Form("hGridCells_Mod%d",imod),Form("Entries in grid of cells in Module %d",imod),
c8fe2783 580 colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5);
2302a644 581 fhGridCellsMod[imod]->SetYTitle("row (phi direction)");
582 fhGridCellsMod[imod]->SetXTitle("column (eta direction)");
583 outputContainer->Add(fhGridCellsMod[imod]);
c8fe2783 584
2302a644 585 fhGridCellsEMod[imod] = new TH2F (Form("hGridCellsE_Mod%d",imod),Form("Accumulated energy in grid of cells in Module %d",imod),
c8fe2783 586 colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5);
2302a644 587 fhGridCellsEMod[imod]->SetYTitle("row (phi direction)");
588 fhGridCellsEMod[imod]->SetXTitle("column (eta direction)");
589 outputContainer->Add(fhGridCellsEMod[imod]);
590
591 fhGridCellsTimeMod[imod] = new TH2F (Form("hGridCellsTime_Mod%d",imod),Form("Accumulated time in grid of cells in Module %d, with E > 0.5 GeV",imod),
c8fe2783 592 colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5);
2302a644 593 fhGridCellsTimeMod[imod]->SetYTitle("row (phi direction)");
594 fhGridCellsTimeMod[imod]->SetXTitle("column (eta direction)");
595 outputContainer->Add(fhGridCellsTimeMod[imod]);
596
597 fhAmplitudeMod[imod] = new TH1F (Form("hAmplitude_Mod%d",imod),Form("Cell Energy in Module %d",imod), nptbins*2,ptmin,ptmax);
598 fhAmplitudeMod[imod]->SetXTitle("Cell Energy (GeV)");
599 outputContainer->Add(fhAmplitudeMod[imod]);
600
601 if(fCalorimeter == "EMCAL"){
602 for(Int_t ifrac = 0; ifrac < 3; ifrac++){
603 fhAmplitudeModFraction[imod*3+ifrac] = new TH1F (Form("hAmplitude_Mod%d_Frac%d",imod,ifrac),Form("Cell reconstructed Energy in Module %d, Fraction %d ",imod,ifrac), nptbins,ptmin,ptmax);
604 fhAmplitudeModFraction[imod*3+ifrac]->SetXTitle("E (GeV)");
605 outputContainer->Add(fhAmplitudeModFraction[imod*3+ifrac]);
606 }
607
608 }
609
610 for(Int_t ircu = 0; ircu < fNRCU; ircu++){
c8fe2783 611 fhTimeAmpPerRCU[imod*fNRCU+ircu] = new TH2F (Form("hTimeAmp_Mod%d_RCU%d",imod,ircu),
612 Form("Cell Energy vs Cell Time in Module %d, RCU %d ",imod,ircu),
613 nptbins,ptmin,ptmax,ntimebins,timemin,timemax);
614 fhTimeAmpPerRCU[imod*fNRCU+ircu]->SetXTitle("E (GeV)");
615 fhTimeAmpPerRCU[imod*fNRCU+ircu]->SetYTitle("time (ns)");
616 outputContainer->Add(fhTimeAmpPerRCU[imod*fNRCU+ircu]);
2302a644 617
a6f26052 618 // fhT0TimeAmpPerRCU[imod*fNRCU+ircu] = new TH2F (Form("hT0TimeAmp_Mod%d_RCU%d",imod,ircu),
619 // Form("Cell Energy vs T0-Cell Time in Module %d, RCU %d ",imod,ircu),
620 // nptbins,ptmin,ptmax,ntimebins,timemin,timemax);
621 // fhT0TimeAmpPerRCU[imod*fNRCU+ircu]->SetXTitle("E (GeV)");
622 // fhT0TimeAmpPerRCU[imod*fNRCU+ircu]->SetYTitle("T_{0} - T_{EMCal} (ns)");
623 // outputContainer->Add(fhT0TimeAmpPerRCU[imod*fNRCU+ircu]);
624 //
c1ac3823 625
a6f26052 626 // for(Int_t imod2 = 0; imod2 < fNModules; imod2++){
627 // for(Int_t ircu2 = 0; ircu2 < fNModules; ircu2++){
628 // Int_t index = (imod2*fNRCU+ircu2)+(fNModules*fNRCU)*(ircu+imod)+fNRCU*fNModules*imod;
629 // fhTimeCorrRCU[index] = new TH2F (Form("hTimeCorrRCU_Mod%d_RCU%d_CompareTo_Mod%d_RCU%d",imod, ircu,imod2, ircu2),
630 // Form("Cell Energy > 0.3, Correlate cell Time in Module %d, RCU %d to Module %d, RCU %d",imod,ircu,imod2, ircu2),
631 // ntimebins,timemin,timemax,ntimebins,timemin,timemax);
632 // fhTimeCorrRCU[index]->SetXTitle("Trigger Cell Time (ns)");
633 // fhTimeCorrRCU[index]->SetYTitle("Cell Time (ns)");
634 // outputContainer->Add(fhTimeCorrRCU[index]);
635 // }
636 // }
2302a644 637 }
638
639
640 fhIMMod[imod] = new TH2F (Form("hIM_Mod%d",imod),
c8fe2783 641 Form("Cluster pairs Invariant mass vs reconstructed pair energy in Module %d",imod),
642 nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
2302a644 643 fhIMMod[imod]->SetXTitle("p_{T, cluster pairs} (GeV) ");
644 fhIMMod[imod]->SetYTitle("M_{cluster pairs} (GeV/c^{2})");
645 outputContainer->Add(fhIMMod[imod]);
c8fe2783 646
2302a644 647 fhIMCellCutMod[imod] = new TH2F (Form("hIMCellCut_Mod%d",imod),
c8fe2783 648 Form("Cluster (n cells > 1) pairs Invariant mass vs reconstructed pair energy in Module %d",imod),
649 nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
2302a644 650 fhIMCellCutMod[imod]->SetXTitle("p_{T, cluster pairs} (GeV) ");
651 fhIMCellCutMod[imod]->SetYTitle("M_{cluster pairs} (GeV/c^{2})");
652 outputContainer->Add(fhIMCellCutMod[imod]);
653
654 }
655
656
a6f26052 657 //Monte Carlo Histograms
2302a644 658 if(IsDataMC()){
659
660 fhDeltaE = new TH1F ("hDeltaE","MC - Reco E ", nptbins*2,-ptmax,ptmax);
661 fhDeltaE->SetXTitle("#Delta E (GeV)");
662 outputContainer->Add(fhDeltaE);
663
664 fhDeltaPt = new TH1F ("hDeltaPt","MC - Reco p_{T} ", nptbins*2,-ptmax,ptmax);
665 fhDeltaPt->SetXTitle("#Delta p_{T} (GeV/c)");
666 outputContainer->Add(fhDeltaPt);
667
668 fhDeltaPhi = new TH1F ("hDeltaPhi","MC - Reco #phi ",nphibins*2,-phimax,phimax);
669 fhDeltaPhi->SetXTitle("#Delta #phi (rad)");
670 outputContainer->Add(fhDeltaPhi);
671
672 fhDeltaEta = new TH1F ("hDeltaEta","MC- Reco #eta",netabins*2,-etamax,etamax);
673 fhDeltaEta->SetXTitle("#Delta #eta ");
674 outputContainer->Add(fhDeltaEta);
675
676 fhRatioE = new TH1F ("hRatioE","Reco/MC E ", nratiobins,ratiomin,ratiomax);
677 fhRatioE->SetXTitle("E_{reco}/E_{gen}");
678 outputContainer->Add(fhRatioE);
679
680 fhRatioPt = new TH1F ("hRatioPt","Reco/MC p_{T} ", nratiobins,ratiomin,ratiomax);
681 fhRatioPt->SetXTitle("p_{T, reco}/p_{T, gen}");
682 outputContainer->Add(fhRatioPt);
683
684 fhRatioPhi = new TH1F ("hRatioPhi","Reco/MC #phi ",nratiobins,ratiomin,ratiomax);
685 fhRatioPhi->SetXTitle("#phi_{reco}/#phi_{gen}");
686 outputContainer->Add(fhRatioPhi);
687
688 fhRatioEta = new TH1F ("hRatioEta","Reco/MC #eta",nratiobins,ratiomin,ratiomax);
689 fhRatioEta->SetXTitle("#eta_{reco}/#eta_{gen} ");
690 outputContainer->Add(fhRatioEta);
691
692 fh2E = new TH2F ("h2E","E distribution, reconstructed vs generated", nptbins,ptmin,ptmax,nptbins,ptmin,ptmax);
693 fh2E->SetXTitle("E_{rec} (GeV)");
694 fh2E->SetYTitle("E_{gen} (GeV)");
695 outputContainer->Add(fh2E);
696
697 fh2Pt = new TH2F ("h2Pt","p_T distribution, reconstructed vs generated", nptbins,ptmin,ptmax,nptbins,ptmin,ptmax);
698 fh2Pt->SetXTitle("p_{T,rec} (GeV/c)");
699 fh2Pt->SetYTitle("p_{T,gen} (GeV/c)");
700 outputContainer->Add(fh2Pt);
701
702 fh2Phi = new TH2F ("h2Phi","#phi distribution, reconstructed vs generated", nphibins,phimin,phimax, nphibins,phimin,phimax);
703 fh2Phi->SetXTitle("#phi_{rec} (rad)");
704 fh2Phi->SetYTitle("#phi_{gen} (rad)");
705 outputContainer->Add(fh2Phi);
706
707 fh2Eta = new TH2F ("h2Eta","#eta distribution, reconstructed vs generated", netabins,etamin,etamax,netabins,etamin,etamax);
708 fh2Eta->SetXTitle("#eta_{rec} ");
709 fh2Eta->SetYTitle("#eta_{gen} ");
710 outputContainer->Add(fh2Eta);
711
a6f26052 712 //Fill histos depending on origin of cluster
2302a644 713 fhGamE = new TH2F ("hGamE","E reconstructed vs E generated from #gamma", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
714 fhGamE->SetXTitle("E_{rec} (GeV)");
715 fhGamE->SetXTitle("E_{gen} (GeV)");
716 outputContainer->Add(fhGamE);
717
718 fhGamPt = new TH2F ("hGamPt","p_{T} reconstructed vs E generated from #gamma", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
719 fhGamPt->SetXTitle("p_{T rec} (GeV/c)");
720 fhGamPt->SetYTitle("p_{T gen} (GeV/c)");
721 outputContainer->Add(fhGamPt);
722
723 fhGamPhi = new TH2F ("hGamPhi","#phi reconstructed vs E generated from #gamma",nphibins,phimin,phimax,nphibins,phimin,phimax);
724 fhGamPhi->SetXTitle("#phi_{rec} (rad)");
725 fhGamPhi->SetYTitle("#phi_{gen} (rad)");
726 outputContainer->Add(fhGamPhi);
727
728 fhGamEta = new TH2F ("hGamEta","#eta reconstructed vs E generated from #gamma",netabins,etamin,etamax,netabins,etamin,etamax);
729 fhGamEta->SetXTitle("#eta_{rec} ");
730 fhGamEta->SetYTitle("#eta_{gen} ");
731 outputContainer->Add(fhGamEta);
732
733 fhGamDeltaE = new TH1F ("hGamDeltaE","#gamma MC - Reco E ", nptbins*2,-ptmax,ptmax);
734 fhGamDeltaE->SetXTitle("#Delta E (GeV)");
735 outputContainer->Add(fhGamDeltaE);
736
737 fhGamDeltaPt = new TH1F ("hGamDeltaPt","#gamma MC - Reco p_{T} ", nptbins*2,-ptmax,ptmax);
738 fhGamDeltaPt->SetXTitle("#Delta p_{T} (GeV/c)");
739 outputContainer->Add(fhGamDeltaPt);
740
741 fhGamDeltaPhi = new TH1F ("hGamDeltaPhi","#gamma MC - Reco #phi ",nphibins*2,-phimax,phimax);
742 fhGamDeltaPhi->SetXTitle("#Delta #phi (rad)");
743 outputContainer->Add(fhGamDeltaPhi);
744
745 fhGamDeltaEta = new TH1F ("hGamDeltaEta","#gamma MC- Reco #eta",netabins*2,-etamax,etamax);
746 fhGamDeltaEta->SetXTitle("#Delta #eta ");
747 outputContainer->Add(fhGamDeltaEta);
748
749 fhGamRatioE = new TH1F ("hGamRatioE","#gamma Reco/MC E ", nratiobins,ratiomin,ratiomax);
750 fhGamRatioE->SetXTitle("E_{reco}/E_{gen}");
751 outputContainer->Add(fhGamRatioE);
752
753 fhGamRatioPt = new TH1F ("hGamRatioPt","#gamma Reco/MC p_{T} ", nratiobins,ratiomin,ratiomax);
754 fhGamRatioPt->SetXTitle("p_{T, reco}/p_{T, gen}");
755 outputContainer->Add(fhGamRatioPt);
756
757 fhGamRatioPhi = new TH1F ("hGamRatioPhi","#gamma Reco/MC #phi ",nratiobins,ratiomin,ratiomax);
758 fhGamRatioPhi->SetXTitle("#phi_{reco}/#phi_{gen}");
759 outputContainer->Add(fhGamRatioPhi);
760
761 fhGamRatioEta = new TH1F ("hGamRatioEta","#gamma Reco/MC #eta",nratiobins,ratiomin,ratiomax);
762 fhGamRatioEta->SetXTitle("#eta_{reco}/#eta_{gen} ");
763 outputContainer->Add(fhGamRatioEta);
764
765 fhPi0E = new TH2F ("hPi0E","E reconstructed vs E generated from #pi^{0}", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
766 fhPi0E->SetXTitle("E_{rec} (GeV)");
767 fhPi0E->SetYTitle("E_{gen} (GeV)");
768 outputContainer->Add(fhPi0E);
769
770 fhPi0Pt = new TH2F ("hPi0Pt","p_{T} reconstructed vs E generated from #pi^{0}", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
771 fhPi0Pt->SetXTitle("p_{T rec} (GeV/c)");
772 fhPi0Pt->SetYTitle("p_{T gen} (GeV/c)");
773 outputContainer->Add(fhPi0Pt);
774
775 fhPi0Phi = new TH2F ("hPi0Phi","#phi reconstructed vs E generated from #pi^{0}",nphibins,phimin,phimax,nphibins,phimin,phimax);
776 fhPi0Phi->SetXTitle("#phi_{rec} (rad)");
777 fhPi0Phi->SetYTitle("#phi_{gen} (rad)");
778 outputContainer->Add(fhPi0Phi);
779
780 fhPi0Eta = new TH2F ("hPi0Eta","#eta reconstructed vs E generated from #pi^{0}",netabins,etamin,etamax,netabins,etamin,etamax);
781 fhPi0Eta->SetXTitle("#eta_{rec} ");
782 fhPi0Eta->SetYTitle("#eta_{gen} ");
783 outputContainer->Add(fhPi0Eta);
784
785 fhEleE = new TH2F ("hEleE","E reconstructed vs E generated from e^{#pm}", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
786 fhEleE->SetXTitle("E_{rec} (GeV)");
787 fhEleE->SetXTitle("E_{gen} (GeV)");
788 outputContainer->Add(fhEleE);
789
790 fhElePt = new TH2F ("hElePt","p_{T} reconstructed vs E generated from e^{#pm}", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
791 fhElePt->SetXTitle("p_{T rec} (GeV/c)");
792 fhElePt->SetYTitle("p_{T gen} (GeV/c)");
793 outputContainer->Add(fhElePt);
794
795 fhElePhi = new TH2F ("hElePhi","#phi reconstructed vs E generated from e^{#pm}",nphibins,phimin,phimax,nphibins,phimin,phimax);
796 fhElePhi->SetXTitle("#phi_{rec} (rad)");
797 fhElePhi->SetYTitle("#phi_{gen} (rad)");
798 outputContainer->Add(fhElePhi);
799
800 fhEleEta = new TH2F ("hEleEta","#eta reconstructed vs E generated from e^{#pm}",netabins,etamin,etamax,netabins,etamin,etamax);
801 fhEleEta->SetXTitle("#eta_{rec} ");
802 fhEleEta->SetYTitle("#eta_{gen} ");
803 outputContainer->Add(fhEleEta);
804
805 fhNeHadE = new TH2F ("hNeHadE","E reconstructed vs E generated from neutral hadron", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
806 fhNeHadE->SetXTitle("E_{rec} (GeV)");
807 fhNeHadE->SetYTitle("E_{gen} (GeV)");
808 outputContainer->Add(fhNeHadE);
809
810 fhNeHadPt = new TH2F ("hNeHadPt","p_{T} reconstructed vs E generated from neutral hadron", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
811 fhNeHadPt->SetXTitle("p_{T rec} (GeV/c)");
812 fhNeHadPt->SetYTitle("p_{T gen} (GeV/c)");
813 outputContainer->Add(fhNeHadPt);
814
815 fhNeHadPhi = new TH2F ("hNeHadPhi","#phi reconstructed vs E generated from neutral hadron",nphibins,phimin,phimax,nphibins,phimin,phimax);
816 fhNeHadPhi->SetXTitle("#phi_{rec} (rad)");
817 fhNeHadPhi->SetYTitle("#phi_{gen} (rad)");
818 outputContainer->Add(fhNeHadPhi);
819
820 fhNeHadEta = new TH2F ("hNeHadEta","#eta reconstructed vs E generated from neutral hadron",netabins,etamin,etamax,netabins,etamin,etamax);
821 fhNeHadEta->SetXTitle("#eta_{rec} ");
822 fhNeHadEta->SetYTitle("#eta_{gen} ");
823 outputContainer->Add(fhNeHadEta);
824
825 fhChHadE = new TH2F ("hChHadE","E reconstructed vs E generated from charged hadron", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
826 fhChHadE->SetXTitle("E_{rec} (GeV)");
827 fhChHadE->SetYTitle("E_{gen} (GeV)");
828 outputContainer->Add(fhChHadE);
829
830 fhChHadPt = new TH2F ("hChHadPt","p_{T} reconstructed vs E generated from charged hadron", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
831 fhChHadPt->SetXTitle("p_{T rec} (GeV/c)");
832 fhChHadPt->SetYTitle("p_{T gen} (GeV/c)");
833 outputContainer->Add(fhChHadPt);
834
835 fhChHadPhi = new TH2F ("hChHadPhi","#phi reconstructed vs E generated from charged hadron",nphibins,phimin,phimax,nphibins,phimin,phimax);
836 fhChHadPhi->SetXTitle("#phi_{rec} (rad)");
837 fhChHadPhi->SetYTitle("#phi_{gen} (rad)");
838 outputContainer->Add(fhChHadPhi);
839
840 fhChHadEta = new TH2F ("hChHadEta","#eta reconstructed vs E generated from charged hadron",netabins,etamin,etamax,netabins,etamin,etamax);
841 fhChHadEta->SetXTitle("#eta_{rec} ");
842 fhChHadEta->SetYTitle("#eta_{gen} ");
843 outputContainer->Add(fhChHadEta);
844
a6f26052 845 //Charged clusters
2302a644 846
847 fhGamECharged = new TH2F ("hGamECharged","E reconstructed vs E generated from #gamma, track matched cluster", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
848 fhGamECharged->SetXTitle("E_{rec} (GeV)");
849 fhGamECharged->SetXTitle("E_{gen} (GeV)");
850 outputContainer->Add(fhGamECharged);
851
852 fhGamPtCharged = new TH2F ("hGamPtCharged","p_{T} reconstructed vs E generated from #gamma, track matched cluster", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
853 fhGamPtCharged->SetXTitle("p_{T rec} (GeV/c)");
854 fhGamPtCharged->SetYTitle("p_{T gen} (GeV/c)");
855 outputContainer->Add(fhGamPtCharged);
856
857 fhGamPhiCharged = new TH2F ("hGamPhiCharged","#phi reconstructed vs E generated from #gamma, track matched cluster",nphibins,phimin,phimax,nphibins,phimin,phimax);
858 fhGamPhiCharged->SetXTitle("#phi_{rec} (rad)");
859 fhGamPhiCharged->SetYTitle("#phi_{gen} (rad)");
860 outputContainer->Add(fhGamPhiCharged);
861
862 fhGamEtaCharged = new TH2F ("hGamEtaCharged","#eta reconstructed vs E generated from #gamma, track matched cluster",netabins,etamin,etamax,netabins,etamin,etamax);
863 fhGamEtaCharged->SetXTitle("#eta_{rec} ");
864 fhGamEtaCharged->SetYTitle("#eta_{gen} ");
865 outputContainer->Add(fhGamEtaCharged);
866
867 fhPi0ECharged = new TH2F ("hPi0ECharged","E reconstructed vs E generated from #pi^{0}, track matched cluster", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
868 fhPi0ECharged->SetXTitle("E_{rec} (GeV)");
869 fhPi0ECharged->SetYTitle("E_{gen} (GeV)");
870 outputContainer->Add(fhPi0ECharged);
871
872 fhPi0PtCharged = new TH2F ("hPi0PtCharged","p_{T} reconstructed vs E generated from #pi^{0}, track matched cluster", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
873 fhPi0PtCharged->SetXTitle("p_{T rec} (GeV/c)");
874 fhPi0PtCharged->SetYTitle("p_{T gen} (GeV/c)");
875 outputContainer->Add(fhPi0PtCharged);
876
877 fhPi0PhiCharged = new TH2F ("hPi0PhiCharged","#phi reconstructed vs E generated from #pi^{0}, track matched cluster",nphibins,phimin,phimax,nphibins,phimin,phimax);
878 fhPi0PhiCharged->SetXTitle("#phi_{rec} (rad)");
879 fhPi0PhiCharged->SetYTitle("#phi_{gen} (rad)");
880 outputContainer->Add(fhPi0PhiCharged);
881
882 fhPi0EtaCharged = new TH2F ("hPi0EtaCharged","#eta reconstructed vs E generated from #pi^{0}, track matched cluster",netabins,etamin,etamax,netabins,etamin,etamax);
883 fhPi0EtaCharged->SetXTitle("#eta_{rec} ");
884 fhPi0EtaCharged->SetYTitle("#eta_{gen} ");
885 outputContainer->Add(fhPi0EtaCharged);
886
887 fhEleECharged = new TH2F ("hEleECharged","E reconstructed vs E generated from e^{#pm}, track matched cluster", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
888 fhEleECharged->SetXTitle("E_{rec} (GeV)");
889 fhEleECharged->SetXTitle("E_{gen} (GeV)");
890 outputContainer->Add(fhEleECharged);
891
892 fhElePtCharged = new TH2F ("hElePtCharged","p_{T} reconstructed vs E generated from e^{#pm}, track matched cluster", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
893 fhElePtCharged->SetXTitle("p_{T rec} (GeV/c)");
894 fhElePtCharged->SetYTitle("p_{T gen} (GeV/c)");
895 outputContainer->Add(fhElePtCharged);
896
897 fhElePhiCharged = new TH2F ("hElePhiCharged","#phi reconstructed vs E generated from e^{#pm}, track matched cluster",nphibins,phimin,phimax,nphibins,phimin,phimax);
898 fhElePhiCharged->SetXTitle("#phi_{rec} (rad)");
899 fhElePhiCharged->SetYTitle("#phi_{gen} (rad)");
900 outputContainer->Add(fhElePhiCharged);
901
902 fhEleEtaCharged = new TH2F ("hEleEtaCharged","#eta reconstructed vs E generated from e^{#pm}, track matched cluster",netabins,etamin,etamax,netabins,etamin,etamax);
903 fhEleEtaCharged->SetXTitle("#eta_{rec} ");
904 fhEleEtaCharged->SetYTitle("#eta_{gen} ");
905 outputContainer->Add(fhEleEtaCharged);
906
907 fhNeHadECharged = new TH2F ("hNeHadECharged","E reconstructed vs E generated from neutral hadron, track matched cluster", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
908 fhNeHadECharged->SetXTitle("E_{rec} (GeV)");
909 fhNeHadECharged->SetYTitle("E_{gen} (GeV)");
910 outputContainer->Add(fhNeHadECharged);
911
912 fhNeHadPtCharged = new TH2F ("hNeHadPtCharged","p_{T} reconstructed vs E generated from neutral hadron, track matched cluster", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
913 fhNeHadPtCharged->SetXTitle("p_{T rec} (GeV/c)");
914 fhNeHadPtCharged->SetYTitle("p_{T gen} (GeV/c)");
915 outputContainer->Add(fhNeHadPtCharged);
916
917 fhNeHadPhiCharged = new TH2F ("hNeHadPhiCharged","#phi reconstructed vs E generated from neutral hadron, track matched cluster",nphibins,phimin,phimax,nphibins,phimin,phimax);
918 fhNeHadPhiCharged->SetXTitle("#phi_{rec} (rad)");
919 fhNeHadPhiCharged->SetYTitle("#phi_{gen} (rad)");
920 outputContainer->Add(fhNeHadPhiCharged);
921
922 fhNeHadEtaCharged = new TH2F ("hNeHadEtaCharged","#eta reconstructed vs E generated from neutral hadron, track matched cluster",netabins,etamin,etamax,netabins,etamin,etamax);
923 fhNeHadEtaCharged->SetXTitle("#eta_{rec} ");
924 fhNeHadEtaCharged->SetYTitle("#eta_{gen} ");
925 outputContainer->Add(fhNeHadEtaCharged);
926
927 fhChHadECharged = new TH2F ("hChHadECharged","E reconstructed vs E generated from charged hadron, track matched cluster", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
928 fhChHadECharged->SetXTitle("E_{rec} (GeV)");
929 fhChHadECharged->SetYTitle("E_{gen} (GeV)");
930 outputContainer->Add(fhChHadECharged);
931
932 fhChHadPtCharged = new TH2F ("hChHadPtCharged","p_{T} reconstructed vs E generated from charged hadron, track matched cluster", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax);
933 fhChHadPtCharged->SetXTitle("p_{T rec} (GeV/c)");
934 fhChHadPtCharged->SetYTitle("p_{T gen} (GeV/c)");
935 outputContainer->Add(fhChHadPtCharged);
936
937 fhChHadPhiCharged = new TH2F ("hChHadPhiCharged","#phi reconstructed vs E generated from charged hadron, track matched cluster",nphibins,phimin,phimax,nphibins,phimin,phimax);
938 fhChHadPhiCharged->SetXTitle("#phi (rad)");
939 fhChHadPhiCharged->SetXTitle("#phi_{rec} (rad)");
940 fhChHadPhiCharged->SetYTitle("#phi_{gen} (rad)");
941 outputContainer->Add(fhChHadPhiCharged);
942
943 fhChHadEtaCharged = new TH2F ("hChHadEtaCharged","#eta reconstructed vs E generated from charged hadron, track matched cluster",netabins,etamin,etamax,netabins,etamin,etamax);
944 fhChHadEtaCharged->SetXTitle("#eta_{rec} ");
945 fhChHadEtaCharged->SetYTitle("#eta_{gen} ");
946 outputContainer->Add(fhChHadEtaCharged);
947
a6f26052 948 //Vertex of generated particles
2302a644 949
950 fhEMVxyz = new TH2F ("hEMVxyz","Production vertex of reconstructed ElectroMagnetic particles",nvdistbins,vdistmin,vdistmax,nvdistbins,vdistmin,vdistmax);//,100,0,500);
951 fhEMVxyz->SetXTitle("v_{x}");
952 fhEMVxyz->SetYTitle("v_{y}");
a6f26052 953 //fhEMVxyz->SetZTitle("v_{z}");
2302a644 954 outputContainer->Add(fhEMVxyz);
955
956 fhHaVxyz = new TH2F ("hHaVxyz","Production vertex of reconstructed hadrons",nvdistbins,vdistmin,vdistmax,nvdistbins,vdistmin,vdistmax);//,100,0,500);
957 fhHaVxyz->SetXTitle("v_{x}");
958 fhHaVxyz->SetYTitle("v_{y}");
a6f26052 959 //fhHaVxyz->SetZTitle("v_{z}");
2302a644 960 outputContainer->Add(fhHaVxyz);
961
962 fhEMR = new TH2F ("hEMR","Distance to production vertex of reconstructed ElectroMagnetic particles vs E rec",nptbins,ptmin,ptmax,nvdistbins,vdistmin,vdistmax);
963 fhEMR->SetXTitle("E (GeV)");
964 fhEMR->SetYTitle("TMath::Sqrt(v_{x}^{2}+v_{y}^{2})");
965 outputContainer->Add(fhEMR);
966
967 fhHaR = new TH2F ("hHaR","Distance to production vertex of reconstructed Hadrons vs E rec",nptbins,ptmin,ptmax,nvdistbins,vdistmin,vdistmax);
968 fhHaR->SetXTitle("E (GeV)");
969 fhHaR->SetYTitle("TMath::Sqrt(v_{x}^{2}+v_{y}^{2})");
970 outputContainer->Add(fhHaR);
971
972
c8fe2783 973
a6f26052 974 //Pure MC
2302a644 975 fhGenGamPt = new TH1F("hGenGamPt" ,"p_{T} of generated #gamma",nptbins,ptmin,ptmax);
976 fhGenGamEta = new TH1F("hGenGamEta","Y of generated #gamma",netabins,etamin,etamax);
977 fhGenGamPhi = new TH1F("hGenGamPhi","#phi of generated #gamma",nphibins,phimin,phimax);
978
979 fhGenPi0Pt = new TH1F("hGenPi0Pt" ,"p_{T} of generated #pi^{0}",nptbins,ptmin,ptmax);
980 fhGenPi0Eta = new TH1F("hGenPi0Eta","Y of generated #pi^{0}",netabins,etamin,etamax);
981 fhGenPi0Phi = new TH1F("hGenPi0Phi","#phi of generated #pi^{0}",nphibins,phimin,phimax);
982
983 fhGenEtaPt = new TH1F("hGenEtaPt" ,"p_{T} of generated #eta",nptbins,ptmin,ptmax);
984 fhGenEtaEta = new TH1F("hGenEtaEta","Y of generated #eta",netabins,etamin,etamax);
985 fhGenEtaPhi = new TH1F("hGenEtaPhi","#phi of generated #eta",nphibins,phimin,phimax);
986
987 fhGenOmegaPt = new TH1F("hGenOmegaPt" ,"p_{T} of generated #omega",nptbins,ptmin,ptmax);
988 fhGenOmegaEta = new TH1F("hGenOmegaEta","Y of generated #omega",netabins,etamin,etamax);
989 fhGenOmegaPhi = new TH1F("hGenOmegaPhi","#phi of generated #omega",nphibins,phimin,phimax);
990
991 fhGenElePt = new TH1F("hGenElePt" ,"p_{T} of generated e^{#pm}",nptbins,ptmin,ptmax);
992 fhGenEleEta = new TH1F("hGenEleEta","Y of generated e^{#pm}",netabins,etamin,etamax);
993 fhGenElePhi = new TH1F("hGenElePhi","#phi of generated e^{#pm}",nphibins,phimin,phimax);
994
995 fhGenGamPt->SetXTitle("p_{T} (GeV/c)");
996 fhGenGamEta->SetXTitle("#eta");
997 fhGenGamPhi->SetXTitle("#phi (rad)");
998 outputContainer->Add(fhGenGamPt);
999 outputContainer->Add(fhGenGamEta);
1000 outputContainer->Add(fhGenGamPhi);
1001
1002 fhGenPi0Pt->SetXTitle("p_{T} (GeV/c)");
1003 fhGenPi0Eta->SetXTitle("#eta");
1004 fhGenPi0Phi->SetXTitle("#phi (rad)");
1005 outputContainer->Add(fhGenPi0Pt);
1006 outputContainer->Add(fhGenPi0Eta);
1007 outputContainer->Add(fhGenPi0Phi);
1008
1009 fhGenEtaPt->SetXTitle("p_{T} (GeV/c)");
1010 fhGenEtaEta->SetXTitle("#eta");
1011 fhGenEtaPhi->SetXTitle("#phi (rad)");
1012 outputContainer->Add(fhGenEtaPt);
1013 outputContainer->Add(fhGenEtaEta);
1014 outputContainer->Add(fhGenEtaPhi);
1015
1016 fhGenOmegaPt->SetXTitle("p_{T} (GeV/c)");
1017 fhGenOmegaEta->SetXTitle("#eta");
1018 fhGenOmegaPhi->SetXTitle("#phi (rad)");
1019 outputContainer->Add(fhGenOmegaPt);
1020 outputContainer->Add(fhGenOmegaEta);
1021 outputContainer->Add(fhGenOmegaPhi);
1022
1023 fhGenElePt->SetXTitle("p_{T} (GeV/c)");
1024 fhGenEleEta->SetXTitle("#eta");
1025 fhGenElePhi->SetXTitle("#phi (rad)");
1026 outputContainer->Add(fhGenElePt);
1027 outputContainer->Add(fhGenEleEta);
1028 outputContainer->Add(fhGenElePhi);
1029
1030 fhGenGamAccE = new TH1F("hGenGamAccE" ,"E of generated #gamma in calorimeter acceptance",nptbins,ptmin,ptmax);
1031 fhGenGamAccPt = new TH1F("hGenGamAccPt" ,"p_{T} of generated #gamma in calorimeter acceptance",nptbins,ptmin,ptmax);
1032 fhGenGamAccEta = new TH1F("hGenGamAccEta","Y of generated #gamma in calorimeter acceptance",netabins,etamin,etamax);
1033 fhGenGamAccPhi = new TH1F("hGenGamAccPhi","#phi of generated #gamma in calorimeter acceptance",nphibins,phimin,phimax);
1034
1035 fhGenPi0AccE = new TH1F("hGenPi0AccE" ,"E of generated #pi^{0} in calorimeter acceptance",nptbins,ptmin,ptmax);
1036 fhGenPi0AccPt = new TH1F("hGenPi0AccPt" ,"p_{T} of generated #pi^{0} in calorimeter acceptance",nptbins,ptmin,ptmax);
1037 fhGenPi0AccEta = new TH1F("hGenPi0AccEta","Y of generated #pi^{0} in calorimeter acceptance",netabins,etamin,etamax);
1038 fhGenPi0AccPhi = new TH1F("hGenPi0AccPhi","#phi of generated #pi^{0} in calorimeter acceptance",nphibins,phimin,phimax);
1039
1040 fhGenGamAccE ->SetXTitle("E (GeV)");
1041 fhGenGamAccPt ->SetXTitle("p_{T} (GeV/c)");
1042 fhGenGamAccEta->SetXTitle("#eta");
1043 fhGenGamAccPhi->SetXTitle("#phi (rad)");
1044 outputContainer->Add(fhGenGamAccE);
1045 outputContainer->Add(fhGenGamAccPt);
1046 outputContainer->Add(fhGenGamAccEta);
1047 outputContainer->Add(fhGenGamAccPhi);
1048
1049 fhGenPi0AccE ->SetXTitle("E (GeV)");
1050 fhGenPi0AccPt ->SetXTitle("p_{T} (GeV/c)");
1051 fhGenPi0AccEta->SetXTitle("#eta");
1052 fhGenPi0AccPhi->SetXTitle("#phi (rad)");
1053 outputContainer->Add(fhGenPi0AccE);
1054 outputContainer->Add(fhGenPi0AccPt);
1055 outputContainer->Add(fhGenPi0AccEta);
1056 outputContainer->Add(fhGenPi0AccPhi);
1057
a6f26052 1058 //Track Matching
2302a644 1059
1060 fhMCEle1pOverE = new TH2F("hMCEle1pOverE","TRACK matches p/E, MC electrons",nptbins,ptmin,ptmax, nPoverEbins,pOverEmin,pOverEmax);
1061 fhMCEle1pOverE->SetYTitle("p/E");
1062 fhMCEle1pOverE->SetXTitle("p_{T} (GeV/c)");
1063 outputContainer->Add(fhMCEle1pOverE);
1064
1065 fhMCEle1dR = new TH1F("hMCEle1dR","TRACK matches dR, MC electrons",ndRbins,dRmin,dRmax);
1066 fhMCEle1dR->SetXTitle("#Delta R (rad)");
1067 outputContainer->Add(fhMCEle1dR) ;
1068
1069 fhMCEle2MatchdEdx = new TH2F("hMCEle2MatchdEdx","dE/dx vs. p for all matches, MC electrons",nptbins,ptmin,ptmax,ndedxbins,dedxmin,dedxmax);
1070 fhMCEle2MatchdEdx->SetXTitle("p (GeV/c)");
1071 fhMCEle2MatchdEdx->SetYTitle("<dE/dx>");
1072 outputContainer->Add(fhMCEle2MatchdEdx);
1073
1074 fhMCChHad1pOverE = new TH2F("hMCChHad1pOverE","TRACK matches p/E, MC charged hadrons",nptbins,ptmin,ptmax, nPoverEbins,pOverEmin,pOverEmax);
1075 fhMCChHad1pOverE->SetYTitle("p/E");
1076 fhMCChHad1pOverE->SetXTitle("p_{T} (GeV/c)");
1077 outputContainer->Add(fhMCChHad1pOverE);
1078
1079 fhMCChHad1dR = new TH1F("hMCChHad1dR","TRACK matches dR, MC charged hadrons",ndRbins,dRmin,dRmax);
1080 fhMCChHad1dR->SetXTitle("#Delta R (rad)");
1081 outputContainer->Add(fhMCChHad1dR) ;
1082
1083 fhMCChHad2MatchdEdx = new TH2F("hMCChHad2MatchdEdx","dE/dx vs. p for all matches, MC charged hadrons",nptbins,ptmin,ptmax,ndedxbins,dedxmin,dedxmax);
1084 fhMCChHad2MatchdEdx->SetXTitle("p (GeV/c)");
1085 fhMCChHad2MatchdEdx->SetYTitle("<dE/dx>");
1086 outputContainer->Add(fhMCChHad2MatchdEdx);
1087
1088 fhMCNeutral1pOverE = new TH2F("hMCNeutral1pOverE","TRACK matches p/E, MC neutrals",nptbins,ptmin,ptmax, nPoverEbins,pOverEmin,pOverEmax);
1089 fhMCNeutral1pOverE->SetYTitle("p/E");
1090 fhMCNeutral1pOverE->SetXTitle("p_{T} (GeV/c)");
1091 outputContainer->Add(fhMCNeutral1pOverE);
1092
1093 fhMCNeutral1dR = new TH1F("hMCNeutral1dR","TRACK matches dR, MC neutrals",ndRbins,dRmin,dRmax);
1094 fhMCNeutral1dR->SetXTitle("#Delta R (rad)");
1095 outputContainer->Add(fhMCNeutral1dR) ;
1096
1097 fhMCNeutral2MatchdEdx = new TH2F("hMCNeutral2MatchdEdx","dE/dx vs. p for all matches, MC neutrals",nptbins,ptmin,ptmax,ndedxbins,dedxmin,dedxmax);
1098 fhMCNeutral2MatchdEdx->SetXTitle("p (GeV/c)");
1099 fhMCNeutral2MatchdEdx->SetYTitle("<dE/dx>");
1100 outputContainer->Add(fhMCNeutral2MatchdEdx);
1101
1102 fhMCEle1pOverER02 = new TH2F("hMCEle1pOverER02","TRACK matches p/E, MC electrons",nptbins,ptmin,ptmax, nPoverEbins,pOverEmin,pOverEmax);
1103 fhMCEle1pOverER02->SetYTitle("p/E");
1104 fhMCEle1pOverER02->SetXTitle("p_{T} (GeV/c)");
1105 outputContainer->Add(fhMCEle1pOverER02);
1106
1107 fhMCChHad1pOverER02 = new TH2F("hMCChHad1pOverER02","TRACK matches p/E, MC charged hadrons",nptbins,ptmin,ptmax, nPoverEbins,pOverEmin,pOverEmax);
1108 fhMCChHad1pOverER02->SetYTitle("p/E");
1109 fhMCChHad1pOverER02->SetXTitle("p_{T} (GeV/c)");
1110 outputContainer->Add(fhMCChHad1pOverER02);
1111
1112 fhMCNeutral1pOverER02 = new TH2F("hMCNeutral1pOverER02","TRACK matches p/E, MC neutrals",nptbins,ptmin,ptmax, nPoverEbins,pOverEmin,pOverEmax);
1113 fhMCNeutral1pOverER02->SetYTitle("p/E");
1114 fhMCNeutral1pOverER02->SetXTitle("p_{T} (GeV/c)");
1115 outputContainer->Add(fhMCNeutral1pOverER02);
1116 }
c8fe2783 1117
2302a644 1118 return outputContainer;
9725fd2a 1119}
1120
a6f26052 1121//_______________________________________________________________________________________________________________________________________
3a75604b 1122Int_t AliAnaCalorimeterQA::GetNewRebinForRePlotting(TH1D* histo, const Float_t newXmin, const Float_t newXmax,const Int_t newXnbins) const
1123{
a6f26052 1124 //Calculate the rebinning for the new requested bin size, only used when replotting executing the Terminte
3a75604b 1125 Float_t oldbinsize = histo->GetBinWidth(0);
1126 Float_t newbinsize = TMath::Abs(newXmax-newXmin) / newXnbins;
a6f26052 1127 //printf("bin size, old %f, new %f\n",oldbinsize,newbinsize);
3a75604b 1128 if(newbinsize > oldbinsize) return (Int_t) (newbinsize/oldbinsize);
1129 else return 1;
1130}
a5fafd85 1131
a6f26052 1132//__________________________________________________
9725fd2a 1133void AliAnaCalorimeterQA::Init()
1134{
a6f26052 1135 //Check if the data or settings are ok
2302a644 1136 if(fCalorimeter != "PHOS" && fCalorimeter !="EMCAL"){
1137 printf("AliAnaCalorimeterQA::Init() - Wrong calorimeter name <%s>, END\n", fCalorimeter.Data());
1138 abort();
1139 }
1140
1141 if(GetReader()->GetDataType()== AliCaloTrackReader::kMC){
1142 printf("AliAnaCalorimeterQA::Init() - Analysis of reconstructed data, MC reader not aplicable\n");
1143 abort();
1144 }
1145
9725fd2a 1146}
1147
1148
a6f26052 1149//__________________________________________________
9725fd2a 1150void AliAnaCalorimeterQA::InitParameters()
1151{
a6f26052 1152 //Initialize the parameters of the analysis.
9725fd2a 1153 AddToHistogramsName("AnaCaloQA_");
c8fe2783 1154
9725fd2a 1155 fCalorimeter = "EMCAL"; //or PHOS
5a2dbc3c 1156 fStyleMacro = "" ;
1157 fNModules = 12; // set maximum to maximum number of EMCAL modules
eb5a51ae 1158 fNRCU = 2; // set maximum number of RCU in EMCAL per SM
4cf55759 1159 fTimeCutMin = -1;
1160 fTimeCutMax = 9999999;
2302a644 1161 fEMCALCellAmpMin = 0.0;
1162 fPHOSCellAmpMin = 0.0;
1163
5a2dbc3c 1164 fHistoPOverEBins = 100 ; fHistoPOverEMax = 10. ; fHistoPOverEMin = 0. ;
1165 fHistodEdxBins = 200 ; fHistodEdxMax = 400. ; fHistodEdxMin = 0. ;
1166 fHistodRBins = 300 ; fHistodRMax = 3.15 ; fHistodRMin = 0. ;
c9141a7c 1167 fHistoTimeBins = 1000; fHistoTimeMax = 1.e3 ; fHistoTimeMin = 0. ;//ns
5a2dbc3c 1168 fHistoNBins = 300 ; fHistoNMax = 300 ; fHistoNMin = 0 ;
1169 fHistoRatioBins = 200 ; fHistoRatioMax = 2 ; fHistoRatioMin = 0. ;
1170 fHistoVertexDistBins = 100 ; fHistoVertexDistMax = 500. ; fHistoVertexDistMin = 0. ;
0866d83a 1171 fHistoRBins = 100 ; fHistoRMax = 500 ; fHistoRMin = -500 ;//cm
1172 fHistoXBins = 100 ; fHistoXMax = 500 ; fHistoXMin = -500 ;//cm
1173 fHistoYBins = 100 ; fHistoYMax = 500 ; fHistoYMin = -500 ;//cm
1174 fHistoZBins = 100 ; fHistoZMax = 600 ; fHistoZMin = -500 ;//cm
eb5a51ae 1175 fHistoSSBins = 40 ; fHistoSSMax = 10 ; fHistoSSMin = 0 ;
1176
9725fd2a 1177}
1178
a6f26052 1179//__________________________________________________________________
9725fd2a 1180void AliAnaCalorimeterQA::Print(const Option_t * opt) const
1181{
a6f26052 1182 //Print some relevant parameters set for the analysis
9725fd2a 1183 if(! opt)
1184 return;
1185
1186 printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
1187 AliAnaPartCorrBaseClass::Print(" ");
c8fe2783 1188
9725fd2a 1189 printf("Select Calorimeter %s \n",fCalorimeter.Data());
63f1dd86 1190 printf("Make plots? %d \n",fMakePlots);
1191 printf("Plots style macro %s \n",fStyleMacro.Data());
4cf55759 1192 printf("Time Cut: %3.1f < TOF < %3.1f\n", fTimeCutMin, fTimeCutMax);
2302a644 1193 printf("EMCAL Min Amplitude : %2.1f GeV/c\n", fEMCALCellAmpMin) ;
1194 printf("PHOS Min Amplitude : %2.1f GeV/c\n", fPHOSCellAmpMin) ;
5a2dbc3c 1195 printf("Histograms: %3.1f < p/E < %3.1f, Nbin = %d\n", fHistoPOverEMin, fHistoPOverEMax, fHistoPOverEBins);
1196 printf("Histograms: %3.1f < dEdx < %3.1f, Nbin = %d\n", fHistodEdxMin, fHistodEdxMax, fHistodEdxBins);
0866d83a 1197 printf("Histograms: %3.1f < dR (track cluster) < %3.1f, Nbin = %d\n", fHistodRMin, fHistodRMax, fHistodRBins);
255b904d 1198 printf("Histograms: %3.1f < R=sqrt{x^2+y^2} < %3.1f, Nbin = %d\n", fHistoRMin, fHistoRMax, fHistoRBins);
0866d83a 1199 printf("Histograms: %3.1f < X < %3.1f, Nbin = %d\n", fHistoXMin, fHistoXMax, fHistoXBins);
1200 printf("Histograms: %3.1f < Y < %3.1f, Nbin = %d\n", fHistoYMin, fHistoYMax, fHistoYBins);
1201 printf("Histograms: %3.1f < Z < %3.1f, Nbin = %d\n", fHistoZMin, fHistoZMax, fHistoZBins);
5a2dbc3c 1202 printf("Histograms: %g < Time < %g, Nbin = %d\n" , fHistoTimeMin, fHistoTimeMax, fHistoTimeBins);
1203 printf("Histograms: %d < N < %d, Nbin = %d\n" , fHistoNMin, fHistoNMax, fHistoNBins);
1204 printf("Histograms: %3.1f < Ratio< %3.1f, Nbin = %d\n", fHistoRatioMin, fHistoRatioMax, fHistoRatioBins);
1205 printf("Histograms: %3.1f < Vertex Distance < %3.1f, Nbin = %d\n", fHistoVertexDistMin, fHistoVertexDistMax, fHistoVertexDistBins);
c8fe2783 1206
9725fd2a 1207}
1208
a6f26052 1209//__________________________________________________________________
9725fd2a 1210void AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
1211{
a6f26052 1212 //Fill Calorimeter QA histograms
2302a644 1213 TLorentzVector mom ;
1214 TLorentzVector mom2 ;
1215 TObjArray * caloClusters = NULL;
1216 Int_t nLabel = 0;
1217 Int_t *labels=0x0;
1218 Int_t nCaloClusters = 0;
1219 Int_t nCaloClustersAccepted = 0;
1220 Int_t nCaloCellsPerCluster = 0;
1221 Int_t nTracksMatched = 0;
1222 Int_t trackIndex = 0;
1223 Int_t nModule = -1;
c8fe2783 1224
5025c139 1225 //Get vertex for photon momentum calculation and event selection
1226 Double_t v[3] = {0,0,0}; //vertex ;
1227 GetReader()->GetVertex(v);
1228 if (TMath::Abs(v[2]) > GetZvertexCut()) return ;
1229
a6f26052 1230 //Play with the MC stack if available
1231 //Get the MC arrays and do some checks
2302a644 1232 if(IsDataMC()){
1233 if(GetReader()->ReadStack()){
c8fe2783 1234
2302a644 1235 if(!GetMCStack()) {
5025c139 1236 printf("AliAnaPhoton::MakeAnalysisFillHistograms() - Stack not available, is the MC handler called? STOP\n");
1237 abort();
2302a644 1238 }
a6f26052 1239 //Fill some pure MC histograms, only primaries.
2302a644 1240 for(Int_t i=0 ; i<GetMCStack()->GetNprimary(); i++){//Only primary particles, for all MC transport put GetNtrack()
5025c139 1241 TParticle *primary = GetMCStack()->Particle(i) ;
a6f26052 1242 //printf("i %d, %s: status = %d, primary? %d\n",i, primary->GetName(), primary->GetStatusCode(), primary->IsPrimary());
5025c139 1243 if (primary->GetStatusCode() > 11) continue; //Working for PYTHIA and simple generators, check for HERWIG
1244 primary->Momentum(mom);
1245 MCHistograms(mom,TMath::Abs(primary->GetPdgCode()));
2302a644 1246 } //primary loop
1247 }
1248 else if(GetReader()->ReadAODMCParticles()){
c8fe2783 1249
2302a644 1250 if(!GetReader()->GetAODMCParticles(0)) {
5025c139 1251 printf("AliAnaPhoton::MakeAnalysisFillHistograms() - AODMCParticles not available!\n");
1252 abort();
2302a644 1253 }
a6f26052 1254 //Fill some pure MC histograms, only primaries.
2302a644 1255 for(Int_t i=0 ; i < (GetReader()->GetAODMCParticles(0))->GetEntriesFast(); i++){
5025c139 1256 AliAODMCParticle *aodprimary = (AliAODMCParticle*) (GetReader()->GetAODMCParticles(0))->At(i) ;
a6f26052 1257 //printf("i %d, %s: primary? %d physical primary? %d, flag %d\n",
1258 // i,(TDatabasePDG::Instance()->GetParticle(aodprimary->GetPdgCode()))->GetName(),
1259 // aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary(), aodprimary->GetFlag());
5025c139 1260 if (!aodprimary->IsPrimary()) continue; //accept all which is not MC transport generated. Don't know how to avoid partons
a6f26052 1261 //aodprimary->Momentum(mom);
5025c139 1262 mom.SetPxPyPzE(aodprimary->Px(),aodprimary->Py(),aodprimary->Pz(),aodprimary->E());
1263 MCHistograms(mom,TMath::Abs(aodprimary->GetPdgCode()));
2302a644 1264 } //primary loop
1265
1266 }
1267 }// is data and MC
1268
1269
a6f26052 1270 //Get List with CaloClusters
17708df9 1271 if (fCalorimeter == "PHOS") caloClusters = GetAODPHOS();
1272 else if (fCalorimeter == "EMCAL") caloClusters = GetAODEMCAL();
f8006433 1273 else
1274 AliFatal(Form("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Wrong calorimeter name <%s>, END\n", fCalorimeter.Data()));
17708df9 1275
f8006433 1276 // if (fCalorimeter == "EMCAL") GetReader()->GetInputEvent()->GetEMCALClusters(caloClusters);//GetAODEMCAL();
1277 // else if(fCalorimeter == "PHOS") GetReader()->GetInputEvent()->GetPHOSClusters (caloClusters);//GetAODPHOS();
1278 // else
1279 // AliFatal(Form("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Wrong calorimeter name <%s>, END\n", fCalorimeter.Data()));
2302a644 1280
1281 if(!caloClusters) {
1282 AliFatal(Form("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - No CaloClusters available\n"));
1283 }
f8006433 1284 else{
1285 //----------------------------------------------------------
1286 //Correlate Calorimeters
1287 //----------------------------------------------------------
1288 //if(fCorrelateCalos) CorrelateCalorimeters(caloClusters);
1289 if(fCorrelateCalos) CorrelateCalorimeters();
1290
1291
1292 //----------------------------------------------------------
1293 // CALOCLUSTERS
1294 //----------------------------------------------------------
1295
1296 nCaloClusters = caloClusters->GetEntriesFast() ;
f8006433 1297 Int_t *nClustersInModule = new Int_t[fNModules];
1298 for(Int_t imod = 0; imod < fNModules; imod++ ) nClustersInModule[imod] = 0;
1299
1300 if(GetDebug() > 0)
1301 printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - In %s there are %d clusters \n", fCalorimeter.Data(), nCaloClusters);
1302
f8006433 1303 AliVTrack * track = 0x0;
f8006433 1304 Float_t pos[3] ;
1305 Float_t showerShape[3] ;
1306 Double_t tof = 0;
1307 //Loop over CaloClusters
1308 //if(nCaloClusters > 0)printf("QA : Vertex Cut passed %f, cut %f, entries %d, %s\n",v[2], 40., nCaloClusters, fCalorimeter.Data());
1309 for(Int_t iclus = 0; iclus < nCaloClusters; iclus++){
c8fe2783 1310
f8006433 1311 if(GetDebug() > 0) printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - cluster: %d/%d, data %d \n",
1312 iclus+1,nCaloClusters,GetReader()->GetDataType());
c8fe2783 1313
f8006433 1314 if(GetReader()->GetDataType()==AliCaloTrackReader::kESD){
1315 AliVCluster* clus = (AliVCluster*)caloClusters->At(iclus);
1316 AliVCaloCells * cell = 0x0;
1317 if(fCalorimeter == "PHOS") cell = GetPHOSCells();
1318 else cell = GetEMCALCells();
c8fe2783 1319
f8006433 1320 //Get cluster kinematics
1321 clus->GetPosition(pos);
1322 clus->GetMomentum(mom,v);
1323 tof = clus->GetTOF()*1e9;
1324 if(tof < fTimeCutMin || tof > fTimeCutMax) continue;
c8fe2783 1325
f8006433 1326 //Check only certain regions
1327 Bool_t in = kTRUE;
1328 if(IsFiducialCutOn()) in = GetFiducialCut()->IsInFiducialCut(mom,fCalorimeter) ;
1329 if(!in) continue;
5025c139 1330
f8006433 1331 //Get module of cluster
2302a644 1332 nCaloClustersAccepted++;
f8006433 1333 nModule = GetModuleNumber(clus);
1334 if(nModule >=0 && nModule < fNModules) nClustersInModule[nModule]++;
2302a644 1335
f8006433 1336 //MC labels
1337 nLabel = clus->GetNLabels();
1338 labels = clus->GetLabels();
2302a644 1339
f8006433 1340 //Cells per cluster
1341 nCaloCellsPerCluster = clus->GetNCells();
1342 //if(mom.E() > 10 && nCaloCellsPerCluster == 1 ) printf("%s:************** E = %f ********** ncells = %d\n",fCalorimeter.Data(), mom.E(),nCaloCellsPerCluster);
5025c139 1343
f8006433 1344 //matched cluster with tracks
1345 nTracksMatched = clus->GetNTracksMatched();
1346 trackIndex = clus->GetTrackMatchedIndex();
1347 if(trackIndex >= 0){
1348 track = (AliVTrack*)GetReader()->GetInputEvent()->GetTrack(trackIndex);
1349 }
1350 else{
1351 if(nTracksMatched == 1) nTracksMatched = 0;
1352 track = 0;
c8fe2783 1353 }
c8fe2783 1354
f8006433 1355 //Shower shape parameters
1356 showerShape[0] = clus->GetM20();
1357 showerShape[1] = clus->GetM02();
1358 showerShape[2] = clus->GetDispersion();
c8fe2783 1359
f8006433 1360 //======================
1361 //Cells in cluster
1362 //======================
c8fe2783 1363
f8006433 1364 //Get list of contributors
1365 UShort_t * indexList = clus->GetCellsAbsId() ;
1366 // check time of cells respect to max energy cell
1367 //Get maximum energy cell
1368 Float_t emax = -1;
1369 Double_t tmax = -1;
1370 Int_t imax = -1;
1371 Int_t absId = -1 ;
1372 //printf("nCaloCellsPerCluster %d\n",nCaloCellsPerCluster);
1373 //Loop on cluster cells
1374 for (Int_t ipos = 0; ipos < nCaloCellsPerCluster; ipos++) {
1375 // printf("Index %d\n",ipos);
1376 absId = indexList[ipos];
1377
1378 //Get position of cell compare to cluster
1379 if(fFillAllPosHisto){
1380 if(fCalorimeter=="EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){
1381
1382 Double_t cellpos[] = {0, 0, 0};
1383 GetEMCALGeometry()->GetGlobal(absId, cellpos);
1384
1385 fhDeltaCellClusterXNCells->Fill(pos[0]-cellpos[0],nCaloCellsPerCluster) ;
1386 fhDeltaCellClusterYNCells->Fill(pos[1]-cellpos[1],nCaloCellsPerCluster) ;
1387 fhDeltaCellClusterZNCells->Fill(pos[2]-cellpos[2],nCaloCellsPerCluster) ;
1388
1389 fhDeltaCellClusterXE->Fill(pos[0]-cellpos[0],mom.E()) ;
1390 fhDeltaCellClusterYE->Fill(pos[1]-cellpos[1],mom.E()) ;
1391 fhDeltaCellClusterZE->Fill(pos[2]-cellpos[2],mom.E()) ;
1392
1393 Float_t r = TMath::Sqrt(pos[0]*pos[0] +pos[1]*pos[1]);// +pos[2]*pos[2]);
1394 Float_t rcell = TMath::Sqrt(cellpos[0]*cellpos[0]+cellpos[1]*cellpos[1]);//+cellpos[2]*cellpos[2]);
1395 fhDeltaCellClusterRNCells->Fill(r-rcell, nCaloCellsPerCluster) ;
1396 fhDeltaCellClusterRE ->Fill(r-rcell, mom.E()) ;
1397
1398 // Float_t celleta = 0, cellphi = 0;
1399 // GetEMCALGeometry()->EtaPhiFromIndex(absId, celleta, cellphi);
1400 // Int_t imod = -1, iTower = -1, iIphi = -1, iIeta = -1, iphi = -1, ieta = -1;
1401 // GetEMCALGeometry()->GetCellIndex(absId,imod,iTower,iIphi,iIeta);
1402 // GetEMCALGeometry()->GetCellPhiEtaIndexInSModule(imod,iTower,
1403 // iIphi, iIeta,iphi,ieta);
1404 // printf("AbsId %d, SM %d, Index eta %d, phi %d\n", absId, imod, ieta, iphi);
1405 // printf("Cluster E %f, eta %f, phi %f; Cell: Amp %f, eta %f, phi%f\n", mom.E(),mom.Eta(), mom.Phi()*TMath::RadToDeg(), cell->GetCellAmplitude(absId),celleta, cellphi*TMath::RadToDeg());
1406 // printf("x cluster %f, x cell %f, cluster-cell %f\n",pos[0], cellpos[0],pos[0]-cellpos[0]);
1407 // printf("y cluster %f, y cell %f, cluster-cell %f\n",pos[1], cellpos[1],pos[1]-cellpos[1]);
1408 // printf("z cluster %f, z cell %f, cluster-cell %f\n",pos[2], cellpos[2],pos[2]-cellpos[2]);
1409 // printf("r cluster %f, r cell %f, cluster-cell %f\n",r, rcell, r-rcell);
1410 //
1411
1412 }//EMCAL and its matrices are available
1413 else if(fCalorimeter=="PHOS" && GetCaloUtils()->IsPHOSGeoMatrixSet()){
1414 TVector3 xyz;
1415 Int_t relId[4], module;
1416 Float_t xCell, zCell;
1417
1418 GetPHOSGeometry()->AbsToRelNumbering(absId,relId);
1419 module = relId[0];
1420 GetPHOSGeometry()->RelPosInModule(relId,xCell,zCell);
1421 GetPHOSGeometry()->Local2Global(module,xCell,zCell,xyz);
1422
1423 fhDeltaCellClusterXNCells->Fill(pos[0]-xyz.X(),nCaloCellsPerCluster) ;
1424 fhDeltaCellClusterYNCells->Fill(pos[1]-xyz.Y(),nCaloCellsPerCluster) ;
1425 fhDeltaCellClusterZNCells->Fill(pos[2]-xyz.Z(),nCaloCellsPerCluster) ;
1426
1427 fhDeltaCellClusterXE->Fill(pos[0]-xyz.X(),mom.E()) ;
1428 fhDeltaCellClusterYE->Fill(pos[1]-xyz.Y(),mom.E()) ;
1429 fhDeltaCellClusterZE->Fill(pos[2]-xyz.Z(),mom.E()) ;
1430
1431 Float_t r = TMath::Sqrt(pos[0]*pos[0] +pos[1]*pos[1]);// +pos[2]*pos[2]);
1432 Float_t rcell = TMath::Sqrt(xyz.X()*xyz.X()+xyz.Y()*xyz.Y());//+xyz.Z()*xyz.Z());
1433 fhDeltaCellClusterRNCells->Fill(r-rcell, nCaloCellsPerCluster) ;
1434 fhDeltaCellClusterRE ->Fill(r-rcell, mom.E()) ;
1435
1436 // printf("x cluster %f, x cell %f, cluster-cell %f\n",pos[0], cellpos[0],pos[0]-cellpos[0]);
1437 // printf("y cluster %f, y cell %f, cluster-cell %f\n",pos[1], cellpos[1],pos[1]-cellpos[1]);
1438 // printf("z cluster %f, z cell %f, cluster-cell %f\n",pos[2], cellpos[2],pos[2]-cellpos[2]);
1439 // printf("r cluster %f, r cell %f, cluster-cell %f\n",r, rcell, r-rcell);
1440 }//PHOS and its matrices are available
1441 }//Fill all position histograms
1442
1443 //Find maximum energy cluster
1444 if(cell->GetCellAmplitude(absId) > emax) {
1445 imax = ipos;
1446 emax = cell->GetCellAmplitude(absId);
1447 tmax = cell->GetCellTime(absId);
1448 }
1449
1450 }// cluster cell loop
c8fe2783 1451
f8006433 1452 // check time of cells respect to max energy cell
1453 if(nCaloCellsPerCluster > 1){
1454 for (Int_t ipos = 0; ipos < nCaloCellsPerCluster; ipos++) {
1455 if(imax == ipos) continue;
1456 absId = indexList[ipos];
1457 Float_t diff = (tmax-cell->GetCellTime(absId))*1e9;
1458 fhCellTimeSpreadRespectToCellMax->Fill(diff);
1459 if(TMath::Abs(TMath::Abs(diff) > 100)) fhCellIdCellLargeTimeSpread->Fill(absId);
1460 }// fill cell-cluster histogram loop
1461
1462 }//check time of cells respect to max energy cell
1463
1464 //-----------------------------------------------------------
1465 //Fill histograms related to single cluster or track matching
1466 //-----------------------------------------------------------
1467
1468 ClusterHistograms(mom, tof, pos, showerShape, nCaloCellsPerCluster, nModule, nTracksMatched, track, labels, nLabel);
1469
1470
1471 //-----------------------------------------------------------
1472 //Invariant mass
1473 //-----------------------------------------------------------
1474 if(GetDebug()>1) printf("Invariant mass \n");
1475
1476 //do not do for bad vertex
5025c139 1477 // Float_t fZvtxCut = 40. ;
1478 if(v[2]<-GetZvertexCut() || v[2]> GetZvertexCut()) continue ; //Event can not be used (vertex, centrality,... cuts not fulfilled)
f8006433 1479
1480 Int_t nModule2 = -1;
1481 Int_t nCaloCellsPerCluster2=0;
1482 if (nCaloClusters > 1 ) {
1483 for(Int_t jclus = iclus + 1 ; jclus < nCaloClusters ; jclus++) {
1484 AliVCluster* clus2 = (AliVCluster*)caloClusters->At(jclus);
1485
1486 //Get cluster kinematics
1487 clus2->GetMomentum(mom2,v);
1488 //Check only certain regions
1489 Bool_t in2 = kTRUE;
1490 if(IsFiducialCutOn()) in2 = GetFiducialCut()->IsInFiducialCut(mom2,fCalorimeter) ;
1491 if(!in2) continue;
1492 //Get module of cluster
1493 nModule2 = GetModuleNumber(clus2);
1494 //Cells per cluster
1495 nCaloCellsPerCluster2 = clus2->GetNCells();
1496 }
1497 //Fill invariant mass histograms
1498 //All modules
1499
1500 //printf("QA : Fill inv mass histo: pt1 %f, pt2 %f, pt12 %f, mass %f, calo %s \n",mom.Pt(),mom2.Pt(),(mom+mom2).Pt(),(mom+mom2).M(), fCalorimeter.Data());
1501 fhIM ->Fill((mom+mom2).Pt(),(mom+mom2).M());
1502 //Single module
1503 if(nModule == nModule2 && nModule >=0 && nModule < fNModules)
1504 fhIMMod[nModule]->Fill((mom+mom2).Pt(),(mom+mom2).M());
1505
1506 //Select only clusters with at least 2 cells
1507 if(nCaloCellsPerCluster > 1 && nCaloCellsPerCluster2 > 1) {
1508 //All modules
1509 fhIMCellCut ->Fill((mom+mom2).Pt(),(mom+mom2).M());
1510 //Single modules
1511 if(nModule == nModule2 && nModule >=0 && nModule < fNModules)
1512 fhIMCellCutMod[nModule]->Fill((mom+mom2).Pt(),(mom+mom2).M());
1513 }
1514
1515 //Asymetry histograms
1516 fhAsym->Fill((mom+mom2).Pt(),TMath::Abs((mom.E()-mom2.E())/(mom.E()+mom2.E())));
1517
1518 }// 2nd cluster loop
1519 }////more than 1 cluster in calorimeter
1520 }//cluster loop
1521
2302a644 1522 //Number of clusters histograms
1523 if(nCaloClustersAccepted > 0) fhNClusters->Fill(nCaloClustersAccepted);
1524 // Number of clusters per module
f8006433 1525 for(Int_t imod = 0; imod < fNModules; imod++ ){
1526 if(GetDebug() > 1)
1527 printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - module %d calo %s clusters %d\n", imod, fCalorimeter.Data(), nClustersInModule[imod]);
1528 fhNClustersMod[imod]->Fill(nClustersInModule[imod]);
1529 }
1530 delete [] nClustersInModule;
1531 //delete caloClusters;
1532 }// calo clusters array exists
c8fe2783 1533
a6f26052 1534 //----------------------------------------------------------
1535 // CALOCELLS
1536 //----------------------------------------------------------
0866d83a 1537
2302a644 1538 Int_t *nCellsInModule = new Int_t[fNModules];
1539 for(Int_t imod = 0; imod < fNModules; imod++ ) nCellsInModule[imod] = 0;
1540 Int_t icol = -1;
1541 Int_t irow = -1;
1542 Int_t iRCU = -1;
1543 Float_t amp = 0.;
1544 Float_t time = 0.;
1545 Int_t id = -1;
1546 Float_t recalF = 1.;
1547
c8fe2783 1548 AliVCaloCells * cell = 0x0;
1549 Int_t ncells = 0;
1550 if(fCalorimeter == "PHOS")
17708df9 1551 cell = GetPHOSCells();
c8fe2783 1552 else
17708df9 1553 cell = GetEMCALCells();
c8fe2783 1554
1555 if(!cell) {
1556 printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - STOP: No %s ESD CELLS available for analysis\n",fCalorimeter.Data());
1557 abort();
1558 }
1559
c8fe2783 1560 if(GetDebug() > 0)
2302a644 1561 printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - In ESD %s cell entries %d\n", fCalorimeter.Data(), cell->GetNumberOfCells());
c8fe2783 1562
2302a644 1563 for (Int_t iCell = 0; iCell < cell->GetNumberOfCells(); iCell++) {
c8fe2783 1564 if(GetDebug() > 2) printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Cell : amp %f, absId %d \n", cell->GetAmplitude(iCell), cell->GetCellNumber(iCell));
1565 nModule = GetModuleNumberCellIndexes(cell->GetCellNumber(iCell),fCalorimeter, icol, irow, iRCU);
1566 if(GetDebug() > 2) printf("\t module %d, column %d, row %d \n", nModule,icol,irow);
1567
1568 if(nModule < fNModules) {
a6f26052 1569 //Check if the cell is a bad channel
c8fe2783 1570 if(GetCaloUtils()->IsBadChannelsRemovalSwitchedOn()){
1571 if(fCalorimeter=="EMCAL"){
1572 if(GetCaloUtils()->GetEMCALChannelStatus(nModule,icol,irow)) continue;
1573 }
1574 else {
1575 if(GetCaloUtils()->GetPHOSChannelStatus(nModule,icol,irow)) {
1576 printf("PHOS bad channel\n");
1577 continue;
1578 }
1579 }
1580 }
1581
a6f26052 1582 //Get Recalibration factor if set
c8fe2783 1583 if (GetCaloUtils()->IsRecalibrationOn()) {
1584 if(fCalorimeter == "PHOS") recalF = GetCaloUtils()->GetPHOSChannelRecalibrationFactor(nModule,icol,irow);
17708df9 1585 else recalF = GetCaloUtils()->GetEMCALChannelRecalibrationFactor(nModule,icol,irow);
2302a644 1586 //if(fCalorimeter == "PHOS")printf("Recalibration factor (sm,row,col)=(%d,%d,%d) - %f\n",nModule,icol,irow,recalF);
c8fe2783 1587 }
1588
1589 amp = cell->GetAmplitude(iCell)*recalF;
1590 time = cell->GetTime(iCell)*1e9;//transform time to ns
2302a644 1591 if(time < fTimeCutMin || time > fTimeCutMax) continue;
c8fe2783 1592
a6f26052 1593 //if(amp > 3 && fCalorimeter=="EMCAL") printf("Amp = %f, time = %f, (mod, col, row)= (%d,%d,%d)\n",
1594 // amp,time,nModule,icol,irow);
c8fe2783 1595
a6f26052 1596 //printf("%s: time %g\n",fCalorimeter.Data(), time);
c8fe2783 1597 id = cell->GetCellNumber(iCell);
1598 fhAmplitude->Fill(amp);
1599 fhAmpId ->Fill(amp,id);
1600 fhTime ->Fill(time);
1601 fhTimeId ->Fill(time,id);
1602 fhTimeAmp ->Fill(amp,time);
a6f26052 1603 //Double_t t0 = GetReader()->GetInputEvent()->GetT0();
1604 //printf("---->>> Time EMCal %e, T0 %e, T0 vertex %e, T0 clock %e, T0 trig %d \n",time,t0,
1605 // GetReader()->GetInputEvent()->GetT0zVertex(),
1606 // GetReader()->GetInputEvent()->GetT0clock(),
1607 // GetReader()->GetInputEvent()->GetT0Trig());
1608 //fhT0Time ->Fill(time-t0);
1609 //fhT0TimeId ->Fill(time-t0,id);
1610 //fhT0TimeAmp ->Fill(amp,time-t0);
c8fe2783 1611
1612 fhAmplitudeMod[nModule]->Fill(amp);
1613 if(fCalorimeter=="EMCAL"){
1614 Int_t ifrac = 0;
1615 if(icol > 15 && icol < 32) ifrac = 1;
1616 else if(icol > 31) ifrac = 2;
1617 fhAmplitudeModFraction[nModule*3+ifrac]->Fill(amp);
c8fe2783 1618 }
1619
1620 fhTimeAmpPerRCU [nModule*fNRCU+iRCU]->Fill(amp, time);
a6f26052 1621 //printf("id %d, nModule %d, iRCU %d: Histo Name %s\n",id, nModule,iRCU, fhTimeAmpPerRCU[nModule*fNRCU+iRCU]->GetName());
1622 //fhT0TimeAmpPerRCU[nModule*fNRCU+iRCU]->Fill(amp, time-t0);
c8fe2783 1623 nCellsInModule[nModule]++;
1624 fhGridCellsMod[nModule] ->Fill(icol,irow);
1625 fhGridCellsEMod[nModule] ->Fill(icol,irow,amp);
1626 if(amp > 0.3){
1627 fhGridCellsTimeMod[nModule]->Fill(icol,irow,time);
1628
a6f26052 1629 // AliESDCaloCells * cell2 = 0x0;
1630 // if(fCalorimeter == "PHOS") cell2 = GetReader()->GetInputEvent()->GetPHOSCells();
1631 // else cell2 = GetReader()->GetInputEvent()->GetEMCALCells();
1632 // Int_t icol2 = -1;
1633 // Int_t irow2 = -1;
1634 // Int_t iRCU2 = -1;
1635 // Float_t amp2 = 0.;
1636 // Float_t time2 = 0.;
1637 // Int_t id2 = -1;
1638 // Int_t nModule2 = -1;
1639 // for (Int_t iCell2 = 0; iCell2 < ncells; iCell2++) {
1640 // amp2 = cell2->GetAmplitude(iCell2);
1641 // if(amp2 < 0.3) continue;
1642 // if(iCell2 == iCell) continue;
1643 // time2 = cell2->GetTime(iCell2)*1e9;//transform time to ns
1644 // //printf("%s: time %g\n",fCalorimeter.Data(), time);
1645 // id2 = cell2->GetCellNumber(iCell2);
1646 // nModule2 = GetModuleNumberCellIndexes(cell2->GetCellNumber(iCell2), fCalorimeter, icol2, irow2, iRCU2);
1647 // Int_t index = (nModule2*fNRCU+iRCU2)+(fNModules*fNRCU)*(iRCU+fNRCU*nModule);
1648 // //printf("id %d, nModule %d, iRCU %d, id2 %d, nModule2 %d, iRCU2 %d, index %d: Histo Name %s\n",id, nModule,iRCU,cell2->GetCellNumber(iCell2),nModule2,iRCU2,index, fhTimeCorrRCU[index]->GetName());
1649 // fhTimeCorrRCU[index]->Fill(time,time2);
1650 //
1651 // }// second cell loop
c8fe2783 1652 }// amplitude cut
1653 }//nmodules
1654
a6f26052 1655 //Get Eta-Phi position of Cell
b8187de4 1656 //if(fFillAllPosHisto)
a6f26052 1657 {
1658 if(fCalorimeter=="EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){
1659 Float_t celleta = 0.;
1660 Float_t cellphi = 0.;
1661 GetEMCALGeometry()->EtaPhiFromIndex(id, celleta, cellphi);
1662 fhEtaPhiAmp->Fill(celleta,cellphi,amp);
1663 Double_t cellpos[] = {0, 0, 0};
1664 GetEMCALGeometry()->GetGlobal(id, cellpos);
1665 fhXCellE->Fill(cellpos[0],amp) ;
1666 fhYCellE->Fill(cellpos[1],amp) ;
1667 fhZCellE->Fill(cellpos[2],amp) ;
1668 Float_t rcell = TMath::Sqrt(cellpos[0]*cellpos[0]+cellpos[1]*cellpos[1]);//+cellpos[2]*cellpos[2]);
1669 fhRCellE->Fill(rcell,amp) ;
1670 fhXYZCell->Fill(cellpos[0],cellpos[1],cellpos[2]) ;
1671 }//EMCAL Cells
1672 else if(fCalorimeter=="PHOS" && GetCaloUtils()->IsPHOSGeoMatrixSet()){
1673 TVector3 xyz;
1674 Int_t relId[4], module;
1675 Float_t xCell, zCell;
1676
1677 GetPHOSGeometry()->AbsToRelNumbering(id,relId);
1678 module = relId[0];
1679 GetPHOSGeometry()->RelPosInModule(relId,xCell,zCell);
1680 GetPHOSGeometry()->Local2Global(module,xCell,zCell,xyz);
1681 Float_t rcell = TMath::Sqrt(xyz.X()*xyz.X()+xyz.Y()*xyz.Y());
1682 fhXCellE ->Fill(xyz.X(),amp) ;
1683 fhYCellE ->Fill(xyz.Y(),amp) ;
1684 fhZCellE ->Fill(xyz.Z(),amp) ;
1685 fhRCellE ->Fill(rcell ,amp) ;
1686 fhXYZCell->Fill(xyz.X(),xyz.Y(),xyz.Z()) ;
1687 }//PHOS cells
1688 }//fill cell position histograms
2302a644 1689 if (fCalorimeter=="EMCAL" && amp > fEMCALCellAmpMin) ncells ++ ;
1690 else if(fCalorimeter=="PHOS" && amp > fPHOSCellAmpMin) ncells ++ ;
fec34043 1691 //else
1692 // printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - no %s CELLS passed the analysis cut\n",fCalorimeter.Data());
c8fe2783 1693 }//cell loop
2302a644 1694 if(ncells > 0 )fhNCells->Fill(ncells) ; //fill the cells after the cut
c8fe2783 1695
a6f26052 1696 //Number of cells per module
63f1dd86 1697 for(Int_t imod = 0; imod < fNModules; imod++ ) {
1698 if(GetDebug() > 1)
1699 printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - module %d calo %s cells %d\n", imod, fCalorimeter.Data(), nCellsInModule[imod]);
1700 fhNCellsMod[imod]->Fill(nCellsInModule[imod]) ;
1701 }
4a745797 1702 delete [] nCellsInModule;
1703
902aa95c 1704 if(GetDebug() > 0)
1705 printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - End \n");
1706}
1707
a0bb4dc0 1708
17708df9 1709//_____________________________________________________________________________________________
1710void AliAnaCalorimeterQA::ClusterHistograms(const TLorentzVector mom, const Double_t tof,
1711 Float_t *pos, Float_t *showerShape,
c8fe2783 1712 const Int_t nCaloCellsPerCluster,const Int_t nModule,
1713 const Int_t nTracksMatched, const AliVTrack * track,
1714 const Int_t * labels, const Int_t nLabels){
a6f26052 1715 //Fill CaloCluster related histograms
9725fd2a 1716
2302a644 1717 AliAODMCParticle * aodprimary = 0x0;
1718 TParticle * primary = 0x0;
c8fe2783 1719 Int_t tag = 0;
2302a644 1720
1721 Float_t e = mom.E();
1722 Float_t pt = mom.Pt();
1723 Float_t eta = mom.Eta();
1724 Float_t phi = mom.Phi();
1725 if(phi < 0) phi +=TMath::TwoPi();
1726 if(GetDebug() > 0) {
1727 printf("AliAnaCalorimeterQA::ClusterHistograms() - cluster: E %2.3f, pT %2.3f, eta %2.3f, phi %2.3f \n",e,pt,eta,phi*TMath::RadToDeg());
1728 if(IsDataMC()) {
a6f26052 1729 //printf("\t Primaries: nlabels %d, labels pointer %p\n",nLabels,labels);
2302a644 1730 printf("\t Primaries: nlabels %d\n",nLabels);
1731 if(!nLabels || !labels) printf("\t Strange, no labels!!!\n");
1732 }
1733 }
c8fe2783 1734
2302a644 1735 fhE ->Fill(e);
1736 if(nModule >=0 && nModule < fNModules) fhEMod[nModule]->Fill(e);
a6f26052 1737 if(fFillAllTH12){
1738 fhPt ->Fill(pt);
1739 fhPhi ->Fill(phi);
1740 fhEta ->Fill(eta);
1741 }
2302a644 1742 fhEtaPhiE->Fill(eta,phi,e);
a6f26052 1743
1744 //Cells per cluster
2302a644 1745 fhNCellsPerCluster ->Fill(e, nCaloCellsPerCluster,eta);
1746 fhNCellsPerClusterMIP->Fill(e, nCaloCellsPerCluster,eta);
a6f26052 1747
1748 //Position
b8187de4 1749 //if(fFillAllPosHisto)
1750 {
a6f26052 1751 fhXE ->Fill(pos[0],e);
1752 fhYE ->Fill(pos[1],e);
1753 fhZE ->Fill(pos[2],e);
1754 fhXYZ ->Fill(pos[0], pos[1],pos[2]);
5025c139 1755
a6f26052 1756 fhXNCells->Fill(pos[0],nCaloCellsPerCluster);
1757 fhYNCells->Fill(pos[1],nCaloCellsPerCluster);
1758 fhZNCells->Fill(pos[2],nCaloCellsPerCluster);
1759 Float_t rxyz = TMath::Sqrt(pos[0]*pos[0]+pos[1]*pos[1]);//+pos[2]*pos[2]);
1760 fhRE ->Fill(rxyz,e);
1761 fhRNCells->Fill(rxyz ,nCaloCellsPerCluster);
1762 }
b8187de4 1763
2302a644 1764 fhClusterTimeEnergy->Fill(e,tof);
0866d83a 1765
a6f26052 1766 //Shower shape parameters
2302a644 1767 fhLambda->Fill(showerShape[0], showerShape[1], e);
1768 fhDispersion->Fill(showerShape[2],e);
1769
1770 if(nModule >=0 && nModule < fNModules) fhNCellsPerClusterMod[nModule]->Fill(e, nCaloCellsPerCluster);
c8fe2783 1771
a6f26052 1772 //Fill histograms only possible when simulation
2302a644 1773 if(IsDataMC() && nLabels > 0 && labels){
c8fe2783 1774
a6f26052 1775 //Play with the MC stack if available
2302a644 1776 Int_t label = labels[0];
c8fe2783 1777
2302a644 1778 if(label < 0) {
1779 if(GetDebug() >= 0) printf("AliAnaCalorimeterQA::ClusterHistograms() *** bad label ***: label %d \n", label);
1780 return;
1781 }
1782
1783 Int_t pdg =-1; Int_t pdg0 =-1;Int_t status = -1; Int_t iMother = -1; Int_t iParent = -1;
1784 Float_t vxMC= 0; Float_t vyMC = 0;
1785 Float_t eMC = 0; Float_t ptMC= 0; Float_t phiMC =0; Float_t etaMC = 0;
1786 Int_t charge = 0;
c8fe2783 1787
a6f26052 1788 //Check the origin.
2302a644 1789 tag = GetMCAnalysisUtils()->CheckOrigin(labels,nLabels, GetReader(),0);
c8fe2783 1790
2302a644 1791 if(GetReader()->ReadStack() && !GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCUnknown)){ //it MC stack and known tag
c8fe2783 1792
2302a644 1793 if( label >= GetMCStack()->GetNtrack()) {
5025c139 1794 if(GetDebug() >= 0) printf("AliAnaCalorimeterQA::ClusterHistograms() *** large label ***: label %d, n tracks %d \n", label, GetMCStack()->GetNtrack());
1795 return ;
2302a644 1796 }
1797
1798 primary = GetMCStack()->Particle(label);
1799 iMother = label;
1800 pdg0 = TMath::Abs(primary->GetPdgCode());
1801 pdg = pdg0;
1802 status = primary->GetStatusCode();
1803 vxMC = primary->Vx();
1804 vyMC = primary->Vy();
1805 iParent = primary->GetFirstMother();
c8fe2783 1806
2302a644 1807 if(GetDebug() > 1 ) {
5025c139 1808 printf("AliAnaCalorimeterQA::ClusterHistograms() - Cluster most contributing mother: \n");
1809 printf("\t Mother label %d, pdg %d, %s, status %d, parent %d \n",iMother, pdg0, primary->GetName(),status, iParent);
2302a644 1810 }
c8fe2783 1811
a6f26052 1812 //Get final particle, no conversion products
2302a644 1813 if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCConversion)){
a6f26052 1814 //Get the parent
5025c139 1815 primary = GetMCStack()->Particle(iParent);
1816 pdg = TMath::Abs(primary->GetPdgCode());
1817 if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted cluster!. Find before conversion: \n");
1818 while((pdg == 22 || pdg == 11) && status != 1){
1819 iMother = iParent;
1820 primary = GetMCStack()->Particle(iMother);
1821 status = primary->GetStatusCode();
1822 iParent = primary->GetFirstMother();
1823 pdg = TMath::Abs(primary->GetPdgCode());
1824 if(GetDebug() > 1 )printf("\t pdg %d, index %d, %s, status %d \n",pdg, iMother, primary->GetName(),status);
1825 }
c8fe2783 1826
5025c139 1827 if(GetDebug() > 1 ) {
1828 printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted Cluster mother before conversion: \n");
1829 printf("\t Mother label %d, pdg %d, %s, status %d, parent %d \n",iMother, pdg, primary->GetName(), status, iParent);
1830 }
c8fe2783 1831
2302a644 1832 }
c8fe2783 1833
a6f26052 1834 //Overlapped pi0 (or eta, there will be very few), get the meson
2302a644 1835 if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0) ||
c8fe2783 1836 GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta)){
5025c139 1837 if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped Meson decay!, Find it: \n");
1838 while(pdg != 111 && pdg != 221){
1839 iMother = iParent;
1840 primary = GetMCStack()->Particle(iMother);
1841 status = primary->GetStatusCode();
1842 iParent = primary->GetFirstMother();
1843 pdg = TMath::Abs(primary->GetPdgCode());
1844 if(GetDebug() > 1 ) printf("\t pdg %d, %s, index %d\n",pdg, primary->GetName(),iMother);
1845 if(iMother==-1) {
1846 printf("AliAnaCalorimeterQA::ClusterHistograms() - Tagged as Overlapped photon but meson not found, why?\n");
a6f26052 1847 //break;
5025c139 1848 }
1849 }
c8fe2783 1850
5025c139 1851 if(GetDebug() > 2 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped %s decay, label %d \n",
a6f26052 1852 primary->GetName(),iMother);
2302a644 1853 }
c8fe2783 1854
2302a644 1855 eMC = primary->Energy();
1856 ptMC = primary->Pt();
1857 phiMC = primary->Phi();
1858 etaMC = primary->Eta();
1859 pdg = TMath::Abs(primary->GetPdgCode());
1860 charge = (Int_t) TDatabasePDG::Instance()->GetParticle(pdg)->Charge();
c8fe2783 1861
2302a644 1862 }
1863 else if(GetReader()->ReadAODMCParticles() && !GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCUnknown)){//it MC AOD and known tag
a6f26052 1864 //Get the list of MC particles
2302a644 1865 if(!GetReader()->GetAODMCParticles(0)) {
5025c139 1866 printf("AliAnaCalorimeterQA::ClusterHistograms() - MCParticles not available!\n");
1867 abort();
2302a644 1868 }
c8fe2783 1869
2302a644 1870 aodprimary = (AliAODMCParticle*) (GetReader()->GetAODMCParticles(0))->At(label);
1871 iMother = label;
1872 pdg0 = TMath::Abs(aodprimary->GetPdgCode());
1873 pdg = pdg0;
1874 status = aodprimary->IsPrimary();
1875 vxMC = aodprimary->Xv();
1876 vyMC = aodprimary->Yv();
1877 iParent = aodprimary->GetMother();
1878
1879 if(GetDebug() > 1 ) {
5025c139 1880 printf("AliAnaCalorimeterQA::ClusterHistograms() - Cluster most contributing mother: \n");
1881 printf("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d, parent %d \n",
a6f26052 1882 iMother, pdg0, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary(), iParent);
2302a644 1883 }
1884
a6f26052 1885 //Get final particle, no conversion products
2302a644 1886 if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCConversion)){
5025c139 1887 if(GetDebug() > 1 )
1888 printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted cluster!. Find before conversion: \n");
a6f26052 1889 //Get the parent
5025c139 1890 aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles(0))->At(iParent);
1891 pdg = TMath::Abs(aodprimary->GetPdgCode());
1892 while ((pdg == 22 || pdg == 11) && !aodprimary->IsPhysicalPrimary()) {
1893 iMother = iParent;
1894 aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles(0))->At(iMother);
1895 status = aodprimary->IsPrimary();
1896 iParent = aodprimary->GetMother();
1897 pdg = TMath::Abs(aodprimary->GetPdgCode());
1898 if(GetDebug() > 1 )
1899 printf("\t pdg %d, index %d, Primary? %d, Physical Primary? %d \n",
a6f26052 1900 pdg, iMother, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary());
5025c139 1901 }
1902
1903 if(GetDebug() > 1 ) {
1904 printf("AliAnaCalorimeterQA::ClusterHistograms() - Converted Cluster mother before conversion: \n");
1905 printf("\t Mother label %d, pdg %d, parent %d, Primary? %d, Physical Primary? %d \n",
a6f26052 1906 iMother, pdg, iParent, aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary());
5025c139 1907 }
1908
2302a644 1909 }
c8fe2783 1910
a6f26052 1911 //Overlapped pi0 (or eta, there will be very few), get the meson
2302a644 1912 if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0) ||
c8fe2783 1913 GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta)){
5025c139 1914 if(GetDebug() > 1 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped Meson decay!, Find it: PDG %d, mom %d \n",pdg, iMother);
1915 while(pdg != 111 && pdg != 221){
c8fe2783 1916
5025c139 1917 iMother = iParent;
1918 aodprimary = (AliAODMCParticle*)(GetReader()->GetAODMCParticles(0))->At(iMother);
1919 status = aodprimary->IsPrimary();
1920 iParent = aodprimary->GetMother();
1921 pdg = TMath::Abs(aodprimary->GetPdgCode());
1922
1923 if(GetDebug() > 1 ) printf("\t pdg %d, index %d\n",pdg, iMother);
1924
1925 if(iMother==-1) {
1926 printf("AliAnaCalorimeterQA::ClusterHistograms() - Tagged as Overlapped photon but meson not found, why?\n");
a6f26052 1927 //break;
5025c139 1928 }
1929 }
1930
1931 if(GetDebug() > 2 ) printf("AliAnaCalorimeterQA::ClusterHistograms() - Overlapped %s decay, label %d \n",
a6f26052 1932 aodprimary->GetName(),iMother);
2302a644 1933 }
c8fe2783 1934
2302a644 1935 status = aodprimary->IsPrimary();
1936 eMC = aodprimary->E();
1937 ptMC = aodprimary->Pt();
1938 phiMC = aodprimary->Phi();
1939 etaMC = aodprimary->Eta();
1940 pdg = TMath::Abs(aodprimary->GetPdgCode());
1941 charge = aodprimary->Charge();
c8fe2783 1942
2302a644 1943 }
c8fe2783 1944
a6f26052 1945 //Float_t vz = primary->Vz();
2302a644 1946 Float_t rVMC = TMath::Sqrt(vxMC*vxMC + vyMC*vyMC);
1947 if((pdg == 22 || TMath::Abs(pdg)==11) && status!=1) {
1948 fhEMVxyz ->Fill(vxMC,vyMC);//,vz);
1949 fhEMR ->Fill(e,rVMC);
1950 }
c8fe2783 1951
a6f26052 1952 //printf("reco e %f, pt %f, phi %f, eta %f \n", e, pt, phi, eta);
1953 //printf("prim e %f, pt %f, phi %f, eta %f \n", eMC,ptMC,phiMC ,etaMC );
1954 //printf("vertex: vx %f, vy %f, vz %f, r %f \n", vxMC, vyMC, vz, r);
c8fe2783 1955
1956
2302a644 1957 fh2E ->Fill(e, eMC);
1958 fh2Pt ->Fill(pt, ptMC);
1959 fh2Phi ->Fill(phi, phiMC);
1960 fh2Eta ->Fill(eta, etaMC);
1961 fhDeltaE ->Fill(eMC-e);
1962 fhDeltaPt ->Fill(ptMC-pt);
1963 fhDeltaPhi->Fill(phiMC-phi);
1964 fhDeltaEta->Fill(etaMC-eta);
1965 if(eMC > 0) fhRatioE ->Fill(e/eMC);
1966 if(ptMC > 0) fhRatioPt ->Fill(pt/ptMC);
1967 if(phiMC > 0) fhRatioPhi->Fill(phi/phiMC);
1968 if(etaMC > 0) fhRatioEta->Fill(eta/etaMC);
c8fe2783 1969
1970
a6f26052 1971 //Overlapped pi0 (or eta, there will be very few)
2302a644 1972 if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0) ||
c8fe2783 1973 GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCEta)){
1974 fhPi0E ->Fill(e,eMC);
1975 fhPi0Pt ->Fill(pt,ptMC);
1976 fhPi0Eta ->Fill(eta,etaMC);
1977 fhPi0Phi ->Fill(phi,phiMC);
1978 if( nTracksMatched > 0){
1979 fhPi0ECharged ->Fill(e,eMC);
1980 fhPi0PtCharged ->Fill(pt,ptMC);
1981 fhPi0PhiCharged ->Fill(phi,phiMC);
1982 fhPi0EtaCharged ->Fill(eta,etaMC);
1983 }
2302a644 1984 }//Overlapped pizero decay
1985 else if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCPhoton)){
c8fe2783 1986 fhGamE ->Fill(e,eMC);
1987 fhGamPt ->Fill(pt,ptMC);
1988 fhGamEta ->Fill(eta,etaMC);
1989 fhGamPhi ->Fill(phi,phiMC);
1990 fhGamDeltaE ->Fill(eMC-e);
1991 fhGamDeltaPt ->Fill(ptMC-pt);
1992 fhGamDeltaPhi->Fill(phiMC-phi);
1993 fhGamDeltaEta->Fill(etaMC-eta);
1994 if(eMC > 0) fhGamRatioE ->Fill(e/eMC);
1995 if(ptMC > 0) fhGamRatioPt ->Fill(pt/ptMC);
1996 if(phiMC > 0) fhGamRatioPhi->Fill(phi/phiMC);
1997 if(etaMC > 0) fhGamRatioEta->Fill(eta/etaMC);
1998 if( nTracksMatched > 0){
1999 fhGamECharged ->Fill(e,eMC);
2000 fhGamPtCharged ->Fill(pt,ptMC);
2001 fhGamPhiCharged ->Fill(phi,phiMC);
2002 fhGamEtaCharged ->Fill(eta,etaMC);
2003 }
2302a644 2004 }//photon
2005 else if(GetMCAnalysisUtils()->CheckTagBit(tag, AliMCAnalysisUtils::kMCElectron)){
2006 fhEleE ->Fill(e,eMC);
2007 fhElePt ->Fill(pt,ptMC);
2008 fhEleEta ->Fill(eta,etaMC);
2009 fhElePhi ->Fill(phi,phiMC);
2010 fhEMVxyz ->Fill(vxMC,vyMC);//,vz);
2011 fhEMR ->Fill(e,rVMC);
2012 if( nTracksMatched > 0){
5025c139 2013 fhEleECharged ->Fill(e,eMC);
2014 fhElePtCharged ->Fill(pt,ptMC);
2015 fhElePhiCharged ->Fill(phi,phiMC);
2016 fhEleEtaCharged ->Fill(eta,etaMC);
2302a644 2017 }
2018 }
2019 else if(charge == 0){
2020 fhNeHadE ->Fill(e,eMC);
2021 fhNeHadPt ->Fill(pt,ptMC);
2022 fhNeHadEta ->Fill(eta,etaMC);
2023 fhNeHadPhi ->Fill(phi,phiMC);
2024 fhHaVxyz ->Fill(vxMC,vyMC);//,vz);
2025 fhHaR ->Fill(e,rVMC);
2026 if( nTracksMatched > 0){
5025c139 2027 fhNeHadECharged ->Fill(e,eMC);
2028 fhNeHadPtCharged ->Fill(pt,ptMC);
2029 fhNeHadPhiCharged ->Fill(phi,phiMC);
2030 fhNeHadEtaCharged ->Fill(eta,etaMC);
2302a644 2031 }
2032 }
2033 else if(charge!=0){
2034 fhChHadE ->Fill(e,eMC);
2035 fhChHadPt ->Fill(pt,ptMC);
2036 fhChHadEta ->Fill(eta,etaMC);
2037 fhChHadPhi ->Fill(phi,phiMC);
2038 fhHaVxyz ->Fill(vxMC,vyMC);//,vz);
2039 fhHaR ->Fill(e,rVMC);
2040 if( nTracksMatched > 0){
5025c139 2041 fhChHadECharged ->Fill(e,eMC);
2042 fhChHadPtCharged ->Fill(pt,ptMC);
2043 fhChHadPhiCharged ->Fill(phi,phiMC);
2044 fhChHadEtaCharged ->Fill(eta,etaMC);
2302a644 2045 }
2046 }
2047 }//Work with MC
c8fe2783 2048
902aa95c 2049
a6f26052 2050 //Match tracks and clusters
2051 //To be Modified in case of AODs
902aa95c 2052
a6f26052 2053 //if(ntracksmatched==1 && trackIndex==-1) ntracksmatched=0;
902aa95c 2054
2302a644 2055 if( nTracksMatched > 0){
a6f26052 2056 if(fFillAllTH12){
2057 fhECharged ->Fill(e);
2058 fhPtCharged ->Fill(pt);
2059 fhPhiCharged ->Fill(phi);
2060 fhEtaCharged ->Fill(eta);
2061 }
2302a644 2062 fhEtaPhiECharged->Fill(eta,phi,e);
2063 fhNCellsPerClusterMIPCharged->Fill(e, nCaloCellsPerCluster,eta);
2064
a6f26052 2065 //printf("track index %d ntracks %d\n", esd->GetNumberOfTracks());
2066 //Study the track and matched cluster if track exists.
2302a644 2067 if(!track) return;
2068 Double_t emcpos[3] = {0.,0.,0.};
2069 Double_t emcmom[3] = {0.,0.,0.};
2070 Double_t radius = 441.0; //[cm] EMCAL radius +13cm
2071 Double_t bfield = 0.;
2072 Double_t tphi = 0;
2073 Double_t teta = 0;
2074 Double_t tmom = 0;
2075 Double_t tpt = 0;
2076 Double_t tmom2 = 0;
2077 Double_t tpcSignal = 0;
2078 Bool_t okpos = kFALSE;
2079 Bool_t okmom = kFALSE;
2080 Bool_t okout = kFALSE;
2081 Int_t nITS = 0;
2082 Int_t nTPC = 0;
2083
a6f26052 2084 //In case of ESDs get the parameters in this way
2085 // if(GetReader()->GetDataType()==AliCaloTrackReader::kESD) {
c8fe2783 2086 if (track->GetOuterParam() ) {
2087 okout = kTRUE;
2088
2089 bfield = GetReader()->GetInputEvent()->GetMagneticField();
2090 okpos = track->GetOuterParam()->GetXYZAt(radius,bfield,emcpos);
2091 okmom = track->GetOuterParam()->GetPxPyPzAt(radius,bfield,emcmom);
2092 if(!(okpos && okmom)) return;
2093
2094 TVector3 position(emcpos[0],emcpos[1],emcpos[2]);
2095 TVector3 momentum(emcmom[0],emcmom[1],emcmom[2]);
2096 tphi = position.Phi();
2097 teta = position.Eta();
2098 tmom = momentum.Mag();
2099
a6f26052 2100 //Double_t tphi = track->GetOuterParam()->Phi();
2101 //Double_t teta = track->GetOuterParam()->Eta();
2102 //Double_t tmom = track->GetOuterParam()->P();
c8fe2783 2103 tpt = track->Pt();
2104 tmom2 = track->P();
2105 tpcSignal = track->GetTPCsignal();
2106
2107 nITS = track->GetNcls(0);
2108 nTPC = track->GetNcls(1);
2109 }//Outer param available
a6f26052 2110 //}// ESDs
2111 // else if(GetReader()->GetDataType()==AliCaloTrackReader::kAOD) {
2112 // AliAODPid* pid = (AliAODPid*) ((AliAODTrack *) track)->GetDetPid();
2113 // if (pid) {
2114 // okout = kTRUE;
2115 // pid->GetEMCALPosition(emcpos);
2116 // pid->GetEMCALMomentum(emcmom);
2117 //
2118 // TVector3 position(emcpos[0],emcpos[1],emcpos[2]);
2119 // TVector3 momentum(emcmom[0],emcmom[1],emcmom[2]);
2120 // tphi = position.Phi();
2121 // teta = position.Eta();
2122 // tmom = momentum.Mag();
2123 //
2124 // tpt = ((AliAODTrack*)track)->Pt();
2125 // tmom2 = ((AliAODTrack*)track)->P();
2126 // tpcSignal = pid->GetTPCsignal();
2127 //
2128 // //nITS = ((AliAODTrack*)track)->GetNcls(0);
2129 // //nTPC = ((AliAODTrack*)track)->GetNcls(1);
2130 // }//Outer param available
2131 // }//AODs
2132 // else return; //Do nothing case not implemented.
c8fe2783 2133
2134 if(okout){
2135 Double_t deta = teta - eta;
2136 Double_t dphi = tphi - phi;
2137 if(dphi > TMath::Pi()) dphi -= 2*TMath::Pi();
2138 if(dphi < -TMath::Pi()) dphi += 2*TMath::Pi();
2139 Double_t dR = sqrt(dphi*dphi + deta*deta);
6fa7d352 2140
c8fe2783 2141 Double_t pOverE = tmom/e;
6fa7d352 2142
c8fe2783 2143 fh1pOverE->Fill(tpt, pOverE);
2144 if(dR < 0.02) fh1pOverER02->Fill(tpt,pOverE);
6fa7d352 2145
c8fe2783 2146 fh1dR->Fill(dR);
2147 fh2MatchdEdx->Fill(tmom2,tpcSignal);
6fa7d352 2148
c8fe2783 2149 if(IsDataMC() && primary){
2150 Int_t pdg = primary->GetPdgCode();
2151 Double_t charge = TDatabasePDG::Instance()->GetParticle(pdg)->Charge();
6fa7d352 2152
c8fe2783 2153 if(TMath::Abs(pdg) == 11){
2154 fhMCEle1pOverE->Fill(tpt,pOverE);
2155 fhMCEle1dR->Fill(dR);
2156 fhMCEle2MatchdEdx->Fill(tmom2,tpcSignal);
2157 if(dR < 0.02) fhMCEle1pOverER02->Fill(tpt,pOverE);
2158 }
2159 else if(charge!=0){
2160 fhMCChHad1pOverE->Fill(tpt,pOverE);
2161 fhMCChHad1dR->Fill(dR);
2162 fhMCChHad2MatchdEdx->Fill(tmom2,tpcSignal);
2163 if(dR < 0.02) fhMCChHad1pOverER02->Fill(tpt,pOverE);
2164 }
2165 else if(charge == 0){
2166 fhMCNeutral1pOverE->Fill(tpt,pOverE);
2167 fhMCNeutral1dR->Fill(dR);
2168 fhMCNeutral2MatchdEdx->Fill(tmom2,tpcSignal);
2169 if(dR < 0.02) fhMCNeutral1pOverER02->Fill(tpt,pOverE);
2170 }
2171 }//DataMC
2172
2173 if(dR < 0.02 && pOverE > 0.5 && pOverE < 1.5
2174 && nCaloCellsPerCluster > 1 && nITS > 3 && nTPC > 20) {
2175 fh2EledEdx->Fill(tmom2,tpcSignal);
2176 }
2177 }
2178 else{//no ESD external param or AODPid
a6f26052 2179 // ULong_t status=AliESDtrack::kTPCrefit;
2180 // status|=AliESDtrack::kITSrefit;
2181 //printf("track status %d\n", track->GetStatus() );
2182 // fhEChargedNoOut ->Fill(e);
2183 // fhPtChargedNoOut ->Fill(pt);
2184 // fhPhiChargedNoOut ->Fill(phi);
2185 // fhEtaChargedNoOut ->Fill(eta);
2186 // fhEtaPhiChargedNoOut ->Fill(eta,phi);
2187 // if(GetDebug() >= 0 && ((track->GetStatus() & status) == status)) printf("ITS+TPC\n");
c8fe2783 2188 if(GetDebug() >= 0) printf("No ESD external param or AliAODPid \n");
2189
2190 }//No out params
2302a644 2191 }//matched clusters with tracks
c8fe2783 2192
902aa95c 2193}// Clusters
c8fe2783 2194
a6f26052 2195//__________________________________
17708df9 2196//void AliAnaCalorimeterQA::CorrelateCalorimeters(TRefArray* refArray){
2197// // Correlate information from PHOS and EMCAL
2198// TRefArray * caloClustersEMCAL = 0;
2199// TRefArray * caloClustersPHOS = 0;
2200//
2201// // Get once the array of clusters per calorimeter, avoid an extra loop.
2202// if(fCalorimeter == "EMCAL"){
2203// caloClustersPHOS = new TRefArray();
2204// GetReader()->GetInputEvent()->GetPHOSClusters(caloClustersPHOS);
2205// caloClustersEMCAL = new TRefArray(*refArray);
2206// }
2207// else if(fCalorimeter == "PHOS") {
2208// caloClustersEMCAL = new TRefArray();
2209// GetReader()->GetInputEvent()->GetEMCALClusters (caloClustersEMCAL);
2210// caloClustersPHOS = new TRefArray(*refArray);
2211// }
2212//
2213// //Fill histograms with clusters
2214//
2215// fhCaloCorrNClusters->Fill(caloClustersEMCAL->GetEntriesFast(),caloClustersPHOS->GetEntriesFast());
2216// Float_t sumClusterEnergyEMCAL = 0;
2217// Float_t sumClusterEnergyPHOS = 0;
2218// Int_t iclus = 0;
2219// for(iclus = 0 ; iclus < caloClustersEMCAL->GetEntriesFast() ; iclus++)
2220// sumClusterEnergyEMCAL += ((AliVCluster*)caloClustersEMCAL->At(iclus))->E();
2221// for(iclus = 0 ; iclus < caloClustersPHOS->GetEntriesFast(); iclus++)
2222// sumClusterEnergyPHOS += ((AliVCluster*)caloClustersPHOS->At(iclus))->E();
2223// fhCaloCorrEClusters->Fill(sumClusterEnergyEMCAL,sumClusterEnergyPHOS);
2224//
2225// //Fill histograms with cells
2226//
2227// AliVCaloCells * cellsEMCAL = GetReader()->GetInputEvent()->GetEMCALCells();
2228// AliVCaloCells * cellsPHOS = GetReader()->GetInputEvent()->GetPHOSCells();
2229// fhCaloCorrNCells ->Fill(cellsEMCAL->GetNumberOfCells(),cellsPHOS->GetNumberOfCells());
2230//
2231// Int_t icell = 0;
2232// Float_t sumCellEnergyEMCAL = 0;
2233// Float_t sumCellEnergyPHOS = 0;
2234// for(icell = 0 ; icell < cellsEMCAL->GetNumberOfCells() ; icell++)
2235// sumCellEnergyEMCAL += cellsEMCAL->GetAmplitude(icell);
2236// for(icell = 0 ; icell < cellsPHOS->GetNumberOfCells(); icell++)
2237// sumCellEnergyPHOS += cellsPHOS->GetAmplitude(icell);
2238// fhCaloCorrECells->Fill(sumCellEnergyEMCAL,sumCellEnergyPHOS);
2239// if(GetDebug() > 0 ){
2240// printf("AliAnaCalorimeterQA::CorrelateCalorimeters() - ESD: \n");
2241// printf("\t EMCAL: N cells %d, N clusters %d, summed E cells %f, summed E clusters %f \n",
2242// cellsEMCAL->GetNumberOfCells(),caloClustersEMCAL->GetEntriesFast(),sumCellEnergyEMCAL,sumClusterEnergyEMCAL);
2243// printf("\t PHOS : N cells %d, N clusters %d, summed E cells %f, summed E clusters %f \n",
2244// cellsPHOS->GetNumberOfCells(),caloClustersPHOS->GetEntriesFast(),sumCellEnergyPHOS,sumClusterEnergyPHOS);
2245// }
2246//
2247// delete caloClustersEMCAL;
2248// delete caloClustersPHOS;
2249//
2250//}
2251
2252//__________________________________
2253void AliAnaCalorimeterQA::CorrelateCalorimeters(){
a6f26052 2254 // Correlate information from PHOS and EMCAL
2302a644 2255 TObjArray * caloClustersEMCAL = GetAODEMCAL();
2256 TObjArray * caloClustersPHOS = GetAODPHOS();
2257
a6f26052 2258 //Fill histograms with clusters
c8fe2783 2259
2260 fhCaloCorrNClusters->Fill(caloClustersEMCAL->GetEntriesFast(),caloClustersPHOS->GetEntriesFast());
2261 Float_t sumClusterEnergyEMCAL = 0;
2262 Float_t sumClusterEnergyPHOS = 0;
2263 Int_t iclus = 0;
2264 for(iclus = 0 ; iclus < caloClustersEMCAL->GetEntriesFast() ; iclus++)
2265 sumClusterEnergyEMCAL += ((AliVCluster*)caloClustersEMCAL->At(iclus))->E();
2266 for(iclus = 0 ; iclus < caloClustersPHOS->GetEntriesFast(); iclus++)
2267 sumClusterEnergyPHOS += ((AliVCluster*)caloClustersPHOS->At(iclus))->E();
2268 fhCaloCorrEClusters->Fill(sumClusterEnergyEMCAL,sumClusterEnergyPHOS);
2269
a6f26052 2270 //Fill histograms with cells
c8fe2783 2271
17708df9 2272 AliVCaloCells * cellsEMCAL = GetEMCALCells();
2273 AliVCaloCells * cellsPHOS = GetPHOSCells();
c8fe2783 2274 fhCaloCorrNCells ->Fill(cellsEMCAL->GetNumberOfCells(),cellsPHOS->GetNumberOfCells());
2275
2276 Int_t icell = 0;
2277 Float_t sumCellEnergyEMCAL = 0;
2278 Float_t sumCellEnergyPHOS = 0;
2279 for(icell = 0 ; icell < cellsEMCAL->GetNumberOfCells() ; icell++)
2280 sumCellEnergyEMCAL += cellsEMCAL->GetAmplitude(icell);
2281 for(icell = 0 ; icell < cellsPHOS->GetNumberOfCells(); icell++)
2282 sumCellEnergyPHOS += cellsPHOS->GetAmplitude(icell);
2283 fhCaloCorrECells->Fill(sumCellEnergyEMCAL,sumCellEnergyPHOS);
2284 if(GetDebug() > 0 ){
2285 printf("AliAnaCalorimeterQA::CorrelateCalorimeters() - ESD: \n");
2286 printf("\t EMCAL: N cells %d, N clusters %d, summed E cells %f, summed E clusters %f \n",
a6f26052 2287 cellsEMCAL->GetNumberOfCells(),caloClustersEMCAL->GetEntriesFast(),sumCellEnergyEMCAL,sumClusterEnergyEMCAL);
c8fe2783 2288 printf("\t PHOS : N cells %d, N clusters %d, summed E cells %f, summed E clusters %f \n",
a6f26052 2289 cellsPHOS->GetNumberOfCells(),caloClustersPHOS->GetEntriesFast(),sumCellEnergyPHOS,sumClusterEnergyPHOS);
c8fe2783 2290 }
a0bb4dc0 2291}
2292
17708df9 2293
a6f26052 2294//______________________________________________________________________________
902aa95c 2295void AliAnaCalorimeterQA::MCHistograms(const TLorentzVector mom, const Int_t pdg){
a6f26052 2296 //Fill pure monte carlo related histograms
4865e325 2297
2302a644 2298 Float_t eMC = mom.E();
2299 Float_t ptMC = mom.Pt();
2300 Float_t phiMC = mom.Phi();
2301 if(phiMC < 0)
2302 phiMC += TMath::TwoPi();
2303 Float_t etaMC = mom.Eta();
2304
2305 if (TMath::Abs(etaMC) > 1) return;
2306
2307 Bool_t in = kTRUE;
2308 if(IsFiducialCutOn()) in = GetFiducialCut()->IsInFiducialCut(mom,fCalorimeter) ;
2309
2310 if (pdg==22) {
2311 fhGenGamPt ->Fill(ptMC);
2312 fhGenGamEta->Fill(etaMC);
2313 fhGenGamPhi->Fill(phiMC);
2314 if(in){
2315 fhGenGamAccE ->Fill(eMC);
2316 fhGenGamAccPt ->Fill(ptMC);
2317 fhGenGamAccEta->Fill(etaMC);
2318 fhGenGamAccPhi->Fill(phiMC);
2319 }
2320 }
2321 else if (pdg==111) {
2322 fhGenPi0Pt ->Fill(ptMC);
2323 fhGenPi0Eta->Fill(etaMC);
2324 fhGenPi0Phi->Fill(phiMC);
2325 if(in){
2326 fhGenPi0AccE ->Fill(eMC);
2327 fhGenPi0AccPt ->Fill(ptMC);
2328 fhGenPi0AccEta->Fill(etaMC);
2329 fhGenPi0AccPhi->Fill(phiMC);
2330 }
2331 }
2332 else if (pdg==221) {
2333 fhGenEtaPt ->Fill(ptMC);
2334 fhGenEtaEta->Fill(etaMC);
2335 fhGenEtaPhi->Fill(phiMC);
2336 }
2337 else if (pdg==223) {
2338 fhGenOmegaPt ->Fill(ptMC);
2339 fhGenOmegaEta->Fill(etaMC);
2340 fhGenOmegaPhi->Fill(phiMC);
2341 }
2342 else if (TMath::Abs(pdg)==11) {
2343 fhGenElePt ->Fill(ptMC);
2344 fhGenEleEta->Fill(etaMC);
2345 fhGenElePhi->Fill(phiMC);
2346 }
c8fe2783 2347
902aa95c 2348}
c8fe2783 2349
a6f26052 2350//________________________________________________________________________
9725fd2a 2351void AliAnaCalorimeterQA::ReadHistograms(TList* outputList)
2352{
a6f26052 2353 // Needed when Terminate is executed in distributed environment
2354 // Refill analysis histograms of this class with corresponding histograms in output list.
9725fd2a 2355
a6f26052 2356 // Histograms of this analsys are kept in the same list as other analysis, recover the position of
2357 // the first one and then add the next
2302a644 2358 Int_t index = outputList->IndexOf(outputList->FindObject(GetAddedHistogramsStringToName()+"hE"));
a6f26052 2359 //printf("Calo: %s, index: %d, nmodules %d\n",fCalorimeter.Data(),index,fNModules);
2302a644 2360
a6f26052 2361 //Read histograms, must be in the same order as in GetCreateOutputObject.
2302a644 2362 fhE = (TH1F *) outputList->At(index++);
a6f26052 2363 if(fFillAllTH12){
2364 fhPt = (TH1F *) outputList->At(index++);
2365 fhPhi = (TH1F *) outputList->At(index++);
2366 fhEta = (TH1F *) outputList->At(index++);
2367 }
2302a644 2368 fhEtaPhiE = (TH3F *) outputList->At(index++);
a6f26052 2369
2302a644 2370 fhClusterTimeEnergy = (TH2F*) outputList->At(index++);
2371
2372 fhLambda = (TH3F *) outputList->At(index++);
2373 fhDispersion = (TH2F *) outputList->At(index++);
a6f26052 2374 if(fFillAllTH12){
2375 fhECharged = (TH1F *) outputList->At(index++);
2376 fhPtCharged = (TH1F *) outputList->At(index++);
2377 fhPhiCharged = (TH1F *) outputList->At(index++);
2378 fhEtaCharged = (TH1F *) outputList->At(index++);
2379 }
2302a644 2380 fhEtaPhiECharged = (TH3F *) outputList->At(index++);
2381
2382 fh1pOverE = (TH2F *) outputList->At(index++);
2383 fh1dR = (TH1F *) outputList->At(index++);
2384 fh2MatchdEdx = (TH2F *) outputList->At(index++);
2385 fh2EledEdx = (TH2F *) outputList->At(index++);
2386 fh1pOverER02 = (TH2F *) outputList->At(index++);
2387
2388 fhIM = (TH2F *) outputList->At(index++);
2389 fhIMCellCut = (TH2F *) outputList->At(index++);
b8187de4 2390 fhAsym = (TH2F *) outputList->At(index++);
2302a644 2391
2392 fhNCellsPerCluster = (TH3F *) outputList->At(index++);
2393 fhNCellsPerClusterMIP = (TH3F *) outputList->At(index++);
2394 fhNCellsPerClusterMIPCharged = (TH3F *) outputList->At(index++);
2395 fhNClusters = (TH1F *) outputList->At(index++);
2396
2397 fhRNCells = (TH2F *) outputList->At(index++);
2398 fhXNCells = (TH2F *) outputList->At(index++);
2399 fhYNCells = (TH2F *) outputList->At(index++);
2400 fhZNCells = (TH2F *) outputList->At(index++);
2401 fhRE = (TH2F *) outputList->At(index++);
2402 fhXE = (TH2F *) outputList->At(index++);
2403 fhYE = (TH2F *) outputList->At(index++);
2404 fhZE = (TH2F *) outputList->At(index++);
2405 fhXYZ = (TH3F *) outputList->At(index++);
b8187de4 2406 if(fFillAllPosHisto){
a6f26052 2407 fhRCellE = (TH2F *) outputList->At(index++);
2408 fhXCellE = (TH2F *) outputList->At(index++);
2409 fhYCellE = (TH2F *) outputList->At(index++);
2410 fhZCellE = (TH2F *) outputList->At(index++);
2411 fhXYZCell = (TH3F *) outputList->At(index++);
2412 fhDeltaCellClusterRNCells = (TH2F *) outputList->At(index++);
2413 fhDeltaCellClusterXNCells = (TH2F *) outputList->At(index++);
2414 fhDeltaCellClusterYNCells = (TH2F *) outputList->At(index++);
2415 fhDeltaCellClusterZNCells = (TH2F *) outputList->At(index++);
2416 fhDeltaCellClusterRE = (TH2F *) outputList->At(index++);
2417 fhDeltaCellClusterXE = (TH2F *) outputList->At(index++);
2418 fhDeltaCellClusterYE = (TH2F *) outputList->At(index++);
2419 fhDeltaCellClusterZE = (TH2F *) outputList->At(index++);
2420 fhEtaPhiAmp = (TH3F *) outputList->At(index++);
2302a644 2421 }
a6f26052 2422
2302a644 2423 fhNCells = (TH1F *) outputList->At(index++);
2424 fhAmplitude = (TH1F *) outputList->At(index++);
2425 fhAmpId = (TH2F *) outputList->At(index++);
c8fe2783 2426
2302a644 2427 if(GetReader()->GetDataType()==AliCaloTrackReader::kESD) {
2428
2429 fhCellTimeSpreadRespectToCellMax = (TH1F *) outputList->At(index++);
2430 fhCellIdCellLargeTimeSpread = (TH1F *) outputList->At(index++);
2431
2432 fhTime = (TH1F *) outputList->At(index++);
2433 fhTimeId = (TH2F *) outputList->At(index++);
2434 fhTimeAmp = (TH2F *) outputList->At(index++);
c8fe2783 2435
a6f26052 2436 // fhT0Time = (TH1F *) outputList->At(index++);
2437 // fhT0TimeId = (TH2F *) outputList->At(index++);
2438 // fhT0TimeAmp = (TH2F *) outputList->At(index++);
2302a644 2439
2440 }
2441
2442
2443 if(fCorrelateCalos){
2444 fhCaloCorrNClusters = (TH2F *) outputList->At(index++);
2445 fhCaloCorrEClusters = (TH2F *) outputList->At(index++);
2446 fhCaloCorrNCells = (TH2F *) outputList->At(index++);
2447 fhCaloCorrECells = (TH2F *) outputList->At(index++);
2448 }
2449
a6f26052 2450 //Module histograms
2302a644 2451 fhEMod = new TH1F*[fNModules];
2452 fhNClustersMod = new TH1F*[fNModules];
2453 fhNCellsPerClusterMod = new TH2F*[fNModules];
2454 fhNCellsMod = new TH1F*[fNModules];
2455 fhGridCellsMod = new TH2F*[fNModules];
2456 fhGridCellsEMod = new TH2F*[fNModules];
2457 if(GetReader()->GetDataType()==AliCaloTrackReader::kESD)
2458 fhGridCellsTimeMod = new TH2F*[fNModules];
2459 fhAmplitudeMod = new TH1F*[fNModules];
2460 if(fCalorimeter=="EMCAL")
2461 fhAmplitudeModFraction = new TH1F*[fNModules*3];
2462
a6f26052 2463 //EMCAL
2302a644 2464 fhTimeAmpPerRCU = new TH2F*[fNModules*fNRCU];
2465
2466 fhIMMod = new TH2F*[fNModules];
2467 fhIMCellCutMod = new TH2F*[fNModules];
2468
2469 for(Int_t imod = 0 ; imod < fNModules; imod++){
2470 fhEMod[imod] = (TH1F *) outputList->At(index++);
2471 fhNClustersMod[imod] = (TH1F *) outputList->At(index++);
2472 fhNCellsPerClusterMod[imod] = (TH2F *) outputList->At(index++);
2473 fhNCellsMod[imod] = (TH1F *) outputList->At(index++);
2474 fhGridCellsMod[imod] = (TH2F *) outputList->At(index++);
2475 fhGridCellsEMod[imod] = (TH2F *) outputList->At(index++);
2476 if(GetReader()->GetDataType()==AliCaloTrackReader::kESD)
2477 fhGridCellsTimeMod[imod] = (TH2F *) outputList->At(index++);
2478 fhAmplitudeMod[imod] = (TH1F *) outputList->At(index++);
2479
2480 if(fCalorimeter=="EMCAL"){
2481 for(Int_t ifrac = 0; ifrac < 3; ifrac++){
2482 fhAmplitudeModFraction[imod*3+ifrac] = (TH1F *) outputList->At(index++);
2483 }
2484 }
2485
2486 for(Int_t ircu = 0; ircu < fNRCU; ircu++){
2487 fhTimeAmpPerRCU[imod*fNRCU+ircu] = (TH2F *) outputList->At(index++);
a6f26052 2488 //fhT0TimeAmpPerRCU[imod*fNRCU+ircu] = (TH2F *) outputList->At(index++);
2489 // for(Int_t imod2 = 0; imod2 < fNModules; imod2++){
2490 // for(Int_t ircu2 = 0; ircu2 < fNModules; ircu2++){
2491 // fhTimeCorrRCU[imod*fNRCU+ircu+imod2*fNRCU+ircu2] = (TH2F *) outputList->At(index++);
2492 // }
2493 // }
2302a644 2494 }
2495 fhIMMod[imod] = (TH2F *) outputList->At(index++);
2496 fhIMCellCutMod[imod] = (TH2F *) outputList->At(index++);
c8fe2783 2497
2302a644 2498 }
2499
2500 if(IsDataMC()){
2501 fhDeltaE = (TH1F *) outputList->At(index++);
2502 fhDeltaPt = (TH1F *) outputList->At(index++);
2503 fhDeltaPhi = (TH1F *) outputList->At(index++);
2504 fhDeltaEta = (TH1F *) outputList->At(index++);
2505
2506 fhRatioE = (TH1F *) outputList->At(index++);
2507 fhRatioPt = (TH1F *) outputList->At(index++);
2508 fhRatioPhi = (TH1F *) outputList->At(index++);
2509 fhRatioEta = (TH1F *) outputList->At(index++);
2510
2511 fh2E = (TH2F *) outputList->At(index++);
2512 fh2Pt = (TH2F *) outputList->At(index++);
2513 fh2Phi = (TH2F *) outputList->At(index++);
2514 fh2Eta = (TH2F *) outputList->At(index++);
2515
2516 fhGamE = (TH2F *) outputList->At(index++);
2517 fhGamPt = (TH2F *) outputList->At(index++);
2518 fhGamPhi = (TH2F *) outputList->At(index++);
2519 fhGamEta = (TH2F *) outputList->At(index++);
2520
2521 fhGamDeltaE = (TH1F *) outputList->At(index++);
2522 fhGamDeltaPt = (TH1F *) outputList->At(index++);
2523 fhGamDeltaPhi = (TH1F *) outputList->At(index++);
2524 fhGamDeltaEta = (TH1F *) outputList->At(index++);
2525
2526 fhGamRatioE = (TH1F *) outputList->At(index++);
2527 fhGamRatioPt = (TH1F *) outputList->At(index++);
2528 fhGamRatioPhi = (TH1F *) outputList->At(index++);
2529 fhGamRatioEta = (TH1F *) outputList->At(index++);
2530
2531 fhPi0E = (TH2F *) outputList->At(index++);
2532 fhPi0Pt = (TH2F *) outputList->At(index++);
2533 fhPi0Phi = (TH2F *) outputList->At(index++);
2534 fhPi0Eta = (TH2F *) outputList->At(index++);
2535
2536 fhEleE = (TH2F *) outputList->At(index++);
2537 fhElePt = (TH2F *) outputList->At(index++);
2538 fhElePhi = (TH2F *) outputList->At(index++);
2539 fhEleEta = (TH2F *) outputList->At(index++);
2540
2541 fhNeHadE = (TH2F *) outputList->At(index++);
2542 fhNeHadPt = (TH2F *) outputList->At(index++);
2543 fhNeHadPhi = (TH2F *) outputList->At(index++);
2544 fhNeHadEta = (TH2F *) outputList->At(index++);
2545
2546 fhChHadE = (TH2F *) outputList->At(index++);
2547 fhChHadPt = (TH2F *) outputList->At(index++);
2548 fhChHadPhi = (TH2F *) outputList->At(index++);
2549 fhChHadEta = (TH2F *) outputList->At(index++);
2550
2551 fhGamECharged = (TH2F *) outputList->At(index++);
2552 fhGamPtCharged = (TH2F *) outputList->At(index++);
2553 fhGamPhiCharged = (TH2F *) outputList->At(index++);
2554 fhGamEtaCharged = (TH2F *) outputList->At(index++);
2555
2556 fhPi0ECharged = (TH2F *) outputList->At(index++);
2557 fhPi0PtCharged = (TH2F *) outputList->At(index++);
2558 fhPi0PhiCharged = (TH2F *) outputList->At(index++);
2559 fhPi0EtaCharged = (TH2F *) outputList->At(index++);
2560
2561 fhEleECharged = (TH2F *) outputList->At(index++);
2562 fhElePtCharged = (TH2F *) outputList->At(index++);
2563 fhElePhiCharged = (TH2F *) outputList->At(index++);
2564 fhEleEtaCharged = (TH2F *) outputList->At(index++);
2565
2566 fhNeHadECharged = (TH2F *) outputList->At(index++);
2567 fhNeHadPtCharged = (TH2F *) outputList->At(index++);
2568 fhNeHadPhiCharged = (TH2F *) outputList->At(index++);
2569 fhNeHadEtaCharged = (TH2F *) outputList->At(index++);
2570
2571 fhChHadECharged = (TH2F *) outputList->At(index++);
2572 fhChHadPtCharged = (TH2F *) outputList->At(index++);
2573 fhChHadPhiCharged = (TH2F *) outputList->At(index++);
2574 fhChHadEtaCharged = (TH2F *) outputList->At(index++);
06e5656a 2575
a6f26052 2576 // fhEMVxyz = (TH3F *) outputList->At(index++);
2577 // fhHaVxyz = (TH3F *) outputList->At(index++);
9725fd2a 2578
2302a644 2579 fhEMVxyz = (TH2F *) outputList->At(index++);
2580 fhHaVxyz = (TH2F *) outputList->At(index++);
2581 fhEMR = (TH2F *) outputList->At(index++);
2582 fhHaR = (TH2F *) outputList->At(index++);
2583
2584 fhGenGamPt = (TH1F *) outputList->At(index++);
2585 fhGenGamEta = (TH1F *) outputList->At(index++);
2586 fhGenGamPhi = (TH1F *) outputList->At(index++);
2587
2588 fhGenPi0Pt = (TH1F *) outputList->At(index++);
2589 fhGenPi0Eta = (TH1F *) outputList->At(index++);
2590 fhGenPi0Phi = (TH1F *) outputList->At(index++);
2591
2592 fhGenEtaPt = (TH1F *) outputList->At(index++);
2593 fhGenEtaEta = (TH1F *) outputList->At(index++);
2594 fhGenEtaPhi = (TH1F *) outputList->At(index++);
2595
2596 fhGenOmegaPt = (TH1F *) outputList->At(index++);
2597 fhGenOmegaEta = (TH1F *) outputList->At(index++);
2598 fhGenOmegaPhi = (TH1F *) outputList->At(index++);
2599
2600 fhGenElePt = (TH1F *) outputList->At(index++);
2601 fhGenEleEta = (TH1F *) outputList->At(index++);
2602 fhGenElePhi = (TH1F *) outputList->At(index++);
2603
2604 fhGenGamAccE = (TH1F *) outputList->At(index++);
2605 fhGenGamAccPt = (TH1F *) outputList->At(index++);
2606 fhGenGamAccEta = (TH1F *) outputList->At(index++);
2607 fhGenGamAccPhi = (TH1F *) outputList->At(index++);
2608
2609 fhGenPi0AccE = (TH1F *) outputList->At(index++);
2610 fhGenPi0AccPt = (TH1F *) outputList->At(index++);
2611 fhGenPi0AccEta = (TH1F *) outputList->At(index++);
2612 fhGenPi0AccPhi = (TH1F *) outputList->At(index++);
2613
2614 fhMCEle1pOverE = (TH2F *) outputList->At(index++);
2615 fhMCEle1dR = (TH1F *) outputList->At(index++);
2616 fhMCEle2MatchdEdx = (TH2F *) outputList->At(index++);
2617
2618 fhMCChHad1pOverE = (TH2F *) outputList->At(index++);
2619 fhMCChHad1dR = (TH1F *) outputList->At(index++);
2620 fhMCChHad2MatchdEdx = (TH2F *) outputList->At(index++);
2621
2622 fhMCNeutral1pOverE = (TH2F *) outputList->At(index++);
2623 fhMCNeutral1dR = (TH1F *) outputList->At(index++);
2624 fhMCNeutral2MatchdEdx = (TH2F *) outputList->At(index++);
2625
2626 fhMCEle1pOverER02 = (TH2F *) outputList->At(index++);
2627 fhMCChHad1pOverER02 = (TH2F *) outputList->At(index++);
2628 fhMCNeutral1pOverER02 = (TH2F *) outputList->At(index++);
2629 }
9725fd2a 2630}
2631
a6f26052 2632//__________________________________________________________________
9725fd2a 2633void AliAnaCalorimeterQA::Terminate(TList* outputList)
2634{
a6f26052 2635 //Do plots if requested
c8fe2783 2636
5a2dbc3c 2637 if(GetDebug() > 0) printf("AliAnaCalorimeterQA::Terminate() - Make plots for %s? %d\n",fCalorimeter.Data(), fMakePlots);
21d9bc2a 2638 if(!fMakePlots) return;
9725fd2a 2639
a6f26052 2640 //Do some plots to end
c8fe2783 2641 if(fStyleMacro!="")gROOT->Macro(fStyleMacro);
a6f26052 2642 //Recover histograms from output histograms list, needed for distributed analysis.
9725fd2a 2643 ReadHistograms(outputList);
2644
a6f26052 2645 //printf(" AliAnaCalorimeterQA::Terminate() *** %s Report:", GetName()) ;
2646 //printf(" AliAnaCalorimeterQA::Terminate() pt : %5.3f , RMS : %5.3f \n", fhPt->GetMean(), fhPt->GetRMS() ) ;
c8fe2783 2647
164a1d84 2648 const Int_t buffersize = 255;
2649 char name[buffersize];
2650 char cname[buffersize];
255b904d 2651
a6f26052 2652 //In case terminate is executed after the analysis, in a second step, and we want to rebin or to change the range of the histograms for plotting
255b904d 2653 Int_t nptbins = GetHistoPtBins(); Float_t ptmax = GetHistoPtMax(); Float_t ptmin = GetHistoPtMin();
3a75604b 2654 Int_t nphibins = GetHistoPhiBins(); Float_t phimax = GetHistoPhiMax(); Float_t phimin = GetHistoPhiMin();
255b904d 2655 Int_t netabins = GetHistoEtaBins(); Float_t etamax = GetHistoEtaMax(); Float_t etamin = GetHistoEtaMin();
a6f26052 2656 // Int_t nmassbins = GetHistoMassBins(); Float_t massmax = GetHistoMassMax(); Float_t massmin = GetHistoMassMin();
2657 // Int_t nasymbins = GetHistoAsymmetryBins(); Float_t asymmax = GetHistoAsymmetryMax(); Float_t asymmin = GetHistoAsymmetryMin();
2658 // Int_t nPoverEbins = GetHistoPOverEBins(); Float_t pOverEmax = GetHistoPOverEMax(); Float_t pOverEmin = GetHistoPOverEMin();
2659 // Int_t ndedxbins = GetHistodEdxBins(); Float_t dedxmax = GetHistodEdxMax(); Float_t dedxmin = GetHistodEdxMin();
2660 // Int_t ndRbins = GetHistodRBins(); Float_t dRmax = GetHistodRMax(); Float_t dRmin = GetHistodRMin();
255b904d 2661 Int_t ntimebins = GetHistoTimeBins(); Float_t timemax = GetHistoTimeMax(); Float_t timemin = GetHistoTimeMin();
2662 Int_t nbins = GetHistoNClusterCellBins(); Int_t nmax = GetHistoNClusterCellMax(); Int_t nmin = GetHistoNClusterCellMin();
a6f26052 2663 // Int_t nratiobins = GetHistoRatioBins(); Float_t ratiomax = GetHistoRatioMax(); Float_t ratiomin = GetHistoRatioMin();
2664 // Int_t nvdistbins = GetHistoVertexDistBins(); Float_t vdistmax = GetHistoVertexDistMax(); Float_t vdistmin = GetHistoVertexDistMin();
5a35dd37 2665 Int_t rbins = GetHistoRBins(); Float_t rmax = GetHistoRMax(); Float_t rmin = GetHistoRMin();
2666 Int_t xbins = GetHistoXBins(); Float_t xmax = GetHistoXMax(); Float_t xmin = GetHistoXMin();
2667 Int_t ybins = GetHistoYBins(); Float_t ymax = GetHistoYMax(); Float_t ymin = GetHistoYMin();
2668 Int_t zbins = GetHistoZBins(); Float_t zmax = GetHistoZMax(); Float_t zmin = GetHistoZMin();
255b904d 2669
a6f26052 2670 //Color code for the different modules
255b904d 2671 Int_t modColorIndex[]={2,4,6,8};
2672
a6f26052 2673 //--------------------------------------------------
2674 // Cluster energy distributions, module dependence
2675 //--------------------------------------------------
164a1d84 2676 snprintf(cname,buffersize,"QA_%s_ClusterEnergy",fCalorimeter.Data());
255b904d 2677 TCanvas * c = new TCanvas(cname, "Energy distributions", 800, 400) ;
2678 c->Divide(2, 1);
3a75604b 2679 Int_t rbE = GetNewRebinForRePlotting((TH1D*)fhE, ptmin, ptmax,nptbins) ;
a6f26052 2680 //printf("new E rb %d\n",rbE);
255b904d 2681 fhE->Rebin(rbE);
2682 fhE->SetAxisRange(ptmin,ptmax,"X");
2683 c->cd(1) ;
2684 if(fhE->GetEntries() > 0) gPad->SetLogy();
2685 TLegend pLegendE(0.7,0.6,0.9,0.8);
2686 pLegendE.SetTextSize(0.03);
2687 pLegendE.AddEntry(fhE,"all modules","L");
2688 pLegendE.SetFillColor(10);
2689 pLegendE.SetBorderSize(1);
2690
2691 fhE->SetMinimum(1);
2692 fhE->SetLineColor(1);
2693 fhE->Draw("HE");
2694 for(Int_t imod = 0; imod < fNModules; imod++){
2695 fhEMod[imod]->Rebin(rbE);
2696 fhEMod[imod]->SetLineColor(modColorIndex[imod]);
2697 fhEMod[imod]->Draw("HE same");
2698 pLegendE.AddEntry(fhEMod[imod],Form("module %d",imod),"L");
2699 }
2700 pLegendE.Draw();
2701
a6f26052 2702 //Ratio of modules
255b904d 2703 c->cd(2) ;
2704 TLegend pLegendER(0.55,0.8,0.9,0.9);
2705 pLegendER.SetTextSize(0.03);
2706 pLegendER.SetFillColor(10);
2707 pLegendER.SetBorderSize(1);
c8fe2783 2708
255b904d 2709 for(Int_t imod = 1; imod < fNModules; imod++){
2710 TH1D * htmp = (TH1D*)fhEMod[imod]->Clone(Form("hERat%d",imod));
2711 htmp->Divide(fhEMod[0]);
2712 htmp->SetLineColor(modColorIndex[imod]);
2713 if(imod==1){
2714 htmp->SetTitle("Ratio module X / module 0");
2715 htmp->SetAxisRange(ptmin,ptmax,"X");
2716 htmp->SetMaximum(5);
2717 htmp->SetMinimum(0);
2718 htmp->SetAxisRange(ptmin,ptmax,"X");
2719 htmp->Draw("HE");
2720 }
2721 else
2722 htmp->Draw("same HE");
2723
2724 pLegendER.AddEntry(fhEMod[imod],Form("module %d / module 0",imod),"L");
2725 }
2726 pLegendER.Draw();
2727
164a1d84 2728 snprintf(name,buffersize,"QA_%s_ClusterEnergy.eps",fCalorimeter.Data());
255b904d 2729 c->Print(name); printf("Plot: %s\n",name);
2730
a6f26052 2731 //--------------------------------------------------
2732 // Cell energy distributions, module dependence
2733 //--------------------------------------------------
164a1d84 2734 snprintf(cname,buffersize,"%s_QA_CellEnergy",fCalorimeter.Data());
255b904d 2735 TCanvas * ca = new TCanvas(cname, "Cell Energy distributions", 800, 400) ;
2736 ca->Divide(2, 1);
2737
3a75604b 2738 Int_t rbAmp = GetNewRebinForRePlotting((TH1D*)fhAmplitude, ptmin, ptmax,nptbins*2) ;
a6f26052 2739 //printf("new Amp rb %d\n",rbAmp);
255b904d 2740 fhAmplitude->Rebin(rbAmp);
2741 fhAmplitude->SetAxisRange(ptmin,ptmax,"X");
2742
2743 ca->cd(1) ;
2744 if(fhAmplitude->GetEntries() > 0) gPad->SetLogy();
2745 TLegend pLegendA(0.7,0.6,0.9,0.8);
2746 pLegendA.SetTextSize(0.03);
2747 pLegendA.AddEntry(fhE,"all modules","L");
2748 pLegendA.SetFillColor(10);
2749 pLegendA.SetBorderSize(1);
2750 fhAmplitude->SetMinimum(0.1);
2751 fhAmplitude->SetLineColor(1);
2752 fhAmplitude->Draw("HE");
2753
2754 for(Int_t imod = 0; imod < fNModules; imod++){
2755 fhAmplitudeMod[imod]->Rebin(rbAmp);
2756 fhAmplitudeMod[imod]->SetLineColor(modColorIndex[imod]);
2757 fhAmplitudeMod[imod]->Draw("HE same");
2758 pLegendA.AddEntry(fhAmplitudeMod[imod],Form("module %d",imod),"L");
2759 }
2760 pLegendA.Draw();
2761
2762
2763 ca->cd(2) ;
2764 TLegend pLegendAR(0.55,0.8,0.9,0.9);
2765 pLegendAR.SetTextSize(0.03);
2766 pLegendAR.SetFillColor(10);
2767 pLegendAR.SetBorderSize(1);
2768
2769 for(Int_t imod = 1; imod < fNModules; imod++){
2770 TH1D * htmp = (TH1D*)fhAmplitudeMod[imod]->Clone(Form("hAmpRat%d",imod));
2771 htmp->Divide(fhAmplitudeMod[0]);
2772 htmp->SetLineColor(modColorIndex[imod]);
2773 if(imod==1){
2774 htmp->SetTitle("Ratio cells energy in module X / module 0");
2775 htmp->SetAxisRange(ptmin,ptmax,"X");
2776 htmp->SetMaximum(5);
2777 htmp->SetMinimum(0);
2778 htmp->Draw("HE");
2779 }
2780 else
2781 htmp->Draw("same HE");
2782 pLegendAR.AddEntry(fhAmplitudeMod[imod],Form("module %d",imod),"L");
255b904d 2783 }
2784
2785 pLegendAR.Draw();
164a1d84 2786 snprintf(name,buffersize,"QA_%s_CellEnergy.eps",fCalorimeter.Data());
255b904d 2787 ca->Print(name); printf("Plot: %s\n",name);
c8fe2783 2788
a6f26052 2789 //----------------------------------------------------------
2790 // Cell energy distributions, FRACTION of module dependence
2791 // See Super Module calibration difference
2792 //---------------------------------------------------------
255b904d 2793 if(fCalorimeter=="EMCAL"){
a6f26052 2794 //Close To Eta 0
164a1d84 2795 snprintf(cname,buffersize,"%s_QA_SMThirds",fCalorimeter.Data());
255b904d 2796 TCanvas * cfrac = new TCanvas(cname, "SM Thirds ratios", 800, 1200) ;
2797 cfrac->Divide(2, 3);
2798 cfrac->cd(1) ;
2799 if(fhAmplitude->GetEntries() > 0)
2800 gPad->SetLogy();
2801 TLegend pLegend1(0.6,0.6,0.9,0.8);
2802 pLegend1.SetTextSize(0.03);
2803 pLegend1.SetFillColor(10);
2804 pLegend1.SetBorderSize(1);
2805 pLegend1.SetHeader("Third close to Eta=0");
2806 fhAmplitudeModFraction[0]->SetTitle("Third close to Eta=0");
2807 fhAmplitudeModFraction[0]->SetAxisRange(ptmin,ptmax,"X");
2808 fhAmplitudeModFraction[0]->Draw("axis");
2809 TH1D * hAverageThird1 = (TH1D *)fhAmplitudeModFraction[3*0+2]->Clone("AverageThird1");
2810 for(Int_t imod = 0; imod < fNModules; imod++){
2811 Int_t ifrac = 0;
2812 if(imod%2==0) ifrac = 2;
2813 if(imod > 0) hAverageThird1->Add( fhAmplitudeModFraction[3*imod+ifrac]);
2814 fhAmplitudeModFraction[3*imod+ifrac]->SetLineColor(modColorIndex[imod]);
2815 fhAmplitudeModFraction[3*imod+ifrac]->Draw("HE same");
2816 pLegend1.AddEntry(fhAmplitudeModFraction[3*imod+ifrac],Form("super module %d",imod),"L");
2817 }
2818 hAverageThird1 ->Scale(1./fNModules);
2819 pLegend1.Draw();
a6f26052 2820 //Ratio
255b904d 2821 cfrac->cd(2) ;
2822 for(Int_t imod = 0; imod < fNModules; imod++){
2823 Int_t ifrac = 0;
2824 if(imod%2==0) ifrac = 2;
2825 TH1D * htmp = (TH1D*)fhAmplitudeModFraction[3*imod+ifrac]->Clone(Form("ThirdFractionAverage_%d_%d",imod,ifrac));
2826 htmp->Divide(hAverageThird1);
2827 if(imod ==0) {
2828 htmp ->SetTitle("Close to eta = 0");
2829 htmp ->SetMaximum(5);
2830 htmp ->SetMinimum(0);
2831 htmp ->SetAxisRange(ptmin,ptmax,"X");
2832 htmp ->SetYTitle("ratio third to average");
2833 htmp -> Draw("HE");
2834 }
2835 else htmp -> Draw("same HE");
2836 }
a6f26052 2837 //pLegend1.Draw();
255b904d 2838
a6f26052 2839 //Middle Eta
255b904d 2840 cfrac->cd(3) ;
2841 if(fhAmplitude->GetEntries() > 0)
2842 gPad->SetLogy();
2843 TLegend pLegend2(0.6,0.6,0.9,0.8);
2844 pLegend2.SetTextSize(0.03);
2845 pLegend2.SetFillColor(10);
2846 pLegend2.SetBorderSize(1);
2847 pLegend2.SetHeader("Middle Third");
2848
2849 fhAmplitudeModFraction[0]->SetTitle("Middle Third");
2850 fhAmplitudeModFraction[0]->SetAxisRange(ptmin,ptmax,"X");
2851 fhAmplitudeModFraction[0]->Draw("axis");
2852
2853 TH1D * hAverageThird2 = (TH1D *)fhAmplitudeModFraction[3*0+1]->Clone("AverageThird2");
2854 for(Int_t imod = 0; imod < fNModules; imod++){
2855 Int_t ifrac = 1;
2856 if(imod > 0) hAverageThird2->Add( fhAmplitudeModFraction[3*imod+ifrac]);
2857 fhAmplitudeModFraction[3*imod+ifrac]->SetLineColor(modColorIndex[imod]);
2858 fhAmplitudeModFraction[3*imod+ifrac]->Draw("HE same");
2859 pLegend2.AddEntry(fhAmplitudeModFraction[3*imod+ifrac],Form("super module %d",imod),"L");
2860 }
2861 hAverageThird2->Scale(1./fNModules);
2862 pLegend2.Draw();
2863
a6f26052 2864 //Ratio
255b904d 2865 cfrac->cd(4) ;
2866
2867 for(Int_t imod = 0; imod < fNModules; imod++){
2868 Int_t ifrac = 1;
2869 TH1D * htmp = (TH1D*)fhAmplitudeModFraction[3*imod+ifrac]->Clone(Form("ThirdFractionAverage_%d_%d",imod,ifrac));
2870 htmp->Divide(hAverageThird2);
2871 if(imod ==0) {
2872 htmp ->SetTitle("Middle");
2873 htmp ->SetMaximum(5);
2874 htmp ->SetMinimum(0);
2875 htmp ->SetAxisRange(ptmin,ptmax,"X");
2876 htmp ->SetYTitle("ratio third to average");
2877 htmp -> Draw("HE");
2878 }
2879 else htmp -> Draw("same HE");
2880 }
a6f26052 2881 //pLegend2.Draw();
255b904d 2882
a6f26052 2883 //Close To Eta 0.7
255b904d 2884 cfrac->cd(5) ;
2885 if(fhAmplitude->GetEntries() > 0)
2886 gPad->SetLogy();
2887 TLegend pLegend3(0.6,0.6,0.9,0.8);
2888 pLegend3.SetTextSize(0.03);
2889 pLegend3.SetFillColor(10);
2890 pLegend3.SetBorderSize(1);
2891 pLegend3.SetHeader("Third close to Eta=0.7");
2892
2893 fhAmplitudeModFraction[0]->SetTitle("Third close to Eta=0.7");
2894 fhAmplitudeModFraction[0]->SetAxisRange(ptmin,ptmax,"X");
2895 fhAmplitudeModFraction[0]->Draw("axis");
2896
2897 TH1D * hAverageThird3 = (TH1D *)fhAmplitudeModFraction[3*0+0]->Clone("AverageThird3");
2898 for(Int_t imod = 0; imod < 4; imod++){
2899 Int_t ifrac = 2;
2900 if(imod%2==0) ifrac = 0;
2901 if(imod > 0) hAverageThird3->Add( fhAmplitudeModFraction[3*imod+ifrac]);
2902 fhAmplitudeModFraction[3*imod+ifrac]->SetLineColor(modColorIndex[imod]);
2903 fhAmplitudeModFraction[3*imod+ifrac]->Draw("HE same");
2904 pLegend3.AddEntry(fhAmplitudeModFraction[3*imod+ifrac],Form("super module %d",imod),"L");
2905 }
2906 hAverageThird3 ->Scale(1./fNModules);
2907 pLegend3.Draw();
2908
2909 cfrac->cd(6) ;
2910
2911 for(Int_t imod = 0; imod < fNModules; imod++){
2912 Int_t ifrac = 2;
2913 if(imod%2==0) ifrac = 0;
2914 TH1D * htmp = (TH1D*)fhAmplitudeModFraction[3*imod+ifrac]->Clone(Form("ThirdFractionAverage_%d_%d",imod,ifrac));
2915 htmp->Divide(hAverageThird3);
2916 if(imod ==0) {
2917 htmp ->SetTitle("Close to eta = 0.7");
2918 htmp ->SetMaximum(5);
2919 htmp ->SetMinimum(0);
2920 htmp ->SetAxisRange(ptmin,ptmax,"X");
2921 htmp ->SetYTitle("ratio third to average");
2922 htmp ->Draw("HE");
2923 }
2924 else htmp ->Draw("same HE");
2925 }
a6f26052 2926 //pLegend3.Draw();
255b904d 2927
164a1d84 2928 snprintf(name,buffersize,"QA_%s_CellEnergyModuleFraction.eps",fCalorimeter.Data());
255b904d 2929 cfrac->Print(name); printf("Create plot %s\n",name);
2930 }//EMCAL
2931
2932
a6f26052 2933 //----------------------------------------------------------
2934 // Cluster eta and phi distributions, energy cut dependence
2935 //---------------------------------------------------------
255b904d 2936
164a1d84 2937 snprintf(cname,buffersize,"%s_QA_EtaPhiCluster",fCalorimeter.Data());
255b904d 2938 TCanvas * cetaphic = new TCanvas(cname, "Eta-Phi Reconstructed distributions", 1200, 400) ;
2939 cetaphic->Divide(3, 1);
2940 Int_t binmin = 0;
2941 Int_t rbPhi = 1;
2942 Int_t rbEta = 1;
2943 Int_t ncuts = 7;
5a35dd37 2944 Float_t ecut[] = {0.1, 0.3, 0.5, 0.7, 0.9, 1.1, 1.3};
2945 Int_t ecutcolor[]= {2, 4, 6, 7, 8, 9, 12};
255b904d 2946 TH1D * hE = fhEtaPhiE->ProjectionZ();
2947
a6f26052 2948 //PHI
255b904d 2949 cetaphic->cd(1) ;
2950 gPad->SetLogy();
2951 gPad->SetGridy();
2952
2953 TLegend pLegendPhiCl(0.83,0.6,0.95,0.93);
2954 pLegendPhiCl.SetTextSize(0.03);
2955 pLegendPhiCl.SetFillColor(10);
2956 pLegendPhiCl.SetBorderSize(1);
2957
2958 TH1D * htmp = fhEtaPhiE->ProjectionY("hphi_cluster_nocut",0,-1,0,-1);
2959 if(htmp){
3a75604b 2960 htmp->SetMinimum(1);
2961 rbPhi = GetNewRebinForRePlotting(htmp, phimin, phimax,nphibins) ;
a6f26052 2962 //printf("new Phi rb %d\n",rbPhi);
3a75604b 2963 htmp->Rebin(rbPhi);
2964 htmp->SetTitle("#phi of clusters for energy in cluster > threshold");
2965 htmp->SetAxisRange(phimin,phimax,"X");
2966 htmp->Draw("HE");
2967 pLegendPhiCl.AddEntry(htmp,"No cut","L");
c8fe2783 2968
3a75604b 2969 for (Int_t i = 0; i < ncuts; i++) {
2970 binmin = hE->FindBin(ecut[i]);
a6f26052 2971 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
3a75604b 2972 htmp = fhEtaPhiE->ProjectionY(Form("hphi_cluster_cut%d",i),0,-1,binmin,-1);
2973 htmp->SetLineColor(ecutcolor[i]);
2974 htmp->Rebin(rbPhi);
255b904d 2975 htmp->Draw("same HE");
3a75604b 2976 pLegendPhiCl.AddEntry(htmp,Form("E>%1.1f",ecut[i]),"L");
2977
2978 }
255b904d 2979 }
2980 pLegendPhiCl.Draw();
2981
5025c139 2982 //ETA
255b904d 2983 cetaphic->cd(2) ;
2984 gPad->SetLogy();
2985 gPad->SetGridy();
164a1d84 2986
5025c139 2987 delete htmp;
255b904d 2988 htmp = fhEtaPhiE->ProjectionX("heta_cluster_nocut",0,-1,0,-1);
2989 htmp ->SetLineColor(1);
3a75604b 2990 rbEta = GetNewRebinForRePlotting(htmp,etamin, etamax,netabins) ;
a6f26052 2991 //printf("new Eta rb %d\n",rbEta);
255b904d 2992 if(htmp){
3a75604b 2993 htmp->Rebin(rbEta);
2994 htmp->SetMinimum(1);
2995 htmp->SetTitle("#eta of clusters for energy in cluster > threshold");
2996 htmp->SetAxisRange(etamin,etamax,"X");
2997 htmp->Draw("HE");
2998
2999 for (Int_t i = 0; i < ncuts; i++) {
3000 binmin = hE->FindBin(ecut[i]);
a6f26052 3001 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
3a75604b 3002 htmp = fhEtaPhiE->ProjectionX(Form("heta_cluster_cut%d",i),0,-1,binmin,-1);
3003 htmp->SetLineColor(ecutcolor[i]);
3004 htmp->Rebin(rbEta);
3005 htmp->Draw("same HE");
3006 }
255b904d 3007 }
a6f26052 3008 //ETA vs PHI
255b904d 3009 cetaphic->cd(3) ;
3010 TH2D* hEtaPhiCl = (TH2D*) fhEtaPhiE->Project3D("xy");
3011 hEtaPhiCl->SetAxisRange(etamin,etamax,"X");
3012 hEtaPhiCl->SetAxisRange(phimin,phimax,"Y");
3013 hEtaPhiCl->Draw("colz");
c8fe2783 3014
164a1d84 3015 snprintf(name,buffersize,"QA_%s_ClusterEtaPhi.eps",fCalorimeter.Data());
255b904d 3016 cetaphic->Print(name); printf("Create plot %s\n",name);
c8fe2783 3017
a6f26052 3018 //----------------------------------------------------------
3019 // Cell eta and phi distributions, energy cut dependence
3020 //---------------------------------------------------------
255b904d 3021
164a1d84 3022 snprintf(cname,buffersize,"%s_QA_EtaPhiCell",fCalorimeter.Data());
255b904d 3023 TCanvas * cetaphicell = new TCanvas(cname, "Eta-Phi Cells distributions", 1200, 400) ;
3024 cetaphicell->Divide(3, 1);
3025
a6f26052 3026 //PHI
255b904d 3027 cetaphicell->cd(1) ;
3028 gPad->SetLogy();
3029 gPad->SetGridy();
3030
3031 TLegend pLegendPhiCell(0.83,0.6,0.95,0.93);
3032 pLegendPhiCell.SetTextSize(0.03);
3033 pLegendPhiCell.SetFillColor(10);
3034 pLegendPhiCell.SetBorderSize(1);
5025c139 3035
3036 delete htmp;
255b904d 3037 htmp = fhEtaPhiAmp->ProjectionY("hphi_cell_nocut",0,-1,0,-1);
3038 if(htmp){
3a75604b 3039 htmp->SetMinimum(1);
3040 htmp->Rebin(rbPhi);
3041 htmp->SetTitle("#phi of cells for cell energy > threshold");
3042 htmp->SetAxisRange(phimin,phimax,"X");
3043 htmp->Draw("HE");
3044 pLegendPhiCell.AddEntry(htmp,"No cut","L");
3045
3046 for (Int_t i = 0; i < ncuts; i++) {
3047 binmin = hE->FindBin(ecut[i]);
a6f26052 3048 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
3a75604b 3049 htmp = fhEtaPhiAmp->ProjectionY(Form("hphi_cell_cut%d",i),0,-1,binmin,-1);
3050 htmp->SetLineColor(ecutcolor[i]);
3051 htmp->Rebin(rbPhi);
255b904d 3052 htmp->Draw("same HE");
3a75604b 3053 pLegendPhiCl.AddEntry(htmp,Form("E>%1.1f",ecut[i]),"L");
3054
3055 }
255b904d 3056 }
3057 pLegendPhiCell.Draw();
3058
a6f26052 3059 //ETA
255b904d 3060 cetaphicell->cd(2) ;
3061 gPad->SetLogy();
3062 gPad->SetGridy();
5025c139 3063
3064 delete htmp;
255b904d 3065 htmp = fhEtaPhiAmp->ProjectionX("heta_cell_nocut",0,-1,0,-1);
3066 if(htmp){
3a75604b 3067 htmp ->SetLineColor(1);
3068 htmp->Rebin(rbEta);
3069 htmp->SetMinimum(1);
3070 htmp->SetTitle("#eta of cells for cell energy > threshold");
3071 htmp->SetAxisRange(etamin,etamax,"X");
3072 htmp->Draw("HE");
3073
3074 for (Int_t i = 0; i < ncuts; i++) {
3075 binmin = hE->FindBin(ecut[i]);
a6f26052 3076 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
3a75604b 3077 htmp = fhEtaPhiAmp->ProjectionX(Form("heta_cell_cut%d",i),0,-1,binmin,-1);
3078 htmp->SetLineColor(ecutcolor[i]);
3079 htmp->Rebin(rbEta);
255b904d 3080 htmp->Draw("same HE");
3a75604b 3081
3082 }
255b904d 3083 }
a6f26052 3084 //ETA vs PHI
255b904d 3085 cetaphicell->cd(3) ;
3086 TH2D* hEtaPhiCell = (TH2D*) fhEtaPhiAmp->Project3D("xy");
3087 hEtaPhiCell->SetAxisRange(etamin,etamax,"X");
3088 hEtaPhiCell->SetAxisRange(phimin,phimax,"Y");
3089 hEtaPhiCell->Draw("colz");
3090
164a1d84 3091 snprintf(name,buffersize,"QA_%s_CellEtaPhi.eps",fCalorimeter.Data());
255b904d 3092 cetaphicell->Print(name); printf("Create plot %s\n",name);
3093
c8fe2783 3094
a6f26052 3095 ////////////////////////////////////////
3096 ///////// Global Positions /////////////
3097 ////////////////////////////////////////
3098
3099 //CLUSTERS
b8187de4 3100 Int_t rbX = 1;
3101 Int_t rbY = 1;
3102 Int_t rbZ = 1;
3103 //if(fFillAllPosHisto)
3104 {
164a1d84 3105 snprintf(cname,buffersize,"%s_QA_ClusterXY",fCalorimeter.Data());
a6f26052 3106 TCanvas * cxyz = new TCanvas(cname, "Cluster XY distributions", 1200, 400) ;
3107 cxyz->Divide(3, 1);
3108
3109 cxyz->cd(1) ;
3110 TH2D * hXY = (TH2D*) fhXYZ->Project3D("yx" );
3111 hXY->SetTitle("Cluster X vs Y");
3112 hXY->GetYaxis()->SetTitleOffset(1.6);
3113 hXY->Draw("colz");
3114 cxyz->cd(2) ;
3115 TH2D * hYZ = (TH2D*) fhXYZ->Project3D("yz" );
3116 hYZ->SetTitle("Cluster Z vs Y");
3117 hYZ->GetYaxis()->SetTitleOffset(1.6);
3118 hYZ->Draw("colz");
3119 cxyz->cd(3) ;
3120 TH2D * hXZ = (TH2D*) fhXYZ->Project3D("zx" );
3121 hXZ->SetTitle("Cluster X vs Z");
3122 hXZ->GetYaxis()->SetTitleOffset(1.6);
3123 hXZ->Draw("colz");
3124
164a1d84 3125 snprintf(name,buffersize,"QA_%s_ClusterXY_YZ_XZ.eps",fCalorimeter.Data());
a6f26052 3126 cxyz->Print(name); printf("Create plot %s\n",name);
3127
164a1d84 3128 snprintf(cname,buffersize,"QA_%s_ClusterX",fCalorimeter.Data());
a6f26052 3129 TCanvas * cx = new TCanvas(cname, "Cluster X distributions", 1200, 400) ;
3130 cx->Divide(3, 1);
3131
3132 cx->cd(1) ;
3133 TH1D * hX = (TH1D*) fhXYZ->Project3D("xe" );
c8fe2783 3134 //gPad->SetLogy();
a6f26052 3135 gPad->SetGridy();
3136 hX->SetTitle("Cluster X ");
3137 hX->Draw("HE");
3138 rbX = GetNewRebinForRePlotting(hX, xmin, xmax,xbins) ;
c8fe2783 3139 //printf("new X rb %d\n",rbX);
a6f26052 3140 hX->Rebin(rbX);
3141 hX->SetMinimum(hX->GetMaximum()/2);
3142 hX->SetAxisRange(xmin,xmax);
3143
3144 cx->cd(2) ;
3145 TH1D * hY = (TH1D*) fhXYZ->Project3D("ye" );
c8fe2783 3146 //gPad->SetLogy();
a6f26052 3147 hY->SetTitle("Cluster Y ");
3148 rbY = GetNewRebinForRePlotting(hY, ymin, ymax, ybins) ;
c8fe2783 3149 //printf("new Y rb %d\n",rbY);
a6f26052 3150 hY->Rebin(rbY);
3151 hY->SetMinimum(1);
3152 hY->SetAxisRange(ymin,ymax);
3153 hY->Draw("HE");
3154
3155 cx->cd(3) ;
3156 TH1D * hZ = (TH1D*) fhXYZ->Project3D("ze" );
c8fe2783 3157 //gPad->SetLogy();
a6f26052 3158 gPad->SetGridy();
3159 rbZ = GetNewRebinForRePlotting(hZ,zmin, zmax,zbins) ;
c8fe2783 3160 //printf("new Z rb %d\n",rbZ);
a6f26052 3161 hZ->Rebin(rbZ);
3162 hZ->SetMinimum(hZ->GetMaximum()/2);
3163 hZ->SetAxisRange(zmin,zmax);
3164 hZ->Draw("HE");
3165
164a1d84 3166 snprintf(name,buffersize,"QA_%s_ClusterX_Y_Z.eps",fCalorimeter.Data());
a6f26052 3167 cx->Print(name); printf("Create plot %s\n",name);
b8187de4 3168 }
5025c139 3169 //CELLS
b8187de4 3170 if(fFillAllPosHisto)
3171 {
164a1d84 3172 snprintf(cname,buffersize,"%s_QA_CellXY",fCalorimeter.Data());
a6f26052 3173 TCanvas * cellxyz = new TCanvas(cname, "Cell XY distributions", 1200, 400) ;
3174 cellxyz->Divide(3, 1);
3175
3176 cellxyz->cd(1) ;
3177 TH2D * hXYCell = (TH2D*) fhXYZCell->Project3D("yx" );
3178 hXYCell->SetTitle("Cell X vs Y");
3179 hXYCell->GetYaxis()->SetTitleOffset(1.6);
3180 hXYCell->Draw("colz");
3181 cellxyz->cd(2) ;
3182 TH2D * hYZCell = (TH2D*) fhXYZCell->Project3D("yz" );
3183 hYZCell->SetTitle("Cell Z vs Y");
3184 hYZCell->GetYaxis()->SetTitleOffset(1.6);
3185 hYZCell->Draw("colz");
3186 cellxyz->cd(3) ;
3187 TH2D * hXZCell = (TH2D*) fhXYZCell->Project3D("zx" );
3188 hXZCell->SetTitle("Cell X vs Z");
3189 hXZCell->GetYaxis()->SetTitleOffset(1.6);
3190 hXZCell->Draw("colz");
3191
164a1d84 3192 snprintf(name,buffersize,"QA_%s_CellXY_YZ_XZ.eps",fCalorimeter.Data());
a6f26052 3193 cellxyz->Print(name); printf("Create plot %s\n",name);
3194
3195
164a1d84 3196 snprintf(cname,buffersize,"%s_QA_CellX",fCalorimeter.Data());
a6f26052 3197 TCanvas * cellx = new TCanvas(cname, "Cell X distributions", 1200, 400) ;
3198 cellx->Divide(3, 1);
3199
3200 cellx->cd(1) ;
3201 TH1D * hXCell = (TH1D*) fhXYZCell->Project3D("xe" );
c8fe2783 3202 //gPad->SetLogy();
a6f26052 3203 gPad->SetGridy();
3204 hXCell->SetTitle("Cell X ");
3205 hXCell->Rebin(rbX);
3206 hXCell->SetMinimum(hXCell->GetMaximum()/2);
3207 hXCell->SetAxisRange(xmin,xmax);
3208 hXCell->Draw("HE");
3209
3210 cellx->cd(2) ;
3211 TH1D * hYCell = (TH1D*) fhXYZCell->Project3D("ye" );
c8fe2783 3212 //gPad->SetLogy();
a6f26052 3213 hYCell->SetTitle("Cell Y ");
3214 hYCell->Rebin(rbY);
3215 hYCell->SetAxisRange(ymin,ymax);
3216 hYCell->SetMinimum(1);
3217 hYCell->Draw("HE");
3218
3219 cellx->cd(3) ;
3220 TH1D * hZCell = (TH1D*) fhXYZCell->Project3D("ze" );
c8fe2783 3221 //gPad->SetLogy();
a6f26052 3222 gPad->SetGridy();
3223 hZCell->SetAxisRange(zmin,zmax);
3224 hZCell->SetTitle("Cell Z ");
3225 hZCell->Rebin(rbZ);
3226 hZCell->SetMinimum(hZCell->GetMaximum()/2);
3227 hZCell->Draw("HE");
3228
164a1d84 3229 snprintf(name,buffersize,"QA_%s_CellX_Y_Z.eps",fCalorimeter.Data());
a6f26052 3230 cellx->Print(name); printf("Create plot %s\n",name);
3231
3232
c8fe2783 3233 //----------------------------------------------------------
3234 // Cluster X, Y, Z, R, energy cut dependence
3235 //---------------------------------------------------------
a6f26052 3236
164a1d84 3237 snprintf(cname,buffersize,"%s_QA_ClusterX_Y_Z_R_ECut",fCalorimeter.Data());
a6f26052 3238 TCanvas * cxe = new TCanvas(cname, "Cluster X Y Z R, E cut", 800, 800) ;
3239 cxe->Divide(2, 2);
c8fe2783 3240 //R
a6f26052 3241 cxe->cd(1) ;
3242 gPad->SetLogy();
3243 gPad->SetGridy();
3244
3245 TLegend pLegendXCl(0.83,0.6,0.95,0.93);
3246 pLegendXCl.SetTextSize(0.03);
3247 pLegendXCl.SetFillColor(10);
3248 pLegendXCl.SetBorderSize(1);
3249
5025c139 3250 delete htmp;
a6f26052 3251 htmp = fhRE->ProjectionX("hre_cluster_nocut",0,-1);
3252 Int_t rbR=1;
3253 if(htmp){
3254 htmp->SetMinimum(1);
3255 rbR = GetNewRebinForRePlotting(htmp, rmin, rmax,rbins) ;
c8fe2783 3256 //printf("new R rb %d\n",rbR);
a6f26052 3257 htmp->Rebin(rbR);
3258 htmp->SetTitle("r of clusters for energy in cluster > threshold");
3259 htmp->SetAxisRange(rmin,rmax,"X");
3260 htmp->Draw("HE");
3261 pLegendXCl.AddEntry(htmp,"No cut","L");
3262
3263 for (Int_t i = 0; i < ncuts; i++) {
3264 binmin = hE->FindBin(ecut[i]);
c8fe2783 3265 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
a6f26052 3266 htmp = fhRE->ProjectionX(Form("hre_cluster_cut%d",i),binmin,-1);
3267 htmp->SetLineColor(ecutcolor[i]);
3268 htmp->Rebin(rbR);
3269 htmp->Draw("same HE");
3270 pLegendXCl.AddEntry(htmp,Form("E>%1.1f",ecut[i]),"L");
3271 }
3272 }
3273 pLegendXCl.Draw();
3274
c8fe2783 3275 //X
a6f26052 3276 cxe->cd(2) ;
3277 gPad->SetLogy();
3278 gPad->SetGridy();
5025c139 3279 delete htmp;
a6f26052 3280 htmp = fhXE->ProjectionX("hxe_cluster_nocut",0,-1);
3281 if(htmp){
3282 htmp->SetMinimum(1);
3283 htmp->Rebin(rbX);
3284 htmp->SetTitle("x of clusters for energy in cluster > threshold");
3285 htmp->SetAxisRange(xmin,xmax,"X");
3286 htmp->Draw("HE");
3287
3288 for (Int_t i = 0; i < ncuts; i++) {
3289 binmin = hE->FindBin(ecut[i]);
c8fe2783 3290 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
a6f26052 3291 htmp = fhXE->ProjectionX(Form("hxe_cluster_cut%d",i),binmin,-1);
3292 htmp->SetLineColor(ecutcolor[i]);
3293 htmp->Rebin(rbX);
3294 htmp->Draw("same HE");
3295 }
3296 }
c8fe2783 3297 //Y
a6f26052 3298 cxe->cd(3) ;
3299 gPad->SetLogy();
3300 gPad->SetGridy();
5025c139 3301
3302 delete htmp;
a6f26052 3303 htmp = fhYE->ProjectionX("hye_cluster_nocut",0,-1);
3304 if(htmp){
3305 htmp->SetMinimum(1);
3306 htmp->Rebin(rbY);
3307 htmp->SetTitle("y of clusters for energy in cluster > threshold");
3308 htmp->SetAxisRange(ymin,ymax,"X");
3309 htmp->Draw("HE");
3310
3311 for (Int_t i = 0; i < ncuts; i++) {
3312 binmin = hE->FindBin(ecut[i]);
c8fe2783 3313 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
a6f26052 3314 htmp = fhYE->ProjectionX(Form("hye_cluster_cut%d",i),binmin,-1);
3315 htmp->SetLineColor(ecutcolor[i]);
3316 htmp->Rebin(rbY);
3317 htmp->Draw("same HE");
3318 }
3319 }
c8fe2783 3320 //Z
a6f26052 3321 cxe->cd(4) ;
3322 gPad->SetLogy();
3323 gPad->SetGridy();
3324
5025c139 3325 delete htmp;
a6f26052 3326 htmp = fhZE->ProjectionX("hze_cluster_nocut",0,-1);
3327 if(htmp){
3328 htmp->SetMinimum(1);
3329 htmp->Rebin(rbZ);
3330 htmp->SetTitle("z of clusters for energy in cluster > threshold");
3331 htmp->SetAxisRange(zmin,zmax,"X");
3332 htmp->Draw("HE");
3333
3334 for (Int_t i = 0; i < ncuts; i++) {
3335 binmin = hE->FindBin(ecut[i]);
c8fe2783 3336 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
a6f26052 3337 htmp = fhZE->ProjectionX(Form("hze_cluster_cut%d",i),binmin,-1);
3338 htmp->SetLineColor(ecutcolor[i]);
3339 htmp->Rebin(rbZ);
3340 htmp->Draw("same HE");
3341 }
3342 }
3343
164a1d84 3344 snprintf(name,buffersize,"QA_%s_ClusterX_Y_Z_R_ECut.eps",fCalorimeter.Data());
a6f26052 3345 cxe->Print(name); printf("Create plot %s\n",name);
3346
3347
c8fe2783 3348 //----------------------------------------------------------
3349 // Cluster X, Y, Z, R, NCells in cluster dependence
3350 //---------------------------------------------------------
a6f26052 3351 Int_t ncellcut[]={2, 3, 4};
3352 Int_t ncellcuts = 3;
164a1d84 3353 snprintf(cname,buffersize,"%s_QA_ClusterX_Y_Z_R_NCellsCut",fCalorimeter.Data());
a6f26052 3354 TCanvas * cxn = new TCanvas(cname, "Cluster X Y Z R, NCells cut", 800, 800) ;
3355 cxn->Divide(2, 2);
c8fe2783 3356 //R
a6f26052 3357 cxn->cd(1) ;
3358 gPad->SetLogy();
3359 gPad->SetGridy();
3360
3361 TLegend pLegendXClN(0.83,0.6,0.95,0.93);
3362 pLegendXClN.SetTextSize(0.03);
3363 pLegendXClN.SetFillColor(10);
3364 pLegendXClN.SetBorderSize(1);
3365
5025c139 3366 delete htmp;
a6f26052 3367 htmp = fhRNCells->ProjectionX("hrn_cluster_nocut",0,-1);
3368 if(htmp){
3369 htmp->SetMinimum(1);
3370 htmp->Rebin(rbR);
3371 htmp->SetTitle("r of clusters for energy in cluster > threshold");
3372 htmp->SetAxisRange(rmin,rmax,"X");
3373 htmp->Draw("HE");
3374 pLegendXClN.AddEntry(htmp,"No cut","L");
3375
3376 for (Int_t i = 0; i < ncellcuts; i++) {
3377 if(i < ncellcuts-1) htmp = fhRNCells->ProjectionX(Form("hrn_cluster_cut%d",i),ncellcut[i],ncellcut[i]);
3378 else htmp = fhRNCells->ProjectionX(Form("hrn_cluster_cut%d",i),ncellcut[i],-1);
3379 htmp->SetLineColor(ecutcolor[i]);
3380 htmp->Rebin(rbR);
3381 htmp->Draw("same HE");
3382 if(i < ncellcuts-1) pLegendXClN.AddEntry(htmp,Form("n = %1.1d",ncellcut[i]-1),"L");
3383 else pLegendXClN.AddEntry(htmp,Form("n >= %1.1d",ncellcut[i]-1),"L");
3384
3385 }
3386 }
3387 pLegendXClN.Draw();
3388
c8fe2783 3389 //X
a6f26052 3390 cxn->cd(2) ;
3391 gPad->SetLogy();
3392 gPad->SetGridy();
5025c139 3393
3394 delete htmp;
a6f26052 3395 htmp = fhXNCells->ProjectionX("hxn_cluster_nocut",0,-1);
3396 if(htmp){
3397 htmp->SetMinimum(1);
3398 htmp->Rebin(rbX);
3399 htmp->SetTitle("x of clusters for energy in cluster > threshold");
3400 htmp->SetAxisRange(xmin,xmax,"X");
3401 htmp->Draw("HE");
3402
3403 for (Int_t i = 0; i < ncellcuts; i++) {
3404 if(i < ncellcuts-1)htmp = fhXNCells->ProjectionX(Form("hxn_cluster_cut%d",i),ncellcut[i],ncellcut[i]);
3405 else htmp = fhXNCells->ProjectionX(Form("hxn_cluster_cut%d",i),ncellcut[i],-1);
3406 htmp->SetLineColor(ecutcolor[i]);
3407 htmp->Rebin(rbX);
3408 htmp->Draw("same HE");
3409 }
3410 }
c8fe2783 3411 //Y
a6f26052 3412 cxn->cd(3) ;
3413 gPad->SetLogy();
3414 gPad->SetGridy();
5025c139 3415 delete htmp;
a6f26052 3416 htmp = fhYNCells->ProjectionX("hyn_cluster_nocut",0,-1);
3417 if(htmp){
3418 htmp->SetMinimum(1);
3419 htmp->Rebin(rbY);
3420 htmp->SetTitle("y of clusters for energy in cluster > threshold");
3421 htmp->SetAxisRange(ymin,ymax,"X");
3422 htmp->Draw("HE");
3423
3424 for (Int_t i = 0; i < ncellcuts; i++) {
3425 if(i < ncellcuts-1) htmp = fhYNCells->ProjectionX(Form("hyn_cluster_cut%d",i),ncellcut[i],ncellcut[i]);
3426 else htmp = fhYNCells->ProjectionX(Form("hyn_cluster_cut%d",i),ncellcut[i],-1);
3427 htmp->SetLineColor(ecutcolor[i]);
3428 htmp->Rebin(rbY);
3429 htmp->Draw("same HE");
3430 }
3431 }
c8fe2783 3432 //Z
a6f26052 3433 cxn->cd(4) ;
3434 gPad->SetLogy();
3435 gPad->SetGridy();
3436
5025c139 3437 delete htmp;
a6f26052 3438 htmp = fhZNCells->ProjectionX("hzn_cluster_nocut",0,-1);
3439 if(htmp){
3440 htmp->SetMinimum(1);
3441 htmp->Rebin(rbZ);
3442 htmp->SetTitle("z of clusters for energy in cluster > threshold");
3443 htmp->SetAxisRange(zmin,zmax,"X");
3444 htmp->Draw("HE");
3445
3446 for (Int_t i = 0; i < ncellcuts; i++) {
3447 if(i < ncellcuts-1)htmp = fhZNCells->ProjectionX(Form("hzn_cluster_cut%d",i),ncellcut[i],ncellcut[i]);
3448 else htmp = fhZNCells->ProjectionX(Form("hzn_cluster_cut%d",i),ncellcut[i],-1);
3449 htmp->SetLineColor(ecutcolor[i]);
3450 htmp->Rebin(rbZ);
3451 htmp->Draw("same HE");
3452 }
3453 }
3454
164a1d84 3455 snprintf(name,buffersize,"QA_%s_ClusterX_Y_Z_R_NCellsCut.eps",fCalorimeter.Data());
a6f26052 3456 cxn->Print(name); printf("Create plot %s\n",name);
3457
3458
c8fe2783 3459 //----------------------------------------------------------
3460 // Cell X, Y, Z, R, energy cut dependence
3461 //---------------------------------------------------------
a6f26052 3462
164a1d84 3463 snprintf(cname,buffersize,"%s_QA_CellX_Y_Z_R_ECut",fCalorimeter.Data());
a6f26052 3464 TCanvas * cxecell = new TCanvas(cname, "Cell X Y Z R, E cut", 800, 800) ;
3465 cxecell->Divide(2, 2);
c8fe2783 3466 //R
a6f26052 3467 cxecell->cd(1) ;
3468 gPad->SetLogy();
3469 gPad->SetGridy();
3470
3471 TLegend pLegendXCell(0.83,0.6,0.95,0.93);
3472 pLegendXCell.SetTextSize(0.03);
3473 pLegendXCell.SetFillColor(10);
3474 pLegendXCell.SetBorderSize(1);
3475
5025c139 3476 delete htmp;
a6f26052 3477 htmp = fhRCellE->ProjectionX("hre_cell_nocut",0,-1);
3478 if(htmp){
3479 htmp->SetMinimum(1);
3480 htmp->Rebin(rbR);
3481 htmp->SetTitle("r of cells for energy in cluster > threshold");
3482 htmp->SetAxisRange(rmin,rmax,"X");
3483 htmp->Draw("HE");
3484 pLegendXCell.AddEntry(htmp,"No cut","L");
3485
3486 for (Int_t i = 0; i < ncuts; i++) {
3487 binmin = hE->FindBin(ecut[i]);
c8fe2783 3488 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
a6f26052 3489 htmp = fhRCellE->ProjectionX(Form("hre_celr_cut%d",i),binmin,-1);
3490 htmp->SetLineColor(ecutcolor[i]);
3491 htmp->Rebin(rbR);
3492 htmp->Draw("same HE");
3493 pLegendXCell.AddEntry(htmp,Form("E>%1.1f",ecut[i]),"L");
3494 }
3495 }
3496 pLegendXCell.Draw();
3497
c8fe2783 3498 //X
a6f26052 3499 cxecell->cd(2) ;
3500 gPad->SetLogy();
3501 gPad->SetGridy();
3502
5025c139 3503 delete htmp;
a6f26052 3504 htmp = fhXCellE->ProjectionX("hxe_cells_nocut",0,-1);
3505 if(htmp){
3506 htmp->SetMinimum(1);
3507 htmp->Rebin(rbX);
3508 htmp->SetTitle("x of cells for energy in cluster > threshold");
3509 htmp->SetAxisRange(xmin,xmax,"X");
3510 htmp->Draw("HE");
3511
3512 for (Int_t i = 0; i < ncuts; i++) {
3513 binmin = hE->FindBin(ecut[i]);
c8fe2783 3514 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
a6f26052 3515 htmp = fhXCellE->ProjectionX(Form("hxe_cells_cut%d",i),binmin,-1);
3516 htmp->SetLineColor(ecutcolor[i]);
3517 htmp->Rebin(rbX);
3518 htmp->Draw("same HE");
3519 }
3520 }
c8fe2783 3521 //Y
a6f26052 3522 cxecell->cd(3) ;
3523 gPad->SetLogy();
3524 gPad->SetGridy();
5025c139 3525 delete htmp;
a6f26052 3526 htmp = fhYCellE->ProjectionX("hye_cells_nocut",0,-1);
3527 if(htmp){
3528 htmp->SetMinimum(1);
3529 htmp->Rebin(rbY);
3530 htmp->SetTitle("y of cells for energy in cluster > threshold");
3531 htmp->SetAxisRange(ymin,ymax,"X");
3532 htmp->Draw("HE");
3533
3534 for (Int_t i = 0; i < ncuts; i++) {
3535 binmin = hE->FindBin(ecut[i]);
c8fe2783 3536 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
5025c139 3537 delete htmp;
a6f26052 3538 htmp = fhYCellE->ProjectionX(Form("hye_cells_cut%d",i),binmin,-1);
3539 htmp->SetLineColor(ecutcolor[i]);
3540 htmp->Rebin(rbY);
3541 htmp->Draw("same HE");
3542 }
3543 }
c8fe2783 3544 //Z
a6f26052 3545 cxecell->cd(4) ;
3546 gPad->SetLogy();
3547 gPad->SetGridy();
5025c139 3548 delete htmp;
a6f26052 3549 htmp = fhZCellE->ProjectionX("hze_cells_nocut",0,-1);
3550 if(htmp){
3551 htmp->SetMinimum(1);
3552 htmp->Rebin(rbZ);
3553 htmp->SetTitle("z of cells for energy in cluster > threshold");
3554 htmp->SetAxisRange(zmin,zmax,"X");
3555 htmp->Draw("HE");
3556
3557 for (Int_t i = 0; i < ncuts; i++) {
3558 binmin = hE->FindBin(ecut[i]);
c8fe2783 3559 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
5025c139 3560 delete htmp;
a6f26052 3561 htmp = fhZCellE->ProjectionX(Form("hze_cells_cut%d",i),binmin,-1);
3562 htmp->SetLineColor(ecutcolor[i]);
3563 htmp->Rebin(rbZ);
3564 htmp->Draw("same HE");
3565 }
3566 }
164a1d84 3567 snprintf(name,buffersize,"QA_%s_CellX_Y_Z_R_ECut.eps",fCalorimeter.Data());
a6f26052 3568 cxecell->Print(name); printf("Create plot %s\n",name);
3569
3570
c8fe2783 3571 //----------------------------------------------------------
3572 // Cluster-Cell X, Y, Z, R, cluster energy cut dependence
3573 //---------------------------------------------------------
a6f26052 3574 Int_t rbDR= 1;//rbR;
3575 Int_t rbDX= 1;//rbX;
3576 Int_t rbDY= 1;//rbY;
3577 Int_t rbDZ= 1;//rbZ;
3578
164a1d84 3579 snprintf(cname,buffersize,"%s_QA_DeltaClusterCellX_Y_Z_R_ECut",fCalorimeter.Data());
a6f26052 3580 TCanvas * cxde = new TCanvas(cname, "Cluster-Cell X, Y, Z, R, E cut", 800, 800) ;
3581 cxde->Divide(2, 2);
c8fe2783 3582 //R
a6f26052 3583 cxde->cd(1) ;
3584 gPad->SetLogy();
3585 gPad->SetGridy();
3586
3587 TLegend pLegendXClD(0.83,0.6,0.95,0.93);
3588 pLegendXClD.SetTextSize(0.03);
3589 pLegendXClD.SetFillColor(10);
3590 pLegendXClD.SetBorderSize(1);
3591
5025c139 3592 delete htmp;
a6f26052 3593 htmp = fhDeltaCellClusterRE->ProjectionX("hrde_nocut",0,-1);
3594 if(htmp){
3595 htmp->SetMinimum(1);
3596 htmp->Rebin(rbDR);
3597 htmp->SetTitle("r clusters - r cells for energy in cluster > threshold");
3598 htmp->SetAxisRange(-50,50,"X");
3599 htmp->Draw("HE");
3600 pLegendXCl.AddEntry(htmp,"No cut","L");
3601
3602 for (Int_t i = 0; i < ncuts; i++) {
3603 binmin = hE->FindBin(ecut[i]);
c8fe2783 3604 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
5025c139 3605 delete htmp;
a6f26052 3606 htmp = fhDeltaCellClusterRE->ProjectionX(Form("hrde_cut%d",i),binmin,-1);
3607 htmp->SetLineColor(ecutcolor[i]);
3608 htmp->Rebin(rbDR);
3609 htmp->Draw("same HE");
3610 pLegendXClD.AddEntry(htmp,Form("E>%1.1f",ecut[i]),"L");
3611 }
3612 }
3613 pLegendXClD.Draw();
3614
c8fe2783 3615 //X
a6f26052 3616 cxde->cd(2) ;
3617 gPad->SetLogy();
3618 gPad->SetGridy();
5025c139 3619 delete htmp;
a6f26052 3620 htmp = fhDeltaCellClusterXE->ProjectionX("hxde_nocut",0,-1);
3621 if(htmp){
3622 htmp->SetMinimum(1);
3623 htmp->Rebin(rbDX);
3624 htmp->SetTitle("x clusters -x cells for energy in cluster > threshold");
3625 htmp->SetAxisRange(-50,50,"X");
3626 htmp->Draw("HE");
3627
3628 for (Int_t i = 0; i < ncuts; i++) {
3629 binmin = hE->FindBin(ecut[i]);
c8fe2783 3630 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
5025c139 3631 delete htmp;
a6f26052 3632 htmp = fhDeltaCellClusterXE->ProjectionX(Form("hxde_cut%d",i),binmin,-1);
3633 htmp->SetLineColor(ecutcolor[i]);
3634 htmp->Rebin(rbDX);
3635 htmp->Draw("same HE");
3636
3637 }
3638 }
c8fe2783 3639 //Y
a6f26052 3640 cxde->cd(3) ;
3641 gPad->SetLogy();
3642 gPad->SetGridy();
5025c139 3643 delete htmp;
a6f26052 3644 htmp = fhDeltaCellClusterYE->ProjectionX("hyde_nocut",0,-1);
3645 if(htmp){
3646 htmp->SetMinimum(1);
3647 htmp->Rebin(rbDY);
3648 htmp->SetTitle("y clusters - ycells for energy in cluster > threshold");
3649 htmp->SetAxisRange(-50,50,"X");
3650 htmp->Draw("HE");
3651
3652 for (Int_t i = 0; i < ncuts; i++) {
3653 binmin = hE->FindBin(ecut[i]);
c8fe2783 3654 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
5025c139 3655 delete htmp;
a6f26052 3656 htmp = fhDeltaCellClusterYE->ProjectionX(Form("hyde_cut%d",i),binmin,-1);
3657 htmp->SetLineColor(ecutcolor[i]);
3658 htmp->Rebin(rbDY);
3659 htmp->Draw("same HE");
3660
3661 }
3662 }
c8fe2783 3663 //Z
a6f26052 3664 cxde->cd(4) ;
3665 gPad->SetLogy();
3666 gPad->SetGridy();
3667
5025c139 3668 delete htmp;
a6f26052 3669 htmp = fhDeltaCellClusterZE->ProjectionX("hzde_nocut",0,-1);
3670 if(htmp){
3671 htmp->SetMinimum(1);
3672 htmp->Rebin(rbZ);
3673 htmp->SetTitle("z clusters - z cells for energy in cluster > threshold");
3674 htmp->SetAxisRange(-50,50,"X");
3675 htmp->Draw("HE");
3676
3677 for (Int_t i = 0; i < ncuts; i++) {
3678 binmin = hE->FindBin(ecut[i]);
c8fe2783 3679 //printf(" bins %d for e %f\n",binmin[i],ecut[i]);
5025c139 3680 delete htmp;
a6f26052 3681 htmp = fhDeltaCellClusterZE->ProjectionX(Form("hzde_cut%d",i),binmin,-1);
3682 htmp->SetLineColor(ecutcolor[i]);
3683 htmp->Rebin(rbZ);
3684 htmp->Draw("same HE");
3685
3686 }
3687 }
3688
164a1d84 3689 snprintf(name,buffersize,"QA_%s_DeltaClusterCellX_Y_Z_R_ECut.eps",fCalorimeter.Data());
a6f26052 3690 cxde->Print(name); printf("Create plot %s\n",name);
3691
3692
c8fe2783 3693 //----------------------------------------------------------
3694 // Cluster-Cell X, Y, Z, R, NCells in cluster dependence
3695 //---------------------------------------------------------
164a1d84 3696 snprintf(cname,buffersize,"%s_QA_DeltaClusterCellX_Y_Z_R_NCellsCut",fCalorimeter.Data());
a6f26052 3697 TCanvas * cxdn = new TCanvas(cname, "Cluster-Cell X Y Z R, NCells cut", 800, 800) ;
3698 cxdn->Divide(2, 2);
c8fe2783 3699 //R
a6f26052 3700 cxdn->cd(1) ;
3701 gPad->SetLogy();
3702 gPad->SetGridy();
3703
3704 TLegend pLegendXClDN(0.83,0.6,0.95,0.93);
3705 pLegendXClDN.SetTextSize(0.03);
3706 pLegendXClDN.SetFillColor(10);
3707 pLegendXClDN.SetBorderSize(1);
5025c139 3708 delete htmp;
a6f26052 3709 htmp = fhDeltaCellClusterRNCells->ProjectionX("hrdn_nocut",0,-1);
3710 if(htmp){
3711 htmp->SetMinimum(1);
3712 htmp->Rebin(rbDR);
3713 htmp->SetTitle("r clusters - r cells for n cells in cluster > threshold");
3714 htmp->SetAxisRange(-50,50,"X");
3715 htmp->Draw("HE");
3716 pLegendXClDN.AddEntry(htmp,"No cut","L");
3717
3718 for (Int_t i = 0; i < ncellcuts; i++) {
5025c139 3719 delete htmp;
a6f26052 3720 if(i < ncellcuts-1) htmp = fhDeltaCellClusterRNCells->ProjectionX(Form("hrdn_cut%d",i),ncellcut[i],ncellcut[i]);
3721 else htmp = fhDeltaCellClusterRNCells->ProjectionX(Form("hrdn_cut%d",i),ncellcut[i],-1);
3722 htmp->SetLineColor(ecutcolor[i]);
3723 htmp->Rebin(rbDR);
3724 htmp->Draw("same HE");
3725 if(i < ncellcuts-1) pLegendXClDN.AddEntry(htmp,Form("n = %1.1d",ncellcut[i]-1),"L");
3726 else pLegendXClDN.AddEntry(htmp,Form("n >= %1.1d",ncellcut[i]-1),"L");
3727
3728 }
3729 }
3730 pLegendXClDN.Draw();
3731
c8fe2783 3732 //X
a6f26052 3733 cxdn->cd(2) ;
3734 gPad->SetLogy();
3735 gPad->SetGridy();
5025c139 3736 delete htmp;
a6f26052 3737 htmp = fhDeltaCellClusterXNCells->ProjectionX("hxdn_nocut",0,-1);
3738 if(htmp){
3739 htmp->SetMinimum(1);
3740 htmp->Rebin(rbDX);
3741 htmp->SetTitle("x clusters - x cells for n cells in cluster > threshold");
3742 htmp->SetAxisRange(-50,50,"X");
3743 htmp->Draw("HE");
3744
3745 for (Int_t i = 0; i < ncellcuts; i++) {
5025c139 3746 delete htmp;
a6f26052 3747 if(i < ncellcuts-1)htmp = fhDeltaCellClusterXNCells->ProjectionX(Form("hxdn_cut%d",i),ncellcut[i],ncellcut[i]);
3748 else htmp = fhDeltaCellClusterXNCells->ProjectionX(Form("hxdn_cut%d",i),ncellcut[i],-1);
3749 htmp->SetLineColor(ecutcolor[i]);
3750 htmp->Rebin(rbDX);
3751 htmp->Draw("same HE");
3752
3753 }
3754 }
c8fe2783 3755 //Y
a6f26052 3756 cxdn->cd(3) ;
3757 gPad->SetLogy();
3758 gPad->SetGridy();
5025c139 3759 delete htmp;
a6f26052 3760 htmp = fhDeltaCellClusterYNCells->ProjectionX("hydn_nocut",0,-1);
3761 if(htmp){
3762 htmp->SetMinimum(1);
3763 htmp->Rebin(rbDY);
3764 htmp->SetTitle("y clusters - y cells for n cells in cluster > threshold");
3765 htmp->SetAxisRange(-50,50,"X");
3766 htmp->Draw("HE");
3767
3768 for (Int_t i = 0; i < ncellcuts; i++) {
5025c139 3769 delete htmp;
a6f26052 3770 if(i < ncellcuts-1) htmp = fhDeltaCellClusterYNCells->ProjectionX(Form("hydn_cut%d",i),ncellcut[i],ncellcut[i]);
3771 else htmp = fhDeltaCellClusterYNCells->ProjectionX(Form("hydn_cut%d",i),ncellcut[i],-1);
3772 htmp->SetLineColor(ecutcolor[i]);
3773 htmp->Rebin(rbDY);
3774 htmp->Draw("same HE");
3775
3776 }
3777 }
c8fe2783 3778 //Z
a6f26052 3779 cxdn->cd(4) ;
3780 gPad->SetLogy();
3781 gPad->SetGridy();
5025c139 3782 delete htmp;
a6f26052 3783 htmp = fhDeltaCellClusterZNCells->ProjectionX("hzdn_nocut",0,-1);
3784 if(htmp){
3785 htmp->SetMinimum(1);
3786 htmp->Rebin(rbDZ);
3787 htmp->SetTitle("z clusters - z cells for ncells in cluster > threshold");
3788 htmp->SetAxisRange(-50,50,"X");
3789 htmp->Draw("HE");
3790
3791 for (Int_t i = 0; i < ncellcuts; i++) {
5025c139 3792 delete htmp;
a6f26052 3793 if(i < ncellcuts-1)htmp = fhDeltaCellClusterZNCells->ProjectionX(Form("hzdn_cut%d",i),ncellcut[i],ncellcut[i]);
3794 else htmp = fhDeltaCellClusterZNCells->ProjectionX(Form("hzdn_cut%d",i),ncellcut[i],-1);
3795 htmp->SetLineColor(ecutcolor[i]);
3796 htmp->Rebin(rbDZ);
3797 htmp->Draw("same HE");
3798
3799 }
3800 }
3801
164a1d84 3802 snprintf(name,buffersize,"QA_%s_DeltaClusterCellX_Y_Z_R_NCellsCut.eps",fCalorimeter.Data());
a6f26052 3803 cxdn->Print(name); printf("Create plot %s\n",name);
3804
255b904d 3805 }
c8fe2783 3806
a6f26052 3807 //----------------------------------------------------------
3808 //Reconstructed clusters energy-eta-phi distributions, matched with tracks
3809 //----------------------------------------------------------
3810 TH1F * hEChargedClone = 0 ;
3811 TH1F * hPtChargedClone = 0 ;
3812 TH1F * hEtaChargedClone = 0 ;
3813 TH1F * hPhiChargedClone = 0 ;
3814 if(fFillAllTH12){
3815 hEChargedClone = (TH1F*) fhECharged->Clone(Form("%sClone",fhECharged->GetName()));
3816 hPtChargedClone = (TH1F*) fhPtCharged->Clone(Form("%sClone",fhPtCharged->GetName()));
3817 hEtaChargedClone = (TH1F*) fhEtaCharged->Clone(Form("%sClone",fhEtaCharged->GetName()));
3818 hPhiChargedClone = (TH1F*) fhPhiCharged->Clone(Form("%sClone",fhPhiCharged->GetName()));
3819
164a1d84 3820 snprintf(cname,buffersize,"QA_%s_rectrackmatch",fCalorimeter.Data());
a6f26052 3821 TCanvas * ccltm = new TCanvas(cname, "Reconstructed clusters E-Phi-Eta, matched with tracks", 1200, 400) ;
3822 ccltm->Divide(3, 1);
3823
3824 ccltm->cd(1) ;
3825 if(fhECharged->GetEntries() > 0) gPad->SetLogy();
3826 fhECharged->Rebin(rbE);
3827 fhECharged->SetAxisRange(ptmin,ptmax,"X");
3828 fhECharged->SetMinimum(1);
3829 fhECharged->Draw();
3830
3831 ccltm->cd(2) ;
3832 if(fhPhiCharged->GetEntries() > 0) gPad->SetLogy();
3833 fhPhiCharged->Rebin(rbPhi);
3834 fhPhiCharged->SetAxisRange(phimin,phimax,"X");
3835 fhPhiCharged->Draw();
3836 fhPhiCharged->Draw();
3837
3838 ccltm->cd(3) ;
3839 if(fhEtaCharged->GetEntries() > 0) gPad->SetLogy();
3840 fhEtaCharged->Rebin(rbEta);
3841 fhEtaCharged->SetAxisRange(etamin,etamax,"X");
3842 fhEtaCharged->Draw();
3843 fhEtaCharged->Draw();
3844
164a1d84 3845 snprintf(name,buffersize,"QA_%s_ClusterEnergyPhiEta_TrackMatched.eps",fCalorimeter.Data());
a6f26052 3846 ccltm->Print(name); printf("Plot: %s\n",name);
3847
c8fe2783 3848 //----------------------------------------------------------
3849 // Ratio of reconstructed clusters energy-eta-phi distributions, matched with tracks over all
3850 //----------------------------------------------------------
a6f26052 3851
164a1d84 3852 snprintf(cname,buffersize,"%s_QA_ChargedRatio",fCalorimeter.Data());
a6f26052 3853 TCanvas * ccharge = new TCanvas(cname, "Charged clusters over all clusters", 1200, 400) ;
3854 ccharge->Divide(3, 1);
3855
3856 ccharge->cd(1) ;
3857 fhECharged->Sumw2();
3858 fhE->Sumw2();
3859 fhECharged->Divide(fhE);
3860 fhECharged->SetAxisRange(ptmin,ptmax,"X");
3861 fhECharged->SetMaximum(0.5);
3862 fhECharged->SetYTitle("track-matched clusters / all clusters");
3863 fhECharged->Draw("HE");
3864
3865 ccharge->cd(2) ;
3866 fhPhiCharged->Sumw2();
3867 fhPhi->Rebin(rbPhi);
3868 fhPhi->Sumw2();
3869 fhPhiCharged->Divide(fhPhi);
3870 fhPhiCharged->SetAxisRange(phimin,phimax,"X");
3871 fhPhiCharged->SetMaximum(0.5);
3872 fhPhiCharged->SetYTitle("track-matched clusters / all clusters");
3873 fhPhiCharged->Draw("HE");
3874
3875 ccharge->cd(3) ;
3876 fhEtaCharged->Sumw2();
3877 fhEta->Rebin(rbEta);
3878 fhEta->Sumw2();
3879 fhEtaCharged->Divide(fhEta);
3880 fhEtaCharged->SetAxisRange(etamin,etamax,"X");
3881 fhEtaCharged->SetMaximum(0.5);
3882 fhEtaCharged->SetYTitle("track-matched clusters / all clusters");
3883 fhEtaCharged->Draw("HE");
3884
164a1d84 3885 snprintf(name,buffersize,"QA_%s_ClustersMatchedToAllRatios.eps",fCalorimeter.Data());
a6f26052 3886 ccharge->Print(name); printf("Create plot %s\n",name);
3887 }
3888 //-------------------------------------------
3889 // N Cells - N Clusters - N Cells per cluster
3890 //-------------------------------------------
164a1d84 3891 snprintf(cname,buffersize,"QA_%s_nclustercells",fCalorimeter.Data());
255b904d 3892 TCanvas * cN = new TCanvas(cname, " Number of CaloClusters and CaloCells", 800, 1200) ;
3893 cN->Divide(2, 3);
3894
3895 cN->cd(1) ;
a5fafd85 3896
3897 TLegend pLegendN(0.7,0.6,0.9,0.8);
3898 pLegendN.SetTextSize(0.03);
3899 pLegendN.AddEntry(fhNClusters,"all modules","L");
3900 pLegendN.SetFillColor(10);
3901 pLegendN.SetBorderSize(1);
3902
8a587055 3903 if(fhNClusters->GetEntries() > 0) gPad->SetLogy();
3904 gPad->SetLogx();
a5fafd85 3905 fhNClusters->SetLineColor(1);
255b904d 3906
3907 Int_t rbN = 1;
3908 if(fhNClusters->GetNbinsX()> nbins) rbN = fhNClusters->GetNbinsX()/nbins;
3909
3910 fhNClusters->SetAxisRange(nmin,nmax,"X");
3911 fhNClusters->Draw("HE");
a5fafd85 3912 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 3913 fhNClustersMod[imod]->SetAxisRange(nmin,nmax,"X");
3914 fhNClustersMod[imod]->SetLineColor(modColorIndex[imod]);
a5fafd85 3915 fhNClustersMod[imod]->Draw("same");
3916 pLegendN.AddEntry(fhNClustersMod[imod],Form("module %d",imod),"L");
3917 }
3918 pLegendN.Draw();
255b904d 3919
3920 cN->cd(2) ;
3921 gPad->SetLogx();
3922 for(Int_t imod = 1; imod < fNModules; imod++){
5025c139 3923 delete htmp;
255b904d 3924 htmp = (TH1D*)fhNClustersMod[imod]->Clone(Form("hNClustersRat%d",imod));
3925 htmp->Divide(fhNClustersMod[0]);
3926 htmp->SetLineColor(modColorIndex[imod]);
3927 if(imod==1){
3928 htmp->SetTitle("Ratio # clusters in module X / module 0");
3929 htmp->SetMaximum(5);
3930 htmp->SetMinimum(0);
3931 htmp->Draw("HE");
3932 }
3933 else
3934 htmp->Draw("same HE");
3935
3936 }
3937
3938 cN->cd(3) ;
8a587055 3939 if(fhNCells->GetEntries() > 0) gPad->SetLogy();
3940 gPad->SetLogx();
a5fafd85 3941 fhNCells->SetLineColor(1);
255b904d 3942 fhNCells->SetAxisRange(nmin,nmax,"X");
3943 fhNCells->Draw("HE");
a5fafd85 3944 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 3945 fhNCellsMod[imod]->SetAxisRange(nmin,nmax,"X");
3946 fhNCellsMod[imod]->SetLineColor(modColorIndex[imod]);
3947 fhNCellsMod[imod]->Draw("same HE");
3948 }
3949
3950
3951 cN->cd(4) ;
a348c43e 3952 gPad->SetLogx();
255b904d 3953 for(Int_t imod = 1; imod < fNModules; imod++){
5025c139 3954 delete htmp;
255b904d 3955 htmp = (TH1D*)fhNCellsMod[imod]->Clone(Form("hNCellsRat%d",imod));
3956 htmp->Divide(fhNCellsMod[0]);
3957 htmp->SetLineColor(modColorIndex[imod]);
3958 if(imod==1){
3959 htmp->SetTitle("Ratio # cells in module X / module 0");
3960 htmp->SetMaximum(5);
3961 htmp->SetMinimum(0);
3962 htmp->Draw("HE");
3963 }
3964 else
3965 htmp->Draw("same HE");
3966
3967 }
3968
3969 cN->cd(5) ;
3970 if(fhNCellsPerCluster->GetEntries() > 0) gPad->SetLogy();
3971 gPad->SetLogx();
3972 TH1D *cpc = fhNCellsPerCluster->ProjectionY("cpc",-1,-1,-1,-1);
3973 cpc->SetLineColor(1);
3974 cpc->SetTitle("# cells per cluster");
3975 cpc->Draw("HE");
3976 TH1D ** hNCellsCluster1D = new TH1D*[fNModules];
3977
a5fafd85 3978 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 3979 hNCellsCluster1D[imod] = fhNCellsPerClusterMod[imod]->ProjectionY(Form("cpc_%d",imod),-1,-1);
3980 hNCellsCluster1D[imod]->SetLineColor(modColorIndex[imod]);
3981 hNCellsCluster1D[imod]->Draw("same HE");
a5fafd85 3982 }
8a587055 3983
8a587055 3984
255b904d 3985 cN->cd(6) ;
3986 gPad->SetLogx();
3987 for(Int_t imod = 1; imod < fNModules; imod++){
5025c139 3988 delete htmp;
255b904d 3989 htmp = (TH1D*)hNCellsCluster1D[imod]->Clone(Form("hNClustersCells1DRat%d",imod));
3990 htmp->Divide(hNCellsCluster1D[0]);
3991 htmp->SetLineColor(modColorIndex[imod]);
3992 if(imod==1){
3993 htmp->SetTitle("Ratio # cells per cluster in module X / module 0");
a6f26052 3994 //htmp->SetAxisRange(ptmin,ptmax,"X");
255b904d 3995 htmp->SetMaximum(3.5);
3996 htmp->SetMinimum(0);
3997 htmp->Draw("HE");
3998 }
3999 else
4000 htmp->Draw("same HE");
255b904d 4001 }
572157db 4002 delete [] hNCellsCluster1D;
4003
164a1d84 4004 snprintf(name,buffersize,"QA_%s_NumberCaloClustersAndCaloCells.eps",fCalorimeter.Data());
255b904d 4005 cN->Print(name); printf("Print plot %s\n",name);
4006
a6f26052 4007 //----------------------------------------------------
4008 // Cell Time histograms, time only available in ESDs
4009 //----------------------------------------------------
5a2dbc3c 4010 if(GetReader()->GetDataType()==AliCaloTrackReader::kESD) {
c8fe2783 4011
164a1d84 4012 snprintf(cname,buffersize,"QA_%s_cellstime",fCalorimeter.Data());
5a2dbc3c 4013 TCanvas * ctime = new TCanvas(cname, " Cells time", 1200, 400) ;
4014 ctime->Divide(3, 1);
255b904d 4015
4016 Int_t rbTime = 1;
4017 if(fhTime->GetNbinsX()> ntimebins) rbTime = fhTime->GetNbinsX()/ntimebins;
4018
5a2dbc3c 4019 ctime->cd(1) ;
4020 if(fhTime->GetEntries() > 0) gPad->SetLogy();
255b904d 4021 fhTime->Rebin(rbTime);
4022 fhTime->SetAxisRange(timemin,timemax,"X");
5a2dbc3c 4023 fhTime->Draw();
c8fe2783 4024
5a2dbc3c 4025 ctime->cd(2) ;
255b904d 4026 fhTimeId->SetTitleOffset(1.8,"Y");
4027 fhTimeId->SetAxisRange(timemin,timemax,"X");
5a2dbc3c 4028 fhTimeId->Draw("colz");
c8fe2783 4029
5a2dbc3c 4030 ctime->cd(3) ;
255b904d 4031 fhTimeAmp->SetTitle("Cell Energy vs Cell Time");
4032 fhTimeAmp->SetTitleOffset(1.8,"Y");
4033 fhTimeAmp->SetAxisRange(timemin,timemax,"Y");
4034 fhTimeAmp->SetAxisRange(ptmin,ptmax,"X");
4035 fhTimeAmp->Draw("colz");
c8fe2783 4036
164a1d84 4037 snprintf(name,buffersize,"QA_%s_CellsTime.eps",fCalorimeter.Data());
5a2dbc3c 4038 ctime->Print(name); printf("Plot: %s\n",name);
4039 }
4040
255b904d 4041
a6f26052 4042 //---------------------------------
4043 //Grid of cell per module plots
4044 //---------------------------------
255b904d 4045 {
a6f26052 4046 //Number of entries per cell
c8fe2783 4047 gStyle->SetPadRightMargin(0.15);
164a1d84 4048 snprintf(cname,buffersize,"%s_QA_GridCellEntries",fCalorimeter.Data());
c8fe2783 4049 TCanvas *cgrid = new TCanvas("cgrid","Number of entries per cell", 12,12,800,400);
4050 if(fNModules%2 == 0)
4051 cgrid->Divide(fNModules/2,2);
4052 else
4053 cgrid->Divide(fNModules/2+1,2);
4054
4055 for(Int_t imod = 0; imod < fNModules ; imod++){
4056 cgrid->cd(imod+1);
4057 gPad->SetLogz();
4058 gPad->SetGridy();
4059 gPad->SetGridx();
a6f26052 4060 //fhGridCellsMod[imod]->GetYAxis()->SetTitleColor(1);
c8fe2783 4061 fhGridCellsMod[imod]->SetZTitle("Counts ");
4062 fhGridCellsMod[imod]->SetYTitle("row (phi direction) ");
a6f26052 4063 //fhGridCellsMod[imod]->SetLabelSize(0.025,"z");
c8fe2783 4064 fhGridCellsMod[imod]->Draw("colz");
4065 }
164a1d84 4066 snprintf(name,buffersize,"QA_%s_GridCellsEntries.eps",fCalorimeter.Data());
c8fe2783 4067 cgrid->Print(name); printf("Create plot %s\n",name);
4068
164a1d84 4069 snprintf(cname,buffersize,"%s_QA_GridCellAccumEnergy",fCalorimeter.Data());
c8fe2783 4070 TCanvas *cgridE = new TCanvas("cgridE","Summed energy per cell", 12,12,800,400);
4071 if(fNModules%2 == 0)
4072 cgridE->Divide(fNModules/2,2);
4073 else
4074 cgridE->Divide(fNModules/2+1,2);
4075 for(Int_t imod = 0; imod < fNModules ; imod++){
4076 cgridE->cd(imod+1);
4077 gPad->SetLogz();
4078 gPad->SetGridy();
4079 gPad->SetGridx();
a6f26052 4080 //fhGridCellsEMod[imod]->SetLabelSize(0.025,"z");
c8fe2783 4081 fhGridCellsEMod[imod]->SetZTitle("Accumulated Energy (GeV) ");
4082 fhGridCellsEMod[imod]->SetYTitle("row (phi direction) ");
4083 fhGridCellsEMod[imod]->Draw("colz");
4084 }
164a1d84 4085 snprintf(name,buffersize,"QA_%s_GridCellsAccumEnergy.eps",fCalorimeter.Data());
c8fe2783 4086 cgridE->Print(name); printf("Create plot %s\n",name);
4087
a6f26052 4088 //Accumulated energy per cell
164a1d84 4089 snprintf(cname,buffersize,"%s_QA_GridCellAverageEnergy",fCalorimeter.Data());
c8fe2783 4090 TCanvas *cgridEA = new TCanvas("cgridEA","Average energy per cell", 12,12,800,400);
4091 if(fNModules%2 == 0)
4092 cgridEA->Divide(fNModules/2,2);
4093 else
4094 cgridEA->Divide(fNModules/2+1,2);
4095 for(Int_t imod = 0; imod < fNModules ; imod++){
4096 cgridEA->cd(imod+1);
4097 gPad->SetLogz();
4098 gPad->SetGridy();
4099 gPad->SetGridx();
a6f26052 4100 //fhGridCellsEMod[imod]->SetLabelSize(0.025,"z");
c8fe2783 4101 fhGridCellsEMod[imod]->SetZTitle("Average Energy (GeV) ");
4102 fhGridCellsEMod[imod]->Divide(fhGridCellsMod[imod]);
4103 fhGridCellsEMod[imod]->Draw("colz");
4104 }
164a1d84 4105 snprintf(name,buffersize,"QA_%s_GridCellsAverageEnergy.eps",fCalorimeter.Data());
c8fe2783 4106 cgridEA->Print(name); printf("Create plot %s\n",name);
4107
a6f26052 4108 //Accumulated Time per cell, E > 0.5 GeV
c8fe2783 4109
164a1d84 4110 snprintf(cname,buffersize,"%s_QA_GridCellAccumTime",fCalorimeter.Data());
c8fe2783 4111 TCanvas *cgridT = new TCanvas("cgridT","Summed time per cell", 12,12,800,400);
4112 if(fNModules%2 == 0)
4113 cgridT->Divide(fNModules/2,2);
4114 else
4115 cgridE->Divide(fNModules/2+1,2);
4116 for(Int_t imod = 0; imod < fNModules ; imod++){
4117 cgridT->cd(imod+1);
4118 gPad->SetLogz();
4119 gPad->SetGridy();
4120 gPad->SetGridx();
a6f26052 4121 //fhGridCellsTimeMod[imod]->SetLabelSize(0.025,"z");
c8fe2783 4122 fhGridCellsTimeMod[imod]->SetZTitle("Accumulated Time (ns) ");
4123 fhGridCellsTimeMod[imod]->SetYTitle("row (phi direction) ");
4124 fhGridCellsTimeMod[imod]->Draw("colz");
4125 }
164a1d84 4126 snprintf(name,buffersize,"QA_%s_GridCellsAccumTime.eps",fCalorimeter.Data());
c8fe2783 4127 cgridT->Print(name); printf("Create plot %s\n",name);
255b904d 4128
4129 }
4130
a6f26052 4131 //---------------------------------------------
4132 //Calorimeter Correlation, PHOS vs EMCAL
4133 //---------------------------------------------
a0bb4dc0 4134 if(fCorrelateCalos){
255b904d 4135
164a1d84 4136 snprintf(cname,buffersize,"QA_%s_CaloCorr_EMCALvsPHOS",fCalorimeter.Data());
a0bb4dc0 4137 TCanvas * ccorr = new TCanvas(cname, " EMCAL vs PHOS", 400, 400) ;
4138 ccorr->Divide(2, 2);
c8fe2783 4139
a0bb4dc0 4140 ccorr->cd(1) ;
a6f26052 4141 //gPad->SetLogy();
4142 //gPad->SetLogx();
255b904d 4143 fhCaloCorrNClusters->SetAxisRange(nmin,nmax,"X");
4144 fhCaloCorrNClusters->SetAxisRange(nmin,nmax,"Y");
a0bb4dc0 4145 fhCaloCorrNClusters ->Draw();
c8fe2783 4146
a0bb4dc0 4147 ccorr->cd(2) ;
a6f26052 4148 //gPad->SetLogy();
4149 //gPad->SetLogx();
255b904d 4150 fhCaloCorrNCells->SetAxisRange(nmin,nmax,"X");
4151 fhCaloCorrNCells->SetAxisRange(nmin,nmax,"Y");
a0bb4dc0 4152 fhCaloCorrNCells->Draw();
c8fe2783 4153
a6f26052 4154 //gPad->SetLogy();
4155 //gPad->SetLogx();
255b904d 4156 fhCaloCorrEClusters->SetAxisRange(ptmin,ptmax,"X");
4157 fhCaloCorrEClusters->SetAxisRange(ptmin,ptmax,"Y");
a0bb4dc0 4158 fhCaloCorrEClusters->Draw();
c8fe2783 4159
a0bb4dc0 4160 ccorr->cd(4) ;
a6f26052 4161 //gPad->SetLogy();
4162 //gPad->SetLogx();
255b904d 4163 fhCaloCorrECells->SetAxisRange(ptmin,ptmax,"X");
4164 fhCaloCorrECells->SetAxisRange(ptmin,ptmax,"Y");
a0bb4dc0 4165 fhCaloCorrECells->Draw();
c8fe2783 4166
164a1d84 4167 snprintf(name,buffersize,"QA_%s_CaloCorr_EMCALvsPHOS.eps",fCalorimeter.Data());
a0bb4dc0 4168 ccorr->Print(name); printf("Plot: %s\n",name);
4169 }
c8fe2783 4170
a6f26052 4171 //----------------------------
4172 //Invariant mass
4173 //-----------------------------
255b904d 4174
4175 Int_t imbinmin = -1;
4176 Int_t imbinmax = -1;
06e5656a 4177
9725fd2a 4178 if(fhIM->GetEntries() > 1){
4179 Int_t nebins = fhIM->GetNbinsX();
4180 Int_t emax = (Int_t) fhIM->GetXaxis()->GetXmax();
4181 Int_t emin = (Int_t) fhIM->GetXaxis()->GetXmin();
4182 if (emin != 0 ) printf("emin != 0 \n");
a6f26052 4183 //printf("IM: nBinsX %d, emin %2.2f, emax %2.2f\n",nebins,emin,emax);
9725fd2a 4184
164a1d84 4185 snprintf(cname,buffersize,"QA_%s_IM",fCalorimeter.Data());
a6f26052 4186 // printf("c5\n");
a5fafd85 4187 TCanvas * c5 = new TCanvas(cname, "Invariant mass", 600, 400) ;
4188 c5->Divide(2, 3);
9725fd2a 4189
4190 c5->cd(1) ;
a6f26052 4191 //fhIM->SetLineColor(4);
4192 //fhIM->Draw();
255b904d 4193 imbinmin = 0;
4194 imbinmax = (Int_t) (1-emin)*nebins/emax;
4195 TH1D *pyim1 = fhIM->ProjectionY(Form("%s_py1",fhIM->GetName()),imbinmin,imbinmax);
a5fafd85 4196 pyim1->SetTitle("E_{pair} < 1 GeV");
4197 pyim1->SetLineColor(1);
4198 pyim1->Draw();
4199 TLegend pLegendIM(0.7,0.6,0.9,0.8);
4200 pLegendIM.SetTextSize(0.03);
4201 pLegendIM.AddEntry(pyim1,"all modules","L");
4202 pLegendIM.SetFillColor(10);
4203 pLegendIM.SetBorderSize(1);
a6f26052 4204 //FIXME
a5fafd85 4205 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 4206 pyim1 = fhIMMod[imod]->ProjectionY(Form("%s_py1",fhIMMod[imod]->GetName()),imbinmin,imbinmax);
a5fafd85 4207 pLegendIM.AddEntry(pyim1,Form("module %d",imod),"L");
4208 pyim1->SetLineColor(imod+1);
4209 pyim1->Draw("same");
4210 }
4211 pLegendIM.Draw();
9725fd2a 4212
4213 c5->cd(2) ;
255b904d 4214 imbinmin = (Int_t) (1-emin)*nebins/emax;
4215 imbinmax = (Int_t) (2-emin)*nebins/emax;
4216 TH1D *pyim2 = fhIM->ProjectionY(Form("%s_py2",fhIM->GetName()),imbinmin,imbinmax);
a5fafd85 4217 pyim2->SetTitle("1 < E_{pair} < 2 GeV");
4218 pyim2->SetLineColor(1);
4219 pyim2->Draw();
4220 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 4221 pyim2 = fhIMMod[imod]->ProjectionY(Form("%s_py2",fhIMMod[imod]->GetName()),imbinmin,imbinmax);
a5fafd85 4222 pyim2->SetLineColor(imod+1);
4223 pyim2->Draw("same");
4224 }
4225
4226 c5->cd(3) ;
255b904d 4227 imbinmin = (Int_t) (2-emin)*nebins/emax;
4228 imbinmax = (Int_t) (3-emin)*nebins/emax;
4229 TH1D *pyim3 = fhIM->ProjectionY(Form("%s_py3",fhIM->GetName()),imbinmin,imbinmax);
a5fafd85 4230 pyim3->SetTitle("2 < E_{pair} < 3 GeV");
4231 pyim3->SetLineColor(1);
4232 pyim3->Draw();
4233 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 4234 pyim3 = fhIMMod[imod]->ProjectionY(Form("%s_py3",fhIMMod[imod]->GetName()),imbinmin,imbinmax);
a5fafd85 4235 pyim3->SetLineColor(imod+1);
4236 pyim3->Draw("same");
4237 }
4238
4239 c5->cd(4) ;
255b904d 4240 imbinmin = (Int_t) (3-emin)*nebins/emax;
4241 imbinmax = (Int_t) (4-emin)*nebins/emax;
4242 TH1D *pyim4 = fhIM->ProjectionY(Form("%s_py4",fhIM->GetName()),imbinmin,imbinmax);
a5fafd85 4243 pyim4->SetTitle("3 < E_{pair} < 4 GeV");
4244 pyim4->SetLineColor(1);
4245 pyim4->Draw();
4246 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 4247 pyim4 = fhIMMod[imod]->ProjectionY(Form("%s_py4",fhIMMod[imod]->GetName()),imbinmin,imbinmax);
a5fafd85 4248 pyim4->SetLineColor(imod+1);
4249 pyim4->Draw("same");
4250 }
4251
4252 c5->cd(5) ;
255b904d 4253 imbinmin = (Int_t) (4-emin)*nebins/emax;
4254 imbinmax = (Int_t) (5-emin)*nebins/emax;
4255 TH1D *pyim5 = fhIM->ProjectionY(Form("%s_py5",fhIM->GetName()),imbinmin,imbinmax);
a5fafd85 4256 pyim5->SetTitle("4< E_{pair} < 5 GeV");
4257 pyim5->SetLineColor(1);
9725fd2a 4258 pyim5->Draw();
a5fafd85 4259 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 4260 pyim5 = fhIMMod[imod]->ProjectionY(Form("%s_py5",fhIMMod[imod]->GetName()),imbinmin,imbinmax);
a5fafd85 4261 pyim5->SetLineColor(imod+1);
4262 pyim5->Draw("same");
4263 }
9725fd2a 4264
a5fafd85 4265 c5->cd(6) ;
255b904d 4266 imbinmin = (Int_t) (5-emin)*nebins/emax;
4267 imbinmax = -1;
4268 TH1D *pyim10 = fhIM->ProjectionY(Form("%s_py6",fhIM->GetName()),imbinmin,imbinmax);
a5fafd85 4269 pyim10->SetTitle("E_{pair} > 5 GeV");
4270 pyim10->SetLineColor(1);
9725fd2a 4271 pyim10->Draw();
a5fafd85 4272 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 4273 pyim10 = fhIMMod[imod]->ProjectionY(Form("%s_py6",fhIMMod[imod]->GetName()),imbinmin,imbinmax);
a5fafd85 4274 pyim10->SetLineColor(imod+1);
4275 pyim10->Draw("same");
4276 }
9725fd2a 4277
164a1d84 4278 snprintf(name,buffersize,"QA_%s_InvariantMass.eps",fCalorimeter.Data());
8a587055 4279 c5->Print(name); printf("Plot: %s\n",name);
9725fd2a 4280 }
4281
a6f26052 4282 //--------------------------------------------------
4283 //Invariant mass, clusters with more than one cell
4284 //-------------------------------------------------
a5fafd85 4285 if(fhIMCellCut->GetEntries() > 1){
4286 Int_t nebins = fhIMCellCut->GetNbinsX();
4287 Int_t emax = (Int_t) fhIMCellCut->GetXaxis()->GetXmax();
4288 Int_t emin = (Int_t) fhIMCellCut->GetXaxis()->GetXmin();
4289 if (emin != 0 ) printf("emin != 0 \n");
a6f26052 4290 //printf("IMCellCut: nBinsX %d, emin %2.2f, emax %2.2f\n",nebins,emin,emax);
a5fafd85 4291
164a1d84 4292 snprintf(cname,buffersize,"QA_%s_IMCellCut",fCalorimeter.Data());
a6f26052 4293 // printf("c5cc\n");
a5fafd85 4294 TCanvas * c5cc = new TCanvas(cname, "Invariant mass, Cell Cut", 600, 400) ;
4295 c5cc->Divide(2, 3);
4296
4297 c5cc->cd(1) ;
a6f26052 4298 //fhIMCellCut->SetLineColor(4);
4299 //fhIMCellCut->Draw();
255b904d 4300 imbinmin = 0;
4301 imbinmax = (Int_t) (1-emin)*nebins/emax;
4302 TH1D *pyimcc1 = fhIMCellCut->ProjectionY(Form("%s_py1",fhIMCellCut->GetName()),imbinmin,imbinmax);
a5fafd85 4303 pyimcc1->SetTitle("E_{pair} < 1 GeV");
4304 pyimcc1->SetLineColor(1);
4305 pyimcc1->Draw();
4306 TLegend pLegendIMCellCut(0.7,0.6,0.9,0.8);
4307 pLegendIMCellCut.SetTextSize(0.03);
4308 pLegendIMCellCut.AddEntry(pyimcc1,"all modules","L");
4309 pLegendIMCellCut.SetFillColor(10);
4310 pLegendIMCellCut.SetBorderSize(1);
255b904d 4311
a5fafd85 4312 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 4313 pyimcc1 = fhIMCellCutMod[imod]->ProjectionY(Form("%s_py1",fhIMCellCutMod[imod]->GetName()),imbinmin,imbinmax);
a5fafd85 4314 pLegendIMCellCut.AddEntry(pyimcc1,Form("module %d",imod),"L");
4315 pyimcc1->SetLineColor(imod+1);
4316 pyimcc1->Draw("same");
4317 }
4318 pLegendIMCellCut.Draw();
4319
4320 c5cc->cd(2) ;
255b904d 4321 imbinmin = (Int_t) (1-emin)*nebins/emax;
4322 imbinmax = (Int_t) (2-emin)*nebins/emax;
4323 TH1D *pyimcc2 = fhIMCellCut->ProjectionY(Form("%s_py2",fhIMCellCut->GetName()),imbinmin,imbinmax);
a5fafd85 4324 pyimcc2->SetTitle("1 < E_{pair} < 2 GeV");
4325 pyimcc2->SetLineColor(1);
4326 pyimcc2->Draw();
4327 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 4328 pyimcc2 = fhIMCellCutMod[imod]->ProjectionY(Form("%s_py1",fhIMCellCutMod[imod]->GetName()),imbinmin,imbinmax);
a5fafd85 4329 pyimcc2->SetLineColor(imod+1);
4330 pyimcc2->Draw("same");
4331 }
4332
4333 c5cc->cd(3) ;
255b904d 4334 imbinmin = (Int_t) (2-emin)*nebins/emax;
4335 imbinmax = (Int_t) (3-emin)*nebins/emax;
4336 TH1D *pyimcc3 = fhIMCellCut->ProjectionY(Form("%s_py3",fhIMCellCut->GetName()),imbinmin,imbinmax);
a5fafd85 4337 pyimcc3->SetTitle("2 < E_{pair} < 3 GeV");
4338 pyimcc3->SetLineColor(1);
4339 pyimcc3->Draw();
4340 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 4341 pyimcc3 = fhIMCellCutMod[imod]->ProjectionY(Form("%s_py1",fhIMCellCutMod[imod]->GetName()),imbinmin,imbinmax);
a5fafd85 4342 pyimcc3->SetLineColor(imod+1);
4343 pyimcc3->Draw("same");
4344 }
4345
4346 c5cc->cd(4) ;
255b904d 4347 imbinmin = (Int_t) (3-emin)*nebins/emax;
4348 imbinmax = (Int_t) (4-emin)*nebins/emax;
4349 TH1D *pyimcc4 = fhIMCellCut->ProjectionY(Form("%s_py4",fhIMCellCut->GetName()),imbinmin,imbinmax);
a5fafd85 4350 pyimcc4->SetTitle("3 < E_{pair} < 4 GeV");
4351 pyimcc4->SetLineColor(1);
4352 pyimcc4->Draw();
4353 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 4354 pyimcc4 = fhIMCellCutMod[imod]->ProjectionY(Form("%s_py5",fhIMCellCutMod[imod]->GetName()),imbinmin,imbinmax);
a5fafd85 4355 pyimcc4->SetLineColor(imod+1);
4356 pyimcc4->Draw("same");
4357 }
4358
4359 c5cc->cd(5) ;
255b904d 4360 imbinmin = (Int_t) (4-emin)*nebins/emax;
4361 imbinmax = (Int_t) (5-emin)*nebins/emax;
4362 TH1D *pyimcc5cc = fhIMCellCut->ProjectionY(Form("%s_py5",fhIMCellCut->GetName()),imbinmin,imbinmax);
a5fafd85 4363 pyimcc5cc->SetTitle("4< E_{pair} < 5 GeV");
4364 pyimcc5cc->SetLineColor(1);
4365 pyimcc5cc->Draw();
4366 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 4367 pyimcc5cc = fhIMCellCutMod[imod]->ProjectionY(Form("%s_py5",fhIMCellCutMod[imod]->GetName()),imbinmin,imbinmax);
a5fafd85 4368 pyimcc5cc->SetLineColor(imod+1);
4369 pyimcc5cc->Draw("same");
4370 }
4371
4372 c5cc->cd(6) ;
255b904d 4373 imbinmin = (Int_t) (5-emin)*nebins/emax;
4374 imbinmax = -1;
4375 TH1D *pyimcc10 = fhIMCellCut->ProjectionY(Form("%s_py6",fhIMCellCut->GetName()),imbinmin,imbinmax);
a5fafd85 4376 pyimcc10->SetTitle("E_{pair} > 5 GeV");
4377 pyimcc10->SetLineColor(1);
4378 pyimcc10->Draw();
4379 for(Int_t imod = 0; imod < fNModules; imod++){
255b904d 4380 pyimcc10 = fhIMCellCutMod[imod]->ProjectionY(Form("%s_py1",fhIMCellCutMod[imod]->GetName()),imbinmin,imbinmax);
a5fafd85 4381 pyimcc10->SetLineColor(imod+1);
4382 pyimcc10->Draw("same");
4383 }
4384
164a1d84 4385 snprintf(name,buffersize,"QA_%s_InvariantMass_CellCut.eps",fCalorimeter.Data());
a5fafd85 4386 c5cc->Print(name); printf("Plot: %s\n",name);
4387 }
4388
4389
a6f26052 4390 //Asymmetry
9725fd2a 4391 if(fhAsym->GetEntries() > 1){
4392 Int_t nebins = fhAsym->GetNbinsX();
4393 Int_t emax = (Int_t) fhAsym->GetXaxis()->GetXmax();
4394 Int_t emin = (Int_t) fhAsym->GetXaxis()->GetXmin();
4395 if (emin != 0 ) printf("emin != 0 \n");
a6f26052 4396 //printf("Asym: nBinsX %d, emin %2.2f, emax %2.2f\n",nebins,emin,emax);
9725fd2a 4397
164a1d84 4398 snprintf(cname,buffersize,"QA_%s_Asym",fCalorimeter.Data());
a6f26052 4399 // printf("c5\n");
9725fd2a 4400 TCanvas * c5b = new TCanvas(cname, "Asymmetry", 400, 400) ;
4401 c5b->Divide(2, 2);
4402
4403 c5b->cd(1) ;
06e5656a 4404 fhAsym->SetTitleOffset(1.6,"Y");
9725fd2a 4405 fhAsym->SetLineColor(4);
4406 fhAsym->Draw();
4407
4408 c5b->cd(2) ;
255b904d 4409 imbinmin = 0;
4410 imbinmax = (Int_t) (5-emin)*nebins/emax;
4411 TH1D *pyAsym5 = fhAsym->ProjectionY(Form("%s_py5",fhAsym->GetName()),imbinmin,imbinmax);
9725fd2a 4412 pyAsym5->SetTitle("E_{pair} < 5 GeV");
4413 pyAsym5->SetLineColor(4);
4414 pyAsym5->Draw();
4415
4416 c5b->cd(3) ;
255b904d 4417 imbinmin = (Int_t) (5-emin)*nebins/emax;
4418 imbinmax = (Int_t) (10-emin)*nebins/emax;
4419 TH1D *pyAsym510 = fhAsym->ProjectionY(Form("%s_py510",fhAsym->GetName()),imbinmin,imbinmax);
9725fd2a 4420 pyAsym510->SetTitle("5 < E_{pair} < 10 GeV");
4421 pyAsym510->SetLineColor(4);
4422 pyAsym510->Draw();
4423
4424 c5b->cd(4) ;
255b904d 4425 imbinmin = (Int_t) (10-emin)*nebins/emax;
4426 imbinmax = -1;
4427 TH1D *pyAsym10 = fhAsym->ProjectionY(Form("%s_py10",fhAsym->GetName()),imbinmin,imbinmax);
9725fd2a 4428 pyAsym10->SetTitle("E_{pair} > 10 GeV");
4429 pyAsym10->SetLineColor(4);
4430 pyAsym10->Draw();
4431
164a1d84 4432 snprintf(name,buffersize,"QA_%s_Asymmetry.eps",fCalorimeter.Data());
8a587055 4433 c5b->Print(name); printf("Plot: %s\n",name);
9725fd2a 4434 }
4435
a5fafd85 4436
8a587055 4437 if(IsDataMC()){
a6f26052 4438 //Reconstructed vs MC distributions
4439 //printf("c6\n");
164a1d84 4440 snprintf(cname,buffersize,"QA_%s_recvsmc",fCalorimeter.Data());
c8fe2783 4441 TCanvas * c6 = new TCanvas(cname, "Reconstructed vs MC distributions", 400, 400) ;
4442 c6->Divide(2, 2);
4443
4444 c6->cd(1) ;
4445 fh2E->SetTitleOffset(1.6,"Y");
4446 fh2E->SetLineColor(4);
4447 fh2E->Draw();
4448
4449 c6->cd(2) ;
4450 fh2Pt->SetTitleOffset(1.6,"Y");
4451 fh2Pt->SetLineColor(4);
4452 fh2Pt->Draw();
4453
4454 c6->cd(3) ;
4455 fh2Phi->SetTitleOffset(1.6,"Y");
4456 fh2Phi->SetLineColor(4);
4457 fh2Phi->Draw();
4458
4459 c6->cd(4) ;
4460 fh2Eta->SetTitleOffset(1.6,"Y");
4461 fh2Eta->SetLineColor(4);
4462 fh2Eta->Draw();
4463
164a1d84 4464 snprintf(name,buffersize,"QA_%s_ReconstructedVSMCDistributions.eps",fCalorimeter.Data());
c8fe2783 4465 c6->Print(name); printf("Plot: %s\n",name);
4466
a6f26052 4467 //Reconstructed vs MC distributions
4468 //printf("c6\n");
164a1d84 4469 snprintf(cname,buffersize,"QA_%s_gamrecvsmc",fCalorimeter.Data());
c8fe2783 4470 TCanvas * c6Gam = new TCanvas(cname, "Reconstructed vs MC distributions", 400, 400) ;
4471 c6Gam->Divide(2, 2);
4472
4473 c6Gam->cd(1) ;
4474 fhGamE->Draw();
4475
4476 c6Gam->cd(2) ;
4477 fhGamPt->Draw();
4478
4479 c6Gam->cd(3) ;
4480 fhGamPhi->Draw();
4481
4482 c6Gam->cd(4) ;
4483 fhGamEta->Draw();
4484
164a1d84 4485 snprintf(name,buffersize,"QA_%s_GammaReconstructedVSMCDistributions.eps",fCalorimeter.Data());
c8fe2783 4486 c6->Print(name); printf("Plot: %s\n",name);
4487
a6f26052 4488 //Generated - reconstructed
4489 //printf("c7\n");
164a1d84 4490 snprintf(cname,buffersize,"QA_%s_diffgenrec",fCalorimeter.Data());
c8fe2783 4491 TCanvas * c7 = new TCanvas(cname, "generated - reconstructed", 400, 400) ;
4492 c7->Divide(2, 2);
4493
4494 c7->cd(1) ;
4495 if(fhDeltaE->GetEntries() > 0) gPad->SetLogy();
4496 fhGamDeltaE->SetLineColor(4);
4497 fhDeltaE->Draw();
4498 fhGamDeltaE->Draw("same");
4499
4500 TLegend pLegendd(0.65,0.55,0.9,0.8);
4501 pLegendd.SetTextSize(0.06);
4502 pLegendd.AddEntry(fhDeltaE,"all","L");
4503 pLegendd.AddEntry(fhGamDeltaE,"from #gamma","L");
4504 pLegendd.SetFillColor(10);
4505 pLegendd.SetBorderSize(1);
4506 pLegendd.Draw();
4507
4508 c7->cd(2) ;
4509 if(fhDeltaPt->GetEntries() > 0) gPad->SetLogy();
4510 fhGamDeltaPt->SetLineColor(4);
4511 fhDeltaPt->Draw();
4512 fhGamDeltaPt->Draw("same");
4513
4514 c7->cd(3) ;
4515 fhGamDeltaPhi->SetLineColor(4);
4516 fhDeltaPhi->Draw();
4517 fhGamDeltaPhi->Draw("same");
4518
4519 c7->cd(4) ;
4520 fhGamDeltaEta->SetLineColor(4);
4521 fhDeltaEta->Draw();
4522 fhGamDeltaEta->Draw("same");
4523
164a1d84 4524 snprintf(name,buffersize,"QA_%s_DiffGeneratedReconstructed.eps",fCalorimeter.Data());
c8fe2783 4525 c7->Print(name); printf("Plot: %s\n",name);
4526
a6f26052 4527 // Reconstructed / Generated
4528 //printf("c8\n");
164a1d84 4529 snprintf(cname,buffersize,"QA_%s_ratiorecgen",fCalorimeter.Data());
c8fe2783 4530 TCanvas * c8 = new TCanvas(cname, " reconstructed / generated", 400, 400) ;
4531 c8->Divide(2, 2);
4532
4533 c8->cd(1) ;
4534 if(fhRatioE->GetEntries() > 0) gPad->SetLogy();
4535 fhGamRatioE->SetLineColor(4);
4536 fhRatioE->Draw();
4537 fhGamRatioE->Draw("same");
4538
4539 TLegend pLegendr(0.65,0.55,0.9,0.8);
4540 pLegendr.SetTextSize(0.06);
4541 pLegendr.AddEntry(fhRatioE,"all","L");
4542 pLegendr.AddEntry(fhGamRatioE,"from #gamma","L");
4543 pLegendr.SetFillColor(10);
4544 pLegendr.SetBorderSize(1);
4545 pLegendr.Draw();
4546
4547 c8->cd(2) ;
4548 if(fhRatioPt->GetEntries() > 0) gPad->SetLogy();
4549 fhGamRatioPt->SetLineColor(4);
4550 fhRatioPt->Draw();
4551 fhGamRatioPt->Draw("same");
4552
4553 c8->cd(3) ;
4554 fhGamRatioPhi->SetLineColor(4);
4555 fhRatioPhi->Draw();
4556 fhGamRatioPhi->Draw("same");
4557
4558 c8->cd(4) ;
4559 fhGamRatioEta->SetLineColor(4);
4560 fhRatioEta->Draw();
4561 fhGamRatioEta->Draw("same");
4562
164a1d84 4563 snprintf(name,buffersize,"QA_%s_ReconstructedDivGenerated.eps",fCalorimeter.Data());
c8fe2783 4564 c8->Print(name); printf("Plot: %s\n",name);
4565
a6f26052 4566 //MC
c8fe2783 4567
a6f26052 4568 //Generated distributions
4569 //printf("c1\n");
164a1d84 4570 snprintf(cname,buffersize,"QA_%s_gen",fCalorimeter.Data());
c8fe2783 4571 TCanvas * c10 = new TCanvas(cname, "Generated distributions", 600, 200) ;
4572 c10->Divide(3, 1);
4573
4574 c10->cd(1) ;
4575 gPad->SetLogy();
4576 TH1F * haxispt = (TH1F*) fhGenPi0Pt->Clone(Form("%s_axispt",fhGenPi0Pt->GetName()));
4577 haxispt->SetTitle("Generated Particles p_{T}, |#eta| < 1");
4578 fhGenPi0Pt->SetLineColor(1);
4579 fhGenGamPt->SetLineColor(4);
4580 fhGenEtaPt->SetLineColor(2);
4581 fhGenOmegaPt->SetLineColor(7);
4582 fhGenElePt->SetLineColor(6);
4583
a6f26052 4584 //Select the maximum of the histogram to show all lines.
c8fe2783 4585 if(fhGenPi0Pt->GetMaximum() >= fhGenGamPt->GetMaximum() && fhGenPi0Pt->GetMaximum() >= fhGenEtaPt->GetMaximum() &&
4586 fhGenPi0Pt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenPi0Pt->GetMaximum() >= fhGenElePt->GetMaximum())
4587 haxispt->SetMaximum(fhGenPi0Pt->GetMaximum());
4588 else if(fhGenGamPt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenGamPt->GetMaximum() >= fhGenEtaPt->GetMaximum() &&
4589 fhGenGamPt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenGamPt->GetMaximum() >= fhGenElePt->GetMaximum())
4590 haxispt->SetMaximum(fhGenGamPt->GetMaximum());
4591 else if(fhGenEtaPt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenEtaPt->GetMaximum() >= fhGenGamPt->GetMaximum() &&
4592 fhGenEtaPt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenEtaPt->GetMaximum() >= fhGenElePt->GetMaximum())
4593 haxispt->SetMaximum(fhGenEtaPt->GetMaximum());
4594 else if(fhGenOmegaPt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenOmegaPt->GetMaximum() >= fhGenEtaPt->GetMaximum() &&
4595 fhGenOmegaPt->GetMaximum() >= fhGenGamPt->GetMaximum() && fhGenOmegaPt->GetMaximum() >= fhGenElePt->GetMaximum())
4596 haxispt->SetMaximum(fhGenOmegaPt->GetMaximum());
4597 else if(fhGenElePt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenElePt->GetMaximum() >= fhGenEtaPt->GetMaximum() &&
4598 fhGenElePt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenElePt->GetMaximum() >= fhGenGamPt->GetMaximum())
4599 haxispt->SetMaximum(fhGenElePt->GetMaximum());
4600 haxispt->SetMinimum(1);
4601 haxispt->Draw("axis");
4602 fhGenPi0Pt->Draw("same");
4603 fhGenGamPt->Draw("same");
4604 fhGenEtaPt->Draw("same");
4605 fhGenOmegaPt->Draw("same");
4606 fhGenElePt->Draw("same");
4607
4608 TLegend pLegend(0.85,0.65,0.95,0.93);
4609 pLegend.SetTextSize(0.06);
4610 pLegend.AddEntry(fhGenPi0Pt," #pi^{0}","L");
4611 pLegend.AddEntry(fhGenGamPt," #gamma","L");
4612 pLegend.AddEntry(fhGenEtaPt," #eta","L");
4613 pLegend.AddEntry(fhGenOmegaPt," #omega","L");
4614 pLegend.AddEntry(fhGenElePt," e^{#pm}","L");
4615 pLegend.SetFillColor(10);
4616 pLegend.SetBorderSize(1);
4617 pLegend.Draw();
4618
4619 c10->cd(2) ;
4620 gPad->SetLogy();
4621 TH1F * haxiseta = (TH1F*) fhGenPi0Eta->Clone(Form("%s_axiseta",fhGenPi0Eta->GetName()));
4622 haxiseta->SetTitle("Generated Particles #eta, |#eta| < 1");
4623 fhGenPi0Eta->SetLineColor(1);
4624 fhGenGamEta->SetLineColor(4);
4625 fhGenEtaEta->SetLineColor(2);
4626 fhGenOmegaEta->SetLineColor(7);
4627 fhGenEleEta->SetLineColor(6);
a6f26052 4628 //Select the maximum of the histogram to show all lines.
c8fe2783 4629 if(fhGenPi0Eta->GetMaximum() >= fhGenGamEta->GetMaximum() && fhGenPi0Eta->GetMaximum() >= fhGenEtaEta->GetMaximum() &&
4630 fhGenPi0Eta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenPi0Eta->GetMaximum() >= fhGenEleEta->GetMaximum())
4631 haxiseta->SetMaximum(fhGenPi0Eta->GetMaximum());
4632 else if(fhGenGamEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenGamEta->GetMaximum() >= fhGenEtaEta->GetMaximum() &&
4633 fhGenGamEta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenGamEta->GetMaximum() >= fhGenEleEta->GetMaximum())
4634 haxiseta->SetMaximum(fhGenGamEta->GetMaximum());
4635 else if(fhGenEtaEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenEtaEta->GetMaximum() >= fhGenGamEta->GetMaximum() &&
4636 fhGenEtaEta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenEtaEta->GetMaximum() >= fhGenEleEta->GetMaximum())
4637 haxiseta->SetMaximum(fhGenEtaEta->GetMaximum());
4638 else if(fhGenOmegaEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenOmegaEta->GetMaximum() >= fhGenEtaEta->GetMaximum() &&
4639 fhGenOmegaEta->GetMaximum() >= fhGenGamEta->GetMaximum() && fhGenOmegaEta->GetMaximum() >= fhGenEleEta->GetMaximum())
4640 haxiseta->SetMaximum(fhGenOmegaEta->GetMaximum());
4641 else if(fhGenEleEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenEleEta->GetMaximum() >= fhGenEtaEta->GetMaximum() &&
4642 fhGenEleEta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenEleEta->GetMaximum() >= fhGenGamEta->GetMaximum())
4643 haxiseta->SetMaximum(fhGenEleEta->GetMaximum());
4644 haxiseta->SetMinimum(100);
4645 haxiseta->Draw("axis");
4646 fhGenPi0Eta->Draw("same");
4647 fhGenGamEta->Draw("same");
4648 fhGenEtaEta->Draw("same");
4649 fhGenOmegaEta->Draw("same");
4650 fhGenEleEta->Draw("same");
4651
4652
4653 c10->cd(3) ;
4654 gPad->SetLogy();
4655 TH1F * haxisphi = (TH1F*) fhGenPi0Phi->Clone(Form("%s_axisphi",fhGenPi0Phi->GetName()));
4656 haxisphi->SetTitle("Generated Particles #phi, |#eta| < 1");
4657 fhGenPi0Phi->SetLineColor(1);
4658 fhGenGamPhi->SetLineColor(4);
4659 fhGenEtaPhi->SetLineColor(2);
4660 fhGenOmegaPhi->SetLineColor(7);
4661 fhGenElePhi->SetLineColor(6);
a6f26052 4662 //Select the maximum of the histogram to show all lines.
c8fe2783 4663 if(fhGenPi0Phi->GetMaximum() >= fhGenGamPhi->GetMaximum() && fhGenPi0Phi->GetMaximum() >= fhGenEtaPhi->GetMaximum() &&
4664 fhGenPi0Phi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenPi0Phi->GetMaximum() >= fhGenElePhi->GetMaximum())
4665 haxisphi->SetMaximum(fhGenPi0Phi->GetMaximum());
4666 else if(fhGenGamPhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenGamPhi->GetMaximum() >= fhGenEtaPhi->GetMaximum() &&
4667 fhGenGamPhi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenGamPhi->GetMaximum() >= fhGenElePhi->GetMaximum())
4668 haxisphi->SetMaximum(fhGenGamPhi->GetMaximum());
4669 else if(fhGenEtaPhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenEtaPhi->GetMaximum() >= fhGenGamPhi->GetMaximum() &&
4670 fhGenEtaPhi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenEtaPhi->GetMaximum() >= fhGenElePhi->GetMaximum())
4671 haxisphi->SetMaximum(fhGenEtaPhi->GetMaximum());
4672 else if(fhGenOmegaPhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenOmegaPhi->GetMaximum() >= fhGenEtaPhi->GetMaximum() &&
4673 fhGenOmegaPhi->GetMaximum() >= fhGenGamPhi->GetMaximum() && fhGenOmegaPhi->GetMaximum() >= fhGenElePhi->GetMaximum())
4674 haxisphi->SetMaximum(fhGenOmegaPhi->GetMaximum());
4675 else if(fhGenElePhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenElePhi->GetMaximum() >= fhGenEtaPhi->GetMaximum() &&
4676 fhGenElePhi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenElePhi->GetMaximum() >= fhGenGamPhi->GetMaximum())
4677 haxisphi->SetMaximum(fhGenElePhi->GetMaximum());
4678 haxisphi->SetMinimum(100);
4679 haxisphi->Draw("axis");
4680 fhGenPi0Phi->Draw("same");
4681 fhGenGamPhi->Draw("same");
4682 fhGenEtaPhi->Draw("same");
4683 fhGenOmegaPhi->Draw("same");
4684 fhGenElePhi->Draw("same");
4685
164a1d84 4686 snprintf(name,buffersize,"QA_%s_GeneratedDistributions.eps",fCalorimeter.Data());
c8fe2783 4687 c10->Print(name); printf("Plot: %s\n",name);
4688
4689
a6f26052 4690 //Reconstructed clusters depending on its original particle.
4691 //printf("c1\n");
164a1d84 4692 snprintf(cname,buffersize,"QA_%s_recgenid",fCalorimeter.Data());
c8fe2783 4693 TCanvas * c11 = new TCanvas(cname, "Reconstructed particles, function of their original particle ID", 400, 400) ;
4694 c11->Divide(2, 2);
4695
4696
4697 c11->cd(1) ;
4698 gPad->SetLogy();
4699 TH1F * hGamE = (TH1F*) fhGamE->ProjectionX(Form("%s_px",fhGamE->GetName()),-1,-1);
4700 TH1F * hPi0E = (TH1F*) fhPi0E->ProjectionX(Form("%s_px",fhPi0E->GetName()),-1,-1);
4701 TH1F * hEleE = (TH1F*) fhEleE->ProjectionX(Form("%s_px",fhEleE->GetName()),-1,-1);
4702 TH1F * hNeHadE = (TH1F*) fhNeHadE->ProjectionX(Form("%s_px",fhNeHadE->GetName()),-1,-1);
4703 TH1F * hChHadE = (TH1F*) fhChHadE->ProjectionX(Form("%s_px",fhChHadE->GetName()),-1,-1);
4704 TH1F * haxisE = (TH1F*) hPi0E->Clone(Form("%s_axisE",fhPi0E->GetName()));
4705 haxisE->SetTitle("Reconstructed particles E, function of their original particle ID");
4706 hPi0E->SetLineColor(1);
4707 hGamE->SetLineColor(4);
4708 hNeHadE->SetLineColor(2);
4709 hChHadE->SetLineColor(7);
4710 hEleE->SetLineColor(6);
4711
a6f26052 4712 //Select the maximum of the histogram to show all lines.
c8fe2783 4713 if(hPi0E->GetMaximum() >= hGamE->GetMaximum() && hPi0E->GetMaximum() >= hNeHadE->GetMaximum() &&
4714 hPi0E->GetMaximum() >= hChHadE->GetMaximum() && hPi0E->GetMaximum() >= hEleE->GetMaximum())
4715 haxisE->SetMaximum(hPi0E->GetMaximum());
4716 else if(hGamE->GetMaximum() >= hPi0E->GetMaximum() && hGamE->GetMaximum() >= hNeHadE->GetMaximum() &&
4717 hGamE->GetMaximum() >= hChHadE->GetMaximum() && hGamE->GetMaximum() >= hEleE->GetMaximum())
4718 haxisE->SetMaximum(hGamE->GetMaximum());
4719 else if(hNeHadE->GetMaximum() >= hPi0E->GetMaximum() && hNeHadE->GetMaximum() >= hGamE->GetMaximum() &&
4720 hNeHadE->GetMaximum() >= hChHadE->GetMaximum() && hNeHadE->GetMaximum() >= hEleE->GetMaximum())
4721 haxisE->SetMaximum(hNeHadE->GetMaximum());
4722 else if(hChHadE->GetMaximum() >= hPi0E->GetMaximum() && hChHadE->GetMaximum() >= hNeHadE->GetMaximum() &&
4723 hChHadE->GetMaximum() >= hGamE->GetMaximum() && hChHadE->GetMaximum() >= hEleE->GetMaximum())
4724 haxisE->SetMaximum(hChHadE->GetMaximum());
4725 else if(hEleE->GetMaximum() >= hPi0E->GetMaximum() && hEleE->GetMaximum() >= hNeHadE->GetMaximum() &&
4726 hEleE->GetMaximum() >= hChHadE->GetMaximum() && hEleE->GetMaximum() >= hGamE->GetMaximum())
4727 haxisE->SetMaximum(hEleE->GetMaximum());
4728 haxisE->SetXTitle("E (GeV)");
4729 haxisE->SetMinimum(1);
4730 haxisE->Draw("axis");
4731 hPi0E->Draw("same");
4732 hGamE->Draw("same");
4733 hNeHadE->Draw("same");
4734 hChHadE->Draw("same");
4735 hEleE->Draw("same");
4736
4737 TLegend pLegend2(0.8,0.65,0.95,0.93);
4738 pLegend2.SetTextSize(0.06);
4739 pLegend2.AddEntry(hPi0E," #pi^{0}","L");
4740 pLegend2.AddEntry(hGamE," #gamma","L");
4741 pLegend2.AddEntry(hEleE," e^{#pm}","L");
4742 pLegend2.AddEntry(hChHadE," h^{#pm}","L");
4743 pLegend2.AddEntry(hNeHadE," h^{0}","L");
4744 pLegend2.SetFillColor(10);
4745 pLegend2.SetBorderSize(1);
4746 pLegend2.Draw();
4747
4748
4749 c11->cd(2) ;
4750 gPad->SetLogy();
a6f26052 4751 //printf("%s, %s, %s, %s, %s\n",fhGamPt->GetName(),fhPi0Pt->GetName(),fhElePt->GetName(),fhNeHadPt->GetName(), fhChHadPt->GetName());
c8fe2783 4752 TH1F * hGamPt = (TH1F*) fhGamPt->ProjectionX(Form("%s_px",fhGamPt->GetName()),-1,-1);
4753 TH1F * hPi0Pt = (TH1F*) fhPi0Pt->ProjectionX(Form("%s_px",fhPi0Pt->GetName()),-1,-1);
4754 TH1F * hElePt = (TH1F*) fhElePt->ProjectionX(Form("%s_px",fhElePt->GetName()),-1,-1);
4755 TH1F * hNeHadPt = (TH1F*) fhNeHadPt->ProjectionX(Form("%s_px",fhNeHadPt->GetName()),-1,-1);
4756 TH1F * hChHadPt = (TH1F*) fhChHadPt->ProjectionX(Form("%s_px",fhChHadPt->GetName()),-1,-1);
4757 haxispt = (TH1F*) hPi0Pt->Clone(Form("%s_axisPt",fhPi0Pt->GetName()));
4758 haxispt->SetTitle("Reconstructed particles p_{T}, function of their original particle ID");
4759 hPi0Pt->SetLineColor(1);
4760 hGamPt->SetLineColor(4);
4761 hNeHadPt->SetLineColor(2);
4762 hChHadPt->SetLineColor(7);
4763 hElePt->SetLineColor(6);
4764
a6f26052 4765 //Select the maximum of the histogram to show all lines.
c8fe2783 4766 if(hPi0Pt->GetMaximum() >= hGamPt->GetMaximum() && hPi0Pt->GetMaximum() >= hNeHadPt->GetMaximum() &&
4767 hPi0Pt->GetMaximum() >= hChHadPt->GetMaximum() && hPi0Pt->GetMaximum() >= hElePt->GetMaximum())
4768 haxispt->SetMaximum(hPi0Pt->GetMaximum());
4769 else if(hGamPt->GetMaximum() >= hPi0Pt->GetMaximum() && hGamPt->GetMaximum() >= hNeHadPt->GetMaximum() &&
4770 hGamPt->GetMaximum() >= hChHadPt->GetMaximum() && hGamPt->GetMaximum() >= hElePt->GetMaximum())
4771 haxispt->SetMaximum(hGamPt->GetMaximum());
4772 else if(hNeHadPt->GetMaximum() >= hPi0Pt->GetMaximum() && hNeHadPt->GetMaximum() >= hGamPt->GetMaximum() &&
4773 hNeHadPt->GetMaximum() >= hChHadPt->GetMaximum() && hNeHadPt->GetMaximum() >= hElePt->GetMaximum())
4774 haxispt->SetMaximum(hNeHadPt->GetMaximum());
4775 else if(hChHadPt->GetMaximum() >= hPi0Pt->GetMaximum() && hChHadPt->GetMaximum() >= hNeHadPt->GetMaximum() &&
4776 hChHadPt->GetMaximum() >= hGamPt->GetMaximum() && hChHadPt->GetMaximum() >= hElePt->GetMaximum())
4777 haxispt->SetMaximum(hChHadPt->GetMaximum());
4778 else if(hElePt->GetMaximum() >= hPi0Pt->GetMaximum() && hElePt->GetMaximum() >= hNeHadPt->GetMaximum() &&
4779 hElePt->GetMaximum() >= hChHadPt->GetMaximum() && hElePt->GetMaximum() >= hGamPt->GetMaximum())
4780 haxispt->SetMaximum(hElePt->GetMaximum());
4781 haxispt->SetXTitle("p_{T} (GeV/c)");
4782 haxispt->SetMinimum(1);
4783 haxispt->Draw("axis");
4784 hPi0Pt->Draw("same");
4785 hGamPt->Draw("same");
4786 hNeHadPt->Draw("same");
4787 hChHadPt->Draw("same");
4788 hElePt->Draw("same");
4789
4790 c11->cd(3) ;
4791 gPad->SetLogy();
4792
4793 TH1F * hGamEta = (TH1F*) fhGamEta->ProjectionX(Form("%s_px",fhGamEta->GetName()),-1,-1);
4794 TH1F * hPi0Eta = (TH1F*) fhPi0Eta->ProjectionX(Form("%s_px",fhPi0Eta->GetName()),-1,-1);
4795 TH1F * hEleEta = (TH1F*) fhEleEta->ProjectionX(Form("%s_px",fhEleEta->GetName()),-1,-1);
4796 TH1F * hNeHadEta = (TH1F*) fhNeHadEta->ProjectionX(Form("%s_px",fhNeHadEta->GetName()),-1,-1);
4797 TH1F * hChHadEta = (TH1F*) fhChHadEta->ProjectionX(Form("%s_px",fhChHadEta->GetName()),-1,-1);
4798 haxiseta = (TH1F*) hPi0Eta->Clone(Form("%s_axisEta",fhPi0Eta->GetName()));
4799 haxiseta->SetTitle("Reconstructed particles #eta, function of their original particle ID");
4800 hPi0Eta->SetLineColor(1);
4801 hGamEta->SetLineColor(4);
4802 hNeHadEta->SetLineColor(2);
4803 hChHadEta->SetLineColor(7);
4804 hEleEta->SetLineColor(6);
a6f26052 4805 //Select the maximum of the histogram to show all lines.
c8fe2783 4806 if(hPi0Eta->GetMaximum() >= hGamEta->GetMaximum() && hPi0Eta->GetMaximum() >= hNeHadEta->GetMaximum() &&
4807 hPi0Eta->GetMaximum() >= hChHadEta->GetMaximum() && hPi0Eta->GetMaximum() >= hEleEta->GetMaximum())
4808 haxiseta->SetMaximum(hPi0Eta->GetMaximum());
4809 else if(hGamEta->GetMaximum() >= hPi0Eta->GetMaximum() && hGamEta->GetMaximum() >= hNeHadEta->GetMaximum() &&
4810 hGamEta->GetMaximum() >= hChHadEta->GetMaximum() && hGamEta->GetMaximum() >= hEleEta->GetMaximum())
4811 haxiseta->SetMaximum(hGamEta->GetMaximum());
4812 else if(hNeHadEta->GetMaximum() >= hPi0Eta->GetMaximum() && hNeHadEta->GetMaximum() >= hGamEta->GetMaximum() &&
4813 hNeHadEta->GetMaximum() >= hChHadEta->GetMaximum() && hNeHadEta->GetMaximum() >= hEleEta->GetMaximum())
4814 haxiseta->SetMaximum(hNeHadEta->GetMaximum());
4815 else if(hChHadEta->GetMaximum() >= hPi0Eta->GetMaximum() && hChHadEta->GetMaximum() >= hNeHadEta->GetMaximum() &&
4816 hChHadEta->GetMaximum() >= hGamEta->GetMaximum() && hChHadEta->GetMaximum() >= hEleEta->GetMaximum())
4817 haxiseta->SetMaximum(hChHadEta->GetMaximum());
4818 else if(hEleEta->GetMaximum() >= hPi0Eta->GetMaximum() && hEleEta->GetMaximum() >= hNeHadEta->GetMaximum() &&
4819 hEleEta->GetMaximum() >= hChHadEta->GetMaximum() && hEleEta->GetMaximum() >= hGamEta->GetMaximum())
4820 haxiseta->SetMaximum(hEleEta->GetMaximum());
4821
4822 haxiseta->SetXTitle("#eta");
4823 haxiseta->Draw("axis");
4824 hPi0Eta->Draw("same");
4825 hGamEta->Draw("same");
4826 hNeHadEta->Draw("same");
4827 hChHadEta->Draw("same");
4828 hEleEta->Draw("same");
4829
4830
4831 c11->cd(4) ;
4832 gPad->SetLogy();
4833 TH1F * hGamPhi = (TH1F*) fhGamPhi->ProjectionX(Form("%s_px",fhGamPhi->GetName()),-1,-1);
4834 TH1F * hPi0Phi = (TH1F*) fhPi0Phi->ProjectionX(Form("%s_px",fhPi0Phi->GetName()),-1,-1);
4835 TH1F * hElePhi = (TH1F*) fhElePhi->ProjectionX(Form("%s_px",fhElePhi->GetName()),-1,-1);
4836 TH1F * hNeHadPhi = (TH1F*) fhNeHadPhi->ProjectionX(Form("%s_px",fhNeHadPhi->GetName()),-1,-1);
4837 TH1F * hChHadPhi = (TH1F*) fhChHadPhi->ProjectionX(Form("%s_px",fhChHadPhi->GetName()),-1,-1);
4838 haxisphi = (TH1F*) hPi0Phi->Clone(Form("%s_axisPhi",fhPi0Phi->GetName()));
4839 haxisphi->SetTitle("Reconstructed particles #phi, function of their original particle ID");
4840
4841 hPi0Phi->SetLineColor(1);
4842 hGamPhi->SetLineColor(4);
4843 hNeHadPhi->SetLineColor(2);
4844 hChHadPhi->SetLineColor(7);
4845 hElePhi->SetLineColor(6);
a6f26052 4846 //Select the maximum of the histogram to show all lines.
c8fe2783 4847 if(hPi0Phi->GetMaximum() >= hGamPhi->GetMaximum() && hPi0Phi->GetMaximum() >= hNeHadPhi->GetMaximum() &&
4848 hPi0Phi->GetMaximum() >= hChHadPhi->GetMaximum() && hPi0Phi->GetMaximum() >= hElePhi->GetMaximum())
4849 haxisphi->SetMaximum(hPi0Phi->GetMaximum());
4850 else if(hGamPhi->GetMaximum() >= hPi0Phi->GetMaximum() && hGamPhi->GetMaximum() >= hNeHadPhi->GetMaximum() &&
4851 hGamPhi->GetMaximum() >= hChHadPhi->GetMaximum() && hGamPhi->GetMaximum() >= hElePhi->GetMaximum())
4852 haxisphi->SetMaximum(hGamPhi->GetMaximum());
4853 else if(hNeHadPhi->GetMaximum() >= hPi0Phi->GetMaximum() && hNeHadPhi->GetMaximum() >= hGamPhi->GetMaximum() &&
4854 hNeHadPhi->GetMaximum() >= hChHadPhi->GetMaximum() && hNeHadPhi->GetMaximum() >= hElePhi->GetMaximum())
4855 haxisphi->SetMaximum(hNeHadPhi->GetMaximum());
4856 else if(hChHadPhi->GetMaximum() >= hPi0Phi->GetMaximum() && hChHadPhi->GetMaximum() >= hNeHadPhi->GetMaximum() &&
4857 hChHadPhi->GetMaximum() >= hGamPhi->GetMaximum() && hChHadPhi->GetMaximum() >= hElePhi->GetMaximum())
4858 haxisphi->SetMaximum(hChHadPhi->GetMaximum());
4859 else if(hElePhi->GetMaximum() >= hPi0Phi->GetMaximum() && hElePhi->GetMaximum() >= hNeHadPhi->GetMaximum() &&
4860 hElePhi->GetMaximum() >= hChHadPhi->GetMaximum() && hElePhi->GetMaximum() >= hGamPhi->GetMaximum())
4861 haxisphi->SetMaximum(hElePhi->GetMaximum());
4862 haxisphi->SetXTitle("#phi (rad)");
4863 haxisphi->Draw("axis");
4864 hPi0Phi->Draw("same");
4865 hGamPhi->Draw("same");
4866 hNeHadPhi->Draw("same");
4867 hChHadPhi->Draw("same");
4868 hElePhi->Draw("same");
4869
164a1d84 4870 snprintf(name,buffersize,"QA_%s_RecDistributionsGenID.eps",fCalorimeter.Data());
c8fe2783 4871 c11->Print(name); printf("Plot: %s\n",name);
4872
4873
a6f26052 4874 //Ratio reconstructed clusters / generated particles in acceptance, for different particle ID
4875 //printf("c1\n");
c8fe2783 4876
4877 TH1F * hPi0EClone = (TH1F*) hPi0E ->Clone(Form("%s_Clone",fhPi0E->GetName()));
4878 TH1F * hGamEClone = (TH1F*) hGamE ->Clone(Form("%s_Clone",fhGamE->GetName()));
4879 TH1F * hPi0PtClone = (TH1F*) hPi0Pt ->Clone(Form("%s_Clone",fhPi0Pt->GetName()));
4880 TH1F * hGamPtClone = (TH1F*) hGamPt ->Clone(Form("%s_Clone",fhGamPt->GetName()));
4881 TH1F * hPi0EtaClone = (TH1F*) hPi0Eta->Clone(Form("%s_Clone",fhPi0Eta->GetName()));
4882 TH1F * hGamEtaClone = (TH1F*) hGamEta->Clone(Form("%s_Clone",fhGamEta->GetName()));
4883 TH1F * hPi0PhiClone = (TH1F*) hPi0Phi->Clone(Form("%s_Clone",fhPi0Phi->GetName()));
4884 TH1F * hGamPhiClone = (TH1F*) hGamPhi->Clone(Form("%s_Clone",fhGamPhi->GetName()));
4885
164a1d84 4886 snprintf(cname,buffersize,"QA_%s_recgenidratio",fCalorimeter.Data());
c8fe2783 4887 TCanvas * c12 = new TCanvas(cname, "Ratio reconstructed clusters / generated particles in acceptance, for different particle ID", 400, 400) ;
4888 c12->Divide(2, 2);
4889
4890 c12->cd(1) ;
4891 gPad->SetLogy();
4892 haxisE->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID");
4893 hPi0EClone->Divide(fhGenPi0AccE);
4894 hGamEClone->Divide(fhGenGamAccE);
4895 haxisE->SetMaximum(5);
4896 haxisE->SetMinimum(1e-2);
4897 haxisE->SetXTitle("E (GeV)");
4898 haxisE->SetYTitle("ratio = rec/gen");
4899 haxisE->Draw("axis");
4900 hPi0E->Draw("same");
4901 hGamE->Draw("same");
4902
4903 TLegend pLegend3(0.75,0.2,0.9,0.4);
4904 pLegend3.SetTextSize(0.06);
4905 pLegend3.AddEntry(hPi0EClone," #pi^{0}","L");
4906 pLegend3.AddEntry(hGamEClone," #gamma","L");
4907 pLegend3.SetFillColor(10);
4908 pLegend3.SetBorderSize(1);
4909 pLegend3.Draw();
4910
4911 c12->cd(2) ;
4912 gPad->SetLogy();
4913 haxispt->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID");
4914 hPi0PtClone->Divide(fhGenPi0AccPt);
4915 hGamPtClone->Divide(fhGenGamAccPt);
4916 haxispt->SetMaximum(5);
4917 haxispt->SetMinimum(1e-2);
4918 haxispt->SetXTitle("p_{T} (GeV/c)");
4919 haxispt->SetYTitle("ratio = rec/gen");
4920 haxispt->Draw("axis");
4921 hPi0PtClone->Draw("same");
4922 hGamPtClone->Draw("same");
4923
4924 c12->cd(3) ;
4925 gPad->SetLogy();
4926
4927 haxiseta->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID");
4928 hPi0EtaClone->Divide(fhGenPi0AccEta);
4929 hGamEtaClone->Divide(fhGenGamAccEta);
4930 haxiseta->SetMaximum(1.2);
4931 haxiseta->SetMinimum(1e-2);
4932 haxiseta->SetYTitle("ratio = rec/gen");
4933 haxiseta->SetXTitle("#eta");
4934 haxiseta->Draw("axis");
4935 hPi0EtaClone->Draw("same");
4936 hGamEtaClone->Draw("same");
4937
4938
4939 c12->cd(4) ;
4940 gPad->SetLogy();
4941 haxisphi->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID");
4942 hPi0PhiClone->Divide(fhGenPi0AccPhi);
4943 hGamPhiClone->Divide(fhGenGamAccPhi);
4944 haxisphi->SetYTitle("ratio = rec/gen");
4945 haxisphi->SetXTitle("#phi (rad)");
4946 haxisphi->SetMaximum(1.2);
4947 haxisphi->SetMinimum(1e-2);
4948 haxisphi->Draw("axis");
4949 hPi0PhiClone->Draw("same");
4950 hGamPhiClone->Draw("same");
4951
164a1d84 4952 snprintf(name,buffersize,"QA_%s_EfficiencyGenID.eps",fCalorimeter.Data());
c8fe2783 4953 c12->Print(name); printf("Plot: %s\n",name);
4954
4955
4956
a6f26052 4957 //Reconstructed distributions
4958 //printf("c1\n");
164a1d84 4959 snprintf(cname,buffersize,"QA_%s_vertex",fCalorimeter.Data());
c8fe2783 4960 TCanvas * c13 = new TCanvas(cname, "Particle vertex", 400, 400) ;
4961 c13->Divide(2, 2);
4962
4963 c13->cd(1) ;
a6f26052 4964 //gPad->SetLogy();
c8fe2783 4965 fhEMVxyz->SetTitleOffset(1.6,"Y");
4966 fhEMVxyz->Draw();
4967
4968 c13->cd(2) ;
a6f26052 4969 //gPad->SetLogy();
c8fe2783 4970 fhHaVxyz->SetTitleOffset(1.6,"Y");
4971 fhHaVxyz->Draw();
4972
4973 c13->cd(3) ;
4974 gPad->SetLogy();
4975 TH1F * hEMR = (TH1F*) fhEMR->ProjectionY(Form("%s_py",fhEMR->GetName()),-1,-1);
4976 hEMR->SetLineColor(4);
4977 hEMR->Draw();
4978
4979 c13->cd(4) ;
4980 gPad->SetLogy();
4981 TH1F * hHaR = (TH1F*) fhHaR->ProjectionY(Form("%s_py",fhHaR->GetName()),-1,-1);
4982 hHaR->SetLineColor(4);
4983 hHaR->Draw();
4984
4985
164a1d84 4986 snprintf(name,buffersize,"QA_%s_ParticleVertex.eps",fCalorimeter.Data());
c8fe2783 4987 c13->Print(name); printf("Plot: %s\n",name);
4988
4989
a6f26052 4990 //Track-matching distributions
4991 if(fFillAllTH12){
c8fe2783 4992 //Reconstructed distributions, matched with tracks, generated particle dependence
4993 //printf("c2\n");
164a1d84 4994 snprintf(cname,buffersize,"QA_%s_rectrackmatchGenID",fCalorimeter.Data());
a6f26052 4995 TCanvas * c22ch = new TCanvas(cname, "Reconstructed distributions, matched with tracks, for different particle ID", 400, 400) ;
4996 c22ch->Divide(2, 2);
4997
4998 c22ch->cd(1) ;
4999
5000 TH1F * hGamECharged = (TH1F*) fhGamECharged->ProjectionX(Form("%s_px",fhGamECharged->GetName()),-1,-1);
5001 TH1F * hPi0ECharged = (TH1F*) fhPi0ECharged->ProjectionX(Form("%s_px",fhPi0ECharged->GetName()),-1,-1);
5002 TH1F * hEleECharged = (TH1F*) fhEleECharged->ProjectionX(Form("%s_px",fhEleECharged->GetName()),-1,-1);
5003 TH1F * hNeHadECharged = (TH1F*) fhNeHadECharged->ProjectionX(Form("%s_px",fhNeHadECharged->GetName()),-1,-1);
5004 TH1F * hChHadECharged = (TH1F*) fhChHadECharged->ProjectionX(Form("%s_px",fhChHadECharged->GetName()),-1,-1);
5005 hPi0ECharged->SetLineColor(1);
5006 hGamECharged->SetLineColor(4);
5007 hNeHadECharged->SetLineColor(2);
5008 hChHadECharged->SetLineColor(7);
5009 hEleECharged->SetLineColor(6);
5010 gPad->SetLogy();
5011 fhECharged->SetLineColor(3);
5012 fhECharged->SetMinimum(0.5);
5013 fhECharged->Draw();
5014 hPi0ECharged->Draw("same");
5015 hGamECharged->Draw("same");
5016 hNeHadECharged->Draw("same");
5017 hChHadECharged->Draw("same");
5018 hEleECharged->Draw("same");
5019 TLegend pLegend22(0.75,0.45,0.9,0.8);
5020 pLegend22.SetTextSize(0.06);
5021 pLegend22.AddEntry(fhECharged,"all","L");
5022 pLegend22.AddEntry(hPi0ECharged,"#pi^{0}","L");
5023 pLegend22.AddEntry(hGamECharged,"#gamma","L");
5024 pLegend22.AddEntry(hEleECharged,"e^{#pm}","L");
5025 pLegend22.AddEntry(hChHadECharged,"h^{#pm}","L");
5026 pLegend22.AddEntry(hNeHadECharged,"h^{0}","L");
5027 pLegend22.SetFillColor(10);
5028 pLegend22.SetBorderSize(1);
5029 pLegend22.Draw();
5030
5031 c22ch->cd(2) ;
5032
5033 TH1F * hGamPtCharged = (TH1F*) fhGamPtCharged->ProjectionX(Form("%s_px",fhGamPtCharged->GetName()),-1,-1);
5034 TH1F * hPi0PtCharged = (TH1F*) fhPi0PtCharged->ProjectionX(Form("%s_px",fhPi0PtCharged->GetName()),-1,-1);
5035 TH1F * hElePtCharged = (TH1F*) fhElePtCharged->ProjectionX(Form("%s_px",fhElePtCharged->GetName()),-1,-1);
5036 TH1F * hNeHadPtCharged = (TH1F*) fhNeHadPtCharged->ProjectionX(Form("%s_px",fhNeHadPtCharged->GetName()),-1,-1);
5037 TH1F * hChHadPtCharged = (TH1F*) fhChHadPtCharged->ProjectionX(Form("%s_px",fhChHadPtCharged->GetName()),-1,-1);
5038 hPi0PtCharged->SetLineColor(1);
5039 hGamPtCharged->SetLineColor(4);
5040 hNeHadPtCharged->SetLineColor(2);
5041 hChHadPtCharged->SetLineColor(7);
5042 hElePtCharged->SetLineColor(6);
5043 gPad->SetLogy();
5044 fhPtCharged->SetLineColor(3);
5045 fhPtCharged->SetMinimum(0.5);
5046 fhPtCharged->Draw();
5047 hPi0PtCharged->Draw("same");
5048 hGamPtCharged->Draw("same");
5049 hNeHadPtCharged->Draw("same");
5050 hChHadPtCharged->Draw("same");
5051 hElePtCharged->Draw("same");
5052
5053 c22ch->cd(4) ;
5054
5055 TH1F * hGamEtaCharged = (TH1F*) fhGamEtaCharged->ProjectionX(Form("%s_px",fhGamEtaCharged->GetName()),-1,-1);
5056 TH1F * hPi0EtaCharged = (TH1F*) fhPi0EtaCharged->ProjectionX(Form("%s_px",fhPi0EtaCharged->GetName()),-1,-1);
5057 TH1F * hEleEtaCharged = (TH1F*) fhEleEtaCharged->ProjectionX(Form("%s_px",fhEleEtaCharged->GetName()),-1,-1);
5058 TH1F * hNeHadEtaCharged = (TH1F*) fhNeHadEtaCharged->ProjectionX(Form("%s_px",fhNeHadEtaCharged->GetName()),-1,-1);
5059 TH1F * hChHadEtaCharged = (TH1F*) fhChHadEtaCharged->ProjectionX(Form("%s_px",fhChHadEtaCharged->GetName()),-1,-1);
5060 hPi0EtaCharged->SetLineColor(1);
5061 hGamEtaCharged->SetLineColor(4);
5062 hNeHadEtaCharged->SetLineColor(2);
5063 hChHadEtaCharged->SetLineColor(7);
5064 hEleEtaCharged->SetLineColor(6);
5065 gPad->SetLogy();
5066 fhEtaCharged->SetLineColor(3);
5067 fhEtaCharged->SetMinimum(0.5);
5068 fhEtaCharged->Draw();
5069 hPi0EtaCharged->Draw("same");
5070 hGamEtaCharged->Draw("same");
5071 hNeHadEtaCharged->Draw("same");
5072 hChHadEtaCharged->Draw("same");
5073 hEleEtaCharged->Draw("same");
5074
5075 c22ch->cd(3) ;
5076
5077 TH1F * hGamPhiCharged = (TH1F*) fhGamPhiCharged->ProjectionX(Form("%s_px",fhGamPhiCharged->GetName()),-1,-1);
5078 TH1F * hPi0PhiCharged = (TH1F*) fhPi0PhiCharged->ProjectionX(Form("%s_px",fhPi0PhiCharged->GetName()),-1,-1);
5079 TH1F * hElePhiCharged = (TH1F*) fhElePhiCharged->ProjectionX(Form("%s_px",fhElePhiCharged->GetName()),-1,-1);
5080 TH1F * hNeHadPhiCharged = (TH1F*) fhNeHadPhiCharged->ProjectionX(Form("%s_px",fhNeHadPhiCharged->GetName()),-1,-1);
5081 TH1F * hChHadPhiCharged = (TH1F*) fhChHadPhiCharged->ProjectionX(Form("%s_px",fhChHadPhiCharged->GetName()),-1,-1);
5082 hPi0PhiCharged->SetLineColor(1);
5083 hGamPhiCharged->SetLineColor(4);
5084 hNeHadPhiCharged->SetLineColor(2);
5085 hChHadPhiCharged->SetLineColor(7);
5086 hElePhiCharged->SetLineColor(6);
5087 gPad->SetLogy();
5088 fhPhiCharged->SetLineColor(3);
5089 fhPhiCharged->SetMinimum(0.5);
5090 fhPhiCharged->Draw();
5091 hPi0PhiCharged->Draw("same");
5092 hGamPhiCharged->Draw("same");
5093 hNeHadPhiCharged->Draw("same");
5094 hChHadPhiCharged->Draw("same");
5095 hElePhiCharged->Draw("same");
5096
5097
164a1d84 5098 snprintf(name,buffersize,"QA_%s_ReconstructedDistributions_TrackMatchedGenID.eps",fCalorimeter.Data());
a6f26052 5099 c22ch->Print(name); printf("Plot: %s\n",name);
5100
5101 TH1F * hGamEChargedClone = (TH1F*) hGamECharged->Clone(Form("%s_Clone",fhGamECharged->GetName()));
5102 TH1F * hGamPtChargedClone = (TH1F*) hGamPtCharged->Clone(Form("%s_Clone",fhGamPtCharged->GetName()));
5103 TH1F * hGamEtaChargedClone = (TH1F*) hGamEtaCharged->Clone(Form("%s_Clone",fhGamEtaCharged->GetName()));
5104 TH1F * hGamPhiChargedClone = (TH1F*) hGamPhiCharged->Clone(Form("%s_Clone",fhGamPhiCharged->GetName()));
5105
5106 TH1F * hPi0EChargedClone = (TH1F*) hPi0ECharged->Clone(Form("%s_Clone",fhPi0ECharged->GetName()));
5107 TH1F * hPi0PtChargedClone = (TH1F*) hPi0PtCharged->Clone(Form("%s_Clone",fhPi0PtCharged->GetName()));
5108 TH1F * hPi0EtaChargedClone = (TH1F*) hPi0EtaCharged->Clone(Form("%s_Clone",fhPi0EtaCharged->GetName()));
5109 TH1F * hPi0PhiChargedClone = (TH1F*) hPi0PhiCharged->Clone(Form("%s_Clone",fhPi0PhiCharged->GetName()));
5110
5111 TH1F * hEleEChargedClone = (TH1F*) hEleECharged->Clone(Form("%s_Clone",fhEleECharged->GetName()));
5112 TH1F * hElePtChargedClone = (TH1F*) hElePtCharged->Clone(Form("%s_Clone",fhElePtCharged->GetName()));
5113 TH1F * hEleEtaChargedClone = (TH1F*) hEleEtaCharged->Clone(Form("%s_Clone",fhEleEtaCharged->GetName()));
5114 TH1F * hElePhiChargedClone = (TH1F*) hElePhiCharged->Clone(Form("%s_Clone",fhElePhiCharged->GetName()));
5115
5116 TH1F * hNeHadEChargedClone = (TH1F*) hNeHadECharged->Clone(Form("%s_Clone",fhNeHadECharged->GetName()));
5117 TH1F * hNeHadPtChargedClone = (TH1F*) hNeHadPtCharged->Clone(Form("%s_Clone",fhNeHadPtCharged->GetName()));
5118 TH1F * hNeHadEtaChargedClone = (TH1F*) hNeHadEtaCharged->Clone(Form("%s_Clone",fhNeHadEtaCharged->GetName()));
5119 TH1F * hNeHadPhiChargedClone = (TH1F*) hNeHadPhiCharged->Clone(Form("%s_Clone",fhNeHadPhiCharged->GetName()));
5120
5121 TH1F * hChHadEChargedClone = (TH1F*) hChHadECharged->Clone(Form("%s_Clone",fhChHadECharged->GetName()));
5122 TH1F * hChHadPtChargedClone = (TH1F*) hChHadPtCharged->Clone(Form("%s_Clone",fhChHadPtCharged->GetName()));
5123 TH1F * hChHadEtaChargedClone = (TH1F*) hChHadEtaCharged->Clone(Form("%s_Clone",fhChHadEtaCharged->GetName()));
5124 TH1F * hChHadPhiChargedClone = (TH1F*) hChHadPhiCharged->Clone(Form("%s_Clone",fhChHadPhiCharged->GetName()));
5125
c8fe2783 5126 //Ratio: reconstructed track matched/ all reconstructed
5127 //printf("c3\n");
164a1d84 5128 snprintf(cname,buffersize,"QA_%s_rectrackmatchratGenID",fCalorimeter.Data());
a6f26052 5129 TCanvas * c3ch = new TCanvas(cname, "Ratio: reconstructed track matched/ all reconstructed, for different particle ID", 400, 400) ;
5130 c3ch->Divide(2, 2);
5131
5132 c3ch->cd(1) ;
5133 hEChargedClone->SetMaximum(1.2);
5134 hEChargedClone->SetMinimum(0.001);
5135 hEChargedClone->SetLineColor(3);
5136 hEChargedClone->SetYTitle("track matched / all");
5137 hPi0EChargedClone->Divide(hPi0E);
5138 hGamEChargedClone->Divide(hGamE);
5139 hEleEChargedClone->Divide(hEleE);
5140 hNeHadEChargedClone->Divide(hNeHadE);
5141 hChHadEChargedClone->Divide(hChHadE);
5142 hEChargedClone->Draw();
5143 hPi0EChargedClone->Draw("same");
5144 hGamEChargedClone->Draw("same");
5145 hEleEChargedClone->Draw("same");
5146 hNeHadEChargedClone->Draw("same");
5147 hChHadEChargedClone->Draw("same");
5148
5149 TLegend pLegend3ch(0.75,0.45,0.9,0.8);
5150 pLegend3ch.SetTextSize(0.06);
5151 pLegend3ch.AddEntry(hEChargedClone,"all","L");
5152 pLegend3ch.AddEntry(hPi0EChargedClone,"#pi^{0}","L");
5153 pLegend3ch.AddEntry(hGamEChargedClone,"#gamma","L");
5154 pLegend3ch.AddEntry(hEleEChargedClone,"e^{#pm}","L");
5155 pLegend3ch.AddEntry(hChHadEChargedClone,"h^{#pm}","L");
5156 pLegend3ch.AddEntry(hNeHadEChargedClone,"h^{0}","L");
5157 pLegend3ch.SetFillColor(10);
5158 pLegend3ch.SetBorderSize(1);
5159 pLegend3ch.Draw();
5160
5161 c3ch->cd(2) ;
5162 hPtChargedClone->SetMaximum(1.2);
5163 hPtChargedClone->SetMinimum(0.001);
5164 hPtChargedClone->SetLineColor(3);
5165 hPtChargedClone->SetYTitle("track matched / all");
5166 hPi0PtChargedClone->Divide(hPi0Pt);
5167 hGamPtChargedClone->Divide(hGamPt);
5168 hElePtChargedClone->Divide(hElePt);
5169 hNeHadPtChargedClone->Divide(hNeHadPt);
5170 hChHadPtChargedClone->Divide(hChHadPt);
5171 hPtChargedClone->Draw();
5172 hPi0PtChargedClone->Draw("same");
5173 hGamPtChargedClone->Draw("same");
5174 hElePtChargedClone->Draw("same");
5175 hNeHadPtChargedClone->Draw("same");
5176 hChHadPtChargedClone->Draw("same");
5177
5178 c3ch->cd(4) ;
5179 hEtaChargedClone->SetMaximum(1.2);
5180 hEtaChargedClone->SetMinimum(0.001);
5181 hEtaChargedClone->SetLineColor(3);
5182 hEtaChargedClone->SetYTitle("track matched / all");
5183 hPi0EtaChargedClone->Divide(hPi0Eta);
5184 hGamEtaChargedClone->Divide(hGamEta);
5185 hEleEtaChargedClone->Divide(hEleEta);
5186 hNeHadEtaChargedClone->Divide(hNeHadEta);
5187 hChHadEtaChargedClone->Divide(hChHadEta);
5188 hEtaChargedClone->Draw();
5189 hPi0EtaChargedClone->Draw("same");
5190 hGamEtaChargedClone->Draw("same");
5191 hEleEtaChargedClone->Draw("same");
5192 hNeHadEtaChargedClone->Draw("same");
5193 hChHadEtaChargedClone->Draw("same");
5194
5195 c3ch->cd(3) ;
5196 hPhiChargedClone->SetMaximum(1.2);
5197 hPhiChargedClone->SetMinimum(0.001);
5198 hPhiChargedClone->SetLineColor(3);
5199 hPhiChargedClone->SetYTitle("track matched / all");
5200 hPi0PhiChargedClone->Divide(hPi0Phi);
5201 hGamPhiChargedClone->Divide(hGamPhi);
5202 hElePhiChargedClone->Divide(hElePhi);
5203 hNeHadPhiChargedClone->Divide(hNeHadPhi);
5204 hChHadPhiChargedClone->Divide(hChHadPhi);
5205 hPhiChargedClone->Draw();
5206 hPi0PhiChargedClone->Draw("same");
5207 hGamPhiChargedClone->Draw("same");
5208 hElePhiChargedClone->Draw("same");
5209 hNeHadPhiChargedClone->Draw("same");
5210 hChHadPhiChargedClone->Draw("same");
5211
164a1d84 5212 snprintf(name,buffersize,"QA_%s_RatioReconstructedMatchedDistributionsGenID.eps",fCalorimeter.Data());
a6f26052 5213 c3ch->Print(name); printf("Plot: %s\n",name);
5214
5215 }
5216 }
5217 //Track-matching distributions
c8fe2783 5218
164a1d84 5219 snprintf(cname,buffersize,"QA_%s_trkmatch",fCalorimeter.Data());
6fa7d352 5220 TCanvas *cme = new TCanvas(cname,"Track-matching distributions", 400, 400);
5221 cme->Divide(2,2);
c8fe2783 5222
6fa7d352 5223 TLegend pLegendpE0(0.6,0.55,0.9,0.8);
5224 pLegendpE0.SetTextSize(0.04);
5225 pLegendpE0.AddEntry(fh1pOverE,"all","L");
5226 pLegendpE0.AddEntry(fh1pOverER02,"dR < 0.02","L");
5227 pLegendpE0.SetFillColor(10);
5228 pLegendpE0.SetBorderSize(1);
a6f26052 5229 //pLegendpE0.Draw();
c8fe2783 5230
6fa7d352 5231 cme->cd(1);
5232 if(fh1pOverE->GetEntries() > 0) gPad->SetLogy();
5233 fh1pOverE->SetTitle("Track matches p/E");
5234 fh1pOverE->Draw();
5235 fh1pOverER02->SetLineColor(4);
5236 fh1pOverER02->Draw("same");
5237 pLegendpE0.Draw();
c8fe2783 5238
6fa7d352 5239 cme->cd(2);
5240 if(fh1dR->GetEntries() > 0) gPad->SetLogy();
5241 fh1dR->Draw();
5242
5243 cme->cd(3);
5244 fh2MatchdEdx->Draw();
5245
5246 cme->cd(4);
5247 fh2EledEdx->Draw();
5248
164a1d84 5249 snprintf(name,buffersize,"QA_%s_TrackMatchingEleDist.eps",fCalorimeter.Data());
6fa7d352 5250 cme->Print(name); printf("Plot: %s\n",name);
5251
5252 if(IsDataMC()){
164a1d84 5253 snprintf(cname,buffersize,"QA_%s_trkmatchMCEle",fCalorimeter.Data());
c8fe2783 5254 TCanvas *cmemc = new TCanvas(cname,"Track-matching distributions from MC electrons", 600, 200);
5255 cmemc->Divide(3,1);
5256
5257 cmemc->cd(1);
5258 gPad->SetLogy();
5259 fhMCEle1pOverE->Draw();
5260 fhMCEle1pOverER02->SetLineColor(4);
5261 fhMCEle1pOverE->SetLineColor(1);
5262 fhMCEle1pOverER02->Draw("same");
5263 pLegendpE0.Draw();
5264
5265 cmemc->cd(2);
5266 gPad->SetLogy();
5267 fhMCEle1dR->Draw();
5268
5269 cmemc->cd(3);
5270 fhMCEle2MatchdEdx->Draw();
5271
164a1d84 5272 snprintf(name,buffersize,"QA_%s_TrackMatchingDistMCEle.eps",fCalorimeter.Data());
c8fe2783 5273 cmemc->Print(name); printf("Plot: %s\n",name);
5274
6fa7d352 5275
164a1d84 5276 snprintf(cname,buffersize,"QA_%s_trkmatchMCChHad",fCalorimeter.Data());
c8fe2783 5277 TCanvas *cmemchad = new TCanvas(cname,"Track-matching distributions from MC charged hadrons", 600, 200);
5278 cmemchad->Divide(3,1);
5279
5280 cmemchad->cd(1);
5281 gPad->SetLogy();
5282 fhMCChHad1pOverE->Draw();
5283 fhMCChHad1pOverER02->SetLineColor(4);
5284 fhMCChHad1pOverE->SetLineColor(1);
5285 fhMCChHad1pOverER02->Draw("same");
5286 pLegendpE0.Draw();
5287
5288 cmemchad->cd(2);
5289 gPad->SetLogy();
5290 fhMCChHad1dR->Draw();
5291
5292 cmemchad->cd(3);
5293 fhMCChHad2MatchdEdx->Draw();
6fa7d352 5294
164a1d84 5295 snprintf(name,buffersize,"QA_%s_TrackMatchingDistMCChHad.eps",fCalorimeter.Data());
c8fe2783 5296 cmemchad->Print(name); printf("Plot: %s\n",name);
5297
164a1d84 5298 snprintf(cname,buffersize,"QA_%s_trkmatchMCNeutral",fCalorimeter.Data());
c8fe2783 5299 TCanvas *cmemcn = new TCanvas(cname,"Track-matching distributions from MC neutrals", 600, 200);
5300 cmemcn->Divide(3,1);
5301
5302 cmemcn->cd(1);
5303 gPad->SetLogy();
5304 fhMCNeutral1pOverE->Draw();
5305 fhMCNeutral1pOverE->SetLineColor(1);
5306 fhMCNeutral1pOverER02->SetLineColor(4);
5307 fhMCNeutral1pOverER02->Draw("same");
5308 pLegendpE0.Draw();
5309
5310 cmemcn->cd(2);
5311 gPad->SetLogy();
5312 fhMCNeutral1dR->Draw();
5313
5314 cmemcn->cd(3);
5315 fhMCNeutral2MatchdEdx->Draw();
5316
164a1d84 5317 snprintf(name,buffersize,"QA_%s_TrackMatchingDistMCNeutral.eps",fCalorimeter.Data());
c8fe2783 5318 cmemcn->Print(name); printf("Plot: %s\n",name);
5319
164a1d84 5320 snprintf(cname,buffersize,"QA_%s_trkmatchpE",fCalorimeter.Data());
c8fe2783 5321 TCanvas *cmpoe = new TCanvas(cname,"Track-matching distributions, p/E", 400, 200);
5322 cmpoe->Divide(2,1);
5323
5324 cmpoe->cd(1);
5325 gPad->SetLogy();
5326 fh1pOverE->SetLineColor(1);
5327 fhMCEle1pOverE->SetLineColor(4);
5328 fhMCChHad1pOverE->SetLineColor(2);
5329 fhMCNeutral1pOverE->SetLineColor(7);
5330 fh1pOverER02->SetMinimum(0.5);
5331 fh1pOverE->Draw();
5332 fhMCEle1pOverE->Draw("same");
5333 fhMCChHad1pOverE->Draw("same");
5334 fhMCNeutral1pOverE->Draw("same");
5335 TLegend pLegendpE(0.65,0.55,0.9,0.8);
5336 pLegendpE.SetTextSize(0.06);
5337 pLegendpE.AddEntry(fh1pOverE,"all","L");
5338 pLegendpE.AddEntry(fhMCEle1pOverE,"e^{#pm}","L");
5339 pLegendpE.AddEntry(fhMCChHad1pOverE,"h^{#pm}","L");
5340 pLegendpE.AddEntry(fhMCNeutral1pOverE,"neutrals","L");
5341 pLegendpE.SetFillColor(10);
5342 pLegendpE.SetBorderSize(1);
5343 pLegendpE.Draw();
5344
5345 cmpoe->cd(2);
5346 gPad->SetLogy();
5347 fh1pOverER02->SetTitle("Track matches p/E, dR<0.2");
5348 fh1pOverER02->SetLineColor(1);
5349 fhMCEle1pOverER02->SetLineColor(4);
5350 fhMCChHad1pOverER02->SetLineColor(2);
5351 fhMCNeutral1pOverER02->SetLineColor(7);
5352 fh1pOverER02->SetMaximum(fh1pOverE->GetMaximum());
5353 fh1pOverER02->SetMinimum(0.5);
5354 fh1pOverER02->Draw();
5355 fhMCEle1pOverER02->Draw("same");
5356 fhMCChHad1pOverER02->Draw("same");
5357 fhMCNeutral1pOverER02->Draw("same");
5358
a6f26052 5359 // TLegend pLegendpE2(0.65,0.55,0.9,0.8);
5360 // pLegendpE2.SetTextSize(0.06);
5361 // pLegendpE2.SetHeader("dR < 0.02");
5362 // pLegendpE2.SetFillColor(10);
5363 // pLegendpE2.SetBorderSize(1);
5364 // pLegendpE2.Draw();
c8fe2783 5365
164a1d84 5366 snprintf(name,buffersize,"QA_%s_TrackMatchingPOverE.eps",fCalorimeter.Data());
c8fe2783 5367 cmpoe->Print(name); printf("Plot: %s\n",name);
9725fd2a 5368 }
06e5656a 5369
164a1d84 5370 char line[buffersize] ;
5371 snprintf(line, buffersize,".!tar -zcf QA_%s_%s.tar.gz *%s*.eps", fCalorimeter.Data(), GetName(),fCalorimeter.Data()) ;
9725fd2a 5372 gROOT->ProcessLine(line);
164a1d84 5373 snprintf(line, buffersize,".!rm -fR *.eps");
9725fd2a 5374 gROOT->ProcessLine(line);
5375
5376 printf("AliAnaCalorimeterQA::Terminate() - !! All the eps files are in QA_%s_%s.tar.gz !!!\n", fCalorimeter.Data(), GetName());
5377
5378}