]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/CaloTrackCorrelations/AliAnaElectron.cxx
Merge branch 'master' into TPCdev
[u/mrichter/AliRoot.git] / PWGGA / CaloTrackCorrelations / AliAnaElectron.cxx
CommitLineData
d9105d92 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 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 **************************************************************************/
d9105d92 15
16//_________________________________________________________________________
17//
18// Class for the photon identification.
19// Clusters from calorimeters are identified as photons
20// and kept in the AOD. Few histograms produced.
21// Copy of AliAnaPhoton just add electron id.
22//
23// -- Author: Gustavo Conesa (LPSC-IN2P3-CRNS)
24//////////////////////////////////////////////////////////////////////////////
25
26
27// --- ROOT system ---
28#include <TH2F.h>
29#include <TH3D.h>
30#include <TClonesArray.h>
31#include <TObjString.h>
32//#include <Riostream.h>
33#include "TParticle.h"
34#include "TDatabasePDG.h"
35#include "AliVTrack.h"
36
37// --- Analysis system ---
38#include "AliAnaElectron.h"
39#include "AliCaloTrackReader.h"
40#include "AliStack.h"
41#include "AliCaloPID.h"
42#include "AliMCAnalysisUtils.h"
43#include "AliFiducialCut.h"
44#include "AliVCluster.h"
45#include "AliAODMCParticle.h"
46#include "AliMixedEvent.h"
47
48
49ClassImp(AliAnaElectron)
50
78a28af3 51//________________________________
d9105d92 52AliAnaElectron::AliAnaElectron() :
764ab1f4 53 AliAnaCaloTrackCorrBaseClass(), fCalorimeter(""),
78a28af3 54 fMinDist(0.), fMinDist2(0.), fMinDist3(0.),
55 fTimeCutMin(-1), fTimeCutMax(999999),
7e9a1194 56 fNCellsCut(0), fNLMCutMin(-1), fNLMCutMax(10),
57 fFillSSHistograms(kFALSE), fFillOnlySimpleSSHisto(1),
78a28af3 58 fFillWeightHistograms(kFALSE), fNOriginHistograms(8),
59 fdEdxMin(0.), fdEdxMax (200.),
60 fEOverPMin(0), fEOverPMax (2),
764ab1f4 61 fAODParticle(0),
d9105d92 62 // Histograms
78a28af3 63 fhdEdxvsE(0), fhdEdxvsP(0),
64 fhEOverPvsE(0), fhEOverPvsP(0),
7e9a1194 65 fhdEdxvsECutM02(0), fhdEdxvsPCutM02(0),
66 fhEOverPvsECutM02(0), fhEOverPvsPCutM02(0),
67 fhdEdxvsECutEOverP(0), fhdEdxvsPCutEOverP(0),
68 fhEOverPvsECutM02CutdEdx(0), fhEOverPvsPCutM02CutdEdx(0),
78a28af3 69 // Weight studies
70 fhECellClusterRatio(0), fhECellClusterLogRatio(0),
71 fhEMaxCellClusterRatio(0), fhEMaxCellClusterLogRatio(0),
d9105d92 72 // MC histograms
73 // Electron SS MC histograms
74 fhMCElectronELambda0NoOverlap(0),
75 fhMCElectronELambda0TwoOverlap(0), fhMCElectronELambda0NOverlap(0),
76
77 //Embedding
78 fhEmbeddedSignalFractionEnergy(0),
79 fhEmbedElectronELambda0FullSignal(0), fhEmbedElectronELambda0MostlySignal(0),
80 fhEmbedElectronELambda0MostlyBkg(0), fhEmbedElectronELambda0FullBkg(0)
81{
82 //default ctor
34c16486 83 for(Int_t index = 0; index < 2; index++)
84 {
7e9a1194 85 fhNCellsE [index] = 0;
86 fhNLME [index] = 0;
87 fhTimeE [index] = 0;
d9105d92 88 fhMaxCellDiffClusterE[index] = 0;
992b14a7 89 fhE [index] = 0;
90 fhPt [index] = 0;
d9105d92 91 fhPhi [index] = 0;
92 fhEta [index] = 0;
93 fhEtaPhi [index] = 0;
94 fhEtaPhi05[index] = 0;
95
96 // Shower shape histograms
97 fhDispE [index] = 0;
98 fhLam0E [index] = 0;
99 fhLam1E [index] = 0;
100 fhDispETRD[index] = 0;
101 fhLam0ETRD[index] = 0;
102 fhLam1ETRD[index] = 0;
103 fhNCellsLam0LowE [index] = 0;
104 fhNCellsLam0HighE[index] = 0;
105 fhEtaLam0LowE [index] = 0;
106 fhPhiLam0LowE [index] = 0;
107 fhEtaLam0HighE [index] = 0;
108 fhPhiLam0HighE [index] = 0;
109
34c16486 110 fhDispEtaE [index] = 0;
111 fhDispPhiE [index] = 0;
112 fhSumEtaE [index] = 0;
113 fhSumPhiE [index] = 0;
114 fhSumEtaPhiE [index] = 0;
115 fhDispEtaPhiDiffE[index] = 0;
116 fhSphericityE [index] = 0;
117
118 for(Int_t i = 0; i < 10; i++)
119 {
d9105d92 120 fhMCPt [index][i] = 0;
121 fhMCE [index][i] = 0;
122 fhMCPhi [index][i] = 0;
123 fhMCEta [index][i] = 0;
124 fhMCDeltaE [index][i] = 0;
7e9a1194 125 fhMC2E [index][i] = 0;
126 fhMCdEdxvsE [i] = 0;
127 fhMCdEdxvsP [i] = 0;
128 fhMCEOverPvsE [i] = 0;
129 fhMCEOverPvsP [i] = 0;
d9105d92 130 }
131
34c16486 132 for(Int_t i = 0; i < 6; i++)
133 {
134 fhMCELambda0 [index][i] = 0;
135 fhMCEDispEta [index][i] = 0;
136 fhMCEDispPhi [index][i] = 0;
137 fhMCESumEtaPhi [index][i] = 0;
138 fhMCEDispEtaPhiDiff[index][i] = 0;
139 fhMCESphericity [index][i] = 0;
d9105d92 140 }
141
67616439 142 for(Int_t i = 0; i < 5; i++)
34c16486 143 {
144 fhDispEtaDispPhiEBin[index][i] = 0 ;
34c16486 145 }
d9105d92 146 }
78a28af3 147
148 //Weight studies
34c16486 149 for(Int_t i =0; i < 14; i++)
150 {
78a28af3 151 fhLambda0ForW0[i] = 0;
1a72f6c5 152 //fhLambda1ForW0[i] = 0;
78a28af3 153 }
154
d9105d92 155 //Initialize parameters
156 InitParameters();
157
158}
159
78a28af3 160//____________________________________________________________________________
7e9a1194 161Bool_t AliAnaElectron::ClusterSelected(AliVCluster* calo, TLorentzVector mom, Int_t nMaxima)
d9105d92 162{
163 //Select clusters if they pass different cuts
164 if(GetDebug() > 2)
165 printf("AliAnaElectron::ClusterSelected() Current Event %d; Before selection : E %2.2f, pT %2.2f, Ecl %2.2f, phi %2.2f, eta %2.2f\n",
166 GetReader()->GetEventNumber(),
167 mom.E(), mom.Pt(),calo->E(),mom.Phi()*TMath::RadToDeg(),mom.Eta());
168
169 //.......................................
170 //If too small or big energy, skip it
171 if(mom.E() < GetMinEnergy() || mom.E() > GetMaxEnergy() ) return kFALSE ;
172 if(GetDebug() > 2) printf("\t Cluster %d Pass E Cut \n",calo->GetID());
173
174 //.......................................
175 // TOF cut, BE CAREFUL WITH THIS CUT
176 Double_t tof = calo->GetTOF()*1e9;
177 if(tof < fTimeCutMin || tof > fTimeCutMax) return kFALSE;
178 if(GetDebug() > 2) printf("\t Cluster %d Pass Time Cut \n",calo->GetID());
179
180 //.......................................
181 if(calo->GetNCells() <= fNCellsCut && GetReader()->GetDataType() != AliCaloTrackReader::kMC) return kFALSE;
182 if(GetDebug() > 2) printf("\t Cluster %d Pass NCell Cut \n",calo->GetID());
183
184 //.......................................
185 //Check acceptance selection
186 if(IsFiducialCutOn()){
187 Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,fCalorimeter) ;
188 if(! in ) return kFALSE ;
189 }
190 if(GetDebug() > 2) printf("Fiducial cut passed \n");
191
192 //.......................................
193 //Skip not matched clusters with tracks
49b5c49b 194 if(!IsTrackMatched(calo, GetReader()->GetInputEvent())) {
d9105d92 195 if(GetDebug() > 2) printf("\t Reject non track-matched clusters\n");
196 return kFALSE ;
197 }
198 else if(GetDebug() > 2) printf(" Track-matching cut passed \n");
199
7e9a1194 200 //...........................................
201 // skip clusters with too many maxima
202 if(nMaxima < fNLMCutMin || nMaxima > fNLMCutMax) return kFALSE ;
203 if(GetDebug() > 2) printf(" \t Cluster %d pass NLM %d of out of range \n",calo->GetID(), nMaxima);
204
d9105d92 205 //.......................................
206 //Check Distance to Bad channel, set bit.
207 Double_t distBad=calo->GetDistanceToBadChannel() ; //Distance to bad channel
208 if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ;
209 if(distBad < fMinDist) {//In bad channel (PHOS cristal size 2.2x2.2 cm), EMCAL ( cell units )
210 return kFALSE ;
211 }
212 else if(GetDebug() > 2) printf("\t Bad channel cut passed %4.2f > %2.2f \n",distBad, fMinDist);
213 //printf("Cluster %d Pass Bad Dist Cut \n",icalo);
214
215 if(GetDebug() > 0)
216 printf("AliAnaElectron::ClusterSelected() Current Event %d; After selection : E %2.2f, pT %2.2f, Ecl %2.2f, phi %2.2f, eta %2.2f\n",
217 GetReader()->GetEventNumber(),
218 mom.E(), mom.Pt(),calo->E(),mom.Phi()*TMath::RadToDeg(),mom.Eta());
219
220 //All checks passed, cluster selected
221 return kTRUE;
222
223}
224
b94e038e 225//______________________________________________________________________________________________
226void AliAnaElectron::FillShowerShapeHistograms(AliVCluster* cluster, Int_t mcTag, Int_t pidTag)
78a28af3 227{
d9105d92 228
229 //Fill cluster Shower Shape histograms
230
231 if(!fFillSSHistograms || GetMixedEvent()) return;
232
233 Int_t pidIndex = 0;// Electron
234 if (pidTag == AliCaloPID::kElectron) pidIndex = 0;
235 else if(pidTag == AliCaloPID::kChargedHadron) pidIndex = 1;
236 else return;
237
238 Float_t energy = cluster->E();
239 Int_t ncells = cluster->GetNCells();
240 Float_t lambda0 = cluster->GetM02();
241 Float_t lambda1 = cluster->GetM20();
242 Float_t disp = cluster->GetDispersion()*cluster->GetDispersion();
243
764ab1f4 244 Float_t l0 = 0., l1 = 0.;
245 Float_t dispp= 0., dEta = 0., dPhi = 0.;
246 Float_t sEta = 0., sPhi = 0., sEtaPhi = 0.;
247
d9105d92 248 TLorentzVector mom;
34c16486 249 if(GetReader()->GetDataType() != AliCaloTrackReader::kMC)
250 {
d9105d92 251 cluster->GetMomentum(mom,GetVertex(0)) ;}//Assume that come from vertex in straight line
252 else{
253 Double_t vertex[]={0,0,0};
254 cluster->GetMomentum(mom,vertex) ;
255 }
256
257 Float_t eta = mom.Eta();
258 Float_t phi = mom.Phi();
259 if(phi < 0) phi+=TMath::TwoPi();
260
261 fhLam0E[pidIndex] ->Fill(energy,lambda0);
262 fhLam1E[pidIndex] ->Fill(energy,lambda1);
263 fhDispE[pidIndex] ->Fill(energy,disp);
264
34c16486 265 if(fCalorimeter == "EMCAL" && GetModuleNumber(cluster) > 5)
266 {
d9105d92 267 fhLam0ETRD[pidIndex]->Fill(energy,lambda0);
268 fhLam1ETRD[pidIndex]->Fill(energy,lambda1);
269 fhDispETRD[pidIndex]->Fill(energy,disp);
270 }
271
764ab1f4 272 if(!fFillOnlySimpleSSHisto)
34c16486 273 {
764ab1f4 274 if(energy < 2)
275 {
276 fhNCellsLam0LowE[pidIndex] ->Fill(ncells,lambda0);
277 fhEtaLam0LowE[pidIndex] ->Fill(eta, lambda0);
278 fhPhiLam0LowE[pidIndex] ->Fill(phi, lambda0);
279 }
280 else
281 {
282 fhNCellsLam0HighE[pidIndex]->Fill(ncells,lambda0);
283 fhEtaLam0HighE[pidIndex] ->Fill(eta, lambda0);
284 fhPhiLam0HighE[pidIndex] ->Fill(phi, lambda0);
285 }
d9105d92 286
764ab1f4 287 if(fCalorimeter == "EMCAL")
288 {
289 GetCaloUtils()->GetEMCALRecoUtils()->RecalculateClusterShowerShapeParameters(GetEMCALGeometry(), GetReader()->GetInputEvent()->GetEMCALCells(), cluster,
290 l0, l1, dispp, dEta, dPhi, sEta, sPhi, sEtaPhi);
291 fhDispEtaE [pidIndex]-> Fill(energy,dEta);
292 fhDispPhiE [pidIndex]-> Fill(energy,dPhi);
293 fhSumEtaE [pidIndex]-> Fill(energy,sEta);
294 fhSumPhiE [pidIndex]-> Fill(energy,sPhi);
295 fhSumEtaPhiE [pidIndex]-> Fill(energy,sEtaPhi);
296 fhDispEtaPhiDiffE [pidIndex]-> Fill(energy,dPhi-dEta);
297 if(dEta+dPhi>0)fhSphericityE [pidIndex]-> Fill(energy,(dPhi-dEta)/(dEta+dPhi));
298
299 if (energy < 2 ) fhDispEtaDispPhiEBin[pidIndex][0]->Fill(dEta,dPhi);
300 else if (energy < 4 ) fhDispEtaDispPhiEBin[pidIndex][1]->Fill(dEta,dPhi);
301 else if (energy < 6 ) fhDispEtaDispPhiEBin[pidIndex][2]->Fill(dEta,dPhi);
302 else if (energy < 10) fhDispEtaDispPhiEBin[pidIndex][3]->Fill(dEta,dPhi);
303 else fhDispEtaDispPhiEBin[pidIndex][4]->Fill(dEta,dPhi);
304
305 }
34c16486 306 }
307
308 if(IsDataMC())
309 {
d9105d92 310 AliVCaloCells* cells = 0;
311 if(fCalorimeter == "EMCAL") cells = GetEMCALCells();
312 else cells = GetPHOSCells();
313
314 //Fill histograms to check shape of embedded clusters
315 Float_t fraction = 0;
316 if(GetReader()->IsEmbeddedClusterSelectionOn()){//Only working for EMCAL
317
318 Float_t clusterE = 0; // recalculate in case corrections applied.
319 Float_t cellE = 0;
320 for(Int_t icell = 0; icell < cluster->GetNCells(); icell++){
321 cellE = cells->GetCellAmplitude(cluster->GetCellAbsId(icell));
322 clusterE+=cellE;
323 fraction+=cellE*cluster->GetCellAmplitudeFraction(icell);
324 }
325
326 //Fraction of total energy due to the embedded signal
327 fraction/=clusterE;
328
329 if(GetDebug() > 1 ) printf("AliAnaElectron::FillShowerShapeHistogram() - Energy fraction of embedded signal %2.3f, Energy %2.3f\n",fraction, clusterE);
330
331 fhEmbeddedSignalFractionEnergy->Fill(clusterE,fraction);
332
333 } // embedded fraction
334
d9105d92 335 // Check the origin and fill histograms
ecdde216 336 Int_t index = -1;
337
338 if( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCPhoton) &&
d9105d92 339 !GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCConversion) &&
340 !GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCPi0) &&
34c16486 341 !GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCEta))
342 {
343 index = kmcssPhoton;
d9105d92 344
345 }//photon no conversion
346 else if ( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCElectron &&
34c16486 347 !GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCConversion)))
348 {
349 index = kmcssElectron;
d9105d92 350
34c16486 351 if(!GetReader()->IsEmbeddedClusterSelectionOn())
352 {
d9105d92 353 //Check particle overlaps in cluster
354
355 //Compare the primary depositing more energy with the rest, if no photon/electron as comon ancestor (conversions), count as other particle
356 Int_t ancPDG = 0, ancStatus = -1;
357 TLorentzVector momentum; TVector3 prodVertex;
358 Int_t ancLabel = 0;
359 Int_t noverlaps = 1;
360 for (UInt_t ilab = 0; ilab < cluster->GetNLabels(); ilab++ ) {
361 ancLabel = GetMCAnalysisUtils()->CheckCommonAncestor(cluster->GetLabels()[0],cluster->GetLabels()[ilab], GetReader(),ancPDG,ancStatus,momentum,prodVertex);
362 if(ancPDG!=22 && TMath::Abs(ancPDG)!=11) noverlaps++;
363 }
364
365 if(noverlaps == 1){
366 fhMCElectronELambda0NoOverlap ->Fill(energy, lambda0);
367 }
368 else if(noverlaps == 2){
369 fhMCElectronELambda0TwoOverlap ->Fill(energy, lambda0);
370 }
371 else if(noverlaps > 2){
372 fhMCElectronELambda0NOverlap ->Fill(energy, lambda0);
373 }
374 else {
ecdde216 375 printf("AliAnaElectron::FillShowerShapeHistogram() - n overlaps = %d for ancestor %d!!", noverlaps, ancLabel);
d9105d92 376 }
377 }//No embedding
378
379 //Fill histograms to check shape of embedded clusters
34c16486 380 if(GetReader()->IsEmbeddedClusterSelectionOn())
381 {
d9105d92 382 if (fraction > 0.9)
383 {
384 fhEmbedElectronELambda0FullSignal ->Fill(energy, lambda0);
385 }
386 else if(fraction > 0.5)
387 {
388 fhEmbedElectronELambda0MostlySignal ->Fill(energy, lambda0);
389 }
390 else if(fraction > 0.1)
391 {
392 fhEmbedElectronELambda0MostlyBkg ->Fill(energy, lambda0);
393 }
394 else
395 {
396 fhEmbedElectronELambda0FullBkg ->Fill(energy, lambda0);
397 }
398 } // embedded
399 }//electron
400 else if ( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCElectron) &&
34c16486 401 GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCConversion) )
402 {
403 index = kmcssConversion;
d9105d92 404 }//conversion photon
34c16486 405 else if ( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCPi0) )
406 {
407 index = kmcssPi0;
d9105d92 408 }//pi0
34c16486 409 else if ( GetMCAnalysisUtils()->CheckTagBit(mcTag,AliMCAnalysisUtils::kMCEta) )
410 {
411 index = kmcssEta;
d9105d92 412 }//eta
34c16486 413 else
414 {
415 index = kmcssOther;
d9105d92 416 }//other particles
417
34c16486 418 fhMCELambda0[pidIndex][index] ->Fill(energy, lambda0);
419
764ab1f4 420 if(fCalorimeter == "EMCAL" && !fFillOnlySimpleSSHisto)
34c16486 421 {
422 fhMCEDispEta [pidIndex][index]-> Fill(energy,dEta);
423 fhMCEDispPhi [pidIndex][index]-> Fill(energy,dPhi);
424 fhMCESumEtaPhi [pidIndex][index]-> Fill(energy,sEtaPhi);
425 fhMCEDispEtaPhiDiff [pidIndex][index]-> Fill(energy,dPhi-dEta);
ecdde216 426 if(dEta+dPhi>0)fhMCESphericity [pidIndex][index]-> Fill(energy,(dPhi-dEta)/(dEta+dPhi));
34c16486 427 }
428
d9105d92 429 }//MC data
430
431}
432
78a28af3 433//_____________________________________________
d9105d92 434TObjString * AliAnaElectron::GetAnalysisCuts()
435{
436 //Save parameters used for analysis
437 TString parList ; //this will be list of parameters used for this analysis.
438 const Int_t buffersize = 255;
439 char onePar[buffersize] ;
440
441 snprintf(onePar,buffersize,"--- AliAnaElectron ---\n") ;
442 parList+=onePar ;
443 snprintf(onePar,buffersize,"Calorimeter: %s\n",fCalorimeter.Data()) ;
444 parList+=onePar ;
445 snprintf(onePar,buffersize," %2.2f < dEdx < %2.2f \n",fdEdxMin,fdEdxMax) ;
446 parList+=onePar ;
447 snprintf(onePar,buffersize," %2.2f < E/P < %2.2f \n",fEOverPMin, fEOverPMax) ;
448 parList+=onePar ;
449 snprintf(onePar,buffersize,"fMinDist =%2.2f (Minimal distance to bad channel to accept cluster) \n",fMinDist) ;
450 parList+=onePar ;
451 snprintf(onePar,buffersize,"fMinDist2=%2.2f (Cuts on Minimal distance to study acceptance evaluation) \n",fMinDist2) ;
452 parList+=onePar ;
453 snprintf(onePar,buffersize,"fMinDist3=%2.2f (One more cut on distance used for acceptance-efficiency study) \n",fMinDist3) ;
454 parList+=onePar ;
455
456 //Get parameters set in base class.
457 parList += GetBaseParametersList() ;
458
459 //Get parameters set in PID class.
460 parList += GetCaloPID()->GetPIDParametersList() ;
461
462 //Get parameters set in FiducialCut class (not available yet)
7e9a1194 463 //parlist += GetFidCut()->GetFidCutParametersList()
d9105d92 464
465 return new TObjString(parList) ;
466}
467
78a28af3 468//_______________________________________________
d9105d92 469TList * AliAnaElectron::GetCreateOutputObjects()
470{
471 // Create histograms to be saved in output file and
472 // store them in outputContainer
473 TList * outputContainer = new TList() ;
474 outputContainer->SetName("ElectronHistos") ;
475
745913ae 476 Int_t nptbins = GetHistogramRanges()->GetHistoPtBins(); Float_t ptmax = GetHistogramRanges()->GetHistoPtMax(); Float_t ptmin = GetHistogramRanges()->GetHistoPtMin();
477 Int_t nphibins = GetHistogramRanges()->GetHistoPhiBins(); Float_t phimax = GetHistogramRanges()->GetHistoPhiMax(); Float_t phimin = GetHistogramRanges()->GetHistoPhiMin();
478 Int_t netabins = GetHistogramRanges()->GetHistoEtaBins(); Float_t etamax = GetHistogramRanges()->GetHistoEtaMax(); Float_t etamin = GetHistogramRanges()->GetHistoEtaMin();
479 Int_t ssbins = GetHistogramRanges()->GetHistoShowerShapeBins(); Float_t ssmax = GetHistogramRanges()->GetHistoShowerShapeMax(); Float_t ssmin = GetHistogramRanges()->GetHistoShowerShapeMin();
480 Int_t nbins = GetHistogramRanges()->GetHistoNClusterCellBins(); Int_t nmax = GetHistogramRanges()->GetHistoNClusterCellMax(); Int_t nmin = GetHistogramRanges()->GetHistoNClusterCellMin();
481 Int_t ndedxbins = GetHistogramRanges()->GetHistodEdxBins(); Float_t dedxmax = GetHistogramRanges()->GetHistodEdxMax(); Float_t dedxmin = GetHistogramRanges()->GetHistodEdxMin();
482 Int_t nPoverEbins = GetHistogramRanges()->GetHistoPOverEBins(); Float_t pOverEmax = GetHistogramRanges()->GetHistoPOverEMax(); Float_t pOverEmin = GetHistogramRanges()->GetHistoPOverEMin();
483 Int_t tbins = GetHistogramRanges()->GetHistoTimeBins() ; Float_t tmax = GetHistogramRanges()->GetHistoTimeMax(); Float_t tmin = GetHistogramRanges()->GetHistoTimeMin();
d9105d92 484
7e9a1194 485
486 // MC labels, titles, for originator particles
487 TString ptypess[] = { "#gamma","hadron?","#pi^{0}","#eta","#gamma->e^{#pm}","e^{#pm}"} ;
488 TString pnamess[] = { "Photon","Hadron" ,"Pi0" ,"Eta" ,"Conversion" ,"Electron"} ;
489 TString ptype[] = { "#gamma", "#gamma_{#pi decay}","#gamma_{other decay}", "#pi^{0}","#eta",
490 "e^{#pm}","#gamma->e^{#pm}","hadron?","Anti-N","Anti-P" } ;
491
492 TString pname[] = { "Photon","PhotonPi0Decay","PhotonOtherDecay","Pi0","Eta","Electron",
493 "Conversion", "Hadron", "AntiNeutron","AntiProton" } ;
494
495
496 fhdEdxvsE = new TH2F ("hdEdxvsE","matched track <dE/dx> vs cluster E ", nptbins,ptmin,ptmax,ndedxbins, dedxmin, dedxmax);
d9105d92 497 fhdEdxvsE->SetXTitle("E (GeV)");
498 fhdEdxvsE->SetYTitle("<dE/dx>");
499 outputContainer->Add(fhdEdxvsE);
500
501 fhdEdxvsP = new TH2F ("hdEdxvsP","matched track <dE/dx> vs track P ", nptbins,ptmin,ptmax,ndedxbins, dedxmin, dedxmax);
502 fhdEdxvsP->SetXTitle("P (GeV/c)");
503 fhdEdxvsP->SetYTitle("<dE/dx>");
504 outputContainer->Add(fhdEdxvsP);
505
506 fhEOverPvsE = new TH2F ("hEOverPvsE","matched track E/p vs cluster E ", nptbins,ptmin,ptmax,nPoverEbins,pOverEmin,pOverEmax);
507 fhEOverPvsE->SetXTitle("E (GeV)");
508 fhEOverPvsE->SetYTitle("E/p");
509 outputContainer->Add(fhEOverPvsE);
510
511 fhEOverPvsP = new TH2F ("hEOverPvsP","matched track E/p vs track P ", nptbins,ptmin,ptmax,nPoverEbins,pOverEmin,pOverEmax);
512 fhEOverPvsP->SetXTitle("P (GeV/c)");
513 fhEOverPvsP->SetYTitle("E/p");
514 outputContainer->Add(fhEOverPvsP);
515
516
7e9a1194 517 fhdEdxvsECutM02 = new TH2F ("hdEdxvsECutM02","matched track <dE/dx> vs cluster E, mild #lambda_{0}^{2} cut", nptbins,ptmin,ptmax,ndedxbins, dedxmin, dedxmax);
518 fhdEdxvsECutM02->SetXTitle("E (GeV)");
519 fhdEdxvsECutM02->SetYTitle("<dE/dx>");
520 outputContainer->Add(fhdEdxvsECutM02);
521
522 fhdEdxvsPCutM02 = new TH2F ("hdEdxvsPCutM02","matched track <dE/dx> vs track P, mild #lambda_{0}^{2} cut", nptbins,ptmin,ptmax,ndedxbins, dedxmin, dedxmax);
523 fhdEdxvsPCutM02->SetXTitle("P (GeV/c)");
524 fhdEdxvsPCutM02->SetYTitle("<dE/dx>");
525 outputContainer->Add(fhdEdxvsPCutM02);
526
527 fhEOverPvsECutM02 = new TH2F ("hEOverPvsECutM02","matched track E/p vs cluster E, mild #lambda_{0}^{2} cut", nptbins,ptmin,ptmax,nPoverEbins,pOverEmin,pOverEmax);
528 fhEOverPvsECutM02->SetXTitle("E (GeV)");
529 fhEOverPvsECutM02->SetYTitle("E/p");
530 outputContainer->Add(fhEOverPvsECutM02);
531
532 fhEOverPvsPCutM02 = new TH2F ("hEOverPvsPCutM02","matched track E/p vs track P, mild #lambda_{0}^{2} cut", nptbins,ptmin,ptmax,nPoverEbins,pOverEmin,pOverEmax);
533 fhEOverPvsPCutM02->SetXTitle("P (GeV/c)");
534 fhEOverPvsPCutM02->SetYTitle("E/p");
535 outputContainer->Add(fhEOverPvsPCutM02);
536
537
538 fhdEdxvsECutEOverP = new TH2F ("hdEdxvsECutEOverP","matched track <dE/dx> vs cluster E, cut on E/p", nptbins,ptmin,ptmax,ndedxbins, dedxmin, dedxmax);
539 fhdEdxvsECutEOverP->SetXTitle("E (GeV)");
540 fhdEdxvsECutEOverP->SetYTitle("<dE/dx>");
541 outputContainer->Add(fhdEdxvsECutEOverP);
542
543 fhdEdxvsPCutEOverP = new TH2F ("hdEdxvsPCutEOverP","matched track <dE/dx> vs track P, cut on E/p", nptbins,ptmin,ptmax,ndedxbins, dedxmin, dedxmax);
544 fhdEdxvsPCutEOverP->SetXTitle("P (GeV/c)");
545 fhdEdxvsPCutEOverP->SetYTitle("<dE/dx>");
546 outputContainer->Add(fhdEdxvsPCutEOverP);
547
548 fhEOverPvsECutM02CutdEdx = new TH2F ("hEOverPvsECutM02CutdEdx","matched track E/p vs cluster E, dEdx cut, mild #lambda_{0}^{2} cut", nptbins,ptmin,ptmax,nPoverEbins,pOverEmin,pOverEmax);
549 fhEOverPvsECutM02CutdEdx->SetXTitle("E (GeV)");
550 fhEOverPvsECutM02CutdEdx->SetYTitle("E/p");
551 outputContainer->Add(fhEOverPvsECutM02CutdEdx);
552
553 fhEOverPvsPCutM02CutdEdx = new TH2F ("hEOverPvsPCutM02CutdEdx","matched track E/p vs track P, dEdx cut, mild #lambda_{0}^{2} cut ", nptbins,ptmin,ptmax,nPoverEbins,pOverEmin,pOverEmax);
554 fhEOverPvsPCutM02CutdEdx->SetXTitle("P (GeV/c)");
555 fhEOverPvsPCutM02CutdEdx->SetYTitle("E/p");
556 outputContainer->Add(fhEOverPvsPCutM02CutdEdx);
557
558 if(IsDataMC())
559 {
560 for(Int_t i = 0; i < fNOriginHistograms; i++)
561 {
562 fhMCdEdxvsE[i] = new TH2F(Form("hdEdxvsE_MC%s",pname[i].Data()),
563 Form("matched track <dE/dx> vs cluster E from %s : E ",ptype[i].Data()),
564 nptbins,ptmin,ptmax,ndedxbins, dedxmin, dedxmax);
565 fhMCdEdxvsE[i]->SetXTitle("E (GeV)");
566 fhMCdEdxvsE[i]->SetYTitle("<dE/dx>");
567 outputContainer->Add(fhMCdEdxvsE[i]) ;
568
569 fhMCdEdxvsP[i] = new TH2F(Form("hdEdxvsP_MC%s",pname[i].Data()),
570 Form("matched track <dE/dx> vs track P from %s : E ",ptype[i].Data()),
571 nptbins,ptmin,ptmax,ndedxbins, dedxmin, dedxmax);
572 fhMCdEdxvsP[i]->SetXTitle("E (GeV)");
573 fhMCdEdxvsP[i]->SetYTitle("<dE/dx>");
574 outputContainer->Add(fhMCdEdxvsP[i]) ;
575
576
577 fhMCEOverPvsE[i] = new TH2F(Form("hEOverPvsE_MC%s",pname[i].Data()),
578 Form("matched track E/p vs cluster E from %s : E ",ptype[i].Data()),
579 nptbins,ptmin,ptmax,nPoverEbins,pOverEmin,pOverEmax);
580 fhMCEOverPvsE[i]->SetXTitle("E (GeV)");
581 fhMCEOverPvsE[i]->SetYTitle("<dE/dx>");
582 outputContainer->Add(fhMCEOverPvsE[i]) ;
583
584 fhMCEOverPvsP[i] = new TH2F(Form("hEOverPvsP_MC%s",pname[i].Data()),
585 Form("matched track E/pvs track P from %s : E ",ptype[i].Data()),
586 nptbins,ptmin,ptmax,nPoverEbins,pOverEmin,pOverEmax);
587 fhMCEOverPvsP[i]->SetXTitle("E (GeV)");
588 fhMCEOverPvsP[i]->SetYTitle("<dE/dx>");
589 outputContainer->Add(fhMCEOverPvsP[i]) ;
590
591 }
592 }
593
d9105d92 594 TString pidParticle[] = {"Electron","ChargedHadron"} ;
595
34c16486 596 if(fFillWeightHistograms)
597 {
1a72f6c5 598
599 fhECellClusterRatio = new TH2F ("hECellClusterRatio"," cell energy / cluster energy vs cluster energy, for selected electrons",
600 nptbins,ptmin,ptmax, 100,0,1.);
601 fhECellClusterRatio->SetXTitle("E_{cluster} (GeV) ");
602 fhECellClusterRatio->SetYTitle("E_{cell i}/E_{cluster}");
603 outputContainer->Add(fhECellClusterRatio);
604
605 fhECellClusterLogRatio = new TH2F ("hECellClusterLogRatio"," Log(cell energy / cluster energy) vs cluster energy, for selected electrons",
606 nptbins,ptmin,ptmax, 100,-10,0);
607 fhECellClusterLogRatio->SetXTitle("E_{cluster} (GeV) ");
608 fhECellClusterLogRatio->SetYTitle("Log (E_{max cell}/E_{cluster})");
609 outputContainer->Add(fhECellClusterLogRatio);
610
611 fhEMaxCellClusterRatio = new TH2F ("hEMaxCellClusterRatio"," max cell energy / cluster energy vs cluster energy, for selected electrons",
612 nptbins,ptmin,ptmax, 100,0,1.);
613 fhEMaxCellClusterRatio->SetXTitle("E_{cluster} (GeV) ");
614 fhEMaxCellClusterRatio->SetYTitle("E_{max cell}/E_{cluster}");
615 outputContainer->Add(fhEMaxCellClusterRatio);
616
617 fhEMaxCellClusterLogRatio = new TH2F ("hEMaxCellClusterLogRatio"," Log(max cell energy / cluster energy) vs cluster energy, for selected electrons",
618 nptbins,ptmin,ptmax, 100,-10,0);
619 fhEMaxCellClusterLogRatio->SetXTitle("E_{cluster} (GeV) ");
620 fhEMaxCellClusterLogRatio->SetYTitle("Log (E_{max cell}/E_{cluster})");
621 outputContainer->Add(fhEMaxCellClusterLogRatio);
622
34c16486 623 for(Int_t iw = 0; iw < 14; iw++)
624 {
1a72f6c5 625 fhLambda0ForW0[iw] = new TH2F (Form("hLambda0ForW0%d",iw),Form("shower shape, #lambda^{2}_{0} vs E, w0 = %1.1f, for selected electrons",1+0.5*iw),
626 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
627 fhLambda0ForW0[iw]->SetXTitle("E_{cluster}");
628 fhLambda0ForW0[iw]->SetYTitle("#lambda^{2}_{0}");
629 outputContainer->Add(fhLambda0ForW0[iw]);
630
631 // fhLambda1ForW0[iw] = new TH2F (Form("hLambda1ForW0%d",iw),Form("shower shape, #lambda^{2}_{1} vs E, w0 = %1.1f, for selected electrons",1+0.5*iw),
632 // nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
633 // fhLambda1ForW0[iw]->SetXTitle("E_{cluster}");
634 // fhLambda1ForW0[iw]->SetYTitle("#lambda^{2}_{1}");
635 // outputContainer->Add(fhLambda1ForW0[iw]);
636
637 }
638 }
639
34c16486 640 for(Int_t pidIndex = 0; pidIndex < 2; pidIndex++)
641 {
d9105d92 642 //Shower shape
34c16486 643 if(fFillSSHistograms)
644 {
d9105d92 645 fhLam0E[pidIndex] = new TH2F (Form("h%sLam0E",pidParticle[pidIndex].Data()),
646 Form("%s: #lambda_{0}^{2} vs E",pidParticle[pidIndex].Data()),
647 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
648 fhLam0E[pidIndex]->SetYTitle("#lambda_{0}^{2}");
649 fhLam0E[pidIndex]->SetXTitle("E (GeV)");
650 outputContainer->Add(fhLam0E[pidIndex]);
651
652 fhLam1E[pidIndex] = new TH2F (Form("h%sLam1E",pidParticle[pidIndex].Data()),
653 Form("%s: #lambda_{1}^{2} vs E",pidParticle[pidIndex].Data()),
654 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
655 fhLam1E[pidIndex]->SetYTitle("#lambda_{1}^{2}");
656 fhLam1E[pidIndex]->SetXTitle("E (GeV)");
657 outputContainer->Add(fhLam1E[pidIndex]);
658
659 fhDispE[pidIndex] = new TH2F (Form("h%sDispE",pidParticle[pidIndex].Data()),
660 Form("%s: dispersion^{2} vs E",pidParticle[pidIndex].Data()),
661 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
662 fhDispE[pidIndex]->SetYTitle("D^{2}");
663 fhDispE[pidIndex]->SetXTitle("E (GeV) ");
664 outputContainer->Add(fhDispE[pidIndex]);
665
34c16486 666 if(fCalorimeter == "EMCAL")
667 {
d9105d92 668 fhLam0ETRD[pidIndex] = new TH2F (Form("h%sLam0ETRD",pidParticle[pidIndex].Data()),
669 Form("%s: #lambda_{0}^{2} vs E, EMCAL SM covered by TRD",pidParticle[pidIndex].Data()),
670 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
671 fhLam0ETRD[pidIndex]->SetYTitle("#lambda_{0}^{2}");
672 fhLam0ETRD[pidIndex]->SetXTitle("E (GeV)");
673 outputContainer->Add(fhLam0ETRD[pidIndex]);
674
675 fhLam1ETRD[pidIndex] = new TH2F (Form("h%sLam1ETRD",pidParticle[pidIndex].Data()),
676 Form("%s: #lambda_{1}^{2} vs E, EMCAL SM covered by TRD",pidParticle[pidIndex].Data()),
677 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
678 fhLam1ETRD[pidIndex]->SetYTitle("#lambda_{1}^{2}");
679 fhLam1ETRD[pidIndex]->SetXTitle("E (GeV)");
680 outputContainer->Add(fhLam1ETRD[pidIndex]);
681
682 fhDispETRD[pidIndex] = new TH2F (Form("h%sDispETRD",pidParticle[pidIndex].Data()),
683 Form("%s: dispersion^{2} vs E, EMCAL SM covered by TRD",pidParticle[pidIndex].Data()),
684 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
685 fhDispETRD[pidIndex]->SetYTitle("Dispersion^{2}");
686 fhDispETRD[pidIndex]->SetXTitle("E (GeV) ");
687 outputContainer->Add(fhDispETRD[pidIndex]);
688 }
689
764ab1f4 690 if(!fFillOnlySimpleSSHisto)
34c16486 691 {
34c16486 692
764ab1f4 693 fhNCellsLam0LowE[pidIndex] = new TH2F (Form("h%sNCellsLam0LowE",pidParticle[pidIndex].Data()),
694 Form("%s: N_{cells} in cluster vs #lambda_{0}^{2}, E < 2 GeV",pidParticle[pidIndex].Data()),
695 nbins,nmin, nmax, ssbins,ssmin,ssmax);
696 fhNCellsLam0LowE[pidIndex]->SetXTitle("N_{cells}");
697 fhNCellsLam0LowE[pidIndex]->SetYTitle("#lambda_{0}^{2}");
698 outputContainer->Add(fhNCellsLam0LowE[pidIndex]);
34c16486 699
764ab1f4 700 fhNCellsLam0HighE[pidIndex] = new TH2F (Form("h%sNCellsLam0HighE",pidParticle[pidIndex].Data()),
701 Form("%s: N_{cells} in cluster vs #lambda_{0}^{2}, E > 2 GeV",pidParticle[pidIndex].Data()),
702 nbins,nmin, nmax, ssbins,ssmin,ssmax);
703 fhNCellsLam0HighE[pidIndex]->SetXTitle("N_{cells}");
704 fhNCellsLam0HighE[pidIndex]->SetYTitle("#lambda_{0}^{2}");
705 outputContainer->Add(fhNCellsLam0HighE[pidIndex]);
78a28af3 706
34c16486 707
764ab1f4 708 fhEtaLam0LowE[pidIndex] = new TH2F (Form("h%sEtaLam0LowE",pidParticle[pidIndex].Data()),
709 Form("%s: #eta vs #lambda_{0}^{2}, E < 2 GeV",pidParticle[pidIndex].Data()),
710 netabins,etamin,etamax, ssbins,ssmin,ssmax);
711 fhEtaLam0LowE[pidIndex]->SetYTitle("#lambda_{0}^{2}");
712 fhEtaLam0LowE[pidIndex]->SetXTitle("#eta");
713 outputContainer->Add(fhEtaLam0LowE[pidIndex]);
34c16486 714
764ab1f4 715 fhPhiLam0LowE[pidIndex] = new TH2F (Form("h%sPhiLam0LowE",pidParticle[pidIndex].Data()),
716 Form("%s: #phi vs #lambda_{0}^{2}, E < 2 GeV",pidParticle[pidIndex].Data()),
717 nphibins,phimin,phimax, ssbins,ssmin,ssmax);
718 fhPhiLam0LowE[pidIndex]->SetYTitle("#lambda_{0}^{2}");
719 fhPhiLam0LowE[pidIndex]->SetXTitle("#phi");
720 outputContainer->Add(fhPhiLam0LowE[pidIndex]);
34c16486 721
764ab1f4 722 fhEtaLam0HighE[pidIndex] = new TH2F (Form("h%sEtaLam0HighE",pidParticle[pidIndex].Data()),
723 Form("%s: #eta vs #lambda_{0}^{2}, E > 2 GeV",pidParticle[pidIndex].Data()),
724 netabins,etamin,etamax, ssbins,ssmin,ssmax);
725 fhEtaLam0HighE[pidIndex]->SetYTitle("#lambda_{0}^{2}");
726 fhEtaLam0HighE[pidIndex]->SetXTitle("#eta");
727 outputContainer->Add(fhEtaLam0HighE[pidIndex]);
34c16486 728
764ab1f4 729 fhPhiLam0HighE[pidIndex] = new TH2F (Form("h%sPhiLam0HighE",pidParticle[pidIndex].Data()),
730 Form("%s: #phi vs #lambda_{0}^{2}, E > 2 GeV",pidParticle[pidIndex].Data()),
731 nphibins,phimin,phimax, ssbins,ssmin,ssmax);
732 fhPhiLam0HighE[pidIndex]->SetYTitle("#lambda_{0}^{2}");
733 fhPhiLam0HighE[pidIndex]->SetXTitle("#phi");
734 outputContainer->Add(fhPhiLam0HighE[pidIndex]);
735
736 if(fCalorimeter == "EMCAL")
34c16486 737 {
764ab1f4 738 fhDispEtaE[pidIndex] = new TH2F (Form("h%sDispEtaE",pidParticle[pidIndex].Data()),
739 Form("%s: #sigma^{2}_{#eta #eta} = #Sigma w_{i}(#eta_{i} - <#eta>)^{2}/ #Sigma w_{i} vs E",pidParticle[pidIndex].Data()),
740 nptbins,ptmin,ptmax, ssbins,ssmin,ssmax);
741 fhDispEtaE[pidIndex]->SetXTitle("E (GeV)");
742 fhDispEtaE[pidIndex]->SetYTitle("#sigma^{2}_{#eta #eta}");
743 outputContainer->Add(fhDispEtaE[pidIndex]);
744
745 fhDispPhiE[pidIndex] = new TH2F (Form("h%sDispPhiE",pidParticle[pidIndex].Data()),
746 Form("%s: #sigma^{2}_{#phi #phi} = #Sigma w_{i}(#phi_{i} - <#phi>)^{2} / #Sigma w_{i} vs E",pidParticle[pidIndex].Data()),
747 nptbins,ptmin,ptmax, ssbins,ssmin,ssmax);
748 fhDispPhiE[pidIndex]->SetXTitle("E (GeV)");
749 fhDispPhiE[pidIndex]->SetYTitle("#sigma^{2}_{#phi #phi}");
750 outputContainer->Add(fhDispPhiE[pidIndex]);
751
752 fhSumEtaE[pidIndex] = new TH2F (Form("h%sSumEtaE",pidParticle[pidIndex].Data()),
753 Form("%s: #sigma^{2}_{#eta #eta} = #Sigma w_{i}(#eta_{i})^{2} / #Sigma w_{i} - <#eta>^{2} vs E",pidParticle[pidIndex].Data()),
754 nptbins,ptmin,ptmax, ssbins,ssmin,ssmax);
755 fhSumEtaE[pidIndex]->SetXTitle("E (GeV)");
756 fhSumEtaE[pidIndex]->SetYTitle("#delta^{2}_{#eta #eta}");
757 outputContainer->Add(fhSumEtaE[pidIndex]);
758
759 fhSumPhiE[pidIndex] = new TH2F (Form("h%sSumPhiE",pidParticle[pidIndex].Data()),
760 Form("%s: #sigma^{2}_{#phi #phi} = #Sigma w_{i}(#phi_{i})^{2}/ #Sigma w_{i} - <#phi>^{2} vs E",pidParticle[pidIndex].Data()),
761 nptbins,ptmin,ptmax, ssbins,ssmin,ssmax);
762 fhSumPhiE[pidIndex]->SetXTitle("E (GeV)");
763 fhSumPhiE[pidIndex]->SetYTitle("#delta^{2}_{#phi #phi}");
764 outputContainer->Add(fhSumPhiE[pidIndex]);
765
766 fhSumEtaPhiE[pidIndex] = new TH2F (Form("h%sSumEtaPhiE",pidParticle[pidIndex].Data()),
767 Form("%s: #delta^{2}_{#eta #phi} = #Sigma w_{i}(#phi_{i} #eta_{i} ) / #Sigma w_{i} - <#phi><#eta> vs E",pidParticle[pidIndex].Data()),
768 nptbins,ptmin,ptmax, 2*ssbins,-ssmax,ssmax);
769 fhSumEtaPhiE[pidIndex]->SetXTitle("E (GeV)");
770 fhSumEtaPhiE[pidIndex]->SetYTitle("#delta^{2}_{#eta #phi}");
771 outputContainer->Add(fhSumEtaPhiE[pidIndex]);
772
773 fhDispEtaPhiDiffE[pidIndex] = new TH2F (Form("h%sDispEtaPhiDiffE",pidParticle[pidIndex].Data()),
774 Form("%s: #sigma^{2}_{#phi #phi} - #sigma^{2}_{#eta #eta} vs E",pidParticle[pidIndex].Data()),
775 nptbins,ptmin,ptmax,200, -10,10);
776 fhDispEtaPhiDiffE[pidIndex]->SetXTitle("E (GeV)");
777 fhDispEtaPhiDiffE[pidIndex]->SetYTitle("#sigma^{2}_{#phi #phi}-#sigma^{2}_{#eta #eta}");
778 outputContainer->Add(fhDispEtaPhiDiffE[pidIndex]);
779
780 fhSphericityE[pidIndex] = new TH2F (Form("h%sSphericityE",pidParticle[pidIndex].Data()),
781 Form("%s: (#sigma^{2}_{#phi #phi} - #sigma^{2}_{#eta #eta}) / (#sigma^{2}_{#eta #eta} + #sigma^{2}_{#phi #phi}) vs E",pidParticle[pidIndex].Data()),
782 nptbins,ptmin,ptmax, 200, -1,1);
783 fhSphericityE[pidIndex]->SetXTitle("E (GeV)");
784 fhSphericityE[pidIndex]->SetYTitle("s = (#sigma^{2}_{#phi #phi} - #sigma^{2}_{#eta #eta}) / (#sigma^{2}_{#eta #eta} + #sigma^{2}_{#phi #phi})");
785 outputContainer->Add(fhSphericityE[pidIndex]);
786
787 Int_t bin[] = {0,2,4,6,10,1000};
788 for(Int_t i = 0; i < 5; i++)
789 {
790 fhDispEtaDispPhiEBin[pidIndex][i] = new TH2F (Form("h%sDispEtaDispPhi_EBin%d",pidParticle[pidIndex].Data(),i),
791 Form("%s: #sigma^{2}_{#phi #phi} vs #sigma^{2}_{#eta #eta} for %d < E < %d GeV",pidParticle[pidIndex].Data(),bin[i],bin[i+1]),
792 ssbins,ssmin,ssmax , ssbins,ssmin,ssmax);
793 fhDispEtaDispPhiEBin[pidIndex][i]->SetXTitle("#sigma^{2}_{#eta #eta}");
794 fhDispEtaDispPhiEBin[pidIndex][i]->SetYTitle("#sigma^{2}_{#phi #phi}");
795 outputContainer->Add(fhDispEtaDispPhiEBin[pidIndex][i]);
796 }
34c16486 797 }
798 }
34c16486 799 } // Shower shape
800
801 if(IsDataMC())
802 {
803 if(fFillSSHistograms)
804 {
34c16486 805 for(Int_t i = 0; i < 6; i++)
806 {
d9105d92 807 fhMCELambda0[pidIndex][i] = new TH2F(Form("h%sELambda0_MC%s",pidParticle[pidIndex].Data(),pnamess[i].Data()),
808 Form("%s like cluster from %s : E vs #lambda_{0}^{2}",pidParticle[pidIndex].Data(),ptypess[i].Data()),
809 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
810 fhMCELambda0[pidIndex][i]->SetYTitle("#lambda_{0}^{2}");
811 fhMCELambda0[pidIndex][i]->SetXTitle("E (GeV)");
812 outputContainer->Add(fhMCELambda0[pidIndex][i]) ;
813
764ab1f4 814 if(fCalorimeter=="EMCAL" && !fFillOnlySimpleSSHisto)
34c16486 815 {
816 fhMCEDispEta[pidIndex][i] = new TH2F (Form("h%sEDispEtaE_MC%s",pidParticle[pidIndex].Data(),pnamess[i].Data()),
817 Form("cluster from %s : %s like, #sigma^{2}_{#eta #eta} = #Sigma w_{i}(#eta_{i} - <#eta>)^{2}/ #Sigma w_{i} vs E",ptypess[i].Data(),pidParticle[pidIndex].Data()),
818 nptbins,ptmin,ptmax, ssbins,ssmin,ssmax);
819 fhMCEDispEta[pidIndex][i]->SetXTitle("E (GeV)");
820 fhMCEDispEta[pidIndex][i]->SetYTitle("#sigma^{2}_{#eta #eta}");
821 outputContainer->Add(fhMCEDispEta[pidIndex][i]);
822
823 fhMCEDispPhi[pidIndex][i] = new TH2F (Form("h%sEDispPhiE_MC%s",pidParticle[pidIndex].Data(),pnamess[i].Data()),
824 Form("cluster from %s : %s like, #sigma^{2}_{#phi #phi} = #Sigma w_{i}(#phi_{i} - <#phi>)^{2} / #Sigma w_{i} vs E",ptypess[i].Data(),pidParticle[pidIndex].Data()),
825 nptbins,ptmin,ptmax, ssbins,ssmin,ssmax);
826 fhMCEDispPhi[pidIndex][i]->SetXTitle("E (GeV)");
827 fhMCEDispPhi[pidIndex][i]->SetYTitle("#sigma^{2}_{#phi #phi}");
828 outputContainer->Add(fhMCEDispPhi[pidIndex][i]);
829
830 fhMCESumEtaPhi[pidIndex][i] = new TH2F (Form("h%sESumEtaPhiE_MC%s",pidParticle[pidIndex].Data(),pnamess[i].Data()),
06373cc6 831 Form("cluster from %s : %s like, #delta^{2}_{#eta #phi} = #Sigma w_{i}(#phi_{i} #eta_{i} ) / #Sigma w_{i} - <#phi><#eta> vs E",ptypess[i].Data(),pidParticle[pidIndex].Data()),
34c16486 832 nptbins,ptmin,ptmax, 2*ssbins,-ssmax,ssmax);
833 fhMCESumEtaPhi[pidIndex][i]->SetXTitle("E (GeV)");
06373cc6 834 fhMCESumEtaPhi[pidIndex][i]->SetYTitle("#delta^{2}_{#eta #phi}");
34c16486 835 outputContainer->Add(fhMCESumEtaPhi[pidIndex][i]);
836
837 fhMCEDispEtaPhiDiff[pidIndex][i] = new TH2F (Form("h%sEDispEtaPhiDiffE_MC%s",pidParticle[pidIndex].Data(),pnamess[i].Data()),
838 Form("cluster from %s : %s like, #sigma^{2}_{#phi #phi} - #sigma^{2}_{#eta #eta} vs E",ptypess[i].Data(),pidParticle[pidIndex].Data()),
839 nptbins,ptmin,ptmax,200,-10,10);
840 fhMCEDispEtaPhiDiff[pidIndex][i]->SetXTitle("E (GeV)");
841 fhMCEDispEtaPhiDiff[pidIndex][i]->SetYTitle("#sigma^{2}_{#phi #phi}-#sigma^{2}_{#eta #eta}");
842 outputContainer->Add(fhMCEDispEtaPhiDiff[pidIndex][i]);
843
844 fhMCESphericity[pidIndex][i] = new TH2F (Form("h%sESphericity_MC%s",pidParticle[pidIndex].Data(),pnamess[i].Data()),
845 Form("cluster from %s : %s like, (#sigma^{2}_{#phi #phi} - #sigma^{2}_{#eta #eta}) / (#sigma^{2}_{#eta #eta} + #sigma^{2}_{#phi #phi}) vs E",ptypess[i].Data(),pidParticle[pidIndex].Data()),
846 nptbins,ptmin,ptmax, 200,-1,1);
847 fhMCESphericity[pidIndex][i]->SetXTitle("E (GeV)");
848 fhMCESphericity[pidIndex][i]->SetYTitle("s = (#sigma^{2}_{#phi #phi} - #sigma^{2}_{#eta #eta}) / (#sigma^{2}_{#eta #eta} + #sigma^{2}_{#phi #phi})");
849 outputContainer->Add(fhMCESphericity[pidIndex][i]);
34c16486 850 }
851
d9105d92 852 }// loop
853 }
854 }
855
764ab1f4 856 //if(IsCaloPIDOn() && pidIndex > 0) continue;
d9105d92 857
858 fhNCellsE[pidIndex] = new TH2F (Form("h%sNCellsE",pidParticle[pidIndex].Data()),
859 Form("N cells in %s cluster vs E ",pidParticle[pidIndex].Data()),
860 nptbins,ptmin,ptmax, nbins,nmin,nmax);
861 fhNCellsE[pidIndex]->SetXTitle("E (GeV)");
862 fhNCellsE[pidIndex]->SetYTitle("# of cells in cluster");
863 outputContainer->Add(fhNCellsE[pidIndex]);
864
7e9a1194 865 fhNLME[pidIndex] = new TH2F (Form("h%sNLME",pidParticle[pidIndex].Data()),
866 Form("NLM in %s cluster vs E ",pidParticle[pidIndex].Data()),
867 nptbins,ptmin,ptmax, 10,0,10);
868 fhNLME[pidIndex]->SetXTitle("E (GeV)");
869 fhNLME[pidIndex]->SetYTitle("# of cells in cluster");
870 outputContainer->Add(fhNLME[pidIndex]);
871
42d47cb7 872 fhTimeE[pidIndex] = new TH2F(Form("h%sTimeE",pidParticle[pidIndex].Data()),
873 Form("Time in %s cluster vs E ",pidParticle[pidIndex].Data())
874 ,nptbins,ptmin,ptmax, tbins,tmin,tmax);
875 fhTimeE[pidIndex]->SetXTitle("E (GeV)");
876 fhTimeE[pidIndex]->SetYTitle(" t (ns)");
877 outputContainer->Add(fhTimeE[pidIndex]);
878
d9105d92 879 fhMaxCellDiffClusterE[pidIndex] = new TH2F (Form("h%sMaxCellDiffClusterE",pidParticle[pidIndex].Data()),
880 Form("%s: energy vs difference of cluster energy - max cell energy / cluster energy, good clusters",pidParticle[pidIndex].Data()),
881 nptbins,ptmin,ptmax, 500,0,1.);
882 fhMaxCellDiffClusterE[pidIndex]->SetXTitle("E_{cluster} (GeV) ");
883 fhMaxCellDiffClusterE[pidIndex]->SetYTitle("(E_{cluster} - E_{cell max})/ E_{cluster}");
884 outputContainer->Add(fhMaxCellDiffClusterE[pidIndex]);
885
886 fhE[pidIndex] = new TH1F(Form("h%sE",pidParticle[pidIndex].Data()),
887 Form("Number of %s over calorimeter vs energy",pidParticle[pidIndex].Data()),
888 nptbins,ptmin,ptmax);
889 fhE[pidIndex]->SetYTitle("N");
890 fhE[pidIndex]->SetXTitle("E_{#gamma}(GeV)");
891 outputContainer->Add(fhE[pidIndex]) ;
892
893 fhPt[pidIndex] = new TH1F(Form("h%sPtElectron",pidParticle[pidIndex].Data()),
894 Form("Number of %s over calorimeter vs p_{T}",pidParticle[pidIndex].Data()),
895 nptbins,ptmin,ptmax);
896 fhPt[pidIndex]->SetYTitle("N");
897 fhPt[pidIndex]->SetXTitle("p_{T #gamma}(GeV/c)");
898 outputContainer->Add(fhPt[pidIndex]) ;
899
900 fhPhi[pidIndex] = new TH2F(Form("h%sPhiElectron",pidParticle[pidIndex].Data()),
901 Form("%s: #phi vs p_{T}",pidParticle[pidIndex].Data()),
902 nptbins,ptmin,ptmax,nphibins,phimin,phimax);
903 fhPhi[pidIndex]->SetYTitle("#phi (rad)");
904 fhPhi[pidIndex]->SetXTitle("p_{T #gamma} (GeV/c)");
905 outputContainer->Add(fhPhi[pidIndex]) ;
906
907 fhEta[pidIndex] = new TH2F(Form("h%sEta",pidParticle[pidIndex].Data()),
908 Form("%s: #eta vs p_{T}",pidParticle[pidIndex].Data()),
909 nptbins,ptmin,ptmax,netabins,etamin,etamax);
910 fhEta[pidIndex]->SetYTitle("#eta");
911 fhEta[pidIndex]->SetXTitle("p_{T #gamma} (GeV/c)");
912 outputContainer->Add(fhEta[pidIndex]) ;
913
914 fhEtaPhi[pidIndex] = new TH2F(Form("h%sEtaPhi",pidParticle[pidIndex].Data()),
915 Form("%s: #eta vs #phi",pidParticle[pidIndex].Data()),
916 netabins,etamin,etamax,nphibins,phimin,phimax);
917 fhEtaPhi[pidIndex]->SetYTitle("#phi (rad)");
918 fhEtaPhi[pidIndex]->SetXTitle("#eta");
919 outputContainer->Add(fhEtaPhi[pidIndex]) ;
34c16486 920 if(GetMinPt() < 0.5)
921 {
d9105d92 922 fhEtaPhi05[pidIndex] = new TH2F(Form("h%sEtaPhi05",pidParticle[pidIndex].Data()),
923 Form("%s: #eta vs #phi, E > 0.5",pidParticle[pidIndex].Data()),
924 netabins,etamin,etamax,nphibins,phimin,phimax);
925 fhEtaPhi05[pidIndex]->SetYTitle("#phi (rad)");
926 fhEtaPhi05[pidIndex]->SetXTitle("#eta");
927 outputContainer->Add(fhEtaPhi05[pidIndex]) ;
928 }
929
930
34c16486 931 if(IsDataMC())
7e9a1194 932 {
34c16486 933 for(Int_t i = 0; i < fNOriginHistograms; i++)
934 {
d9105d92 935 fhMCE[pidIndex][i] = new TH1F(Form("h%sE_MC%s",pidParticle[pidIndex].Data(),pname[i].Data()),
936 Form("%s like cluster from %s : E ",pidParticle[pidIndex].Data(),ptype[i].Data()),
937 nptbins,ptmin,ptmax);
938 fhMCE[pidIndex][i]->SetXTitle("E (GeV)");
939 outputContainer->Add(fhMCE[pidIndex][i]) ;
940
941 fhMCPt[pidIndex][i] = new TH1F(Form("h%sPt_MC%s",pidParticle[pidIndex].Data(),pname[i].Data()),
942 Form("%s like cluster from %s : p_{T} ",pidParticle[pidIndex].Data(),ptype[i].Data()),
943 nptbins,ptmin,ptmax);
944 fhMCPt[pidIndex][i]->SetXTitle("p_{T} (GeV/c)");
945 outputContainer->Add(fhMCPt[pidIndex][i]) ;
946
947 fhMCEta[pidIndex][i] = new TH2F(Form("h%sEta_MC%s",pidParticle[pidIndex].Data(),pname[i].Data()),
948 Form("%s like cluster from %s : #eta ",pidParticle[pidIndex].Data(),ptype[i].Data()),
949 nptbins,ptmin,ptmax,netabins,etamin,etamax);
950 fhMCEta[pidIndex][i]->SetYTitle("#eta");
951 fhMCEta[pidIndex][i]->SetXTitle("E (GeV)");
952 outputContainer->Add(fhMCEta[pidIndex][i]) ;
953
954 fhMCPhi[pidIndex][i] = new TH2F(Form("h%sPhi_MC%s",pidParticle[pidIndex].Data(),pname[i].Data()),
955 Form("%s like cluster from %s : #phi ",pidParticle[pidIndex].Data(),ptype[i].Data()),
956 nptbins,ptmin,ptmax,nphibins,phimin,phimax);
957 fhMCPhi[pidIndex][i]->SetYTitle("#phi (rad)");
958 fhMCPhi[pidIndex][i]->SetXTitle("E (GeV)");
959 outputContainer->Add(fhMCPhi[pidIndex][i]) ;
960
961
962 fhMCDeltaE[pidIndex][i] = new TH2F (Form("h%sDeltaE_MC%s",pidParticle[pidIndex].Data(),pname[i].Data()),
963 Form("%s like MC - Reco E from %s",pidParticle[pidIndex].Data(),pname[i].Data()),
964 nptbins,ptmin,ptmax, 200,-50,50);
965 fhMCDeltaE[pidIndex][i]->SetXTitle("#Delta E (GeV)");
966 outputContainer->Add(fhMCDeltaE[pidIndex][i]);
967
968 fhMC2E[pidIndex][i] = new TH2F (Form("h%s2E_MC%s",pidParticle[pidIndex].Data(),pname[i].Data()),
969 Form("%s like E distribution, reconstructed vs generated from %s",pidParticle[pidIndex].Data(),pname[i].Data()),
970 nptbins,ptmin,ptmax,nptbins,ptmin,ptmax);
971 fhMC2E[pidIndex][i]->SetXTitle("E_{rec} (GeV)");
972 fhMC2E[pidIndex][i]->SetYTitle("E_{gen} (GeV)");
973 outputContainer->Add(fhMC2E[pidIndex][i]);
974
975 }
976 } // MC
977
978 }// pid Index
979
980
34c16486 981 if(fFillSSHistograms)
982 {
983 if(IsDataMC())
984 {
d9105d92 985 if(!GetReader()->IsEmbeddedClusterSelectionOn())
986 {
987 fhMCElectronELambda0NoOverlap = new TH2F("hELambda0_MCElectron_NoOverlap",
988 "cluster from Electron : E vs #lambda_{0}^{2}",
989 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
990 fhMCElectronELambda0NoOverlap->SetYTitle("#lambda_{0}^{2}");
991 fhMCElectronELambda0NoOverlap->SetXTitle("E (GeV)");
992 outputContainer->Add(fhMCElectronELambda0NoOverlap) ;
993
994 fhMCElectronELambda0TwoOverlap = new TH2F("hELambda0_MCElectron_TwoOverlap",
995 "cluster from Electron : E vs #lambda_{0}^{2}",
996 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
997 fhMCElectronELambda0TwoOverlap->SetYTitle("#lambda_{0}^{2}");
998 fhMCElectronELambda0TwoOverlap->SetXTitle("E (GeV)");
999 outputContainer->Add(fhMCElectronELambda0TwoOverlap) ;
1000
1001 fhMCElectronELambda0NOverlap = new TH2F("hELambda0_MCElectron_NOverlap",
1002 "cluster from Electron : E vs #lambda_{0}^{2}",
1003 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
1004 fhMCElectronELambda0NOverlap->SetYTitle("#lambda_{0}^{2}");
1005 fhMCElectronELambda0NOverlap->SetXTitle("E (GeV)");
1006 outputContainer->Add(fhMCElectronELambda0NOverlap) ;
1007
1008 } //No embedding
1009
1010 //Fill histograms to check shape of embedded clusters
1011 if(GetReader()->IsEmbeddedClusterSelectionOn())
1012 {
1013
1014 fhEmbeddedSignalFractionEnergy = new TH2F("hEmbeddedSignal_FractionEnergy",
1015 "Energy Fraction of embedded signal versus cluster energy",
1016 nptbins,ptmin,ptmax,100,0.,1.);
1017 fhEmbeddedSignalFractionEnergy->SetYTitle("Fraction");
1018 fhEmbeddedSignalFractionEnergy->SetXTitle("E (GeV)");
1019 outputContainer->Add(fhEmbeddedSignalFractionEnergy) ;
1020
1021 fhEmbedElectronELambda0FullSignal = new TH2F("hELambda0_EmbedElectron_FullSignal",
1022 "cluster from Electron embedded with more than 90% energy in cluster : E vs #lambda_{0}^{2}",
1023 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
1024 fhEmbedElectronELambda0FullSignal->SetYTitle("#lambda_{0}^{2}");
1025 fhEmbedElectronELambda0FullSignal->SetXTitle("E (GeV)");
1026 outputContainer->Add(fhEmbedElectronELambda0FullSignal) ;
1027
1028 fhEmbedElectronELambda0MostlySignal = new TH2F("hELambda0_EmbedElectron_MostlySignal",
1029 "cluster from Electron embedded with 50% to 90% energy in cluster : E vs #lambda_{0}^{2}",
1030 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
1031 fhEmbedElectronELambda0MostlySignal->SetYTitle("#lambda_{0}^{2}");
1032 fhEmbedElectronELambda0MostlySignal->SetXTitle("E (GeV)");
1033 outputContainer->Add(fhEmbedElectronELambda0MostlySignal) ;
1034
1035 fhEmbedElectronELambda0MostlyBkg = new TH2F("hELambda0_EmbedElectron_MostlyBkg",
1036 "cluster from Electron embedded with 10% to 50% energy in cluster : E vs #lambda_{0}^{2}",
1037 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
1038 fhEmbedElectronELambda0MostlyBkg->SetYTitle("#lambda_{0}^{2}");
1039 fhEmbedElectronELambda0MostlyBkg->SetXTitle("E (GeV)");
1040 outputContainer->Add(fhEmbedElectronELambda0MostlyBkg) ;
1041
1042 fhEmbedElectronELambda0FullBkg = new TH2F("hELambda0_EmbedElectron_FullBkg",
1043 "cluster from Electronm embedded with 0% to 10% energy in cluster : E vs #lambda_{0}^{2}",
1044 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
1045 fhEmbedElectronELambda0FullBkg->SetYTitle("#lambda_{0}^{2}");
1046 fhEmbedElectronELambda0FullBkg->SetXTitle("E (GeV)");
1047 outputContainer->Add(fhEmbedElectronELambda0FullBkg) ;
1048
1049
1050 }// embedded histograms
1051
1052 }//Histos with MC
1053
1054 }// Fill SS MC histograms
1055
d9105d92 1056 return outputContainer ;
1057
1058}
1059
78a28af3 1060//_________________________
d9105d92 1061void AliAnaElectron::Init()
1062{
1063
1064 //Init
1065 //Do some checks
1066 if(fCalorimeter == "PHOS" && !GetReader()->IsPHOSSwitchedOn() && NewOutputAOD()){
1067 printf("AliAnaElectron::Init() - !!STOP: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!\n");
1068 abort();
1069 }
1070 else if(fCalorimeter == "EMCAL" && !GetReader()->IsEMCALSwitchedOn() && NewOutputAOD()){
1071 printf("AliAnaElectron::Init() - !!STOP: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!\n");
1072 abort();
1073 }
1074
1075}
1076
78a28af3 1077//___________________________________
d9105d92 1078void AliAnaElectron::InitParameters()
1079{
1080
1081 //Initialize the parameters of the analysis.
1082 AddToHistogramsName("AnaElectron_");
1083
1084 fCalorimeter = "EMCAL" ;
1085 fMinDist = 2.;
1086 fMinDist2 = 4.;
1087 fMinDist3 = 5.;
1088
1089 fTimeCutMin = -1;
1090 fTimeCutMax = 9999999;
1091 fNCellsCut = 0;
1092
1093 fdEdxMin = 76.; // for LHC11a, but for LHC11c pass1 56.
1094 fdEdxMax = 85.; // for LHC11a, but for LHC11c pass1 64.
1095
1096 fEOverPMin = 0.8; // for LHC11a, but for LHC11c pass1 0.9
1097 fEOverPMax = 1.2; // for LHC11a and LHC11c pass1
1098
1099}
1100
78a28af3 1101//_________________________________________
d9105d92 1102void AliAnaElectron::MakeAnalysisFillAOD()
1103{
1104 //Do photon analysis and fill aods
1105
1106 //Get the vertex
1107 Double_t v[3] = {0,0,0}; //vertex ;
1108 GetReader()->GetVertex(v);
1109
1110 //Select the Calorimeter of the photon
1111 TObjArray * pl = 0x0;
1112 if(fCalorimeter == "PHOS")
1113 pl = GetPHOSClusters();
1114 else if (fCalorimeter == "EMCAL")
1115 pl = GetEMCALClusters();
1116
1117 if(!pl) {
1118 Info("MakeAnalysisFillAOD","TObjArray with %s clusters is NULL!\n",fCalorimeter.Data());
1119 return;
1120 }
1121
1122 //Init arrays, variables, get number of clusters
1123 TLorentzVector mom, mom2 ;
1124 Int_t nCaloClusters = pl->GetEntriesFast();
1125 //List to be used in conversion analysis, to tag the cluster as candidate for conversion
1126
1127 if(GetDebug() > 0) printf("AliAnaElectron::MakeAnalysisFillAOD() - input %s cluster entries %d\n", fCalorimeter.Data(), nCaloClusters);
1128
1129 //----------------------------------------------------
1130 // Fill AOD with PHOS/EMCAL AliAODPWG4Particle objects
1131 //----------------------------------------------------
1132 // Loop on clusters
1133 for(Int_t icalo = 0; icalo < nCaloClusters; icalo++){
1134
1135 AliVCluster * calo = (AliVCluster*) (pl->At(icalo));
1136 //printf("calo %d, %f\n",icalo,calo->E());
1137
1138 //Get the index where the cluster comes, to retrieve the corresponding vertex
1139 Int_t evtIndex = 0 ;
1140 if (GetMixedEvent()) {
1141 evtIndex=GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ;
1142 //Get the vertex and check it is not too large in z
1143 if(TMath::Abs(GetVertex(evtIndex)[2])> GetZvertexCut()) continue;
1144 }
1145
1146 //Cluster selection, not charged, with photon id and in fiducial cut
1147 if(GetReader()->GetDataType() != AliCaloTrackReader::kMC){
1148 calo->GetMomentum(mom,GetVertex(evtIndex)) ;}//Assume that come from vertex in straight line
1149 else{
1150 Double_t vertex[]={0,0,0};
1151 calo->GetMomentum(mom,vertex) ;
1152 }
1153
1154 //--------------------------------------
1155 // Cluster selection
1156 //--------------------------------------
7e9a1194 1157 AliVCaloCells* cells = 0;
1158 if(fCalorimeter == "EMCAL") cells = GetEMCALCells();
1159 else cells = GetPHOSCells();
1160
1161 Int_t nMaxima = GetCaloUtils()->GetNumberOfLocalMaxima(calo, cells); // NLM
1162 if(!ClusterSelected(calo,mom,nMaxima)) continue;
d9105d92 1163
1164 //----------------------------
1165 //Create AOD for analysis
1166 //----------------------------
764ab1f4 1167 AliAODPWG4Particle aodpart = AliAODPWG4Particle(mom);
d9105d92 1168
1169 //...............................................
1170 //Set the indeces of the original caloclusters (MC, ID), and calorimeter
1171 Int_t label = calo->GetLabel();
764ab1f4 1172 aodpart.SetLabel(label);
1173 aodpart.SetCaloLabel(calo->GetID(),-1);
1174 aodpart.SetDetector(fCalorimeter);
d9105d92 1175 //printf("Index %d, Id %d, iaod %d\n",icalo, calo->GetID(),GetOutputAODBranch()->GetEntriesFast());
1176
1177 //...............................................
1178 //Set bad channel distance bit
1179 Double_t distBad=calo->GetDistanceToBadChannel() ; //Distance to bad channel
764ab1f4 1180 if (distBad > fMinDist3) aodpart.SetDistToBad(2) ;
1181 else if(distBad > fMinDist2) aodpart.SetDistToBad(1) ;
1182 else aodpart.SetDistToBad(0) ;
1183 //printf("DistBad %f Bit %d\n",distBad, aodpart.DistToBad());
d9105d92 1184
d9105d92 1185 //-------------------------------------
78a28af3 1186 //PID selection via dEdx
d9105d92 1187 //-------------------------------------
78a28af3 1188
4bfeae64 1189 AliVTrack *track = GetCaloUtils()->GetMatchedTrack(calo, GetReader()->GetInputEvent());
1190
7e9a1194 1191 if(!track)
1192 {
d9105d92 1193 printf("AliAnaElectron::MakeAnalysisFillAOD() - Null track");
1194 continue;
1195 }
1196
7e9a1194 1197 //printf("track dedx %f, p %f, cluster E %f\n",track->GetTPCsignal(),track->P(),calo->E());
e416be7d 1198 Float_t dEdx = track->GetTPCsignal();
7e9a1194 1199 Float_t eOverp = calo->E()/track->P();
1200
d9105d92 1201 fhdEdxvsE->Fill(calo->E(), dEdx);
1202 fhdEdxvsP->Fill(track->P(),dEdx);
1203
7e9a1194 1204 if( eOverp < fEOverPMax && eOverp > fEOverPMin)
1205 {
1206 fhdEdxvsECutEOverP ->Fill(calo->E(), dEdx);
1207 fhdEdxvsPCutEOverP ->Fill(track->P(),dEdx);
1208 }
1209
1210 //Apply a mild cut on the cluster SS and check the value of dEdX and EOverP
1211 Float_t m02 = calo->GetM02();
1212 if(m02 > 0.1 && m02 < 0.4)
1213 {
1214 fhdEdxvsECutM02 ->Fill(calo->E(), dEdx);
1215 fhdEdxvsPCutM02 ->Fill(track->P(),dEdx);
1216 fhEOverPvsECutM02->Fill(calo->E(), eOverp);
1217 fhEOverPvsPCutM02->Fill(track->P(), eOverp);
1218 }
1219
c5693f62 1220 Int_t pid = AliCaloPID::kChargedHadron;
1221
7e9a1194 1222 if( dEdx < fdEdxMax && dEdx > fdEdxMin)
1223 {
e416be7d 1224 fhEOverPvsE->Fill(calo->E(), eOverp);
1225 fhEOverPvsP->Fill(track->P(), eOverp);
d9105d92 1226
7e9a1194 1227 if(m02 > 0.1 && m02 < 0.4)
1228 {
1229 fhEOverPvsECutM02CutdEdx->Fill(calo->E(), eOverp);
1230 fhEOverPvsPCutM02CutdEdx->Fill(track->P(), eOverp);
1231 }
1232
1233 if( eOverp < fEOverPMax && eOverp > fEOverPMin)
1234 {
d9105d92 1235 pid = AliCaloPID::kElectron;
d9105d92 1236 } //E/p
1237
1238 }// dEdx
1239
764ab1f4 1240 aodpart.SetIdentifiedParticleType(pid);
d9105d92 1241
1242 Int_t pidIndex = 0;// Electron
dbf54f1e 1243 if(pid == AliCaloPID::kChargedHadron) pidIndex = 1;
7e9a1194 1244
1245 //--------------------------------------------------------------------------------------
1246 //Play with the MC stack if available
1247 //--------------------------------------------------------------------------------------
1248
1249 //Check origin of the candidates
1250 if(IsDataMC())
1251 {
1252 Int_t tag = GetMCAnalysisUtils()->CheckOrigin(calo->GetLabels(),calo->GetNLabels(),GetReader());
1253 aodpart.SetTag(tag);
1254
1255 if(GetDebug() > 0)
1256 printf("AliAnaElectron::MakeAnalysisFillAOD() - Origin of candidate, bit map %d\n",aodpart.GetTag());
1257
1258 if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) && fhMCE[pidIndex][kmcPhoton])
1259 {
1260 fhMCdEdxvsE [kmcPhoton]->Fill(calo ->E(), dEdx);
1261 fhMCdEdxvsP [kmcPhoton]->Fill(track->P(), dEdx);
1262 fhMCEOverPvsE[kmcPhoton]->Fill(calo ->E(), eOverp);
1263 fhMCEOverPvsP[kmcPhoton]->Fill(track->P(), eOverp);
1264
1265 if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion) && fhMCE[pidIndex][kmcConversion])
1266 {
1267 fhMCdEdxvsE [kmcConversion]->Fill(calo ->E(), dEdx);
1268 fhMCdEdxvsP [kmcConversion]->Fill(track->P(), dEdx);
1269 fhMCEOverPvsE[kmcConversion]->Fill(calo ->E(), eOverp);
1270 fhMCEOverPvsP[kmcConversion]->Fill(track->P(), eOverp);
1271 }
1272 else if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0Decay) &&
1273 !GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) && fhMCE[pidIndex][kmcPi0Decay])
1274 {
1275 fhMCdEdxvsE [kmcPi0Decay]->Fill(calo ->E(), dEdx);
1276 fhMCdEdxvsP [kmcPi0Decay]->Fill(track->P(), dEdx);
1277 fhMCEOverPvsE[kmcPi0Decay]->Fill(calo ->E(), eOverp);
1278 fhMCEOverPvsP[kmcPi0Decay]->Fill(track->P(), eOverp);
1279 }
1280 else if( (GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEtaDecay) ||
1281 GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCOtherDecay) ) && fhMCE[pidIndex][kmcOtherDecay])
1282 {
1283 fhMCdEdxvsE [kmcOtherDecay]->Fill(calo ->E(), dEdx);
1284 fhMCdEdxvsP [kmcOtherDecay]->Fill(track->P(), dEdx);
1285 fhMCEOverPvsE[kmcOtherDecay]->Fill(calo ->E(), eOverp);
1286 fhMCEOverPvsP[kmcOtherDecay]->Fill(track->P(), eOverp);
1287 }
1288 else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) && fhMCE [pidIndex][kmcPi0])
1289 {
1290 fhMCdEdxvsE [kmcPi0]->Fill(calo ->E(), dEdx);
1291 fhMCdEdxvsP [kmcPi0]->Fill(track->P(), dEdx);
1292 fhMCEOverPvsE[kmcPi0]->Fill(calo ->E(), eOverp);
1293 fhMCEOverPvsP[kmcPi0]->Fill(track->P(), eOverp);
1294 }
1295 else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEta) && fhMCE[pidIndex][kmcEta])
1296 {
1297 fhMCdEdxvsE [kmcEta]->Fill(calo ->E(), dEdx);
1298 fhMCdEdxvsP [kmcEta]->Fill(track->P(), dEdx);
1299 fhMCEOverPvsE[kmcEta]->Fill(calo ->E(), eOverp);
1300 fhMCEOverPvsP[kmcEta]->Fill(track->P(), eOverp);
1301 }
1302 }
1303 else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCAntiNeutron) && fhMCE[pidIndex][kmcAntiNeutron])
1304 {
1305 fhMCdEdxvsE [kmcAntiNeutron]->Fill(calo ->E(), dEdx);
1306 fhMCdEdxvsP [kmcAntiNeutron]->Fill(track->P(), dEdx);
1307 fhMCEOverPvsE[kmcAntiNeutron]->Fill(calo ->E(), eOverp);
1308 fhMCEOverPvsP[kmcAntiNeutron]->Fill(track->P(), eOverp);
1309 }
1310 else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCAntiProton) && fhMCE[pidIndex][kmcAntiProton])
1311 {
1312 fhMCdEdxvsE [kmcAntiProton]->Fill(calo ->E(), dEdx);
1313 fhMCdEdxvsP [kmcAntiProton]->Fill(track->P(), dEdx);
1314 fhMCEOverPvsE[kmcAntiProton]->Fill(calo ->E(), eOverp);
1315 fhMCEOverPvsP[kmcAntiProton]->Fill(track->P(), eOverp);
1316 }
1317 else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCElectron) && fhMCE[pidIndex][kmcElectron])
1318 {
1319 fhMCdEdxvsE [kmcElectron]->Fill(calo ->E(), dEdx);
1320 fhMCdEdxvsP [kmcElectron]->Fill(track->P(), dEdx);
1321 fhMCEOverPvsE[kmcElectron]->Fill(calo ->E(), eOverp);
1322 fhMCEOverPvsP[kmcElectron]->Fill(track->P(), eOverp);
1323 }
1324 else if( fhMCE[pidIndex][kmcOther])
1325 {
1326 fhMCdEdxvsE [kmcOther]->Fill(calo ->E(), dEdx);
1327 fhMCdEdxvsP [kmcOther]->Fill(track->P(), dEdx);
1328 fhMCEOverPvsE[kmcOther]->Fill(calo ->E(), eOverp);
1329 fhMCEOverPvsP[kmcOther]->Fill(track->P(), eOverp);
1330 }
1331 }// set MC tag and fill Histograms with MC
d9105d92 1332
78a28af3 1333 //---------------------------------
d9105d92 1334 //Fill some shower shape histograms
78a28af3 1335 //---------------------------------
1a72f6c5 1336
764ab1f4 1337 FillShowerShapeHistograms(calo,aodpart.GetTag(),pid);
7e9a1194 1338
78a28af3 1339 if(pid == AliCaloPID::kElectron)
1340 WeightHistograms(calo);
1341
1342 //-----------------------------------------
d9105d92 1343 //PID Shower Shape selection or bit setting
78a28af3 1344 //-----------------------------------------
1345
d9105d92 1346 // Data, PID check on
3c1d9afb 1347 if(IsCaloPIDOn())
1348 {
49b5c49b 1349 // Get most probable PID, 2 options check bayesian PID weights or redo PID
1350 // By default, redo PID
d9105d92 1351
764ab1f4 1352 if(GetCaloPID()->GetIdentifiedParticleType(calo)!=AliCaloPID::kPhoton)
1353 {
1354 continue;
1355 }
1356 if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - PDG of identified particle %d\n",aodpart.GetIdentifiedParticleType());
d9105d92 1357
1358 }
49b5c49b 1359
3c1d9afb 1360 if(GetDebug() > 1) printf("AliAnaElectron::MakeAnalysisFillAOD() - Photon selection cuts passed: pT %3.2f, pdg %d\n",
764ab1f4 1361 aodpart.Pt(), aodpart.GetIdentifiedParticleType());
d9105d92 1362
d9105d92 1363 //FIXME, this to MakeAnalysisFillHistograms ...
d9105d92 1364 Float_t maxCellFraction = 0;
d9105d92 1365
ecdde216 1366 Int_t absID = GetCaloUtils()->GetMaxEnergyCell(cells, calo,maxCellFraction);
1367 if(absID>=0)fhMaxCellDiffClusterE[pidIndex]->Fill(aodpart.E(),maxCellFraction);
764ab1f4 1368 fhNCellsE[pidIndex] ->Fill(aodpart.E(),calo->GetNCells());
7e9a1194 1369 fhNLME[pidIndex] ->Fill(aodpart.E(),nMaxima);
764ab1f4 1370 fhTimeE[pidIndex] ->Fill(aodpart.E(),calo->GetTOF()*1.e9);
1371
1372 //Add AOD with electron/hadron object to aod branch
1373 if ( pid == fAODParticle || fAODParticle == 0 )
1374 {
1375 AddAODParticle(aodpart);
1376 }
42d47cb7 1377
d9105d92 1378 }//loop
1379
1380 if(GetDebug() > 1) printf("AliAnaElectron::MakeAnalysisFillAOD() End fill AODs, with %d entries \n",GetOutputAODBranch()->GetEntriesFast());
1381
1382}
1383
78a28af3 1384//________________________________________________
d9105d92 1385void AliAnaElectron::MakeAnalysisFillHistograms()
1386{
1387 //Fill histograms
1388
1389 //-------------------------------------------------------------------
1390 // Access MC information in stack if requested, check that it exists.
1391 AliStack * stack = 0x0;
1392 TParticle * primary = 0x0;
1393 TClonesArray * mcparticles = 0x0;
1394 AliAODMCParticle * aodprimary = 0x0;
1395
1396 if(IsDataMC()){
1397
1398 if(GetReader()->ReadStack()){
1399 stack = GetMCStack() ;
1400 if(!stack) {
1401 printf("AliAnaElectron::MakeAnalysisFillHistograms() - Stack not available, is the MC handler called? STOP\n");
1402 abort();
1403 }
1404
1405 }
1406 else if(GetReader()->ReadAODMCParticles()){
1407
1408 //Get the list of MC particles
2644ead9 1409 mcparticles = GetReader()->GetAODMCParticles();
d9105d92 1410 if(!mcparticles && GetDebug() > 0) {
1411 printf("AliAnaElectron::MakeAnalysisFillHistograms() - Standard MCParticles not available!\n");
1412 }
1413 }
1414 }// is data and MC
1415
1416
1417 // Get vertex
1418 Double_t v[3] = {0,0,0}; //vertex ;
1419 GetReader()->GetVertex(v);
1420 //fhVertex->Fill(v[0],v[1],v[2]);
1421 if(TMath::Abs(v[2]) > GetZvertexCut()) return ; // done elsewhere for Single Event analysis, but there for mixed event
1422
1423 //----------------------------------
1424 //Loop on stored AOD photons
1425 Int_t naod = GetOutputAODBranch()->GetEntriesFast();
1426 if(GetDebug() > 0) printf("AliAnaElectron::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
1427
3c1d9afb 1428 for(Int_t iaod = 0; iaod < naod ; iaod++)
1429 {
d9105d92 1430 AliAODPWG4Particle* ph = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
1431 Int_t pdg = ph->GetIdentifiedParticleType();
1432
1433 Int_t pidIndex = 0;// Electron
1434 if (pdg == AliCaloPID::kElectron) pidIndex = 0;
1435 else if(pdg == AliCaloPID::kChargedHadron) pidIndex = 1;
1436 else continue ;
1437
1438 if(ph->GetDetector() != fCalorimeter) continue;
1439
1440 if(GetDebug() > 2)
1441 printf("AliAnaElectron::MakeAnalysisFillHistograms() - ID Electron: pt %f, phi %f, eta %f\n", ph->Pt(),ph->Phi(),ph->Eta()) ;
1442
1443 //................................
1444 //Fill photon histograms
1445 Float_t ptcluster = ph->Pt();
1446 Float_t phicluster = ph->Phi();
1447 Float_t etacluster = ph->Eta();
1448 Float_t ecluster = ph->E();
1449
1450 fhE[pidIndex] ->Fill(ecluster);
1451 fhPt[pidIndex] ->Fill(ptcluster);
1452 fhPhi[pidIndex] ->Fill(ptcluster,phicluster);
1453 fhEta[pidIndex] ->Fill(ptcluster,etacluster);
1454 if (ecluster > 0.5) fhEtaPhi[pidIndex] ->Fill(etacluster, phicluster);
1455 else if(GetMinPt() < 0.5) fhEtaPhi05[pidIndex]->Fill(etacluster, phicluster);
1456
1457 //.......................................
1458 //Play with the MC data if available
1459 if(IsDataMC()){
1460
1461 //....................................................................
1462 // Access MC information in stack if requested, check that it exists.
1463 Int_t label =ph->GetLabel();
1464 if(label < 0) {
1465 if(GetDebug() > 1) printf("AliAnaElectron::MakeAnalysisFillHistograms() *** bad label ***: label %d \n", label);
1466 continue;
1467 }
1468
1469 Float_t eprim = 0;
ecdde216 1470 //Float_t ptprim = 0;
d9105d92 1471 if(GetReader()->ReadStack()){
1472
1473 if(label >= stack->GetNtrack()) {
1474 if(GetDebug() > 2) printf("AliAnaElectron::MakeAnalysisFillHistograms() *** large label ***: label %d, n tracks %d \n", label, stack->GetNtrack());
1475 continue ;
1476 }
1477
1478 primary = stack->Particle(label);
1479 if(!primary){
1480 printf("AliAnaElectron::MakeAnalysisFillHistograms() *** no primary ***: label %d \n", label);
1481 continue;
1482 }
1483
1484 eprim = primary->Energy();
ecdde216 1485 //ptprim = primary->Pt();
d9105d92 1486
1487 }
1488 else if(GetReader()->ReadAODMCParticles()){
1489 //Check which is the input
1490 if(ph->GetInputFileIndex() == 0){
1491 if(!mcparticles) continue;
1492 if(label >= mcparticles->GetEntriesFast()) {
1493 if(GetDebug() > 2) printf("AliAnaElectron::MakeAnalysisFillHistograms() *** large label ***: label %d, n tracks %d \n",
1494 label, mcparticles->GetEntriesFast());
1495 continue ;
1496 }
1497 //Get the particle
1498 aodprimary = (AliAODMCParticle*) mcparticles->At(label);
1499
1500 }
1501
1502 if(!aodprimary){
1503 printf("AliAnaElectron::MakeAnalysisFillHistograms() *** no primary ***: label %d \n", label);
1504 continue;
1505 }
1506
1507 eprim = aodprimary->E();
ecdde216 1508 //ptprim = aodprimary->Pt();
d9105d92 1509
1510 }
1511
1512 Int_t tag =ph->GetTag();
1513
c5693f62 1514 if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) && fhMCE[pidIndex][kmcPhoton])
d9105d92 1515 {
c5693f62 1516 fhMCE [pidIndex][kmcPhoton] ->Fill(ecluster);
1517 fhMCPt [pidIndex][kmcPhoton] ->Fill(ptcluster);
1518 fhMCPhi[pidIndex][kmcPhoton] ->Fill(ecluster,phicluster);
1519 fhMCEta[pidIndex][kmcPhoton] ->Fill(ecluster,etacluster);
d9105d92 1520
c5693f62 1521 fhMC2E[pidIndex][kmcPhoton] ->Fill(ecluster, eprim);
1522 fhMCDeltaE[pidIndex][kmcPhoton] ->Fill(ecluster,eprim-ecluster);
d9105d92 1523
c5693f62 1524 if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion) && fhMCE[pidIndex][kmcConversion])
d9105d92 1525 {
c5693f62 1526 fhMCE [pidIndex][kmcConversion] ->Fill(ecluster);
1527 fhMCPt [pidIndex][kmcConversion] ->Fill(ptcluster);
1528 fhMCPhi[pidIndex][kmcConversion] ->Fill(ecluster,phicluster);
1529 fhMCEta[pidIndex][kmcConversion] ->Fill(ecluster,etacluster);
d9105d92 1530
c5693f62 1531 fhMC2E[pidIndex][kmcConversion] ->Fill(ecluster, eprim);
1532 fhMCDeltaE[pidIndex][kmcConversion] ->Fill(ecluster,eprim-ecluster);
d9105d92 1533
1534 }
1535 else if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0Decay) &&
c5693f62 1536 !GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) && fhMCE[pidIndex][kmcPi0Decay])
d9105d92 1537 {
c5693f62 1538 fhMCE [pidIndex][kmcPi0Decay] ->Fill(ecluster);
1539 fhMCPt [pidIndex][kmcPi0Decay] ->Fill(ptcluster);
1540 fhMCPhi[pidIndex][kmcPi0Decay] ->Fill(ecluster,phicluster);
1541 fhMCEta[pidIndex][kmcPi0Decay] ->Fill(ecluster,etacluster);
d9105d92 1542
c5693f62 1543 fhMC2E[pidIndex][kmcPi0Decay] ->Fill(ecluster, eprim);
1544 fhMCDeltaE[pidIndex][kmcPi0Decay] ->Fill(ecluster,eprim-ecluster);
d9105d92 1545 }
1546 else if( (GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEtaDecay) ||
c5693f62 1547 GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCOtherDecay) ) && fhMCE[pidIndex][kmcOtherDecay])
d9105d92 1548 {
c5693f62 1549 fhMCE [pidIndex][kmcOtherDecay] ->Fill(ecluster);
1550 fhMCPt [pidIndex][kmcOtherDecay] ->Fill(ptcluster);
1551 fhMCPhi[pidIndex][kmcOtherDecay] ->Fill(ecluster,phicluster);
1552 fhMCEta[pidIndex][kmcOtherDecay] ->Fill(ecluster,etacluster);
d9105d92 1553
c5693f62 1554 fhMC2E[pidIndex][kmcOtherDecay] ->Fill(ecluster, eprim);
1555 fhMCDeltaE[pidIndex][kmcOtherDecay] ->Fill(ecluster,eprim-ecluster);
d9105d92 1556 }
c5693f62 1557 else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) && fhMCE [pidIndex][kmcPi0])
d9105d92 1558 {
c5693f62 1559 fhMCE [pidIndex][kmcPi0] ->Fill(ecluster);
1560 fhMCPt [pidIndex][kmcPi0] ->Fill(ptcluster);
1561 fhMCPhi[pidIndex][kmcPi0] ->Fill(ecluster,phicluster);
1562 fhMCEta[pidIndex][kmcPi0] ->Fill(ecluster,etacluster);
d9105d92 1563
c5693f62 1564 fhMC2E[pidIndex][kmcPi0] ->Fill(ecluster, eprim);
1565 fhMCDeltaE[pidIndex][kmcPi0] ->Fill(ecluster,eprim-ecluster);
d9105d92 1566
1567 }
c5693f62 1568 else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEta) && fhMCE[pidIndex][kmcEta])
d9105d92 1569 {
c5693f62 1570 fhMCE [pidIndex][kmcEta] ->Fill(ecluster);
1571 fhMCPt [pidIndex][kmcEta] ->Fill(ptcluster);
1572 fhMCPhi[pidIndex][kmcEta] ->Fill(ecluster,phicluster);
1573 fhMCEta[pidIndex][kmcEta] ->Fill(ecluster,etacluster);
d9105d92 1574
c5693f62 1575 fhMC2E[pidIndex][kmcEta] ->Fill(ecluster, eprim);
1576 fhMCDeltaE[pidIndex][kmcEta] ->Fill(ecluster,eprim-ecluster);
d9105d92 1577
1578 }
1579 }
c5693f62 1580 else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCAntiNeutron) && fhMCE[pidIndex][kmcAntiNeutron])
d9105d92 1581 {
c5693f62 1582 fhMCE [pidIndex][kmcAntiNeutron] ->Fill(ecluster);
1583 fhMCPt [pidIndex][kmcAntiNeutron] ->Fill(ptcluster);
1584 fhMCPhi[pidIndex][kmcAntiNeutron] ->Fill(ecluster,phicluster);
1585 fhMCEta[pidIndex][kmcAntiNeutron] ->Fill(ecluster,etacluster);
d9105d92 1586
c5693f62 1587 fhMC2E[pidIndex][kmcAntiNeutron] ->Fill(ecluster, eprim);
1588 fhMCDeltaE[pidIndex][kmcAntiNeutron] ->Fill(ecluster,eprim-ecluster);
d9105d92 1589
1590 }
c5693f62 1591 else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCAntiProton) && fhMCE[pidIndex][kmcAntiProton])
d9105d92 1592 {
c5693f62 1593 fhMCE [pidIndex][kmcAntiProton] ->Fill(ecluster);
1594 fhMCPt [pidIndex][kmcAntiProton] ->Fill(ptcluster);
1595 fhMCPhi[pidIndex][kmcAntiProton] ->Fill(ecluster,phicluster);
1596 fhMCEta[pidIndex][kmcAntiProton] ->Fill(ecluster,etacluster);
d9105d92 1597
c5693f62 1598 fhMC2E[pidIndex][kmcAntiProton] ->Fill(ecluster, eprim);
1599 fhMCDeltaE[pidIndex][kmcAntiProton] ->Fill(ecluster,eprim-ecluster);
d9105d92 1600
1601 }
c5693f62 1602 else if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCElectron) && fhMCE[pidIndex][kmcElectron])
d9105d92 1603 {
c5693f62 1604 fhMCE [pidIndex][kmcElectron] ->Fill(ecluster);
1605 fhMCPt [pidIndex][kmcElectron] ->Fill(ptcluster);
1606 fhMCPhi[pidIndex][kmcElectron] ->Fill(ecluster,phicluster);
1607 fhMCEta[pidIndex][kmcElectron] ->Fill(ecluster,etacluster);
d9105d92 1608
c5693f62 1609 fhMC2E[pidIndex][kmcElectron] ->Fill(ecluster, eprim);
1610 fhMCDeltaE[pidIndex][kmcElectron] ->Fill(ecluster,eprim-ecluster);
d9105d92 1611
1612 }
c5693f62 1613 else if( fhMCE[pidIndex][kmcOther]){
1614 fhMCE [pidIndex][kmcOther] ->Fill(ecluster);
1615 fhMCPt [pidIndex][kmcOther] ->Fill(ptcluster);
1616 fhMCPhi[pidIndex][kmcOther] ->Fill(ecluster,phicluster);
1617 fhMCEta[pidIndex][kmcOther] ->Fill(ecluster,etacluster);
d9105d92 1618
c5693f62 1619 fhMC2E[pidIndex][kmcOther] ->Fill(ecluster, eprim);
1620 fhMCDeltaE[pidIndex][kmcOther] ->Fill(ecluster,eprim-ecluster);
d9105d92 1621
1622 }
1623
1624 }//Histograms with MC
1625
1626 }// aod loop
1627
1628}
1629
78a28af3 1630//____________________________________________________
d9105d92 1631void AliAnaElectron::Print(const Option_t * opt) const
1632{
1633 //Print some relevant parameters set for the analysis
1634
1635 if(! opt)
1636 return;
1637
1638 printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
745913ae 1639 AliAnaCaloTrackCorrBaseClass::Print(" ");
d9105d92 1640
1641 printf("Calorimeter = %s\n", fCalorimeter.Data()) ;
1642 printf(" %2.2f < dEdx < %2.2f \n",fdEdxMin,fdEdxMax) ;
1643 printf(" %2.2f < E/P < %2.2f \n",fEOverPMin,fEOverPMax) ;
1644 printf("Min Distance to Bad Channel = %2.1f\n",fMinDist);
1645 printf("Min Distance to Bad Channel 2 = %2.1f\n",fMinDist2);
1646 printf("Min Distance to Bad Channel 3 = %2.1f\n",fMinDist3);
1647 printf("Time Cut: %3.1f < TOF < %3.1f\n", fTimeCutMin, fTimeCutMax);
1648 printf("Number of cells in cluster is > %d \n", fNCellsCut);
1649 printf(" \n") ;
1650
1651}
78a28af3 1652
78a28af3 1653//______________________________________________________
1654void AliAnaElectron::WeightHistograms(AliVCluster *clus)
1655{
1656 // Calculate weights and fill histograms
1657
1658 if(!fFillWeightHistograms || GetMixedEvent()) return;
1659
1660 AliVCaloCells* cells = 0;
1661 if(fCalorimeter == "EMCAL") cells = GetEMCALCells();
1662 else cells = GetPHOSCells();
1663
1664 // First recalculate energy in case non linearity was applied
1665 Float_t energy = 0;
1666 Float_t ampMax = 0;
1667 for (Int_t ipos = 0; ipos < clus->GetNCells(); ipos++) {
1668
1669 Int_t id = clus->GetCellsAbsId()[ipos];
1670
1671 //Recalibrate cell energy if needed
1672 Float_t amp = cells->GetCellAmplitude(id);
dbba06ca 1673 GetCaloUtils()->RecalibrateCellAmplitude(amp,fCalorimeter, id);
78a28af3 1674
1675 energy += amp;
1676
1677 if(amp> ampMax)
1678 ampMax = amp;
1679
1680 } // energy loop
1681
1682 if(energy <=0 ) {
1683 printf("AliAnaCalorimeterQA::WeightHistograms()- Wrong calculated energy %f\n",energy);
1684 return;
1685 }
1686
1a72f6c5 1687 //printf("AliAnaElectron::WeightHistograms() - energy %f, ampmax %f, rat %f, lograt %f\n",energy,ampMax,ampMax/energy,TMath::Log(ampMax/energy));
78a28af3 1688 fhEMaxCellClusterRatio ->Fill(energy,ampMax/energy);
1689 fhEMaxCellClusterLogRatio->Fill(energy,TMath::Log(ampMax/energy));
1690
1691 //Get the ratio and log ratio to all cells in cluster
1692 for (Int_t ipos = 0; ipos < clus->GetNCells(); ipos++) {
1693 Int_t id = clus->GetCellsAbsId()[ipos];
1694
1695 //Recalibrate cell energy if needed
1696 Float_t amp = cells->GetCellAmplitude(id);
dbba06ca 1697 GetCaloUtils()->RecalibrateCellAmplitude(amp, fCalorimeter, id);
78a28af3 1698
1699 //printf("energy %f, amp %f, rat %f, lograt %f\n",energy,amp,amp/energy,TMath::Log(amp/energy));
1700 fhECellClusterRatio ->Fill(energy,amp/energy);
1701 fhECellClusterLogRatio->Fill(energy,TMath::Log(amp/energy));
1702 }
1703
1704 //Recalculate shower shape for different W0
1705 if(fCalorimeter=="EMCAL"){
1706
1707 Float_t l0org = clus->GetM02();
1708 Float_t l1org = clus->GetM20();
1709 Float_t dorg = clus->GetDispersion();
1710
1a72f6c5 1711 for(Int_t iw = 0; iw < 14; iw++){
1712
1713 GetCaloUtils()->GetEMCALRecoUtils()->SetW0(1+iw*0.5);
78a28af3 1714 GetCaloUtils()->GetEMCALRecoUtils()->RecalculateClusterShowerShapeParameters(GetEMCALGeometry(), cells, clus);
1715
1716 fhLambda0ForW0[iw]->Fill(energy,clus->GetM02());
1a72f6c5 1717 //fhLambda1ForW0[iw]->Fill(energy,clus->GetM20());
78a28af3 1718
1719 //printf("\t w %1.1f, l0 %f, l1 %f,\n",3+iw*0.5,clus->GetM02(),clus->GetM20());
1720
1721 } // w0 loop
1722
1723 // Set the original values back
1724 clus->SetM02(l0org);
1725 clus->SetM20(l1org);
1726 clus->SetDispersion(dorg);
1727
1728 }// EMCAL
1729}
1730
1731