3 #include "TEveGeoNode.h"
28 if( fileName[0] ==
'/' || ( fileName[0] ==
'.' && fileName[1] ==
'/' ))
34 if(
const char* cmspath = gSystem->Getenv(
"CMSSW_BASE" ))
41 if( !gSystem->AccessPathName( file.Data()))
43 return TFile::Open( file );
46 const char* searchpath = gSystem->Getenv(
"CMSSW_SEARCH_PATH" );
49 TString
paths( searchpath );
50 TObjArray* tokens = paths.Tokenize(
":" );
51 for(
int i = 0;
i < tokens->GetEntries(); ++
i )
53 TObjString*
path = (TObjString*)tokens->At(
i );
54 TString fullFileName( path->GetString());
55 fullFileName +=
"/Fireworks/Geometry/data/";
57 if( !gSystem->AccessPathName( fullFileName.Data()))
58 return TFile::Open( fullFileName.Data());
69 throw std::runtime_error(
"ERROR: failed to find geometry file. Initialization failed." );
72 TTree*
tree =
static_cast<TTree*
>(file->Get(
"idToGeo" ));
75 throw std::runtime_error(
"ERROR: cannot find detector id map in the file. Initialization failed." );
83 Float_t translation[3];
85 bool loadPoints = tree->GetBranch(
"points" ) != 0;
86 bool loadParameters = tree->GetBranch(
"topology" ) != 0;
87 bool loadShape = tree->GetBranch(
"shape" ) != 0;
88 bool loadTranslation = tree->GetBranch(
"translation" ) != 0;
89 bool loadMatrix = tree->GetBranch(
"matrix" ) != 0;
90 tree->SetBranchAddress(
"id", &
id );
92 tree->SetBranchAddress(
"points", &points );
94 tree->SetBranchAddress(
"topology", &topology );
96 tree->SetBranchAddress(
"shape", &shape );
98 tree->SetBranchAddress(
"translation", &translation );
100 tree->SetBranchAddress(
"matrix", &matrix );
102 unsigned int treeSize = tree->GetEntries();
105 for(
unsigned int i = 0;
i < treeSize; ++
i )
112 for(
unsigned int j = 0;
j < 24; ++
j )
117 for(
unsigned int j = 0;
j < 9; ++
j )
122 for(
unsigned int j = 0;
j < 5; ++
j )
125 if( loadTranslation )
127 for(
unsigned int j = 0;
j < 3; ++
j )
132 for(
unsigned int j = 0;
j < 9; ++
j )
144 unsigned int mapSize = map.size();
149 it !=
end; ++it, ++
i )
152 for(
unsigned int j = 0;
j < 24; ++
j )
154 for(
unsigned int j = 0;
j < 9; ++
j )
156 for(
unsigned int j = 0;
j < 5; ++
j )
158 for(
unsigned int j = 0;
j < 3; ++
j )
160 for(
unsigned int j = 0;
j < 9; ++
j )
168 std::map<unsigned int, TGeoMatrix*>::iterator mit =
m_idToMatrix.find(
id );
186 rotation.SetMatrix( matrix );
188 m_idToMatrix[id] =
new TGeoCombiTrans( trans, rotation );
193 std::vector<unsigned int>
196 std::vector<unsigned int> ids;
197 unsigned int mask = ( det << 4 ) | ( subdet );
202 ids.push_back(( *it ).id );
226 TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
227 TGeoShape* geoShape = 0;
228 if( info.
shape[0] == 1 )
230 geoShape =
new TGeoTrap(
244 geoShape =
new TGeoBBox( info.
shape[1], info.
shape[2], info.
shape[3] );
266 TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
267 TEveGeoShape* shape =
new TEveGeoShape(TString::Format(
"RecoGeom Id=%u",
id));
268 TGeoShape* geoShape =
getShape( info );
269 shape->SetShape( geoShape );
271 shape->SetTransMatrix( array );
288 return ( *it ).points;
304 return ( *it ).parameters;
320 return ( *it ).shape;
358 return std::lower_bound( begin, end,
id );
364 for(
int i = 0;
i < 3; ++
i )
367 + local[0] * info.
matrix[3 *
i]
368 + local[1] * info.
matrix[3 *
i + 1]
369 + 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