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, lumiQTWidget::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 144 of file TouchableToHistory.cc.

References relval_2017::k, and LogDebug.

Referenced by touchableToInt(), and touchableToNavType().

144  {
145  int levels = v->GetHistoryDepth();
146 
147  LogDebug("TrackerSimDebugNumbering")<<" NAME : "<<v->GetVolume()->GetLogicalVolume()->GetName();
148  for (int k=0; k<=levels; k++){
149  LogDebug("TrackerSimInfoNumbering") <<" Hist: "<< v->GetVolume(k)->GetLogicalVolume()->GetName()<<
150  " Copy "<< v->GetVolume(k)->GetCopyNo();
151  }
152 }
#define LogDebug(id)
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, lumiQTWidget::t, groupFilesInBlocks::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 133 of file TouchableToHistory.cc.

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

Referenced by TrackerG4SimHitNumberingScheme::g4ToNumberingScheme().

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

Definition at line 97 of file TouchableToHistory.cc.

References findQualityFiles::jj, relval_2017::k, LogDebug, and groupFilesInBlocks::temp.

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

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

Definition at line 124 of file TouchableToHistory.cc.

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

124  {
125  if (alreadySet == false)
126  buildAll();
127 
128  dumpG4VPV(v);
129 
130  return myMap[touchableToNavStory(v)];
131 }
Nav_Story touchableToNavStory(const G4VTouchable *)
void dumpG4VPV(const G4VTouchable *)

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