]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/AliHFEtaggedTrackAnalysis.cxx
Merge branch 'master' into TPCdev
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliHFEtaggedTrackAnalysis.cxx
CommitLineData
3a72645a 1/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
7* Permission to use, copy, modify and distribute this software and its *
8* documentation strictly for non-commercial purposes is hereby granted *
9* without fee, provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
15//
16// Class AliHFEtaggedTrackAnalysis
17// Analyses tracks with an apriori PID information (i.e. using the daugther
18// tracks from well-identified decays of neutral charged particles). Tracks
19// are processed in the Process function, where given tracks are filtered
20// via the track cuts and used for PID later. The plugin fills Correction
21// Framework containers and additional PID QA containers
22//
23// Author:
24// Markus Fasel <M.Fasel@gsi.de>
25//
26#include "AliCFCutBase.h"
27#include "AliCFContainer.h"
28#include "AliCFManager.h"
bf892a6a 29#include "AliESDtrack.h"
3a72645a 30#include "AliLog.h"
31#include "AliPID.h"
8c1c76e9 32#include "AliPIDResponse.h"
e3ae862b 33#include "AliExternalTrackParam.h"
3a72645a 34
bf892a6a 35#include "AliHFEcollection.h"
3a72645a 36#include "AliHFEcontainer.h"
37#include "AliHFEcuts.h"
38#include "AliHFEpid.h"
6555e2ad 39#include "AliHFEpidTPC.h"
3a72645a 40#include "AliHFEpidQAmanager.h"
41#include "AliHFEtaggedTrackAnalysis.h"
42#include "AliHFEvarManager.h"
43
44ClassImp(AliHFEtaggedTrackAnalysis)
3a72645a 45//____________________________________________________________
46AliHFEtaggedTrackAnalysis::AliHFEtaggedTrackAnalysis():
c2690925 47 TNamed()
48 , fVarManager(NULL)
49 , fContainer(NULL)
50 , fPID(NULL)
51 , fPIDqa(NULL)
52 , fCuts(NULL)
53 , fCFM(NULL)
54 , fQAhistos(NULL)
e156c3bb 55 , fCentralityF(0)
c2690925 56 , fClean(kFALSE)
57 , fMagneticField(0.0)
58 , fVariablesTRD(kFALSE)
e156c3bb 59 , fIsPbPb(kFALSE)
4437a0d2 60 , fIspPb(kFALSE)
ff8249bd 61 , fIsAOD(kFALSE)
c2690925 62{
63 //
64 // Dummy constructor
65 //
66}
67
68//____________________________________________________________
69AliHFEtaggedTrackAnalysis::AliHFEtaggedTrackAnalysis(const char *name):
70 TNamed(name, "")
3a72645a 71 , fVarManager(NULL)
72 , fContainer(NULL)
73 , fPID(NULL)
74 , fPIDqa(NULL)
75 , fCuts(NULL)
76 , fCFM(NULL)
bf892a6a 77 , fQAhistos(NULL)
e156c3bb 78 , fCentralityF(0)
6555e2ad 79 , fClean(kFALSE)
e3ae862b 80 , fMagneticField(0.0)
81 , fVariablesTRD(kFALSE)
e156c3bb 82 , fIsPbPb(kFALSE)
4437a0d2 83 , fIspPb(kFALSE)
58d0bf42 84 , fIsAOD(kFALSE)
3a72645a 85{
86 //
87 // Default constructor
88 //
89 fVarManager = new AliHFEvarManager("taggedTrackVarManager");
c2690925 90 //fVarManager->AddVariable("pt");
91 //fVarManager->AddVariable("eta");
92 //fVarManager->AddVariable("phi");
93 //fVarManager->AddVariable("charge");
94 //fVarManager->AddVariable("species");
3a72645a 95 fPIDqa = new AliHFEpidQAmanager;
96 fCFM = new AliCFManager;
97 SetBit(kIsOwner, kTRUE);
98}
99
100//____________________________________________________________
101AliHFEtaggedTrackAnalysis::AliHFEtaggedTrackAnalysis(const AliHFEtaggedTrackAnalysis &ref):
c2690925 102 TNamed(ref)
3a72645a 103 , fVarManager(ref.fVarManager)
104 , fContainer(NULL)
105 , fPID(ref.fPID)
106 , fPIDqa(ref.fPIDqa)
107 , fCuts(ref.fCuts)
108 , fCFM(ref.fCFM)
bf892a6a 109 , fQAhistos(ref.fQAhistos)
c2690925 110 , fCentralityF(ref.fCentralityF)
6555e2ad 111 , fClean(ref.fClean)
e3ae862b 112 , fMagneticField(ref.fMagneticField)
113 , fVariablesTRD(ref.fVariablesTRD)
e156c3bb 114 , fIsPbPb(ref.fIsPbPb)
4437a0d2 115 , fIspPb(ref.fIspPb)
58d0bf42 116 , fIsAOD(ref.fIsAOD)
3a72645a 117{
118 //
119 // Copy constructor
120 //
121 if(ref.fContainer){
122 InitContainer();
123 }
124 SetBit(kIsOwner, kFALSE);
125}
126
127//____________________________________________________________
128AliHFEtaggedTrackAnalysis &AliHFEtaggedTrackAnalysis::operator=(const AliHFEtaggedTrackAnalysis &ref){
129 //
130 // Assignment operator
131 //
c2690925 132 TNamed::operator=(ref);
3a72645a 133 if(&ref != this){
134 fVarManager = ref.fVarManager;
135 fPID = ref.fPID;
136 fPIDqa = ref.fPIDqa;
137 fCuts = ref.fCuts;
138 fCFM = ref.fCFM;
bf892a6a 139 fQAhistos = ref.fQAhistos;
c2690925 140 fCentralityF = ref.fCentralityF;
6555e2ad 141 fClean = ref.fClean;
e3ae862b 142 fMagneticField = ref.fMagneticField;
143 fVariablesTRD = ref.fVariablesTRD;
e156c3bb 144 fIsPbPb = ref.fIsPbPb;
4437a0d2 145 fIspPb = ref.fIspPb;
58d0bf42 146 fIsAOD = ref.fIsAOD;
3a72645a 147
148 if(ref.fContainer) InitContainer();
149
150 SetBit(kIsOwner, kFALSE);
151 SetBit(kIsOwnerCuts, kFALSE);
152 }
153 return *this;
154}
155
156//____________________________________________________________
157AliHFEtaggedTrackAnalysis::~AliHFEtaggedTrackAnalysis(){
158 //
159 // Destructor
160 //
161 if(TestBit(kIsOwner)){
162 if(fVarManager) delete fVarManager;
163 if(fPIDqa) delete fPIDqa;
164 }
165 if(TestBit(kIsOwnerCuts)) delete fCuts;
166 if(fContainer) delete fContainer;
167}
168
169//____________________________________________________________
170void AliHFEtaggedTrackAnalysis::InitContainer(){
171 //
172 // Initialize output container
173 //
174 if(fContainer) return;
175 Int_t nStepPID = 0;
176 if(!fPID){
177 AliError("No PID set - defining container without PID steps");
178 } else {
179 nStepPID = fPID->GetNumberOfPIDdetectors();
180 }
181 fContainer = new AliHFEcontainer("containerV0");
182 fVarManager->DefineVariables(fContainer);
183 fContainer->CreateContainer("taggedTrackContainerReco", "Container for Tagged Tracks", AliHFEcuts::kNcutStepsRecTrack + nStepPID);
184
185 // Set the step titles
186 for(Int_t istep = 0; istep < AliHFEcuts::kNcutStepsRecTrack; istep++)
187 fContainer->SetStepTitle("taggedTrackContainerReco", AliHFEcuts::RecoCutName(istep), istep);
188 for(Int_t ipid = 0; ipid < nStepPID; ipid++){
189 fContainer->SetStepTitle("taggedTrackContainerReco", fPID->SortedDetectorName(ipid), ipid + AliHFEcuts::kNcutStepsRecTrack);
190 }
191 fCFM->SetParticleContainer(fContainer->GetCFContainer("taggedTrackContainerReco"));
bf892a6a 192
193 // temporarily special QA
194 fQAhistos = new AliHFEcollection("taggedTrackQA", "Special QA for the TaggedTrackAnalysis");
195 fQAhistos->CreateTH2F("TPCclusters2_1", "TPCclusterInfo for findable clusters for 2 neighbors", 30, 0.1, 10., 162, 0., 161.);
e3ae862b 196 fQAhistos->CreateTH2F("TPCclusters2_0", "TPCclusterInfo for the ratio for 2 neighbors", 30, 0.1, 10., 110, 0., 1.1);
ccc37cdc 197 fQAhistos->CreateTH2F("TPCncls", "TPC number of clusters", 30, 0.1, 10., 162, 0., 161.);
198 fQAhistos->CreateTH2F("TPCclr", "TPC cluster ratio", 30, 0.1, 10., 110, 0., 1.1);
bf892a6a 199 fQAhistos->BinLogAxis("TPCclusters2_1", 0); // pt axis in logarithmic binning
200 fQAhistos->BinLogAxis("TPCclusters2_0", 0); // pt axis in logarithmic binning
ccc37cdc 201 fQAhistos->BinLogAxis("TPCncls", 0); // pt axis in logarithmic binning
202 fQAhistos->BinLogAxis("TPCclr", 0); // pt axis in logarithmic binning
3a72645a 203}
204
205//____________________________________________________________
e17c1f86 206void AliHFEtaggedTrackAnalysis::ProcessTrack(AliVTrack *track, Int_t abinitioPID){
3a72645a 207 //
208 // Filter tracks tagged by V0 PID class
209 //
e3ae862b 210 //
c2690925 211 fVarManager->NewTrack(track, NULL, fCentralityF, abinitioPID, kTRUE);
e3ae862b 212
213
214
215 // Phi Angle
216 if(fVariablesTRD) {
217 AliESDtrack *esdtrackc = dynamic_cast<AliESDtrack *>(track);
218 if(esdtrackc) {
219
220 const AliExternalTrackParam *trueparam = NULL;
221 if(esdtrackc->GetOuterParam()) {
ff8249bd 222 trueparam = esdtrackc->GetOuterParam();
223 fVarManager->NewTrack((AliVParticle *)trueparam, NULL, fCentralityF, abinitioPID, kTRUE);
e3ae862b 224 }
225 else return;
226 }
227 }
228
229
230 // Try a loose cut to reject pion contamination
231 if(fClean) {
232 if(abinitioPID == AliPID::kElectron){
233 AliHFEpidTPC *pidTPC = (AliHFEpidTPC *) fPID->GetDetPID(AliHFEpid::kTPCpid);
234 if(pidTPC) {
8c1c76e9 235 Double_t numberOfSigmaTPC = pidTPC->GetPIDResponse()->NumberOfSigmasTPC(track,AliPID::kElectron);
e3ae862b 236 if(numberOfSigmaTPC < -5) return;
237 }
238 }
239 }
240 // temporarily monitoring of the number of TPC clusters
241 AliESDtrack *esdtrack = dynamic_cast<AliESDtrack *>(track);
242 if(esdtrack && abinitioPID == AliPID::kElectron){
243 if((esdtrack->GetITSClusterMap() & (BIT(0) | BIT(1))) && (TMath::Abs(esdtrack->Eta()) < 0.8)){ // Only select quasi-primary tracks
244 fQAhistos->Fill("TPCclusters2_1", track->Pt(), esdtrack->GetTPCClusterInfo(2,1));
245 fQAhistos->Fill("TPCclusters2_0", track->Pt(), esdtrack->GetTPCNclsF() > 0 ? esdtrack->GetTPCClusterInfo(2,1)/esdtrack->GetTPCNclsF() : 0.);
ccc37cdc 246 fQAhistos->Fill("TPCncls", track->Pt(), esdtrack->GetTPCNcls());
247 fQAhistos->Fill("TPCclr", track->Pt(), esdtrack->GetTPCNclsF() > 0 ? static_cast<Double_t>(esdtrack->GetTPCNcls())/static_cast<Double_t>(esdtrack->GetTPCNclsF()) : 0.);
e3ae862b 248 }
249 }
250
3a72645a 251 Int_t offset = AliHFEcuts::kStepRecKineITSTPC;
252 fVarManager->FillContainer(fCFM->GetParticleContainer(), 0); // Fill Container without filtering
253
254 Bool_t survived = kTRUE;
255 for(Int_t icut = AliHFEcuts::kStepRecKineITSTPC; icut <= AliHFEcuts::kStepHFEcutsTRD; icut++){
256 AliDebug(2, Form("Checking cut %d for species %s", icut + AliHFEcuts::kNcutStepsMCTrack, AliPID::ParticleName(abinitioPID)));
e3ae862b 257 /*
258 TObjArray *cutlist = fCFM->GetParticleCutsList(icut + AliHFEcuts::kNcutStepsMCTrack);
259 if(!cutlist){
3a72645a 260 AliDebug(2, Form("No cuts for step %d set", icut + AliHFEcuts::kNcutStepsMCTrack));
e3ae862b 261 } else {
3a72645a 262 AliDebug(2, Form("Cut Collection %s", cutlist->GetName()));
263 TIter cutiter(cutlist);
264 AliCFCutBase *cut;
265 while((cut = dynamic_cast<AliCFCutBase *>(cutiter()))){
e3ae862b 266 AliDebug(2, Form("Cut object %s, QA on? %s", cut->GetName(), cut->IsQAOn() ? "yes" : "no"));
3a72645a 267 }
e3ae862b 268 }
269 */
3a72645a 270 //if(!fCFM->CheckParticleCuts(icut + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)){
271 if(!fCuts->CheckParticleCuts(icut + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)){
272 AliDebug(2, Form("Track didn' survive cut %d", icut + AliHFEcuts::kNcutStepsMCTrack));
273 survived = kFALSE;
274 break;
275 }
276 AliDebug(2, Form("Cut passed, filling container %d", icut - offset + 1));
277 fVarManager->FillContainer(fCFM->GetParticleContainer(), icut - offset + 1);
278 }
bf892a6a 279
280 if(survived){
e3ae862b 281 AliDebug(2, "Use track in the PID");
282 // Apply PID
283 AliHFEpidObject hfetrack;
58d0bf42 284 if(!fIsAOD) hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
285 else hfetrack.SetAnalysisType(AliHFEpidObject::kAODanalysis);
e3ae862b 286 hfetrack.SetRecTrack(track);
287 hfetrack.SetAbInitioPID(abinitioPID);
c2690925 288 hfetrack.SetCentrality(fCentralityF);
e156c3bb 289 if(fIsPbPb) hfetrack.SetPbPb();
ff8249bd 290 else
291 {
292 if(fIspPb) hfetrack.SetpPb();
293 else hfetrack.SetPP();
4437a0d2 294 }
e3ae862b 295 fPID->SetVarManager(fVarManager);
296 fPID->IsSelected(&hfetrack, fContainer, "taggedTrackContainer", fPIDqa);
297 }
3a72645a 298}
299
300//____________________________________________________________
301void AliHFEtaggedTrackAnalysis::SetCuts(AliHFEcuts *cuts){
302 //
303 // Set HFE cuts to be used to filter the tagged tracks
304 //
305 if(!cuts){
306 AliWarning("Nob cuts provided - Using standard cuts");
307 fCuts = new AliHFEcuts("cutsTagged", "HFE Cuts for the V0 tagged tracks");
308 fCuts->CreateStandardCuts();
309 fCuts->SetQAOn();
310 SetBit(kIsOwnerCuts);
bf892a6a 311 } else {
312 AliDebug(1, "Setting single track cuts");
313 fCuts = cuts;
3a72645a 314 }
3a72645a 315 const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack;
316 printf("Setting Number of cut steps %d\n", kNcutSteps);
317 fCFM->SetNStepParticle(kNcutSteps);
318 for(Int_t istep = 0; istep < kNcutSteps; istep++)
319 fCFM->SetParticleCutsList(istep, NULL);
320
321 fCuts->Initialize(fCFM);
322}
323
324//____________________________________________________________
325void AliHFEtaggedTrackAnalysis::SetPID(AliHFEpid *pid){
326 //
327 // Set the PID and initialize the the QA manager
328 //
329 fPID = pid;
330 fPIDqa->Initialize(fPID);
331}
332
333//____________________________________________________________
334TList *AliHFEtaggedTrackAnalysis::GetPIDQA() const {
335 //
336 // return PID QA
337 //
338 return fPIDqa->MakeList("PIDqa_taggedTracks");
339}
340
341//____________________________________________________________
342TList *AliHFEtaggedTrackAnalysis::GetCutQA() const {
343 //
344 // return Cut QA
345 //
346 return fCuts->GetQAhistograms();
347}
348
e3ae862b 349