]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/AliRsnMiniValue.cxx
Fix in AddTaskXiStar to remove physics selection (not needed)
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnMiniValue.cxx
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"
46
47 #include "AliRsnMiniValue.h"
48
49 ClassImp(AliRsnMiniValue)
50
51 //_____________________________________________________________________________
52 AliRsnMiniValue::AliRsnMiniValue(EType type, Bool_t useMC) :
53    TNamed(ValueName(type, useMC), ""),
54    fType(type),
55    fUseMCInfo(useMC)
56 {
57 //
58 // Constructor
59 //
60 }
61
62 //_____________________________________________________________________________
63 AliRsnMiniValue::AliRsnMiniValue(const AliRsnMiniValue &copy) :
64    TNamed(copy),
65    fType(copy.fType),
66    fUseMCInfo(copy.fUseMCInfo)
67 {
68 //
69 // Copy constructor
70 //
71 }
72
73 //_____________________________________________________________________________
74 AliRsnMiniValue &AliRsnMiniValue::operator=(const AliRsnMiniValue &copy)
75 {
76 //
77 // Assignment operator.
78 // Works like copy constructor.
79 //
80    TNamed::operator=(copy);
81    if (this == &copy)
82       return *this;
83    fType = copy.fType;
84    fUseMCInfo = copy.fUseMCInfo;
85
86    return (*this);
87 }
88
89 //_____________________________________________________________________________
90 const char *AliRsnMiniValue::TypeName(EType type)
91 {
92 //
93 // This method returns a string to give a name to each possible
94 // computation value.
95 //
96
97    switch (type) {
98       case kVz:           return "EventVz";
99       case kMult:         return "EventMult";
100       case kPlaneAngle:   return "EventPlane";
101       case kLeadingPt:    return "EventLeadingPt";
102       case kPt:           return "Pt";
103       case kPz:           return "Pz";
104       case kInvMass:      return "InvMass";
105       case kInvMassRes:   return "InvMassResolution";
106       case kInvMassDiff:  return "InvMassDifference";
107       case kEta:          return "Eta";
108       case kMt:           return "Mt";
109       case kY:            return "Y";
110       case kPtRatio:      return "PtRatio";
111       case kDipAngle:     return "DipAngle";
112       case kCosThetaStar: return "CosThetaStar";
113       case kAngleLeading: return "AngleToLeading";
114       default:            return "Undefined";
115    }
116 }
117
118 //_____________________________________________________________________________
119 Float_t AliRsnMiniValue::Eval(AliRsnMiniPair *pair, AliRsnMiniEvent *event)
120 {
121 //
122 // Evaluation of the required value.
123 // In this implementation, fills the member 4-vectors with data
124 // coming from the object passed as argument, and then returns the value
125 //
126
127    if (!pair && fType > kEventCuts) {
128       AliError("Null pair passed!");
129       return 1E20;
130    }
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          // ---- event values -------------------------------------------------------------------------
139       case kVz:
140          return event->Vz();
141       case kMult:
142          return event->Mult();
143       case kPlaneAngle:
144          return event->Angle();
145       case kLeadingPt:
146          return 0.0;
147          // ---- pair values --------------------------------------------------------------------------
148       case kPt:
149          return pair->Pt(fUseMCInfo);
150       case kInvMass:
151          return pair->InvMass(fUseMCInfo);
152       case kEta:
153          return pair->Eta(fUseMCInfo);
154       case kInvMassRes:
155          return pair->InvMassRes();
156       case kInvMassDiff:
157          return pair->InvMassDiff();
158       case kMt:
159          return pair->Mt(fUseMCInfo);
160       case kY:
161          return pair->Y(fUseMCInfo);
162       case kPtRatio:
163          return pair->PtRatio(fUseMCInfo);
164       case kDipAngle:
165          return pair->DipAngle(fUseMCInfo);
166       case kCosThetaStar:
167          return pair->CosThetaStar(fUseMCInfo);
168       case kAngleLeading:
169          AliWarning("This method is not yet implemented");
170          return 1E20;
171       default:
172          AliError("Invalid value type");
173          return 1E20;
174    }
175 }