StRefMultCorr.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. //------------------------------------------------------------------------------
  2. // $Id$
  3. // $Log$
  4. // Revision 1.9 2015/05/22 06:52:07 hmasui
  5. // Add grefmult for Run14 Au+Au 200 GeV
  6. //
  7. // Revision 1.8 2013/05/10 18:33:33 hmasui
  8. // Add TOF tray mult, preliminary update for Run12 U+U
  9. //
  10. // Revision 1.7 2012/05/08 03:19:51 hmasui
  11. // Move parameters to Centrality_def_refmult.txt
  12. //
  13. // Revision 1.6 2012/04/23 21:29:33 hmasui
  14. // Added isBadRun() function for outlier rejection, getBeginRun() and getEndRun() to obtain the run range for a given (energy,year)
  15. //
  16. // Revision 1.5 2011/11/08 19:11:03 hmasui
  17. // Add luminosity corrections for 200 GeV
  18. //
  19. // Revision 1.4 2011/10/11 19:35:18 hmasui
  20. // Fix typo. Add z-vertex check in getWeight() function
  21. //
  22. // Revision 1.3 2011/10/10 21:30:34 hmasui
  23. // Replaced hard coded parameters for z-vertex and weight corrections by input parameters from text file
  24. //
  25. // Revision 1.2 2011/08/12 20:28:04 hmasui
  26. // Avoid varying corrected refmult in the same event by random number
  27. //
  28. // Revision 1.1 2011/08/11 18:38:36 hmasui
  29. // First version of Refmult correction class
  30. //
  31. //------------------------------------------------------------------------------
  32. // StRefMultCorr class
  33. // - Provide centrality bins based on multiplicity (refmult, refmult2, tof tray mulitplicity etc)
  34. // * 5% increment centrality bins (16 bins)
  35. // * 5% increment in 0-10%, and 10% increment in 10-80% (9 bins)
  36. // - Provide corrected multiplicity (z-vertex dependence)
  37. // - Provide "re-weighting" correction, only relevant to the peripheral bins
  38. //
  39. // Centrality binning:
  40. // Bin Centrality (16) Centrality (9)
  41. // 0 75-80% 70-80%
  42. // 1 70-75% 60-70%
  43. // 2 65-70% 50-60%
  44. // 3 60-65% 40-50%
  45. // 4 55-60% 30-40%
  46. // 5 50-55% 20-30%
  47. // 6 45-50% 10-20%
  48. // 7 40-45% 5-10%
  49. // 8 35-40% 0- 5%
  50. // 9 30-35%
  51. // 10 25-30%
  52. // 11 20-25%
  53. // 12 15-20%
  54. // 13 10-15%
  55. // 14 5-10%
  56. // 15 0- 5%
  57. //
  58. // See how to use this class in StRefMultCorr/macros/getCentralityBins.C
  59. //
  60. // authors: Alexander Schmah, Hiroshi Masui
  61. //------------------------------------------------------------------------------
  62. #ifndef __StRefMultCorr_h__
  63. #define __StRefMultCorr_h__
  64. #include <vector>
  65. #include <map>
  66. #include "TString.h"
  67. //______________________________________________________________________________
  68. // Class to correct z-vertex dependence, luminosity dependence of multiplicity
  69. class StRefMultCorr {
  70. public:
  71. // Specify the type of multiplicity (default is refmult)
  72. // "refmult" - reference multiplicity defined in |eta|<0.5
  73. // "refmult2" - reference multiplicity defined in 0.5<|eta|<1.0
  74. // "refmult3" - reference multiplicity defined in |eta|<0.5 without protons
  75. // "toftray" - TOF tray multiplicity
  76. // "grefmult" - global reference multiplicity defined in |eta|<0.5,dca<3,nHitsFit>10
  77. StRefMultCorr(const TString name="refmult");
  78. virtual ~StRefMultCorr(); /// Default destructor
  79. // Bad run rejection
  80. Bool_t isBadRun(const Int_t RunId) ;
  81. // Event-by-event initialization. Call this function event-by-event
  82. // * Default ZDC coincidence rate = 0 to make the function backward compatible
  83. // --> i.e. no correction will be applied unless users set the values for 200 GeV
  84. void initEvent(const UShort_t RefMult, const Double_t z,
  85. const Double_t zdcCoincidenceRate=0.0) ; // Set multiplicity, vz and zdc coincidence rate
  86. /// Get corrected multiplicity, correction as a function of primary z-vertex
  87. Double_t getRefMultCorr() const;
  88. // Corrected multiplity
  89. // flag=0: Luminosity only
  90. // flag=1: z-vertex only
  91. // flag=2: full correction (default)
  92. Double_t getRefMultCorr(const UShort_t RefMult, const Double_t z,
  93. const Double_t zdcCoincidenceRate, const UInt_t flag=2) const ;
  94. /// Get 16 centrality bins (5% increment, 0-5, 5-10, ..., 75-80)
  95. Int_t getCentralityBin16() const;
  96. /// Get 9 centrality bins (10% increment except for 0-5 and 5-10)
  97. Int_t getCentralityBin9() const;
  98. /// Re-weighting correction, correction is only applied up to mNormalize_step (energy dependent)
  99. Double_t getWeight() const;
  100. // Initialization of centrality bins etc
  101. void init(const Int_t RunId);
  102. // Read scale factor from text file
  103. void setVzForWeight(const Int_t nbin, const Double_t min, const Double_t max) ;
  104. void readScaleForWeight(const Char_t* input) ;
  105. // Return begin/end run from energy and year
  106. Int_t getBeginRun(const Double_t energy, const Int_t year) ;
  107. Int_t getEndRun(const Double_t energy, const Int_t year) ;
  108. // Print all parameters
  109. void print(const Option_t* option="") const ;
  110. private:
  111. const TString mName ; // refmult, refmult2, refmult3 or toftray (case insensitive)
  112. // Functions
  113. void read() ; /// Read input parameters from text file StRoot/StRefMultCorr/Centrality_def.txt
  114. void readBadRuns() ; /// Read bad run numbers
  115. void clear() ; /// Clear all arrays
  116. Bool_t isIndexOk() const ; /// 0 <= mParameterIndex < maxArraySize
  117. Bool_t isZvertexOk() const ; /// mStart_zvertex < z < mStop_zvertex
  118. Bool_t isRefMultOk() const ; /// 0-80%, (corrected multiplicity) > mCentrality_bins[0]
  119. Bool_t isCentralityOk(const Int_t icent) const ; /// centrality bin check
  120. Int_t setParameterIndex(const Int_t RunId) ; /// Parameter index from run id (return mParameterIndex)
  121. // Special scale factor for Run14 to take into account the weight
  122. // between different triggers
  123. // - return 1 for all the other runs
  124. Double_t getScaleForWeight() const ;
  125. // Get table name based on the input multiplicity definition
  126. const Char_t* getTable() const ;
  127. // Data members
  128. enum {
  129. mNCentrality = 16, /// 16 centrality bins, starting from 75-80% with 5% bin width
  130. mNPar_z_vertex = 8,
  131. mNPar_weight = 8,
  132. mNPar_luminosity = 2
  133. };
  134. // Use these variables to avoid varying the corrected multiplicity
  135. // in the same event by random numbers
  136. UShort_t mRefMult ; /// Current multiplicity
  137. Double_t mVz ; /// Current primary z-vertex
  138. Double_t mZdcCoincidenceRate ; /// Current ZDC coincidence rate
  139. Double_t mRefMult_corr; /// Corrected refmult
  140. std::vector<Int_t> mYear ; /// Year
  141. std::vector<Int_t> mStart_runId ; /// Start run id
  142. std::vector<Int_t> mStop_runId ; /// Stop run id
  143. std::vector<Double_t> mStart_zvertex ; /// Start z-vertex (cm)
  144. std::vector<Double_t> mStop_zvertex ; /// Stop z-vertex (cm)
  145. std::vector<Double_t> mNormalize_stop ; /// Normalization between MC and data (normalized in refmult>mNormalize_stop)
  146. std::vector<Int_t> mCentrality_bins[mNCentrality+1] ; /// Centrality bins (last value is set to 5000)
  147. std::vector<Double_t> mPar_z_vertex[mNPar_z_vertex] ; /// parameters for z-vertex correction
  148. std::vector<Double_t> mPar_weight[mNPar_weight] ; /// parameters for weight correction
  149. std::vector<Double_t> mPar_luminosity[mNPar_luminosity] ; /// parameters for luminosity correction (valid only for 200 GeV)
  150. Int_t mParameterIndex; /// Index of correction parameters
  151. std::multimap<std::pair<Double_t, Int_t>, Int_t> mBeginRun ; /// Begin run number for a given (energy, year)
  152. std::multimap<std::pair<Double_t, Int_t>, Int_t> mEndRun ; /// End run number for a given (energy, year)
  153. std::vector<Int_t> mBadRun ; /// Bad run number list
  154. // [6][680];
  155. Int_t mnVzBinForWeight ; /// vz bin size for scale factor
  156. std::vector<Double_t> mVzEdgeForWeight ; /// vz edge value
  157. std::vector<Double_t> mgRefMultTriggerCorrDiffVzScaleRatio ; /// Scale factor for global refmult
  158. ClassDef(StRefMultCorr, 0)
  159. };
  160. #endif