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, 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

Definition at line 136 of file FWGeometry.h.

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

Definition at line 137 of file FWGeometry.h.

Member Enumeration Documentation

Enumerator
Tracker 
Muon 
Ecal 
Hcal 
Calo 
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  HGCalEE = 8,
39  HGCalHSi = 9,
40  HGCalHSc = 10,
41  HGCalTrigger = 11
42  };
Definition: Muon.py:1
Enumerator
PixelBarrel 
PixelEndcap 
TIB 
TID 
TOB 
TEC 
CSC 
DT 
RPCBarrel 
RPCEndcap 
GEM 
ME0 

Definition at line 43 of file FWGeometry.h.

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

Constructor & Destructor Documentation

FWGeometry::FWGeometry ( void  )

Definition at line 23 of file FWGeometry.cc.

Referenced by FWGeometry::VersionInfo::VersionInfo().

23 : m_producerVersion(0) {}
int m_producerVersion
Definition: FWGeometry.h:171
FWGeometry::~FWGeometry ( void  )

Definition at line 25 of file FWGeometry.cc.

Referenced by FWGeometry::VersionInfo::VersionInfo().

25 {}

Member Function Documentation

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

Definition at line 55 of file FWGeometry.cc.

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

Referenced by CmsShowMain::fileChangedSlot(), and getTrackerTopology().

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

Definition at line 139 of file FWGeometry.h.

References find(), and m_idToInfo.

Referenced by LumiList.LumiList::__contains__(), fireworks::addSiStripClusters(), FWTrackTrackingRecHitProxyBuilder::build(), FWME0DigiProxyBuilder::build(), FWME0SegmentProxyBuilder::build(), FWPhase2TrackerCluster1DDetProxyBuilder::build(), FWSiPixelClusterDetProxyBuilder::build(), FWCSCRecHitProxyBuilder::build(), FWCSCStripDigiProxyBuilder::build(), FWSiStripDigiProxyBuilder::build(), FWRPCDigiProxyBuilder::build(), FWPhase2TrackerCluster1DProxyBuilder::build(), FWCSCWireDigiProxyBuilder::build(), FWCSCSegmentProxyBuilder::build(), FWSiPixelDigiProxyBuilder::build(), FWGEMDigiProxyBuilder::build(), FWSiPixelClusterProxyBuilder::build(), FWTrajectorySeedProxyBuilder::build(), FWGEMPadDigiProxyBuilder::build(), FWME0RecHitProxyBuilder::buildViewType(), FWGEMSegmentProxyBuilder::buildViewType(), FWPSimHitProxyBuilder::buildViewType(), FWRPCRecHitProxyBuilder::buildViewType(), FWGEMRecHitProxyBuilder::buildViewType(), FWDTRecHitProxyBuilder::buildViewType(), FWDTSegmentProxyBuilder::buildViewType(), FWDTDigiProxyBuilder::buildViewType(), FWHFTowerProxyBuilderBase::fillTowerForDetId(), FWHGTowerProxyBuilderBase::fillTowerForDetId(), fireworks::pushNearbyPixelHits(), and fireworks::pushPixelHits().

139 { return FWGeometry::find(id) != m_idToInfo.end(); }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:516
IdToInfo m_idToInfo
Definition: FWGeometry.h:165
FWGeometry::IdToInfoItr FWGeometry::find ( unsigned int  id) const
TFile * FWGeometry::findFile ( const char *  fileName)
static

Definition at line 34 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(), FWGeometryTableViewManager::setGeoManagerFromFile(), and FWGeometry::VersionInfo::VersionInfo().

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

Definition at line 463 of file FWGeometry.cc.

References find(), fwLog, 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(), FWPFEcalRecHitRPProxyBuilder::build(), FWPFEcalRecHitLegoProxyBuilder::build(), FWHGCRecHitProxyBuilder::build(), FWPhotonProxyBuilder::buildViewType(), FWECALCaloDataDetailViewBuilder::fillData(), FWECALDetailViewBuilder::fillEtaPhi(), FWHFTowerProxyBuilderBase::fillTowerForDetId(), FWHGTowerProxyBuilderBase::fillTowerForDetId(), FWHFTowerSliceSelector::findBinFromId(), FWHGTowerSliceSelector::findBinFromId(), fireworks::makeRhoPhiSuperCluster(), fireworks::makeRhoZSuperCluster(), FWCaloRecHitDigitSetProxyBuilder::scaleProduct(), FWPFCandidateWithHitsProxyBuilder::scaleProduct(), FW3DViewBase::showEcalBarrel(), ValidateGeometry::validateCaloGeometry(), and FWGeometry::VersionInfo::VersionInfo().

463  {
464  // reco geometry points
465  IdToInfoItr it = FWGeometry::find(id);
466  if (it == m_idToInfo.end()) {
467  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
468  return nullptr;
469  } else {
470  return (*it).points;
471  }
472 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:516
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:165
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:137
TEveGeoShape * FWGeometry::getEveShape ( unsigned int  id) const

Definition at line 320 of file FWGeometry.cc.

References mps_check::array, find(), fwLog, getShape(), info(), fwlog::kWarning, m_idToInfo, FWGeometry::GeomDetInfo::matrix, and FWGeometry::GeomDetInfo::translation.

Referenced by FWTrackHitsDetailView::addModules(), FWConvTrackHitsDetailView::addModules(), FWME0SegmentProxyBuilder::build(), FWPhase2TrackerCluster1DDetProxyBuilder::build(), FWSiPixelClusterDetProxyBuilder::build(), FWTracksModulesProxyBuilder::build(), FWCSCSegmentProxyBuilder::build(), FWME0RecHitProxyBuilder::buildViewType(), FWGEMSegmentProxyBuilder::buildViewType(), FWRPCRecHitProxyBuilder::buildViewType(), FWGEMRecHitProxyBuilder::buildViewType(), FWDTSegmentProxyBuilder::buildViewType(), FWRPZViewGeometry::makeMuonGeometryRhoPhi(), FWRPZViewGeometry::makeMuonGeometryRhoZ(), FWRPZViewGeometry::showGEM(), FWRPZViewGeometry::showME0(), FW3DViewGeometry::showMuonBarrel(), FW3DViewGeometry::showMuonBarrelFull(), FW3DViewGeometry::showMuonEndcap(), FW3DViewGeometry::showPixelBarrel(), FWRPZViewGeometry::showPixelBarrel(), FW3DViewGeometry::showPixelEndcap(), FWRPZViewGeometry::showPixelEndcap(), FWRPZViewGeometry::showRpcEndcap(), FW3DViewGeometry::showTrackerBarrel(), FWRPZViewGeometry::showTrackerBarrel(), FW3DViewGeometry::showTrackerEndcap(), FWRPZViewGeometry::showTrackerEndcap(), and FWGeometry::VersionInfo::VersionInfo().

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

Definition at line 419 of file FWGeometry.cc.

References mps_check::array, find(), fwLog, info(), fwlog::kWarning, m_idToInfo, FWGeometry::GeomDetInfo::matrix, FWGeometry::GeomDetInfo::points, FWGeometry::GeomDetInfo::shape, FWGeometry::GeomDetInfo::translation, x, and y.

Referenced by FW3DViewGeometry::showHGCalHSc(), and FWGeometry::VersionInfo::VersionInfo().

419  {
420  IdToInfoItr it = FWGeometry::find(id);
421  if (it == m_idToInfo.end()) {
422  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
423  return nullptr;
424  }
425 
426  GeomDetInfo info = *it;
427 
428  TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
429  TEveGeoShape* shape = new TEveGeoShape(TString::Format("RecoGeom Id=%u", id));
430 
431  TGeoXtru* geoShape = new TGeoXtru(2);
432  Double_t x[4] = {info.points[0], info.points[3], info.points[6], info.points[9]};
433  Double_t y[4] = {info.points[1], info.points[4], info.points[7], info.points[10]};
434 
435  bool isNeg = info.shape[3] < 0;
436  geoShape->DefinePolygon(4, x, y);
437  geoShape->DefineSection(0, isNeg * info.shape[3]);
438  geoShape->DefineSection(1, !isNeg * info.shape[3]);
439  info.translation[2] = info.points[2];
440 
441  shape->SetShape(geoShape);
442  double array[16] = {info.matrix[0],
443  info.matrix[3],
444  info.matrix[6],
445  0.,
446  info.matrix[1],
447  info.matrix[4],
448  info.matrix[7],
449  0.,
450  info.matrix[2],
451  info.matrix[5],
452  info.matrix[8],
453  0.,
454  info.translation[0],
455  info.translation[1],
456  info.translation[2],
457  1.};
458  // Set transformation matrix from a column-major array
459  shape->SetTransMatrix(array);
460  return shape;
461 }
static const TGPicture * info(bool iBackgroundIsBlack)
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:516
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:165
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:137
TEveGeoShape * FWGeometry::getHGCSiliconEveShape ( unsigned int  id) const

Definition at line 353 of file FWGeometry.cc.

References mps_check::array, PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, f, find(), fwLog, info(), fwlog::kWarning, m_idToInfo, FWGeometry::GeomDetInfo::matrix, FWGeometry::GeomDetInfo::points, mathSSE::sqrt(), FWGeometry::GeomDetInfo::translation, x, testProducerWithPsetDescEmpty_cfi::x1, and y.

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

353  {
354 #if 0
355  const unsigned int type = (id>>26)&0x3;
356  // select the middle cell of each waifer
357  id &= ~0x3FF;
358  id |= (type == 0) ? 0x16B : 0xE7;
359 #else
360  float sideToSideWaferSize = 16.7441f;
361  float dx = sideToSideWaferSize / 2;
362  float sidey = dx / sqrt(3);
363  float dy = 2 * sidey;
364 
365  int waferUint = (id >> 10) & 0xF;
366  int waferVint = (id >> 15) & 0xF;
367  float waferU = ((id >> 14) & 0x1) ? -sideToSideWaferSize * waferUint : sideToSideWaferSize * waferUint;
368  float waferV = ((id >> 19) & 0x1) ? -sideToSideWaferSize * waferVint : sideToSideWaferSize * waferVint;
369 
370  float waferX = (-2 * waferU + waferV) / 2;
371  float waferY = waferV * sqrt(3) / 2;
372 #endif
373  IdToInfoItr it = FWGeometry::find(id);
374  if (it == m_idToInfo.end()) {
375  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
376  return nullptr;
377  }
378 
379  GeomDetInfo info = *it;
380 
381  TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
382  TEveGeoShape* shape = new TEveGeoShape(TString::Format("RecoGeom Id=%u", id));
383 
384  float dz = fabs(info.points[14] - info.points[2]) * 0.5;
385 
386  info.translation[2] = (info.points[14] + info.points[2]) / 2.0f;
387  info.translation[0] = waferX * ((0 < info.translation[2]) - (info.translation[2] < 0));
388  info.translation[1] = waferY;
389 
390  TGeoXtru* geoShape = new TGeoXtru(2);
391  Double_t x[6] = {-dx, -dx, 0.0, dx, dx, 0.0};
392  Double_t y[6] = {-sidey, sidey, dy, sidey, -sidey, -dy};
393  geoShape->DefinePolygon(6, x, y);
394  geoShape->DefineSection(0, -dz);
395  geoShape->DefineSection(1, dz);
396 
397  shape->SetShape(geoShape);
398  double array[16] = {info.matrix[0],
399  info.matrix[3],
400  info.matrix[6],
401  0.,
402  info.matrix[1],
403  info.matrix[4],
404  info.matrix[7],
405  0.,
406  info.matrix[2],
407  info.matrix[5],
408  info.matrix[8],
409  0.,
410  info.translation[0],
411  info.translation[1],
412  info.translation[2],
413  1.};
414  // Set transformation matrix from a column-major array
415  shape->SetTransMatrix(array);
416  return shape;
417 }
type
Definition: HCALResponse.h:21
static const TGPicture * info(bool iBackgroundIsBlack)
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:516
T sqrt(T t)
Definition: SSEVec.h:19
double f[11][100]
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:165
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:137
std::vector< unsigned int > FWGeometry::getMatchedIds ( Detector  det,
SubDetector  subdet 
) const

Definition at line 250 of file FWGeometry.cc.

References photons_cff::ids, m_idToInfo, and match_id().

Referenced by FW3DViewBase::showEcalBarrel(), FW3DViewGeometry::showHGCalEE(), FW3DViewGeometry::showHGCalHSc(), FW3DViewGeometry::showHGCalHSi(), FW3DViewGeometry::showPixelBarrel(), FWRPZViewGeometry::showPixelBarrel(), FW3DViewGeometry::showPixelEndcap(), FWRPZViewGeometry::showPixelEndcap(), FW3DViewGeometry::showTrackerBarrel(), FWRPZViewGeometry::showTrackerBarrel(), FW3DViewGeometry::showTrackerEndcap(), FWRPZViewGeometry::showTrackerEndcap(), and FWGeometry::VersionInfo::VersionInfo().

250  {
251  std::vector<unsigned int> ids;
252  unsigned int mask = (det << 4) | (subdet);
253  for (IdToInfoItr it = m_idToInfo.begin(), itEnd = m_idToInfo.end(); it != itEnd; ++it) {
254  if (FWGeometry::match_id(*it, mask))
255  ids.push_back((*it).id);
256  }
257 
258  return ids;
259 }
bool match_id(const GeomDetInfo &o, unsigned int mask) const
Definition: FWGeometry.h:131
IdToInfo m_idToInfo
Definition: FWGeometry.h:165
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:137
std::vector< unsigned int > FWGeometry::getMatchedIds ( Detector  det) const

Definition at line 261 of file FWGeometry.cc.

References RemoveAddSevLevel::flag, HGCalHSc, photons_cff::ids, kDetOffset, and m_idToInfo.

261  {
262  std::vector<unsigned int> ids;
263 
264  for (const auto& it : m_idToInfo) {
265  if (((it.id >> kDetOffset) & 0xF) != det)
266  continue;
267  // select only the 1st layer
268  // if(((it->id>>17)&0x1F) != 12) continue;
269 
270  // select only the first cell of each wafer
271  if (det != HGCalHSc) {
272  bool flag(false);
273 
274  for (const auto& id_it : ids) {
275  flag = (~0x3FF & it.id) == (~0x3FF & id_it);
276  if (flag)
277  break;
278  }
279 
280  if (flag)
281  continue;
282  }
283 
284  ids.push_back(it.id);
285  }
286  return ids;
287 }
static const int kDetOffset
Definition: FWGeometry.h:29
IdToInfo m_idToInfo
Definition: FWGeometry.h:165
const TGeoMatrix * FWGeometry::getMatrix ( unsigned int  id) const

Definition at line 221 of file FWGeometry.cc.

References find(), fwLog, triggerObjects_cff::id, info(), fwlog::kWarning, m_idToInfo, m_idToMatrix, FWGeometry::GeomDetInfo::matrix, makeMuonMisalignmentScenario::matrix, idealTransformation::rotation, and FWGeometry::GeomDetInfo::translation.

Referenced by FWTrackResidualDetailView::getSignedResidual(), ValidateGeometry::validateCSChamberGeometry(), ValidateGeometry::validateCSCLayerGeometry(), DTGeometryValidate::validateDTChamberGeometry(), ValidateGeometry::validateDTChamberGeometry(), DTGeometryValidate::validateDTLayerGeometry(), ValidateGeometry::validateDTLayerGeometry(), RPCGeometryValidate::validateRPCChamberGeometry(), ValidateGeometry::validateRPCGeometry(), ValidateGeometry::validateTrackerGeometry(), and FWGeometry::VersionInfo::VersionInfo().

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

Definition at line 474 of file FWGeometry.cc.

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

Referenced by fireworks::addSiStripClusters(), FWHGCalMultiClusterProxyBuilder::build(), FWHGCalTriggerCellProxyBuilder::build(), FWSiStripClusterProxyBuilder::build(), FWHGCalTriggerClusterProxyBuilder::build(), FWCaloParticleProxyBuilder::build(), FWSiStripDigiProxyBuilder::build(), FWCSCStripDigiProxyBuilder::build(), FWRPCDigiProxyBuilder::build(), FWPhase2TrackerCluster1DProxyBuilder::build(), FWCaloClusterProxyBuilder::build(), FWSiPixelDigiProxyBuilder::build(), FWSiPixelClusterProxyBuilder::build(), FWGEMDigiProxyBuilder::build(), FWTrajectorySeedProxyBuilder::build(), FWHGCRecHitProxyBuilder::build(), FWGEMPadDigiProxyBuilder::build(), FWDTDigiProxyBuilder::buildViewType(), fireworks::pushNearbyPixelHits(), fireworks::pushPixelHits(), ValidateGeometry::validateCSCLayerGeometry(), DTGeometryValidate::validateDTLayerGeometry(), ValidateGeometry::validateDTLayerGeometry(), ValidateGeometry::validatePixelTopology(), ValidateGeometry::validateRPCGeometry(), RPCGeometryValidate::validateRPCStripsGeometry(), ValidateGeometry::validateStripTopology(), and FWGeometry::VersionInfo::VersionInfo().

474  {
475  // reco geometry parameters
476  IdToInfoItr it = FWGeometry::find(id);
477  if (it == m_idToInfo.end()) {
478  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
479  return nullptr;
480  } else {
481  return (*it).parameters;
482  }
483 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:516
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:165
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:137
int FWGeometry::getProducerVersion ( ) const
inline

Definition at line 152 of file FWGeometry.h.

References getShape(), and m_producerVersion.

152 { return m_producerVersion; }
int m_producerVersion
Definition: FWGeometry.h:171
TGeoShape * FWGeometry::getShape ( unsigned int  id) const

Definition at line 289 of file FWGeometry.cc.

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

Referenced by FWSiStripClusterProxyBuilder::build(), getEveShape(), getProducerVersion(), and FWGeometry::VersionInfo::VersionInfo().

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

Definition at line 299 of file FWGeometry.cc.

References FWGeometry::GeomDetInfo::shape.

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

Definition at line 485 of file FWGeometry.cc.

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

Referenced by FWHGCalMultiClusterProxyBuilder::build(), FWHGCalTriggerCellProxyBuilder::build(), FWHGCalTriggerClusterProxyBuilder::build(), FWCaloParticleProxyBuilder::build(), FWCSCStripDigiProxyBuilder::build(), FWPhase2TrackerCluster1DProxyBuilder::build(), FWCaloClusterProxyBuilder::build(), FWCSCWireDigiProxyBuilder::build(), FWHGCRecHitProxyBuilder::build(), ValidateGeometry::validateCSChamberGeometry(), ValidateGeometry::validateCSCLayerGeometry(), DTGeometryValidate::validateDTChamberGeometry(), ValidateGeometry::validateDTChamberGeometry(), DTGeometryValidate::validateDTLayerGeometry(), ValidateGeometry::validateDTLayerGeometry(), RPCGeometryValidate::validateRPCChamberGeometry(), ValidateGeometry::validateRPCGeometry(), ValidateGeometry::validateTrackerGeometry(), and FWGeometry::VersionInfo::VersionInfo().

485  {
486  // reco geometry parameters
487  IdToInfoItr it = FWGeometry::find(id);
488  if (it == m_idToInfo.end()) {
489  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
490  return nullptr;
491  } else {
492  return (*it).shape;
493  }
494 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:516
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:165
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:137
const TrackerTopology* FWGeometry::getTrackerTopology ( ) const
inline
void FWGeometry::initMap ( const FWRecoGeom::InfoMap map)

Definition at line 199 of file FWGeometry.cc.

References begin, end, mps_fire::i, dqmiolumiharvest::j, m_idToInfo, makeMuonMisalignmentScenario::matrix, and HLT_2018_cff::points.

Referenced by FWGeometry::VersionInfo::VersionInfo().

199  {
200  FWRecoGeom::InfoMapItr begin = map.begin();
202  unsigned int mapSize = map.size();
203  if (m_idToInfo.size() != mapSize)
204  m_idToInfo.resize(mapSize);
205  unsigned int i = 0;
206  for (FWRecoGeom::InfoMapItr it = begin; it != end; ++it, ++i) {
207  m_idToInfo[i].id = it->id;
208  for (unsigned int j = 0; j < 24; ++j)
209  m_idToInfo[i].points[j] = it->points[j];
210  for (unsigned int j = 0; j < 9; ++j)
211  m_idToInfo[i].parameters[j] = it->topology[j];
212  for (unsigned int j = 0; j < 5; ++j)
213  m_idToInfo[i].shape[j] = it->shape[j];
214  for (unsigned int j = 0; j < 3; ++j)
215  m_idToInfo[i].translation[j] = it->translation[j];
216  for (unsigned int j = 0; j < 9; ++j)
217  m_idToInfo[i].matrix[j] = it->matrix[j];
218  }
219 }
std::vector< FWRecoGeom::Info >::const_iterator InfoMapItr
Definition: FWRecoGeom.h:24
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
IdToInfo m_idToInfo
Definition: FWGeometry.h:165
bool FWGeometry::isEmpty ( void  ) const

Definition at line 27 of file FWGeometry.cc.

References m_idToInfo.

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

27  {
28  // AMT this is a check if geomtery is not loaded
29  // e.g. cmsShow starts with no data file and without given explicit argument ( --geometry-file option )
30 
31  return m_idToInfo.empty();
32 }
IdToInfo m_idToInfo
Definition: FWGeometry.h:165
void FWGeometry::loadMap ( const char *  fileName)

Definition at line 99 of file FWGeometry.cc.

References FWGeometry::VersionInfo::cmsswVersion, FWGeometry::VersionInfo::extraDetectors, FrontierConditions_GlobalTag_cff::file, findFile(), StandaloneTrackerTopology::fromTrackerParametersXMLString(), fwLog, mps_fire::i, triggerObjects_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, HLT_2018_cff::points, FWGeometry::VersionInfo::productionTag, AlCaHLTBitMon_QueryRunRegistry::string, and ecaldqm::topology().

Referenced by applyGlobalTag(), DTGeometryValidate::DTGeometryValidate(), CmsShowMainBase::loadGeometry(), RPCGeometryValidate::RPCGeometryValidate(), ValidateGeometry::ValidateGeometry(), and FWGeometry::VersionInfo::VersionInfo().

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

Definition at line 496 of file FWGeometry.cc.

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

Referenced by fireworks::addSiStripClusters(), FWTrackTrackingRecHitProxyBuilder::build(), FWME0DigiProxyBuilder::build(), FWME0SegmentProxyBuilder::build(), FWSiStripClusterProxyBuilder::build(), FWCSCRecHitProxyBuilder::build(), FWCSCStripDigiProxyBuilder::build(), FWSiStripDigiProxyBuilder::build(), FWRPCDigiProxyBuilder::build(), FWPhase2TrackerCluster1DProxyBuilder::build(), FWCSCWireDigiProxyBuilder::build(), FWCSCSegmentProxyBuilder::build(), FWSiPixelDigiProxyBuilder::build(), FWGEMDigiProxyBuilder::build(), FWSiPixelClusterProxyBuilder::build(), FWTrackingParticleProxyBuilderFullFramework::build(), FWTrajectorySeedProxyBuilder::build(), FWGEMPadDigiProxyBuilder::build(), FWME0RecHitProxyBuilder::buildViewType(), FWGEMSegmentProxyBuilder::buildViewType(), FWPSimHitProxyBuilder::buildViewType(), FWRPCRecHitProxyBuilder::buildViewType(), FWDTRecHitProxyBuilder::buildViewType(), FWGEMRecHitProxyBuilder::buildViewType(), FWDTSegmentProxyBuilder::buildViewType(), FWDTDigiProxyBuilder::buildViewType(), clear(), FWRPZViewGeometry::estimateProjectionSizeDT(), localToGlobal(), fireworks::pushPixelCluster(), and FWGeometry::VersionInfo::VersionInfo().

496  {
497  IdToInfoItr it = FWGeometry::find(id);
498  if (it == m_idToInfo.end()) {
499  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
500  } else {
501  localToGlobal(*it, local, global, translatep);
502  }
503 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:516
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:496
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:165
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:137
void FWGeometry::localToGlobal ( unsigned int  id,
const float *  local1,
float *  global1,
const float *  local2,
float *  global2,
bool  translatep = true 
) const

Definition at line 505 of file FWGeometry.cc.

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

506  {
507  IdToInfoItr it = FWGeometry::find(id);
508  if (it == m_idToInfo.end()) {
509  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
510  } else {
511  localToGlobal(*it, local1, global1, translatep);
512  localToGlobal(*it, local2, global2, translatep);
513  }
514 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:516
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:496
#define fwLog(_level_)
Definition: fwLog.h:45
IdToInfo m_idToInfo
Definition: FWGeometry.h:165
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:137
void FWGeometry::localToGlobal ( const GeomDetInfo info,
const float *  local,
float *  global,
bool  translatep = true 
) const

Definition at line 522 of file FWGeometry.cc.

References mps_fire::i, FWGeometry::GeomDetInfo::matrix, and FWGeometry::GeomDetInfo::translation.

522  {
523  for (int i = 0; i < 3; ++i) {
524  global[i] = translatep ? info.translation[i] : 0;
525  global[i] += local[0] * info.matrix[3 * i] + local[1] * info.matrix[3 * i + 1] + local[2] * info.matrix[3 * i + 2];
526  }
527 }
static const TGPicture * info(bool iBackgroundIsBlack)
IdToInfoItr FWGeometry::mapEnd ( ) const
inline

Definition at line 141 of file FWGeometry.h.

References m_idToInfo.

Referenced by FWRPZViewGeometry::makeMuonGeometryRhoZ().

141 { return m_idToInfo.end(); }
IdToInfo m_idToInfo
Definition: FWGeometry.h:165
bool FWGeometry::match_id ( const GeomDetInfo o,
unsigned int  mask 
) const
inline

Definition at line 131 of file FWGeometry.h.

References FWGeometry::GeomDetInfo::id.

Referenced by getMatchedIds().

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

Member Data Documentation

const int FWGeometry::kDetOffset = 28
static

Definition at line 29 of file FWGeometry.h.

Referenced by getMatchedIds().

const int FWGeometry::kSubdetOffset = 25
static

Definition at line 30 of file FWGeometry.h.

std::string FWGeometry::m_fileName
private

Definition at line 173 of file FWGeometry.h.

Referenced by applyGlobalTag(), and loadMap().

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

Definition at line 163 of file FWGeometry.h.

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

std::string FWGeometry::m_prodTag
private

Definition at line 167 of file FWGeometry.h.

int FWGeometry::m_producerVersion
private

Definition at line 171 of file FWGeometry.h.

Referenced by getProducerVersion(), and loadMap().

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

Definition at line 175 of file FWGeometry.h.

Referenced by getTrackerTopology(), and loadMap().

VersionInfo FWGeometry::m_versionInfo
private

Definition at line 169 of file FWGeometry.h.

Referenced by loadMap(), and versionInfo().