1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 // AliAnalysisTaskCDMeson
21 // Felix Reidt <Felix.Reidt@cern.ch>
23 // class applies the track cuts and provides access to the tracks
28 #include "TObjArray.h"
31 #include "AliESDEvent.h"
32 #include "AliAODEvent.h"
33 #include "AliESDtrackCuts.h"
34 #include "AliVTrack.h"
35 #include "AliMultiplicity.h"
37 // header of the class itsself
38 #include "AliCDMesonTracks.h"
41 //------------------------------------------------------------------------------
42 AliCDMesonTracks::AliCDMesonTracks()
53 , fNtrackletsCentralBarrel(-999)
54 , fNtrackletsForward(-999)
64 //------------------------------------------------------------------------------
65 AliCDMesonTracks::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)
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)
87 //------------------------------------------------------------------------------
88 AliCDMesonTracks& AliCDMesonTracks::operator=(const AliCDMesonTracks& tracks)
91 // assignment operator
94 if (this != &tracks) {
95 // create deep copy ...
101 //------------------------------------------------------------------------------
102 AliCDMesonTracks::~AliCDMesonTracks()
109 fTracks->SetOwner(kTRUE);
115 fSoftTracks->SetOwner(kTRUE);
116 fSoftTracks->Clear();
123 //------------------------------------------------------------------------------
124 Bool_t AliCDMesonTracks::ProcessEvent(AliAODEvent* aodEvent,
125 AliESDEvent* esdEvent,
126 Bool_t doSoft /* = kTRUE */)
129 // this function controlls the processing of an event, after the processing is
130 // done, the results can be used via the getters
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;
138 fAODEvent = aodEvent;
144 fESDEvent = esdEvent;
150 if (!fDoAOD) GetRemainingTracklets();
156 //------------------------------------------------------------------------------
157 AliVTrack* AliCDMesonTracks::GetTrack(UInt_t index) const
160 // provides access to the selected tracks, normal tracks have lower indices
164 if (!fIsValid) return 0x0; // cut selection wasn't properly done
166 if ((((Int_t)index >= fNch) && !fDoSoft) || // soft not enabled
167 ((Int_t)index >= fNcombined)) return 0x0; // soft enabled
168 // index out of range
170 if ((Int_t)index < fNch) return (AliVTrack*)((*fTracks)[index]);
171 else if ((Int_t)index < fNcombined) {
172 return (AliVTrack*)((*fSoftTracks)[index - fNch]);
174 else return 0x0; // something went wrong
178 //------------------------------------------------------------------------------
179 Double_t AliCDMesonTracks::GetInvariantMass(Bool_t includeSoftTracks /*=kTRUE*/)
182 // compute the invariant mass of all accepted tracks in the event
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());
191 if (includeSoftTracks) {
192 for (Int_t iSoftTrack = 0; iSoftTrack < fSoftTracks->GetEntriesFast();
194 AliVTrack* track = (AliVTrack*)fSoftTracks->UncheckedAt(iSoftTrack);
195 TLorentzVector temp(track->Px(), track->Py(), track->Pz(), track->E());
203 //------------------------------------------------------------------------------
204 void AliCDMesonTracks::ApplyCuts()
207 // steers the track selection process
211 fAODEvent->GetNumberOfTracks() : fESDEvent->GetNumberOfTracks();
219 CutTrack(fAODEvent); // ordinary tracks
220 CutTrack(fAODEvent, 2); // kITSpureSA
223 CutTrack(fESDEvent); // ordinary tracks
224 CutTrack(fESDEvent, 2); // kITSpureSA
227 if (fDoSoft) { // do soft tracks
229 CutTrack(fAODEvent, 1);
232 CutTrack(fESDEvent, 1);
235 fNcombined = fNch + fNsoft;
236 for (Int_t iSoft = 0; iSoft < fNsoft; iSoft++) {
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
247 else { // do not care about soft tracks
253 //------------------------------------------------------------------------------
254 void AliCDMesonTracks::CutTrack(AliESDEvent *ESDEvent, Int_t mode /* = 0 */)
257 //CutTrack to be combined with the AOD function // TODO
260 const Double_t etacut = 0.9;
262 AliESDtrackCuts esdTrackCuts;
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...)
276 esdTrackCuts.SetMinNClustersTPC(70);
277 //esdTrackCuts.SetMinNCrossedRowsTPC(70);
278 //esdTrackCuts.SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
280 esdTrackCuts.SetMaxChi2PerClusterTPC(4);
281 esdTrackCuts.SetAcceptKinkDaughters(kFALSE);
282 esdTrackCuts.SetRequireTPCRefit(kTRUE);
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");
290 esdTrackCuts.SetMaxDCAToVertexZ(2);
291 esdTrackCuts.SetDCAToVertex2D(kFALSE);
292 esdTrackCuts.SetRequireSigmaToVertex(kFALSE);
294 esdTrackCuts.SetEtaRange(-etacut, etacut);
296 fTracks = esdTrackCuts.GetAcceptedTracks(ESDEvent);
297 fNch = fTracks->GetEntriesFast();
299 else if (mode == 1) {
300 // cuts for soft tracks (ITS only - kITSsa)
303 fSoftTracks->Clear();
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");
317 esdTrackCuts.SetEtaRange(-etacut, etacut);
319 fSoftTracks = esdTrackCuts.GetAcceptedTracks(ESDEvent);
320 fNsoft = fSoftTracks->GetEntriesFast();
323 // cuts for ITSpureSA tracks used in order to get rid of them for noise
326 // selection according to cuts
327 esdTrackCuts.SetRequireITSPureStandAlone(kTRUE);
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)){
336 TObjArray* arr = esdTrackCuts.GetAcceptedTracks(ESDEvent);
337 fNITSpureSA = arr->GetEntriesFast();
344 //------------------------------------------------------------------------------
345 void AliCDMesonTracks::CutTrack(AliAODEvent *AODEvent, Int_t mode /* = 0 */)
352 TObjArray* trks = 0x0;
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...)
363 fTracks->SetOwner(kTRUE);
367 fTracks = new TObjArray();
368 fTracks->SetOwner(kTRUE);
371 // store where to put selected tracks
375 else if (mode == 1) {
376 // cuts for soft tracks (ITS only - kITSsa)
380 fSoftTracks->SetOwner(kTRUE);
381 fSoftTracks->Clear();
384 fSoftTracks = new TObjArray();
385 fSoftTracks->SetOwner(kTRUE);
388 // sotre where to put selected tracks
393 // cuts for ITSpureSA tracks used in order to get rid of them for noise
397 // do not store tracks, just count them =>
399 ntrks = &fNITSpureSA;
402 for (Int_t iTrk = 0; iTrk < AODEvent->GetNumberOfTracks(); iTrk++) {
403 const AliAODTrack* trk = AODEvent->GetTrack(iTrk);
405 if (trk->TestFilterBit(bit)) {
406 // test whether track was selected by that filter
408 if (trks) { // add tracks to TObjArray
409 trks->Add((TObject*)trk);
411 else { // just count them
418 (*ntrks) = trks->GetEntriesFast();
423 //------------------------------------------------------------------------------
424 void AliCDMesonTracks::GetRemainingTracklets()
426 // determines the number of tracklets in an event, which are not assigned to
428 // this is only possible running on ESDs, for AODs this information has to be
431 if (!fESDEvent) return;
432 const AliMultiplicity *mult = fESDEvent->GetMultiplicity();
436 fNtrackletsCentralBarrel = 0;
437 fNtrackletsForward = 0;
439 for (Int_t iTracklet = 0; iTracklet < mult->GetNumberOfTracklets();
441 Int_t id1 = -1, id2 = -1;
442 if (!mult->GetTrackletTrackIDs(iTracklet, 0, id1, id2)) {
443 float_t eta = mult->GetEta(iTracklet);
445 if ((eta < -0.9) || (eta < 0.9)) {
446 ++fNtrackletsForward;
449 ++fNtrackletsCentralBarrel;