CMS 3D CMS Logo

PGeometricDetExtraBuilder.cc
Go to the documentation of this file.
16 #include <vector>
17 
18 class PGeometricDetExtraBuilder : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
19 public:
21 
22  void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override;
23  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {}
24  void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
25 
26 private:
27  void putOne(const GeometricDetExtra& gde, PGeometricDetExtra* pgde);
28 };
29 
33  if (!mydbservice.isAvailable()) {
34  edm::LogError("PGeometricDetExtraBuilder") << "PoolDBOutputService unavailable";
35  return;
36  }
39  es.get<IdealGeometryRecord>().get(cpvH);
40  es.get<IdealGeometryRecord>().get(gdeH);
41  const std::vector<GeometricDetExtra>& gdes = (*gdeH);
42 
43  std::vector<GeometricDetExtra>::const_iterator git = gdes.begin();
44  std::vector<GeometricDetExtra>::const_iterator egit = gdes.end();
45 
46  for (; git != egit; ++git) { // one level below "tracker"
47  putOne(*git, pgde);
48  }
49  if (mydbservice->isNewTagRequest("PGeometricDetExtraRcd")) {
50  mydbservice->createNewIOV<PGeometricDetExtra>(
51  pgde, mydbservice->beginOfTime(), mydbservice->endOfTime(), "PGeometricDetExtraRcd");
52  } else {
53  edm::LogError("PGeometricDetExtraBuilder") << "PGeometricDetExtra and PGeometricDetExtraRcd Tag already present";
54  }
55 }
56 
59  item._geographicalId = gde.geographicalId();
60  item._volume = gde.volume();
61  item._density = gde.density();
62  item._weight = gde.weight();
63  item._copy = gde.copyno();
64  item._material = gde.material();
65  pgde->pgdes_.push_back(item);
66 }
67 
EDAnalyzer.h
ESTransientHandle.h
MessageLogger.h
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:187
ESHandle.h
edm::Run
Definition: Run.h:45
PGeometricDetExtraBuilder::analyze
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
Definition: PGeometricDetExtraBuilder.cc:23
PGeometricDetExtra.h
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
DDCompactView.h
MakerMacros.h
PoolDBOutputService.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
PGeometricDetExtraBuilder::putOne
void putOne(const GeometricDetExtra &gde, PGeometricDetExtra *pgde)
Definition: PGeometricDetExtraBuilder.cc:57
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:110
Service.h
edm::ESHandle
Definition: DTSurvey.h:22
GeometricDetExtra::weight
double weight() const
Definition: GeometricDetExtra.h:53
GeometricDetExtra::volume
double volume() const
Definition: GeometricDetExtra.h:51
GeometricDetExtra::geographicalId
DetId geographicalId() const
Definition: GeometricDetExtra.h:48
PGeometricDetExtraBuilder::endRun
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition: PGeometricDetExtraBuilder.cc:24
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
Event.h
edm::Service< cond::service::PoolDBOutputService >
iEvent
int iEvent
Definition: GenABIO.cc:224
GeometricDetExtra
Definition: GeometricDetExtra.h:17
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
GeometricDetExtra.h
PGeometricDetExtra::Item
Definition: PGeometricDetExtra.h:14
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
PGeometricDetExtraBuilder
Definition: PGeometricDetExtraBuilder.cc:18
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:185
GeometricDetExtra::material
std::string const & material() const
Definition: GeometricDetExtra.h:54
PGeometricDetExtraBuilder::PGeometricDetExtraBuilder
PGeometricDetExtraBuilder(const edm::ParameterSet &)
Definition: PGeometricDetExtraBuilder.cc:20
PGeometricDetExtra
Definition: PGeometricDetExtra.h:9
EventSetup.h
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:100
PGeometricDetExtraBuilder::beginRun
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition: PGeometricDetExtraBuilder.cc:30
ParameterSet.h
PGeometricDetExtraRcd.h
GeometricDetExtra::density
double density() const
Definition: GeometricDetExtra.h:52
edm::Event
Definition: Event.h:73
GeometricDetExtra::copyno
int copyno() const
Definition: GeometricDetExtra.h:50
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27
PGeometricDetExtra::pgdes_
std::vector< Item > pgdes_
Definition: PGeometricDetExtra.h:27