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." );
57 TTree*
tree =
static_cast<TTree*
>(file->Get(
"idToGeo" ));
60 throw std::runtime_error(
"ERROR: cannot find detector id map in the file. Initialization failed." );
68 Float_t translation[3];
70 bool loadPoints = tree->GetBranch(
"points" ) != 0;
71 bool loadParameters = tree->GetBranch(
"topology" ) != 0;
72 bool loadShape = tree->GetBranch(
"shape" ) != 0;
73 bool loadTranslation = tree->GetBranch(
"translation" ) != 0;
74 bool loadMatrix = tree->GetBranch(
"matrix" ) != 0;
75 tree->SetBranchAddress(
"id", &
id );
77 tree->SetBranchAddress(
"points", &points );
79 tree->SetBranchAddress(
"topology", &topology );
81 tree->SetBranchAddress(
"shape", &shape );
83 tree->SetBranchAddress(
"translation", &translation );
85 tree->SetBranchAddress(
"matrix", &matrix );
87 unsigned int treeSize = tree->GetEntries();
90 for(
unsigned int i = 0;
i < treeSize; ++
i )
97 for(
unsigned int j = 0;
j < 24; ++
j )
102 for(
unsigned int j = 0;
j < 9; ++
j )
107 for(
unsigned int j = 0;
j < 5; ++
j )
110 if( loadTranslation )
112 for(
unsigned int j = 0;
j < 3; ++
j )
117 for(
unsigned int j = 0;
j < 9; ++
j )
123 TNamed*
tag =
static_cast<TNamed*
>(file->Get(
"TAG" ));
129 TNamed*
version =
static_cast<TNamed*
>(file->Get(
"CMSSW_VERSION" ));
132 fwLog(
fwlog::kInfo ) << Form(
"Load %s %s from %s\n ", tree->GetName(), version->GetTitle(), file->GetPath());
134 fwLog(
fwlog::kInfo ) << Form(
"Load %s from %s\n ", tree->GetName(), file->GetPath());
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];
378 if (!strncmp(tag,
"2015",4))
382 else if (!strncmp(tag,
"2019",4))
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.
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
void ProcessProductionTag(const char *)
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr