StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StRefMultCorr.h
1 
30 #ifndef __StRefMultCorr_h__
31 #define __StRefMultCorr_h__
32 
33 // C++ headers
34 #include <vector>
35 #include <map>
36 
37 // ROOT headers
38 #include "Rtypes.h"
39 #include "TString.h"
40 #include "BadRun.h"
41 
42 //_________________
43 // Class to correct z-vertex dependence, luminosity dependence of multiplicity
45  public:
61  StRefMultCorr(const TString name="refmult", const TString subname="Def", const TString libname="Def");
63  virtual ~StRefMultCorr();
64 
66  Bool_t isBadRun(const Int_t RunId) ;
67 
68  // Event-by-event initialization. Call this function event-by-event
69  // * Default ZDC coincidence rate = 0 to make the function backward compatible
70  // --> i.e. no correction will be applied unless users set the values for 200 GeV
71  void initEvent(const UShort_t RefMult, const Double_t z, const Double_t zdcCoincidenceRate=0.0) ; // Set multiplicity, vz and zdc coincidence rate
72 
74  Bool_t isPileUpEvent(Double_t refmult, Double_t ntofmatch, Double_t vz=0.) const {
75  return !passnTofMatchRefmultCut(refmult, ntofmatch, vz);
76  }
78  Bool_t passnTofMatchRefmultCut(Double_t refmult, Double_t ntofmatch, Double_t vz=0.) const;
79 
81  Double_t getRefMultCorr() const;
82  // Corrected multiplity, flag=0: Luminosity only, flag=1: z-vertex only, flag=2: full correction (default)
83  Double_t getRefMultCorr(const UShort_t RefMult, const Double_t z,
84  const Double_t zdcCoincidenceRate, const UInt_t flag = 2) const;
85 
87  Double_t luminosityCorrection(Double_t zdcCoincidenceRate) const;
89  Double_t vzCorrection(Double_t z) const;
91  Double_t sampleRefMult(Int_t refMult) const;
93  Double_t getShapeWeight_SubVz2Center() const;
95  Double_t triggerWeight() const;
96 
98  Double_t getWeight() const;
99 
101  Int_t getCentralityBin16() const;
103  Int_t getCentralityBin9() const;
104 
106  void init(const Int_t RunId);
107 
108  // Read scale factor from text file
109  void setVzForWeight(const Int_t nbin, const Double_t min, const Double_t max) ;
110  void readScaleForWeight(const Char_t* input) ;
111 
113  Int_t getBeginRun(const Double_t energy, const Int_t year);
115  Int_t getEndRun( const Double_t energy, const Int_t year);
116 
118  void print(const Option_t* option="") const ;
119 
121  void setVerbose(const Bool_t& verbose) { mVerbose = verbose; }
122 
123  private:
125  const TString mName;
127  const TString mSubName;
129  const TString mLibName;
130 
131  // Functions
132 
134  void clear();
136  Bool_t isIndexOk() const;
138  Bool_t isZvertexOk() const;
140  Bool_t isRefMultOk() const;
142  Bool_t isCentralityOk(const Int_t icent) const;
144  Int_t setParameterIndex(const Int_t RunId);
146  Bool_t mIsZr;
147  Bool_t mIsRu;
148 
149  // Special scale factor for Run14 to take into account the weight
150  // between different triggers
151  // - return 1 for all the other runs
152  Double_t getScaleForWeight() const ;
153 
154  // Data members
155  enum
156  {
158  mNCentrality = 16,
160  mNPar_z_vertex = 8,
162  mNPar_weight = 8,
164  mNPar_luminosity = 2
165  };
166 
167  // Use these variables to avoid varying the corrected multiplicity
168  // in the same event by random numbers
169  UShort_t mRefMult ;
170  Double_t mVz ;
171  Double_t mZdcCoincidenceRate ;
172  Double_t mRefMult_corr;
173 
174  std::vector<Int_t> mYear ;
175  std::vector<Int_t> mStart_runId ;
176  std::vector<Int_t> mStop_runId ;
177  std::vector<Double_t> mStart_zvertex ;
178  std::vector<Double_t> mStop_zvertex ;
179  std::vector<Double_t> mNormalize_stop ;
180  std::vector<Int_t> mCentrality_bins[mNCentrality+1] ;
181  std::vector<Double_t> mPar_z_vertex[mNPar_z_vertex] ;
182  std::vector<Double_t> mPar_weight[mNPar_weight] ;
183  std::vector<Double_t> mPar_luminosity[mNPar_luminosity] ;
184  Int_t mParameterIndex;
185 
186  std::multimap<std::pair<Double_t, Int_t>, Int_t> mBeginRun ;
187  std::multimap<std::pair<Double_t, Int_t>, Int_t> mEndRun ;
188  std::vector<Int_t> mBadRun ;
189 
190  // [6][680];
191  Int_t mnVzBinForWeight ;
192  std::vector<Double_t> mVzEdgeForWeight ;
193  std::vector<Double_t> mgRefMultTriggerCorrDiffVzScaleRatio ;
194 
203  Short_t mRefX;
205  Bool_t mVerbose;
206 
209  const Int_t getRefX() const;
210 
211  const Int_t getNumberOfDatasets() const;
212  void readHeaderFile();
213  void readBadRunsFromHeaderFile();
214  Int_t getVzWindowForVzDepCentDef() const;
216  Int_t getCentralityBin9VzDep() const;
217  Int_t getCentralityBin16VzDep() const;
218  std::vector<std::string> StringSplit( const std::string str, const char sep ) const;
219 
220  // Read scale factor from header file
221  void readScaleForWeight(const Int_t nRefmultBin, const Double_t *weight);
222 
225  Double_t calcPileUpRefMult(Double_t ntofmatch, Double_t x0, Double_t x1,
226  Double_t x2, Double_t x3, Double_t x4) const;
228  Bool_t isInPileUpRefMultLimits(Double_t refMult, Double_t low, Double_t hi) const
229  { return ( low < refMult && refMult < hi); }
230 
231  ClassDef(StRefMultCorr, 0)
232 };
233 #endif
234 
Double_t luminosityCorrection(Double_t zdcCoincidenceRate) const
Luminosity correction factor.
Int_t getCentralityBin9() const
Get 9 centrality bins (10% increment except for 0-5 and 5-10)
Double_t getShapeWeight_SubVz2Center() const
Shape reweighting of refmult: ratio of refMult in each Vz bin to that in the center (|Vz|&lt;10cm) ...
Int_t getCentralityBin16() const
Get 16 centrality bins (5% increment, 0-5, 5-10, ..., 75-80)
Int_t getBeginRun(const Double_t energy, const Int_t year)
Return the first runId from energy and year.
Double_t sampleRefMult(Int_t refMult) const
Sample refMult -&gt; convert integer to double.
Double_t getRefMultCorr() const
Get corrected multiplicity, correction as a function of primary z-vertex.
void print(const Option_t *option="") const
Print all parameters.
Double_t getWeight() const
Total weighting factor: incorporates shape and trigger efficiency weights.
Bool_t isPileUpEvent(Double_t refmult, Double_t ntofmatch, Double_t vz=0.) const
Check if pile-up event.
Definition: StRefMultCorr.h:74
Double_t triggerWeight() const
Trigger efficiency: fit of the Glauber/Data.
Bool_t passnTofMatchRefmultCut(Double_t refmult, Double_t ntofmatch, Double_t vz=0.) const
Check if NOT pile-up event.
Double_t vzCorrection(Double_t z) const
Vz correction factor.
Bool_t isBadRun(const Int_t RunId)
Check if run is bad.
Int_t getEndRun(const Double_t energy, const Int_t year)
Return the last runId from energy and year.
StRefMultCorr(const TString name="refmult", const TString subname="Def", const TString libname="Def")
virtual ~StRefMultCorr()
Destructor.
void setVerbose(const Bool_t &verbose)
Print debug information.
void init(const Int_t RunId)
Initialization of centrality bins etc.