]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/GammaConv/AliCaloPhotonCuts.cxx
- changes to new Conv Calo Task for efficient running on the grid
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliCaloPhotonCuts.cxx
CommitLineData
8bdca7f1 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Authors: Friederike Bock, Baldo Sahlmueller *
5 * Version 1.0 *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16////////////////////////////////////////////////
17//---------------------------------------------
18// Class handling all kinds of selection cuts for
19// Photon from EMCAL clusters
20//---------------------------------------------
21////////////////////////////////////////////////
22
23#include "AliCaloPhotonCuts.h"
24#include "AliAnalysisManager.h"
25#include "AliInputEventHandler.h"
26#include "AliMCEventHandler.h"
27#include "AliAODHandler.h"
28#include "TH1.h"
29#include "TH2.h"
30#include "TF1.h"
31#include "AliStack.h"
32#include "AliAODConversionMother.h"
33#include "TObjString.h"
34#include "AliAODEvent.h"
35#include "AliESDEvent.h"
36#include "AliCentrality.h"
37#include "TList.h"
38#include "TFile.h"
39#include "AliLog.h"
40#include "AliV0ReaderV1.h"
41#include "AliAODMCParticle.h"
42#include "AliAODMCHeader.h"
43
44class iostream;
45
46using namespace std;
47
48ClassImp(AliCaloPhotonCuts)
49
50
51const char* AliCaloPhotonCuts::fgkCutNames[AliCaloPhotonCuts::kNCuts] = {
52 "ClusterType", //0
53 "EtaMin", //1
54 "EtaMax", //2
55 "PhiMin", //3
56 "PhiMax", //4
57 "DistanceToBadChannel", //5
58 "Timing", //6
59 "TrackMatching", //7
60 "ExoticCell", //8
61 "MinEnergy", //9
62 "MinNCells", //10
63 "MinM02", //11
64 "MaxM02", //12
65 "MinM20", //13
66 "MaxM20", //14
67 "MaximumDispersion", //15
68 "NLM" //16
69};
70
71
72//________________________________________________________________________
73AliCaloPhotonCuts::AliCaloPhotonCuts(const char *name,const char *title) :
74 AliAnalysisCuts(name,title),
75 fHistograms(NULL),
76 fClusterType(0),
77 fMinEtaCut(-10),
78 fMaxEtaCut(10),
9df9736d 79 fUseEtaCut(0),
8bdca7f1 80 fMinPhiCut(-10000),
81 fMaxPhiCut(-10000),
9df9736d 82 fUsePhiCut(0),
8bdca7f1 83 fMinDistanceToBadChannel(0),
9df9736d 84 fUseDistanceToBadChannel(0),
8bdca7f1 85 fMaxTimeDiff(10e10),
9df9736d 86 fUseTimeDiff(0),
8bdca7f1 87 fMinDistTrackToCluster(0),
9df9736d 88 fUseDistTrackToCluster(0),
8bdca7f1 89 fExoticCell(0),
9df9736d 90 fUseExoticCell(0),
8bdca7f1 91 fMinEnergy(0),
9df9736d 92 fUseMinEnergy(0),
8bdca7f1 93 fMinNCells(0),
9df9736d 94 fUseNCells(0),
8bdca7f1 95 fMaxM02(1000),
96 fMinM02(0),
9df9736d 97 fUseM02(0),
8bdca7f1 98 fMaxM20(1000),
99 fMinM20(0),
9df9736d 100 fUseM20(0),
8bdca7f1 101 fMaxDispersion(1000),
9df9736d 102 fUseDispersion(0),
8bdca7f1 103 fMinNLM(0),
104 fMaxNLM(1000),
9df9736d 105 fUseNLM(0),
8bdca7f1 106 fCutString(NULL),
107 fHistCutIndex(NULL),
108 fHistAcceptanceCuts(NULL),
109 fHistClusterIdentificationCuts(NULL),
110 fHistClusterEtavsPhiBeforeAcc(NULL),
111 fHistClusterEtavsPhiAfterAcc(NULL),
112 fHistClusterEtavsPhiAfterQA(NULL),
113 fHistDistanceToBadChannelBeforeAcc(NULL),
114 fHistDistanceToBadChannelAfterAcc(NULL),
115 fHistClusterTimevsEBeforeQA(NULL),
116 fHistClusterTimevsEAfterQA(NULL),
117 fHistExoticCellBeforeQA(NULL),
118 fHistExoticCellAfterQA(NULL),
119 fHistDistanceTrackToClusterBeforeQA(NULL),
120 fHistDistanceTrackToClusterAfterQA(NULL),
121 fHistEnergyOfClusterBeforeQA(NULL),
122 fHistEnergyOfClusterAfterQA(NULL),
123 fHistNCellsBeforeQA(NULL),
124 fHistNCellsAfterQA(NULL),
125 fHistM02BeforeQA(NULL),
126 fHistM02AfterQA(NULL),
127 fHistM20BeforeQA(NULL),
128 fHistM20AfterQA(NULL),
129 fHistDispersionBeforeQA(NULL),
130 fHistDispersionAfterQA(NULL),
131 fHistNLMBeforeQA(NULL),
132 fHistNLMAfterQA(NULL)
133{
134 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=0;}
135 fCutString=new TObjString((GetCutNumber()).Data());
136}
137
138//________________________________________________________________________
139AliCaloPhotonCuts::AliCaloPhotonCuts(const AliCaloPhotonCuts &ref) :
140 AliAnalysisCuts(ref),
141 fHistograms(NULL),
9df9736d 142 fClusterType(ref.fClusterType),
8bdca7f1 143 fMinEtaCut(ref.fMinEtaCut),
144 fMaxEtaCut(ref.fMaxEtaCut),
9df9736d 145 fUseEtaCut(ref.fUseEtaCut),
8bdca7f1 146 fMinPhiCut(ref.fMinPhiCut),
147 fMaxPhiCut(ref.fMaxPhiCut),
9df9736d 148 fUsePhiCut(ref.fUsePhiCut),
8bdca7f1 149 fMinDistanceToBadChannel(ref.fMinDistanceToBadChannel),
9df9736d 150 fUseDistanceToBadChannel(ref.fUseDistanceToBadChannel),
8bdca7f1 151 fMaxTimeDiff(ref.fMaxTimeDiff),
9df9736d 152 fUseTimeDiff(ref.fUseTimeDiff),
8bdca7f1 153 fMinDistTrackToCluster(ref.fMinDistTrackToCluster),
9df9736d 154 fUseDistTrackToCluster(ref.fUseDistTrackToCluster),
8bdca7f1 155 fExoticCell(ref.fExoticCell),
9df9736d 156 fUseExoticCell(ref.fUseExoticCell),
8bdca7f1 157 fMinEnergy(ref.fMinEnergy),
9df9736d 158 fUseMinEnergy(ref.fUseMinEnergy),
8bdca7f1 159 fMinNCells(ref.fMinNCells),
9df9736d 160 fUseNCells(ref.fUseNCells),
8bdca7f1 161 fMaxM02(ref.fMaxM02),
162 fMinM02(ref.fMinM02),
9df9736d 163 fUseM02(ref.fUseM02),
8bdca7f1 164 fMaxM20(ref.fMaxM20),
165 fMinM20(ref.fMinM20),
9df9736d 166 fUseM20(ref.fUseDispersion),
8bdca7f1 167 fMaxDispersion(ref.fMaxDispersion),
9df9736d 168 fUseDispersion(ref.fUseDispersion),
8bdca7f1 169 fMinNLM(ref.fMinNLM),
170 fMaxNLM(ref.fMaxNLM),
9df9736d 171 fUseNLM(ref.fUseNLM),
8bdca7f1 172 fCutString(NULL),
173 fHistCutIndex(NULL),
174 fHistAcceptanceCuts(NULL),
175 fHistClusterIdentificationCuts(NULL),
176 fHistClusterEtavsPhiBeforeAcc(NULL),
177 fHistClusterEtavsPhiAfterAcc(NULL),
178 fHistClusterEtavsPhiAfterQA(NULL),
179 fHistDistanceToBadChannelBeforeAcc(NULL),
180 fHistDistanceToBadChannelAfterAcc(NULL),
181 fHistClusterTimevsEBeforeQA(NULL),
182 fHistClusterTimevsEAfterQA(NULL),
183 fHistExoticCellBeforeQA(NULL),
184 fHistExoticCellAfterQA(NULL),
185 fHistDistanceTrackToClusterBeforeQA(NULL),
186 fHistDistanceTrackToClusterAfterQA(NULL),
187 fHistEnergyOfClusterBeforeQA(NULL),
188 fHistEnergyOfClusterAfterQA(NULL),
189 fHistNCellsBeforeQA(NULL),
190 fHistNCellsAfterQA(NULL),
191 fHistM02BeforeQA(NULL),
192 fHistM02AfterQA(NULL),
193 fHistM20BeforeQA(NULL),
194 fHistM20AfterQA(NULL),
195 fHistDispersionBeforeQA(NULL),
196 fHistDispersionAfterQA(NULL),
197 fHistNLMBeforeQA(NULL),
198 fHistNLMAfterQA(NULL)
199{
200 // Copy Constructor
201 for(Int_t jj=0;jj<kNCuts;jj++){fCuts[jj]=ref.fCuts[jj];}
202 fCutString=new TObjString((GetCutNumber()).Data());
203
204}
205
206
207//________________________________________________________________________
208AliCaloPhotonCuts::~AliCaloPhotonCuts() {
209 // Destructor
210 //Deleting fHistograms leads to seg fault it it's added to output collection of a task
211 // if(fHistograms)
212 // delete fHistograms;
213 // fHistograms = NULL;
214 if(fCutString != NULL){
215 delete fCutString;
216 fCutString = NULL;
217 }
218}
219
220//________________________________________________________________________
221void AliCaloPhotonCuts::InitCutHistograms(TString name){
222
223 // Initialize Cut Histograms for QA (only initialized and filled if function is called)
224 TH1::AddDirectory(kFALSE);
225
226 if(fHistograms != NULL){
227 delete fHistograms;
228 fHistograms=NULL;
229 }
230 if(fHistograms==NULL){
231 fHistograms=new TList();
232 fHistograms->SetOwner(kTRUE);
233 if(name=="")fHistograms->SetName(Form("CaloCuts_%s",GetCutNumber().Data()));
234 else fHistograms->SetName(Form("%s_%s",name.Data(),GetCutNumber().Data()));
235 }
236
237 // IsPhotonSelected
238 fHistCutIndex=new TH1F(Form("IsPhotonSelected %s",GetCutNumber().Data()),"IsPhotonSelected",5,-0.5,4.5);
239 fHistCutIndex->GetXaxis()->SetBinLabel(kPhotonIn+1,"in");
240 fHistCutIndex->GetXaxis()->SetBinLabel(kDetector+1,"detector");
241 fHistCutIndex->GetXaxis()->SetBinLabel(kAcceptance+1,"acceptance");
242 fHistCutIndex->GetXaxis()->SetBinLabel(kClusterQuality+1,"cluster QA");
243 fHistCutIndex->GetXaxis()->SetBinLabel(kPhotonOut+1,"out");
244 fHistograms->Add(fHistCutIndex);
245
246 // Acceptance Cuts
247 fHistAcceptanceCuts=new TH1F(Form("AcceptanceCuts %s",GetCutNumber().Data()),"AcceptanceCuts",5,-0.5,4.5);
248 fHistAcceptanceCuts->GetXaxis()->SetBinLabel(1,"in");
249 fHistAcceptanceCuts->GetXaxis()->SetBinLabel(2,"eta");
250 fHistAcceptanceCuts->GetXaxis()->SetBinLabel(3,"phi");
251 fHistAcceptanceCuts->GetXaxis()->SetBinLabel(4,"distance to bad channel");
252 fHistAcceptanceCuts->GetXaxis()->SetBinLabel(5,"out");
253 fHistograms->Add(fHistAcceptanceCuts);
254
255 // Cluster Cuts
9df9736d 256 fHistClusterIdentificationCuts =new TH1F(Form("ClusterQualityCuts %s",GetCutNumber().Data()),"ClusterQualityCuts",11,-0.5,10.5);
8bdca7f1 257 fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(1,"in");
258 fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(2,"timing");
259 fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(3,"track matching");
260 fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(4,"Exotics");
261 fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(5,"minimum energy");
9df9736d 262 fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(6,"minimum NCells");
263 fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(7,"M02");
264 fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(8,"M20");
265 fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(9,"dispersion");
266 fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(10,"NLM");
267 fHistClusterIdentificationCuts->GetXaxis()->SetBinLabel(11,"out");
8bdca7f1 268 fHistograms->Add(fHistClusterIdentificationCuts);
269
270 // Acceptance related histogramms
271 fHistClusterEtavsPhiBeforeAcc=new TH2F(Form("EtaPhi_beforeAcceptance %s",GetCutNumber().Data()),"EtaPhi_beforeAcceptance",462,-TMath::Pi(),TMath::Pi(),110,-0.7,0.7);
272 fHistograms->Add(fHistClusterEtavsPhiBeforeAcc);
273 fHistClusterEtavsPhiAfterAcc=new TH2F(Form("EtaPhi_afterAcceptance %s",GetCutNumber().Data()),"EtaPhi_afterAcceptance",462,-TMath::Pi(),TMath::Pi(),110,-0.7,0.7);
274 fHistograms->Add(fHistClusterEtavsPhiAfterAcc);
275 fHistClusterEtavsPhiAfterQA=new TH2F(Form("EtaPhi_afterClusterQA %s",GetCutNumber().Data()),"EtaPhi_afterClusterQA",462,-TMath::Pi(),TMath::Pi(),110,-0.7,0.7);
276 fHistograms->Add(fHistClusterEtavsPhiAfterQA);
277 fHistDistanceToBadChannelBeforeAcc = new TH1F(Form("DistanceToBadChannel_beforeAcceptance %s",GetCutNumber().Data()),"DistanceToBadChannel_beforeAcceptance",200,0,40);
278 fHistograms->Add(fHistDistanceToBadChannelBeforeAcc);
279 fHistDistanceToBadChannelAfterAcc = new TH1F(Form("DistanceToBadChannel_afterAcceptance %s",GetCutNumber().Data()),"DistanceToBadChannel_afterAcceptance",200,0,40);
280 fHistograms->Add(fHistDistanceToBadChannelAfterAcc);
281
282 // Cluster quality related histograms
283 fHistClusterTimevsEBeforeQA=new TH2F(Form("ClusterTimeVsE_beforeClusterQA %s",GetCutNumber().Data()),"ClusterTimeVsE_beforeClusterQA",400,-10e-6,10e-6,100,0.,40);
284 fHistograms->Add(fHistClusterTimevsEBeforeQA);
285 fHistClusterTimevsEAfterQA=new TH2F(Form("ClusterTimeVsE_afterClusterQA %s",GetCutNumber().Data()),"ClusterTimeVsE_afterClusterQA",400,-10e-6,10e-6,100,0.,40);
286 fHistograms->Add(fHistClusterTimevsEAfterQA);
287 fHistExoticCellBeforeQA=new TH2F(Form("ExoticCell_beforeClusterQA %s",GetCutNumber().Data()),"ExoticCell_beforeClusterQA",400,0,40,50,0.75,1);
288 fHistograms->Add(fHistExoticCellBeforeQA);
289 fHistExoticCellAfterQA=new TH2F(Form("ExoticCell_afterClusterQA %s",GetCutNumber().Data()),"ExoticCell_afterClusterQA",400,0,40,50,0.75,1);
290 fHistograms->Add(fHistExoticCellAfterQA);
291 fHistDistanceTrackToClusterBeforeQA = new TH1F(Form("DistanceToTrack_beforeClusterQA %s",GetCutNumber().Data()),"DistanceToTrack_beforeClusterQA",200,0,40);
292 fHistograms->Add(fHistDistanceTrackToClusterBeforeQA);
293 fHistDistanceTrackToClusterAfterQA = new TH1F(Form("DistanceToTrack_afterClusterQA %s",GetCutNumber().Data()),"DistanceToTrack_afterClusterQA",200,0,40);
294 fHistograms->Add(fHistDistanceTrackToClusterAfterQA);
295 fHistEnergyOfClusterBeforeQA = new TH1F(Form("EnergyOfCluster_beforeClusterQA %s",GetCutNumber().Data()),"EnergyOfCluster_beforeClusterQA",300,0,30);
296 fHistograms->Add(fHistEnergyOfClusterBeforeQA);
297 fHistEnergyOfClusterAfterQA = new TH1F(Form("EnergyOfCluster_afterClusterQA %s",GetCutNumber().Data()),"EnergyOfCluster_afterClusterQA",300,0,30);
298 fHistograms->Add(fHistEnergyOfClusterAfterQA);
299 fHistNCellsBeforeQA = new TH1F(Form("NCellPerCluster_beforeClusterQA %s",GetCutNumber().Data()),"NCellPerCluster_beforeClusterQA",50,0,50);
300 fHistograms->Add(fHistNCellsBeforeQA);
301 fHistNCellsAfterQA = new TH1F(Form("NCellPerCluster_afterClusterQA %s",GetCutNumber().Data()),"NCellPerCluster_afterClusterQA",50,0,50);
302 fHistograms->Add(fHistNCellsAfterQA);
303 fHistM02BeforeQA = new TH1F(Form("M02_beforeClusterQA %s",GetCutNumber().Data()),"M02_beforeClusterQA",100,0,5);
304 fHistograms->Add(fHistM02BeforeQA);
305 fHistM02AfterQA = new TH1F(Form("M02_afterClusterQA %s",GetCutNumber().Data()),"M02_afterClusterQA",100,0,5);
306 fHistograms->Add(fHistM02AfterQA);
307 fHistM20BeforeQA = new TH1F(Form("M20_beforeClusterQA %s",GetCutNumber().Data()),"M20_beforeClusterQA",100,0,2.5);
308 fHistograms->Add(fHistM20BeforeQA);
309 fHistM20AfterQA = new TH1F(Form("M20_afterClusterQA %s",GetCutNumber().Data()),"M20_afterClusterQA",100,0,2.5);
310 fHistograms->Add(fHistM20AfterQA);
311 fHistDispersionBeforeQA = new TH1F(Form("Dispersion_beforeClusterQA %s",GetCutNumber().Data()),"Dispersion_beforeClusterQA",100,0,4);
312 fHistograms->Add(fHistDispersionBeforeQA);
313 fHistDispersionAfterQA = new TH1F(Form("Dispersion_afterClusterQA %s",GetCutNumber().Data()),"Dispersion_afterClusterQA",100,0,4);
314 fHistograms->Add(fHistDispersionAfterQA);
315 fHistNLMBeforeQA = new TH1F(Form("NLM_beforeClusterQA %s",GetCutNumber().Data()),"NLM_beforeClusterQA",10,0,10);
316 fHistograms->Add(fHistNLMBeforeQA);
317 fHistNLMAfterQA = new TH1F(Form("NLM_afterClusterQA %s",GetCutNumber().Data()),"NLM_afterClusterQA",10,0,10);
318 fHistograms->Add(fHistNLMAfterQA);
319
320 TH1::AddDirectory(kTRUE);
321}
322
323/*
324///________________________________________________________________________
325Bool_t AliCaloPhotonCuts::ClusterIsSelectedMC(TParticle *particle,AliStack *fMCStack,Bool_t checkForConvertedGamma){
326 // MonteCarlo Photon Selection
327
328 if(!fMCStack)return kFALSE;
329
330 if (particle->GetPdgCode() == 22){
331
332
333 if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) )
334 return kFALSE;
335 if(fEtaCutMin>-0.1){
336 if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) )
337 return kFALSE;
338 }
339
340 if(particle->GetMother(0) >-1 && fMCStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
341 return kFALSE; // no photon as mothers!
342 }
343
344 if(particle->GetMother(0) >= fMCStack->GetNprimary()){
345 return kFALSE; // the gamma has a mother, and it is not a primary particle
346 }
347
348 if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
349
350 // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
351 TParticle* ePos = NULL;
352 TParticle* eNeg = NULL;
353
354 if(particle->GetNDaughters() >= 2){
355 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
356 TParticle *tmpDaughter = fMCStack->Particle(daughterIndex);
357 if(tmpDaughter->GetUniqueID() == 5){
358 if(tmpDaughter->GetPdgCode() == 11){
359 eNeg = tmpDaughter;
360 } else if(tmpDaughter->GetPdgCode() == -11){
361 ePos = tmpDaughter;
362 }
363 }
364 }
365 }
366
367 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
368 return kFALSE;
369 }
370
371 if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
372 return kFALSE; // no reconstruction below the Pt cut
373 }
374
375 if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ||
376 eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) )
377 return kFALSE;
378
379 if(fEtaCutMin > -0.1){
380 if( (ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin)) ||
381 (eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin)) )
382 return kFALSE;
383 }
384
385 if(ePos->R()>fMaxR){
386 return kFALSE; // cuts on distance from collision point
387 }
388
389 if(abs(ePos->Vz()) > fMaxZ){
390 return kFALSE; // outside material
391 }
392 if(abs(eNeg->Vz()) > fMaxZ){
393 return kFALSE; // outside material
394 }
395
396 if( ePos->R() <= ((abs(ePos->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
397 return kFALSE; // line cut to exclude regions where we do not reconstruct
398 } else if ( fEtaCutMin != -0.1 && ePos->R() >= ((abs(ePos->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
399 return kFALSE;
400 }
401
402 if( eNeg->R() <= ((abs(eNeg->Vz()) * fLineCutZRSlope) - fLineCutZValue)){
403 return kFALSE; // line cut to exclude regions where we do not reconstruct
404 } else if ( fEtaCutMin != -0.1 && eNeg->R() >= ((abs(eNeg->Vz()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
405 return kFALSE;
406 }
407
408 return kTRUE;
409 //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
410 }
411 return kFALSE;
412}
413///________________________________________________________________________
414Bool_t AliCaloPhotonCuts::ClusterIsSelectedAODMC(AliAODMCParticle *particle,TClonesArray *aodmcArray,Bool_t checkForConvertedGamma){
415 // MonteCarlo Photon Selection
416
417 if(!aodmcArray)return kFALSE;
418
419 if (particle->GetPdgCode() == 22){
420 if( particle->Eta() > (fEtaCut) || particle->Eta() < (-fEtaCut) )
421 return kFALSE;
422 if(fEtaCutMin>-0.1){
423 if( particle->Eta() < (fEtaCutMin) && particle->Eta() > (-fEtaCutMin) )
424 return kFALSE;
425 }
426
427 if(particle->GetMother() > -1){
428 if((static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother())))->GetPdgCode() == 22){
429 return kFALSE; // no photon as mothers!
430 }
431 if(!(static_cast<AliAODMCParticle*>(aodmcArray->At(particle->GetMother()))->IsPrimary())){
432 return kFALSE; // the gamma has a mother, and it is not a primary particle
433 }
434 }
435
436 if(!checkForConvertedGamma) return kTRUE; // return in case of accepted gamma
437
438 // looking for conversion gammas (electron + positron from pairbuilding (= 5) )
439 AliAODMCParticle* ePos = NULL;
440 AliAODMCParticle* eNeg = NULL;
441
442 if(particle->GetNDaughters() >= 2){
443 for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
444 AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(aodmcArray->At(daughterIndex));
445 if(!tmpDaughter) continue;
446 if(((tmpDaughter->GetMCProcessCode())) == 5){ // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
447 if(tmpDaughter->GetPdgCode() == 11){
448 eNeg = tmpDaughter;
449 } else if(tmpDaughter->GetPdgCode() == -11){
450 ePos = tmpDaughter;
451 }
452 }
453 }
454 }
455
456 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
457 return kFALSE;
458 }
459
460 if(ePos->Pt()<fSinglePtCut || eNeg->Pt()<fSinglePtCut){
461 return kFALSE; // no reconstruction below the Pt cut
462 }
463
464 if( ePos->Eta() > (fEtaCut) || ePos->Eta() < (-fEtaCut) ||
465 eNeg->Eta() > (fEtaCut) || eNeg->Eta() < (-fEtaCut) )
466 return kFALSE;
467
468 if(fEtaCutMin > -0.1){
469 if( (ePos->Eta() < (fEtaCutMin) && ePos->Eta() > (-fEtaCutMin)) ||
470 (eNeg->Eta() < (fEtaCutMin) && eNeg->Eta() > (-fEtaCutMin)) )
471 return kFALSE;
472 }
473
474 Double_t rPos = sqrt( (ePos->Xv()*ePos->Xv()) + (ePos->Yv()*ePos->Yv()) );
475 Double_t rNeg = sqrt( (eNeg->Xv()*eNeg->Xv()) + (eNeg->Yv()*eNeg->Yv()) );
476
477 if(rPos>fMaxR){
478 return kFALSE; // cuts on distance from collision point
479 }
480 if(abs(ePos->Zv()) > fMaxZ){
481 return kFALSE; // outside material
482 }
483 if(abs(eNeg->Zv()) > fMaxZ){
484 return kFALSE; // outside material
485 }
486
487 if( rPos <= ((abs(ePos->Zv()) * fLineCutZRSlope) - fLineCutZValue)){
488 return kFALSE; // line cut to exclude regions where we do not reconstruct
489 } else if ( fEtaCutMin != -0.1 && rPos >= ((abs(ePos->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
490 return kFALSE;
491 }
492
493 if( rNeg <= ((abs(eNeg->Zv()) * fLineCutZRSlope) - fLineCutZValue)){
494 return kFALSE; // line cut to exclude regions where we do not reconstruct
495 } else if ( fEtaCutMin != -0.1 && rNeg >= ((abs(eNeg->Zv()) * fLineCutZRSlopeMin) - fLineCutZValueMin)){
496 return kFALSE;
497 }
498
499 return kTRUE;
500 //if(AcceptanceCut(particle,ePos,eNeg))return kTRUE;
501 }
502 return kFALSE;
503}*/
504
505
506
507///________________________________________________________________________
508// This function selects the clusters based on their quality criteria
509///________________________________________________________________________
510Bool_t AliCaloPhotonCuts::ClusterQualityCuts(AliVCluster* cluster, AliVEvent *event, Bool_t isMC)
511{ // Specific Photon Cuts
512
513 Int_t cutIndex = 0;
514 if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex);
515 cutIndex++;
516
517
518 // Fill Histos before Cuts
519 if(fHistClusterTimevsEBeforeQA) fHistClusterTimevsEBeforeQA->Fill(cluster->GetTOF(), cluster->E());
520// if(fHistExoticCellBeforeQA) fHistExoticCellBeforeQA->Fill(cluster->E(), );
521 if(fHistDistanceTrackToClusterBeforeQA) fHistDistanceTrackToClusterBeforeQA->Fill(cluster->GetEmcCpvDistance());
522 if(fHistEnergyOfClusterBeforeQA) fHistEnergyOfClusterBeforeQA->Fill(cluster->E());
523 if(fHistNCellsBeforeQA) fHistNCellsBeforeQA->Fill(cluster->GetNCells());
524 if(fHistM02BeforeQA) fHistM02BeforeQA->Fill(cluster->GetM02());
525 if(fHistM20BeforeQA) fHistM20BeforeQA->Fill(cluster->GetM20());
526 if(fHistDispersionBeforeQA) fHistDispersionBeforeQA->Fill(cluster->GetDispersion());
527// if(fHistNLMBeforeQA) fHistNLMBeforeQA->Fill(cluster->GetNExMax());
528
529 // Check wether timing is ok
9df9736d 530 if (fUseTimeDiff){
531 if(abs(cluster->GetTOF()) > fMaxTimeDiff && !isMC){
532 if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //1
533 return kFALSE;
534 }
535 }
8bdca7f1 536 cutIndex++; //2, next cut
537
538 // Minimum distance to track
9df9736d 539 if (fUseDistTrackToCluster){
540 if(cluster->GetEmcCpvDistance() < fMinDistTrackToCluster){
541 if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //2
542 return kFALSE;
543 }
544 }
8bdca7f1 545 cutIndex++;//3, next cut
546
547 // exotic cell cut --IMPLEMENT LATER---
548// if(!AcceptanceCuts(photon)){
549// if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //3
550// return kFALSE;
551// }
552 cutIndex++; //4, next cut
553
554 // minimum cell energy cut
9df9736d 555 if (fUseMinEnergy){
556 if(cluster->E() < fMinEnergy){
557 if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //4
558 return kFALSE;
559 }
560 }
8bdca7f1 561 cutIndex++; //5, next cut
562
563 // minimum number of cells
9df9736d 564 if (fUseNCells){
565 if(cluster->GetNCells() < fMinNCells) {
566 if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //5
567 return kFALSE;
568 }
569 }
8bdca7f1 570 cutIndex++; //6, next cut
571
572 // M02 cut
9df9736d 573 if (fUseM02){
574 if( cluster->GetM02()< fMinM02 || cluster->GetM02() > fMaxM02 ) {
575 if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //6
576 return kFALSE;
577 }
578 }
8bdca7f1 579 cutIndex++; //7, next cut
580
581 // M20 cut
9df9736d 582 if (fUseM20){
583 if( cluster->GetM20()< fMinM20 || cluster->GetM20() > fMaxM20 ) {
584 if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //7
585 return kFALSE;
586 }
587 }
8bdca7f1 588 cutIndex++; //8, next cut
589
590 // dispersion cut
9df9736d 591 if (fUseDispersion){
592 if( cluster->GetDispersion()> fMaxDispersion) {
593 if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //8
594 return kFALSE;
595 }
596 }
8bdca7f1 597 cutIndex++; //9, next cut
598
599 // NLM cut --IMPLEMENT LATER---
9df9736d 600// if (fUseNLM){
601// if( cluster->GetDispersion()> fMaxDispersion) {
602// if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //9
603// return kFALSE;
604// }
605// }
8bdca7f1 606 cutIndex++; //9, next cut
607
608 // DONE with selecting photons
609 if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //10
610
611 // Histos after Cuts
612 Double_t vertex[3] = {0};
613 event->GetPrimaryVertex()->GetXYZ(vertex);
614 // TLorentzvector with cluster
615 TLorentzVector clusterVector;
616 cluster->GetMomentum(clusterVector,vertex);
617 Double_t etaCluster = clusterVector.Eta();
618 Double_t phiCluster = clusterVector.Phi();
619
620 if(fHistClusterEtavsPhiAfterQA) fHistClusterEtavsPhiAfterQA->Fill(phiCluster,etaCluster);
621 if(fHistClusterTimevsEAfterQA) fHistClusterTimevsEAfterQA->Fill(cluster->GetTOF(), cluster->E());
622// if(fHistExoticCellAfterQA) fHistExoticCellAfterQA->Fill(cluster->E(), );
623 if(fHistDistanceTrackToClusterAfterQA) fHistDistanceTrackToClusterAfterQA->Fill(cluster->GetEmcCpvDistance());
624 if(fHistEnergyOfClusterAfterQA) fHistEnergyOfClusterAfterQA->Fill(cluster->E());
625 if(fHistNCellsAfterQA) fHistNCellsAfterQA->Fill(cluster->GetNCells());
626 if(fHistM02AfterQA) fHistM02AfterQA->Fill(cluster->GetM02());
627 if(fHistM20AfterQA) fHistM20AfterQA->Fill(cluster->GetM20());
628 if(fHistDispersionAfterQA) fHistDispersionAfterQA->Fill(cluster->GetDispersion());
629// if(fHistNLMBeforeQA) fHistNLMAfterQA->Fill(cluster->GetNExMax());
630
631 return kTRUE;
632
633}
634
635
636///________________________________________________________________________
637Bool_t AliCaloPhotonCuts::ClusterIsSelected(AliVCluster *cluster, AliVEvent * event, Bool_t isMC)
638{
639 //Selection of Reconstructed photon clusters with Calorimeters
640
641 FillClusterCutIndex(kPhotonIn);
642
643 Double_t vertex[3] = {0};
644 event->GetPrimaryVertex()->GetXYZ(vertex);
645 // TLorentzvector with cluster
646 TLorentzVector clusterVector;
647 cluster->GetMomentum(clusterVector,vertex);
648 Double_t etaCluster = clusterVector.Eta();
649 Double_t phiCluster = clusterVector.Phi();
650
651 // Histos before cuts
652 if(fHistClusterEtavsPhiBeforeAcc) fHistClusterEtavsPhiBeforeAcc->Fill(phiCluster,etaCluster);
653
654 // Cluster Selection - 0= accept any calo cluster
655 if (fClusterType > 0){
656 //Select EMCAL cluster
657 if (fClusterType == 1 && !cluster->IsEMCAL()){
658 FillClusterCutIndex(kDetector);
9df9736d 659 return kFALSE;
8bdca7f1 660 }
661 //Select PHOS cluster
662 if (fClusterType == 2 && !cluster->IsPHOS()){
663 FillClusterCutIndex(kDetector);
9df9736d 664 return kFALSE;
8bdca7f1 665 }
666 }
667
668 // Acceptance Cuts
669 if(!AcceptanceCuts(cluster,event)){
670 FillClusterCutIndex(kAcceptance);
671 return kFALSE;
672 }
673 // Cluster Quality Cuts
674 if(!ClusterQualityCuts(cluster,event,isMC)){
675 FillClusterCutIndex(kClusterQuality);
676 return kFALSE;
677 }
678
679 // Photon passed cuts
680 FillClusterCutIndex(kPhotonOut);
681 return kTRUE;
682}
683
684
685///________________________________________________________________________
686Bool_t AliCaloPhotonCuts::AcceptanceCuts(AliVCluster *cluster, AliVEvent* event)
687{
688 // Exclude certain areas for photon reconstruction
689
690 Int_t cutIndex=0;
691 if(fHistAcceptanceCuts)fHistAcceptanceCuts->Fill(cutIndex);
692 cutIndex++;
693
694
695 Double_t vertex[3] = {0};
696 event->GetPrimaryVertex()->GetXYZ(vertex);
697 // TLorentzvector with cluster
698 TLorentzVector clusterVector;
699 cluster->GetMomentum(clusterVector,vertex);
700 Double_t etaCluster = clusterVector.Eta();
701 Double_t phiCluster = clusterVector.Phi();
702
703 // check eta range
9df9736d 704 if (fUseEtaCut){
8bdca7f1 705 if (etaCluster < fMinEtaCut || etaCluster > fMaxEtaCut){
706 if(fHistAcceptanceCuts)fHistAcceptanceCuts->Fill(cutIndex);
707 return kFALSE;
708 }
9df9736d 709 }
8bdca7f1 710 cutIndex++;
711
712 // check phi range
9df9736d 713 if (fUsePhiCut ){
8bdca7f1 714 if (phiCluster < fMinPhiCut || phiCluster > fMaxEtaCut){
715 if(fHistAcceptanceCuts)fHistAcceptanceCuts->Fill(cutIndex);
716 return kFALSE;
717 }
718 }
719 cutIndex++;
720
721 // check distance to bad channel
9df9736d 722 if (fUseDistanceToBadChannel){
723 if (cluster->GetDistanceToBadChannel() < fMinDistanceToBadChannel){
724 if(fHistAcceptanceCuts)fHistAcceptanceCuts->Fill(cutIndex);
725 return kFALSE;
726 }
727 }
728 cutIndex++;
8bdca7f1 729 if(fHistAcceptanceCuts)fHistAcceptanceCuts->Fill(cutIndex);
730
731 // Histos after cuts
732 if(fHistClusterEtavsPhiAfterAcc) fHistClusterEtavsPhiAfterAcc->Fill(phiCluster,etaCluster);
733
734 return kTRUE;
735}
736
737///________________________________________________________________________
738Bool_t AliCaloPhotonCuts::UpdateCutString() {
739 ///Update the cut string (if it has been created yet)
740
741 if(fCutString && fCutString->GetString().Length() == kNCuts) {
742 fCutString->SetString(GetCutNumber());
743 } else {
744 return kFALSE;
745 }
746 return kTRUE;
747}
748
749///________________________________________________________________________
750Bool_t AliCaloPhotonCuts::InitializeCutsFromCutString(const TString analysisCutSelection ) {
751 // Initialize Cuts from a given Cut string
752 AliInfo(Form("Set CaloCut Number: %s",analysisCutSelection.Data()));
753 if(analysisCutSelection.Length()!=kNCuts) {
754 AliError(Form("Cut selection has the wrong length! size is %d, number of cuts is %d", analysisCutSelection.Length(), kNCuts));
755 return kFALSE;
756 }
757 if(!analysisCutSelection.IsDigit()){
758 AliError("Cut selection contains characters");
759 return kFALSE;
760 }
761
762 const char *cutSelection = analysisCutSelection.Data();
763 #define ASSIGNARRAY(i) fCuts[i] = cutSelection[i] - '0'
764 for(Int_t ii=0;ii<kNCuts;ii++){
765 ASSIGNARRAY(ii);
766 }
767
768 // Set Individual Cuts
769 for(Int_t ii=0;ii<kNCuts;ii++){
770 if(!SetCut(cutIds(ii),fCuts[ii]))return kFALSE;
771 }
772 PrintCutsWithValues();
773 return kTRUE;
774}
775
776///________________________________________________________________________
777Bool_t AliCaloPhotonCuts::SetCut(cutIds cutID, const Int_t value) {
778 ///Set individual cut ID
779
780 switch (cutID) {
781
782 case kClusterType:
783 if( SetClusterTypeCut(value)) {
784 fCuts[kClusterType] = value;
785 UpdateCutString();
786 return kTRUE;
787 } else return kFALSE;
788
789 case kEtaMin:
790 if( SetMinEtaCut(value)) {
791 fCuts[kEtaMin] = value;
792 UpdateCutString();
793 return kTRUE;
794 } else return kFALSE;
795
796 case kEtaMax:
797 if( SetMaxEtaCut(value)) {
798 fCuts[kEtaMax] = value;
799 UpdateCutString();
800 return kTRUE;
801 } else return kFALSE;
802
803 case kPhiMin:
804 if( SetMinPhiCut(value)) {
805 fCuts[kPhiMin] = value;
806 UpdateCutString();
807 return kTRUE;
808 } else return kFALSE;
809
810 case kPhiMax:
811 if( SetMaxPhiCut(value)) {
812 fCuts[kPhiMax] = value;
813 UpdateCutString();
814 return kTRUE;
815 } else return kFALSE;
816
817 case kDistanceToBadChannel:
818 if( SetDistanceToBadChannelCut(value)) {
819 fCuts[kDistanceToBadChannel] = value;
820 UpdateCutString();
821 return kTRUE;
822 } else return kFALSE;
823
824 case kTiming:
825 if( SetTimingCut(value)) {
826 fCuts[kTiming] = value;
827 UpdateCutString();
828 return kTRUE;
829 } else return kFALSE;
830
831 case kTrackMatching:
832 if( SetTrackMatchingCut(value)) {
833 fCuts[kTrackMatching] = value;
834 UpdateCutString();
835 return kTRUE;
836 } else return kFALSE;
837
838 case kExoticCell:
839 if( SetExoticCellCut(value)) {
840 fCuts[kExoticCell] = value;
841 UpdateCutString();
842 return kTRUE;
843 } else return kFALSE;
844
845 case kMinEnery:
846 if( SetMinEnergyCut(value)) {
847 fCuts[kMinEnery] = value;
848 UpdateCutString();
849 return kTRUE;
850 } else return kFALSE;
851
852 case kNMinCells:
853 if( SetMinNCellsCut(value)) {
854 fCuts[kNMinCells] = value;
855 UpdateCutString();
856 return kTRUE;
857 } else return kFALSE;
858
859 case kMinM02:
860 if( SetMinM02(value)) {
861 fCuts[kMinM02] = value;
862 UpdateCutString();
863 return kTRUE;
864 } else return kFALSE;
865
866 case kMaxM02:
867 if( SetMaxM02(value)) {
868 fCuts[kMaxM02] = value;
869 UpdateCutString();
870 return kTRUE;
871 } else return kFALSE;
872
873 case kMinM20:
874 if( SetMinM20(value)) {
875 fCuts[kMinM20] = value;
876 UpdateCutString();
877 return kTRUE;
878 } else return kFALSE;
879
880 case kMaxM20:
881 if( SetMaxM20(value)) {
882 fCuts[kMaxM20] = value;
883 UpdateCutString();
884 return kTRUE;
885 } else return kFALSE;
886
887 case kDispersion:
888 if( SetDispersion(value)) {
889 fCuts[kDispersion] = value;
890 UpdateCutString();
891 return kTRUE;
892 } else return kFALSE;
893
894 case kNLM:
895 if( SetNLM(value)) {
896 fCuts[kNLM] = value;
897 UpdateCutString();
898 return kTRUE;
899 } else return kFALSE;
900
901 case kNCuts:
902 AliError("Cut id out of range");
903 return kFALSE;
904 }
905
906 AliError("Cut id %d not recognized");
907 return kFALSE;
908
909
910}
911///________________________________________________________________________
912void AliCaloPhotonCuts::PrintCuts() {
913 // Print out current Cut Selection
914 for(Int_t ic = 0; ic < kNCuts; ic++) {
915 printf("%-30s : %d \n", fgkCutNames[ic], fCuts[ic]);
916 }
917}
918
919void AliCaloPhotonCuts::PrintCutsWithValues() {
920 // Print out current Cut Selection with value
135c1186 921 printf("\nCluster cutnumber \n");
922 for(Int_t ic = 0; ic < kNCuts; ic++) {
923 printf("%d",fCuts[ic]);
924 }
925 printf("\n\n");
926
8bdca7f1 927 printf("Acceptance cuts: \n");
9df9736d 928 if (fClusterType == 0) printf("\tall calorimeter clusters are used\n");
929 if (fClusterType == 1) printf("\tEMCAL calorimeter clusters are used\n");
930 if (fClusterType == 2) printf("\tPHOS calorimeter clusters are used\n");
931 if (fUseEtaCut) printf("\t%3.2f < eta_{cluster} < %3.2f\n", fMinEtaCut, fMaxEtaCut );
932 if (fUsePhiCut) printf("\t%3.2f < phi_{cluster} < %3.2f\n", fMinPhiCut, fMaxPhiCut );
933 if (fUseDistanceToBadChannel) printf("\tcut on exotics applied \n");
8bdca7f1 934
935 printf("Cluster Quality cuts: \n");
9df9736d 936 if (fUseTimeDiff) printf("\t time difference < %3.2f\n", fMaxTimeDiff );
937 if (fUseDistTrackToCluster) printf("\tmin distance to track > %3.2f\n", fMinDistTrackToCluster );
938 if (fUseExoticCell)printf("\t min distance to track > %3.2f\n", fMinDistTrackToCluster );
939 if (fUseMinEnergy)printf("\t E_{cluster} > %3.2f\n", fMinEnergy );
940 if (fUseNCells) printf("\t number of cells per cluster > %d\n", fMinNCells );
941 if (fUseM02) printf("\t %3.2f < M02 < %3.2f\n", fMinM02, fMaxM02 );
942 if (fUseM20) printf("\t %3.2f < M20 < %3.2f\n", fMinM20, fMaxM20 );
943 if (fUseDispersion) printf("\t dispersion < %3.2f\n", fMaxDispersion );
944 if (fUseNLM) printf("\t %d < NLM < %d\n", fMinNLM, fMaxNLM );
8bdca7f1 945
946}
947
948// EMCAL acceptance 2011
949// 1.39626, 3.125 (phi)
950// -0.66687,,0.66465
951
952
953///________________________________________________________________________
954Bool_t AliCaloPhotonCuts::SetClusterTypeCut(Int_t clusterType)
955{ // Set Cut
956 switch(clusterType){
957 case 0: // all clusters
958 fClusterType=0;
959 break;
960 case 1: // EMCAL clusters
961 fClusterType=1;
962 break;
963 case 2: // PHOS clusters
964 fClusterType=2;
965 break;
966 default:
967 AliError(Form("ClusterTypeCut not defined %d",clusterType));
968 return kFALSE;
969 }
970 return kTRUE;
971}
972
973//___________________________________________________________________
974Bool_t AliCaloPhotonCuts::SetMinEtaCut(Int_t minEta)
975{
976 switch(minEta){
9df9736d 977 case 0:
978 if (!fUseEtaCut) fUseEtaCut=0;
979 fMinEtaCut=-10.;
980 break;
981 case 1:
982 if (!fUseEtaCut) fUseEtaCut=1;
8bdca7f1 983 fMinEtaCut=-0.6687;
984 break;
9df9736d 985 case 2:
986 if (!fUseEtaCut) fUseEtaCut=1;
8bdca7f1 987 fClusterType=-0.5;
988 break;
9df9736d 989 case 3:
990 if (!fUseEtaCut) fUseEtaCut=1;
8bdca7f1 991 fClusterType=-2;
992 break;
993 default:
994 AliError(Form("MinEta Cut not defined %d",minEta));
995 return kFALSE;
996 }
997 return kTRUE;
998}
999
1000
1001//___________________________________________________________________
1002Bool_t AliCaloPhotonCuts::SetMaxEtaCut(Int_t maxEta)
1003{
1004 switch(maxEta){
1005 case 0:
9df9736d 1006 if (!fUseEtaCut) fUseEtaCut=0;
1007 fMaxEtaCut=10;
1008 break;
1009 case 1:
1010 if (!fUseEtaCut) fUseEtaCut=1;
8bdca7f1 1011 fMaxEtaCut=0.66465;
1012 break;
9df9736d 1013 case 2:
1014 if (!fUseEtaCut) fUseEtaCut=1;
8bdca7f1 1015 fMaxEtaCut=0.5;
1016 break;
9df9736d 1017 case 3:
1018 if (!fUseEtaCut) fUseEtaCut=1;
8bdca7f1 1019 fMaxEtaCut=2;
1020 break;
1021 default:
1022 AliError(Form("MaxEta Cut not defined %d",maxEta));
1023 return kFALSE;
1024 }
1025 return kTRUE;
1026}
1027
1028//___________________________________________________________________
1029Bool_t AliCaloPhotonCuts::SetMinPhiCut(Int_t minPhi)
1030{
1031 switch(minPhi){
1032 case 0:
9df9736d 1033 if (!fUsePhiCut) fUsePhiCut=0;
8bdca7f1 1034 fMinPhiCut=-10000;
1035 break;
1036 case 1:
9df9736d 1037 if (!fUsePhiCut) fUsePhiCut=1;
8bdca7f1 1038 fMinPhiCut=1.39626;
1039 break;
1040 default:
1041 AliError(Form("MinPhi Cut not defined %d",minPhi));
1042 return kFALSE;
1043 }
1044 return kTRUE;
1045}
1046
1047//___________________________________________________________________
1048Bool_t AliCaloPhotonCuts::SetMaxPhiCut(Int_t maxPhi)
1049{
1050 switch(maxPhi){
1051 case 0:
9df9736d 1052 if (!fUsePhiCut) fUsePhiCut=0;
8bdca7f1 1053 fMaxPhiCut=-10000;
1054 break;
1055 case 1:
9df9736d 1056 if (!fUsePhiCut) fUsePhiCut=1;
8bdca7f1 1057 fMaxPhiCut=3.125;
1058 break;
1059 default:
1060 AliError(Form("Max Phi Cut not defined %d",maxPhi));
1061 return kFALSE;
1062 }
1063 return kTRUE;
1064}
1065
1066//___________________________________________________________________
1067Bool_t AliCaloPhotonCuts::SetDistanceToBadChannelCut(Int_t distanceToBadChannel)
1068{
1069 switch(distanceToBadChannel){
1070 case 0:
9df9736d 1071 fUseDistanceToBadChannel=0;
8bdca7f1 1072 fMinDistanceToBadChannel=0;
1073 break;
1074 case 1:
9df9736d 1075 if (!fUseDistanceToBadChannel) fUseDistanceToBadChannel=1;
8bdca7f1 1076 fMinDistanceToBadChannel=5;
1077 break;
1078 default:
1079 AliError(Form("minimum distance to bad channel Cut not defined %d",distanceToBadChannel));
1080 return kFALSE;
1081 }
1082 return kTRUE;
1083}
1084
1085//___________________________________________________________________
1086Bool_t AliCaloPhotonCuts::SetTimingCut(Int_t timing)
1087{
1088 switch(timing){
1089 case 0:
9df9736d 1090 fUseTimeDiff=0;
8bdca7f1 1091 fMaxTimeDiff=500;
1092 break;
1093 case 1:
9df9736d 1094 if (!fUseTimeDiff) fUseTimeDiff=1;
8bdca7f1 1095 fMaxTimeDiff=10e-7; //1000ns
1096 break;
1097 case 2:
9df9736d 1098 if (!fUseTimeDiff) fUseTimeDiff=1;
8bdca7f1 1099 fMaxTimeDiff=50e-8; //500ns
1100 break;
1101 case 3:
9df9736d 1102 if (!fUseTimeDiff) fUseTimeDiff=1;
8bdca7f1 1103 fMaxTimeDiff=20e-8; //200ns
1104 break;
1105 case 4:
9df9736d 1106 if (!fUseTimeDiff) fUseTimeDiff=1;
8bdca7f1 1107 fMaxTimeDiff=10e-8; //100ns
1108 break;
1109 case 5:
9df9736d 1110 if (!fUseTimeDiff) fUseTimeDiff=1;
8bdca7f1 1111 fMaxTimeDiff=50e-9; //50ns
1112 break;
1113
1114 default:
1115 AliError(Form("Timing Cut not defined %d",timing));
1116 return kFALSE;
1117 }
1118 return kTRUE;
1119}
1120
1121//___________________________________________________________________
1122Bool_t AliCaloPhotonCuts::SetTrackMatchingCut(Int_t trackMatching)
1123{
1124 switch(trackMatching){
1125 case 0:
9df9736d 1126 fUseDistTrackToCluster=0;
8bdca7f1 1127 fMinDistTrackToCluster=0;
1128 break;
1129 case 1:
9df9736d 1130 if (!fUseDistTrackToCluster) fUseDistTrackToCluster=1;
8bdca7f1 1131 fMinDistTrackToCluster=5;
1132 break;
1133 default:
1134 AliError(Form("Track Matching Cut not defined %d",trackMatching));
1135 return kFALSE;
1136 }
1137 return kTRUE;
1138}
1139
1140//___________________________________________________________________
1141Bool_t AliCaloPhotonCuts::SetExoticCellCut(Int_t exoticCell)
1142{
1143 switch(exoticCell){
1144 case 0:
9df9736d 1145 fUseExoticCell=0;
8bdca7f1 1146 fExoticCell=0;
1147 break;
1148 case 1:
9df9736d 1149 if (!fUseExoticCell) fUseExoticCell=1;
8bdca7f1 1150 fExoticCell=5;
1151 break;
1152 default:
1153 AliError(Form("Exotic cell Cut not defined %d",exoticCell));
1154 return kFALSE;
1155 }
1156 return kTRUE;
1157}
1158
1159//___________________________________________________________________
1160Bool_t AliCaloPhotonCuts::SetMinEnergyCut(Int_t minEnergy)
1161{
1162 switch(minEnergy){
1163 case 0:
9df9736d 1164 if (!fUseMinEnergy) fUseMinEnergy=0;
8bdca7f1 1165 fMinEnergy=0;
1166 break;
1167 case 1:
9df9736d 1168 if (!fUseMinEnergy) fUseMinEnergy=1;
8bdca7f1 1169 fMinEnergy=0.05;
1170 break;
1171 case 2:
9df9736d 1172 if (!fUseMinEnergy) fUseMinEnergy=1;
8bdca7f1 1173 fMinEnergy=0.1;
1174 break;
1175 case 3:
9df9736d 1176 if (!fUseMinEnergy) fUseMinEnergy=1;
8bdca7f1 1177 fMinEnergy=0.15;
1178 break;
1179 case 4:
9df9736d 1180 if (!fUseMinEnergy) fUseMinEnergy=1;
8bdca7f1 1181 fMinEnergy=0.2;
1182 break;
1183 case 5:
9df9736d 1184 if (!fUseMinEnergy) fUseMinEnergy=1;
8bdca7f1 1185 fMinEnergy=0.3;
1186 break;
1187 case 6:
9df9736d 1188 if (!fUseMinEnergy) fUseMinEnergy=1;
8bdca7f1 1189 fMinEnergy=0.5;
1190 break;
1191 case 7:
9df9736d 1192 if (!fUseMinEnergy) fUseMinEnergy=1;
8bdca7f1 1193 fMinEnergy=0.75;
1194 break;
1195 case 8:
9df9736d 1196 if (!fUseMinEnergy) fUseMinEnergy=1;
8bdca7f1 1197 fMinEnergy=1.;
1198 break;
1199 case 9:
9df9736d 1200 if (!fUseMinEnergy) fUseMinEnergy=1;
8bdca7f1 1201 fMinEnergy=1.25;
1202 break;
1203 default:
1204 AliError(Form("Minimum Energy Cut not defined %d",minEnergy));
1205 return kFALSE;
1206 }
1207 return kTRUE;
1208}
1209
1210//___________________________________________________________________
1211Bool_t AliCaloPhotonCuts::SetMinNCellsCut(Int_t minNCells)
1212{
1213 switch(minNCells){
9df9736d 1214 case 0:
1215 if (!fUseNCells) fUseNCells=0;
8bdca7f1 1216 fMinNCells=0;
1217 break;
1218 case 1:
9df9736d 1219 if (!fUseNCells) fUseNCells=1;
8bdca7f1 1220 fMinNCells=1;
1221 break;
1222 case 2:
9df9736d 1223 if (!fUseNCells) fUseNCells=1;
8bdca7f1 1224 fMinNCells=2;
1225 break;
1226 case 3:
9df9736d 1227 if (!fUseNCells) fUseNCells=1;
8bdca7f1 1228 fMinNCells=3;
1229 break;
1230 case 4:
9df9736d 1231 if (!fUseNCells) fUseNCells=1;
8bdca7f1 1232 fMinNCells=4;
1233 break;
1234 case 5:
9df9736d 1235 if (!fUseNCells) fUseNCells=1;
8bdca7f1 1236 fMinNCells=5;
1237 break;
1238 case 6:
9df9736d 1239 if (!fUseNCells) fUseNCells=1;
8bdca7f1 1240 fMinNCells=6;
1241 break;
1242
1243 default:
1244 AliError(Form("Min N cells Cut not defined %d",minNCells));
1245 return kFALSE;
1246 }
1247 return kTRUE;
1248}
1249
1250//___________________________________________________________________
1251Bool_t AliCaloPhotonCuts::SetMaxM02(Int_t maxM02)
1252{
1253 switch(maxM02){
1254 case 0:
9df9736d 1255 if (!fUseM02) fUseM02=0;
8bdca7f1 1256 fMaxM02=100;
1257 break;
1258 case 1:
9df9736d 1259 if (!fUseM02) fUseM02=1;
8bdca7f1 1260 fMaxM02=1.;
1261 break;
1262 case 2:
9df9736d 1263 if (!fUseM02) fUseM02=1;
8bdca7f1 1264 fMaxM02=0.7;
1265 break;
1266 case 3:
9df9736d 1267 if (!fUseM02) fUseM02=1;
8bdca7f1 1268 fMaxM02=0.5;
1269 break;
1270 case 4:
9df9736d 1271 if (!fUseM02) fUseM02=1;
8bdca7f1 1272 fMaxM02=0.4;
1273 break;
8bdca7f1 1274 default:
1275 AliError(Form("Max M02 Cut not defined %d",maxM02));
1276 return kFALSE;
1277 }
1278 return kTRUE;
1279}
1280
1281//___________________________________________________________________
1282Bool_t AliCaloPhotonCuts::SetMinM02(Int_t minM02)
1283{
1284 switch(minM02){
1285 case 0:
9df9736d 1286 if (!fUseM02) fUseM02=0;
8bdca7f1 1287 fMinM02=0;
1288 break;
1289 case 1:
9df9736d 1290 if (!fUseM02) fUseM02=1;
8bdca7f1 1291 fMinM02=0.002;
1292 break;
1293 default:
1294 AliError(Form("Min M02 not defined %d",minM02));
1295 return kFALSE;
1296 }
1297 return kTRUE;
1298}
1299
1300//___________________________________________________________________
1301Bool_t AliCaloPhotonCuts::SetMaxM20(Int_t maxM20)
1302{
1303 switch(maxM20){
1304 case 0:
9df9736d 1305 if (!fUseM20) fUseM20=0;
8bdca7f1 1306 fMaxM20=100;
1307 break;
1308 case 1:
9df9736d 1309 if (!fUseM20) fUseM20=1;
8bdca7f1 1310 fMaxM20=0.5;
1311 break;
1312 default:
1313 AliError(Form("Max M20 Cut not defined %d",maxM20));
1314 return kFALSE;
1315 }
1316 return kTRUE;
1317}
1318
1319//___________________________________________________________________
1320Bool_t AliCaloPhotonCuts::SetMinM20(Int_t minM20)
1321{
1322 switch(minM20){
1323 case 0:
9df9736d 1324 if (!fUseM20) fUseM20=0;
8bdca7f1 1325 fMinM20=0;
1326 break;
1327 case 1:
9df9736d 1328 if (!fUseM20) fUseM20=1;
8bdca7f1 1329 fMinM20=0.002;
1330 break;
1331 default:
1332 AliError(Form("Min M20 Cut not defined %d",minM20));
1333 return kFALSE;
1334 }
1335 return kTRUE;
1336}
1337
1338//___________________________________________________________________
1339Bool_t AliCaloPhotonCuts::SetDispersion(Int_t dispersion)
1340{
1341 switch(dispersion){
1342 case 0:
9df9736d 1343 if (!fUseDispersion) fUseDispersion=0;
8bdca7f1 1344 fMaxDispersion =100;
1345 break;
1346 case 1:
9df9736d 1347 if (!fUseDispersion) fUseDispersion=1;
8bdca7f1 1348 fMaxDispersion=2.;
1349 break;
1350 default:
1351 AliError(Form("Maximum Dispersion Cut not defined %d",dispersion));
1352 return kFALSE;
1353 }
1354 return kTRUE;
1355}
1356
1357//___________________________________________________________________
1358Bool_t AliCaloPhotonCuts::SetNLM(Int_t nlm)
1359{
1360 switch(nlm){
1361 case 0:
9df9736d 1362 if (!fUseNLM) fUseNLM=0;
8bdca7f1 1363 fMinNLM =0;
1364 fMaxNLM =100;
1365 break;
1366 case 1:
9df9736d 1367 if (!fUseNLM) fUseNLM=1;
8bdca7f1 1368 fMinNLM =0;
1369 fMaxNLM =1;
1370 break;
1371 default:
1372 AliError(Form("NLM Cut not defined %d",nlm));
1373 return kFALSE;
1374 }
1375 return kTRUE;
1376}
1377
1378///________________________________________________________________________
1379TString AliCaloPhotonCuts::GetCutNumber(){
1380 // returns TString with current cut number
1381 TString a(kNCuts);
1382 for(Int_t ii=0;ii<kNCuts;ii++){
1383 a.Append(Form("%d",fCuts[ii]));
1384 }
1385 return a;
1386}
1387
1388