CMS 3D CMS Logo

HGCalTriggerGeometryESProducer.cc
Go to the documentation of this file.
1 
2 #include <memory>
3 
7 
9 
11 
13 public:
16 
17  typedef std::unique_ptr<HGCalTriggerGeometryBase> ReturnType;
18 
20 
21 private:
30 };
31 
33  : geometry_config_(iConfig.getParameterSet("TriggerGeometry")),
34  geometry_name_(geometry_config_.getParameter<std::string>("TriggerGeometryName")),
35  isV9Geometry_(iConfig.getParameter<bool>("isV9Geometry")) {
36  auto cc = setWhatProduced(this);
37  if (isV9Geometry_) {
38  cc.setConsumes(ee_geometry_token_, edm::ESInputTag{"", "HGCalEESensitive"})
39  .setConsumes(hsi_geometry_token_, edm::ESInputTag{"", "HGCalHESiliconSensitive"})
40  .setConsumes(hsc_geometry_token_, edm::ESInputTag{"", "HGCalHEScintillatorSensitive"})
41  .setConsumes(nose_geometry_token_, edm::ESInputTag{"", "HGCalHFNoseSensitive"});
42  } else {
43  cc.setConsumes(calo_geometry_token_);
44  }
45 }
46 
48  // do anything here that needs to be done at desctruction time
49  // (e.g. close files, deallocate resources etc.)
50 }
51 
53  // using namespace edm::es;
55  if (isV9Geometry_) {
56  // Initialize trigger geometry for V9 HGCAL geometry
57 
58  if (iRecord.getHandle(nose_geometry_token_)) {
59  geometry->setWithNoseGeometry(true);
60  geometry->initialize(&iRecord.get(ee_geometry_token_),
61  &iRecord.get(hsi_geometry_token_),
62  &iRecord.get(hsc_geometry_token_),
63  &iRecord.get(nose_geometry_token_));
64  } else {
65  geometry->initialize(
66  &iRecord.get(ee_geometry_token_), &iRecord.get(hsi_geometry_token_), &iRecord.get(hsc_geometry_token_));
67  }
68 
69  } else {
70  // Initialize trigger geometry for V7/V8 HGCAL geometry
71  const auto& calo_geometry = iRecord.get(calo_geometry_token_);
72  if (not(calo_geometry.getSubdetectorGeometry(DetId::Forward, HGCEE) &&
73  calo_geometry.getSubdetectorGeometry(DetId::Forward, HGCHEF) &&
74  calo_geometry.getSubdetectorGeometry(DetId::Hcal, HcalEndcap))) {
75  throw cms::Exception("LogicError")
76  << "Configuration asked for non-V9 geometry, but the CaloGeometry does not look like one";
77  }
78  geometry->initialize(&calo_geometry);
79  }
80  return geometry;
81 }
82 
83 // define this as a plug-in
geometry
ESHandle< TrackerGeometry > geometry
Definition: TkLasBeamFitter.cc:200
electrons_cff.bool
bool
Definition: electrons_cff.py:372
edm::ESInputTag
Definition: ESInputTag.h:87
edm::eventsetup::DependentRecordImplementation::getHandle
ESHandle< ProductT > getHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:86
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
geometry
Definition: geometry.py:1
DetId::Hcal
Definition: DetId.h:28
HGCalTriggerGeometryESProducer::produce
ReturnType produce(const CaloGeometryRecord &)
Definition: HGCalTriggerGeometryESProducer.cc:52
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
ESProducer.h
HGCalTriggerGeometryESProducer::calo_geometry_token_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > calo_geometry_token_
Definition: HGCalTriggerGeometryESProducer.cc:24
HGCalTriggerGeometryESProducer
Definition: HGCalTriggerGeometryESProducer.cc:12
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
HGCalTriggerGeometryESProducer::HGCalTriggerGeometryESProducer
HGCalTriggerGeometryESProducer(const edm::ParameterSet &)
Definition: HGCalTriggerGeometryESProducer.cc:32
HGCalTriggerGeometryESProducer::~HGCalTriggerGeometryESProducer
~HGCalTriggerGeometryESProducer() override
Definition: HGCalTriggerGeometryESProducer.cc:47
HGCalTriggerGeometryESProducer::geometry_config_
edm::ParameterSet geometry_config_
Definition: HGCalTriggerGeometryESProducer.cc:22
HGCalTriggerGeometryBase.h
HGCalTriggerGeometryESProducer::hsc_geometry_token_
edm::ESGetToken< HGCalGeometry, IdealGeometryRecord > hsc_geometry_token_
Definition: HGCalTriggerGeometryESProducer.cc:27
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:112
CaloGeometryRecord.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ESProducts.h
HGCalTriggerGeometryESProducer::ReturnType
std::unique_ptr< HGCalTriggerGeometryBase > ReturnType
Definition: HGCalTriggerGeometryESProducer.cc:17
HGCEE
Definition: ForwardSubdetector.h:8
edm::ParameterSet
Definition: ParameterSet.h:36
get
#define get
cc
edm::ESGetToken< CaloGeometry, CaloGeometryRecord >
HGCalTriggerGeometryESProducer::ee_geometry_token_
edm::ESGetToken< HGCalGeometry, IdealGeometryRecord > ee_geometry_token_
Definition: HGCalTriggerGeometryESProducer.cc:25
HGCalTriggerGeometryESProducer::hsi_geometry_token_
edm::ESGetToken< HGCalGeometry, IdealGeometryRecord > hsi_geometry_token_
Definition: HGCalTriggerGeometryESProducer.cc:26
HGCalTriggerGeometryESProducer::isV9Geometry_
bool isV9Geometry_
Definition: HGCalTriggerGeometryESProducer.cc:29
ModuleFactory.h
edm::getParameterSet
ParameterSet const & getParameterSet(ParameterSetID const &id)
Definition: ParameterSet.cc:855
std
Definition: JetResolutionObject.h:76
HcalEndcap
Definition: HcalAssistant.h:34
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
Exception
Definition: hltDiff.cc:246
HGCalTriggerGeometryESProducer::geometry_name_
std::string geometry_name_
Definition: HGCalTriggerGeometryESProducer.cc:23
HGCalTriggerGeometryESProducer::nose_geometry_token_
edm::ESGetToken< HGCalGeometry, IdealGeometryRecord > nose_geometry_token_
Definition: HGCalTriggerGeometryESProducer.cc:28
edm::ESProducer
Definition: ESProducer.h:101
HGCHEF
Definition: ForwardSubdetector.h:9
DetId::Forward
Definition: DetId.h:30