CMS 3D CMS Logo

PHGCalParametersDBBuilder.cc
Go to the documentation of this file.
16 
17 //#define EDM_ML_DEBUG
18 
19 class PHGCalParametersDBBuilder : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
20 public:
22 
24 
25  void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override;
26  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {}
27  void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
28 
29 private:
31 
36 };
37 
39  name_ = iC.getParameter<std::string>("name");
40  name2_ = iC.getParameter<std::string>("name2");
41  namew_ = iC.getParameter<std::string>("nameW");
42  namec_ = iC.getParameter<std::string>("nameC");
43  namet_ = iC.getParameter<std::string>("nameT");
44  fromDD4hep_ = iC.getParameter<bool>("fromDD4hep");
45  dd4HepCompactViewToken_ = esConsumes<edm::Transition::BeginRun>();
46  compactViewToken_ = esConsumes<edm::Transition::BeginRun>();
47 
48 #ifdef EDM_ML_DEBUG
49  edm::LogVerbatim("HGCalGeom") << "HGCalParametersESModule for " << name_ << ":" << name2_ << ":" << namew_ << ":"
50  << namec_ << ":" << namet_ << " and fromDD4hep flag " << fromDD4hep_;
51 #endif
52 }
53 
56  desc.add<std::string>("name", "HGCalEESensitive");
57  desc.add<std::string>("name2", "HGCalEE");
58  desc.add<std::string>("nameW", "HGCalEEWafer");
59  desc.add<std::string>("nameC", "HGCalEECell");
60  desc.add<std::string>("nameT", "HGCal");
61  desc.add<bool>("fromDD4hep", false);
62  descriptions.add("HGCalEEParametersWriter", desc);
63 }
64 
66  PHGCalParameters phgp;
68  if (!mydbservice.isAvailable()) {
69  edm::LogError("PHGCalParametersDBBuilder") << "PoolDBOutputService unavailable";
70  return;
71  }
72 
74  HGCalParametersFromDD builder;
75  if (fromDD4hep_) {
76 #ifdef EDM_ML_DEBUG
77  edm::LogVerbatim("HGCalGeom") << "PHGCalParametersDBBuilder::Try to access cm::DDCompactView";
78 #endif
80  builder.build(cpv.product(), *ptp, name_, namew_, namec_, namet_, name2_);
81  } else {
82 #ifdef EDM_ML_DEBUG
83  edm::LogVerbatim("HGCalGeom") << "PHGCalParametersDBBuilder::Try to access DDCompactView";
84 #endif
86  builder.build(cpv.product(), *ptp, name_, namew_, namec_, namet_);
87  }
88  swapParameters(ptp, &phgp);
89  delete ptp;
90 
91  if (mydbservice->isNewTagRequest("PHGCalParametersRcd")) {
92  mydbservice->createOneIOV(phgp, mydbservice->beginOfTime(), "PHGCalParametersRcd");
93  } else {
94  edm::LogError("PHGCalParametersDBBuilder") << "PHGCalParameters and PHGCalParametersRcd Tag already present";
95  }
96 }
97 
99  phgp->name_ = ptp->name_;
100  phgp->cellSize_.swap(ptp->cellSize_);
101  phgp->moduleBlS_.swap(ptp->moduleBlS_);
102  phgp->moduleTlS_.swap(ptp->moduleTlS_);
103  phgp->moduleHS_.swap(ptp->moduleHS_);
104  phgp->moduleDzS_.swap(ptp->moduleDzS_);
105  phgp->moduleAlphaS_.swap(ptp->moduleAlphaS_);
106  phgp->moduleCellS_.swap(ptp->moduleCellS_);
107  phgp->moduleBlR_.swap(ptp->moduleBlR_);
108  phgp->moduleTlR_.swap(ptp->moduleTlR_);
109  phgp->moduleHR_.swap(ptp->moduleHR_);
110  phgp->moduleDzR_.swap(ptp->moduleDzR_);
111  phgp->moduleAlphaR_.swap(ptp->moduleAlphaR_);
112  phgp->moduleCellR_.swap(ptp->moduleCellR_);
113  phgp->trformTranX_.swap(ptp->trformTranX_);
114  phgp->trformTranY_.swap(ptp->trformTranY_);
115  phgp->trformTranZ_.swap(ptp->trformTranZ_);
116  phgp->trformRotXX_.swap(ptp->trformRotXX_);
117  phgp->trformRotYX_.swap(ptp->trformRotYX_);
118  phgp->trformRotZX_.swap(ptp->trformRotZX_);
119  phgp->trformRotXY_.swap(ptp->trformRotXY_);
120  phgp->trformRotYY_.swap(ptp->trformRotYY_);
121  phgp->trformRotZY_.swap(ptp->trformRotZY_);
122  phgp->trformRotXZ_.swap(ptp->trformRotXZ_);
123  phgp->trformRotYZ_.swap(ptp->trformRotYZ_);
124  phgp->trformRotZZ_.swap(ptp->trformRotZZ_);
125  phgp->zLayerHex_.swap(ptp->zLayerHex_);
126  phgp->rMinLayHex_.swap(ptp->rMinLayHex_);
127  phgp->rMaxLayHex_.swap(ptp->rMaxLayHex_);
128  phgp->waferPosX_.swap(ptp->waferPosX_);
129  phgp->waferPosY_.swap(ptp->waferPosY_);
130  phgp->cellFineX_.swap(ptp->cellFineX_);
131  phgp->cellFineY_.swap(ptp->cellFineY_);
132  phgp->cellCoarseX_.swap(ptp->cellCoarseX_);
133  phgp->cellCoarseY_.swap(ptp->cellCoarseY_);
134  phgp->boundR_.swap(ptp->boundR_);
135  phgp->moduleLayS_.swap(ptp->moduleLayS_);
136  phgp->moduleLayR_.swap(ptp->moduleLayR_);
137  phgp->layer_.swap(ptp->layer_);
138  phgp->layerIndex_.swap(ptp->layerIndex_);
139  phgp->layerGroup_.swap(ptp->layerGroup_);
140  phgp->cellFactor_.swap(ptp->cellFactor_);
141  phgp->depth_.swap(ptp->depth_);
142  phgp->depthIndex_.swap(ptp->depthIndex_);
143  phgp->depthLayerF_.swap(ptp->depthLayerF_);
144  phgp->waferCopy_.swap(ptp->waferCopy_);
145  phgp->waferTypeL_.swap(ptp->waferTypeL_);
146  phgp->waferTypeT_.swap(ptp->waferTypeT_);
147  phgp->layerGroupM_.swap(ptp->layerGroupM_);
148  phgp->layerGroupO_.swap(ptp->layerGroupO_);
149  phgp->trformIndex_.swap(ptp->trformIndex_);
150  phgp->slopeMin_.swap(ptp->slopeMin_);
151  phgp->waferR_ = ptp->waferR_;
152  phgp->nCells_ = ptp->nCells_;
153  phgp->nSectors_ = ptp->nSectors_;
154  phgp->mode_ = ptp->mode_;
155 }
156 
std::vector< double > waferPosY_
Log< level::Info, true > LogVerbatim
std::vector< int > layer_
std::vector< double > moduleDzR_
std::vector< int > depthLayerF_
std::vector< uint32_t > trformIndex_
std::vector< int > depthLayerF_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< int > depth_
edm::ESGetToken< DDCompactView, IdealGeometryRecord > compactViewToken_
std::vector< double > moduleCellR_
std::vector< double > moduleHR_
std::vector< int > waferTypeT_
std::vector< double > trformRotXX_
std::vector< double > trformRotYY_
std::vector< double > trformRotXY_
std::vector< int > layerGroupO_
std::vector< double > cellCoarseY_
std::vector< int > moduleLayS_
std::vector< int > moduleLayR_
std::vector< double > trformRotZZ_
std::vector< int > depth_
std::vector< double > trformRotYZ_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::vector< double > moduleHS_
std::vector< double > moduleTlR_
std::vector< double > trformTranY_
std::vector< int > waferTypeL_
std::vector< double > slopeMin_
std::vector< double > cellFineY_
std::vector< double > cellFineX_
static void fillDescriptions(edm::ConfigurationDescriptions &)
std::vector< double > trformRotZY_
Log< level::Error, false > LogError
bool build(const DDCompactView *cpv, HGCalParameters &php, const std::string &name, const std::string &namew, const std::string &namec, const std::string &namet)
std::vector< double > moduleAlphaS_
std::vector< uint32_t > trformIndex_
std::vector< int > layerGroupM_
HGCalGeometryMode::GeometryMode mode_
std::vector< double > waferPosY_
std::vector< int > cellFactor_
std::vector< double > trformRotXX_
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
std::vector< double > trformRotZX_
std::vector< double > trformRotYX_
std::vector< double > cellCoarseX_
std::vector< double > trformTranY_
std::vector< double > trformRotYZ_
int iEvent
Definition: GenABIO.cc:224
std::vector< double > trformRotZY_
std::vector< double > rMaxLayHex_
std::vector< double > boundR_
std::vector< int > layerGroup_
std::vector< double > cellSize_
std::vector< double > moduleAlphaR_
std::vector< double > moduleDzS_
bool isNewTagRequest(const std::string &recordName)
std::vector< int > layerIndex_
std::vector< double > moduleAlphaR_
std::vector< double > trformRotZX_
std::vector< double > waferPosX_
std::vector< int > layer_
std::vector< double > trformRotXY_
PHGCalParametersDBBuilder(const edm::ParameterSet &)
std::vector< double > trformRotYX_
std::vector< int > waferCopy_
std::vector< double > moduleDzS_
std::vector< int > moduleLayR_
std::vector< int > depthIndex_
std::vector< double > moduleBlR_
std::vector< int > layerIndex_
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
std::vector< double > rMinLayHex_
std::vector< double > moduleHS_
std::vector< double > moduleTlS_
std::vector< double > zLayerHex_
std::vector< double > rMaxLayHex_
std::vector< double > trformTranX_
std::vector< double > slopeMin_
std::vector< double > boundR_
std::vector< double > cellFineY_
std::vector< double > trformRotXZ_
std::vector< int > layerGroup_
std::vector< double > moduleCellR_
std::vector< double > moduleCellS_
std::vector< double > moduleHR_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< double > trformRotYY_
std::vector< double > cellFineX_
std::vector< int > layerGroupM_
std::vector< double > trformRotZZ_
std::vector< double > moduleTlS_
std::vector< double > moduleBlS_
std::vector< double > moduleAlphaS_
std::vector< int > layerGroupO_
std::vector< double > rMinLayHex_
std::vector< double > trformTranX_
std::vector< double > moduleBlS_
std::vector< int > cellFactor_
std::vector< int > waferCopy_
void swapParameters(HGCalParameters *, PHGCalParameters *)
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:162
std::vector< double > moduleCellS_
std::vector< int > depthIndex_
bool isAvailable() const
Definition: Service.h:40
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
std::vector< int > moduleLayS_
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
std::vector< double > trformTranZ_
std::vector< double > moduleBlR_
std::vector< double > cellCoarseX_
std::vector< double > trformTranZ_
std::vector< double > waferPosX_
std::vector< double > trformRotXZ_
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4HepCompactViewToken_
std::vector< double > moduleTlR_
std::vector< double > cellSize_
std::vector< int > waferTypeL_
std::vector< double > zLayerHex_
std::string name_
Definition: Run.h:45
std::vector< double > moduleDzR_