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