CMS 3D CMS Logo

MuonOffsetESProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: DetectorDescription/MuonOffsetESProducer
4 // Class: MuonOffsetESProducer
5 //
13 //
14 // Original Author: Sunanda Banerjee
15 // Created: Fri, 16 Oct 2020 09:10:32 GMT
16 //
17 //
18 
30 
31 #include <memory>
32 #include <string>
33 #include <vector>
34 
35 //#define EDM_ML_DEBUG
36 
38 public:
40 
41  using ReturnType = std::unique_ptr<MuonOffsetMap>;
42 
45 
46 private:
47  const bool fromDD4Hep_;
48  const std::vector<std::string> names_;
51 };
52 
54  : fromDD4Hep_(iConfig.getParameter<bool>("fromDD4Hep")),
55  names_(iConfig.getParameter<std::vector<std::string>>("names")) {
56  auto cc = setWhatProduced(this);
57  if (fromDD4Hep_) {
59  } else {
61  }
62 #ifdef EDM_ML_DEBUG
63  edm::LogVerbatim("MuonGeom") << "MuonOffsetESProducer::MuonOffsetESProducer called with dd4hep: " << fromDD4Hep_;
64 #endif
65 }
66 
69  std::vector<std::string> names = {"MuonCommonNumbering",
70  "MuonBarrel",
71  "MuonEndcap",
72  "MuonBarrelWheels",
73  "MuonBarrelStation1",
74  "MuonBarrelStation2",
75  "MuonBarrelStation3",
76  "MuonBarrelStation4",
77  "MuonBarrelSuperLayer",
78  "MuonBarrelLayer",
79  "MuonBarrelWire",
80  "MuonRpcPlane1I",
81  "MuonRpcPlane1O",
82  "MuonRpcPlane2I",
83  "MuonRpcPlane2O",
84  "MuonRpcPlane3S",
85  "MuonRpcPlane4",
86  "MuonRpcChamberLeft",
87  "MuonRpcChamberMiddle",
88  "MuonRpcChamberRight",
89  "MuonRpcEndcap1",
90  "MuonRpcEndcap2",
91  "MuonRpcEndcap3",
92  "MuonRpcEndcap4",
93  "MuonRpcEndcapSector",
94  "MuonRpcEndcapChamberB1",
95  "MuonRpcEndcapChamberB2",
96  "MuonRpcEndcapChamberB3",
97  "MuonRpcEndcapChamberC1",
98  "MuonRpcEndcapChamberC2",
99  "MuonRpcEndcapChamberC3",
100  "MuonRpcEndcapChamberE1",
101  "MuonRpcEndcapChamberE2",
102  "MuonRpcEndcapChamberE3",
103  "MuonRpcEndcapChamberF1",
104  "MuonRpcEndcapChamberF2",
105  "MuonRpcEndcapChamberF3",
106  "MuonEndcapStation1",
107  "MuonEndcapStation2",
108  "MuonEndcapStation3",
109  "MuonEndcapStation4",
110  "MuonEndcapSubrings",
111  "MuonEndcapSectors",
112  "MuonEndcapLayers",
113  "MuonEndcapRing1",
114  "MuonEndcapRing2",
115  "MuonEndcapRing3",
116  "MuonEndcapRingA",
117  "MuonGEMEndcap",
118  "MuonGEMSector",
119  "MuonGEMChamber"};
120  desc.add<bool>("fromDD4Hep", false);
121  desc.add<std::vector<std::string>>("names", names);
122  descriptions.add("muonOffsetESProducer", desc);
123 }
124 
126 #ifdef EDM_ML_DEBUG
127  edm::LogVerbatim("MuonGeom") << "MuonOffsetESProducer::produce(const IdealGeometryRecord& iRecord)";
128 #endif
129 
130  auto ptp = std::make_unique<MuonOffsetMap>();
131  MuonOffsetFromDD builder(names_);
132 
133  if (fromDD4Hep_) {
134 #ifdef EDM_ML_DEBUG
135  edm::LogVerbatim("MuonGeom") << "MuonOffsetESProducer::Try to access cms::DDCompactView";
136 #endif
138  builder.build(&(*cpv), *ptp);
139  } else {
140 #ifdef EDM_ML_DEBUG
141  edm::LogVerbatim("MuonGeom") << "MuonOffsetESProducer::Try to access DDCompactView";
142 #endif
144  builder.build(&(*cpv), *ptp);
145  }
146  return ptp;
147 }
148 
ConfigurationDescriptions.h
MuonOffsetMap.h
electrons_cff.bool
bool
Definition: electrons_cff.py:366
edm::ESInputTag
Definition: ESInputTag.h:87
MuonOffsetFromDD.h
ESTransientHandle.h
MessageLogger.h
MuonOffsetESProducer
Definition: MuonOffsetESProducer.cc:37
MuonOffsetFromDD::build
bool build(const DDCompactView *, MuonOffsetMap &)
Definition: MuonOffsetFromDD.cc:19
MuonOffsetESProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: MuonOffsetESProducer.cc:67
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ESProducer.h
DDCompactView.h
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
MuonOffsetESProducer::ReturnType
std::unique_ptr< MuonOffsetMap > ReturnType
Definition: MuonOffsetESProducer.cc:41
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
edm::eventsetup::DependentRecordImplementation::getTransientHandle
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:98
MuonOffsetESProducer::produce
ReturnType produce(const IdealGeometryRecord &)
Definition: MuonOffsetESProducer.cc:125
MuonOffsetESProducer::names_
const std::vector< std::string > names_
Definition: MuonOffsetESProducer.cc:48
DDCompactView.h
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonOffsetESProducer::cpvTokenDDD_
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvTokenDDD_
Definition: MuonOffsetESProducer.cc:49
MuonOffsetFromDD
Definition: MuonOffsetFromDD.h:14
edm::ParameterSet
Definition: ParameterSet.h:47
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
IdealGeometryRecord.h
cc
edm::ESGetToken< DDCompactView, IdealGeometryRecord >
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
MuonOffsetESProducer::cpvTokenDD4Hep_
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > cpvTokenDD4Hep_
Definition: MuonOffsetESProducer.cc:50
ModuleFactory.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
MuonOffsetESProducer::MuonOffsetESProducer
MuonOffsetESProducer(const edm::ParameterSet &)
Definition: MuonOffsetESProducer.cc:53
cms::DDCompactView
Definition: DDCompactView.h:31
MuonOffsetESProducer::fromDD4Hep_
const bool fromDD4Hep_
Definition: MuonOffsetESProducer.cc:47
edm::ESProducer
Definition: ESProducer.h:104
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25