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 
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
PGeometricDetExtraBuilder(const edm::ParameterSet &)
std::string const & material() const
std::vector< Item > pgdes_
double weight() const
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void putOne(const GeometricDetExtra &gde, PGeometricDetExtra *pgde)
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:40
double density() const
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
DetId geographicalId() const
double volume() const
T get() const
Definition: EventSetup.h:73
Definition: Run.h:45