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  ee_geometry_token_ = cc.consumes(edm::ESInputTag{"", "HGCalEESensitive"});
39  hsi_geometry_token_ = cc.consumes(edm::ESInputTag{"", "HGCalHESiliconSensitive"});
40  hsc_geometry_token_ = cc.consumes(edm::ESInputTag{"", "HGCalHEScintillatorSensitive"});
41  nose_geometry_token_ = cc.consumes(edm::ESInputTag{"", "HGCalHFNoseSensitive"});
42  } else {
43  calo_geometry_token_ = cc.consumes();
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
electrons_cff.bool
bool
Definition: electrons_cff.py:366
edm::ESInputTag
Definition: ESInputTag.h:87
edm::eventsetup::DependentRecordImplementation::getHandle
ESHandle< ProductT > getHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:87
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:163
ESProducer.h
HGCalTriggerGeometryESProducer::calo_geometry_token_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > calo_geometry_token_
Definition: HGCalTriggerGeometryESProducer.cc:24
HGCalTriggerGeometryESProducer
Definition: HGCalTriggerGeometryESProducer.cc:12
relativeConstraints.geometry
geometry
Definition: relativeConstraints.py:39
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:109
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:47
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:862
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:245
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:104
HGCHEF
Definition: ForwardSubdetector.h:9
DetId::Forward
Definition: DetId.h:30