CMS 3D CMS Logo

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
11 
14 
17 
19 
22 
26 #include <vector>
27 
28 //using namespace hi;
29 
30 class LoadEPDB {
31  public:
32 
33  explicit LoadEPDB(const edm::ESHandle<RPFlatParams> flatparmsDB_, HiEvtPlaneFlatten ** flat)
34  {
35  int Hbins;
36  int Obins;
37  int flatTableSize = flatparmsDB_->m_table.size();
38  genFlatPsi_ = kTRUE;
39  if(flatTableSize<flat[0]->getHBins()+2*flat[0]->getOBins()) {
40  genFlatPsi_ = kFALSE;
41  } else {
42  Hbins = flat[0]->getHBins();
43  Obins = flat[0]->getOBins();
44 
45  for(int i = 0; i<flatTableSize; i++) {
46  const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[i]);
47  for(int j = 0; j<hi::NumEPNames; j++) {
48  int indx = thisBin->RPNameIndx[j];
49  if(indx<0||indx>=hi::NumEPNames) {
50  genFlatPsi_ = kFALSE;
51  break;
52  }
53  if(indx>=0) {
54  if(i<Hbins) {
55  flat[indx]->setXDB(i, thisBin->x[j]);
56  flat[indx]->setYDB(i, thisBin->y[j]);
57  } else if(i>=Hbins && i<Hbins+Obins) {
58  flat[indx]->setXoffDB(i - Hbins, thisBin->x[j]);
59  flat[indx]->setYoffDB(i - Hbins, thisBin->y[j]);
60 
61  } else if (i>=Hbins+Obins && i<Hbins+2*Obins) {
62  flat[indx]->setPtDB(i - Hbins- Obins, thisBin->x[j]);
63  flat[indx]->setPt2DB(i - Hbins- Obins, thisBin->y[j]);
64  }
65  }
66  }
67  }
68  int cbins = 0;
69  while(flatTableSize>Hbins + 2*Obins + cbins) {
70  const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[Hbins+2*Obins +cbins]);
71  double centbinning = thisBin->x[0];
72  int ncentbins = (int) thisBin->y[0]+0.01;
73  if(ncentbins==0) break;
74  for(int j = 0; j< ncentbins; j++) {
75  const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[Hbins+2*Obins +cbins+j+1]);
76  if(fabs(centbinning-1.)<0.01) {
77  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes1(j,thisBin->x[i],thisBin->y[i]);
78  }
79  if(fabs(centbinning-2.)<0.01) {
80  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes2(j,thisBin->x[i],thisBin->y[i]);
81  }
82  if(fabs(centbinning-5.)<0.01) {
83  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes5(j,thisBin->x[i],thisBin->y[i]);
84  }
85  if(fabs(centbinning-10.)<0.01) {
86  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes10(j,thisBin->x[i],thisBin->y[i]);
87  }
88  if(fabs(centbinning-20.)<0.01) {
89  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes20(j,thisBin->x[i],thisBin->y[i]);
90  }
91  if(fabs(centbinning-25.)<0.01) {
92  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes25(j,thisBin->x[i],thisBin->y[i]);
93  }
94  if(fabs(centbinning-30.)<0.01) {
95  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes30(j,thisBin->x[i],thisBin->y[i]);
96  }
97  if(fabs(centbinning-40.)<0.01) {
98  for(int i = 0; i<hi::NumEPNames; i++) flat[i]->setCentRes40(j,thisBin->x[i],thisBin->y[i]);
99  }
100  }
101 
102  cbins+=ncentbins+1;
103  }
104 
105  }
106 
107  }
108 
109  bool IsSuccess(){return genFlatPsi_;}
111 
112  private:
114 
115 };
116 
117 #endif
void setXoffDB(unsigned int indx, double val)
void setXDB(unsigned int indx, double val)
~LoadEPDB()
Definition: LoadEPDB.h:110
bool IsSuccess()
Definition: LoadEPDB.h:109
void setYDB(unsigned int indx, double val)
bool genFlatPsi_
Definition: LoadEPDB.h:113
void setYoffDB(unsigned int indx, double val)
std::vector< EP > m_table
Definition: RPFlatParams.h:22
void setPt2DB(unsigned int indx, double val)
LoadEPDB(const edm::ESHandle< RPFlatParams > flatparmsDB_, HiEvtPlaneFlatten **flat)
Definition: LoadEPDB.h:33
int RPNameIndx[50]
Definition: RPFlatParams.h:16
void setPtDB(unsigned int indx, double val)
static const int NumEPNames