CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

TrackerMapDDDtoID Class Reference

#include <TrackerMapDDDtoID.h>

List of all members.

Public Types

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

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
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().

{
   buildAll(iDet);
  //
  // loop over all the volumes which hahe a SpecPar called specpar with value value, 
  // and save in the map the association nav_type<->id
  //
}
TrackerMapDDDtoID::~TrackerMapDDDtoID ( ) [inline]

Definition at line 22 of file TrackerMapDDDtoID.h.

References clear().

{clear();}

Member Function Documentation

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

Definition at line 65 of file TrackerMapDDDtoID.cc.

References navVec.

                                                                                 {
  return navVec;
}
void TrackerMapDDDtoID::buildAll ( const GeometricDet iDet) [private]

Definition at line 18 of file TrackerMapDDDtoID.cc.

References buildAllStep2().

Referenced by TrackerMapDDDtoID().

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

Definition at line 24 of file TrackerMapDDDtoID.cc.

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

Referenced by buildAll().

                                                                   {
  
  std::vector<const GeometricDet*> allDetectors;
  theTracker->deepComponents(allDetectors);
  
  //
  // Also build a map! (for slower access)
  //

  for (unsigned int j=0; j<allDetectors.size(); j++){
    
    path2id_.insert(std::pair<nav_type,uint32_t>(allDetectors[j]->navType(),(allDetectors[j]->geographicalID())()));
    revpath2id_.insert(std::pair<uint32_t,nav_type>((allDetectors[j]->geographicalID())(),allDetectors[j]->navType()));
    navVec.push_back(allDetectors[j]->navType());
  }
  edm::LogInfo("TrackerMapDDDtoID")<<"Created TrackerMapDDDtoID; results in "<<allDetectors.size()<<" detectors numbered.";
}
void TrackerMapDDDtoID::clear ( void  )

Definition at line 81 of file TrackerMapDDDtoID.cc.

References path2id_.

Referenced by ~TrackerMapDDDtoID().

                             {
  path2id_.clear();
  edm::LogInfo("TrackerMapDDDtoID")<<" TrackerMapDDDtoID maps deleted from memory.";
}
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 query::result.

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

Definition at line 73 of file TrackerMapDDDtoID.cc.

References revpath2id_.

Referenced by buildAllStep2().

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

Member Data Documentation

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

Definition at line 41 of file TrackerMapDDDtoID.h.

Referenced by allNavTypes(), and buildAllStep2().

Definition at line 42 of file TrackerMapDDDtoID.h.

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

Definition at line 43 of file TrackerMapDDDtoID.h.

Referenced by buildAllStep2(), and navType().