CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HiEvtPlaneFlatten.h
Go to the documentation of this file.
1 #ifndef __HiEvtPlaneFlatten__
2 #define __HiEvtPlaneFlatten__
3 // -*- C++ -*-
4 //
5 // Package: HiEvtPlaneFlatten
6 // Class: HiEvtPlaneFlatten
7 //
8 
9 //
10 //
11 // Original Author: Stephen Sanders
12 // Created: Mon Jun 7 14:40:12 EDT 2010
13 // $Id: HiEvtPlaneFlatten.h,v 1.5 2012/02/15 10:33:36 eulisse Exp $
14 //
15 //
16 
17 // system include files
18 #include <memory>
19 #include <iostream>
20 #include <string>
21 
22 // user include files
25 
28 
30 
33 
35 
36 #include "TMath.h"
37 #include <vector>
38 
39 #define MAXCUT 5000
40 
41 //
42 // class declaration
43 //
44 
46 public:
47 
48  explicit HiEvtPlaneFlatten()
49  {
50  pi = TMath::Pi();
51  hcentbins = 1;
52  hOrder = 20;
53  vorder = 2; //sets order of event plane
54  minvtx = -25;
55  delvtx = 5;
56  nvtxbins = 10;
57  }
58  void Init(int order, int ncentbins,const int centbinCompression, std::string tag, int vord)
59  {
60  hOrder = order; //order of flattening
61  vorder = vord; //1(v1), 2(v2), 3(v3), 4(v4)
62  hcentbins = ncentbins;
63  centbinComp = centbinCompression;
64  if(hcentbins<=0) hcentbins = 1;
66  if(hbins>MAXCUT) {
67  std::cout<<"Too many cuts for flattening calculation. RESET to deaults"<<std::endl;
68  hcentbins = 1;
69  hOrder = 21;
70  }
71  for(int i = 0; i<hbins; i++) {
72  flatX[i]=0;
73  flatY[i]=0;
74  flatCnt[i]=0;
75  }
76  }
77 
78  int GetCutIndx(int centbin, double vtx, int iord)
79  {
80  int cut;
81  int icent = centbin/centbinComp;
82  if(icent < 0 || icent > hcentbins) return -1;
83  int ivtx = (vtx-minvtx)/delvtx;
84  if(ivtx < 0 || ivtx > nvtxbins) return -1;
85  cut = hOrder*nvtxbins*icent + hOrder*ivtx + iord;
86  if(cut<0 || cut>hbins) return -1;
87  return cut;
88  }
89 
90  void Fill(double psi, double vtx, int centbin)
91  {
92  if(fabs(psi)>4 ) return;
93  for(int k = 0; k<hOrder; k++) {
94  double fsin = sin(vorder*(k+1)*psi);
95  double fcos = cos(vorder*(k+1)*psi);
96  int indx = GetCutIndx(centbin,vtx,k);
97  if(indx>=0) {
98  flatX[indx]+=fcos;
99  flatY[indx]+=fsin;
100  ++flatCnt[indx];
101  }
102  }
103  }
104 
105  double GetFlatPsi(double psi, double vtx, double cent)
106  {
107  double correction = 0;
108  for(int k = 0; k<hOrder; k++) {
109  int indx = GetCutIndx(cent,vtx,k);
110  correction+=(2./(double)((k+1)*vorder))*(flatXDB[indx]*sin(vorder*(k+1)*psi)-flatYDB[indx]*cos(vorder*(k+1)*psi));
111  }
112  psi+=correction;
113  psi=bounds(psi);
114  psi=bounds2(psi);
115  return psi;
116  }
117 
119  int GetHBins(){return hbins;}
120  double GetX(int bin){return flatX[bin];}
121  double GetY(int bin){return flatY[bin];}
122  double GetCnt(int bin) {return flatCnt[bin];}
123  void SetXDB(int indx, double val) {flatXDB[indx]=val;}
124  void SetYDB(int indx, double val) {flatYDB[indx]=val;}
125  Double_t bounds(Double_t ang) {
126  if(ang<-pi) ang+=2.*pi;
127  if(ang>pi) ang-=2.*pi;
128  return ang;
129  }
130  Double_t bounds2(Double_t ang) {
131  double range = pi/(double) vorder;
132  if(ang<-range) ang+=2*range;
133  if(ang>range) ang-=2*range;
134  return ang;
135  }
136 private:
137  double flatX[MAXCUT];
138  double flatY[MAXCUT];
139  double flatXDB[MAXCUT];
140  double flatYDB[MAXCUT];
141  double flatCnt[MAXCUT];
142  int hOrder; //flattening order
143  int hcentbins; //# of centrality bins
145  int hbins;
146  int vorder; //order of flattened event plane
147  double pi;
148 
149  int nvtxbins;
150  double minvtx;
151  double delvtx;
152 
153 };
154 
155 
156 
157 #endif
const double Pi
int i
Definition: DBlmapReader.cc:9
double GetX(int bin)
double GetFlatPsi(double psi, double vtx, double cent)
Double_t bounds2(Double_t ang)
void Init(int order, int ncentbins, const int centbinCompression, std::string tag, int vord)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double GetCnt(int bin)
int GetCutIndx(int centbin, double vtx, int iord)
std::map< std::string, int, std::less< std::string > > psi
void SetXDB(int indx, double val)
double GetY(int bin)
void SetYDB(int indx, double val)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int k[5][pyjets_maxn]
Double_t bounds(Double_t ang)
void Fill(double psi, double vtx, int centbin)
tuple cout
Definition: gather_cfg.py:121
#define MAXCUT