CMS 3D CMS Logo

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

#include <CmsMTDDetIdBuilder.h>

Public Member Functions

GeometricTimingDetbuildId (GeometricTimingDet *det)
 
 CmsMTDDetIdBuilder (std::vector< int > detidShifts)
 

Protected Member Functions

void iterate (GeometricTimingDet *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 CmsMTDDetIdBuilder.h.

Constructor & Destructor Documentation

CmsMTDDetIdBuilder::CmsMTDDetIdBuilder ( std::vector< int >  detidShifts)

Definition at line 13 of file CmsMTDDetIdBuilder.cc.

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

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

Member Function Documentation

GeometricTimingDet * CmsMTDDetIdBuilder::buildId ( GeometricTimingDet det)

Definition at line 25 of file CmsMTDDetIdBuilder.cc.

References DetId::Forward, GeometricTimingDet::geographicalID(), iterate(), LogDebug, DetId::rawId(), GeometricTimingDet::setGeographicalID(), and lumiQTWidget::t.

26 {
27 
28  LogDebug("BuildingTrackerDetId") << "Starting to build MTD DetIds";
29 
30  DetId t( DetId::Forward, 0 );
31  mtd->setGeographicalID( t );
32  iterate( mtd, 0, mtd->geographicalID().rawId() );
33 
34  return mtd;
35 }
#define LogDebug(id)
void iterate(GeometricTimingDet *det, int level, unsigned int ID)
Definition: DetId.h:18
void CmsMTDDetIdBuilder::iterate ( GeometricTimingDet det,
int  level,
unsigned int  ID 
)
protected

Definition at line 38 of file CmsMTDDetIdBuilder.cc.

References funct::abs(), GeometricTimingDet::component(), makeMuonMisalignmentScenario::components, GeometricTimingDet::components(), GeometricTimingDet::geographicalID(), mps_fire::i, recoMuon::in, hcalDigis_cfi::level, LogTrace, m_detidshifts, RecoTauDiscriminantConfiguration::mask, maxLevels, nSubDet, DetId::rawId(), GeometricTimingDet::setGeographicalID(), AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, and GeometricTimingDet::translation().

Referenced by buildId().

39 {
40  std::bitset<32> binary_ID(ID);
41 
42  // SubDetector (useful to know fron now on, valid only after level 0, where SubDetector is assigned)
43  uint32_t mask = (7<<25);
44  uint32_t iSubDet = ID & mask;
45  iSubDet = iSubDet >> 25;
46  //
47 
48  LogTrace("BuildingTrackerDetId") << std::string(2*level,'-')
49  << "+" << ID << " " << iSubDet << " " << level;
50 
51  switch( level )
52  {
53  // level 0: special case because it is used to assign the proper detid bits based on the endcap-like subdetector position: +z or -z
54  case 0:
55  {
56  for( uint32_t i = 0; i<(in)->components().size(); i++ )
57  {
58  GeometricTimingDet* component = in->component(i);
59  uint32_t iSubDet = component->geographicalID().rawId();
60  uint32_t temp = ID;
61  temp |= (iSubDet<<25);
62  component->setGeographicalID(temp);
63 
64  if(iSubDet>0 && iSubDet<=nSubDet && m_detidshifts[level*nSubDet+iSubDet-1]>=0) {
65  if(m_detidshifts[level*nSubDet+iSubDet-1]+2<25) temp|= (0<<(m_detidshifts[level*nSubDet+iSubDet-1]+2));
66  bool negside = component->translation().z()<0.;
67  if(std::abs(component->translation().z())<1.) negside = component->components().front()->translation().z()<0.; // needed for subdet like TID which are NOT translated
68  LogTrace("BuildingTrackerDetId") << "Is negative endcap? " << negside
69  << ", because z translation is " << component->translation().z()
70  << " and component z translation is " << component->components().front()->translation().z();
71  if(negside)
72  {
73  temp |= (1<<m_detidshifts[level*nSubDet+iSubDet-1]);
74  }
75  else
76  {
77  temp |= (2<<m_detidshifts[level*nSubDet+iSubDet-1]);
78  }
79  }
80  component->setGeographicalID(DetId(temp));
81 
82  // next level
83  iterate(component,level+1,((in)->components())[i]->geographicalID().rawId());
84  }
85  break;
86  }
87  // level 1 to 5
88  default:
89  {
90  for( uint32_t i = 0; i < (in)->components().size(); i++ )
91  {
92  auto component = in->component(i);
93  uint32_t temp = ID;
94 
95  if(level<maxLevels) {
96  if(iSubDet>0 && iSubDet <=nSubDet && m_detidshifts[level*nSubDet+iSubDet-1]>=0) {
97  temp |= (component->geographicalID().rawId()<<m_detidshifts[level*nSubDet+iSubDet-1]);
98  }
99  component->setGeographicalID( temp );
100  // next level
101  iterate(component,level+1,((in)->components())[i]->geographicalID().rawId());
102  }
103  }
104 
105  break;
106  }
107  // level switch ends
108  }
109 
110  return;
111 
112 }
std::array< int, nSubDet *maxLevels > m_detidshifts
uint32_t ID
Definition: Definitions.h:26
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
ConstGeometricTimingDetContainer & components()
void iterate(GeometricTimingDet *det, int level, unsigned int ID)
DDTranslation const & translation() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const int maxLevels
void setGeographicalID(DetId id)
#define LogTrace(id)
Definition: DetId.h:18
DetId geographicalID() const
static const unsigned int nSubDet

Member Data Documentation

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

Definition at line 30 of file CmsMTDDetIdBuilder.h.

Referenced by CmsMTDDetIdBuilder(), and iterate().

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

Definition at line 29 of file CmsMTDDetIdBuilder.h.

const int CmsMTDDetIdBuilder::maxLevels =6
staticprivate

Definition at line 26 of file CmsMTDDetIdBuilder.h.

Referenced by CmsMTDDetIdBuilder(), and iterate().

const unsigned int CmsMTDDetIdBuilder::nSubDet =6
staticprivate

Definition at line 25 of file CmsMTDDetIdBuilder.h.

Referenced by CmsMTDDetIdBuilder(), and iterate().