CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LoadEPDB.h
Go to the documentation of this file.
1 #ifndef RecoHI_HiEvtPlaneAlgos_LoadEPDB_h
2 #define RecoHI_HiEvtPlaneAlgos_LoadEPDB_h
3 
4 // system include files
5 #include <memory>
6 #include <iostream>
7 #include <string>
8 
9 // user include files
12 
15 
17 
20 
24 #include <vector>
25 
26 //using namespace hi;
27 
28 class LoadEPDB {
29  public:
30 
31  explicit LoadEPDB(const edm::ESHandle<RPFlatParams> flatparmsDB_, HiEvtPlaneFlatten ** flat)
32  {
33  int Hbins;
34  int Obins;
35  int flatTableSize = flatparmsDB_->m_table.size();
36  genFlatPsi_ = kTRUE;
37  if(flatTableSize<flat[0]->getHBins()+2*flat[0]->getOBins()) {
38  genFlatPsi_ = kFALSE;
39  } else {
40  Hbins = flat[0]->getHBins();
41  Obins = flat[0]->getOBins();
42 
43  for(int i = 0; i<flatTableSize; i++) {
44  const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[i]);
45  for(int j = 0; j<hi::NumEPNames; j++) {
46  int indx = thisBin->RPNameIndx[j];
47  if(indx<0||indx>=hi::NumEPNames) {
48  genFlatPsi_ = kFALSE;
49  break;
50  }
51  if(indx>=0) {
52  if(i<Hbins) {
53  flat[indx]->setXDB(i, thisBin->x[j]);
54  flat[indx]->setYDB(i, thisBin->y[j]);
55  } else if(i>=Hbins && i<Hbins+Obins) {
56  flat[indx]->setXoffDB(i - Hbins, thisBin->x[j]);
57  flat[indx]->setYoffDB(i - Hbins, thisBin->y[j]);
58 
59  } else if (i>=Hbins+Obins && i<Hbins+2*Obins) {
60  flat[indx]->setPtDB(i - Hbins- Obins, thisBin->x[j]);
61  flat[indx]->setPt2DB(i - Hbins- Obins, thisBin->y[j]);
62  }
63  }
64  }
65  }
66  int cbins = 0;
67  while(flatTableSize>Hbins + 2*Obins + cbins) {
68  const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[Hbins+2*Obins +cbins]);
69  double centbinning = thisBin->x[0];
70  int ncentbins = (int) thisBin->y[0]+0.01;
71  if(ncentbins==0) break;
72  for(int j = 0; j< ncentbins; j++) {
73  const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[Hbins+2*Obins +cbins+j+1]);
74  if(fabs(centbinning-1.)<0.01) {
75  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes1(j,thisBin->x[i],thisBin->y[i]);
76  }
77  if(fabs(centbinning-2.)<0.01) {
78  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes2(j,thisBin->x[i],thisBin->y[i]);
79  }
80  if(fabs(centbinning-5.)<0.01) {
81  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes5(j,thisBin->x[i],thisBin->y[i]);
82  }
83  if(fabs(centbinning-10.)<0.01) {
84  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes10(j,thisBin->x[i],thisBin->y[i]);
85  }
86  if(fabs(centbinning-20.)<0.01) {
87  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes20(j,thisBin->x[i],thisBin->y[i]);
88  }
89  if(fabs(centbinning-25.)<0.01) {
90  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes25(j,thisBin->x[i],thisBin->y[i]);
91  }
92  if(fabs(centbinning-30.)<0.01) {
93  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes30(j,thisBin->x[i],thisBin->y[i]);
94  }
95  if(fabs(centbinning-40.)<0.01) {
96  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes40(j,thisBin->x[i],thisBin->y[i]);
97  }
98  }
99 
100  cbins+=ncentbins+1;
101  }
102 
103  }
104 
105  }
106 
107  bool IsSuccess(){return genFlatPsi_;}
109 
110  private:
112 
113 };
114 
115 #endif
int i
Definition: DBlmapReader.cc:9
void setXoffDB(unsigned int indx, double val)
void setXDB(unsigned int indx, double val)
~LoadEPDB()
Definition: LoadEPDB.h:108
bool IsSuccess()
Definition: LoadEPDB.h:107
void setYDB(unsigned int indx, double val)
bool genFlatPsi_
Definition: LoadEPDB.h:111
void setYoffDB(unsigned int indx, double val)
void setPt2DB(unsigned int indx, double val)
LoadEPDB(const edm::ESHandle< RPFlatParams > flatparmsDB_, HiEvtPlaneFlatten **flat)
Definition: LoadEPDB.h:31
int j
Definition: DBlmapReader.cc:9
int RPNameIndx[50]
Definition: RPFlatParams.h:16
void setPtDB(unsigned int indx, double val)
static const int NumEPNames