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) const
 
std::vector< unsigned int > getMatchedIds (Detector det, SubDetector subdet) const
 
const TGeoMatrix * getMatrix (unsigned int id) const
 
const float * getParameters (unsigned int id) const
 
int getProducerVersion () const
 
TGeoShape * getShape (const GeomDetInfo &info) const
 
TGeoShape * getShape (unsigned int id) 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 (const GeomDetInfo &info, const float *local, float *global, bool translatep=true) const
 
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
 
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 136 of file FWGeometry.h.

◆ IdToInfoItr

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

Definition at line 137 of file FWGeometry.h.

Member Enumeration Documentation

◆ Detector

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  };

◆ SubDetector

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::FWGeometry ( void  )

Definition at line 27 of file FWGeometry.cc.

27 : m_producerVersion(0) {}

◆ ~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.

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 }

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

Referenced by CmsShowMain::fileChangedSlot().

◆ clear()

void FWGeometry::clear ( void  )
inline

Definition at line 143 of file FWGeometry.h.

143  {
144  m_idToInfo.clear();
145  m_idToMatrix.clear();
146  }

References m_idToInfo, and m_idToMatrix.

◆ contains()

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

Definition at line 139 of file FWGeometry.h.

139 { return FWGeometry::find(id) != m_idToInfo.end(); }

References find(), and m_idToInfo.

Referenced by LumiList.LumiList::__contains__().

◆ 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.

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 }

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().

◆ getCorners()

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

◆ getEveShape()

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

Definition at line 324 of file FWGeometry.cc.

324  {
325  IdToInfoItr it = FWGeometry::find(id);
326  if (it == m_idToInfo.end()) {
327  fwLog(fwlog::kWarning) << "no reco geoemtry found for id " << id << std::endl;
328  return nullptr;
329  } else {
330  const GeomDetInfo& info = *it;
331  double array[16] = {info.matrix[0],
332  info.matrix[3],
333  info.matrix[6],
334  0.,
335  info.matrix[1],
336  info.matrix[4],
337  info.matrix[7],
338  0.,
339  info.matrix[2],
340  info.matrix[5],
341  info.matrix[8],
342  0.,
343  info.translation[0],
344  info.translation[1],
345  info.translation[2],
346  1.};
347  TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
348  TEveGeoShape* shape = new TEveGeoShape(TString::Format("RecoGeom Id=%u", id));
349  TGeoShape* geoShape = getShape(info);
350  shape->SetShape(geoShape);
351  // Set transformation matrix from a column-major array
352  shape->SetTransMatrix(array);
353  return shape;
354  }
355 }

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

Referenced by FWTrackHitsDetailView::addModules(), FWConvTrackHitsDetailView::addModules(), FWME0SegmentProxyBuilder::build(), FWCSCSegmentProxyBuilder::build(), 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(), and FWRPZViewGeometry::showTrackerEndcap().

◆ getHGCScintillatorEveShape()

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

Definition at line 423 of file FWGeometry.cc.

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

References mps_check::array, find(), fwLog, info(), fwlog::kWarning, m_idToInfo, x, and y.

Referenced by FW3DViewGeometry::showHGCalHSc().

◆ getHGCSiliconEveShape()

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

Definition at line 357 of file FWGeometry.cc.

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

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

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

◆ getMatchedIds() [1/2]

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

Definition at line 265 of file FWGeometry.cc.

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

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

◆ getMatchedIds() [2/2]

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

Definition at line 254 of file FWGeometry.cc.

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) {
258  if (FWGeometry::match_id(*it, mask))
259  ids.push_back((*it).id);
260  }
261 
262  return ids;
263 }

References m_idToInfo, and match_id().

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

◆ getMatrix()

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

Definition at line 225 of file FWGeometry.cc.

225  {
226  std::map<unsigned int, TGeoMatrix*>::iterator mit = m_idToMatrix.find(id);
227  if (mit != m_idToMatrix.end())
228  return mit->second;
229 
230  IdToInfoItr it = FWGeometry::find(id);
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 }

References find(), fwLog, triggerObjects_cff::id, info(), 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().

◆ getParameters()

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

◆ getProducerVersion()

int FWGeometry::getProducerVersion ( ) const
inline

Definition at line 152 of file FWGeometry.h.

152 { return m_producerVersion; }

References m_producerVersion.

◆ getShape() [1/2]

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

Definition at line 303 of file FWGeometry.cc.

303  {
304  TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
305  TGeoShape* geoShape = nullptr;
306  if (info.shape[0] == 1) {
307  geoShape = new TGeoTrap(info.shape[3], //dz
308  0, //theta
309  0, //phi
310  info.shape[4], //dy1
311  info.shape[1], //dx1
312  info.shape[2], //dx2
313  0, //alpha1
314  info.shape[4], //dy2
315  info.shape[1], //dx3
316  info.shape[2], //dx4
317  0); //alpha2
318  } else
319  geoShape = new TGeoBBox(info.shape[1], info.shape[2], info.shape[3]);
320 
321  return geoShape;
322 }

References info().

◆ getShape() [2/2]

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

Definition at line 293 of file FWGeometry.cc.

293  {
294  IdToInfoItr it = FWGeometry::find(id);
295  if (it == m_idToInfo.end()) {
296  fwLog(fwlog::kWarning) << "no reco geoemtry found for id " << id << std::endl;
297  return nullptr;
298  } else {
299  return getShape(*it);
300  }
301 }

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

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

◆ getShapePars()

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

◆ getTrackerTopology()

const TrackerTopology* FWGeometry::getTrackerTopology ( ) const
inline

◆ initMap()

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

Definition at line 203 of file FWGeometry.cc.

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 }

References mps_fire::end, cms::cuda::for(), mps_fire::i, dqmiolumiharvest::j, m_idToInfo, genParticles_cff::map, makeMuonMisalignmentScenario::matrix, and HLT_FULL_cff::points.

Referenced by FWFFLooper::beginRun(), and FWFFService::postBeginRun().

◆ isEmpty()

bool FWGeometry::isEmpty ( void  ) const

Definition at line 31 of file FWGeometry.cc.

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 }

References m_idToInfo.

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

◆ loadMap()

void FWGeometry::loadMap ( const char *  fileName)

Definition at line 103 of file FWGeometry.cc.

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 }

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_FULL_cff::points, FWGeometry::VersionInfo::productionTag, AlCaHLTBitMon_QueryRunRegistry::string, and ecaldqm::topology().

Referenced by applyGlobalTag(), CSCGeometryValidate::CSCGeometryValidate(), GEMGeometryValidate::GEMGeometryValidate(), CmsShowMainBase::loadGeometry(), ME0GeometryValidate::ME0GeometryValidate(), RPCGeometryValidate::RPCGeometryValidate(), and ValidateGeometry::ValidateGeometry().

◆ localToGlobal() [1/3]

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

Definition at line 526 of file FWGeometry.cc.

526  {
527  for (int i = 0; i < 3; ++i) {
528  global[i] = translatep ? info.translation[i] : 0;
529  global[i] += local[0] * info.matrix[3 * i] + local[1] * info.matrix[3 * i + 1] + local[2] * info.matrix[3 * i + 2];
530  }
531 }

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

◆ localToGlobal() [2/3]

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

Definition at line 500 of file FWGeometry.cc.

500  {
501  IdToInfoItr it = FWGeometry::find(id);
502  if (it == m_idToInfo.end()) {
503  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
504  } else {
505  localToGlobal(*it, local, global, translatep);
506  }
507 }

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

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

◆ localToGlobal() [3/3]

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

Definition at line 509 of file FWGeometry.cc.

510  {
511  IdToInfoItr it = FWGeometry::find(id);
512  if (it == m_idToInfo.end()) {
513  fwLog(fwlog::kWarning) << "no reco geometry found for id " << id << std::endl;
514  } else {
515  localToGlobal(*it, local1, global1, translatep);
516  localToGlobal(*it, local2, global2, translatep);
517  }
518 }

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

◆ mapEnd()

IdToInfoItr FWGeometry::mapEnd ( ) const
inline

Definition at line 141 of file FWGeometry.h.

141 { return m_idToInfo.end(); }

References m_idToInfo.

Referenced by FWRPZViewGeometry::makeMuonGeometryRhoZ().

◆ match_id()

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

Definition at line 131 of file FWGeometry.h.

131  {
132  unsigned int id = o.id;
133  return (((((id >> kDetOffset) & 0xF) << 4) | ((id >> kSubdetOffset) & 0x7)) == mask);
134  }

References kDetOffset, kSubdetOffset, and EcalTangentSkim_cfg::o.

Referenced by getMatchedIds().

◆ versionInfo()

const VersionInfo& FWGeometry::versionInfo ( ) const
inline

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 173 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 163 of file FWGeometry.h.

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

◆ m_prodTag

std::string FWGeometry::m_prodTag
private

Definition at line 167 of file FWGeometry.h.

◆ m_producerVersion

int FWGeometry::m_producerVersion
private

Definition at line 171 of file FWGeometry.h.

Referenced by getProducerVersion(), and loadMap().

◆ m_trackerTopology

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

Definition at line 175 of file FWGeometry.h.

Referenced by getTrackerTopology(), and loadMap().

◆ m_versionInfo

VersionInfo FWGeometry::m_versionInfo
private

Definition at line 169 of file FWGeometry.h.

Referenced by loadMap(), and versionInfo().

DDAxes::y
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
mps_fire.i
i
Definition: mps_fire.py:428
FWGeometry::match_id
bool match_id(const GeomDetInfo &o, unsigned int mask) const
Definition: FWGeometry.h:131
makeMuonMisalignmentScenario.matrix
list matrix
Definition: makeMuonMisalignmentScenario.py:141
FWGeometry::loadMap
void loadMap(const char *fileName)
Definition: FWGeometry.cc:103
HLT_FULL_cff.points
points
Definition: HLT_FULL_cff.py:21455
FWGeometry::TID
Definition: FWGeometry.h:47
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
FWGeometry::VersionInfo::productionTag
TNamed * productionTag
Definition: FWGeometry.h:68
FWGeometry::RPCBarrel
Definition: FWGeometry.h:52
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
tree
Definition: tree.py:1
FWGeometry::localToGlobal
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:500
FWGeometry::IdToInfoItr
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:137
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
personalPlayback.fp
fp
Definition: personalPlayback.py:523
FWGeometry::DT
Definition: FWGeometry.h:51
mps_check.array
array
Definition: mps_check.py:216
FWGeometry::RPCEndcap
Definition: FWGeometry.h:53
DDAxes::x
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
FWGeometry::m_versionInfo
VersionInfo m_versionInfo
Definition: FWGeometry.h:169
Muon
Definition: Muon.py:1
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:36
FWGeometry::kDetOffset
static const int kDetOffset
Definition: FWGeometry.h:29
StandaloneTrackerTopology::fromTrackerParametersXMLString
TrackerTopology fromTrackerParametersXMLString(const std::string &xmlContent)
Definition: StandaloneTrackerTopology.cc:180
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
test
Definition: SmallWORMDict.h:13
ecaldqm::topology
const CaloTopology * topology(nullptr)
FWGeometry::Tracker
Definition: FWGeometry.h:33
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
mps_fire.end
end
Definition: mps_fire.py:242
FWGeometry::Hcal
Definition: FWGeometry.h:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
FWGeometry::TOB
Definition: FWGeometry.h:48
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
FWGeometry::VersionInfo::extraDetectors
TObjArray * extraDetectors
Definition: FWGeometry.h:70
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
FWGeometry::CSC
Definition: FWGeometry.h:50
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
FWGeometry::m_idToInfo
IdToInfo m_idToInfo
Definition: FWGeometry.h:165
FWGeometry::Ecal
Definition: FWGeometry.h:35
FWGeometry::m_producerVersion
int m_producerVersion
Definition: FWGeometry.h:171
fwlog::kWarning
Definition: fwLog.h:35
PVValHelper::dy
Definition: PVValidationHelpers.h:49
FWGeometry::m_trackerTopology
std::unique_ptr< TrackerTopology > m_trackerTopology
Definition: FWGeometry.h:175
FWGeometry::TIB
Definition: FWGeometry.h:46
FWRecoGeom::InfoMapItr
std::vector< FWRecoGeom::Info >::const_iterator InfoMapItr
Definition: FWRecoGeom.h:24
FWGeometry::HGCalHSi
Definition: FWGeometry.h:39
cms::cuda::for
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
Definition: HistoContainer.h:27
FWGeometry::HGCalHSc
Definition: FWGeometry.h:40
FWGeometry::TEC
Definition: FWGeometry.h:49
FWGeometry::m_idToMatrix
std::map< unsigned int, TGeoMatrix * > m_idToMatrix
Definition: FWGeometry.h:163
FWGeometry::PixelBarrel
Definition: FWGeometry.h:44
alignCSCRings.r
r
Definition: alignCSCRings.py:93
FWGeometry::ME0
Definition: FWGeometry.h:55
fwlog::kInfo
Definition: fwLog.h:35
FWGeometry::VersionInfo::cmsswVersion
TNamed * cmsswVersion
Definition: FWGeometry.h:69
FWGeometry::HGCalTrigger
Definition: FWGeometry.h:41
FWGeometry::findFile
static TFile * findFile(const char *fileName)
Definition: FWGeometry.cc:38
download_sqlite_cfg.globalTag
globalTag
Definition: download_sqlite_cfg.py:4
PVValHelper::dz
Definition: PVValidationHelpers.h:50
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
FWGeometry::Calo
Definition: FWGeometry.h:37
personalPlayback.fn
fn
Definition: personalPlayback.py:515
Skims_PA_cff.paths
paths
Definition: Skims_PA_cff.py:18
FWGeometry::GEM
Definition: FWGeometry.h:54
FWGeometry::getShape
TGeoShape * getShape(unsigned int id) const
Definition: FWGeometry.cc:293
FWGeometry::kSubdetOffset
static const int kSubdetOffset
Definition: FWGeometry.h:30
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
DTRecHitClients_cfi.local
local
Definition: DTRecHitClients_cfi.py:10
FWGeometry::m_fileName
std::string m_fileName
Definition: FWGeometry.h:173
genParticles_cff.map
map
Definition: genParticles_cff.py:11
FWGeometry::PixelEndcap
Definition: FWGeometry.h:45
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
PVValHelper::dx
Definition: PVValidationHelpers.h:48
FWGeometry::HGCalEE
Definition: FWGeometry.h:38
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
FWGeometry::find
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:520