CMS 3D CMS Logo

EcalTBGeometryBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EcalTBGeometryBuilder
4 // Class: EcalTBGeometryBuilder
5 //
13 //
14 // Original Author: Jeremiah Mans
15 // Created: Mon Oct 3 11:35:27 CDT 2005
16 //
17 //
18 
19 // user include files
23 
24 //
25 // constructors and destructor
26 //
28  //the following line is needed to tell the framework what
29  // data is being produced
30  auto cc = setWhatProduced(this);
31 
32  barrelToken_ = cc.consumes<CaloSubdetectorGeometry>(edm::ESInputTag{"", "EcalBarrel"});
33  hodoscopeToken_ = cc.consumes<CaloSubdetectorGeometry>(edm::ESInputTag{"", "EcalLaserPnDiode"});
34 
35  //now do what ever other initialization is needed
36 }
37 
39 
40 //
41 // member functions
42 //
43 
44 // ------------ method called to produce the data ------------
46  auto pCaloGeom = std::make_unique<CaloGeometry>();
47 
48  // TODO: Look for ECAL parts
49  if (auto pG = iRecord.getHandle(barrelToken_)) {
50  pCaloGeom->setSubdetGeometry(DetId::Ecal, EcalBarrel, pG.product());
51  } else {
52  edm::LogWarning("MissingInput") << "No Ecal Barrel Geometry found";
53  }
54  if (auto pG = iRecord.getHandle(hodoscopeToken_)) {
55  pCaloGeom->setSubdetGeometry(DetId::Ecal, EcalLaserPnDiode, pG.product());
56  } else {
57  edm::LogWarning("MissingInput") << "No Ecal TB Hodoscope Geometry found";
58  }
59 
60  return pCaloGeom;
61 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ESGetToken< CaloSubdetectorGeometry, IdealGeometryRecord > barrelToken_
std::unique_ptr< CaloGeometry > ReturnType
EcalTBGeometryBuilder(const edm::ParameterSet &)
ESHandle< ProductT > getHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
ReturnType produce(const IdealGeometryRecord &)
edm::ESGetToken< CaloSubdetectorGeometry, IdealGeometryRecord > hodoscopeToken_
Log< level::Warning, false > LogWarning