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 {
20 public:
21 
23 
24  void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override;
25  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {}
26  void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
27 private:
28  void putOne ( const GeometricDetExtra& gde, PGeometricDetExtra* pgde );
29 };
30 
31 void
33 {
36  if( !mydbservice.isAvailable() ){
37  edm::LogError("PGeometricDetExtraBuilder")<<"PoolDBOutputService unavailable";
38  return;
39  }
42  es.get<IdealGeometryRecord>().get( cpvH );
43  es.get<IdealGeometryRecord>().get( gdeH );
44  const std::vector<GeometricDetExtra>& gdes = (*gdeH);
45 
46  std::vector<GeometricDetExtra>::const_iterator git = gdes.begin();
47  std::vector<GeometricDetExtra>::const_iterator egit = gdes.end();
48 
49  for (; git!= egit; ++git) { // one level below "tracker"
50  putOne(*git, pgde);
51  }
52  if ( mydbservice->isNewTagRequest("PGeometricDetExtraRcd") ) {
53  mydbservice->createNewIOV<PGeometricDetExtra>( pgde,mydbservice->beginOfTime(),mydbservice->endOfTime(),"PGeometricDetExtraRcd");
54  } else {
55  edm::LogError("PGeometricDetExtraBuilder")<<"PGeometricDetExtra and PGeometricDetExtraRcd Tag already present";
56  }
57 }
58 
61  item._geographicalId = gde.geographicalId();
62  item._volume = gde.volume();
63  item._density = gde.density();
64  item._weight = gde.weight();
65  item._copy = gde.copyno();
66  item._material = gde.material();
67  pgde->pgdes_.push_back ( item );
68 }
69 
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
PGeometricDetExtraBuilder(const edm::ParameterSet &)
std::string const & material() const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< Item > pgdes_
double weight() const
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:230
void putOne(const GeometricDetExtra &gde, PGeometricDetExtra *pgde)
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:46
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
const T & get() const
Definition: EventSetup.h:59
double volume() const
Definition: Run.h:43