CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
CmsTrackerDetIdBuilder Class Reference

#include <CmsTrackerDetIdBuilder.h>

Public Member Functions

void buildId (GeometricDet &det)
 
 CmsTrackerDetIdBuilder (const std::vector< int > &detidShifts)
 

Private Member Functions

void iterate (GeometricDet &det, int level, unsigned int ID)
 

Private Attributes

std::array< int, nSubDet *maxLevelsm_detidshifts
 
std::map< std::string, uint32_t > m_mapNavTypeToDetId
 

Static Private Attributes

static const int maxLevels = 6
 
static const unsigned int nSubDet = 6
 

Detailed Description

Class to build a geographicalId.

Definition at line 15 of file CmsTrackerDetIdBuilder.h.

Constructor & Destructor Documentation

◆ CmsTrackerDetIdBuilder()

CmsTrackerDetIdBuilder::CmsTrackerDetIdBuilder ( const std::vector< int > &  detidShifts)

Definition at line 13 of file CmsTrackerDetIdBuilder.cc.

13  : m_detidshifts() {
14  if (detidShifts.size() != nSubDet * maxLevels)
15  edm::LogError("WrongConfiguration") << "Wrong configuration of TrackerGeometricDetESModule. Vector of "
16  << detidShifts.size() << " elements provided";
17  else {
18  for (unsigned int i = 0; i < nSubDet * maxLevels; ++i) {
19  m_detidshifts[i] = detidShifts[i];
20  }
21  }
22 }

References mps_fire::i, m_detidshifts, maxLevels, and nSubDet.

Member Function Documentation

◆ buildId()

void CmsTrackerDetIdBuilder::buildId ( GeometricDet det)

Definition at line 24 of file CmsTrackerDetIdBuilder.cc.

24  {
25  LogDebug("BuildingTrackerDetId") << "Starting to build Tracker DetIds";
26 
28  tracker.setGeographicalID(t);
29  iterate(tracker, 0, tracker.geographicalId().rawId());
30 }

References iterate(), LogDebug, submitPVValidationJobs::t, DetId::Tracker, and PbPb_ZMuSkimMuonDPG_cff::tracker.

Referenced by DDDCmsTrackerContruction::construct().

◆ iterate()

void CmsTrackerDetIdBuilder::iterate ( GeometricDet det,
int  level,
unsigned int  ID 
)
private

Definition at line 32 of file CmsTrackerDetIdBuilder.cc.

32  {
33  std::bitset<32> binary_ID(ID);
34 
35  // SubDetector (useful to know fron now on, valid only after level 0, where SubDetector is assigned)
36  uint32_t mask = (7 << 25);
37  uint32_t iSubDet = ID & mask;
38  iSubDet = iSubDet >> 25;
39  //
40 
41  LogTrace("BuildingTrackerDetId") << std::string(2 * level, '-') << "+" << ID << " " << iSubDet << " " << level;
42 
43  switch (level) {
44  // level 0: special case because it is used to assign the proper detid bits based on the endcap-like subdetector position: +z or -z
45  case 0: {
46  for (uint32_t i = 0; i < in.components().size(); i++) {
47  GeometricDet* component = in.component(i);
48  uint32_t iSubDet = component->geographicalId().rawId();
49  uint32_t temp = ID;
50  temp |= (iSubDet << 25);
51  component->setGeographicalID(temp);
52 
53  if (iSubDet > 0 && iSubDet <= nSubDet && m_detidshifts[level * nSubDet + iSubDet - 1] >= 0) {
54  if (m_detidshifts[level * nSubDet + iSubDet - 1] + 2 < 25)
55  temp |= (0 << (m_detidshifts[level * nSubDet + iSubDet - 1] + 2));
56  bool negside = component->translation().z() < 0.;
57  if (std::abs(component->translation().z()) < 1.)
58  negside = component->components().front()->translation().z() <
59  0.; // needed for subdet like TID which are NOT translated
60  LogTrace("BuildingTrackerDetId")
61  << "Is negative endcap? " << negside << ", because z translation is " << component->translation().z()
62  << " and component z translation is " << component->components().front()->translation().z();
63  if (negside) {
64  temp |= (1 << m_detidshifts[level * nSubDet + iSubDet - 1]);
65  } else {
66  temp |= (2 << m_detidshifts[level * nSubDet + iSubDet - 1]);
67  }
68  }
69  component->setGeographicalID(DetId(temp));
70 
71  // next level
72  iterate(*component, level + 1, (in.components())[i]->geographicalId().rawId());
73  }
74  break;
75  }
76  // level 1 to 5
77  default: {
78  for (uint32_t i = 0; i < in.components().size(); i++) {
79  auto component = in.component(i);
80  uint32_t temp = ID;
81 
82  if (level < maxLevels) {
83  if (iSubDet > 0 && iSubDet <= nSubDet && m_detidshifts[level * nSubDet + iSubDet - 1] >= 0) {
84  temp |= (component->geographicalId().rawId() << m_detidshifts[level * nSubDet + iSubDet - 1]);
85  }
86  component->setGeographicalID(temp);
87  // next level
88  iterate(*component, level + 1, (in.components())[i]->geographicalId().rawId());
89  }
90  }
91 
92  break;
93  }
94  // level switch ends
95  }
96 
97  return;
98 }

References funct::abs(), GeometricDet::components(), GeometricDet::geographicalId(), mps_fire::i, recoMuon::in, personalPlayback::level, LogTrace, m_detidshifts, maxLevels, nSubDet, DetId::rawId(), GeometricDet::setGeographicalID(), AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, and GeometricDet::translation().

Referenced by buildId().

Member Data Documentation

◆ m_detidshifts

std::array<int, nSubDet * maxLevels> CmsTrackerDetIdBuilder::m_detidshifts
private

Definition at line 27 of file CmsTrackerDetIdBuilder.h.

Referenced by CmsTrackerDetIdBuilder(), and iterate().

◆ m_mapNavTypeToDetId

std::map<std::string, uint32_t> CmsTrackerDetIdBuilder::m_mapNavTypeToDetId
private

Definition at line 26 of file CmsTrackerDetIdBuilder.h.

◆ maxLevels

const int CmsTrackerDetIdBuilder::maxLevels = 6
staticprivate

Definition at line 23 of file CmsTrackerDetIdBuilder.h.

Referenced by CmsTrackerDetIdBuilder(), and iterate().

◆ nSubDet

const unsigned int CmsTrackerDetIdBuilder::nSubDet = 6
staticprivate

Definition at line 22 of file CmsTrackerDetIdBuilder.h.

Referenced by CmsTrackerDetIdBuilder(), and iterate().

personalPlayback.level
level
Definition: personalPlayback.py:22
mps_fire.i
i
Definition: mps_fire.py:428
GeometricDet::components
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:149
CmsTrackerDetIdBuilder::m_detidshifts
std::array< int, nSubDet *maxLevels > m_detidshifts
Definition: CmsTrackerDetIdBuilder.h:27
GeometricDet::translation
const Translation & translation() const
Definition: GeometricDet.h:100
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
DetId
Definition: DetId.h:17
GeometricDet::setGeographicalID
void setGeographicalID(DetId id)
Definition: GeometricDet.h:97
GeometricDet
Definition: GeometricDet.h:31
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
GeometricDet::geographicalId
const DetId & geographicalId() const
Definition: GeometricDet.h:96
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
align::ID
uint32_t ID
Definition: Definitions.h:24
DetId::Tracker
Definition: DetId.h:25
CmsTrackerDetIdBuilder::nSubDet
static const unsigned int nSubDet
Definition: CmsTrackerDetIdBuilder.h:22
recoMuon::in
Definition: RecoMuonEnumerators.h:6
CmsTrackerDetIdBuilder::maxLevels
static const int maxLevels
Definition: CmsTrackerDetIdBuilder.h:23
CmsTrackerDetIdBuilder::iterate
void iterate(GeometricDet &det, int level, unsigned int ID)
Definition: CmsTrackerDetIdBuilder.cc:32
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
edm::Log
Definition: MessageLogger.h:70