CMS 3D CMS Logo

MuonDetLayerGeometryESProducer.cc
Go to the documentation of this file.
1 
11 
17 
24 
30 
33 
34 #include <memory>
35 
37 public:
40 
42  std::unique_ptr<MuonDetLayerGeometry> produce(const MuonRecoGeometryRecord& record);
43 
44  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
45 
46 private:
52 };
53 
54 using namespace edm;
55 
57  auto cc = setWhatProduced(this);
58  dtToken_ = cc.consumes();
59  cscToken_ = cc.consumes();
60  gemToken_ = cc.consumes();
61  me0Token_ = cc.consumes();
62  rpcToken_ = cc.consumes();
63 }
64 
65 std::unique_ptr<MuonDetLayerGeometry> MuonDetLayerGeometryESProducer::produce(const MuonRecoGeometryRecord& record) {
66  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuonDetLayerGeometryESProducer";
67  auto muonDetLayerGeometry = std::make_unique<MuonDetLayerGeometry>();
68 
69  // Build DT layers
70  if (auto dt = record.getHandle(dtToken_)) {
71  muonDetLayerGeometry->addDTLayers(MuonDTDetLayerGeometryBuilder::buildLayers(*dt));
72  } else {
73  LogInfo(metname) << "No DT geometry is available.";
74  }
75 
76  // Build CSC layers
77  if (auto csc = record.getHandle(cscToken_)) {
78  muonDetLayerGeometry->addCSCLayers(MuonCSCDetLayerGeometryBuilder::buildLayers(*csc));
79  } else {
80  LogInfo(metname) << "No CSC geometry is available.";
81  }
82 
83  // Build GEM layers
84  if (auto gem = record.getHandle(gemToken_)) {
85  muonDetLayerGeometry->addGEMLayers(MuonGEMDetLayerGeometryBuilder::buildEndcapLayers(*gem));
86  } else {
87  LogInfo(metname) << "No GEM geometry is available.";
88  }
89 
90  // Build ME0 layers
91  if (auto me0 = record.getHandle(me0Token_)) {
92  muonDetLayerGeometry->addME0Layers(MuonME0DetLayerGeometryBuilder::buildEndcapLayers(*me0));
93  } else {
94  LogDebug(metname) << "No ME0 geometry is available.";
95  }
96 
97  // Build RPC layers
98  if (auto rpc = record.getHandle(rpcToken_)) {
99  muonDetLayerGeometry->addRPCLayers(MuonRPCDetLayerGeometryBuilder::buildBarrelLayers(*rpc),
101  } else {
102  LogInfo(metname) << "No RPC geometry is available.";
103  }
104 
105  // Sort layers properly
106  muonDetLayerGeometry->sortLayers();
107 
108  return muonDetLayerGeometry;
109 }
110 
113  //no parameters are used
114  descriptions.addDefault(desc);
115 }
116 
float dt
Definition: AMPTWrapper.h:136
const std::string metname
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtToken_
void addDefault(ParameterSetDescription const &psetDescription)
static std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > buildLayers(const CSCGeometry &geo)
static std::vector< DetLayer * > buildLayers(const DTGeometry &geo)
Operations.
Definition: L1Track.h:19
Log< level::Info, false > LogInfo
static std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > buildEndcapLayers(const ME0Geometry &geo)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
static std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > buildEndcapLayers(const RPCGeometry &geo)
std::unique_ptr< MuonDetLayerGeometry > produce(const MuonRecoGeometryRecord &record)
Produce MuonDeLayerGeometry.
edm::ESGetToken< ME0Geometry, MuonGeometryRecord > me0Token_
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcToken_
HLT enums.
MuonDetLayerGeometryESProducer(const edm::ParameterSet &p)
Constructor.
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscToken_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > gemToken_
static std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > buildEndcapLayers(const GEMGeometry &geo)
#define LogDebug(id)
static std::vector< DetLayer * > buildBarrelLayers(const RPCGeometry &geo)
Builds the barrel layers. Result vector is sorted inside-out.