3 #include "TEveGeoNode.h"
29 if (gSystem->Getenv(
"CMSSW_SEARCH_PATH" ))
31 TString
paths = gSystem->Getenv(
"CMSSW_SEARCH_PATH" );
32 TObjArray* tokens = paths.Tokenize(
":" );
33 for(
int i = 0;
i < tokens->GetEntries(); ++
i )
35 TObjString*
path = (TObjString*)tokens->At(
i );
37 searchPath += path->GetString();
38 searchPath +=
"/Fireworks/Geometry/data/";
43 const char* fp = gSystem->FindFile(searchPath.c_str(), fn, kFileExists);
44 return fp ? TFile::Open( fp) : 0;
53 throw std::runtime_error(
"ERROR: failed to find geometry file. Initialization failed." );
56 TTree*
tree =
static_cast<TTree*
>(file->Get(
"idToGeo" ));
59 throw std::runtime_error(
"ERROR: cannot find detector id map in the file. Initialization failed." );
67 Float_t translation[3];
69 bool loadPoints = tree->GetBranch(
"points" ) != 0;
70 bool loadParameters = tree->GetBranch(
"topology" ) != 0;
71 bool loadShape = tree->GetBranch(
"shape" ) != 0;
72 bool loadTranslation = tree->GetBranch(
"translation" ) != 0;
73 bool loadMatrix = tree->GetBranch(
"matrix" ) != 0;
74 tree->SetBranchAddress(
"id", &
id );
76 tree->SetBranchAddress(
"points", &points );
78 tree->SetBranchAddress(
"topology", &topology );
80 tree->SetBranchAddress(
"shape", &shape );
82 tree->SetBranchAddress(
"translation", &translation );
84 tree->SetBranchAddress(
"matrix", &matrix );
86 unsigned int treeSize = tree->GetEntries();
89 for(
unsigned int i = 0;
i < treeSize; ++
i )
96 for(
unsigned int j = 0;
j < 24; ++
j )
101 for(
unsigned int j = 0;
j < 9; ++
j )
106 for(
unsigned int j = 0;
j < 5; ++
j )
109 if( loadTranslation )
111 for(
unsigned int j = 0;
j < 3; ++
j )
116 for(
unsigned int j = 0;
j < 9; ++
j )
128 unsigned int mapSize = map.size();
133 it !=
end; ++it, ++
i )
136 for(
unsigned int j = 0;
j < 24; ++
j )
138 for(
unsigned int j = 0;
j < 9; ++
j )
140 for(
unsigned int j = 0;
j < 5; ++
j )
142 for(
unsigned int j = 0;
j < 3; ++
j )
144 for(
unsigned int j = 0;
j < 9; ++
j )
152 std::map<unsigned int, TGeoMatrix*>::iterator mit =
m_idToMatrix.find(
id );
170 rotation.SetMatrix( matrix );
172 m_idToMatrix[id] =
new TGeoCombiTrans( trans, rotation );
177 std::vector<unsigned int>
180 std::vector<unsigned int> ids;
181 unsigned int mask = ( det << 4 ) | ( subdet );
186 ids.push_back(( *it ).id );
210 TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
211 TGeoShape* geoShape = 0;
212 if( info.
shape[0] == 1 )
214 geoShape =
new TGeoTrap(
228 geoShape =
new TGeoBBox( info.
shape[1], info.
shape[2], info.
shape[3] );
250 TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
251 TEveGeoShape* shape =
new TEveGeoShape(TString::Format(
"RecoGeom Id=%u",
id));
252 TGeoShape* geoShape =
getShape( info );
253 shape->SetShape( geoShape );
255 shape->SetTransMatrix( array );
272 return ( *it ).points;
288 return ( *it ).parameters;
304 return ( *it ).shape;
324 const float* local2,
float* global2,
bool translatep )
const
343 return std::lower_bound( begin, end,
id );
349 for(
int i = 0;
i < 3; ++
i )
352 global[
i] += local[0] * info.
matrix[3 *
i]
353 + local[1] * info.
matrix[3 *
i + 1]
354 + 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)
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
tuple path
else: Piece not in the list, fine.
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