CMS 3D CMS Logo

DD4hep_ME0NumberingScheme.cc
Go to the documentation of this file.
1 /*
2 //\class ME0NumberingScheme
3 
4 Description: ME0 Numbering Scheme for DD4hep
5 
6 //
7 // Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration)
8 // Created: 29 Apr 2020
9 */
16 #include <cassert>
17 
18 using namespace cms;
19 
20 ME0NumberingScheme::ME0NumberingScheme(const MuonConstants& muonConstants) { initMe(muonConstants); }
21 
22 void ME0NumberingScheme::initMe(const MuonConstants& muonConstants) {
23  int theLevelPart = get("level", muonConstants);
24 
25  assert(theLevelPart != 0);
26 
27  theRegionLevel = get("m0_region", muonConstants) / theLevelPart;
28  theLayerLevel = get("m0_layer", muonConstants) / theLevelPart;
29  theSectorLevel = get("m0_sector", muonConstants) / theLevelPart;
30  theRollLevel = get("m0_roll", muonConstants) / theLevelPart;
31  theNEtaPart = get("m0_nroll", muonConstants);
32 }
33 
35  int region = 0;
36  int layer = 0;
37  int chamber = 0;
38  int roll = 0;
39 
40  //decode significant ME0 levels
41 
42  if (num.getBaseNo(theRegionLevel) == 0)
43  region = 1;
44  else
45  region = -1;
46  layer = num.getBaseNo(theLayerLevel) + 1;
47  chamber = num.getBaseNo(theSectorLevel) + 1;
48  roll = num.getBaseNo(theRollLevel) + 1;
49 
50  // Build the actual numbering
51  ME0DetId id(region, layer, chamber, roll);
52 
53  setDetId(id.rawId());
54 }
55 
56 const int ME0NumberingScheme::get(const char* key, const MuonConstants& muonConstants) const {
57  int result(0);
58  auto const& it = (muonConstants.find(key));
59  if (it != end(muonConstants))
60  result = it->second;
61  return result;
62 }
cms::ME0NumberingScheme::theNEtaPart
int theNEtaPart
Definition: DD4hep_ME0NumberingScheme.h:35
MessageLogger.h
cms::ME0NumberingScheme::initMe
void initMe(const MuonConstants &muonConstants)
Definition: DD4hep_ME0NumberingScheme.cc:22
cms::ME0NumberingScheme::setDetId
void setDetId(int idnew)
Definition: DD4hep_ME0NumberingScheme.h:29
ME0DetId.h
cms::cuda::assert
assert(be >=bs)
end
#define end
Definition: vmac.h:39
cms::ME0NumberingScheme::ME0NumberingScheme
ME0NumberingScheme(const MuonConstants &muonConstants)
Definition: DD4hep_ME0NumberingScheme.cc:20
cms::ME0NumberingScheme::theRollLevel
int theRollLevel
Definition: DD4hep_ME0NumberingScheme.h:34
cms::ME0NumberingScheme::theSectorLevel
int theSectorLevel
Definition: DD4hep_ME0NumberingScheme.h:32
MuonBaseNumber.h
DD4hep_ME0NumberingScheme.h
ME0DetId
Definition: ME0DetId.h:16
cms::ME0NumberingScheme::theLayerLevel
int theLayerLevel
Definition: DD4hep_ME0NumberingScheme.h:33
DD4hep_MuonNumbering.h
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
MuonBaseNumber
Definition: MuonBaseNumber.h:21
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
cms::ME0NumberingScheme::theRegionLevel
int theRegionLevel
Definition: DD4hep_ME0NumberingScheme.h:31
cms::ME0NumberingScheme::get
const int get(const char *, const MuonConstants &) const
Definition: DD4hep_ME0NumberingScheme.cc:56
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
Exception.h
mps_fire.result
result
Definition: mps_fire.py:303
crabWrapper.key
key
Definition: crabWrapper.py:19
cms::ME0NumberingScheme::baseNumberToUnitNumber
void baseNumberToUnitNumber(const MuonBaseNumber &)
Definition: DD4hep_ME0NumberingScheme.cc:34
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21
cms::MuonConstants
std::unordered_map< std::string_view, int > MuonConstants
Definition: DD4hep_MuonNumbering.h:35