3 #include "TEveGeoNode.h"
19 : m_idToInfo( 260000 )
29 if( fileName[0] ==
'/' )
35 if(
const char* cmspath = gSystem->Getenv(
"CMSSW_BASE" ))
42 if( !gSystem->AccessPathName( file.Data()))
44 return TFile::Open( file );
47 const char* searchpath = gSystem->Getenv(
"CMSSW_SEARCH_PATH" );
50 TString
paths( searchpath );
51 TObjArray*
tokens = paths.Tokenize(
":" );
52 for(
int i = 0;
i < tokens->GetEntries(); ++
i )
54 TObjString*
path = (TObjString*)tokens->At(
i );
55 TString fullFileName( path->GetString());
56 fullFileName +=
"/Fireworks/Geometry/data/";
58 if( !gSystem->AccessPathName( fullFileName.Data()))
59 return TFile::Open( fullFileName.Data());
70 throw std::runtime_error(
"ERROR: failed to find geometry file. Initialization failed." );
73 TTree*
tree =
static_cast<TTree*
>(file->Get(
"idToGeo" ));
76 throw std::runtime_error(
"ERROR: cannot find detector id map in the file. Initialization failed." );
84 Float_t translation[3];
86 bool loadPoints = tree->GetBranch(
"points" ) != 0;
87 bool loadParameters = tree->GetBranch(
"topology" ) != 0;
88 bool loadShape = tree->GetBranch(
"shape" ) != 0;
89 bool loadTranslation = tree->GetBranch(
"translation" ) != 0;
90 bool loadMatrix = tree->GetBranch(
"matrix" ) != 0;
91 tree->SetBranchAddress(
"id", &
id );
93 tree->SetBranchAddress(
"points", &points );
95 tree->SetBranchAddress(
"topology", &topology );
97 tree->SetBranchAddress(
"shape", &shape );
99 tree->SetBranchAddress(
"translation", &translation );
101 tree->SetBranchAddress(
"matrix", &matrix );
103 unsigned int treeSize = tree->GetEntries();
106 for(
unsigned int i = 0;
i < treeSize; ++
i )
113 for(
unsigned int j = 0;
j < 24; ++
j )
118 for(
unsigned int j = 0;
j < 9; ++
j )
123 for(
unsigned int j = 0;
j < 5; ++
j )
126 if( loadTranslation )
128 for(
unsigned int j = 0;
j < 3; ++
j )
133 for(
unsigned int j = 0;
j < 9; ++
j )
145 unsigned int mapSize = map.size();
150 it !=
end; ++it, ++
i )
153 for(
unsigned int j = 0;
j < 24; ++
j )
155 for(
unsigned int j = 0;
j < 9; ++
j )
157 for(
unsigned int j = 0;
j < 5; ++
j )
159 for(
unsigned int j = 0;
j < 3; ++
j )
161 for(
unsigned int j = 0;
j < 9; ++
j )
169 std::map<unsigned int, TGeoMatrix*>::iterator mit =
m_idToMatrix.find(
id );
182 TGeoRotation rotation;
187 rotation.SetMatrix( matrix );
189 m_idToMatrix[id] =
new TGeoCombiTrans( trans, rotation );
194 std::vector<unsigned int>
197 std::vector<unsigned int> ids;
198 unsigned int mask = ( det << 4 ) | ( subdet );
203 ids.push_back(( *it ).id );
227 TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
228 TGeoShape* geoShape = 0;
229 if( info.
shape[0] == 1 )
231 geoShape =
new TGeoTrap(
245 geoShape =
new TGeoBBox( info.
shape[1], info.
shape[2], info.
shape[3] );
267 TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
268 TEveGeoShape* shape =
new TEveGeoShape;
269 TGeoShape* geoShape =
getShape( info );
270 shape->SetShape( geoShape );
272 shape->SetTransMatrix( array );
289 return ( *it ).points;
305 return ( *it ).parameters;
321 return ( *it ).shape;
359 return std::lower_bound( begin, end,
id );
365 for(
int i = 0;
i < 3; ++
i )
368 + local[0] * info.
matrix[3 *
i]
369 + local[1] * info.
matrix[3 *
i + 1]
370 + local[2] * info.
matrix[3 *
i + 2];
static TFile * findFile(const char *fileName)
std::vector< FWRecoGeom::Info >::const_iterator InfoMapItr
void initMap(const FWRecoGeom::InfoMap &map)
IdToInfoItr find(unsigned int) const
const float * getParameters(unsigned int id) const
bool match_id(const GeomDetInfo &o, unsigned int mask) const
TGeoShape * getShape(unsigned int id) const
void localToGlobal(unsigned int id, const float *local, float *global) const
const TGeoMatrix * getMatrix(unsigned int id) const
std::map< unsigned int, TGeoMatrix * > m_idToMatrix
const float * getShapePars(unsigned int id) const
TEveGeoShape * getEveShape(unsigned int id) const
void loadMap(const char *fileName)
std::vector< FWRecoGeom::Info > InfoMap
const float * getCorners(unsigned int id) const
std::vector< unsigned int > getMatchedIds(Detector det, SubDetector subdet) const
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr