AliPhysics  97a96ce (97a96ce)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliTrackContainerV0.cxx
Go to the documentation of this file.
1 /*************************************************************************
2 * Copyright(c) 1998-2016, 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 #include <iostream>
17 #include <vector>
18 #include <TClonesArray.h>
19 #include <AliLog.h>
20 #include <AliAODTrack.h>
21 #include <AliAODv0.h>
22 
23 #include "AliTrackContainerV0.h"
24 
28 
32  fFilterDaughterTracks(0),
33  fEvent(0),
34  fV0s(0),
35  fDaughterVec()
36 {
37  // Constructor.
38 
39  fBaseClassName = "AliAODTrack";
40  SetClassName("AliAODTrack");
41 }
42 
47  AliTrackContainer(name),
48  fFilterDaughterTracks(0),
49  fEvent(0),
50  fV0s(0),
51  fDaughterVec()
52 {
53  // Constructor.
54 
55  fBaseClassName = "AliAODTrack";
56  SetClassName("AliAODTrack");
57 }
58 
63 void AliTrackContainerV0::SetArray(const AliVEvent *event)
64 {
66 
68  return;
69 
70  fEvent = dynamic_cast<const AliAODEvent*>(event);
71 }
72 
76 {
78 
80  // V0s daughter tracks will be removed from track sample
81 
82  if (!fEvent) {
83  AliWarning("fEvent is not valid!");
84  return;
85  }
86 
87  fV0s = dynamic_cast<TClonesArray*>(fEvent->GetV0s());
88  if (!fV0s) {
89  AliWarning("fV0s is not valid!");
90  return;
91  }
92 
93  fDaughterVec.clear();
94 
95  Int_t iNumV0s = fV0s->GetEntriesFast();
96 
97  for(Int_t iV0 = 0; iV0 < iNumV0s; iV0++)
98  ExtractDaughters(dynamic_cast<AliAODv0*>(fV0s->At(iV0)));
99  }
100 }
101 
106 {
107  if (!cand)
108  return;
109 
110  for (Int_t i = 0; i < 2; i++) {
111  AliAODTrack* track = dynamic_cast<AliAODTrack*>(cand->GetDaughter(i));
112 
113  if(!track)
114  {
115  AliWarning("Track is not valid! Skipping candidate.");
116  return;
117  }
118 
119  fDaughterVec.push_back(track->GetID());
120  }
121 }
122 
131 Bool_t AliTrackContainerV0::ApplyTrackCuts(const AliVTrack* vp, UInt_t &rejectionReason) const
132 {
133  const AliAODTrack* track = dynamic_cast<const AliAODTrack*>(vp);
134 
135  if (!track)
136  return kFALSE;
137 
138  if (AliTrackContainer::ApplyTrackCuts(vp, rejectionReason)) {
139  if (IsV0Daughter(track)) {
140  // track is one of the V0 daughter - will be rejected
141  return kFALSE;
142  } else {
143  return kTRUE;
144  }
145  } else {
146  return kFALSE;
147  }
148 }
149 
155 Bool_t AliTrackContainerV0::IsV0Daughter(const AliAODTrack* track) const
156 {
157  Int_t trackID = track->GetID();
158 
159  if(track->IsGlobalConstrained()){ // constrained tracks have a changed ID
160  trackID = -1-trackID;
161  }
162 
163  for(Int_t i = 0; i < fDaughterVec.size(); i++) {
164  if(trackID == fDaughterVec[i])
165  {
166  return kTRUE;
167  }
168  }
169  return kFALSE;
170 }
Container with name, TClonesArray and cuts for particles.
void ExtractDaughters(AliAODv0 *cand)
Bool_t fFilterDaughterTracks
if the daughter tracks of V0s candidates should be filtered out
virtual Bool_t ApplyTrackCuts(const AliVTrack *vp, UInt_t &rejectionReason) const
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
virtual void SetArray(const AliVEvent *event)
virtual Bool_t ApplyTrackCuts(const AliVTrack *vp, UInt_t &rejectionReason) const
TObjArray * fV0s
list of V0 candidates
std::vector< Int_t > fDaughterVec
list of V0 daughters (storing track IDs)
AliTrackContainerV0()
This is the default constructor, used for ROOT I/O purposes.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
void SetArray(const AliVEvent *event)
bool Bool_t
Definition: External.C:53
Select tracks based on specific prescriptions of V0s in jets analysis.
const AliAODEvent * fEvent
pointer to current event (pointer stay the same, but the content is changed event-by-event) ...
Bool_t IsV0Daughter(const AliAODTrack *track) const