]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/AliHFEtaggedTrackAnalysis.cxx
Try to understannd
[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)
c2690925 61{
62 //
63 // Dummy constructor
64 //
65}
66
67//____________________________________________________________
68AliHFEtaggedTrackAnalysis::AliHFEtaggedTrackAnalysis(const char *name):
69 TNamed(name, "")
3a72645a 70 , fVarManager(NULL)
71 , fContainer(NULL)
72 , fPID(NULL)
73 , fPIDqa(NULL)
74 , fCuts(NULL)
75 , fCFM(NULL)
bf892a6a 76 , fQAhistos(NULL)
e156c3bb 77 , fCentralityF(0)
6555e2ad 78 , fClean(kFALSE)
e3ae862b 79 , fMagneticField(0.0)
80 , fVariablesTRD(kFALSE)
e156c3bb 81 , fIsPbPb(kFALSE)
4437a0d2 82 , fIspPb(kFALSE)
3a72645a 83{
84 //
85 // Default constructor
86 //
87 fVarManager = new AliHFEvarManager("taggedTrackVarManager");
c2690925 88 //fVarManager->AddVariable("pt");
89 //fVarManager->AddVariable("eta");
90 //fVarManager->AddVariable("phi");
91 //fVarManager->AddVariable("charge");
92 //fVarManager->AddVariable("species");
3a72645a 93 fPIDqa = new AliHFEpidQAmanager;
94 fCFM = new AliCFManager;
95 SetBit(kIsOwner, kTRUE);
96}
97
98//____________________________________________________________
99AliHFEtaggedTrackAnalysis::AliHFEtaggedTrackAnalysis(const AliHFEtaggedTrackAnalysis &ref):
c2690925 100 TNamed(ref)
3a72645a 101 , fVarManager(ref.fVarManager)
102 , fContainer(NULL)
103 , fPID(ref.fPID)
104 , fPIDqa(ref.fPIDqa)
105 , fCuts(ref.fCuts)
106 , fCFM(ref.fCFM)
bf892a6a 107 , fQAhistos(ref.fQAhistos)
c2690925 108 , fCentralityF(ref.fCentralityF)
6555e2ad 109 , fClean(ref.fClean)
e3ae862b 110 , fMagneticField(ref.fMagneticField)
111 , fVariablesTRD(ref.fVariablesTRD)
e156c3bb 112 , fIsPbPb(ref.fIsPbPb)
4437a0d2 113 , fIspPb(ref.fIspPb)
3a72645a 114{
115 //
116 // Copy constructor
117 //
118 if(ref.fContainer){
119 InitContainer();
120 }
121 SetBit(kIsOwner, kFALSE);
122}
123
124//____________________________________________________________
125AliHFEtaggedTrackAnalysis &AliHFEtaggedTrackAnalysis::operator=(const AliHFEtaggedTrackAnalysis &ref){
126 //
127 // Assignment operator
128 //
c2690925 129 TNamed::operator=(ref);
3a72645a 130 if(&ref != this){
131 fVarManager = ref.fVarManager;
132 fPID = ref.fPID;
133 fPIDqa = ref.fPIDqa;
134 fCuts = ref.fCuts;
135 fCFM = ref.fCFM;
bf892a6a 136 fQAhistos = ref.fQAhistos;
c2690925 137 fCentralityF = ref.fCentralityF;
6555e2ad 138 fClean = ref.fClean;
e3ae862b 139 fMagneticField = ref.fMagneticField;
140 fVariablesTRD = ref.fVariablesTRD;
e156c3bb 141 fIsPbPb = ref.fIsPbPb;
4437a0d2 142 fIspPb = ref.fIspPb;
3a72645a 143
144 if(ref.fContainer) InitContainer();
145
146 SetBit(kIsOwner, kFALSE);
147 SetBit(kIsOwnerCuts, kFALSE);
148 }
149 return *this;
150}
151
152//____________________________________________________________
153AliHFEtaggedTrackAnalysis::~AliHFEtaggedTrackAnalysis(){
154 //
155 // Destructor
156 //
157 if(TestBit(kIsOwner)){
158 if(fVarManager) delete fVarManager;
159 if(fPIDqa) delete fPIDqa;
160 }
161 if(TestBit(kIsOwnerCuts)) delete fCuts;
162 if(fContainer) delete fContainer;
163}
164
165//____________________________________________________________
166void AliHFEtaggedTrackAnalysis::InitContainer(){
167 //
168 // Initialize output container
169 //
170 if(fContainer) return;
171 Int_t nStepPID = 0;
172 if(!fPID){
173 AliError("No PID set - defining container without PID steps");
174 } else {
175 nStepPID = fPID->GetNumberOfPIDdetectors();
176 }
177 fContainer = new AliHFEcontainer("containerV0");
178 fVarManager->DefineVariables(fContainer);
179 fContainer->CreateContainer("taggedTrackContainerReco", "Container for Tagged Tracks", AliHFEcuts::kNcutStepsRecTrack + nStepPID);
180
181 // Set the step titles
182 for(Int_t istep = 0; istep < AliHFEcuts::kNcutStepsRecTrack; istep++)
183 fContainer->SetStepTitle("taggedTrackContainerReco", AliHFEcuts::RecoCutName(istep), istep);
184 for(Int_t ipid = 0; ipid < nStepPID; ipid++){
185 fContainer->SetStepTitle("taggedTrackContainerReco", fPID->SortedDetectorName(ipid), ipid + AliHFEcuts::kNcutStepsRecTrack);
186 }
187 fCFM->SetParticleContainer(fContainer->GetCFContainer("taggedTrackContainerReco"));
bf892a6a 188
189 // temporarily special QA
190 fQAhistos = new AliHFEcollection("taggedTrackQA", "Special QA for the TaggedTrackAnalysis");
191 fQAhistos->CreateTH2F("TPCclusters2_1", "TPCclusterInfo for findable clusters for 2 neighbors", 30, 0.1, 10., 162, 0., 161.);
e3ae862b 192 fQAhistos->CreateTH2F("TPCclusters2_0", "TPCclusterInfo for the ratio for 2 neighbors", 30, 0.1, 10., 110, 0., 1.1);
ccc37cdc 193 fQAhistos->CreateTH2F("TPCncls", "TPC number of clusters", 30, 0.1, 10., 162, 0., 161.);
194 fQAhistos->CreateTH2F("TPCclr", "TPC cluster ratio", 30, 0.1, 10., 110, 0., 1.1);
bf892a6a 195 fQAhistos->BinLogAxis("TPCclusters2_1", 0); // pt axis in logarithmic binning
196 fQAhistos->BinLogAxis("TPCclusters2_0", 0); // pt axis in logarithmic binning
ccc37cdc 197 fQAhistos->BinLogAxis("TPCncls", 0); // pt axis in logarithmic binning
198 fQAhistos->BinLogAxis("TPCclr", 0); // pt axis in logarithmic binning
3a72645a 199}
200
201//____________________________________________________________
e17c1f86 202void AliHFEtaggedTrackAnalysis::ProcessTrack(AliVTrack *track, Int_t abinitioPID){
3a72645a 203 //
204 // Filter tracks tagged by V0 PID class
205 //
e3ae862b 206 //
c2690925 207 fVarManager->NewTrack(track, NULL, fCentralityF, abinitioPID, kTRUE);
e3ae862b 208
209
210
211 // Phi Angle
212 if(fVariablesTRD) {
213 AliESDtrack *esdtrackc = dynamic_cast<AliESDtrack *>(track);
214 if(esdtrackc) {
215
216 const AliExternalTrackParam *trueparam = NULL;
217 if(esdtrackc->GetOuterParam()) {
e2861c1a 218 trueparam = esdtrackc->GetOuterParam();
219 fVarManager->NewTrack((AliVParticle *)trueparam, NULL, fCentralityF, abinitioPID, kTRUE);
e3ae862b 220 }
221 else return;
222 }
223 }
224
225
226 // Try a loose cut to reject pion contamination
227 if(fClean) {
228 if(abinitioPID == AliPID::kElectron){
229 AliHFEpidTPC *pidTPC = (AliHFEpidTPC *) fPID->GetDetPID(AliHFEpid::kTPCpid);
230 if(pidTPC) {
8c1c76e9 231 Double_t numberOfSigmaTPC = pidTPC->GetPIDResponse()->NumberOfSigmasTPC(track,AliPID::kElectron);
e3ae862b 232 if(numberOfSigmaTPC < -5) return;
233 }
234 }
235 }
236 // temporarily monitoring of the number of TPC clusters
237 AliESDtrack *esdtrack = dynamic_cast<AliESDtrack *>(track);
238 if(esdtrack && abinitioPID == AliPID::kElectron){
239 if((esdtrack->GetITSClusterMap() & (BIT(0) | BIT(1))) && (TMath::Abs(esdtrack->Eta()) < 0.8)){ // Only select quasi-primary tracks
240 fQAhistos->Fill("TPCclusters2_1", track->Pt(), esdtrack->GetTPCClusterInfo(2,1));
241 fQAhistos->Fill("TPCclusters2_0", track->Pt(), esdtrack->GetTPCNclsF() > 0 ? esdtrack->GetTPCClusterInfo(2,1)/esdtrack->GetTPCNclsF() : 0.);
ccc37cdc 242 fQAhistos->Fill("TPCncls", track->Pt(), esdtrack->GetTPCNcls());
243 fQAhistos->Fill("TPCclr", track->Pt(), esdtrack->GetTPCNclsF() > 0 ? static_cast<Double_t>(esdtrack->GetTPCNcls())/static_cast<Double_t>(esdtrack->GetTPCNclsF()) : 0.);
e3ae862b 244 }
245 }
246
3a72645a 247 Int_t offset = AliHFEcuts::kStepRecKineITSTPC;
248 fVarManager->FillContainer(fCFM->GetParticleContainer(), 0); // Fill Container without filtering
249
250 Bool_t survived = kTRUE;
251 for(Int_t icut = AliHFEcuts::kStepRecKineITSTPC; icut <= AliHFEcuts::kStepHFEcutsTRD; icut++){
252 AliDebug(2, Form("Checking cut %d for species %s", icut + AliHFEcuts::kNcutStepsMCTrack, AliPID::ParticleName(abinitioPID)));
e3ae862b 253 /*
254 TObjArray *cutlist = fCFM->GetParticleCutsList(icut + AliHFEcuts::kNcutStepsMCTrack);
255 if(!cutlist){
3a72645a 256 AliDebug(2, Form("No cuts for step %d set", icut + AliHFEcuts::kNcutStepsMCTrack));
e3ae862b 257 } else {
3a72645a 258 AliDebug(2, Form("Cut Collection %s", cutlist->GetName()));
259 TIter cutiter(cutlist);
260 AliCFCutBase *cut;
261 while((cut = dynamic_cast<AliCFCutBase *>(cutiter()))){
e3ae862b 262 AliDebug(2, Form("Cut object %s, QA on? %s", cut->GetName(), cut->IsQAOn() ? "yes" : "no"));
3a72645a 263 }
e3ae862b 264 }
265 */
3a72645a 266 //if(!fCFM->CheckParticleCuts(icut + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)){
267 if(!fCuts->CheckParticleCuts(icut + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)){
268 AliDebug(2, Form("Track didn' survive cut %d", icut + AliHFEcuts::kNcutStepsMCTrack));
269 survived = kFALSE;
270 break;
271 }
272 AliDebug(2, Form("Cut passed, filling container %d", icut - offset + 1));
273 fVarManager->FillContainer(fCFM->GetParticleContainer(), icut - offset + 1);
274 }
bf892a6a 275
276 if(survived){
e3ae862b 277 AliDebug(2, "Use track in the PID");
278 // Apply PID
279 AliHFEpidObject hfetrack;
e2861c1a 280 if(track->IsA() == AliESDtrack::Class())
281 hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
282 else
283 hfetrack.SetAnalysisType(AliHFEpidObject::kAODanalysis);
e3ae862b 284 hfetrack.SetRecTrack(track);
285 hfetrack.SetAbInitioPID(abinitioPID);
c2690925 286 hfetrack.SetCentrality(fCentralityF);
e156c3bb 287 if(fIsPbPb) hfetrack.SetPbPb();
e2861c1a 288 else{
289 if(fIspPb) hfetrack.SetpPb();
290 else hfetrack.SetPP();
4437a0d2 291 }
e3ae862b 292 fPID->SetVarManager(fVarManager);
293 fPID->IsSelected(&hfetrack, fContainer, "taggedTrackContainer", fPIDqa);
294 }
3a72645a 295}
296
297//____________________________________________________________
298void AliHFEtaggedTrackAnalysis::SetCuts(AliHFEcuts *cuts){
299 //
300 // Set HFE cuts to be used to filter the tagged tracks
301 //
302 if(!cuts){
303 AliWarning("Nob cuts provided - Using standard cuts");
304 fCuts = new AliHFEcuts("cutsTagged", "HFE Cuts for the V0 tagged tracks");
305 fCuts->CreateStandardCuts();
306 fCuts->SetQAOn();
307 SetBit(kIsOwnerCuts);
bf892a6a 308 } else {
309 AliDebug(1, "Setting single track cuts");
310 fCuts = cuts;
3a72645a 311 }
3a72645a 312 const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack;
313 printf("Setting Number of cut steps %d\n", kNcutSteps);
314 fCFM->SetNStepParticle(kNcutSteps);
315 for(Int_t istep = 0; istep < kNcutSteps; istep++)
316 fCFM->SetParticleCutsList(istep, NULL);
317
318 fCuts->Initialize(fCFM);
319}
320
321//____________________________________________________________
322void AliHFEtaggedTrackAnalysis::SetPID(AliHFEpid *pid){
323 //
324 // Set the PID and initialize the the QA manager
325 //
326 fPID = pid;
327 fPIDqa->Initialize(fPID);
328}
329
330//____________________________________________________________
331TList *AliHFEtaggedTrackAnalysis::GetPIDQA() const {
332 //
333 // return PID QA
334 //
335 return fPIDqa->MakeList("PIDqa_taggedTracks");
336}
337
338//____________________________________________________________
339TList *AliHFEtaggedTrackAnalysis::GetCutQA() const {
340 //
341 // return Cut QA
342 //
343 return fCuts->GetQAhistograms();
344}
345
e3ae862b 346