CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
TouchableToHistory Class Reference

#include <TouchableToHistory.h>

Public Types

typedef std::map< Nav_Story, int > DirectMapType
 
typedef std::map< Nav_Story,
nav_type
MapType
 
typedef std::vector< std::pair
< int, std::string > > 
Nav_Story
 
typedef std::vector< int > nav_type
 

Public Member Functions

void buildAll ()
 
DDFilteredViewgetFilteredView (const G4VTouchable &, DDFilteredView &)
 
Nav_Story getNavStory (DDFilteredView &)
 
nav_type getNavType (const G4VTouchable &)
 
G4VPhysicalVolume & getTouchable (DDFilteredView &)
 
 TouchableToHistory (const DDCompactView &cpv, const GeometricDet &det)
 
int touchableToInt (const G4VTouchable *)
 
Nav_Story touchableToNavStory (const G4VTouchable *)
 
nav_type touchableToNavType (const G4VTouchable *)
 

Private Member Functions

void dumpG4VPV (const G4VTouchable *)
 

Private Attributes

bool alreadySet
 
const DDCompactViewmyCompactView
 
DirectMapType myDirectMap
 
const GeometricDetmyGeomDet
 
MapType myMap
 

Detailed Description

Definition at line 16 of file TouchableToHistory.h.

Member Typedef Documentation

Definition at line 23 of file TouchableToHistory.h.

Definition at line 22 of file TouchableToHistory.h.

typedef std::vector<std::pair<int,std::string> > TouchableToHistory::Nav_Story

Definition at line 21 of file TouchableToHistory.h.

typedef std::vector<int> TouchableToHistory::nav_type

Definition at line 20 of file TouchableToHistory.h.

Constructor & Destructor Documentation

TouchableToHistory::TouchableToHistory ( const DDCompactView cpv,
const GeometricDet det 
)
inline

Definition at line 24 of file TouchableToHistory.h.

24  :
25  alreadySet(false), myCompactView(&cpv), myGeomDet(&det) {}
const GeometricDet * myGeomDet
const DDCompactView * myCompactView

Member Function Documentation

void TouchableToHistory::buildAll ( )

Definition at line 17 of file TouchableToHistory.cc.

References alreadySet, GeometricDet::deepComponents(), estimatePileup::hist, myDirectMap, myGeomDet, myMap, matplotRender::t, and touchableToNavStory().

Referenced by getFilteredView(), getNavStory(), touchableToInt(), and touchableToNavType().

17  {
18  if (alreadySet) return;
19  alreadySet = true;
20 
21  G4Navigator* theStdNavigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
22  G4Navigator theNavigator;
23  theNavigator.SetWorldVolume(theStdNavigator->GetWorldVolume());
24 
25 
26  std::vector<const GeometricDet*> allSensitiveDets;
27  myGeomDet->deepComponents(allSensitiveDets);
28  edm::LogInfo("TrackerSimInfoNumbering")<<" TouchableTo History: got "<<allSensitiveDets.size()<<" sensitive detectors from TrackerMapDDDtoID.";
29 
30  for ( std::vector<const GeometricDet*>::const_iterator it = allSensitiveDets.begin();
31  it != allSensitiveDets.end();
32  ++it)
33  {
34  DDTranslation const & t = (*it)->translation();
35  theNavigator.LocateGlobalPointAndSetup(G4ThreeVector(t.x(),t.y(),t.z()));
36  G4TouchableHistory * hist = theNavigator.CreateTouchableHistory();
38 
39 #ifdef DEBUG
40  u_int32_t oldsize = myDirectMap.size();
41 #endif
42 
43  myMap[st] = nav_type((*it)->navType().begin(),(*it)->navType().end());
44  myDirectMap[st] = (*it)->geographicalID();
45 
46  /*
47 #ifdef DEBUG
48  LogDebug("TrackerSimDebugNumbering")<< " INSERTING "<<view.logicalPart().name()<<" "<<t<<" "<<hist->GetVolume()->GetLogicalVolume()->GetName();
49  LogDebug("TrackerSimDebugNumbering")<<" Sensitive: "<<hist->GetVolume()->GetLogicalVolume()->GetSensitiveDetector()<<std::endl;
50  LogDebug("TrackerSimDebugNumbering")<<"Now size is "<<myDirectMap.size()<<std::endl;
51  if (oldsize == myDirectMap.size())
52  edm::LogError("TrackerSimInfoNumbering")<< "Touchable to History Error!!!!";
53  dumpG4VPV(hist);
54 #endif
55  */
56  delete hist;
57 
58  }
59  edm::LogInfo("TrackerSimInfoNumbering")<<" TouchableToHistory: mapped "<<myDirectMap.size()<<" detectors to G4.";
60 
61  if (myDirectMap.size() != allSensitiveDets.size()){
62  edm::LogError("TrackerSimInfoNumbering")<<" ERROR: DDD sensitive detectors do not match Geant4 ones.";
63  //FIXME use throw
64  abort();
65  }
66 
67 
68 }
DirectMapType myDirectMap
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
const GeometricDet * myGeomDet
std::vector< int > nav_type
Nav_Story touchableToNavStory(const G4VTouchable *)
std::vector< std::pair< int, std::string > > Nav_Story
ConstGeometricDetContainer deepComponents() const
void TouchableToHistory::dumpG4VPV ( const G4VTouchable *  v)
private

Definition at line 145 of file TouchableToHistory.cc.

References gen::k, and LogDebug.

Referenced by touchableToInt(), and touchableToNavType().

145  {
146  int levels = v->GetHistoryDepth();
147 
148  LogDebug("TrackerSimDebugNumbering")<<" NAME : "<<v->GetVolume()->GetLogicalVolume()->GetName();
149  for (int k=0; k<=levels; k++){
150  LogDebug("TrackerSimInfoNumbering") <<" Hist: "<< v->GetVolume(k)->GetLogicalVolume()->GetName()<<
151  " Copy "<< v->GetVolume(k)->GetCopyNo();
152  }
153 }
#define LogDebug(id)
int k[5][pyjets_maxn]
mathSSE::Vec4< T > v
DDFilteredView & TouchableToHistory::getFilteredView ( const G4VTouchable &  t,
DDFilteredView f 
)

Definition at line 70 of file TouchableToHistory.cc.

References alreadySet, buildAll(), f, DDFilteredView::goTo(), myMap, and touchableToNavStory().

70  {
71  if (alreadySet == false)
72  buildAll();
74  return f;
75 }
bool goTo(const nav_type &)
Nav_Story touchableToNavStory(const G4VTouchable *)
double f[11][100]
TouchableToHistory::Nav_Story TouchableToHistory::getNavStory ( DDFilteredView i)

Definition at line 82 of file TouchableToHistory.cc.

References alreadySet, buildAll(), estimatePileup::hist, matplotRender::t, cond::rpcobtemp::temp, touchableToNavStory(), and DDFilteredView::translation().

82  {
83  if (alreadySet == false) buildAll();
85 
86  G4Navigator* theStdNavigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
87  G4Navigator theNavigator;
88  theNavigator.SetWorldVolume(theStdNavigator->GetWorldVolume());
89 
90  theNavigator.LocateGlobalPointAndSetup(G4ThreeVector(t.x(),t.y(),t.z()));
91  G4TouchableHistory* hist = theNavigator.CreateTouchableHistory();
93  delete hist;
94  return (temp);
95 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Nav_Story touchableToNavStory(const G4VTouchable *)
std::vector< std::pair< int, std::string > > Nav_Story
const DDTranslation & translation() const
The absolute translation of the current node.
TouchableToHistory::nav_type TouchableToHistory::getNavType ( const G4VTouchable &  t)

Definition at line 76 of file TouchableToHistory.cc.

References alreadySet, myMap, and touchableToNavStory().

76  {
77  if (alreadySet == false)
78  edm::LogError("TrackerSimInfoNumbering")<<" NOT READY ";
79  return myMap[touchableToNavStory(&t)];
80 }
Nav_Story touchableToNavStory(const G4VTouchable *)
G4VPhysicalVolume& TouchableToHistory::getTouchable ( DDFilteredView )
int TouchableToHistory::touchableToInt ( const G4VTouchable *  v)

Definition at line 134 of file TouchableToHistory.cc.

References alreadySet, buildAll(), dumpG4VPV(), LogDebug, myDirectMap, and touchableToNavStory().

Referenced by TrackerG4SimHitNumberingScheme::g4ToNumberingScheme().

134  {
135  if (alreadySet == false)
136  buildAll();
137 
138  dumpG4VPV(v);
139 
140  LogDebug("TrackerSimDebugNumbering")<<" Returning: "<< myDirectMap[touchableToNavStory(v)]<<std::endl;
141 
143 }
#define LogDebug(id)
DirectMapType myDirectMap
Nav_Story touchableToNavStory(const G4VTouchable *)
void dumpG4VPV(const G4VTouchable *)
mathSSE::Vec4< T > v
TouchableToHistory::Nav_Story TouchableToHistory::touchableToNavStory ( const G4VTouchable *  v)

Definition at line 97 of file TouchableToHistory.cc.

References gen::k, LogDebug, and cond::rpcobtemp::temp.

Referenced by buildAll(), getFilteredView(), getNavStory(), getNavType(), touchableToInt(), and touchableToNavType().

97  {
98  static G4String tobinactive("TOBInactive");
100 #ifdef DEBUG
101  std::vector<int> debugint;
102  std::vector<std::string> debugstring;
103 #endif
104  int levels = v->GetHistoryDepth();
105 
106  for (int k=0; k<=levels; k++){
107  if (v->GetVolume(k)->GetLogicalVolume()->GetName() != tobinactive) {
108  temp.push_back(
109  std::pair<int,std::string>
110  (v->GetVolume(k)->GetCopyNo(),
111  v->GetVolume(k)->GetLogicalVolume()->GetName()));
112 #ifdef DEBUG
113  debugint.push_back(v->GetVolume(k)->GetCopyNo());
114  debugstring.push_back(v->GetVolume(k)->GetLogicalVolume()->GetName());
115 #endif
116  }
117  }
118 #ifdef DEBUG
119  // LogDebug("TrackerSimDebugNumbering")<<" G4 TouchableToHistory "<< debugint;
120  for(u_int32_t jj=0;jj<debugstring.size();jj++)LogDebug("TrackerSimDebugNumbering")<<" "<<debugstring[jj];
121 #endif
122  return temp;
123 }
#define LogDebug(id)
int k[5][pyjets_maxn]
std::vector< std::pair< int, std::string > > Nav_Story
mathSSE::Vec4< T > v
TouchableToHistory::nav_type TouchableToHistory::touchableToNavType ( const G4VTouchable *  v)

Definition at line 125 of file TouchableToHistory.cc.

References alreadySet, buildAll(), dumpG4VPV(), myMap, and touchableToNavStory().

125  {
126  if (alreadySet == false)
127  buildAll();
128 
129  dumpG4VPV(v);
130 
131  return myMap[touchableToNavStory(v)];
132 }
Nav_Story touchableToNavStory(const G4VTouchable *)
void dumpG4VPV(const G4VTouchable *)
mathSSE::Vec4< T > v

Member Data Documentation

bool TouchableToHistory::alreadySet
private
const DDCompactView* TouchableToHistory::myCompactView
private

Definition at line 39 of file TouchableToHistory.h.

DirectMapType TouchableToHistory::myDirectMap
private

Definition at line 37 of file TouchableToHistory.h.

Referenced by buildAll(), and touchableToInt().

const GeometricDet* TouchableToHistory::myGeomDet
private

Definition at line 40 of file TouchableToHistory.h.

Referenced by buildAll().

MapType TouchableToHistory::myMap
private

Definition at line 36 of file TouchableToHistory.h.

Referenced by buildAll(), getFilteredView(), getNavType(), and touchableToNavType().