StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StDedxPidTraits.cxx
1 /***************************************************************************
2  *
3  * $Id: StDedxPidTraits.cxx,v 2.17 2015/12/24 00:14:44 fisyak Exp $
4  *
5  * Author: Thomas Ullrich, Sep 1999
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StDedxPidTraits.cxx,v $
13  * Revision 2.17 2015/12/24 00:14:44 fisyak
14  * Add GMT and SST Id and new dE/dx method
15  *
16  * Revision 2.16 2012/04/29 22:51:18 fisyak
17  * Add field for Log2(<dX>)
18  *
19  * Revision 2.15 2010/08/31 19:51:56 fisyak
20  * Clean up
21  *
22  * Revision 2.14 2009/11/19 17:08:34 fisyak
23  * remove St_dst_dedx_Table
24  *
25  * Revision 2.13 2004/10/11 22:58:35 ullrich
26  * Changed order of initialization in constructor.
27  *
28  * Revision 2.12 2004/07/15 16:36:23 ullrich
29  * Removed all clone() declerations and definitions. Use StObject::clone() only.
30  *
31  * Revision 2.11 2004/03/01 17:44:37 fisyak
32  * Add Print method
33  *
34  * Revision 2.10 2003/04/30 18:05:55 fisyak
35  * Add P03ia flag, which fixes P03ia MuDst
36  *
37  * Revision 2.9 2001/04/05 04:00:47 ullrich
38  * Replaced all (U)Long_t by (U)Int_t and all redundant ROOT typedefs.
39  *
40  * Revision 2.8 2001/03/24 03:34:40 perev
41  * clone() -> clone() const
42  *
43  * Revision 2.7 2000/12/18 17:25:13 fisyak
44  * Add track length used in dE/dx calculations
45  *
46  * Revision 2.6 2000/01/05 16:04:11 ullrich
47  * Changed method name sigma() to errorOnMean().
48  *
49  * Revision 2.5 1999/11/29 17:07:24 ullrich
50  * Moved method() from StTrackPidTraits to StDedxPidTraits.cxx
51  *
52  * Revision 2.4 1999/11/23 15:56:23 ullrich
53  * Added clone() const method. Was pure virtual.
54  *
55  * Revision 2.3 1999/11/16 14:11:38 ullrich
56  * Changed variance to sigma.
57  *
58  * Revision 2.2 1999/10/28 22:25:01 ullrich
59  * Adapted new StArray version. First version to compile on Linux and Sun.
60  *
61  * Revision 2.1 1999/10/13 19:44:31 ullrich
62  * Initial Revision
63  *
64  **************************************************************************/
65 #include "StDedxPidTraits.h"
66 #include "StBichsel/Bichsel.h"
67 #include "TMath.h"
68 #include "Stiostream.h"
69 ClassImp(StDedxPidTraits)
70 
71 static const char rcsid[] = "$Id: StDedxPidTraits.cxx,v 2.17 2015/12/24 00:14:44 fisyak Exp $";
72 
73 Float_t StDedxPidTraits::mean() const {
74 #ifdef P03ia
75  static const Int_t N70 = 6;
76  static const Double_t T70[N70] = {
77  -1.55822e+01,
78  2.15621e+01,
79  -1.24423e+01,
80  3.68329e+00,
81  -5.50226e-01,
82  3.27863e-02
83  };
84  Float_t dEdx = mDedx;
85  if (method() == kTruncatedMeanId) {
86  Double_t x = TMath::Log(length());
87  Double_t Corr = T70[N70-1]; for (int i = N70-2; i >= 0; i--) Corr = Corr*x + T70[i];
88  dEdx *= TMath::Exp(-Corr);
89  }
90  return dEdx;
91 #else
92  return mDedx;
93 #endif
94 }
95 
96 float
97 StDedxPidTraits::errorOnMean() const {
98 #ifndef P03ia
99  return mSigma;
100 #else
101  static const Int_t N70 = 6;
102  static const Double_t T70[N70] = {
103  1.06856e+01,
104  -1.52626e+01,
105  8.62097e+00,
106  -2.37276e+00,
107  3.17727e-01,
108  -1.65739e-02,
109  };
110  Float_t Sigma;
111  if (method() == kTruncatedMeanId) {
112  Double_t x = TMath::Log(length());
113  Double_t Corr = T70[N70-1]; for (int i = N70-2; i >= 0; i--) Corr = Corr*x + T70[i];
114  Sigma = Corr;
115  return Sigma;
116  }
117  else return mSigma;
118 #endif
119 }
120 
121 short
122 StDedxPidTraits::encodedMethod() const { return mMethod; }
123 
124 StDedxMethod
125 StDedxPidTraits::method() const
126 {
127  switch (mMethod) {
128  case kTruncatedMeanId:
129  return kTruncatedMeanId;
130  break;
131  case kEnsembleTruncatedMeanId:
132  return kEnsembleTruncatedMeanId;
133  break;
134  case kLikelihoodFitId:
135  return kLikelihoodFitId;
136  break;
137  case kWeightedTruncatedMeanId:
138  return kWeightedTruncatedMeanId;
139  break;
140  case kOtherMethodId:
141  return kOtherMethodId;
142  break;
143  case kOtherMethodId2:
144  return kOtherMethodId2;
145  break;
146  default:
147  return kUndefinedMethodId;
148  break;
149  }
150 }
151 //________________________________________________________________________________
152 void StDedxPidTraits::Print(Option_t *opt) const {
153  cout << "StDedxPidTraits : \t method" << method()
154  << "\t encodedMethod : " << encodedMethod()
155  << "\t numberOfPoints : " << numberOfPoints()
156  << "\t length : " << length()
157  << "\t mean : " << mean()
158  << "\t errorOnMean : " << errorOnMean()
159  << "\t Log2<dX> : " << log2dX() << endl;
160 
161  }
162