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