CMS 3D CMS Logo

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

#include <TrackerG4SimHitNumberingScheme.h>

Public Types

typedef std::map< Nav_Story, unsigned int > DirectMapType
 
typedef std::map< Nav_Story, Nav_typeMapType
 
typedef std::vector< std::pair< int, std::string > > Nav_Story
 
typedef std::vector< int > Nav_type
 

Public Member Functions

unsigned int g4ToNumberingScheme (const G4VTouchable *)
 
const DDFilteredViewgetFilteredView (const G4VTouchable &, DDFilteredView &)
 
const G4VPhysicalVolume & getTouchable (DDFilteredView &)
 
 TrackerG4SimHitNumberingScheme (const DDCompactView &, const GeometricDet &)
 
 ~TrackerG4SimHitNumberingScheme ()
 

Private Member Functions

void buildAll ()
 
void dumpG4VPV (const G4VTouchable *)
 
void getNavStory (DDFilteredView &, Nav_Story &)
 
Nav_typegetNavType (const G4VTouchable &)
 
Nav_typetouchableToNavType (const G4VTouchable *)
 
void touchToNavStory (const G4VTouchable *, Nav_Story &)
 

Private Attributes

bool alreadySet
 
const DDCompactViewmyCompactView
 
DirectMapType myDirectMap
 
const GeometricDetmyGeomDet
 
MapType myMap
 

Detailed Description

Definition at line 14 of file TrackerG4SimHitNumberingScheme.h.

Member Typedef Documentation

Definition at line 23 of file TrackerG4SimHitNumberingScheme.h.

Definition at line 22 of file TrackerG4SimHitNumberingScheme.h.

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

Definition at line 21 of file TrackerG4SimHitNumberingScheme.h.

typedef std::vector<int> TrackerG4SimHitNumberingScheme::Nav_type

Definition at line 20 of file TrackerG4SimHitNumberingScheme.h.

Constructor & Destructor Documentation

TrackerG4SimHitNumberingScheme::TrackerG4SimHitNumberingScheme ( const DDCompactView cpv,
const GeometricDet det 
)
TrackerG4SimHitNumberingScheme::~TrackerG4SimHitNumberingScheme ( )

Definition at line 23 of file TrackerG4SimHitNumberingScheme.cc.

23  {
24 }

Member Function Documentation

void TrackerG4SimHitNumberingScheme::buildAll ( )
private

Definition at line 26 of file TrackerG4SimHitNumberingScheme.cc.

References alreadySet, GeometricDet::deepComponents(), Exception, create_public_lumi_plots::hist, LogDebug, myDirectMap, myGeomDet, myMap, protons_cff::t, and touchToNavStory().

Referenced by g4ToNumberingScheme(), getFilteredView(), getNavStory(), getNavType(), and touchableToNavType().

26  {
27  if (alreadySet) return;
28  alreadySet = true;
29 
30  G4Navigator* theStdNavigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
31  G4Navigator theNavigator;
32  theNavigator.SetWorldVolume(theStdNavigator->GetWorldVolume());
33 
34  std::vector<const GeometricDet*> allSensitiveDets;
35  myGeomDet->deepComponents(allSensitiveDets);
36  edm::LogInfo("TrackerSimInfoNumbering")
37  <<" TouchableTo History: got "<<allSensitiveDets.size()
38  <<" sensitive detectors from TrackerMapDDDtoID.";
39 
40  for ( auto & theSD : allSensitiveDets)
41  {
42  DDTranslation const & t = theSD->translation();
43  theNavigator.LocateGlobalPointAndSetup(G4ThreeVector(t.x(),t.y(),t.z()));
44  G4TouchableHistory * hist = theNavigator.CreateTouchableHistory();
46  touchToNavStory(hist, st);
47 
48  myMap[st] = Nav_type(theSD->navType().begin(),theSD->navType().end());
49  myDirectMap[st] = theSD->geographicalID();
50 
51  LogDebug("TrackerSimDebugNumbering")
52  <<" INSERTING LV " <<hist->GetVolume()->GetLogicalVolume()->GetName()
53  <<" SD: "<<hist->GetVolume()->GetLogicalVolume()->GetSensitiveDetector()->GetName()
54  <<" Now size is "<<myDirectMap.size();
55  delete hist;
56  }
57  edm::LogInfo("TrackerSimInfoNumbering")
58  <<" TrackerG4SimHitNumberingScheme: mapped "<<myDirectMap.size()<<" detectors to Geant4.";
59 
60  if (myDirectMap.size() != allSensitiveDets.size()){
61  edm::LogError("TrackerSimInfoNumbering")
62  <<" ERROR: DDD sensitive detectors do not match Geant4 ones.";
63  throw cms::Exception("TrackerG4SimHitNumberingScheme::buildAll")
64  << " cannot resolve structure of tracking sensitive detectors";
65  }
66 }
#define LogDebug(id)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
std::vector< std::pair< int, std::string > > Nav_Story
ConstGeometricDetContainer deepComponents() const
void touchToNavStory(const G4VTouchable *, Nav_Story &)
void TrackerG4SimHitNumberingScheme::dumpG4VPV ( const G4VTouchable *  v)
private

Definition at line 161 of file TrackerG4SimHitNumberingScheme.cc.

References gen::k, jets_cff::levels, and LogDebug.

Referenced by g4ToNumberingScheme(), and touchableToNavType().

161  {
162  int levels = v->GetHistoryDepth();
163 
164  LogDebug("TrackerSimDebugNumbering")<<" NAME : "<<v->GetVolume()->GetLogicalVolume()->GetName();
165  for (int k=0; k<=levels; k++){
166  LogDebug("TrackerSimInfoNumbering") <<" Hist: "<< v->GetVolume(k)->GetLogicalVolume()->GetName()<<
167  " Copy "<< v->GetVolume(k)->GetCopyNo();
168  }
169 }
#define LogDebug(id)
int k[5][pyjets_maxn]
unsigned int TrackerG4SimHitNumberingScheme::g4ToNumberingScheme ( const G4VTouchable *  v)

Definition at line 146 of file TrackerG4SimHitNumberingScheme.cc.

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

Referenced by TkAccumulatingSensitiveDetector::setDetUnitId().

146  {
147  if (alreadySet == false) {
148  buildAll();
149  }
151  touchToNavStory(v, st);
152 
153 #ifdef DEBUG
154  dumpG4VPV(v);
155  LogDebug("TrackerSimDebugNumbering")<<" Returning: "<< myDirectMap[st];
156 #endif
157 
158  return myDirectMap[st];
159 }
#define LogDebug(id)
std::vector< std::pair< int, std::string > > Nav_Story
void touchToNavStory(const G4VTouchable *, Nav_Story &)
const DDFilteredView & TrackerG4SimHitNumberingScheme::getFilteredView ( const G4VTouchable &  t,
DDFilteredView f 
)

Definition at line 69 of file TrackerG4SimHitNumberingScheme.cc.

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

69  {
70  if (alreadySet == false) {
71  buildAll();
72  }
74  touchToNavStory(&t, st);
75  f.goTo(myMap[st]);
76  return f;
77 }
bool goTo(const nav_type &)
std::vector< std::pair< int, std::string > > Nav_Story
double f[11][100]
void touchToNavStory(const G4VTouchable *, Nav_Story &)
void TrackerG4SimHitNumberingScheme::getNavStory ( DDFilteredView i,
TrackerG4SimHitNumberingScheme::Nav_Story st 
)
private

Definition at line 89 of file TrackerG4SimHitNumberingScheme.cc.

References alreadySet, buildAll(), create_public_lumi_plots::hist, protons_cff::t, touchToNavStory(), and DDFilteredView::translation().

90  {
91  if (alreadySet == false) {
92  buildAll();
93  }
94 
95  const DDTranslation& t = i.translation();
96 
97  G4Navigator* theStdNavigator =
98  G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
99  G4Navigator theNavigator;
100  theNavigator.SetWorldVolume(theStdNavigator->GetWorldVolume());
101 
102  theNavigator.LocateGlobalPointAndSetup(G4ThreeVector(t.x(),t.y(),t.z()));
103  G4TouchableHistory* hist = theNavigator.CreateTouchableHistory();
104  touchToNavStory(hist, st);
105  delete hist;
106 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
const DDTranslation & translation() const
The absolute translation of the current node.
void touchToNavStory(const G4VTouchable *, Nav_Story &)
TrackerG4SimHitNumberingScheme::Nav_type & TrackerG4SimHitNumberingScheme::getNavType ( const G4VTouchable &  t)
private
const G4VPhysicalVolume& TrackerG4SimHitNumberingScheme::getTouchable ( DDFilteredView )
TrackerG4SimHitNumberingScheme::Nav_type & TrackerG4SimHitNumberingScheme::touchableToNavType ( const G4VTouchable *  v)
private

Definition at line 134 of file TrackerG4SimHitNumberingScheme.cc.

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

134  {
135  if (alreadySet == false) {
136  buildAll();
137  }
138 #ifdef DEBUG
139  dumpG4VPV(v);
140 #endif
142  touchToNavStory(v, st);
143  return myMap[st];
144 }
std::vector< std::pair< int, std::string > > Nav_Story
void touchToNavStory(const G4VTouchable *, Nav_Story &)
void TrackerG4SimHitNumberingScheme::touchToNavStory ( const G4VTouchable *  v,
TrackerG4SimHitNumberingScheme::Nav_Story st 
)
private

Definition at line 108 of file TrackerG4SimHitNumberingScheme.cc.

References findQualityFiles::jj, gen::k, jets_cff::levels, and LogDebug.

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

109  {
110 #ifdef DEBUG
111  std::vector<int> debugint;
112  std::vector<std::string> debugstring;
113 #endif
114  int levels = v->GetHistoryDepth();
115 
116  for (int k=0; k<=levels; ++k){
117  if (v->GetVolume(k)->GetLogicalVolume()->GetName() != "TOBInactive") {
118  st.push_back(std::pair<int,std::string>
119  (v->GetVolume(k)->GetCopyNo(),
120  v->GetVolume(k)->GetLogicalVolume()->GetName()));
121 #ifdef DEBUG
122  debugint.push_back(v->GetVolume(k)->GetCopyNo());
123  debugstring.push_back(v->GetVolume(k)->GetLogicalVolume()->GetName());
124 #endif
125  }
126  }
127 #ifdef DEBUG
128  LogDebug("TrackerSimDebugNumbering")<<" G4 TrackerG4SimHitNumberingScheme "<< debugint;
129  for(u_int32_t jj=0;jj<debugstring.size();jj++)LogDebug("TrackerSimDebugNumbering")<<" "<<debugstring[jj];
130 #endif
131 }
#define LogDebug(id)
int k[5][pyjets_maxn]

Member Data Documentation

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

Definition at line 46 of file TrackerG4SimHitNumberingScheme.h.

DirectMapType TrackerG4SimHitNumberingScheme::myDirectMap
private

Definition at line 44 of file TrackerG4SimHitNumberingScheme.h.

Referenced by buildAll(), and g4ToNumberingScheme().

const GeometricDet* TrackerG4SimHitNumberingScheme::myGeomDet
private

Definition at line 47 of file TrackerG4SimHitNumberingScheme.h.

Referenced by buildAll().

MapType TrackerG4SimHitNumberingScheme::myMap
private