ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/CmsHi/Utilities/macros/Centrality.h
Revision: 1.1
Committed: Sat Jun 27 07:02:03 2009 UTC (15 years, 10 months ago) by yilmaz
Content type: text/plain
Branch: MAIN
CVS Tags: V00-01-02, V00-01-01, V00-01-00, HEAD
Log Message:
macro for centrality

File Contents

# Content
1 #include <iostream>
2 #include <vector>
3
4 #define MAXCENTRALITYBINS 40
5
6 //Root macro for using centrality bins in analysis in root.
7
8 namespace CmsHi{
9
10 static double hf[MAXCENTRALITYBINS] = {-0.5, 91.2201, 190.066, 289.348, 429.714, 610.668, 769.197, 1003.86, 1295.14, 1714.93, 2019.53, 2580.84, 3110.32, 3851.92, 4842.85, 5763.9, 7031.81, 8352.1, 9838.89, 12019.2, 14406.3, 16375.5, 19378.5, 23245.1, 25952.2, 28804.9, 33745.5, 37747, 42576, 46784.8, 52114.6, 57125.6, 64232.7, 72537.2, 82239.3, 89429.5, 99463.8, 109535, 120721, 136768}; // For 3_1_X. Used 2000 events.
11
12 //static double hf[MAXCENTRALITYBINS] = { -3.79397, 41.8848, 100.592, 164.598, 245.863, 332.547, 425.167, 541.657, 686.035, 883.485, 1100.38, 1353.79, 1674.68, 2111.32, 2626.57, 3204.19, 3882.45, 4705.5, 5618.47, 6718.37, 7847.97, 9183.42, 10710.5, 12352, 14111.4, 15915.1, 18050.8, 20267.3, 22969.3, 25847.9, 29106.6, 32622.2, 36850.7, 41185, 46138.2, 51728.2, 57773.7, 66330.7, 76926.8, 88238.4}; // For 2_2_X. Used 14373 events.
13
14
15 /*
16 static double hfgen[MAXCENTRALITYBINS] = {};
17 static double npart[MAXCENTRALITYBINS] = {};
18 static double b[MAXCENTRALITYBINS] = {};
19 */
20
21 class Centrality{
22 public:
23
24 Centrality(const char* label, int nbins) : label_(label), nbins_(nbins){
25
26 bins_.reserve(nbins_);
27
28 for(int i = 0; i < nbins_; ++i){
29 if(label_ == "hf")
30 bins_[i] = hf[i*(int)(MAXCENTRALITYBINS/nbins_)];
31 }
32 }
33
34 ~Centrality() {;}
35
36 double getNpart() {return 0;}
37 double getNcoll() {return 0;}
38 double getNhard(){return 0;}
39 double getB(){return 0;}
40
41 int getBin(double value);
42 void info();
43
44 private:
45 const char* label_;
46 vector<double> bins_;
47 int nbins_;
48
49 };
50
51 int Centrality::getBin(double value){
52
53 int bin = -9;
54 int ibin = -9;
55
56 for(int i = 0; i< nbins_; i++){
57 double min = bins_[i];
58
59 if(value >= min) ibin = i;
60 // if(value < min ) break;
61 }
62
63 if(label_ == "b")bin = ibin+1;
64 else bin = nbins_ - ibin;
65
66 if(ibin < 0) cout<<"Warning : Bin not determined correctly - "<<bin<<endl;
67
68 return bin;
69 }
70
71 void Centrality::info(){
72 std::cout<<"Centrality is based on "<<label_<<std::endl;
73 }
74
75
76 }