CMS 3D CMS Logo

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

#include <MTDMapDDDtoID.h>

Public Types

typedef std::map< nav_type, uint32_t > MapType
 
typedef GeometricTimingDet::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...
 
 MTDMapDDDtoID (const GeometricTimingDet *iDet)
 
nav_type const & navType (uint32_t) const
 
 ~MTDMapDDDtoID ()
 

Private Member Functions

void buildAll (const GeometricTimingDet *)
 
void buildAllStep2 (const GeometricTimingDet *)
 

Private Attributes

std::vector< nav_typenavVec
 
MapType path2id_
 
RevMapType revpath2id_
 

Detailed Description

Definition at line 14 of file MTDMapDDDtoID.h.

Member Typedef Documentation

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

Definition at line 18 of file MTDMapDDDtoID.h.

Definition at line 17 of file MTDMapDDDtoID.h.

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

Definition at line 19 of file MTDMapDDDtoID.h.

Constructor & Destructor Documentation

MTDMapDDDtoID::MTDMapDDDtoID ( const GeometricTimingDet iDet)

Definition at line 9 of file MTDMapDDDtoID.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 GeometricTimingDet *)
MTDMapDDDtoID::~MTDMapDDDtoID ( )
inline

Definition at line 22 of file MTDMapDDDtoID.h.

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

22 {clear();}

Member Function Documentation

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

Definition at line 52 of file MTDMapDDDtoID.cc.

References navVec.

Referenced by ~MTDMapDDDtoID().

52  {
53  return navVec;
54 }
std::vector< nav_type > navVec
Definition: MTDMapDDDtoID.h:35
void MTDMapDDDtoID::buildAll ( const GeometricTimingDet iDet)
private

Definition at line 18 of file MTDMapDDDtoID.cc.

References buildAllStep2().

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

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

Definition at line 24 of file MTDMapDDDtoID.cc.

References GeometricTimingDet::deepComponents(), navVec, path2id_, and revpath2id_.

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

24  {
25 
26  std::vector<const GeometricTimingDet*> allDetectors;
27  theTracker->deepComponents(allDetectors);
28 
29  //
30  // Also build a map! (for slower access)
31  //
32 
33  for (auto & allDetector : allDetectors){
34 
35  path2id_.insert(std::pair<nav_type,uint32_t>(allDetector->navType(),(allDetector->geographicalID())()));
36  revpath2id_.insert(std::pair<uint32_t,nav_type>((allDetector->geographicalID())(),allDetector->navType()));
37  navVec.emplace_back(allDetector->navType());
38  }
39  edm::LogInfo("MTDMapDDDtoID")<<"Created MTDMapDDDtoID; results in "<<allDetectors.size()<<" detectors numbered.";
40 }
RevMapType revpath2id_
Definition: MTDMapDDDtoID.h:37
std::vector< nav_type > navVec
Definition: MTDMapDDDtoID.h:35
MapType path2id_
Definition: MTDMapDDDtoID.h:36
ConstGeometricTimingDetContainer deepComponents() const
void MTDMapDDDtoID::clear ( void  )

Definition at line 68 of file MTDMapDDDtoID.cc.

References path2id_.

Referenced by ~MTDMapDDDtoID().

68  {
69  path2id_.clear();
70  edm::LogInfo("MTDMapDDDtoID")<<" MTDMapDDDtoID maps deleted from memory.";
71 }
MapType path2id_
Definition: MTDMapDDDtoID.h:36
unsigned int MTDMapDDDtoID::id ( const nav_type n) const

calculate the id of a given node

Definition at line 42 of file MTDMapDDDtoID.cc.

References path2id_, and mps_fire::result.

Referenced by ~MTDMapDDDtoID().

43 {
44  std::map<nav_type,uint32_t>::const_iterator it = path2id_.find(n);
45  unsigned int result = 0;
46  if (it != path2id_.end())
47  result = it->second;
48  return result;
49 }
MapType path2id_
Definition: MTDMapDDDtoID.h:36
MTDMapDDDtoID::nav_type const & MTDMapDDDtoID::navType ( uint32_t  num) const

Definition at line 60 of file MTDMapDDDtoID.cc.

References revpath2id_.

Referenced by ~MTDMapDDDtoID().

61 {
62  std::map<uint32_t,nav_type>::const_iterator it = revpath2id_.find(num);
63  if (it != revpath2id_.end())
64  return it->second;
65  return nullresult;
66 }
RevMapType revpath2id_
Definition: MTDMapDDDtoID.h:37

Member Data Documentation

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

Definition at line 35 of file MTDMapDDDtoID.h.

Referenced by allNavTypes(), and buildAllStep2().

MapType MTDMapDDDtoID::path2id_
private

Definition at line 36 of file MTDMapDDDtoID.h.

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

RevMapType MTDMapDDDtoID::revpath2id_
private

Definition at line 37 of file MTDMapDDDtoID.h.

Referenced by buildAllStep2(), and navType().