3 #include "TEveGeoNode.h"
30 if (gSystem->Getenv(
"CMSSW_SEARCH_PATH" ))
33 TString
paths = gSystem->Getenv(
"CMSSW_SEARCH_PATH" );
35 TObjArray* tokens = paths.Tokenize(
":" );
36 for(
int i = 0;
i < tokens->GetEntries(); ++
i )
38 TObjString*
path = (TObjString*)tokens->At(
i );
40 searchPath += path->GetString();
41 if (gSystem->Getenv(
"CMSSW_VERSION"))
42 searchPath +=
"/Fireworks/Geometry/data/";
47 const char* fp = gSystem->FindFile(searchPath.c_str(), fn, kFileExists);
48 return fp ? TFile::Open( fp) : 0;
57 throw std::runtime_error(
"ERROR: failed to find geometry file. Initialization failed." );
61 TTree*
tree =
static_cast<TTree*
>(file->Get(
"idToGeo" ));
64 throw std::runtime_error(
"ERROR: cannot find detector id map in the file. Initialization failed." );
72 Float_t translation[3];
74 bool loadPoints = tree->GetBranch(
"points" ) != 0;
75 bool loadParameters = tree->GetBranch(
"topology" ) != 0;
76 bool loadShape = tree->GetBranch(
"shape" ) != 0;
77 bool loadTranslation = tree->GetBranch(
"translation" ) != 0;
78 bool loadMatrix = tree->GetBranch(
"matrix" ) != 0;
79 tree->SetBranchAddress(
"id", &
id );
81 tree->SetBranchAddress(
"points", &points );
83 tree->SetBranchAddress(
"topology", &topology );
85 tree->SetBranchAddress(
"shape", &shape );
87 tree->SetBranchAddress(
"translation", &translation );
89 tree->SetBranchAddress(
"matrix", &matrix );
91 unsigned int treeSize = tree->GetEntries();
94 for(
unsigned int i = 0;
i < treeSize; ++
i )
101 for(
unsigned int j = 0;
j < 24; ++
j )
106 for(
unsigned int j = 0;
j < 9; ++
j )
111 for(
unsigned int j = 0;
j < 5; ++
j )
114 if( loadTranslation )
116 for(
unsigned int j = 0;
j < 3; ++
j )
121 for(
unsigned int j = 0;
j < 9; ++
j )
131 TString
path = file->GetPath();
132 if (path.EndsWith(
":/")) path.Resize(path.Length() -2);
137 fwLog(
fwlog::kInfo ) << Form(
"Load %s from %s\n", tree->GetName(), path.Data());
147 unsigned int mapSize = map.size();
152 it !=
end; ++it, ++
i )
155 for(
unsigned int j = 0;
j < 24; ++
j )
157 for(
unsigned int j = 0;
j < 9; ++
j )
159 for(
unsigned int j = 0;
j < 5; ++
j )
161 for(
unsigned int j = 0;
j < 3; ++
j )
163 for(
unsigned int j = 0;
j < 9; ++
j )
171 std::map<unsigned int, TGeoMatrix*>::iterator mit =
m_idToMatrix.find(
id );
189 rotation.SetMatrix( matrix );
191 m_idToMatrix[id] =
new TGeoCombiTrans( trans, rotation );
196 std::vector<unsigned int>
199 std::vector<unsigned int> ids;
200 unsigned int mask = ( det << 4 ) | ( subdet );
205 ids.push_back(( *it ).id );
229 TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
230 TGeoShape* geoShape = 0;
231 if( info.
shape[0] == 1 )
233 geoShape =
new TGeoTrap(
247 geoShape =
new TGeoBBox( info.
shape[1], info.
shape[2], info.
shape[3] );
269 TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
270 TEveGeoShape* shape =
new TEveGeoShape(TString::Format(
"RecoGeom Id=%u",
id));
271 TGeoShape* geoShape =
getShape( info );
272 shape->SetShape( geoShape );
274 shape->SetTransMatrix( array );
291 return ( *it ).points;
307 return ( *it ).parameters;
323 return ( *it ).shape;
343 const float* local2,
float* global2,
bool translatep )
const
362 return std::lower_bound( begin, end,
id );
368 for(
int i = 0;
i < 3; ++
i )
371 global[
i] += local[0] * info.
matrix[3 *
i]
372 + local[1] * info.
matrix[3 *
i + 1]
373 + local[2] * info.
matrix[3 *
i + 2];
static TFile * findFile(const char *fileName)
std::vector< FWRecoGeom::Info >::const_iterator InfoMapItr
TObjArray * extraDetectors
void initMap(const FWRecoGeom::InfoMap &map)
CaloTopology const * topology(0)
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
const TGeoMatrix * getMatrix(unsigned int id) const
std::map< unsigned int, TGeoMatrix * > m_idToMatrix
const float * getShapePars(unsigned int id) const
bool haveExtraDet(const char *) const
tuple path
else: Piece not in the list, fine.
VersionInfo m_versionInfo
TEveGeoShape * getEveShape(unsigned int id) const
void loadMap(const char *fileName)
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
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