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  explicit LoadEPDB(const edm::ESHandle<RPFlatParams> flatparmsDB_, HiEvtPlaneFlatten** flat) {
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)
72  break;
73  for (int j = 0; j < ncentbins; j++) {
74  const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[Hbins + 2 * Obins + cbins + j + 1]);
75  if (fabs(centbinning - 1.) < 0.01) {
76  for (int i = 0; i < hi::NumEPNames; i++)
77  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++)
81  flat[i]->setCentRes2(j, thisBin->x[i], thisBin->y[i]);
82  }
83  if (fabs(centbinning - 5.) < 0.01) {
84  for (int i = 0; i < hi::NumEPNames; i++)
85  flat[i]->setCentRes5(j, thisBin->x[i], thisBin->y[i]);
86  }
87  if (fabs(centbinning - 10.) < 0.01) {
88  for (int i = 0; i < hi::NumEPNames; i++)
89  flat[i]->setCentRes10(j, thisBin->x[i], thisBin->y[i]);
90  }
91  if (fabs(centbinning - 20.) < 0.01) {
92  for (int i = 0; i < hi::NumEPNames; i++)
93  flat[i]->setCentRes20(j, thisBin->x[i], thisBin->y[i]);
94  }
95  if (fabs(centbinning - 25.) < 0.01) {
96  for (int i = 0; i < hi::NumEPNames; i++)
97  flat[i]->setCentRes25(j, thisBin->x[i], thisBin->y[i]);
98  }
99  if (fabs(centbinning - 30.) < 0.01) {
100  for (int i = 0; i < hi::NumEPNames; i++)
101  flat[i]->setCentRes30(j, thisBin->x[i], thisBin->y[i]);
102  }
103  if (fabs(centbinning - 40.) < 0.01) {
104  for (int i = 0; i < hi::NumEPNames; i++)
105  flat[i]->setCentRes40(j, thisBin->x[i], thisBin->y[i]);
106  }
107  }
108 
109  cbins += ncentbins + 1;
110  }
111  }
112  }
113 
114  bool IsSuccess() { return genFlatPsi_; }
116 
117 private:
119 };
120 
121 #endif
void setXoffDB(unsigned int indx, double val)
void setXDB(unsigned int indx, double val)
~LoadEPDB()
Definition: LoadEPDB.h:115
bool IsSuccess()
Definition: LoadEPDB.h:114
void setYDB(unsigned int indx, double val)
bool genFlatPsi_
Definition: LoadEPDB.h:118
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:32
int RPNameIndx[50]
Definition: RPFlatParams.h:16
void setPtDB(unsigned int indx, double val)
static const int NumEPNames