3 #include "TEveGeoNode.h" 4 #include "TEveGeoShape.h" 9 #include "TObjString.h" 41 if (gSystem->Getenv(
"CMSSW_SEARCH_PATH")) {
42 TString
paths = gSystem->Getenv(
"CMSSW_SEARCH_PATH");
44 TObjArray* tokens =
paths.Tokenize(
":");
45 for (
int i = 0;
i < tokens->GetEntries(); ++
i) {
46 TObjString*
path = (TObjString*)tokens->At(
i);
48 searchPath +=
static_cast<const char*
>(
path->GetString());
49 if (gSystem->Getenv(
"CMSSW_VERSION"))
50 searchPath +=
"/Fireworks/Geometry/data/";
55 const char*
fp = gSystem->FindFile(searchPath.c_str(),
fn, kFileExists);
56 return fp ? TFile::Open(
fp) :
nullptr;
64 TPMERegexp year_re(
"^[^_]+_[a-zA-Z]*20(\\d\\d)_");
65 TPMERegexp run_re(
"^[^_]+_[a-zA-Z]*Run(\\d)_");
69 if (year_re.Match(
test)) {
70 TString
r = year_re[1];
71 int year = atoi(
r.Data());
74 }
else if (
year < 21) {
79 }
else if (run_re.Match(
test)) {
80 TString rn = run_re[1];
84 }
else if (rn ==
"2") {
86 }
else if (rn ==
"4") {
93 fwLog(
fwlog::kWarning) <<
"Could not guess geometry from global tag. Using geometry scenario 2021.\n";
106 throw std::runtime_error(
"ERROR: failed to find geometry file. Initialization failed.");
110 TTree*
tree =
static_cast<TTree*
>(
file->Get(
"idToGeo"));
112 throw std::runtime_error(
"ERROR: cannot find detector id map in the file. Initialization failed.");
120 Float_t translation[3];
122 bool loadPoints =
tree->GetBranch(
"points") !=
nullptr;
123 bool loadParameters =
tree->GetBranch(
"topology") !=
nullptr;
124 bool loadShape =
tree->GetBranch(
"shape") !=
nullptr;
125 bool loadTranslation =
tree->GetBranch(
"translation") !=
nullptr;
126 bool loadMatrix =
tree->GetBranch(
"matrix") !=
nullptr;
127 tree->SetBranchAddress(
"id", &
id);
135 tree->SetBranchAddress(
"translation", &translation);
145 unsigned int treeSize =
tree->GetEntries();
148 for (
unsigned int i = 0;
i < treeSize; ++
i) {
153 for (
unsigned int j = 0;
j < 24; ++
j)
156 if (loadParameters) {
157 for (
unsigned int j = 0;
j < 9; ++
j)
161 for (
unsigned int j = 0;
j < 5; ++
j)
164 if (loadTranslation) {
165 for (
unsigned int j = 0;
j < 3; ++
j)
169 for (
unsigned int j = 0;
j < 9; ++
j)
179 if (
path.EndsWith(
":/"))
188 TNamed* producerInfo =
static_cast<TNamed*
>(
file->Get(
"PRODUCER_VERSION"));
193 TNamed* ttopology =
static_cast<TNamed*
>(
file->Get(
"TrackerTopology"));
206 unsigned int mapSize =
map.size();
212 for (
unsigned int j = 0;
j < 24; ++
j)
214 for (
unsigned int j = 0;
j < 9; ++
j)
216 for (
unsigned int j = 0;
j < 5; ++
j)
218 for (
unsigned int j = 0;
j < 3; ++
j)
220 for (
unsigned int j = 0;
j < 9; ++
j)
226 std::map<unsigned int, TGeoMatrix*>::iterator mit =
m_idToMatrix.find(
id);
236 TGeoTranslation trans(
info.translation[0],
info.translation[1],
info.translation[2]);
255 std::vector<unsigned int> ids;
256 unsigned int mask = (det << 4) | (subdet);
259 ids.push_back((*it).id);
266 std::vector<unsigned int> ids;
275 ids.push_back(
it.id);
279 ids.push_back(
it.id);
297 TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
298 TGeoShape* geoShape =
nullptr;
299 if (
info.shape[0] == 1) {
300 geoShape =
new TGeoTrap(
info.shape[3],
312 geoShape =
new TGeoBBox(
info.shape[1],
info.shape[2],
info.shape[3]);
340 TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
341 TEveGeoShape*
shape =
new TEveGeoShape(TString::Format(
"RecoGeom Id=%u",
id));
343 shape->SetShape(geoShape);
359 TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
360 TEveGeoShape*
shape =
new TEveGeoShape(TString::Format(
"RecoGeom Id=%u",
id));
362 TGeoXtru* geoShape =
new TGeoXtru(2);
365 for (
unsigned int i = 0;
i < 6; ++
i) {
369 geoShape->DefinePolygon(6,
x,
y);
370 geoShape->DefineSection(0,
info.points[2] - 0.0150);
371 geoShape->DefineSection(1,
info.points[2] + 0.0150);
373 shape->SetShape(geoShape);
404 TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
405 TEveGeoShape*
shape =
new TEveGeoShape(TString::Format(
"RecoGeom Id=%u",
id));
407 TGeoXtru* geoShape =
new TGeoXtru(2);
408 Double_t
x[4] = {
info.points[0],
info.points[3],
info.points[6],
info.points[9]};
409 Double_t
y[4] = {
info.points[1],
info.points[4],
info.points[7],
info.points[10]};
411 bool isNeg =
info.shape[3] < 0;
412 geoShape->DefinePolygon(4,
x,
y);
413 geoShape->DefineSection(0, isNeg *
info.shape[3]);
414 geoShape->DefineSection(1, !isNeg *
info.shape[3]);
415 info.translation[2] =
info.points[2];
417 shape->SetShape(geoShape);
457 return (*it).parameters;
482 unsigned int id,
const float* local1,
float* global1,
const float* local2,
float* global2,
bool translatep)
const {
499 for (
int i = 0;
i < 3; ++
i) {
500 global[
i] = translatep ?
info.translation[
i] : 0;
std::unique_ptr< TrackerTopology > m_trackerTopology
static TFile * findFile(const char *fileName)
std::vector< FWRecoGeom::Info >::const_iterator InfoMapItr
TObjArray * extraDetectors
void initMap(const FWRecoGeom::InfoMap &map)
std::vector< unsigned int > getMatchedIds(Detector det, SubDetector subdet) const
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
bool haveExtraDet(const char *) const
std::map< unsigned int, TGeoMatrix * > m_idToMatrix
IdToInfoItr find(unsigned int) const
TEveGeoShape * getHGCScintillatorEveShape(unsigned int id) const
VersionInfo m_versionInfo
const float * getCorners(unsigned int id) const
TEveGeoShape * getHGCSiliconEveShape(unsigned int id) const
void loadMap(const char *fileName)
key
prepare the HTCondor submission files and eventually submit them
std::vector< FWRecoGeom::Info > InfoMap
TEveGeoShape * getEveShape(unsigned int id) const
TGeoShape * getShape(unsigned int id) const
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
const float * getShapePars(unsigned int id) const
const float * getParameters(unsigned int id) const
const TGeoMatrix * getMatrix(unsigned int id) const
TrackerTopology fromTrackerParametersXMLString(const std::string &xmlContent)
void applyGlobalTag(const std::string >)
static const int kDetOffset
bool match_id(const GeomDetInfo &o, unsigned int mask) const
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr