]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGUD/DIFFRACTIVE/xsAndTwoProng/AliCDMesonTracks.cxx
- removed old double-gap analysis task by Xian-Guo Lu
[u/mrichter/AliRoot.git] / PWGUD / DIFFRACTIVE / xsAndTwoProng / AliCDMesonTracks.cxx
CommitLineData
784b6a81 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// AliCDMesonTracks
17// for
18// AliAnalysisTaskCDMeson
19//
20// Author:
21// Felix Reidt <Felix.Reidt@cern.ch>
22//
23// class applies the track cuts and provides access to the tracks
24//
25//
26
27// ROOT classes
28#include "TObjArray.h"
29
30// AliRoot classes
31#include "AliESDEvent.h"
32#include "AliAODEvent.h"
33#include "AliESDtrackCuts.h"
34#include "AliVTrack.h"
35#include "AliMultiplicity.h"
36
37// header of the class itsself
38#include "AliCDMesonTracks.h"
39
40
41//------------------------------------------------------------------------------
42AliCDMesonTracks::AliCDMesonTracks()
43 : fAODEvent(0x0)
44 , fESDEvent(0x0)
45 , fDoAOD(kFALSE)
46 , fDoSoft(kTRUE)
47 , fIsValid(kFALSE)
48 , fNTrk0(-999)
49 , fNch(-999)
50 , fNsoft(-999)
51 , fNcombined(-999)
52 , fNITSpureSA(-999)
53 , fNtrackletsCentralBarrel(-999)
54 , fNtrackletsForward(-999)
55 , fTracks(0x0)
56 , fSoftTracks(0x0)
57{
58 //
59 // constructor
60 //
61}
62
63
64//------------------------------------------------------------------------------
65AliCDMesonTracks::AliCDMesonTracks(const AliCDMesonTracks& tracks)
66 : fAODEvent(tracks.fAODEvent)
67 , fESDEvent(tracks.fESDEvent)
68 , fDoAOD(tracks.fDoAOD)
69 , fDoSoft(tracks.fDoSoft)
70 , fIsValid(tracks.fIsValid)
71 , fNTrk0(tracks.fNTrk0)
72 , fNch(tracks.fNch)
73 , fNsoft(tracks.fNsoft)
74 , fNcombined(tracks.fNcombined)
75 , fNITSpureSA(tracks.fNITSpureSA)
76 , fNtrackletsCentralBarrel(tracks.fNtrackletsCentralBarrel)
77 , fNtrackletsForward(tracks.fNtrackletsForward)
78 , fTracks(tracks.fTracks)
79 , fSoftTracks(tracks.fSoftTracks)
80{
81 //
82 // copy constructor
83 //
84}
85
86
87//------------------------------------------------------------------------------
88AliCDMesonTracks& AliCDMesonTracks::operator=(const AliCDMesonTracks& tracks)
89{
90 //
91 // assignment operator
92 //
93
94 if (this != &tracks) {
95 // create deep copy ...
96 }
97 return *this;
98}
99
100
101//------------------------------------------------------------------------------
102AliCDMesonTracks::~AliCDMesonTracks()
103{
104 //
105 // destructor
106 //
107
108 if (fTracks) {
109 fTracks->SetOwner(kTRUE);
110 fTracks->Clear();
111 delete fTracks;
112 fTracks = 0x0;
113 }
114 if (fSoftTracks) {
115 fSoftTracks->SetOwner(kTRUE);
116 fSoftTracks->Clear();
117 delete fSoftTracks;
118 fSoftTracks = 0x0;
119 }
120}
121
122
123//------------------------------------------------------------------------------
124Bool_t AliCDMesonTracks::ProcessEvent(AliAODEvent* aodEvent,
125 AliESDEvent* esdEvent,
126 Bool_t doSoft /* = kTRUE */)
127{
128 //
129 // this function controlls the processing of an event, after the processing is
130 // done, the results can be used via the getters
131 //
132
133 if ((aodEvent && esdEvent) || (!aodEvent && !esdEvent)) {
134 // only one event type is allowed, no event type is also not allowed
135 return fIsValid = fDoAOD = kFALSE;
136 }
137 else if (aodEvent) {
138 fAODEvent = aodEvent;
139 fESDEvent = 0x0;
140 fDoAOD = kTRUE;
141 }
142 else if (esdEvent) {
143 fAODEvent = 0x0;
144 fESDEvent = esdEvent;
145 fDoAOD = kFALSE;
146 }
147 fDoSoft = doSoft;
148
149 ApplyCuts();
150 if (!fDoAOD) GetRemainingTracklets();
151 fIsValid = kTRUE;
152 return kTRUE;
153}
154
155
156//------------------------------------------------------------------------------
157AliVTrack* AliCDMesonTracks::GetTrack(UInt_t index) const
158{
159 //
160 // provides access to the selected tracks, normal tracks have lower indices
161 // than soft tracks
162 //
163
164 if (!fIsValid) return 0x0; // cut selection wasn't properly done
165
166 if ((((Int_t)index >= fNch) && !fDoSoft) || // soft not enabled
167 ((Int_t)index >= fNcombined)) return 0x0; // soft enabled
168 // index out of range
169
170 if ((Int_t)index < fNch) return (AliVTrack*)((*fTracks)[index]);
171 else if ((Int_t)index < fNcombined) {
172 return (AliVTrack*)((*fSoftTracks)[index - fNch]);
173 }
174 else return 0x0; // something went wrong
175}
176
177
178//------------------------------------------------------------------------------
179Double_t AliCDMesonTracks::GetInvariantMass(Bool_t includeSoftTracks /*=kTRUE*/)
180{
181 //
182 // compute the invariant mass of all accepted tracks in the event
183 //
184
185 TLorentzVector sum;
186 for (Int_t iTrack = 0; iTrack < fTracks->GetEntriesFast(); ++iTrack) {
187 AliVTrack* track = (AliVTrack*)fTracks->UncheckedAt(iTrack);
188 TLorentzVector temp(track->Px(), track->Py(), track->Pz(), track->E());
189 sum += temp;
190 }
191 if (includeSoftTracks) {
192 for (Int_t iSoftTrack = 0; iSoftTrack < fSoftTracks->GetEntriesFast();
193 ++iSoftTrack) {
194 AliVTrack* track = (AliVTrack*)fSoftTracks->UncheckedAt(iSoftTrack);
195 TLorentzVector temp(track->Px(), track->Py(), track->Pz(), track->E());
196 sum += temp;
197 }
198 }
199 return sum.M();
200}
201
202
203//------------------------------------------------------------------------------
204void AliCDMesonTracks::ApplyCuts()
205{
206 //
207 // steers the track selection process
208 //
209
210 fNTrk0 = (fDoAOD) ?
211 fAODEvent->GetNumberOfTracks() : fESDEvent->GetNumberOfTracks();
212
213 fNch = -999;
214 fNsoft = -999;
215 fNcombined = -999;
216 fNITSpureSA = -999;
217
218 if (fDoAOD) {
219 CutTrack(fAODEvent); // ordinary tracks
220 CutTrack(fAODEvent, 2); // kITSpureSA
221 }
222 else {
223 CutTrack(fESDEvent); // ordinary tracks
224 CutTrack(fESDEvent, 2); // kITSpureSA
225 }
226
227 if (fDoSoft) { // do soft tracks
228 if (fDoAOD) {
229 CutTrack(fAODEvent, 1);
230 }
231 else {
232 CutTrack(fESDEvent, 1);
233 }
234
235 fNcombined = fNch + fNsoft;
236 for (Int_t iSoft = 0; iSoft < fNsoft; iSoft++) {
237 Int_t iTrk = 0;
238 while (iTrk < fNch) {
239 // TODO find some criterion to match them properly!
240 // check whether they are really complementary if not
241 // an error will be raised
242 // already contained in both arrays, exit loop
243 ++iTrk; // next track
244 }
245 }
246 }
247 else { // do not care about soft tracks
248 fNcombined = fNch;
249 }
250}
251
252
253//------------------------------------------------------------------------------
254void AliCDMesonTracks::CutTrack(AliESDEvent *ESDEvent, Int_t mode /* = 0 */)
255{
256 //
257 //CutTrack to be combined with the AOD function // TODO
258 //
259
260 const Double_t etacut = 0.9;
261
262 AliESDtrackCuts esdTrackCuts;
263
264 if (mode == 0) { // default mode
265 // cuts for normal tracks (ITS + TPC)
266 // i.e. GetStandardITSTPCTrackCuts2010(kTRUE);
267 // (same, just typed in full detail...)
268
269 if (fTracks) {
270 fTracks->Clear();
271 delete fTracks;
272 fTracks = 0x0;
273 }
274
275 // TPC
276 esdTrackCuts.SetMinNClustersTPC(70);
277 //esdTrackCuts.SetMinNCrossedRowsTPC(70);
278 //esdTrackCuts.SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
279
280 esdTrackCuts.SetMaxChi2PerClusterTPC(4);
281 esdTrackCuts.SetAcceptKinkDaughters(kFALSE);
282 esdTrackCuts.SetRequireTPCRefit(kTRUE);
283 // ITS
284 esdTrackCuts.SetRequireITSRefit(kTRUE);
285 esdTrackCuts.SetClusterRequirementITS(AliESDtrackCuts::kSPD,
286 AliESDtrackCuts::kAny);
287 // 7*(0.0026+0.0050/pt^1.01)
288 esdTrackCuts.SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
289
290 esdTrackCuts.SetMaxDCAToVertexZ(2);
291 esdTrackCuts.SetDCAToVertex2D(kFALSE);
292 esdTrackCuts.SetRequireSigmaToVertex(kFALSE);
293
294 esdTrackCuts.SetEtaRange(-etacut, etacut);
295
296 fTracks = esdTrackCuts.GetAcceptedTracks(ESDEvent);
297 fNch = fTracks->GetEntriesFast();
298 }
299 else if (mode == 1) {
300 // cuts for soft tracks (ITS only - kITSsa)
301
302 if (fSoftTracks) {
303 fSoftTracks->Clear();
304 delete fSoftTracks;
305 fSoftTracks = 0x0;
306 }
307
308 esdTrackCuts.SetRequireITSStandAlone(kTRUE);
309 esdTrackCuts.SetRequireITSPureStandAlone(kFALSE);
310 esdTrackCuts.SetRequireITSRefit(kTRUE);
311 esdTrackCuts.SetMinNClustersITS(4);
312 esdTrackCuts.SetClusterRequirementITS(AliESDtrackCuts::kSPD,
313 AliESDtrackCuts::kAny);
314 esdTrackCuts.SetMaxChi2PerClusterITS(1.);
315 esdTrackCuts.SetMaxDCAToVertexXYPtDep("0.0595+0.0182/pt^1.55");
316
317 esdTrackCuts.SetEtaRange(-etacut, etacut);
318
319 fSoftTracks = esdTrackCuts.GetAcceptedTracks(ESDEvent);
320 fNsoft = fSoftTracks->GetEntriesFast();
321 }
322 else {
323 // cuts for ITSpureSA tracks used in order to get rid of them for noise
324 // studies
325
326 // selection according to cuts
327 esdTrackCuts.SetRequireITSPureStandAlone(kTRUE);
328
329 // do selection according to status bits (never tested!!!)
330 //for(Int_t itrack = 0; itrack < ESDEvent->GetNumberOfTracks(); itrack++){
331 // const AliESDtrack* esdtrack = ESDEvent->GetTrack(itrack);
332 // UInt64 status = esdtrack->GetStatus();
333 // if ((status & kITSpureSA) && !(status & kITSsa)){
334 // }
335 //}
336 TObjArray* arr = esdTrackCuts.GetAcceptedTracks(ESDEvent);
337 fNITSpureSA = arr->GetEntriesFast();
338 delete arr;
339 arr = 0x0;
340 }
341}
342
343
344//------------------------------------------------------------------------------
345void AliCDMesonTracks::CutTrack(AliAODEvent *AODEvent, Int_t mode /* = 0 */)
346{
347 //
348 // CutTrack for AODs
349 //
350
351 UInt_t bit = 0x0;
352 TObjArray* trks = 0x0;
353 Int_t* ntrks = 0x0;
354
355 if (mode == 0) { // default mode
356 // cuts for normal tracks (ITS + TPC)
357 // i.e. GetStandardITSTPCTrackCuts2010(kTRUE);
358 // (same, just typed in full detail...)
359 bit = 0x1 << 14;
360
361 // prepare storage
362 if (fTracks) {
363 fTracks->SetOwner(kTRUE);
364 fTracks->Clear();
365 }
366 else {
367 fTracks = new TObjArray();
368 fTracks->SetOwner(kTRUE);
369 }
370
371 // store where to put selected tracks
372 trks = fTracks;
373 ntrks = &fNch;
374 }
375 else if (mode == 1) {
376 // cuts for soft tracks (ITS only - kITSsa)
377 bit = 0x1 << 15;
378
379 if (fSoftTracks) {
380 fSoftTracks->SetOwner(kTRUE);
381 fSoftTracks->Clear();
382 }
383 else {
384 fSoftTracks = new TObjArray();
385 fSoftTracks->SetOwner(kTRUE);
386 }
387
388 // sotre where to put selected tracks
389 trks = fSoftTracks;
390 ntrks = &fNsoft;
391 }
392 else {
393 // cuts for ITSpureSA tracks used in order to get rid of them for noise
394 // studies
395 bit = 0x1 << 16;
396
397 // do not store tracks, just count them =>
398 trks = 0x0;
399 ntrks = &fNITSpureSA;
400 }
401
402 for (Int_t iTrk = 0; iTrk < AODEvent->GetNumberOfTracks(); iTrk++) {
403 const AliAODTrack* trk = AODEvent->GetTrack(iTrk);
404
405 if (trk->TestFilterBit(bit)) {
406 // test whether track was selected by that filter
407
408 if (trks) { // add tracks to TObjArray
409 trks->Add((TObject*)trk);
410 }
411 else { // just count them
412 ++(*ntrks);
413 }
414 }
415 }
416
417 if (trks) {
418 (*ntrks) = trks->GetEntriesFast();
419 }
420}
421
422
423//------------------------------------------------------------------------------
424void AliCDMesonTracks::GetRemainingTracklets()
425{
426 // determines the number of tracklets in an event, which are not assigned to
427 // tracks
428 // this is only possible running on ESDs, for AODs this information has to be
429 // preprocessed
430
431 if (!fESDEvent) return;
432 const AliMultiplicity *mult = fESDEvent->GetMultiplicity();
433
434 if (mult) {
435 // reset values
436 fNtrackletsCentralBarrel = 0;
437 fNtrackletsForward = 0;
438
439 for (Int_t iTracklet = 0; iTracklet < mult->GetNumberOfTracklets();
440 iTracklet++) {
441 Int_t id1 = -1, id2 = -1;
442 if (!mult->GetTrackletTrackIDs(iTracklet, 0, id1, id2)) {
443 float_t eta = mult->GetEta(iTracklet);
444
445 if ((eta < -0.9) || (eta < 0.9)) {
446 ++fNtrackletsForward;
447 }
448 else {
449 ++fNtrackletsCentralBarrel;
450 }
451 }
452 }
453 }
454}