flag jets with too high p_T track
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskESDFilterPWG4Train.C
CommitLineData
ebad39a9 1
2a7c86bc 2
ebad39a9 3AliAnalysisTaskESDfilter *AddTaskESDFilter(Bool_t useKineFilter=kTRUE,
4 Bool_t writeMuonAOD=kFALSE,
5 Bool_t writeDimuonAOD=kFALSE,
30f922ad 6 Bool_t usePhysicsSelection=kFALSE,
7 Bool_t useCentralityTask=kFALSE)
ebad39a9 8{
9// Creates a filter task and adds it to the analysis manager.
10
11 // Get the pointer to the existing analysis manager via the static access method.
12 //==============================================================================
13 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
14 if (!mgr) {
15 ::Error("AddTaskESDFilter", "No analysis manager to connect to.");
16 return NULL;
17 }
18
19 // This task requires an ESD input handler and an AOD output handler.
20 // Check this using the analysis manager.
21 //===============================================================================
22 TString type = mgr->GetInputEventHandler()->GetDataType();
23 if (!type.Contains("ESD")) {
24 ::Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an ESD input handler.");
25 return NULL;
26 }
27 // Check if AOD output handler exist.
28 AliAODHandler *aod_h = (AliAODHandler*)mgr->GetOutputEventHandler();
29 if (!aod_h) {
30 ::Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an AOD output handler.");
31 return NULL;
32 }
33 // Check if MC handler is connected in case kine filter requested
34 AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
35 if (!mcH && useKineFilter) {
36 ::Error("AddTaskESDFilter", "No MC handler connected while kine filtering requested");
37 return NULL;
38 }
39
40 // Create the task, add it to the manager and configure it.
41 //===========================================================================
42 // Barrel tracks filter
43 AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");
3095177c 44
45 // Make the AOD a little bit lighter and filtering faster
46
47 esdfilter->DisableCascades();
48 // esdfilter->DisableV0s();
49 esdfilter->DisableKinks();
50 // esdfilter->DisableTracks();
51 esdfilter->DisablePmdClusters();
52 // esdfilter->DisableCaloClusters();
53 // esdfilter->DisableCells();
54 esdfilter->DisableTracklets();
30f922ad 55 esdfilter->SetWriteHybridGlobalConstrainedOnly(kTRUE);
56
57 AliAnalysisTaskAODCentralityMaker* ctask = 0;
58 if (useCentralityTask) {
59 ctask = new AliAnalysisTaskAODCentralityMaker("AODCentralityMaker");
60 ctask->SetDeltaAODFileName("AliAODCentrality.root");
61 mgr->AddTask(ctask);
62 }
3095177c 63
64
ebad39a9 65 mgr->AddTask(esdfilter);
66 // Muons
48602d36 67 // AliAnalysisTaskESDMuonFilter *esdmuonfilter = new AliAnalysisTaskESDMuonFilter("ESD Muon Filter");
68 // mgr->AddTask(esdmuonfilter);
ebad39a9 69 if(usePhysicsSelection){
70 esdfilter->SelectCollisionCandidates(AliVEvent::kAny);
48602d36 71 // esdmuonfilter->SelectCollisionCandidates(AliVEvent::kAny);
ebad39a9 72 }
73
74 // Filtering of MC particles (decays conversions etc)
75 // this task has to go AFTER all other filter tasks
76 // since it fills the AODMC array with all
77 // selected MC Particles, only this way we have the
78 // AODMCparticle information available for following tasks
79 AliAnalysisTaskMCParticleFilter *kinefilter = 0;
80 if (useKineFilter) {
81 kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Kine Filter");
48602d36 82 if(usePhysicsSelection)kinefilter->SelectCollisionCandidates(AliVEvent::kAny);
ebad39a9 83 mgr->AddTask(kinefilter);
84 }
85
86 // Cuts on primary tracks
87 AliESDtrackCuts* esdTrackCutsL = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
88
89 // ITS stand-alone tracks
90 AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("ITS stand-alone Track Cuts", "ESD Track Cuts");
91 esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE);
92
93 // Pixel OR necessary for the electrons
94 AliESDtrackCuts *itsStrong = new AliESDtrackCuts("ITSorSPD", "pixel requirement for ITS");
95 itsStrong->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
96
97
98 // PID for the electrons
99 AliESDpidCuts *electronID = new AliESDpidCuts("Electrons", "Electron PID cuts");
100 electronID->SetTPCnSigmaCut(AliPID::kElectron, 3.);
101
102 // tighter cuts on primary particles for high pT tracks
103 // take the standard cuts, which include already
104 // ITSrefit and use only primaries...
3456f527 105
5a0bd31f 106 // ITS cuts for new jet analysis
30f922ad 107 gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/CreateTrackCutsPWG4.C");
65c43de8 108 AliESDtrackCuts* esdTrackCutsHG0 = CreateTrackCutsPWG4(10001005);
5a0bd31f 109
c3ff0a6e 110 // throw out tracks with too low number of clusters in
111 // the first pass (be consistent with TPC only tracks)
112 // N.B. the number off crossed rows still acts on the tracks after
113 // all iterations if we require tpc standalone, number of clusters
114 // and chi2 TPC cuts act on track after the first iteration
5a0bd31f 115 // esdTrackCutsH0->SetRequireTPCStandAlone(kTRUE);
116 // esdTrackCutsH0->SetMinNClustersTPC(80); // <--- first pass
c3ff0a6e 117
2a7c86bc 118
30f922ad 119 // the complement to the one with SPD requirement
65c43de8 120 AliESDtrackCuts* esdTrackCutsHG1 = CreateTrackCutsPWG4(10011005);
30f922ad 121
122 // the tracks that must not be taken pass this cut and
123 // non HGC1 and HG
65c43de8 124 AliESDtrackCuts* esdTrackCutsHG2 = CreateTrackCutsPWG4(10021005);
30f922ad 125
126
2a7c86bc 127
3456f527 128
5a0bd31f 129 // standard cuts also used in R_AA analysis
130 gROOT->LoadMacro("$ALICE_ROOT/PWG0/dNdPt/macros/CreatedNdPtTrackCuts.C");
131 AliESDtrackCuts* esdTrackCutsH2 = CreatedNdPtTrackCuts(200);
132 esdTrackCutsH2->SetMaxChi2PerClusterITS(36.);
f4132e7d 133 esdTrackCutsH2->SetPtRange(0.15,1E10);
3456f527 134
65c43de8 135 AliESDtrackCuts* esdTrackCutsGCOnly = CreateTrackCutsPWG4(10041005);
4ef34763 136
070f06d2 137 // TPC only tracks
4ef34763 138 AliESDtrackCuts* esdTrackCutsTPCCOnly = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
139 esdTrackCutsTPCCOnly->SetMinNClustersTPC(70);
140
141
c3ff0a6e 142
ebad39a9 143 // Compose the filter
144 AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
39e7e8ab 145 // 1, 1<<0
ebad39a9 146 trackFilter->AddCuts(esdTrackCutsL);
39e7e8ab 147 // 2 1<<1
ebad39a9 148 trackFilter->AddCuts(esdTrackCutsITSsa);
39e7e8ab 149 // 4 1<<2
ebad39a9 150 trackFilter->AddCuts(itsStrong);
151 itsStrong->SetFilterMask(1); // AND with Standard track cuts
39e7e8ab 152 // 8 1<<3
ebad39a9 153 trackFilter->AddCuts(electronID);
154 electronID->SetFilterMask(4); // AND with Pixel Cuts
39e7e8ab 155 // 16 1<<4
30f922ad 156 trackFilter->AddCuts(esdTrackCutsHG0);
39e7e8ab 157 // 32 1<<5
30f922ad 158 trackFilter->AddCuts(esdTrackCutsHG1);
39e7e8ab 159 // 64 1<<6
30f922ad 160 trackFilter->AddCuts(esdTrackCutsHG2);
39e7e8ab 161 // 128 1<<7
30f922ad 162 trackFilter->AddCuts(esdTrackCutsHG0); // add once more for tpc only tracks
ea4857bd 163 // 256 1<<8
30f922ad 164 trackFilter->AddCuts(esdTrackCutsGCOnly);
5a0bd31f 165 // 512 1<<9
30f922ad 166 trackFilter->AddCuts(esdTrackCutsHG1); // add once more for tpc only tracks
4ef34763 167 // 1024 1<<10
94148a9c 168 trackFilter->AddCuts(esdTrackCutsH2); // add r_aa cuts
4ef34763 169 // 2048 1<<11
170 trackFilter->AddCuts(esdTrackCutsTPCCOnly); // add QM TPC only track cuts
171
2a7c86bc 172
30f922ad 173 esdfilter->SetGlobalConstrainedFilterMask(1<<8|1<<9); // these tracks are written out as global constrained tracks
174 esdfilter->SetHybridFilterMaskGlobalConstrainedGlobal((1<<4)); // these normal global tracks will be marked as hybrid
2a7c86bc 175
4ef34763 176 esdfilter->SetTPCConstrainedFilterMask(1<<11); // these tracks are written out as global constrained tracks
2a7c86bc 177
ebad39a9 178 // Filter with cuts on V0s
179 AliESDv0Cuts* esdV0Cuts = new AliESDv0Cuts("Standard V0 Cuts pp", "ESD V0 Cuts");
180 esdV0Cuts->SetMinRadius(0.2);
181 esdV0Cuts->SetMaxRadius(200);
182 esdV0Cuts->SetMinDcaPosToVertex(0.05);
183 esdV0Cuts->SetMinDcaNegToVertex(0.05);
184 esdV0Cuts->SetMaxDcaV0Daughters(1.5);
185 esdV0Cuts->SetMinCosinePointingAngle(0.99);
186 AliAnalysisFilter* v0Filter = new AliAnalysisFilter("v0Filter");
070f06d2 187 v0Filter->AddCuts(esdV0Cuts);
ebad39a9 188
189 esdfilter->SetTrackFilter(trackFilter);
070f06d2 190 esdfilter->SetV0Filter(v0Filter);
ebad39a9 191
192 // Enable writing of Muon AODs
48602d36 193 // esdmuonfilter->SetWriteMuonAOD(writeMuonAOD);
ebad39a9 194
195 // Enable writing of Dimuon AODs
48602d36 196 // esdmuonfilter->SetWriteDimuonAOD(writeDimuonAOD);
ebad39a9 197
198 // Create ONLY the output containers for the data produced by the task.
199 // Get and connect other common input/output containers via the manager as below
200 //==============================================================================
201
202 mgr->ConnectInput (esdfilter, 0, mgr->GetCommonInputContainer());
203 mgr->ConnectOutput (esdfilter, 0, mgr->GetCommonOutputContainer());
204
205
206 // mgr->ConnectInput (esdmuonfilter, 0, mgr->GetCommonInputContainer());
207 if (useKineFilter) {
208 mgr->ConnectInput (kinefilter, 0, mgr->GetCommonInputContainer());
209 mgr->ConnectOutput (kinefilter, 0, mgr->GetCommonOutputContainer());
210 AliAnalysisDataContainer *coutputEx = mgr->CreateContainer("cFilterList", TList::Class(),
211 AliAnalysisManager::kOutputContainer,"pyxsec_hists.root");
212 mgr->ConnectOutput (kinefilter, 1,coutputEx);
213 }
30f922ad 214 if (useCentralityTask) {
215 mgr->ConnectInput (ctask, 0, mgr->GetCommonInputContainer());
216 mgr->ConnectOutput(ctask, 0, mgr->GetCommonOutputContainer());
217 }
218
ebad39a9 219 return esdfilter;
220 }
221