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