]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnValueDaughter.cxx
Added another version of cut for pp (small differences in PID)
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnValueDaughter.cxx
CommitLineData
2895972e 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////////////////////////////////////////////////////////////////////////////////
17//
18// This class contains all code which is used to compute any of the values
19// which can be of interest within a resonance analysis. Besides the obvious
20// invariant mass, it allows to compute other utility values on all possible
21// targets, in order to allow a wide spectrum of binning and checks.
22// When needed, this object can also define a binning in the variable which
23// it is required to compute, which is used for initializing axes of output
24// histograms (see AliRsnFunction).
25// The value computation requires this object to be passed the object whose
26// informations will be used. This object can be of any allowed input type
27// (track, Daughter, event), then this class must inherit from AliRsnTarget.
28// Then, when value computation is attempted, a check on target type is done
29// and computation is successful only if expected target matches that of the
30// passed object.
31// In some cases, the value computation can require a support external object,
32// which must then be passed to this class. It can be of any type inheriting
33// from TObject.
34//
35// authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
36// M. Vala (martin.vala@cern.ch)
37//
38////////////////////////////////////////////////////////////////////////////////
39
40#include "AliVVertex.h"
41#include "AliMultiplicity.h"
42#include "AliESDtrackCuts.h"
43#include "AliESDpid.h"
44#include "AliAODPid.h"
45#include "AliCentrality.h"
46#include "AliESDUtils.h"
47
48#include "AliRsnEvent.h"
49#include "AliRsnDaughter.h"
50#include "AliRsnMother.h"
51#include "AliRsnDaughterDef.h"
52#include "AliRsnDaughterDef.h"
53
54#include "AliRsnValueDaughter.h"
55
56ClassImp(AliRsnValueDaughter)
57
58//_____________________________________________________________________________
59AliRsnValueDaughter::AliRsnValueDaughter(const char *name, EType type) :
60 AliRsnValue(name, AliRsnTarget::kDaughter),
61 fType(type)
62{
63//
64// Constructor
65//
66}
67
68//_____________________________________________________________________________
69AliRsnValueDaughter::AliRsnValueDaughter(const AliRsnValueDaughter& copy) :
70 AliRsnValue(copy),
71 fType(copy.fType)
72{
73//
74// Copy constructor
75//
76}
77
78//_____________________________________________________________________________
79AliRsnValueDaughter& AliRsnValueDaughter::operator=(const AliRsnValueDaughter& copy)
80{
81//
82// Assignment operator.
83// Works like copy constructor.
84//
85
86 AliRsnValue::operator=(copy);
87 fType = copy.fType;
88
89 return (*this);
90}
91
92//_____________________________________________________________________________
93const char* AliRsnValueDaughter::GetTypeName() const
94{
95//
96// This method returns a string to give a name to each possible
97// computation value.
98//
99
100 switch (fType) {
101 case kP: return "SingleTrackPtot";
102 case kPt: return "SingleTrackPt";
103 case kPtpc: return "SingleTrackPtpc";
104 case kEta: return "SingleTrackEta";
105 case kITSsignal: return "SingleTrackITSsignal";
106 case kTPCsignal: return "SingleTrackTPCsignal";
107 case kTOFsignal: return "SingleTrackTOFsignal";
108 default: return "Undefined";
109 }
110}
111
112//_____________________________________________________________________________
113Bool_t AliRsnValueDaughter::Eval(TObject *object)
114{
115//
116// Evaluation of the required value.
117// Checks that the passed object is of the right type
118// and if this check is successful, computes the required value.
119// The output of the function tells if computing was successful,
120// and the values must be taken with GetValue().
121//
122
123 // coherence check, which also casts object
124 // to AliRsnTarget data members and returns kFALSE
125 // in case the object is NULL
126 if (!TargetOK(object)) return kFALSE;
127
128 // set a reference to the mother momentum
129 TLorentzVector &p = fDaughter->P(fUseMCInfo);
130 AliVTrack *track = fDaughter->Ref2Vtrack();
131
132 // compute value depending on types in the enumeration
133 // if the type does not match any available choice, or if
134 // the computation is not doable due to any problem
135 // (not initialized support object, wrong values, risk of floating point errors)
136 // the method returng kFALSE and sets the computed value to a meaningless number
137 switch (fType) {
138 case kP:
139 fComputedValue = p.Mag();
140 return kTRUE;
141 case kPt:
142 fComputedValue = p.Perp();
143 return kTRUE;
144 case kEta:
145 fComputedValue = p.Eta();
146 return kTRUE;
147 case kPtpc:
148 if (track) {
149 fComputedValue = track->GetTPCmomentum();
150 return kTRUE;
151 } else {
152 AliWarning("Cannot get TPC momentum for non-track object");
153 fComputedValue = 0.0;
154 return kFALSE;
155 }
156 case kITSsignal:
157 if (track) {
158 fComputedValue = track->GetITSsignal();
159 return kTRUE;
160 } else {
161 AliWarning("Cannot get ITS signal for non-track object");
162 fComputedValue = 0.0;
163 return kFALSE;
164 }
165 case kTPCsignal:
166 if (track) {
167 fComputedValue = track->GetTPCsignal();
168 return kTRUE;
169 } else {
170 AliWarning("Cannot get TPC signal for non-track object");
171 fComputedValue = 0.0;
172 return kFALSE;
173 }
174 case kTOFsignal:
175 if (track) {
176 fComputedValue = track->GetTOFsignal();
177 return kTRUE;
178 } else {
179 AliWarning("Cannot get TOF signal for non-track object");
180 fComputedValue = 0.0;
181 return kFALSE;
182 }
183 default:
184 AliError(Form("[%s] Invalid value type for this computation", GetName()));
185 return kFALSE;
186 }
187}