CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes
FWGeometry Class Reference

#include <FWGeometry.h>

Classes

struct  GeomDetInfo
 
struct  Range
 
class  VersionInfo
 

Public Types

enum  Detector {
  Tracker = 1, Muon = 2, Ecal = 3, Hcal = 4,
  Calo = 5, Forward = 6, HGCalEE = 8, HGCalHSi = 9,
  HGCalHSc = 10, HGCalTrigger = 11
}
 
typedef std::vector< FWGeometry::GeomDetInfoIdToInfo
 
typedef std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
 
enum  SubDetector {
  PixelBarrel = 1, PixelEndcap = 2, TIB = 3, TID = 4,
  TOB = 5, TEC = 6, CSC = 7, DT = 8,
  RPCBarrel = 9, RPCEndcap = 10, GEM = 11, ME0 = 12
}
 

Public Member Functions

void applyGlobalTag (const std::string &gt)
 
void clear (void)
 
bool contains (unsigned int id) const
 
IdToInfoItr find (unsigned int) const
 
 FWGeometry (void)
 
const float * getCorners (unsigned int id) const
 
TEveGeoShape * getEveShape (unsigned int id) const
 
TEveGeoShape * getHGCScintillatorEveShape (unsigned int id) const
 
TEveGeoShape * getHGCSiliconEveShape (unsigned int id) const
 
std::vector< unsigned int > getMatchedIds (Detector det, SubDetector subdet) const
 
std::vector< unsigned int > getMatchedIds (Detector det) const
 
const TGeoMatrix * getMatrix (unsigned int id) const
 
const float * getParameters (unsigned int id) const
 
int getProducerVersion () const
 
TGeoShape * getShape (unsigned int id) const
 
TGeoShape * getShape (const GeomDetInfo &info) const
 
const float * getShapePars (unsigned int id) const
 
const TrackerTopologygetTrackerTopology () const
 
void initMap (const FWRecoGeom::InfoMap &map)
 
bool isEmpty () const
 
void loadMap (const char *fileName)
 
void localToGlobal (unsigned int id, const float *local, float *global, bool translatep=true) const
 
void localToGlobal (unsigned int id, const float *local1, float *global1, const float *local2, float *global2, bool translatep=true) const
 
void localToGlobal (const GeomDetInfo &info, const float *local, float *global, bool translatep=true) const
 
IdToInfoItr mapEnd () const
 
bool match_id (const GeomDetInfo &o, unsigned int mask) const
 
const VersionInfoversionInfo () const
 
 ~FWGeometry (void)
 

Static Public Member Functions

static TFile * findFile (const char *fileName)
 

Static Public Attributes

static const int kDetOffset = 28
 
static const int kSubdetOffset = 25
 

Private Attributes

std::string m_fileName
 
IdToInfo m_idToInfo
 
std::map< unsigned int, TGeoMatrix * > m_idToMatrix
 
std::string m_prodTag
 
int m_producerVersion
 
std::unique_ptr< TrackerTopologym_trackerTopology
 
VersionInfo m_versionInfo
 

Detailed Description

Definition at line 27 of file FWGeometry.h.

Member Typedef Documentation

◆ IdToInfo

Definition at line 137 of file FWGeometry.h.

◆ IdToInfoItr

typedef std::vector<FWGeometry::GeomDetInfo>::const_iterator FWGeometry::IdToInfoItr

Definition at line 138 of file FWGeometry.h.

Member Enumeration Documentation

◆ Detector

Enumerator
Tracker 
Muon 
Ecal 
Hcal 
Calo 
Forward 
HGCalEE 
HGCalHSi 
HGCalHSc 
HGCalTrigger 

Definition at line 32 of file FWGeometry.h.

32  {
33  Tracker = 1,
34  Muon = 2,
35  Ecal = 3,
36  Hcal = 4,
37  Calo = 5,
38  Forward = 6,
39  HGCalEE = 8,
40  HGCalHSi = 9,
41  HGCalHSc = 10,
42  HGCalTrigger = 11
43  };
Definition: Muon.py:1

◆ SubDetector

Enumerator
PixelBarrel 
PixelEndcap 
TIB 
TID 
TOB 
TEC 
CSC 
DT 
RPCBarrel 
RPCEndcap 
GEM 
ME0 

Definition at line 44 of file FWGeometry.h.

44  {
45  PixelBarrel = 1,
46  PixelEndcap = 2,
47  TIB = 3,
48  TID = 4,
49  TOB = 5,
50  TEC = 6,
51  CSC = 7,
52  DT = 8,
53  RPCBarrel = 9,
54  RPCEndcap = 10,
55  GEM = 11,
56  ME0 = 12
57  };

Constructor & Destructor Documentation

◆ FWGeometry()

FWGeometry::FWGeometry ( void  )

Definition at line 27 of file FWGeometry.cc.

27 : m_producerVersion(0) {}
int m_producerVersion
Definition: FWGeometry.h:172

◆ ~FWGeometry()

FWGeometry::~FWGeometry ( void  )

Definition at line 29 of file FWGeometry.cc.

29 {}

Member Function Documentation

◆ applyGlobalTag()

void FWGeometry::applyGlobalTag ( const std::string &  gt)

Definition at line 59 of file FWGeometry.cc.

References fwLog, download_sqlite_cfg::globalTag, fwlog::kInfo, fwlog::kWarning, loadMap(), m_fileName, alignCSCRings::r, AlCaHLTBitMon_QueryRunRegistry::string, and HLT_2024v14_cff::year.

Referenced by CmsShowMain::fileChangedSlot().

59  {
60  const std::string fnRun2 = "cmsGeomRun2.root";
61  const std::string fnRun3 = "cmsGeom2021.root";
62  const std::string fnSLHC = "cmsGeom2026.root";
63 
64  TPMERegexp year_re("^[^_]+_[a-zA-Z]*20(\\d\\d)_");
65  TPMERegexp run_re("^[^_]+_[a-zA-Z]*Run(\\d)_");
66 
67  TString test = globalTag.c_str();
68  std::string cfn;
69  if (year_re.Match(test)) {
70  TString r = year_re[1];
71  int year = atoi(r.Data());
72  if (year < 18) {
73  cfn = fnRun2;
74  } else if (year < 21) {
75  cfn = fnRun3;
76  } else {
77  cfn = fnSLHC;
78  }
79  } else if (run_re.Match(test)) {
80  TString rn = run_re[1];
81  if (rn == "1") {
82  fwLog(fwlog::kWarning) << "Run1 geometry not included. Using Run2 geometry." << std::endl;
83  cfn = fnRun2;
84  } else if (rn == "2") {
85  cfn = fnRun2;
86  } else if (rn == "4") {
87  cfn = fnSLHC;
88  } else {
89  fwLog(fwlog::kWarning) << "Detected Run" << rn << ". Using geometry scenario 2021.\n";
90  cfn = fnRun3;
91  }
92  } else {
93  fwLog(fwlog::kWarning) << "Could not guess geometry from global tag. Using geometry scenario 2021.\n";
94  cfn = fnRun3;
95  }
96 
97  fwLog(fwlog::kInfo) << "Guessed geometry " << cfn << " from global tag " << globalTag << std::endl;
98  if (cfn.compare(m_fileName)) {
99  loadMap(cfn.c_str());
100  }
101 }
void loadMap(const char *fileName)
Definition: FWGeometry.cc:103
std::string m_fileName
Definition: FWGeometry.h:174
#define fwLog(_level_)
Definition: fwLog.h:45

◆ clear()

void FWGeometry::clear ( void  )
inline

Definition at line 144 of file FWGeometry.h.

References m_idToInfo, and m_idToMatrix.

144  {
145  m_idToInfo.clear();
146  m_idToMatrix.clear();
147  }
std::map< unsigned int, TGeoMatrix * > m_idToMatrix
Definition: FWGeometry.h:164
IdToInfo m_idToInfo
Definition: FWGeometry.h:166

◆ contains()

bool FWGeometry::contains ( unsigned int  id) const
inline

Definition at line 140 of file FWGeometry.h.

References find(), and m_idToInfo.

Referenced by LumiList.LumiList::__contains__().

140 { return FWGeometry::find(id) != m_idToInfo.end(); }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:492
IdToInfo m_idToInfo
Definition: FWGeometry.h:166

◆ find()

FWGeometry::IdToInfoItr FWGeometry::find ( unsigned int  id) const

◆ findFile()

TFile * FWGeometry::findFile ( const char *  fileName)
static

Definition at line 38 of file FWGeometry.cc.

References MillePedeFileConverter_cfg::fileName, personalPlayback::fn, personalPlayback::fp, mps_fire::i, castor_dqm_sourceclient_file_cfg::path, Skims_PA_cff::paths, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by loadMap(), and FWGeometryTableViewManager::setGeoManagerFromFile().

38  {
39  std::string searchPath = ".";
40 
41  if (gSystem->Getenv("CMSSW_SEARCH_PATH")) {
42  TString paths = gSystem->Getenv("CMSSW_SEARCH_PATH");
43 
44  TObjArray* tokens = paths.Tokenize(":");
45  for (int i = 0; i < tokens->GetEntries(); ++i) {
46  TObjString* path = (TObjString*)tokens->At(i);
47  searchPath += ":";
48  searchPath += static_cast<const char*>(path->GetString());
49  if (gSystem->Getenv("CMSSW_VERSION"))
50  searchPath += "/Fireworks/Geometry/data/";
51  }
52  }
53 
54  TString fn = fileName;
55  const char* fp = gSystem->FindFile(searchPath.c_str(), fn, kFileExists);
56  return fp ? TFile::Open(fp) : nullptr;
57 }

◆ getCorners()

const float * FWGeometry::getCorners ( unsigned int  id) const

Definition at line 439 of file FWGeometry.cc.

References find(), fwLog, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, fwlog::kWarning, and m_idToInfo.

Referenced by FWPFCandidateWithHitsProxyBuilder::addHitsForCandidate(), FWCaloRecHitDigitSetProxyBuilder::build(), FWPRCaloTowerProxyBuilder::build(), FWHGCalMultiClusterProxyBuilder::build(), FWECaloParticleProxyBuilder::build(), FWHGCalTriggerCellProxyBuilder::build(), FWPCaloHitProxyBuilder::build(), FWHGCalTriggerClusterProxyBuilder::build(), FWCaloParticleProxyBuilder::build(), FWCaloClusterProxyBuilder::build(), FWTracksterHitsProxyBuilder::build(), FWPFEcalRecHitRPProxyBuilder::build(), FWPFEcalRecHitLegoProxyBuilder::build(), FWHGCRecHitProxyBuilder::build(), FWECALCaloDataDetailViewBuilder::fillData(), FWECALDetailViewBuilder::fillEtaPhi(), FWHFTowerSliceSelector::findBinFromId(), FWHGTowerSliceSelector::findBinFromId(), fireworks::makeRhoPhiSuperCluster(), fireworks::makeRhoZSuperCluster(), FWCaloRecHitDigitSetProxyBuilder::scaleProduct(), FWPFCandidateWithHitsProxyBuilder::scaleProduct(), FW3DViewBase::showEcalBarrel(), and ValidateGeometry::validateCaloGeometry().

439  {
440  // reco geometry points
442  if (it == m_idToInfo.end()) {
443  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
444  return nullptr;
445  } else {
446  return (*it).points;
447  }
448 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:492
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:166
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:138

◆ getEveShape()

TEveGeoShape * FWGeometry::getEveShape ( unsigned int  id) const

Definition at line 317 of file FWGeometry.cc.

References mps_check::array, find(), fwLog, getShape(), info(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, fwlog::kWarning, m_idToInfo, and l1trig_cff::shape.

Referenced by FWConvTrackHitsDetailView::addModules(), FWTrackHitsDetailView::addModules(), FWME0SegmentProxyBuilder::build(), FWCSCSegmentProxyBuilder::build(), FWDTSegmentProxyBuilder::buildViewType(), FWRPZViewGeometry::makeMuonGeometryRhoPhi(), FWRPZViewGeometry::makeMuonGeometryRhoZ(), FWRPZViewGeometry::showGEM(), FWRPZViewGeometry::showME0(), FWRPZViewGeometry::showMtdBarrel(), FW3DViewGeometry::showMtdBarrel(), FW3DViewGeometry::showMtdEndcap(), FW3DViewGeometry::showMuonBarrel(), FW3DViewGeometry::showMuonBarrelFull(), FW3DViewGeometry::showMuonEndcap(), FW3DViewGeometry::showPixelBarrel(), FWRPZViewGeometry::showPixelBarrel(), FW3DViewGeometry::showPixelEndcap(), FWRPZViewGeometry::showPixelEndcap(), FWRPZViewGeometry::showRpcEndcap(), FW3DViewGeometry::showTrackerBarrel(), FWRPZViewGeometry::showTrackerBarrel(), FW3DViewGeometry::showTrackerEndcap(), and FWRPZViewGeometry::showTrackerEndcap().

317  {
319  if (it == m_idToInfo.end()) {
320  fwLog(fwlog::kWarning) << "no reco geoemtry found for id " << id << std::endl;
321  return nullptr;
322  } else {
323  const GeomDetInfo& info = *it;
324  double array[16] = {info.matrix[0],
325  info.matrix[3],
326  info.matrix[6],
327  0.,
328  info.matrix[1],
329  info.matrix[4],
330  info.matrix[7],
331  0.,
332  info.matrix[2],
333  info.matrix[5],
334  info.matrix[8],
335  0.,
336  info.translation[0],
337  info.translation[1],
338  info.translation[2],
339  1.};
340  TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
341  TEveGeoShape* shape = new TEveGeoShape(TString::Format("RecoGeom Id=%u", id));
342  TGeoShape* geoShape = getShape(info);
343  shape->SetShape(geoShape);
344  // Set transformation matrix from a column-major array
345  shape->SetTransMatrix(array);
346  return shape;
347  }
348 }
static const TGPicture * info(bool iBackgroundIsBlack)
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:492
TGeoShape * getShape(unsigned int id) const
Definition: FWGeometry.cc:286
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:166
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:138

◆ getHGCScintillatorEveShape()

TEveGeoShape * FWGeometry::getHGCScintillatorEveShape ( unsigned int  id) const

Definition at line 395 of file FWGeometry.cc.

References mps_check::array, find(), fwLog, info(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, fwlog::kWarning, m_idToInfo, l1trig_cff::shape, x, and y.

Referenced by FW3DViewGeometry::showHGCalHSc().

395  {
397  if (it == m_idToInfo.end()) {
398  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
399  return nullptr;
400  }
401 
402  GeomDetInfo info = *it;
403 
404  TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
405  TEveGeoShape* shape = new TEveGeoShape(TString::Format("RecoGeom Id=%u", id));
406 
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]};
410 
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];
416 
417  shape->SetShape(geoShape);
418  double array[16] = {info.matrix[0],
419  info.matrix[3],
420  info.matrix[6],
421  0.,
422  info.matrix[1],
423  info.matrix[4],
424  info.matrix[7],
425  0.,
426  info.matrix[2],
427  info.matrix[5],
428  info.matrix[8],
429  0.,
430  info.translation[0],
431  info.translation[1],
432  info.translation[2],
433  1.};
434  // Set transformation matrix from a column-major array
435  shape->SetTransMatrix(array);
436  return shape;
437 }
static const TGPicture * info(bool iBackgroundIsBlack)
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:492
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:166
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:138

◆ getHGCSiliconEveShape()

TEveGeoShape * FWGeometry::getHGCSiliconEveShape ( unsigned int  id) const

Definition at line 350 of file FWGeometry.cc.

References mps_check::array, find(), fwLog, mps_fire::i, info(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, fwlog::kWarning, m_idToInfo, l1trig_cff::shape, x, and y.

Referenced by FW3DViewGeometry::showHGCalEE(), and FW3DViewGeometry::showHGCalHSi().

350  {
352  if (it == m_idToInfo.end()) {
353  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
354  return nullptr;
355  }
356 
357  GeomDetInfo info = *it;
358 
359  TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
360  TEveGeoShape* shape = new TEveGeoShape(TString::Format("RecoGeom Id=%u", id));
361 
362  TGeoXtru* geoShape = new TGeoXtru(2);
363  Double_t x[6];
364  Double_t y[6];
365  for (unsigned int i = 0; i < 6; ++i) {
366  x[i] = info.points[i * 3];
367  y[i] = info.points[3 * i + 1];
368  }
369  geoShape->DefinePolygon(6, x, y);
370  geoShape->DefineSection(0, info.points[2] - 0.0150); // First plane at the Z position of the wafer, minus 150um
371  geoShape->DefineSection(1, info.points[2] + 0.0150); // Second plane at the Z position of the wafer, minus 150um
372 
373  shape->SetShape(geoShape);
374  double array[16] = {info.matrix[0],
375  info.matrix[3],
376  info.matrix[6],
377  0.,
378  info.matrix[1],
379  info.matrix[4],
380  info.matrix[7],
381  0.,
382  info.matrix[2],
383  info.matrix[5],
384  info.matrix[8],
385  0.,
386  0., // translation x
387  0., // translation y
388  0., // translation z
389  1.};
390  // Set transformation matrix from a column-major array
391  shape->SetTransMatrix(array);
392  return shape;
393 }
static const TGPicture * info(bool iBackgroundIsBlack)
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:492
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:166
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:138

◆ getMatchedIds() [1/2]

std::vector< unsigned int > FWGeometry::getMatchedIds ( Detector  det,
SubDetector  subdet 
) const

Definition at line 254 of file FWGeometry.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, m_idToInfo, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, and match_id().

Referenced by FW3DViewGeometry::showHGCalEE(), FW3DViewGeometry::showHGCalHSc(), FW3DViewGeometry::showHGCalHSi(), FWRPZViewGeometry::showMtdBarrel(), FW3DViewGeometry::showMtdBarrel(), FW3DViewGeometry::showMtdEndcap(), FW3DViewGeometry::showPixelBarrel(), FWRPZViewGeometry::showPixelBarrel(), FW3DViewGeometry::showPixelEndcap(), FWRPZViewGeometry::showPixelEndcap(), FW3DViewGeometry::showTrackerBarrel(), FWRPZViewGeometry::showTrackerBarrel(), FW3DViewGeometry::showTrackerEndcap(), and FWRPZViewGeometry::showTrackerEndcap().

254  {
255  std::vector<unsigned int> ids;
256  unsigned int mask = (det << 4) | (subdet);
257  for (IdToInfoItr it = m_idToInfo.begin(), itEnd = m_idToInfo.end(); it != itEnd; ++it) {
259  ids.push_back((*it).id);
260  }
261 
262  return ids;
263 }
IdToInfo m_idToInfo
Definition: FWGeometry.h:166
bool match_id(const GeomDetInfo &o, unsigned int mask) const
Definition: FWGeometry.h:132
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:138

◆ getMatchedIds() [2/2]

std::vector< unsigned int > FWGeometry::getMatchedIds ( Detector  det) const

Definition at line 265 of file FWGeometry.cc.

References HGCalHSc, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, kDetOffset, submitPVResolutionJobs::key, and m_idToInfo.

265  {
266  std::vector<unsigned int> ids;
267  for (const auto& it : m_idToInfo) {
268  if (((it.id >> kDetOffset) & 0xF) != det)
269  continue;
270 
271  // select only the fake DetIds that have all the (u,v) bits set at 1. This
272  // is used to draw the HGCal Geometry that is wafer-based for the silicon
273  // part. The Scintillators are treated on a tile-basis.
274  if (det == HGCalHSc) {
275  ids.push_back(it.id);
276  } else {
277  auto key = 0x3FF; // 10 bits mask of 1s.
278  if ((it.id | key) == it.id) {
279  ids.push_back(it.id);
280  }
281  }
282  }
283  return ids;
284 }
key
prepare the HTCondor submission files and eventually submit them
static const int kDetOffset
Definition: FWGeometry.h:29
IdToInfo m_idToInfo
Definition: FWGeometry.h:166

◆ getMatrix()

const TGeoMatrix * FWGeometry::getMatrix ( unsigned int  id) const

Definition at line 225 of file FWGeometry.cc.

References find(), fwLog, l1ctLayer2EG_cff::id, info(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, fwlog::kWarning, m_idToInfo, m_idToMatrix, makeMuonMisalignmentScenario::matrix, and idealTransformation::rotation.

Referenced by CSCGeometryValidate::validateCSCChamberGeometry(), ValidateGeometry::validateCSChamberGeometry(), ValidateGeometry::validateCSCLayerGeometry(), DTGeometryValidate::validateDTChamberGeometry(), ValidateGeometry::validateDTChamberGeometry(), DTGeometryValidate::validateDTLayerGeometry(), ValidateGeometry::validateDTLayerGeometry(), GEMGeometryValidate::validateGEMChamberGeometry(), ME0GeometryValidate::validateME0ChamberGeometry(), ME0GeometryValidate::validateME0EtaPartitionGeometry2(), RPCGeometryValidate::validateRPCChamberGeometry(), ValidateGeometry::validateRPCGeometry(), and ValidateGeometry::validateTrackerGeometry().

225  {
226  std::map<unsigned int, TGeoMatrix*>::iterator mit = m_idToMatrix.find(id);
227  if (mit != m_idToMatrix.end())
228  return mit->second;
229 
231  if (it == m_idToInfo.end()) {
232  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
233  return nullptr;
234  } else {
235  const GeomDetInfo& info = *it;
236  TGeoTranslation trans(info.translation[0], info.translation[1], info.translation[2]);
237  TGeoRotation rotation;
238  const Double_t matrix[9] = {info.matrix[0],
239  info.matrix[1],
240  info.matrix[2],
241  info.matrix[3],
242  info.matrix[4],
243  info.matrix[5],
244  info.matrix[6],
245  info.matrix[7],
246  info.matrix[8]};
247  rotation.SetMatrix(matrix);
248 
249  m_idToMatrix[id] = new TGeoCombiTrans(trans, rotation);
250  return m_idToMatrix[id];
251  }
252 }
static const TGPicture * info(bool iBackgroundIsBlack)
std::map< unsigned int, TGeoMatrix * > m_idToMatrix
Definition: FWGeometry.h:164
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:492
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:166
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:138

◆ getParameters()

const float * FWGeometry::getParameters ( unsigned int  id) const

Definition at line 450 of file FWGeometry.cc.

References find(), fwLog, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, fwlog::kWarning, and m_idToInfo.

Referenced by FWHGCalMultiClusterProxyBuilder::build(), FWHGCalTriggerCellProxyBuilder::build(), FWHGCalTriggerClusterProxyBuilder::build(), FWSiStripClusterProxyBuilder::build(), FWCaloParticleProxyBuilder::build(), FWCaloClusterProxyBuilder::build(), FWTracksterHitsProxyBuilder::build(), FWTracksterLayersProxyBuilder::build(), FWHGCRecHitProxyBuilder::build(), FW3DViewGeometry::showHGCalEE(), FW3DViewGeometry::showHGCalHSc(), FW3DViewGeometry::showHGCalHSi(), CSCGeometryValidate::validateCSCLayerGeometry(), ValidateGeometry::validateCSCLayerGeometry(), DTGeometryValidate::validateDTLayerGeometry(), ValidateGeometry::validateDTLayerGeometry(), GEMGeometryValidate::validateGEMEtaPartitionGeometry(), ME0GeometryValidate::validateME0EtaPartitionGeometry(), ValidateGeometry::validatePixelTopology(), ValidateGeometry::validateRPCGeometry(), RPCGeometryValidate::validateRPCStripsGeometry(), and ValidateGeometry::validateStripTopology().

450  {
451  // reco geometry parameters
453  if (it == m_idToInfo.end()) {
454  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
455  return nullptr;
456  } else {
457  return (*it).parameters;
458  }
459 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:492
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:166
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:138

◆ getProducerVersion()

int FWGeometry::getProducerVersion ( ) const
inline

Definition at line 153 of file FWGeometry.h.

References m_producerVersion.

153 { return m_producerVersion; }
int m_producerVersion
Definition: FWGeometry.h:172

◆ getShape() [1/2]

TGeoShape * FWGeometry::getShape ( unsigned int  id) const

Definition at line 286 of file FWGeometry.cc.

References find(), fwLog, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, fwlog::kWarning, and m_idToInfo.

Referenced by FWSiStripClusterProxyBuilder::build(), and getEveShape().

286  {
288  if (it == m_idToInfo.end()) {
289  fwLog(fwlog::kWarning) << "no reco geoemtry found for id " << id << std::endl;
290  return nullptr;
291  } else {
292  return getShape(*it);
293  }
294 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:492
TGeoShape * getShape(unsigned int id) const
Definition: FWGeometry.cc:286
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:166
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:138

◆ getShape() [2/2]

TGeoShape * FWGeometry::getShape ( const GeomDetInfo info) const

Definition at line 296 of file FWGeometry.cc.

References info().

296  {
297  TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
298  TGeoShape* geoShape = nullptr;
299  if (info.shape[0] == 1) {
300  geoShape = new TGeoTrap(info.shape[3], //dz
301  0, //theta
302  0, //phi
303  info.shape[4], //dy1
304  info.shape[1], //dx1
305  info.shape[2], //dx2
306  0, //alpha1
307  info.shape[4], //dy2
308  info.shape[1], //dx3
309  info.shape[2], //dx4
310  0); //alpha2
311  } else
312  geoShape = new TGeoBBox(info.shape[1], info.shape[2], info.shape[3]);
313 
314  return geoShape;
315 }
static const TGPicture * info(bool iBackgroundIsBlack)

◆ getShapePars()

const float * FWGeometry::getShapePars ( unsigned int  id) const

Definition at line 461 of file FWGeometry.cc.

References find(), fwLog, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, fwlog::kWarning, and m_idToInfo.

Referenced by FWHGCalMultiClusterProxyBuilder::build(), FWHGCalTriggerCellProxyBuilder::build(), FWHGCalTriggerClusterProxyBuilder::build(), FWCaloParticleProxyBuilder::build(), FWCaloClusterProxyBuilder::build(), FWTracksterHitsProxyBuilder::build(), FWHGCRecHitProxyBuilder::build(), CSCGeometryValidate::validateCSCChamberGeometry(), ValidateGeometry::validateCSChamberGeometry(), ValidateGeometry::validateCSCLayerGeometry(), DTGeometryValidate::validateDTChamberGeometry(), ValidateGeometry::validateDTChamberGeometry(), DTGeometryValidate::validateDTLayerGeometry(), ValidateGeometry::validateDTLayerGeometry(), GEMGeometryValidate::validateGEMChamberGeometry(), ME0GeometryValidate::validateME0ChamberGeometry(), ME0GeometryValidate::validateME0EtaPartitionGeometry2(), RPCGeometryValidate::validateRPCChamberGeometry(), ValidateGeometry::validateRPCGeometry(), and ValidateGeometry::validateTrackerGeometry().

461  {
462  // reco geometry parameters
464  if (it == m_idToInfo.end()) {
465  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
466  return nullptr;
467  } else {
468  return (*it).shape;
469  }
470 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:492
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:166
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:138

◆ getTrackerTopology()

const TrackerTopology* FWGeometry::getTrackerTopology ( ) const
inline

Definition at line 157 of file FWGeometry.h.

References m_trackerTopology.

Referenced by FWTrackHitsDetailView::addModules(), fireworks::info(), FW3DViewGeometry::showPixelBarrel(), and FW3DViewGeometry::showPixelEndcap().

157 { return m_trackerTopology.get(); }
std::unique_ptr< TrackerTopology > m_trackerTopology
Definition: FWGeometry.h:176

◆ initMap()

void FWGeometry::initMap ( const FWRecoGeom::InfoMap map)

Definition at line 203 of file FWGeometry.cc.

References mps_fire::end, cms::cuda::for(), mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, dqmiolumiharvest::j, m_idToInfo, genParticles_cff::map, makeMuonMisalignmentScenario::matrix, hiPixelPairStep_cff::points, and l1trig_cff::shape.

Referenced by FWFFLooper::beginRun().

203  {
204  FWRecoGeom::InfoMapItr begin = map.begin();
206  unsigned int mapSize = map.size();
207  if (m_idToInfo.size() != mapSize)
208  m_idToInfo.resize(mapSize);
209  unsigned int i = 0;
210  for (FWRecoGeom::InfoMapItr it = begin; it != end; ++it, ++i) {
211  m_idToInfo[i].id = it->id;
212  for (unsigned int j = 0; j < 24; ++j)
213  m_idToInfo[i].points[j] = it->points[j];
214  for (unsigned int j = 0; j < 9; ++j)
215  m_idToInfo[i].parameters[j] = it->topology[j];
216  for (unsigned int j = 0; j < 5; ++j)
217  m_idToInfo[i].shape[j] = it->shape[j];
218  for (unsigned int j = 0; j < 3; ++j)
219  m_idToInfo[i].translation[j] = it->translation[j];
220  for (unsigned int j = 0; j < 9; ++j)
221  m_idToInfo[i].matrix[j] = it->matrix[j];
222  }
223 }
std::vector< FWRecoGeom::Info >::const_iterator InfoMapItr
Definition: FWRecoGeom.h:24
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
IdToInfo m_idToInfo
Definition: FWGeometry.h:166

◆ isEmpty()

bool FWGeometry::isEmpty ( void  ) const

Definition at line 31 of file FWGeometry.cc.

References m_idToInfo.

Referenced by plotting.Plot::clone(), and FWRPZViewGeometry::initStdGeoElements().

31  {
32  // AMT this is a check if geomtery is not loaded
33  // e.g. cmsShow starts with no data file and without given explicit argument ( --geometry-file option )
34 
35  return m_idToInfo.empty();
36 }
IdToInfo m_idToInfo
Definition: FWGeometry.h:166

◆ loadMap()

void FWGeometry::loadMap ( const char *  fileName)

Definition at line 103 of file FWGeometry.cc.

References FWGeometry::VersionInfo::cmsswVersion, FWGeometry::VersionInfo::extraDetectors, geometryDiff::file, findFile(), StandaloneTrackerTopology::fromTrackerParametersXMLString(), fwLog, mps_fire::i, l1ctLayer2EG_cff::id, dqmiolumiharvest::j, fwlog::kInfo, m_fileName, m_idToInfo, m_idToMatrix, m_producerVersion, m_trackerTopology, m_versionInfo, makeMuonMisalignmentScenario::matrix, AlCaHLTBitMon_ParallelJobs::p, castor_dqm_sourceclient_file_cfg::path, hiPixelPairStep_cff::points, FWGeometry::VersionInfo::productionTag, l1trig_cff::shape, AlCaHLTBitMon_QueryRunRegistry::string, and HLT_2024v14_cff::topology.

Referenced by applyGlobalTag(), CmsShowMainBase::loadGeometry(), and ValidateGeometry::ValidateGeometry().

103  {
104  TFile* file = findFile(iFileName);
105  if (!file) {
106  throw std::runtime_error("ERROR: failed to find geometry file. Initialization failed.");
107  return;
108  }
109  m_fileName = iFileName;
110  TTree* tree = static_cast<TTree*>(file->Get("idToGeo"));
111  if (!tree) {
112  throw std::runtime_error("ERROR: cannot find detector id map in the file. Initialization failed.");
113  return;
114  }
115 
116  unsigned int id;
117  Float_t points[24];
118  Float_t topology[9];
119  Float_t shape[5];
120  Float_t translation[3];
121  Float_t matrix[9];
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);
128  if (loadPoints)
129  tree->SetBranchAddress("points", &points);
130  if (loadParameters)
131  tree->SetBranchAddress("topology", &topology);
132  if (loadShape)
133  tree->SetBranchAddress("shape", &shape);
134  if (loadTranslation)
135  tree->SetBranchAddress("translation", &translation);
136  if (loadMatrix)
137  tree->SetBranchAddress("matrix", &matrix);
138 
139  // reset previous values
140  m_idToInfo.clear();
141  for (const auto& p : m_idToMatrix)
142  delete p.second;
143  m_trackerTopology.reset();
144 
145  unsigned int treeSize = tree->GetEntries();
146  if (m_idToInfo.size() != treeSize)
147  m_idToInfo.resize(treeSize);
148  for (unsigned int i = 0; i < treeSize; ++i) {
149  tree->GetEntry(i);
150 
151  m_idToInfo[i].id = id;
152  if (loadPoints) {
153  for (unsigned int j = 0; j < 24; ++j)
154  m_idToInfo[i].points[j] = points[j];
155  }
156  if (loadParameters) {
157  for (unsigned int j = 0; j < 9; ++j)
159  }
160  if (loadShape) {
161  for (unsigned int j = 0; j < 5; ++j)
162  m_idToInfo[i].shape[j] = shape[j];
163  }
164  if (loadTranslation) {
165  for (unsigned int j = 0; j < 3; ++j)
166  m_idToInfo[i].translation[j] = translation[j];
167  }
168  if (loadMatrix) {
169  for (unsigned int j = 0; j < 9; ++j)
170  m_idToInfo[i].matrix[j] = matrix[j];
171  }
172  }
173 
174  m_versionInfo.productionTag = static_cast<TNamed*>(file->Get("tag"));
175  m_versionInfo.cmsswVersion = static_cast<TNamed*>(file->Get("CMSSW_VERSION"));
176  m_versionInfo.extraDetectors = static_cast<TObjArray*>(file->Get("ExtraDetectors"));
177 
178  TString path = file->GetPath();
179  if (path.EndsWith(":/"))
180  path.Resize(path.Length() - 2);
181 
183  fwLog(fwlog::kInfo) << Form(
184  "Load %s %s from %s\n", tree->GetName(), m_versionInfo.productionTag->GetTitle(), path.Data());
185  else
186  fwLog(fwlog::kInfo) << Form("Load %s from %s\n", tree->GetName(), path.Data());
187 
188  TNamed* producerInfo = static_cast<TNamed*>(file->Get("PRODUCER_VERSION"));
189  if (producerInfo) {
190  m_producerVersion = atoi(producerInfo->GetTitle());
191  }
192 
193  TNamed* ttopology = static_cast<TNamed*>(file->Get("TrackerTopology"));
194  if (ttopology) {
195  std::string xml = ttopology->GetTitle();
197  std::make_unique<TrackerTopology>(StandaloneTrackerTopology::fromTrackerParametersXMLString(xml));
198  }
199 
200  file->Close();
201 }
std::unique_ptr< TrackerTopology > m_trackerTopology
Definition: FWGeometry.h:176
static TFile * findFile(const char *fileName)
Definition: FWGeometry.cc:38
TObjArray * extraDetectors
Definition: FWGeometry.h:71
std::map< unsigned int, TGeoMatrix * > m_idToMatrix
Definition: FWGeometry.h:164
VersionInfo m_versionInfo
Definition: FWGeometry.h:170
int m_producerVersion
Definition: FWGeometry.h:172
std::string m_fileName
Definition: FWGeometry.h:174
#define fwLog(_level_)
Definition: fwLog.h:45
TrackerTopology fromTrackerParametersXMLString(const std::string &xmlContent)
Definition: tree.py:1
IdToInfo m_idToInfo
Definition: FWGeometry.h:166

◆ localToGlobal() [1/3]

void FWGeometry::localToGlobal ( unsigned int  id,
const float *  local,
float *  global,
bool  translatep = true 
) const

Definition at line 472 of file FWGeometry.cc.

References find(), fwLog, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, fwlog::kWarning, DTRecHitClients_cfi::local, and m_idToInfo.

Referenced by FWSiStripClusterProxyBuilder::build(), FWRPZViewGeometry::estimateProjectionSizeDT(), and localToGlobal().

472  {
474  if (it == m_idToInfo.end()) {
475  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
476  } else {
477  localToGlobal(*it, local, global, translatep);
478  }
479 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:492
#define fwLog(_level_)
Definition: fwLog.h:45
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:472
IdToInfo m_idToInfo
Definition: FWGeometry.h:166
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:138

◆ localToGlobal() [2/3]

void FWGeometry::localToGlobal ( unsigned int  id,
const float *  local1,
float *  global1,
const float *  local2,
float *  global2,
bool  translatep = true 
) const

Definition at line 481 of file FWGeometry.cc.

References find(), fwLog, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, fwlog::kWarning, localToGlobal(), and m_idToInfo.

482  {
484  if (it == m_idToInfo.end()) {
485  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
486  } else {
487  localToGlobal(*it, local1, global1, translatep);
488  localToGlobal(*it, local2, global2, translatep);
489  }
490 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:492
#define fwLog(_level_)
Definition: fwLog.h:45
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:472
IdToInfo m_idToInfo
Definition: FWGeometry.h:166
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:138

◆ localToGlobal() [3/3]

void FWGeometry::localToGlobal ( const GeomDetInfo info,
const float *  local,
float *  global,
bool  translatep = true 
) const

Definition at line 498 of file FWGeometry.cc.

References mps_fire::i, info(), and DTRecHitClients_cfi::local.

498  {
499  for (int i = 0; i < 3; ++i) {
500  global[i] = translatep ? info.translation[i] : 0;
501  global[i] += local[0] * info.matrix[3 * i] + local[1] * info.matrix[3 * i + 1] + local[2] * info.matrix[3 * i + 2];
502  }
503 }
static const TGPicture * info(bool iBackgroundIsBlack)

◆ mapEnd()

IdToInfoItr FWGeometry::mapEnd ( ) const
inline

Definition at line 142 of file FWGeometry.h.

References m_idToInfo.

Referenced by FWRPZViewGeometry::makeMuonGeometryRhoZ().

142 { return m_idToInfo.end(); }
IdToInfo m_idToInfo
Definition: FWGeometry.h:166

◆ match_id()

bool FWGeometry::match_id ( const GeomDetInfo o,
unsigned int  mask 
) const
inline

Definition at line 132 of file FWGeometry.h.

References kDetOffset, kSubdetOffset, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, and EcalTangentSkim_cfg::o.

Referenced by getMatchedIds().

132  {
133  unsigned int id = o.id;
134  return (((((id >> kDetOffset) & 0xF) << 4) | ((id >> kSubdetOffset) & 0x7)) == mask);
135  }
static const int kSubdetOffset
Definition: FWGeometry.h:30
static const int kDetOffset
Definition: FWGeometry.h:29

◆ versionInfo()

const VersionInfo& FWGeometry::versionInfo ( ) const
inline

Definition at line 151 of file FWGeometry.h.

References m_versionInfo.

Referenced by FWRPZView::populateController(), FW3DViewGeometry::showMuonEndcap(), and FWRPZViewGeometry::showRpcEndcap().

151 { return m_versionInfo; }
VersionInfo m_versionInfo
Definition: FWGeometry.h:170

Member Data Documentation

◆ kDetOffset

const int FWGeometry::kDetOffset = 28
static

Definition at line 29 of file FWGeometry.h.

Referenced by getMatchedIds(), and match_id().

◆ kSubdetOffset

const int FWGeometry::kSubdetOffset = 25
static

Definition at line 30 of file FWGeometry.h.

Referenced by match_id().

◆ m_fileName

std::string FWGeometry::m_fileName
private

Definition at line 174 of file FWGeometry.h.

Referenced by applyGlobalTag(), and loadMap().

◆ m_idToInfo

IdToInfo FWGeometry::m_idToInfo
private

◆ m_idToMatrix

std::map<unsigned int, TGeoMatrix*> FWGeometry::m_idToMatrix
mutableprivate

Definition at line 164 of file FWGeometry.h.

Referenced by clear(), getMatrix(), and loadMap().

◆ m_prodTag

std::string FWGeometry::m_prodTag
private

Definition at line 168 of file FWGeometry.h.

◆ m_producerVersion

int FWGeometry::m_producerVersion
private

Definition at line 172 of file FWGeometry.h.

Referenced by getProducerVersion(), and loadMap().

◆ m_trackerTopology

std::unique_ptr<TrackerTopology> FWGeometry::m_trackerTopology
private

Definition at line 176 of file FWGeometry.h.

Referenced by getTrackerTopology(), and loadMap().

◆ m_versionInfo

VersionInfo FWGeometry::m_versionInfo
private

Definition at line 170 of file FWGeometry.h.

Referenced by loadMap(), and versionInfo().