CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
TrackerMapDDDtoID Class Reference

#include <TrackerMapDDDtoID.h>

Public Types

typedef std::map< nav_type, uint32_t > MapType
 
typedef GeometricDet::nav_type nav_type
 
typedef std::map< uint32_t, nav_typeRevMapType
 

Public Member Functions

std::vector< nav_type > const & allNavTypes () const
 
void clear ()
 
unsigned int id (const nav_type &) const
 calculate the id of a given node More...
 
nav_type const & navType (uint32_t) const
 
 TrackerMapDDDtoID (const GeometricDet *iDet)
 
 ~TrackerMapDDDtoID ()
 

Private Member Functions

void buildAll (const GeometricDet *)
 
void buildAllStep2 (const GeometricDet *)
 

Private Attributes

std::vector< nav_typenavVec
 
MapType path2id_
 
RevMapType revpath2id_
 

Detailed Description

Definition at line 14 of file TrackerMapDDDtoID.h.

Member Typedef Documentation

typedef std::map<nav_type,uint32_t> TrackerMapDDDtoID::MapType

Definition at line 18 of file TrackerMapDDDtoID.h.

Definition at line 17 of file TrackerMapDDDtoID.h.

typedef std::map<uint32_t,nav_type> TrackerMapDDDtoID::RevMapType

Definition at line 19 of file TrackerMapDDDtoID.h.

Constructor & Destructor Documentation

TrackerMapDDDtoID::TrackerMapDDDtoID ( const GeometricDet iDet)

Definition at line 9 of file TrackerMapDDDtoID.cc.

References buildAll().

10 {
11  buildAll(iDet);
12  //
13  // loop over all the volumes which hahe a SpecPar called specpar with value value,
14  // and save in the map the association nav_type<->id
15  //
16 }
void buildAll(const GeometricDet *)
TrackerMapDDDtoID::~TrackerMapDDDtoID ( )
inline

Definition at line 22 of file TrackerMapDDDtoID.h.

References allNavTypes(), buildAll(), buildAllStep2(), clear(), id(), and navType().

22 {clear();}

Member Function Documentation

std::vector< TrackerMapDDDtoID::nav_type > const & TrackerMapDDDtoID::allNavTypes ( ) const

Definition at line 65 of file TrackerMapDDDtoID.cc.

References navVec.

Referenced by ~TrackerMapDDDtoID().

65  {
66  return navVec;
67 }
std::vector< nav_type > navVec
void TrackerMapDDDtoID::buildAll ( const GeometricDet iDet)
private

Definition at line 18 of file TrackerMapDDDtoID.cc.

References buildAllStep2().

Referenced by TrackerMapDDDtoID(), and ~TrackerMapDDDtoID().

18  {
19  edm::LogInfo("TrackerMapDDDtoID")<<" Building the TrackerMapDDDtoID map.";
20  TrackerMapDDDtoID* me = const_cast<TrackerMapDDDtoID*>(this);
21  me->buildAllStep2(iDet);
22 }
void buildAllStep2(const GeometricDet *)
void TrackerMapDDDtoID::buildAllStep2 ( const GeometricDet theTracker)
private

Definition at line 24 of file TrackerMapDDDtoID.cc.

References GeometricDet::deepComponents(), navType(), navVec, path2id_, and revpath2id_.

Referenced by buildAll(), and ~TrackerMapDDDtoID().

24  {
25 
26  std::vector<const GeometricDet*> allDetectors;
27  theTracker->deepComponents(allDetectors);
28 
29  //
30  // Also build a map! (for slower access)
31  //
32 
33  for (unsigned int j=0; j<allDetectors.size(); j++){
34 
35  path2id_.insert(std::pair<nav_type,uint32_t>(allDetectors[j]->navType(),(allDetectors[j]->geographicalID())()));
36  revpath2id_.insert(std::pair<uint32_t,nav_type>((allDetectors[j]->geographicalID())(),allDetectors[j]->navType()));
37  navVec.push_back(allDetectors[j]->navType());
38  }
39  edm::LogInfo("TrackerMapDDDtoID")<<"Created TrackerMapDDDtoID; results in "<<allDetectors.size()<<" detectors numbered.";
40 }
std::vector< nav_type > navVec
ConstGeometricDetContainer deepComponents() const
nav_type const & navType(uint32_t) const
void TrackerMapDDDtoID::clear ( void  )

Definition at line 81 of file TrackerMapDDDtoID.cc.

References path2id_.

Referenced by ~TrackerMapDDDtoID().

81  {
82  path2id_.clear();
83  edm::LogInfo("TrackerMapDDDtoID")<<" TrackerMapDDDtoID maps deleted from memory.";
84 }
unsigned int TrackerMapDDDtoID::id ( const nav_type n) const

calculate the id of a given node

Definition at line 55 of file TrackerMapDDDtoID.cc.

References path2id_, and mps_fire::result.

Referenced by ~TrackerMapDDDtoID().

56 {
57  std::map<nav_type,uint32_t>::const_iterator it = path2id_.find(n);
58  unsigned int result = 0;
59  if (it != path2id_.end())
60  result = it->second;
61  return result;
62 }
TrackerMapDDDtoID::nav_type const & TrackerMapDDDtoID::navType ( uint32_t  num) const

Definition at line 73 of file TrackerMapDDDtoID.cc.

References revpath2id_.

Referenced by buildAllStep2(), and ~TrackerMapDDDtoID().

74 {
75  std::map<uint32_t,nav_type>::const_iterator it = revpath2id_.find(num);
76  if (it != revpath2id_.end())
77  return it->second;
78  return nullresult;
79 }

Member Data Documentation

std::vector<nav_type> TrackerMapDDDtoID::navVec
private

Definition at line 41 of file TrackerMapDDDtoID.h.

Referenced by allNavTypes(), and buildAllStep2().

MapType TrackerMapDDDtoID::path2id_
private

Definition at line 42 of file TrackerMapDDDtoID.h.

Referenced by buildAllStep2(), clear(), and id().

RevMapType TrackerMapDDDtoID::revpath2id_
private

Definition at line 43 of file TrackerMapDDDtoID.h.

Referenced by buildAllStep2(), and navType().