]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/AliRsnMiniValue.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnMiniValue.cxx
CommitLineData
03d23846 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, pair, 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 "Riostream.h"
41
42#include "AliLog.h"
43
44#include "AliRsnMiniPair.h"
45#include "AliRsnMiniEvent.h"
4fb0dfa3 46#include "AliRsnMiniParticle.h"
03d23846 47
48#include "AliRsnMiniValue.h"
49
50ClassImp(AliRsnMiniValue)
51
52//_____________________________________________________________________________
53AliRsnMiniValue::AliRsnMiniValue(EType type, Bool_t useMC) :
54 TNamed(ValueName(type, useMC), ""),
55 fType(type),
56 fUseMCInfo(useMC)
57{
58//
59// Constructor
60//
61}
62
63//_____________________________________________________________________________
61f275d1 64AliRsnMiniValue::AliRsnMiniValue(const AliRsnMiniValue &copy) :
03d23846 65 TNamed(copy),
66 fType(copy.fType),
67 fUseMCInfo(copy.fUseMCInfo)
68{
69//
70// Copy constructor
71//
72}
73
74//_____________________________________________________________________________
61f275d1 75AliRsnMiniValue &AliRsnMiniValue::operator=(const AliRsnMiniValue &copy)
03d23846 76{
77//
78// Assignment operator.
79// Works like copy constructor.
80//
03d23846 81 TNamed::operator=(copy);
e6f3a909 82 if (this == &copy)
61f275d1 83 return *this;
03d23846 84 fType = copy.fType;
85 fUseMCInfo = copy.fUseMCInfo;
86
87 return (*this);
88}
89
90//_____________________________________________________________________________
61f275d1 91const char *AliRsnMiniValue::TypeName(EType type)
03d23846 92{
93//
94// This method returns a string to give a name to each possible
95// computation value.
96//
97
98 switch (type) {
99 case kVz: return "EventVz";
100 case kMult: return "EventMult";
57b34356 101 case kTracklets: return "EventTracklets";
03d23846 102 case kPlaneAngle: return "EventPlane";
103 case kLeadingPt: return "EventLeadingPt";
104 case kPt: return "Pt";
105 case kPz: return "Pz";
106 case kInvMass: return "InvMass";
107 case kInvMassRes: return "InvMassResolution";
2d21288f 108 case kInvMassDiff: return "InvMassDifference";
03d23846 109 case kEta: return "Eta";
110 case kMt: return "Mt";
111 case kY: return "Y";
112 case kPtRatio: return "PtRatio";
113 case kDipAngle: return "DipAngle";
114 case kCosThetaStar: return "CosThetaStar";
115 case kAngleLeading: return "AngleToLeading";
4fb0dfa3 116 case kFirstDaughterPt: return "FirstDaughterPt";
117 case kSecondDaughterPt: return "SecondDaughterPt";
118 case kFirstDaughterP: return "FirstDaughterP";
119 case kSecondDaughterP: return "SecondDaughterP";
213adb92 120 case kDCAproduct: return "DaughterDCAproduct";
121 case kFirstDaughterDCA: return "FirstDaughterDCA";
122 case kSecondDaughterDCA: return "SecondDaughterDCA";
088ca370 123 case kNSisters: return "NumberOfSisters";
03d23846 124 default: return "Undefined";
125 }
126}
127
128//_____________________________________________________________________________
129Float_t AliRsnMiniValue::Eval(AliRsnMiniPair *pair, AliRsnMiniEvent *event)
130{
131//
132// Evaluation of the required value.
133// In this implementation, fills the member 4-vectors with data
134// coming from the object passed as argument, and then returns the value
135//
136
137 if (!pair && fType > kEventCuts) {
138 AliError("Null pair passed!");
139 return 1E20;
140 }
61f275d1 141
03d23846 142 // compute value depending on types in the enumeration
143 // if the type does not match any available choice, or if
144 // the computation is not doable due to any problem
145 // (not initialized support object, wrong values, risk of floating point errors)
146 // the method returng kFALSE and sets the computed value to a meaningless number
4fb0dfa3 147 Double_t p3[3]= {0.,0.,0.};
148 AliRsnMiniParticle *l;
149 TLorentzVector v;
03d23846 150 switch (fType) {
61f275d1 151 // ---- event values -------------------------------------------------------------------------
03d23846 152 case kVz:
153 return event->Vz();
154 case kMult:
155 return event->Mult();
57b34356 156 case kTracklets:
157 return event->Tracklets();
03d23846 158 case kPlaneAngle:
159 return event->Angle();
160 case kLeadingPt:
4fb0dfa3 161 l = event->LeadingParticle();
162 if (l) {
163 l->Set4Vector(v,-1.0,fUseMCInfo);
164 return v.Pt();
165 }
03d23846 166 return 0.0;
e6952ec7 167 case kPt:
03d23846 168 return pair->Pt(fUseMCInfo);
169 case kInvMass:
170 return pair->InvMass(fUseMCInfo);
171 case kEta:
172 return pair->Eta(fUseMCInfo);
173 case kInvMassRes:
174 return pair->InvMassRes();
2d21288f 175 case kInvMassDiff:
176 return pair->InvMassDiff();
03d23846 177 case kMt:
178 return pair->Mt(fUseMCInfo);
179 case kY:
180 return pair->Y(fUseMCInfo);
181 case kPtRatio:
182 return pair->PtRatio(fUseMCInfo);
183 case kDipAngle:
184 return pair->DipAngle(fUseMCInfo);
185 case kCosThetaStar:
186 return pair->CosThetaStar(fUseMCInfo);
187 case kAngleLeading:
4fb0dfa3 188 l = event->LeadingParticle();
189 if (l) {
190 l->Set4Vector(v,-1.0,fUseMCInfo);
191 Double_t angle = v.Phi() - pair->Sum(fUseMCInfo).Phi();
192
193 //return angle w.r.t. leading particle in the range -pi/2, 3/2pi
194 while (angle >= 1.5 * TMath::Pi()) angle -= 2 * TMath::Pi();
195 while (angle < -0.5 * TMath::Pi()) angle += 2 * TMath::Pi();
196 return angle;
197 }
198// AliWarning("This method is not yet implemented");
199 return 1E20;
397c0062 200 case kFirstDaughterPt:
201 return pair->DaughterPt(0,fUseMCInfo);
202 case kSecondDaughterPt:
203 return pair->DaughterPt(1,fUseMCInfo);
204 case kFirstDaughterP:
4fb0dfa3 205 pair->DaughterPxPyPz(0,fUseMCInfo, p3);
397c0062 206 return TMath::Sqrt(p3[0]*p3[0]+p3[1]*p3[1]+p3[2]*p3[2]);
207 case kSecondDaughterP:
4fb0dfa3 208 pair->DaughterPxPyPz(1,fUseMCInfo, p3);
397c0062 209 return TMath::Sqrt(p3[0]*p3[0]+p3[1]*p3[1]+p3[2]*p3[2]);
213adb92 210 case kDCAproduct:
211 return pair->DCAProduct();
212 case kFirstDaughterDCA:
213 return pair->DaughterDCA(0);
214 case kSecondDaughterDCA:
215 return pair->DaughterDCA(1);
088ca370 216 case kNSisters:
217 return pair->NSisters();
03d23846 218 default:
219 AliError("Invalid value type");
220 return 1E20;
221 }
222}