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

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

Member Typedef Documentation

Definition at line 113 of file FWGeometry.h.

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

Definition at line 114 of file FWGeometry.h.

Member Enumeration Documentation

Enumerator
Tracker 
Muon 
Ecal 
Hcal 
Calo 
HGCalEE 
HGCalHSi 
HGCalHSc 
HGCalTrigger 

Definition at line 34 of file FWGeometry.h.

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

Definition at line 35 of file FWGeometry.h.

Constructor & Destructor Documentation

FWGeometry::FWGeometry ( void  )

Definition at line 23 of file FWGeometry.cc.

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

24 {}
int m_producerVersion
Definition: FWGeometry.h:144
FWGeometry::~FWGeometry ( void  )

Definition at line 26 of file FWGeometry.cc.

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

27 {}

Member Function Documentation

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

Definition at line 117 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(), FWGEMSegmentProxyBuilder::buildViewType(), FWME0RecHitProxyBuilder::buildViewType(), FWPSimHitProxyBuilder::buildViewType(), FWDTRecHitProxyBuilder::buildViewType(), FWRPCRecHitProxyBuilder::buildViewType(), FWGEMRecHitProxyBuilder::buildViewType(), FWDTSegmentProxyBuilder::buildViewType(), FWDTDigiProxyBuilder::buildViewType(), FWHFTowerProxyBuilderBase::fillTowerForDetId(), FWHGTowerProxyBuilderBase::fillTowerForDetId(), fireworks::pushNearbyPixelHits(), and fireworks::pushPixelHits().

117  {
118  return FWGeometry::find( id ) != m_idToInfo.end();
119  }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:508
IdToInfo m_idToInfo
Definition: FWGeometry.h:138
FWGeometry::IdToInfoItr FWGeometry::find ( unsigned int  id) const
TFile * FWGeometry::findFile ( const char *  fileName)
static

Definition at line 30 of file FWGeometry.cc.

References MillePedeFileConverter_cfg::fileName, mps_fire::i, callgraph::path, and AlCaHLTBitMon_QueryRunRegistry::string.

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

31 {
32  std::string searchPath = ".";
33 
34  if (gSystem->Getenv( "CMSSW_SEARCH_PATH" ))
35  {
36 
37  TString paths = gSystem->Getenv( "CMSSW_SEARCH_PATH" );
38 
39  TObjArray* tokens = paths.Tokenize( ":" );
40  for( int i = 0; i < tokens->GetEntries(); ++i )
41  {
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 430 of file FWGeometry.cc.

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

Referenced by FWPFCandidateWithHitsProxyBuilder::addHitsForCandidate(), FWCaloRecHitDigitSetProxyBuilder::build(), FWPRCaloTowerProxyBuilder::build(), FWHGCalMultiClusterProxyBuilder::build(), FWHGCRecHitProxyBuilder::build(), FWPCaloHitProxyBuilder::build(), FWCaloParticleProxyBuilder::build(), FWCaloClusterProxyBuilder::build(), FWPFEcalRecHitRPProxyBuilder::build(), FWPFEcalRecHitLegoProxyBuilder::build(), FWPhotonProxyBuilder::buildViewType(), FWECALCaloDataDetailViewBuilder::fillData(), FWECALDetailViewBuilder::fillEtaPhi(), FWHFTowerProxyBuilderBase::fillTowerForDetId(), FWHGTowerProxyBuilderBase::fillTowerForDetId(), FWHGTowerSliceSelector::findBinFromId(), FWHFTowerSliceSelector::findBinFromId(), fireworks::makeRhoPhiSuperCluster(), fireworks::makeRhoZSuperCluster(), FWCaloRecHitDigitSetProxyBuilder::scaleProduct(), FWPFCandidateWithHitsProxyBuilder::scaleProduct(), FW3DViewBase::showEcalBarrel(), ValidateGeometry::validateCaloGeometry(), and FWGeometry::VersionInfo::VersionInfo().

431 {
432  // reco geometry points
433  IdToInfoItr it = FWGeometry::find( id );
434  if( it == m_idToInfo.end())
435  {
436  fwLog( fwlog::kWarning ) << "no reco geometry found for id " << id << std::endl;
437  return nullptr;
438  }
439  else
440  {
441  return ( *it ).points;
442  }
443 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:508
#define fwLog(_level_)
Definition: fwLog.h:50
IdToInfo m_idToInfo
Definition: FWGeometry.h:138
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:114
TEveGeoShape * FWGeometry::getEveShape ( unsigned int  id) const

Definition at line 298 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(), FWGEMSegmentProxyBuilder::buildViewType(), FWME0RecHitProxyBuilder::buildViewType(), FWRPCRecHitProxyBuilder::buildViewType(), FWGEMRecHitProxyBuilder::buildViewType(), FWDTSegmentProxyBuilder::buildViewType(), FWRPZViewGeometry::makeMuonGeometryRhoPhi(), FWRPZViewGeometry::makeMuonGeometryRhoZ(), FWRPZViewGeometry::showGEM(), FWRPZViewGeometry::showME0(), FW3DViewGeometry::showMuonBarrel(), FW3DViewGeometry::showMuonBarrelFull(), FW3DViewGeometry::showMuonEndcap(), FWRPZViewGeometry::showPixelBarrel(), FW3DViewGeometry::showPixelBarrel(), FWRPZViewGeometry::showPixelEndcap(), FW3DViewGeometry::showPixelEndcap(), FWRPZViewGeometry::showRpcEndcap(), FWRPZViewGeometry::showTrackerBarrel(), FW3DViewGeometry::showTrackerBarrel(), FWRPZViewGeometry::showTrackerEndcap(), FW3DViewGeometry::showTrackerEndcap(), and FWGeometry::VersionInfo::VersionInfo().

299 {
300  IdToInfoItr it = FWGeometry::find( id );
301  if( it == m_idToInfo.end())
302  {
303  fwLog( fwlog::kWarning ) << "no reco geoemtry found for id " << id << std::endl;
304  return nullptr;
305  }
306  else
307  {
308  const GeomDetInfo& info = *it;
309  double array[16] = { info.matrix[0], info.matrix[3], info.matrix[6], 0.,
310  info.matrix[1], info.matrix[4], info.matrix[7], 0.,
311  info.matrix[2], info.matrix[5], info.matrix[8], 0.,
312  info.translation[0], info.translation[1], info.translation[2], 1.
313  };
314  TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
315  TEveGeoShape* shape = new TEveGeoShape(TString::Format("RecoGeom Id=%u", id));
316  TGeoShape* geoShape = getShape( info );
317  shape->SetShape( geoShape );
318  // Set transformation matrix from a column-major array
319  shape->SetTransMatrix( array );
320  return shape;
321  }
322 }
static const TGPicture * info(bool iBackgroundIsBlack)
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:508
TGeoShape * getShape(unsigned int id) const
Definition: FWGeometry.cc:257
#define fwLog(_level_)
Definition: fwLog.h:50
IdToInfo m_idToInfo
Definition: FWGeometry.h:138
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:114
TEveGeoShape * FWGeometry::getHGCScintillatorEveShape ( unsigned int  id) const

Definition at line 391 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().

392 {
393  IdToInfoItr it = FWGeometry::find( id );
394  if( it == m_idToInfo.end()){
395  fwLog( fwlog::kWarning ) << "no reco geometry found for id " << id << std::endl;
396  return nullptr;
397  }
398 
399  GeomDetInfo info = *it;
400 
401  TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
402  TEveGeoShape* shape = new TEveGeoShape(TString::Format("RecoGeom Id=%u", id));
403 
404  TGeoXtru* geoShape = new TGeoXtru(2);
405  Double_t x[4] = {
406  info.points[0], info.points[3], info.points[6], info.points[9]
407  };
408  Double_t y[4] = {
409  info.points[1], info.points[4], info.points[7], info.points[10]
410  };
411 
412  bool isNeg = info.shape[3] < 0;
413  geoShape->DefinePolygon(4,x,y);
414  geoShape->DefineSection(0, isNeg*info.shape[3]);
415  geoShape->DefineSection(1, !isNeg*info.shape[3]);
416  info.translation[2] = info.points[2];
417 
418  shape->SetShape( geoShape );
419  double array[16] = { info.matrix[0], info.matrix[3], info.matrix[6], 0.,
420  info.matrix[1], info.matrix[4], info.matrix[7], 0.,
421  info.matrix[2], info.matrix[5], info.matrix[8], 0.,
422  info.translation[0], info.translation[1], info.translation[2], 1.
423  };
424  // Set transformation matrix from a column-major array
425  shape->SetTransMatrix( array );
426  return shape;
427 }
static const TGPicture * info(bool iBackgroundIsBlack)
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:508
#define fwLog(_level_)
Definition: fwLog.h:50
IdToInfo m_idToInfo
Definition: FWGeometry.h:138
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:114
TEveGeoShape * FWGeometry::getHGCSiliconEveShape ( unsigned int  id) const

Definition at line 325 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, globals_cff::x1, and y.

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

326 {
327 #if 0
328  const unsigned int type = (id>>26)&0x3;
329  // select the middle cell of each waifer
330  id &= ~0x3FF;
331  id |= (type == 0) ? 0x16B : 0xE7;
332 #else
333  float sideToSideWaferSize = 16.7441f;
334  float dx = sideToSideWaferSize/2;
335  float sidey = dx/sqrt(3);
336  float dy = 2*sidey;
337 
338  int waferUint = (id >> 10) & 0xF;
339  int waferVint = (id >> 15) & 0xF;
340  float waferU = ((id>>14) & 0x1) ? -sideToSideWaferSize*waferUint : sideToSideWaferSize*waferUint;
341  float waferV = ((id>>19) & 0x1) ? -sideToSideWaferSize*waferVint : sideToSideWaferSize*waferVint;
342 
343  float waferX = (-2*waferU+waferV)/2;
344  float waferY = waferV*sqrt(3)/2;
345 #endif
346  IdToInfoItr it = FWGeometry::find( id );
347  if( it == m_idToInfo.end()){
348  fwLog( fwlog::kWarning ) << "no reco geometry found for id " << id << std::endl;
349  return nullptr;
350  }
351 
352  GeomDetInfo info = *it;
353 
354  TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
355  TEveGeoShape* shape = new TEveGeoShape(TString::Format("RecoGeom Id=%u", id));
356 
357  float dz = fabs(info.points[14] - info.points[2])*0.5;
358 
359  info.translation[2] = (info.points[14] + info.points[2])/2.0f;
360  info.translation[0] = waferX*((0 < info.translation[2]) - (info.translation[2] < 0));
361  info.translation[1] = waferY;
362 
363  TGeoXtru* geoShape = new TGeoXtru(2);
364  Double_t x[6] = {
365  -dx, -dx, 0.0, dx, dx, 0.0
366  };
367  Double_t y[6] = {
368  -sidey,
369  sidey,
370  dy,
371  sidey,
372  -sidey,
373  -dy
374  };
375  geoShape->DefinePolygon(6,x,y);
376  geoShape->DefineSection(0, -dz);
377  geoShape->DefineSection(1, dz);
378 
379  shape->SetShape( geoShape );
380  double array[16] = { info.matrix[0], info.matrix[3], info.matrix[6], 0.,
381  info.matrix[1], info.matrix[4], info.matrix[7], 0.,
382  info.matrix[2], info.matrix[5], info.matrix[8], 0.,
383  info.translation[0], info.translation[1], info.translation[2], 1.
384  };
385  // Set transformation matrix from a column-major array
386  shape->SetTransMatrix( array );
387  return shape;
388 }
type
Definition: HCALResponse.h:21
static const TGPicture * info(bool iBackgroundIsBlack)
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:508
T sqrt(T t)
Definition: SSEVec.h:18
double f[11][100]
#define fwLog(_level_)
Definition: fwLog.h:50
IdToInfo m_idToInfo
Definition: FWGeometry.h:138
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:114
std::vector< unsigned int > FWGeometry::getMatchedIds ( Detector  det,
SubDetector  subdet 
) const

Definition at line 214 of file FWGeometry.cc.

References m_idToInfo, RecoTauDiscriminantConfiguration::mask, and match_id().

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

215 {
216  std::vector<unsigned int> ids;
217  unsigned int mask = ( det << 4 ) | ( subdet );
218  for( IdToInfoItr it = m_idToInfo.begin(), itEnd = m_idToInfo.end();
219  it != itEnd; ++it )
220  {
221  if( FWGeometry::match_id( *it, mask ))
222  ids.push_back(( *it ).id );
223  }
224 
225  return ids;
226 }
bool match_id(const GeomDetInfo &o, unsigned int mask) const
Definition: FWGeometry.h:108
IdToInfo m_idToInfo
Definition: FWGeometry.h:138
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:114
std::vector< unsigned int > FWGeometry::getMatchedIds ( Detector  det) const

Definition at line 229 of file FWGeometry.cc.

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

230 {
231  std::vector<unsigned int> ids;
232 
233  for(const auto& it : m_idToInfo)
234  {
235  if( (( it.id >> kDetOffset ) & 0xF) != det ) continue;
236  // select only the 1st layer
237  // if(((it->id>>17)&0x1F) != 12) continue;
238 
239  // select only the first cell of each wafer
240  if(det != HGCalHSc){
241  bool flag(false);
242 
243  for(const auto& id_it : ids) {
244  flag = (~0x3FF & it.id) == (~0x3FF & id_it);
245  if(flag) break;
246  }
247 
248  if(flag) continue;
249  }
250 
251  ids.push_back( it.id );
252  }
253  return ids;
254 }
static const int kDetOffset
Definition: FWGeometry.h:31
IdToInfo m_idToInfo
Definition: FWGeometry.h:138
const TGeoMatrix * FWGeometry::getMatrix ( unsigned int  id) const

Definition at line 186 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(), ValidateGeometry::validateRPCGeometry(), ValidateGeometry::validateTrackerGeometry(), and FWGeometry::VersionInfo::VersionInfo().

187 {
188  std::map<unsigned int, TGeoMatrix*>::iterator mit = m_idToMatrix.find( id );
189  if( mit != m_idToMatrix.end()) return mit->second;
190 
191  IdToInfoItr it = FWGeometry::find( id );
192  if( it == m_idToInfo.end())
193  {
194  fwLog( fwlog::kWarning ) << "no reco geometry found for id " << id << std::endl;
195  return nullptr;
196  }
197  else
198  {
199  const GeomDetInfo& info = *it;
200  TGeoTranslation trans( info.translation[0], info.translation[1], info.translation[2] );
201  TGeoRotation rotation;
202  const Double_t matrix[9] = { info.matrix[0], info.matrix[1], info.matrix[2],
203  info.matrix[3], info.matrix[4], info.matrix[5],
204  info.matrix[6], info.matrix[7], info.matrix[8]
205  };
206  rotation.SetMatrix( matrix );
207 
208  m_idToMatrix[id] = new TGeoCombiTrans( trans, rotation );
209  return m_idToMatrix[id];
210  }
211 }
static const TGPicture * info(bool iBackgroundIsBlack)
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:508
std::map< unsigned int, TGeoMatrix * > m_idToMatrix
Definition: FWGeometry.h:136
#define fwLog(_level_)
Definition: fwLog.h:50
IdToInfo m_idToInfo
Definition: FWGeometry.h:138
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:114
const float * FWGeometry::getParameters ( unsigned int  id) const

Definition at line 446 of file FWGeometry.cc.

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

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

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

Definition at line 129 of file FWGeometry.h.

References getShape(), and m_producerVersion.

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

Definition at line 257 of file FWGeometry.cc.

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

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

258 {
259  IdToInfoItr it = FWGeometry::find( id );
260  if( it == m_idToInfo.end())
261  {
262  fwLog( fwlog::kWarning ) << "no reco geoemtry found for id " << id << std::endl;
263  return nullptr;
264  }
265  else
266  {
267  return getShape( *it );
268  }
269 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:508
TGeoShape * getShape(unsigned int id) const
Definition: FWGeometry.cc:257
#define fwLog(_level_)
Definition: fwLog.h:50
IdToInfo m_idToInfo
Definition: FWGeometry.h:138
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:114
TGeoShape * FWGeometry::getShape ( const GeomDetInfo info) const

Definition at line 272 of file FWGeometry.cc.

References FWGeometry::GeomDetInfo::shape.

273 {
274  TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
275  TGeoShape* geoShape = nullptr;
276  if( info.shape[0] == 1 )
277  {
278  geoShape = new TGeoTrap(
279  info.shape[3], //dz
280  0, //theta
281  0, //phi
282  info.shape[4], //dy1
283  info.shape[1], //dx1
284  info.shape[2], //dx2
285  0, //alpha1
286  info.shape[4], //dy2
287  info.shape[1], //dx3
288  info.shape[2], //dx4
289  0); //alpha2
290  }
291  else
292  geoShape = new TGeoBBox( info.shape[1], info.shape[2], info.shape[3] );
293 
294  return geoShape;
295 }
static const TGPicture * info(bool iBackgroundIsBlack)
const float * FWGeometry::getShapePars ( unsigned int  id) const
const TrackerTopology* FWGeometry::getTrackerTopology ( ) const
inline

Definition at line 133 of file FWGeometry.h.

References m_trackerTopology.

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

133 { return m_trackerTopology.get(); }
std::unique_ptr< TrackerTopology > m_trackerTopology
Definition: FWGeometry.h:146
void FWGeometry::initMap ( const FWRecoGeom::InfoMap map)

Definition at line 160 of file FWGeometry.cc.

References begin, end, mps_fire::i, m_idToInfo, makeMuonMisalignmentScenario::matrix, and hiPixelPairStep_cff::points.

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

161 {
162  FWRecoGeom::InfoMapItr begin = map.begin();
164  unsigned int mapSize = map.size();
165  if( m_idToInfo.size() != mapSize )
166  m_idToInfo.resize( mapSize );
167  unsigned int i = 0;
168  for( FWRecoGeom::InfoMapItr it = begin;
169  it != end; ++it, ++i )
170  {
171  m_idToInfo[i].id = it->id;
172  for( unsigned int j = 0; j < 24; ++j )
173  m_idToInfo[i].points[j] = it->points[j];
174  for( unsigned int j = 0; j < 9; ++j )
175  m_idToInfo[i].parameters[j] = it->topology[j];
176  for( unsigned int j = 0; j < 5; ++j )
177  m_idToInfo[i].shape[j] = it->shape[j];
178  for( unsigned int j = 0; j < 3; ++j )
179  m_idToInfo[i].translation[j] = it->translation[j];
180  for( unsigned int j = 0; j < 9; ++j )
181  m_idToInfo[i].matrix[j] = it->matrix[j];
182  }
183 }
std::vector< FWRecoGeom::Info >::const_iterator InfoMapItr
Definition: FWRecoGeom.h:28
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
IdToInfo m_idToInfo
Definition: FWGeometry.h:138
void FWGeometry::loadMap ( const char *  fileName)

Definition at line 56 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, fwlog::kInfo, PhysicsTools::loadMatrix(), m_idToInfo, m_producerVersion, m_trackerTopology, m_versionInfo, makeMuonMisalignmentScenario::matrix, callgraph::path, hiPixelPairStep_cff::points, FWGeometry::VersionInfo::productionTag, AlCaHLTBitMon_QueryRunRegistry::string, and ecaldqm::topology().

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

57 {
58  TFile* file = findFile( fileName );
59  if( ! file )
60  {
61  throw std::runtime_error( "ERROR: failed to find geometry file. Initialization failed." );
62  return;
63  }
64 
65  TTree* tree = static_cast<TTree*>(file->Get( "idToGeo" ));
66  if( ! tree )
67  {
68  throw std::runtime_error( "ERROR: cannot find detector id map in the file. Initialization failed." );
69  return;
70  }
71 
72  unsigned int id;
73  Float_t points[24];
74  Float_t topology[9];
75  Float_t shape[5];
76  Float_t translation[3];
77  Float_t matrix[9];
78  bool loadPoints = tree->GetBranch( "points" ) != nullptr;
79  bool loadParameters = tree->GetBranch( "topology" ) != nullptr;
80  bool loadShape = tree->GetBranch( "shape" ) != nullptr;
81  bool loadTranslation = tree->GetBranch( "translation" ) != nullptr;
82  bool loadMatrix = tree->GetBranch( "matrix" ) != nullptr;
83  tree->SetBranchAddress( "id", &id );
84  if( loadPoints )
85  tree->SetBranchAddress( "points", &points );
86  if( loadParameters )
87  tree->SetBranchAddress( "topology", &topology );
88  if( loadShape )
89  tree->SetBranchAddress( "shape", &shape );
90  if( loadTranslation )
91  tree->SetBranchAddress( "translation", &translation );
92  if( loadMatrix )
93  tree->SetBranchAddress( "matrix", &matrix );
94 
95  unsigned int treeSize = tree->GetEntries();
96  if( m_idToInfo.size() != treeSize )
97  m_idToInfo.resize( treeSize );
98  for( unsigned int i = 0; i < treeSize; ++i )
99  {
100  tree->GetEntry( i );
101 
102  m_idToInfo[i].id = id;
103  if( loadPoints )
104  {
105  for( unsigned int j = 0; j < 24; ++j )
106  m_idToInfo[i].points[j] = points[j];
107  }
108  if( loadParameters )
109  {
110  for( unsigned int j = 0; j < 9; ++j )
111  m_idToInfo[i].parameters[j] = topology[j];
112  }
113  if( loadShape )
114  {
115  for( unsigned int j = 0; j < 5; ++j )
116  m_idToInfo[i].shape[j] = shape[j];
117  }
118  if( loadTranslation )
119  {
120  for( unsigned int j = 0; j < 3; ++j )
121  m_idToInfo[i].translation[j] = translation[j];
122  }
123  if( loadMatrix )
124  {
125  for( unsigned int j = 0; j < 9; ++j )
126  m_idToInfo[i].matrix[j] = matrix[j];
127  }
128  }
129 
130 
131  m_versionInfo.productionTag = static_cast<TNamed*>(file->Get( "tag" ));
132  m_versionInfo.cmsswVersion = static_cast<TNamed*>(file->Get( "CMSSW_VERSION" ));
133  m_versionInfo.extraDetectors = static_cast<TObjArray*>(file->Get( "ExtraDetectors" ));
134 
135 
136  TString path = file->GetPath();
137  if (path.EndsWith(":/")) path.Resize(path.Length() -2);
138 
140  fwLog( fwlog::kInfo ) << Form("Load %s %s from %s\n", tree->GetName(), m_versionInfo.productionTag->GetTitle(), path.Data());
141  else
142  fwLog( fwlog::kInfo ) << Form("Load %s from %s\n", tree->GetName(), path.Data());
143 
144 
145  TNamed* producerInfo = static_cast<TNamed*>(file->Get( "PRODUCER_VERSION" ));
146  if (producerInfo) {
147  m_producerVersion = atoi(producerInfo->GetTitle());
148  }
149 
150  TNamed* ttopology = static_cast<TNamed*>(file->Get( "TrackerTopology" ));
151  if (ttopology) {
152  std::string xml = ttopology->GetTitle();
154  }
155 
156  file->Close();
157 }
std::unique_ptr< TrackerTopology > m_trackerTopology
Definition: FWGeometry.h:146
static TFile * findFile(const char *fileName)
Definition: FWGeometry.cc:30
TObjArray * extraDetectors
Definition: FWGeometry.h:50
static void loadMatrix(DOMElement *elem, unsigned int n, TMatrixDBase &matrix)
CaloTopology const * topology(0)
VersionInfo m_versionInfo
Definition: FWGeometry.h:142
int m_producerVersion
Definition: FWGeometry.h:144
#define fwLog(_level_)
Definition: fwLog.h:50
TrackerTopology fromTrackerParametersXMLString(const std::string &xmlContent)
Definition: tree.py:1
IdToInfo m_idToInfo
Definition: FWGeometry.h:138
void FWGeometry::localToGlobal ( unsigned int  id,
const float *  local,
float *  global,
bool  translatep = true 
) const

Definition at line 478 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(), FWGEMSegmentProxyBuilder::buildViewType(), FWME0RecHitProxyBuilder::buildViewType(), FWPSimHitProxyBuilder::buildViewType(), FWDTRecHitProxyBuilder::buildViewType(), FWRPCRecHitProxyBuilder::buildViewType(), FWGEMRecHitProxyBuilder::buildViewType(), FWDTSegmentProxyBuilder::buildViewType(), FWDTDigiProxyBuilder::buildViewType(), clear(), FWRPZViewGeometry::estimateProjectionSizeDT(), localToGlobal(), fireworks::pushPixelCluster(), and FWGeometry::VersionInfo::VersionInfo().

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

Definition at line 492 of file FWGeometry.cc.

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

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

Definition at line 516 of file FWGeometry.cc.

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

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

Definition at line 121 of file FWGeometry.h.

References m_idToInfo.

Referenced by FWRPZViewGeometry::makeMuonGeometryRhoZ().

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

Definition at line 108 of file FWGeometry.h.

References FWGeometry::GeomDetInfo::id.

Referenced by getMatchedIds().

108  {
109  unsigned int id = o.id;
110  return ((((( id >> kDetOffset ) & 0xF ) << 4) | (( id >> kSubdetOffset ) & 0x7 )) == mask );
111  }
static const int kSubdetOffset
Definition: FWGeometry.h:32
static const int kDetOffset
Definition: FWGeometry.h:31
const VersionInfo& FWGeometry::versionInfo ( ) const
inline

Member Data Documentation

const int FWGeometry::kDetOffset = 28
static

Definition at line 31 of file FWGeometry.h.

Referenced by getMatchedIds().

const int FWGeometry::kSubdetOffset = 25
static

Definition at line 32 of file FWGeometry.h.

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

Definition at line 136 of file FWGeometry.h.

Referenced by clear(), and getMatrix().

std::string FWGeometry::m_prodTag
private

Definition at line 140 of file FWGeometry.h.

int FWGeometry::m_producerVersion
private

Definition at line 144 of file FWGeometry.h.

Referenced by getProducerVersion(), and loadMap().

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

Definition at line 146 of file FWGeometry.h.

Referenced by getTrackerTopology(), and loadMap().

VersionInfo FWGeometry::m_versionInfo
private

Definition at line 142 of file FWGeometry.h.

Referenced by loadMap(), and versionInfo().