]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/AliHFEcuts.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliHFEcuts.cxx
CommitLineData
809a4336 1/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
7* Permission to use, copy, modify and distribute this software and its *
8* documentation strictly for non-commercial purposes is hereby granted *
9* without fee, provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
50685501 15//
16// Cut menagement class implemented by the
17// ALICE Heavy Flavour Electron Group
18// Interface to the correction framework
19// Provides a set of standard cuts
20//
21// Authors:
22// Raphaelle Bailhache <R.Bailhache@gsi.de>
23// Markus Fasel <M.Fasel@gsi.de>
24// Markus Heide <mheide@uni-muenster.de>
25// Matus Kalisky <m.kalisky@uni-muenster.de>
26//
70da6c5a 27// Overview over the 18 steps in the correction Framework
28// 0. Generated Electrons
29// 1. Signal Electrons
30// 2. Electron in Acceptance
31// ------------------------------------------------------------
32// 3. Rec without cuts (MC information)
33// 4. Rec Kine ITS/TPC (MC Information)
34// 5. Rec Primary (MC Information)
35// 6. HFE ITS (MC Information)
36// 7. HFE TRD (MC Information)
37// 8. PID (MC Information)
38// ............................................................
39// 9. Rec without cuts(MC Information for tracks which are already registered)
40// 10. Rec Kine ITS/TPC (MC Information for tracks which are already registered)
41// 11. RecPrimary (MC Information for tracks which are already registered)
42// 12. HFE ITS (MC Information for tracks which are already registered)
43// 13. HFE TPC (MC Information for tracks which are already registered)
44// 14. PID (MC Information for tracks which are already registered)
45// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
46// 15. Rec without cuts
47// 16. Rec Kine ITS/TPC
48// 17. Rec Primary
49// 18. HFE ITS
50// 19. HFE TRD
51// 20. PID
52//
809a4336 53#include <TClass.h>
54#include <TList.h>
55#include <TObjArray.h>
56#include <TString.h>
57
58#include "AliCFAcceptanceCuts.h"
59#include "AliCFCutBase.h"
0792aa82 60#include "AliCFEventGenCuts.h"
809a4336 61#include "AliCFManager.h"
62#include "AliCFParticleGenCuts.h"
63#include "AliCFTrackIsPrimaryCuts.h"
64#include "AliCFTrackKineCuts.h"
65#include "AliCFTrackQualityCuts.h"
66#include "AliESDtrack.h"
c2690925 67#include "AliHFEextraEventCuts.h"
e17c1f86 68#include "AliMCEvent.h"
69#include "AliVEvent.h"
809a4336 70
71#include "AliHFEcuts.h"
72
73ClassImp(AliHFEcuts)
74
3a72645a 75const Char_t *AliHFEcuts::fgkMCCutName[AliHFEcuts::kNcutStepsMCTrack] = {
76 "MCGenerated",
c2690925 77 "MCGeneratedZOutNoPileUpCentralityFine",
3a72645a 78 "MCGeneratedEventCut",
79 "MCInAcceptance"
80};
81
82const Char_t * AliHFEcuts::fgkRecoCutName[AliHFEcuts::kNcutStepsRecTrack] = {
83 "NoCuts",
84 "RecKineITSTPC",
85 "Primary",
86 "HFEITS",
9250ffbf 87 "HFETOF",
8c1c76e9 88 "HFETPC",
3a72645a 89 "HFETRD"
90};
91
92const Char_t * AliHFEcuts::fgkDECutName[AliHFEcuts::kNcutStepsDETrack] = {
93 "HFEDCA"
94};
95
c2690925 96const Char_t * AliHFEcuts::fgkSecvtxCutName[AliHFEcuts::kNcutStepsSecvtxTrack] = {
97 "HFESecvtx"
98};
99
3a72645a 100const Char_t * AliHFEcuts::fgkEventCutName[AliHFEcuts::kNcutStepsEvent] = {
101 "EventStepGenerated",
102 "EventStepRecNoCut",
103 "EventStepRecNoPileUp",
8c1c76e9 104 "EventStepRecCentralityOK",
3a72645a 105 "EventStepZRange",
106 "EventStepReconstructed"
107};
108
109const Char_t * AliHFEcuts::fgkUndefined = "Undefined";
110
809a4336 111//__________________________________________________________________
112AliHFEcuts::AliHFEcuts():
e3fc062d 113 TNamed(),
114 fRequirements(0),
76d0b522 115 fTPCclusterDef(0),
116 fTPCratioDef(0),
e3fc062d 117 fMinClustersTPC(0),
e17c1f86 118 fMinClustersTPCPID(0),
3a72645a 119 fMinClustersITS(0),
e3fc062d 120 fMinTrackletsTRD(0),
cedf0381 121 fMaxChi2TRD(-1.),
e3fc062d 122 fCutITSPixel(0),
123 fCheckITSLayerStatus(kTRUE),
5cd679b7 124 fCutITSDrift(0),
8c1c76e9 125 fMaxChi2clusterITS(-1.),
e3fc062d 126 fMaxChi2clusterTPC(0.),
127 fMinClusterRatioTPC(0.),
3a72645a 128 fVertexRangeZ(20.),
e17c1f86 129 fTRDtrackletsExact(kFALSE),
e3ae862b 130 fTOFPIDStep(kFALSE),
2e4ed823 131 fMatchTOFLabel(kFALSE),
c2690925 132 fTOFMISMATCHStep(kFALSE),
8c1c76e9 133 fTPCPIDCLEANUPStep(kFALSE),
cedf0381 134 fITSpatternCut(kFALSE),
c2690925 135 fUseMixedVertex(kTRUE),
63bdf450 136 fUseSPDVertex(kFALSE),
137 fUseCorrelationVertex(kFALSE),
4437a0d2 138 fSPDVtxResolution(kFALSE),
139 fPApileupCut(kFALSE),
c2690925 140 fIsIPSigmacut(kFALSE),
63bdf450 141 fIsIPcharge(kFALSE),
142 fIsIPOpp(kFALSE),
9250ffbf 143 fFractionOfSharedTPCClusters(-1.0),
144 fMaxImpactParameterRpar(kFALSE),
11ff28c5 145 fAdditionalStatusRequirement(0),
1c051dd4 146 fTOFsignaldx(-1.0),
147 fTOFsignaldz(-1.0),
96167a04 148 fAODFilterBit(-1),
bbeea05b 149 fRejectKinkDaughters(kTRUE),
150 fRejectKinkMothers(kTRUE),
e3fc062d 151 fHistQA(0x0),
152 fCutList(0x0),
153 fDebugLevel(0)
154{
155 //
156 // Dummy Constructor
157 //
8c1c76e9 158 memset(fProdVtx, 0, sizeof(Double_t) * 4);
bbeea05b 159 memset(fProdVtxZ, 0, sizeof(Double_t) * 2);
8c1c76e9 160 memset(fDCAtoVtx, 0, sizeof(Double_t) * 2);
161 memset(fPtRange, 0, sizeof(Double_t) * 2);
162 memset(fIPCutParams, 0, sizeof(Float_t) * 4);
163 memset(fSigmaToVtx, 0, sizeof(Double_t) * 3);
cddc311d 164 fEtaRange[0] = -0.8; fEtaRange[1] = 0.8;
a5fb8511 165 fPhiRange[0] = -1.; fPhiRange[1] = -1.;
e3fc062d 166}
167
168//__________________________________________________________________
169AliHFEcuts::AliHFEcuts(const Char_t *name, const Char_t *title):
170 TNamed(name, title),
809a4336 171 fRequirements(0),
76d0b522 172 fTPCclusterDef(0),
173 fTPCratioDef(0),
809a4336 174 fMinClustersTPC(0),
e17c1f86 175 fMinClustersTPCPID(0),
3a72645a 176 fMinClustersITS(0),
809a4336 177 fMinTrackletsTRD(0),
cedf0381 178 fMaxChi2TRD(-1.),
809a4336 179 fCutITSPixel(0),
0792aa82 180 fCheckITSLayerStatus(kTRUE),
5cd679b7 181 fCutITSDrift(0),
8c1c76e9 182 fMaxChi2clusterITS(-1.),
809a4336 183 fMaxChi2clusterTPC(0.),
184 fMinClusterRatioTPC(0.),
3a72645a 185 fVertexRangeZ(20.),
e17c1f86 186 fTRDtrackletsExact(kFALSE),
e3ae862b 187 fTOFPIDStep(kFALSE),
2e4ed823 188 fMatchTOFLabel(kFALSE),
c2690925 189 fTOFMISMATCHStep(kFALSE),
8c1c76e9 190 fTPCPIDCLEANUPStep(kFALSE),
cedf0381 191 fITSpatternCut(kFALSE),
c2690925 192 fUseMixedVertex(kTRUE),
63bdf450 193 fUseSPDVertex(kFALSE),
194 fUseCorrelationVertex(kFALSE),
d87a9d29 195 fSPDVtxResolution(kFALSE),
4437a0d2 196 fPApileupCut(kFALSE),
c2690925 197 fIsIPSigmacut(kFALSE),
63bdf450 198 fIsIPcharge(kFALSE),
199 fIsIPOpp(kFALSE),
9250ffbf 200 fFractionOfSharedTPCClusters(-1.0),
201 fMaxImpactParameterRpar(kFALSE),
11ff28c5 202 fAdditionalStatusRequirement(0),
1c051dd4 203 fTOFsignaldx(-1.0),
204 fTOFsignaldz(-1.0),
96167a04 205 fAODFilterBit(-1),
bbeea05b 206 fRejectKinkDaughters(kTRUE),
207 fRejectKinkMothers(kTRUE),
809a4336 208 fHistQA(0x0),
dbe3abbe 209 fCutList(0x0),
210 fDebugLevel(0)
809a4336 211{
212 //
213 // Default Constructor
214 //
215 memset(fProdVtx, 0, sizeof(Double_t) * 4);
bbeea05b 216 memset(fProdVtxZ, 0, sizeof(Double_t) * 2);
809a4336 217 memset(fDCAtoVtx, 0, sizeof(Double_t) * 2);
218 memset(fPtRange, 0, sizeof(Double_t) * 2);
c2690925 219 memset(fIPCutParams, 0, sizeof(Float_t) * 4);
8c1c76e9 220 memset(fSigmaToVtx, 0, sizeof(Double_t) * 3);
cddc311d 221 fEtaRange[0] = -0.8; fEtaRange[1] = 0.8;
a5fb8511 222 fPhiRange[0] = -1.; fPhiRange[1] = -1.;
809a4336 223}
224
225//__________________________________________________________________
226AliHFEcuts::AliHFEcuts(const AliHFEcuts &c):
e3fc062d 227 TNamed(c),
809a4336 228 fRequirements(c.fRequirements),
e3ae862b 229 fTPCclusterDef(c.fTPCclusterDef),
230 fTPCratioDef(c.fTPCratioDef),
e3fc062d 231 fMinClustersTPC(0),
e17c1f86 232 fMinClustersTPCPID(0),
3a72645a 233 fMinClustersITS(0),
e3fc062d 234 fMinTrackletsTRD(0),
cedf0381 235 fMaxChi2TRD(-1.),
e3fc062d 236 fCutITSPixel(0),
237 fCheckITSLayerStatus(0),
5cd679b7 238 fCutITSDrift(0),
8c1c76e9 239 fMaxChi2clusterITS(-1.),
e3fc062d 240 fMaxChi2clusterTPC(0),
241 fMinClusterRatioTPC(0),
3a72645a 242 fVertexRangeZ(20.),
e17c1f86 243 fTRDtrackletsExact(kFALSE),
e3ae862b 244 fTOFPIDStep(kFALSE),
2e4ed823 245 fMatchTOFLabel(kFALSE),
c2690925 246 fTOFMISMATCHStep(kFALSE),
8c1c76e9 247 fTPCPIDCLEANUPStep(kFALSE),
cedf0381 248 fITSpatternCut(c.fITSpatternCut),
c2690925 249 fUseMixedVertex(kTRUE),
63bdf450 250 fUseSPDVertex(kFALSE),
d87a9d29 251 fUseCorrelationVertex(c.fUseCorrelationVertex),
252 fSPDVtxResolution(c.fSPDVtxResolution),
4437a0d2 253 fPApileupCut(c.fPApileupCut),
c2690925 254 fIsIPSigmacut(kFALSE),
63bdf450 255 fIsIPcharge(kFALSE),
256 fIsIPOpp(kFALSE),
9250ffbf 257 fFractionOfSharedTPCClusters(-1.0),
258 fMaxImpactParameterRpar(kFALSE),
11ff28c5 259 fAdditionalStatusRequirement(0),
1c051dd4 260 fTOFsignaldx(-1.0),
261 fTOFsignaldz(-1.0),
96167a04 262 fAODFilterBit(-1),
bbeea05b 263 fRejectKinkDaughters(c.fRejectKinkDaughters),
264 fRejectKinkMothers(c.fRejectKinkMothers),
809a4336 265 fHistQA(0x0),
dbe3abbe 266 fCutList(0x0),
267 fDebugLevel(0)
809a4336 268{
269 //
270 // Copy Constructor
271 //
e3fc062d 272 c.Copy(*this);
273}
274
275//__________________________________________________________________
276AliHFEcuts &AliHFEcuts::operator=(const AliHFEcuts &c){
277 //
278 // Make assignment
279 //
280 if(&c != this) c.Copy(*this);
281 return *this;
282}
283
284//__________________________________________________________________
285void AliHFEcuts::Copy(TObject &c) const {
286 //
287 // Performing copy
288 //
289 AliHFEcuts &target = dynamic_cast<AliHFEcuts &>(c);
290
291 target.fRequirements = fRequirements;
e3ae862b 292 target.fTPCclusterDef = fTPCclusterDef;
293 target.fTPCratioDef = fTPCratioDef;
e3fc062d 294 target.fMinClustersTPC = fMinClustersTPC;
e17c1f86 295 target.fMinClustersTPCPID = fMinClustersTPCPID;
3a72645a 296 target.fMinClustersITS = fMinClustersITS;
e3fc062d 297 target.fMinTrackletsTRD = fMinTrackletsTRD;
cedf0381 298 target.fMaxChi2TRD = fMaxChi2TRD;
e3fc062d 299 target.fCutITSPixel = fCutITSPixel;
300 target.fCheckITSLayerStatus = fCheckITSLayerStatus;
5cd679b7 301 target.fCutITSDrift = fCutITSDrift;
8c1c76e9 302 target.fMaxChi2clusterITS = fMaxChi2clusterITS;
e3fc062d 303 target.fMaxChi2clusterTPC = fMaxChi2clusterTPC;
304 target.fMinClusterRatioTPC = fMinClusterRatioTPC;
3a72645a 305 target.fVertexRangeZ = fVertexRangeZ;
e17c1f86 306 target.fTRDtrackletsExact = fTRDtrackletsExact;
e3ae862b 307 target.fTOFPIDStep = fTOFPIDStep;
2e4ed823 308 target.fMatchTOFLabel = fMatchTOFLabel;
c2690925 309 target.fTOFMISMATCHStep = fTOFMISMATCHStep;
8c1c76e9 310 target.fTPCPIDCLEANUPStep = fTPCPIDCLEANUPStep;
c2690925 311 target.fUseMixedVertex = fUseMixedVertex;
63bdf450 312 target.fUseSPDVertex = fUseSPDVertex;
313 target.fUseCorrelationVertex = fUseCorrelationVertex;
d87a9d29 314 target.fSPDVtxResolution = fSPDVtxResolution;
4437a0d2 315 target.fPApileupCut = fPApileupCut;
c2690925 316 target.fIsIPSigmacut = fIsIPSigmacut;
63bdf450 317 target.fIsIPcharge = fIsIPcharge;
318 target.fIsIPOpp = fIsIPOpp;
9250ffbf 319 target.fFractionOfSharedTPCClusters = fFractionOfSharedTPCClusters;
320 target.fMaxImpactParameterRpar = fMaxImpactParameterRpar;
11ff28c5 321 target.fAdditionalStatusRequirement = fAdditionalStatusRequirement;
1c051dd4 322 target.fTOFsignaldx = fTOFsignaldx;
323 target.fTOFsignaldz = fTOFsignaldz;
96167a04 324 target.fAODFilterBit = fAODFilterBit;
bbeea05b 325 target.fRejectKinkDaughters = fRejectKinkDaughters;
326 target.fRejectKinkMothers = fRejectKinkMothers;
e3fc062d 327 target.fDebugLevel = 0;
328
329 memcpy(target.fProdVtx, fProdVtx, sizeof(Double_t) * 4);
bbeea05b 330 memcpy(target.fProdVtxZ, fProdVtxZ, sizeof(Double_t) * 2);
e3fc062d 331 memcpy(target.fDCAtoVtx, fDCAtoVtx, sizeof(Double_t) * 2);
332 memcpy(target.fPtRange, fPtRange, sizeof(Double_t) *2);
c2690925 333 memcpy(target.fIPCutParams, fIPCutParams, sizeof(Float_t) * 4);
8c1c76e9 334 memcpy(target.fSigmaToVtx, fSigmaToVtx, sizeof(Double_t) * 3);
cddc311d 335 memcpy(target.fEtaRange, fEtaRange, sizeof(Double_t) * 2);
a5fb8511 336 memcpy(target.fPhiRange, fPhiRange, sizeof(Double_t) * 2);
e3fc062d 337
338 // Copy cut List
339 if(target.fCutList){
340 target.fCutList->Clear();
341 delete target.fCutList;
342 }
343 if(fCutList){
344 target.fCutList = dynamic_cast<TObjArray *>(fCutList->Clone());
bf892a6a 345 if(target.fCutList) target.fCutList->SetOwner(); // Coverity
e3fc062d 346 }
347 if(target.fHistQA){
e3fc062d 348 delete target.fHistQA;
e3fc062d 349 }
350 if(fHistQA){
351 // If the QA list was already produced, then we create it new, loop over the cuts and connect all the histos with this list
352 target.fHistQA = new TList;
353 target.fHistQA->SetName(Form("%s_CutQAhistograms", GetName()));
c2690925 354 fHistQA->SetOwner(kTRUE);
e3fc062d 355 TIter cit(target.fCutList);
356 TObjArray *clist = NULL;
357 AliCFCutBase *co = NULL;
358 while((clist = dynamic_cast<TObjArray *>(cit()))){
359 TIter cit1(clist);
360 while((co = dynamic_cast<AliCFCutBase *>(cit1()))) co->SetQAOn(target.fHistQA);
361 }
362 }
809a4336 363}
364
365//__________________________________________________________________
366AliHFEcuts::~AliHFEcuts(){
367 //
368 // Destruktor
369 //
370 if(fCutList){
371 fCutList->Delete();
372 delete fCutList;
373 }
374 fCutList = 0x0;
c2690925 375 if(fHistQA) delete fHistQA;
809a4336 376}
377
8c1c76e9 378//__________________________________________________________________
379Long64_t AliHFEcuts::Merge(const TCollection *list){
380 //
381 // Merge function doing nothing, just writing the object to file
382 //
383 if(!list) return 0;
384 if(list->IsEmpty()) return 1;
385 Long64_t counts = 0;
386 // just count the number of objects to merge
387 TIter iter(list);
388 while(iter()){ counts++; }
389 return counts+1;
390}
391
809a4336 392//__________________________________________________________________
393void AliHFEcuts::Initialize(AliCFManager *cfm){
50685501 394 //
395 // Initializes the cut objects from the correction framework
396 // Publishes the cuts to the correction framework manager
397 //
faee3b18 398 AliDebug(2, "Called");
3a72645a 399 const Int_t kMCOffset = kNcutStepsMCTrack;
400 const Int_t kRecOffset = kNcutStepsRecTrack;
e3fc062d 401 if(fCutList)
402 fCutList->Delete();
403 else{
404 fCutList = new TObjArray;
405 fCutList->SetOwner();
406 }
407 if(IsQAOn()){
408 fHistQA = new TList;
409 fHistQA->SetName(Form("%s_CutQAhistograms", GetName()));
c2690925 410 fHistQA->SetOwner(kTRUE);
722347d8 411 }
412
809a4336 413 // Call all the setters for the cuts
414 SetParticleGenCutList();
415 SetAcceptanceCutList();
722347d8 416 SetRecKineITSTPCCutList();
809a4336 417 SetRecPrimaryCutList();
dbe3abbe 418 SetHFElectronITSCuts();
9250ffbf 419 SetHFElectronTOFCuts();
8c1c76e9 420 SetHFElectronTPCCuts();
dbe3abbe 421 SetHFElectronTRDCuts();
3a72645a 422 SetHFElectronDcaCuts();
dbe3abbe 423
9bcfd1ab 424 // Publish to the cuts which analysis type they are (ESD Analysis by default)
425 if(IsAOD()){
426 AliInfo("Setting AOD Analysis");
427 TObjArray *genCuts = dynamic_cast<TObjArray *>(fCutList->FindObject("fPartGenCuts"));
428 if(genCuts){
429 AliCFParticleGenCuts *myGenCut = dynamic_cast<AliCFParticleGenCuts *>(genCuts->FindObject("fCutsGenMC"));
76d0b522 430 if(myGenCut) {
431 myGenCut->SetAODMC(kTRUE);
432 }
9bcfd1ab 433 }
434 }
435
0792aa82 436 // Connect the event cuts
70da6c5a 437 SetEventCutList(kEventStepGenerated);
0792aa82 438 SetEventCutList(kEventStepReconstructed);
439 cfm->SetEventCutsList(kEventStepGenerated, dynamic_cast<TObjArray *>(fCutList->FindObject("fEvGenCuts")));
70da6c5a 440 cfm->SetEventCutsList(kEventStepReconstructed, dynamic_cast<TObjArray *>(fCutList->FindObject("fEvRecCuts")));
809a4336 441
0792aa82 442 // Connect the particle cuts
3a72645a 443 // 1st MC
809a4336 444 cfm->SetParticleCutsList(kStepMCGenerated, dynamic_cast<TObjArray *>(fCutList->FindObject("fPartGenCuts")));
445 cfm->SetParticleCutsList(kStepMCInAcceptance, dynamic_cast<TObjArray *>(fCutList->FindObject("fPartAccCuts")));
3a72645a 446 // 2nd Reco
447 cfm->SetParticleCutsList(kStepRecKineITSTPC + kMCOffset, dynamic_cast<TObjArray *>(fCutList->FindObject("fPartRecKineITSTPCCuts")));
448 cfm->SetParticleCutsList(kStepRecPrim + kMCOffset, dynamic_cast<TObjArray *>(fCutList->FindObject("fPartPrimCuts")));
449 cfm->SetParticleCutsList(kStepHFEcutsITS + kMCOffset, dynamic_cast<TObjArray *>(fCutList->FindObject("fPartHFECutsITS")));
9250ffbf 450 cfm->SetParticleCutsList(kStepHFEcutsTOF+ kMCOffset, dynamic_cast<TObjArray *>(fCutList->FindObject("fPartHFECutsTOF")));
8c1c76e9 451 cfm->SetParticleCutsList(kStepHFEcutsTPC+ kMCOffset, dynamic_cast<TObjArray *>(fCutList->FindObject("fPartHFECutsTPC")));
3a72645a 452 cfm->SetParticleCutsList(kStepHFEcutsTRD + kMCOffset, dynamic_cast<TObjArray *>(fCutList->FindObject("fPartHFECutsTRD")));
453 cfm->SetParticleCutsList(kStepHFEcutsDca + kRecOffset + kMCOffset, dynamic_cast<TObjArray *>(fCutList->FindObject("fPartHFECutsDca")));
dbe3abbe 454
809a4336 455}
456
457//__________________________________________________________________
458void AliHFEcuts::Initialize(){
459 // Call all the setters for the cuts
faee3b18 460 AliDebug(2, "Called\n");
e3fc062d 461 if(fCutList)
462 fCutList->Delete();
463 else{
464 fCutList = new TObjArray;
465 fCutList->SetOwner();
466 }
467 if(IsQAOn()){
468 fHistQA = new TList;
469 fHistQA->SetName(Form("%s_CutQAhistograms", GetName()));
470 fHistQA->SetOwner(kFALSE);
471 }
809a4336 472 SetParticleGenCutList();
473 SetAcceptanceCutList();
722347d8 474 SetRecKineITSTPCCutList();
809a4336 475 SetRecPrimaryCutList();
dbe3abbe 476 SetHFElectronITSCuts();
9250ffbf 477 SetHFElectronTOFCuts();
8c1c76e9 478 SetHFElectronTPCCuts();
63bdf450 479 SetHFElectronTRDCuts();
3a72645a 480 SetHFElectronDcaCuts();
dbe3abbe 481
76d0b522 482 // Publish to the cuts which analysis type they are (ESD Analysis by default)
483 if(IsAOD()){
484 //printf("Initialize AOD\n");
485 //AliInfo("Setting AOD Analysis");
486 TObjArray *genCuts = dynamic_cast<TObjArray *>(fCutList->FindObject("fPartGenCuts"));
487 if(genCuts){
488 AliCFParticleGenCuts *myGenCut = dynamic_cast<AliCFParticleGenCuts *>(genCuts->FindObject("fCutsGenMC"));
489 if(myGenCut) {
490 myGenCut->SetAODMC(kTRUE);
491 //printf("Set AOD MC\n");
492 }
493 }
494 }
495
e156c3bb 496 // Connect the event cuts
497 SetEventCutList(kEventStepGenerated);
498 SetEventCutList(kEventStepReconstructed);
499
500
809a4336 501}
502
0792aa82 503//__________________________________________________________________
504void AliHFEcuts::SetEventCutList(Int_t istep){
505 //
506 // Cuts for Event Selection
507 //
faee3b18 508 AliDebug(2, "Called\n");
0792aa82 509 TObjArray *arr = new TObjArray;
510 if(istep == kEventStepGenerated){
faee3b18 511 AliCFEventGenCuts *evGenCuts = new AliCFEventGenCuts((Char_t *)"fCutsEvGen", (Char_t *)"Event Generated cuts");
3a72645a 512 //evGenCuts->SetNTracksCut(1);
0792aa82 513 evGenCuts->SetRequireVtxCuts(kTRUE);
3a72645a 514 //evGenCuts->SetVertexXCut(-1, 1);
515 //evGenCuts->SetVertexYCut(-1, 1);
516 evGenCuts->SetVertexZCut(-fVertexRangeZ, fVertexRangeZ);
69ac0e6f 517 if(IsQAOn()) evGenCuts->SetQAOn(fHistQA);
0792aa82 518
519 arr->SetName("fEvGenCuts");
520 arr->AddLast(evGenCuts);
521 } else {
c2690925 522
63bdf450 523 AliHFEextraEventCuts *evRecCuts = new AliHFEextraEventCuts((Char_t *)"fCutsEvRec", (Char_t *)"Event Reconstructed cuts");
524 evRecCuts->SetRequireVtxCuts(kTRUE);
525 if(fUseSPDVertex) evRecCuts->SetUseSPDVertex();
526 if(fUseMixedVertex) evRecCuts->SetUseMixedVertex();
527 if(fUseCorrelationVertex) evRecCuts->SetCheckCorrelationSPDVtx();
d87a9d29 528 if(fSPDVtxResolution) evRecCuts->SetCheckSPDResolution();
4437a0d2 529 if(fPApileupCut) evRecCuts->SetpAPileupCut();
63bdf450 530 evRecCuts->SetVertexZCut(-fVertexRangeZ, fVertexRangeZ);
531 //evRecCuts->SetVertexNContributors(1,(Int_t)1.e9);
532 if(IsQAOn()) evRecCuts->SetQAOn(fHistQA);
533 arr->SetName("fEvRecCuts");
534 arr->AddLast(evRecCuts);
535
536 }
0792aa82 537 fCutList->AddLast(arr);
538}
539
809a4336 540//__________________________________________________________________
541void AliHFEcuts::SetParticleGenCutList(){
542 //
543 // Initialize Particle Cuts for Monte Carlo Tracks
e156c3bb 544 // Production Vertex Radius: < 3cm
809a4336 545 // Particle Species: Electrons
1c051dd4 546 // Eta: < 0.8 (fEtaRange)
809a4336 547 //
faee3b18 548
549 TObjArray *mcCuts = new TObjArray;
550 mcCuts->SetName("fPartGenCuts");
551
552 //
553 AliDebug(2, "Called\n");
809a4336 554 AliCFParticleGenCuts *genCuts = new AliCFParticleGenCuts("fCutsGenMC", "Particle Generation Cuts");
555 genCuts->SetRequireIsCharged();
faee3b18 556 if(IsRequirePrimary()) {
557 genCuts->SetRequireIsPrimary();
558 }
809a4336 559 if(IsRequireProdVertex()){
bbeea05b 560 AliDebug(3, Form("Vertex Range: fProdVtx[0] %f, fProdVtx[1] %f, fProdVtx[2] %f, fProdVtx[3] %f, fProdVtxZ[0] %f, fProdVtx[1] %f", fProdVtx[0], fProdVtx[1], fProdVtx[2], fProdVtx[3], fProdVtxZ[0], fProdVtxZ[1]));
120f0e47 561 //if(!IsAOD()) {
562 genCuts->SetProdVtxRangeX(fProdVtx[0], fProdVtx[1]);
563 genCuts->SetProdVtxRangeY(fProdVtx[2], fProdVtx[3]);
a5fb8511 564 genCuts->SetProdVtxRangeZ(fProdVtxZ[0], fProdVtxZ[1]);
120f0e47 565 genCuts->SetProdVtxRange2D(kTRUE); // Use ellipse
566 //}
567 //else {
76d0b522 568 // (ONLY PROVISOIRE FOR MC AOD)
569 // genCuts->SetProdVtxRangeX(-TMath::Abs(fProdVtx[1]), TMath::Abs(fProdVtx[1]));
570 // genCuts->SetProdVtxRangeY(-TMath::Abs(fProdVtx[3]), TMath::Abs(fProdVtx[3]));
120f0e47 571 //}
809a4336 572 }
722347d8 573 genCuts->SetRequirePdgCode(11, kTRUE);
e3fc062d 574 if(IsQAOn()) genCuts->SetQAOn(fHistQA);
809a4336 575
faee3b18 576 // Add
809a4336 577 mcCuts->AddLast(genCuts);
faee3b18 578
579 //
580 if(IsRequireKineMCCuts()) {
581 AliCFTrackKineCuts *kineMCcuts = new AliCFTrackKineCuts((Char_t *)"fCutsKineMC", (Char_t *)"MC Kine Cuts");
582 kineMCcuts->SetPtRange(fPtRange[0], fPtRange[1]);
1c051dd4 583 //kineMCcuts->SetEtaRange(-0.8, 0.8);
cddc311d 584 kineMCcuts->SetEtaRange(fEtaRange[0],fEtaRange[1]);
a5fb8511 585 if(fPhiRange[0] >= 0. && fPhiRange[1] >= 0.) kineMCcuts->SetPhiRange(fPhiRange[0], fPhiRange[1]);
e3fc062d 586 if(IsQAOn()) kineMCcuts->SetQAOn(fHistQA);
faee3b18 587 mcCuts->AddLast(kineMCcuts);
588 }
589
809a4336 590 fCutList->AddLast(mcCuts);
591}
592
593//__________________________________________________________________
594void AliHFEcuts::SetAcceptanceCutList(){
595 //
596 // Initialize Particle (Monte Carlo) acceptance cuts
597 // Min. Required Hist for Detectors:
598 // ITS [3]
599 // TPC [2]
722347d8 600 // TRD [2*nTracklets]
809a4336 601 // TOF [0]
602 //
faee3b18 603 AliDebug(2, "Called\n");
809a4336 604 AliCFAcceptanceCuts *accCuts = new AliCFAcceptanceCuts("fCutsAccMC", "MC Acceptance Cuts");
605 accCuts->SetMinNHitITS(3);
606 accCuts->SetMinNHitTPC(2);
722347d8 607 accCuts->SetMinNHitTRD(2*fMinTrackletsTRD);
e3fc062d 608 if(IsQAOn()) accCuts->SetQAOn(fHistQA);
809a4336 609
75d81601 610 TObjArray *partAccCuts = new TObjArray();
611 partAccCuts->SetName("fPartAccCuts");
612 partAccCuts->AddLast(accCuts);
613 fCutList->AddLast(partAccCuts);
809a4336 614}
615
616//__________________________________________________________________
722347d8 617void AliHFEcuts::SetRecKineITSTPCCutList(){
809a4336 618 //
619 // Track Kinematics and Quality cuts (Based on the Standard cuts from PWG0)
620 //
722347d8 621 // ITS refit
809a4336 622 // Variances:
623 // y: 2
624 // z: 2
625 // sin(phi): 0.5
626 // tan(theta): 0.5
627 // 1/pt: 2
628 // Min. Number of Clusters:
629 // TPC: 50
630 // RefitRequired:
809a4336 631 // TPC
632 // Chi2 per TPC cluster: 3.5
633 //
634 // Kinematics:
635 // Momentum Range: 100MeV - 20GeV
636 // Eta: < 0.9 (TRD-TOF acceptance)
637 //
11ff28c5 638 const Long_t kStatusSelectionDefault(AliESDtrack::kTPCrefit | AliESDtrack::kITSrefit);
faee3b18 639 AliDebug(2, "Called\n");
640 AliCFTrackQualityCuts *trackQuality = new AliCFTrackQualityCuts((Char_t *)"fCutsQualityRec", (Char_t *)"REC Track Quality Cuts");
11ff28c5 641 //trackQuality->SetMinNClusterITS(fMinClustersITS);
809a4336 642 trackQuality->SetMaxChi2PerClusterTPC(fMaxChi2clusterTPC);
8c1c76e9 643 if(fMaxChi2clusterITS >= 0.) trackQuality->SetMaxChi2PerClusterITS(fMaxChi2clusterITS);
11ff28c5 644 Long_t statusRequirement;
645 if(fAdditionalStatusRequirement)
646 statusRequirement = kStatusSelectionDefault | fAdditionalStatusRequirement;
647 else
648 statusRequirement = kStatusSelectionDefault;
649 trackQuality->SetStatus(statusRequirement);
3a72645a 650 //trackQuality->SetMaxCovDiagonalElements(2., 2., 0.5, 0.5, 2);
809a4336 651
e17c1f86 652 AliHFEextraCuts *hfecuts = new AliHFEextraCuts("fCutsHFElectronGroupTPCRec","Extra cuts from the HFE group");
722347d8 653 hfecuts->SetDebugLevel(fDebugLevel);
11ff28c5 654 hfecuts->SetMinNbITScls(fMinClustersITS);
3a72645a 655 // Set the cut in the TPC number of clusters
76d0b522 656 hfecuts->SetMinNClustersTPC(fMinClustersTPC,AliHFEextraCuts::ETPCclusterDef_t(fTPCclusterDef));
e17c1f86 657 hfecuts->SetMinNClustersTPCPID(fMinClustersTPCPID);
76d0b522 658 hfecuts->SetClusterRatioTPC(fMinClusterRatioTPC,AliHFEextraCuts::ETPCclrDef_t(fTPCratioDef));
9250ffbf 659 if(fFractionOfSharedTPCClusters > 0.0) hfecuts->SetFractionOfTPCSharedClusters(fFractionOfSharedTPCClusters);
cedf0381 660 if(fITSpatternCut) hfecuts->SetITSpatternCut();
96167a04 661 if(fAODFilterBit > -1) hfecuts->SetAODFilterBit(fAODFilterBit);
722347d8 662
faee3b18 663 AliCFTrackKineCuts *kineCuts = new AliCFTrackKineCuts((Char_t *)"fCutsKineRec", (Char_t *)"REC Kine Cuts");
bbeea05b 664 //printf("Setting max. pt to %f\n", fPtRange[1]);
809a4336 665 kineCuts->SetPtRange(fPtRange[0], fPtRange[1]);
1c051dd4 666 //kineCuts->SetEtaRange(-0.8, 0.8);
cddc311d 667 kineCuts->SetEtaRange(fEtaRange[0],fEtaRange[1]);
a5fb8511 668 if(fPhiRange[0] >= 0. && fPhiRange[1] >= 0.) kineCuts->SetPhiRange(fPhiRange[0], fPhiRange[1]);
809a4336 669
e3fc062d 670 if(IsQAOn()){
809a4336 671 trackQuality->SetQAOn(fHistQA);
722347d8 672 hfecuts->SetQAOn(fHistQA);
809a4336 673 kineCuts->SetQAOn(fHistQA);
674 }
675
676 TObjArray *recCuts = new TObjArray;
722347d8 677 recCuts->SetName("fPartRecKineITSTPCCuts");
809a4336 678 recCuts->AddLast(trackQuality);
722347d8 679 recCuts->AddLast(hfecuts);
809a4336 680 recCuts->AddLast(kineCuts);
681 fCutList->AddLast(recCuts);
682}
683
684//__________________________________________________________________
685void AliHFEcuts::SetRecPrimaryCutList(){
686 //
687 // Primary cuts (based on standard cuts from PWG0):
688 // DCA to Vertex:
689 // XY: 3. cm
690 // Z: 10. cm
691 // No Kink daughters
692 //
faee3b18 693 AliDebug(2, "Called\n");
694 AliCFTrackIsPrimaryCuts *primaryCut = new AliCFTrackIsPrimaryCuts((Char_t *)"fCutsPrimaryCuts", (Char_t *)"REC Primary Cuts");
6400afdd 695 //if(IsRequireDCAToVertex()){
78ea5ef4 696 //primaryCut->SetDCAToVertex2D(kTRUE);
6400afdd 697 //primaryCut->SetMaxDCAToVertexXY(fDCAtoVtx[0]);
698 //primaryCut->SetMaxDCAToVertexZ(fDCAtoVtx[1]);
699 //}
809a4336 700 if(IsRequireSigmaToVertex()){
701 primaryCut->SetRequireSigmaToVertex(kTRUE);
8c1c76e9 702 if(fSigmaToVtx[0]) primaryCut->SetMaxNSigmaToVertex(fSigmaToVtx[0]);
703 if(fSigmaToVtx[1]) primaryCut->SetMaxSigmaDCAxy(fSigmaToVtx[1]);
704 if(fSigmaToVtx[2]) primaryCut->SetMaxSigmaDCAz(fSigmaToVtx[2]);
809a4336 705 }
6400afdd 706 //primaryCut->SetAcceptKinkDaughters(kFALSE);
e3fc062d 707 if(IsQAOn()) primaryCut->SetQAOn(fHistQA);
809a4336 708
9250ffbf 709 AliHFEextraCuts *hfecuts = new AliHFEextraCuts("fCutsPrimaryCutsextra","Extra cuts from the HFE group");
710 hfecuts->SetMaxImpactParameterRpar(fMaxImpactParameterRpar);
bbeea05b 711 if(fRejectKinkDaughters) hfecuts->SetRejectKinkDaughter();
712 if(fRejectKinkMothers) hfecuts->SetRejectKinkMother();
6400afdd 713 if(IsRequireDCAToVertex()){
714 hfecuts->SetMaxImpactParamR(fDCAtoVtx[0]);
715 hfecuts->SetMaxImpactParamZ(fDCAtoVtx[1]);
716 }
9250ffbf 717
809a4336 718 TObjArray *primCuts = new TObjArray;
719 primCuts->SetName("fPartPrimCuts");
6400afdd 720 // needed for AOD...
5cd679b7 721 if(IsRequireSigmaToVertex()) primCuts->AddLast(primaryCut);
11ff28c5 722 //if(fMaxImpactParameterRpar){
723 primCuts->AddLast(hfecuts);
724 //}
809a4336 725 fCutList->AddLast(primCuts);
726}
727
728//__________________________________________________________________
dbe3abbe 729void AliHFEcuts::SetHFElectronITSCuts(){
809a4336 730 //
dbe3abbe 731 // Special Cuts introduced by the HFElectron Group: ITS
809a4336 732 //
faee3b18 733 AliDebug(2, "Called\n");
dbe3abbe 734 AliHFEextraCuts *hfecuts = new AliHFEextraCuts("fCutsHFElectronGroupPixels","Extra cuts from the HFE group");
809a4336 735 if(IsRequireITSpixel()){
736 hfecuts->SetRequireITSpixel(AliHFEextraCuts::ITSPixel_t(fCutITSPixel));
0792aa82 737 hfecuts->SetCheckITSstatus(fCheckITSLayerStatus);
809a4336 738 }
5cd679b7 739 if(IsRequireITSdrift()){
740 hfecuts->SetRequireITSdrift(AliHFEextraCuts::ITSDrift_t(fCutITSDrift));
741 }
dbe3abbe 742
e3fc062d 743 if(IsQAOn()) hfecuts->SetQAOn(fHistQA);
78ea5ef4 744 hfecuts->SetDebugLevel(fDebugLevel);
745
dbe3abbe 746 TObjArray *hfeCuts = new TObjArray;
747 hfeCuts->SetName("fPartHFECutsITS");
748 hfeCuts->AddLast(hfecuts);
749 fCutList->AddLast(hfeCuts);
750}
751
dbe3abbe 752//__________________________________________________________________
9250ffbf 753void AliHFEcuts::SetHFElectronTOFCuts(){
dbe3abbe 754 //
755 // Special Cuts introduced by the HFElectron Group: TRD
756 //
faee3b18 757 AliDebug(2, "Called\n");
9250ffbf 758 AliHFEextraCuts *hfecuts = new AliHFEextraCuts("fCutsHFElectronGroupTOF","Extra cuts from the HFE group on TOF PID");
e3ae862b 759 if(fTOFPIDStep) hfecuts->SetTOFPID(kTRUE);
c2690925 760 if(fTOFMISMATCHStep) hfecuts->SetTOFMISMATCH(kTRUE);
2e4ed823 761 if(fMatchTOFLabel) hfecuts->SetMatchTOFLabel(kTRUE);
1c051dd4 762 if((fTOFsignaldx > 0.0) && (fTOFsignaldz > 0.0)) hfecuts->SetTOFsignalDxz(fTOFsignaldx,fTOFsignaldz);
e3fc062d 763 if(IsQAOn()) hfecuts->SetQAOn(fHistQA);
78ea5ef4 764 hfecuts->SetDebugLevel(fDebugLevel);
dbe3abbe 765
9250ffbf 766 TObjArray *hfeCuts = new TObjArray;
767 hfeCuts->SetName("fPartHFECutsTOF");
768 hfeCuts->AddLast(hfecuts);
769 fCutList->AddLast(hfeCuts);
770}
771
8c1c76e9 772//__________________________________________________________________
773void AliHFEcuts::SetHFElectronTPCCuts(){
774 //
775 // Special Cuts introduced by the HFElectron Group: TPC
776 //
777 AliDebug(2, "Called\n");
e17c1f86 778 AliHFEextraCuts *hfecuts = new AliHFEextraCuts("fCutsHFElectronGroupTPCPID","Extra cuts from the HFE group on TPC PID");
8c1c76e9 779 if(fTPCPIDCLEANUPStep) hfecuts->SetTPCPIDCleanUp(kTRUE);
780 if(IsQAOn()) hfecuts->SetQAOn(fHistQA);
781 hfecuts->SetDebugLevel(fDebugLevel);
782
783 TObjArray *hfeCuts = new TObjArray;
784 hfeCuts->SetName("fPartHFECutsTPC");
785 hfeCuts->AddLast(hfecuts);
786 fCutList->AddLast(hfeCuts);
787}
788
789
9250ffbf 790//__________________________________________________________________
791void AliHFEcuts::SetHFElectronTRDCuts(){
792 //
793 // Special Cuts introduced by the HFElectron Group: TRD
794 //
795 AliDebug(2, "Called\n");
796 AliHFEextraCuts *hfecuts = new AliHFEextraCuts("fCutsHFElectronGroupTRD","Extra cuts from the HFE group on TRD PID");
e17c1f86 797 if(fMinTrackletsTRD > 0.) hfecuts->SetMinTrackletsTRD(fMinTrackletsTRD, fTRDtrackletsExact);
cedf0381 798 if(fMaxChi2TRD >= 0)
799 hfecuts->SetMaxChi2TRD(fMaxChi2TRD);
800
9250ffbf 801 if(IsQAOn()) hfecuts->SetQAOn(fHistQA);
802 hfecuts->SetDebugLevel(fDebugLevel);
803
dbe3abbe 804 TObjArray *hfeCuts = new TObjArray;
805 hfeCuts->SetName("fPartHFECutsTRD");
809a4336 806 hfeCuts->AddLast(hfecuts);
807 fCutList->AddLast(hfeCuts);
808}
809
809a4336 810//__________________________________________________________________
3a72645a 811void AliHFEcuts::SetHFElectronDcaCuts(){
812 //
813 // Special Cuts introduced by the HFElectron Group: minimum of impact parameter
814 //
815 AliDebug(2, "Called\n");
816 AliHFEextraCuts *hfecuts = new AliHFEextraCuts("fCutsHFElectronGroupDCA","Extra cuts from the HFE group");
63bdf450 817 hfecuts->SetMinHFEImpactParamR(fIPCutParams,fIsIPSigmacut,fIsIPcharge,fIsIPOpp);
3a72645a 818 if(IsQAOn()) hfecuts->SetQAOn(fHistQA);
819 hfecuts->SetDebugLevel(fDebugLevel);
820
821 TObjArray *hfeCuts = new TObjArray;
822 hfeCuts->SetName("fPartHFECutsDca");
823 hfeCuts->AddLast(hfecuts);
824 fCutList->AddLast(hfeCuts);
825}
826
827//__________________________________________________________________
828Bool_t AliHFEcuts::CheckParticleCuts(UInt_t step, TObject *o){
809a4336 829 //
830 // Checks the cuts without using the correction framework manager
831 //
faee3b18 832 AliDebug(2, "Called\n");
8c1c76e9 833 TString stepnames[kNcutStepsMCTrack + kNcutStepsRecTrack + kNcutStepsDETrack + kNcutStepsSecvtxTrack + 1] = {"fPartGenCuts","fPartEvCutPileupZ","fPartEvCut","fPartAccCuts","fPartRecNoCuts","fPartRecKineITSTPCCuts", "fPartPrimCuts", "fPartHFECutsITS","fPartHFECutsTOF","fPartHFECutsTPC","fPartHFECutsTRD","fPartHFECutsDca", "fPartHFECutsSecvtx"};
3a72645a 834 AliDebug(2, Form("Doing cut %s", stepnames[step].Data()));
e3fc062d 835 TObjArray *cuts = dynamic_cast<TObjArray *>(fCutList->FindObject(stepnames[step].Data()));
809a4336 836 if(!cuts) return kTRUE;
3a72645a 837 TIter it(cuts);
809a4336 838 AliCFCutBase *mycut;
839 Bool_t status = kTRUE;
3a72645a 840 while((mycut = dynamic_cast<AliCFCutBase *>(it()))){
809a4336 841 status &= mycut->IsSelected(o);
842 }
809a4336 843 return status;
844}
e156c3bb 845
846
847//__________________________________________________________________
848Bool_t AliHFEcuts::CheckEventCuts(const char*namestep, TObject *o){
849 //
850 // Checks the cuts without using the correction framework manager
851 //
852 AliDebug(2, "Called\n");
853 TObjArray *cuts = dynamic_cast<TObjArray *>(fCutList->FindObject(namestep));
854 if(!cuts) return kTRUE;
855 TIter it(cuts);
856 AliCFCutBase *mycut;
857 Bool_t status = kTRUE;
858 while((mycut = dynamic_cast<AliCFCutBase *>(it()))){
859 status &= mycut->IsSelected(o);
860 }
861 return status;
862}
e17c1f86 863
864//__________________________________________________________________
865void AliHFEcuts::SetRecEvent(const AliVEvent *ev){
866 //
867 // Publish reconstructed event to the cuts
868 //
869 TIter cutsteps(fCutList);
870 TObjArray *cutstep;
871 AliCFCutBase *cut;
872 while((cutstep = dynamic_cast<TObjArray *>(cutsteps()))){
873 TIter cutIter(cutstep);
874 while((cut = dynamic_cast<AliCFCutBase *>(cutIter()))){
875 cut->SetRecEventInfo(ev);
876 }
877 }
878}
879
880//__________________________________________________________________
76d0b522 881void AliHFEcuts::SetMCEvent(const AliVEvent *ev){
e17c1f86 882 //
883 // Publish reconstructed event to the cuts
884 //
885 TIter cutsteps(fCutList);
886 TObjArray *cutstep;
887 AliCFCutBase *cut;
888 while((cutstep = dynamic_cast<TObjArray *>(cutsteps()))){
889 TIter cutIter(cutstep);
890 while((cut = dynamic_cast<AliCFCutBase *>(cutIter()))){
891 cut->SetMCEventInfo(ev);
892 }
893 }
894}