CMS 3D CMS Logo

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

#include <CmsTrackerDetIdBuilder.h>

Public Member Functions

GeometricDetbuildId (GeometricDet *det)
 
 CmsTrackerDetIdBuilder (std::vector< int > detidShifts)
 

Protected 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 ( std::vector< int >  detidShifts)

Definition at line 13 of file CmsTrackerDetIdBuilder.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 TrackerGeometricDetESModule. 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 }
static const unsigned int nSubDet
std::array< int, nSubDet *maxLevels > m_detidshifts

Member Function Documentation

GeometricDet * CmsTrackerDetIdBuilder::buildId ( GeometricDet det)

Definition at line 25 of file CmsTrackerDetIdBuilder.cc.

References GeometricDet::geographicalID(), iterate(), LogDebug, DetId::rawId(), GeometricDet::setGeographicalID(), lumiQTWidget::t, trackingTruthProducer_cfi::tracker, and DetId::Tracker.

Referenced by DDDCmsTrackerContruction::construct().

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

Definition at line 38 of file CmsTrackerDetIdBuilder.cc.

References funct::abs(), GeometricDet::component(), makeMuonMisalignmentScenario::components, GeometricDet::components(), GeometricDet::geographicalID(), mps_fire::i, recoMuon::in, hcalDigis_cfi::level, LogTrace, m_detidshifts, RecoTauDiscriminantConfiguration::mask, maxLevels, nSubDet, DetId::rawId(), GeometricDet::setGeographicalID(), AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, and GeometricDet::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  GeometricDet* 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 }
static const unsigned int nSubDet
uint32_t ID
Definition: Definitions.h:26
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
void setGeographicalID(DetId id)
Definition: GeometricDet.h:82
DetId geographicalID() const
Definition: GeometricDet.h:208
std::array< int, nSubDet *maxLevels > m_detidshifts
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:176
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DDTranslation const & translation() const
Definition: GeometricDet.h:125
#define LogTrace(id)
Definition: DetId.h:18
void iterate(GeometricDet *det, int level, unsigned int ID)

Member Data Documentation

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

Definition at line 30 of file CmsTrackerDetIdBuilder.h.

Referenced by CmsTrackerDetIdBuilder(), and iterate().

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

Definition at line 29 of file CmsTrackerDetIdBuilder.h.

const int CmsTrackerDetIdBuilder::maxLevels =6
staticprivate

Definition at line 26 of file CmsTrackerDetIdBuilder.h.

Referenced by CmsTrackerDetIdBuilder(), and iterate().

const unsigned int CmsTrackerDetIdBuilder::nSubDet =6
staticprivate

Definition at line 25 of file CmsTrackerDetIdBuilder.h.

Referenced by CmsTrackerDetIdBuilder(), and iterate().