3 #include "TEveGeoNode.h"
30 if (gSystem->Getenv(
"CMSSW_SEARCH_PATH" ))
32 TString
paths = gSystem->Getenv(
"CMSSW_SEARCH_PATH" );
33 TObjArray* tokens = paths.Tokenize(
":" );
34 for(
int i = 0;
i < tokens->GetEntries(); ++
i )
36 TObjString*
path = (TObjString*)tokens->At(
i );
38 searchPath += path->GetString();
39 searchPath +=
"/Fireworks/Geometry/data/";
44 const char* fp = gSystem->FindFile(searchPath.c_str(), fn, kFileExists);
45 return fp ? TFile::Open( fp) : 0;
54 throw std::runtime_error(
"ERROR: failed to find geometry file. Initialization failed." );
58 TTree*
tree =
static_cast<TTree*
>(file->Get(
"idToGeo" ));
61 throw std::runtime_error(
"ERROR: cannot find detector id map in the file. Initialization failed." );
69 Float_t translation[3];
71 bool loadPoints = tree->GetBranch(
"points" ) != 0;
72 bool loadParameters = tree->GetBranch(
"topology" ) != 0;
73 bool loadShape = tree->GetBranch(
"shape" ) != 0;
74 bool loadTranslation = tree->GetBranch(
"translation" ) != 0;
75 bool loadMatrix = tree->GetBranch(
"matrix" ) != 0;
76 tree->SetBranchAddress(
"id", &
id );
78 tree->SetBranchAddress(
"points", &points );
80 tree->SetBranchAddress(
"topology", &topology );
82 tree->SetBranchAddress(
"shape", &shape );
84 tree->SetBranchAddress(
"translation", &translation );
86 tree->SetBranchAddress(
"matrix", &matrix );
88 unsigned int treeSize = tree->GetEntries();
91 for(
unsigned int i = 0;
i < treeSize; ++
i )
98 for(
unsigned int j = 0;
j < 24; ++
j )
103 for(
unsigned int j = 0;
j < 9; ++
j )
108 for(
unsigned int j = 0;
j < 5; ++
j )
111 if( loadTranslation )
113 for(
unsigned int j = 0;
j < 3; ++
j )
118 for(
unsigned int j = 0;
j < 9; ++
j )
128 TString
path = file->GetPath();
129 if (path.EndsWith(
":/")) path.Resize(path.Length() -2);
134 fwLog(
fwlog::kInfo ) << Form(
"Load %s from %s\n ", tree->GetName(), path.Data());
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;
340 const float* local2,
float* global2,
bool translatep )
const
359 return std::lower_bound( begin, end,
id );
365 for(
int i = 0;
i < 3; ++
i )
368 global[
i] += 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
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