AliPhysics  58f3d52 (58f3d52)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliHFTrackContainer.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 <TClonesArray.h>
17 #include <AliAODMCParticle.h>
18 #include <AliLog.h>
19 #include <AliAODRecoDecay.h>
20 #include <AliAODTrack.h>
21 
22 #include "AliHFTrackContainer.h"
23 
27 
31  fDMesonCandidate(0),
32  fDaughterList(10)
33 {
34  // Constructor.
35 
36  fBaseClassName = "AliAODTrack";
37  SetClassName("AliAODTrack");
38  fDaughterList.SetOwner(kFALSE);
39 }
40 
45  AliTrackContainer(name),
46  fDMesonCandidate(0),
47  fDaughterList(10)
48 {
49  // Constructor.
50 
51  fBaseClassName = "AliAODTrack";
52  SetClassName("AliAODTrack");
53  fDaughterList.SetOwner(kFALSE);
54 }
55 
63 Bool_t AliHFTrackContainer::ApplyTrackCuts(const AliVTrack* vp, UInt_t &rejectionReason) const
64 {
65  const AliAODTrack* part = static_cast<const AliAODTrack*>(vp);
66 
67  if (IsDMesonDaughter(part)) {
68  rejectionReason = kHFCut;
69  return kFALSE; // daughter the D meson candidate
70  }
71 
72  // Not a daughter of the D meson. Apply regular cuts.
73  return AliTrackContainer::ApplyTrackCuts(vp, rejectionReason);
74 }
75 
80 Bool_t AliHFTrackContainer::IsDMesonDaughter(const AliAODTrack* track) const
81 {
82  if (!fDMesonCandidate) return kFALSE;
83 
84  if (fDaughterList.FindObject(track)) return kTRUE;
85 
86  return kFALSE;
87 }
88 
93 {
96 }
97 
98 
101 {
102  fDaughterList.Clear();
104 }
105 
106 // Add all the daughters of a D meson candidate in a TObjArray. Follows all the decay cascades.
109 void AliHFTrackContainer::AddDaughters(const AliAODRecoDecay* cand)
110 {
111  if (!cand) return;
112 
113  Int_t n = cand->GetNDaughters();
114 
115  for (Int_t i = 0; i < n; i++) {
116  AliVTrack* track = dynamic_cast<AliVTrack*>(cand->GetDaughter(i));
117  if (!track) continue;
118 
119  AliAODRecoDecay* cand2 = dynamic_cast<AliAODRecoDecay*>(track);
120 
121  if (cand2) {
122  AddDaughters(cand2);
123  }
124  else {
125  if (!track->InheritsFrom("AliAODTrack")) {
126  ::Warning("AliHFTrackContainer::AddDaughters", "One of the daughters is not of type 'AliAODTrack' nor 'AliAODRecoDecay'.");
127  continue;
128  }
129  fDaughterList.AddLast(track);
130  }
131  }
132 }
Bool_t IsDMesonDaughter(const AliAODTrack *track) const
void SetDMesonCandidate(AliAODRecoDecay *c)
Container with name, TClonesArray and cuts for particles.
TCanvas * c
Definition: TestFitELoss.C:172
Select tracks based on specific prescriptions of HF analysis.
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
void GenerateDaughterList()
Generate the list of the daughters of the D meson candidate.
AliHFTrackContainer()
This is the default constructor, used for ROOT I/O purposes.
Select MC particles based on specific prescriptions of HF analysis.
virtual Bool_t ApplyTrackCuts(const AliVTrack *vp, UInt_t &rejectionReason) const
bool Bool_t
Definition: External.C:53
AliAODRecoDecay * fDMesonCandidate
Exclude daughters of this D meson candidate.
void AddDaughters(const AliAODRecoDecay *cand)
TObjArray fDaughterList
Daughters of the D meson candidate.