CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
FWGeometry Class Reference

#include <FWGeometry.h>

Classes

struct  GeomDetInfo
 
struct  Range
 

Public Types

enum  Detector {
  Tracker = 1, Muon = 2, Ecal = 3, Hcal = 4,
  Calo = 5
}
 
typedef std::vector
< FWGeometry::GeomDetInfo
IdToInfo
 
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
}
 

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
 
std::vector< unsigned int > getMatchedIds (Detector det, SubDetector subdet) const
 
const TGeoMatrix * getMatrix (unsigned int id) const
 
const float * getParameters (unsigned int id) const
 
TGeoShape * getShape (unsigned int id) const
 
const float * getShapePars (unsigned int id) const
 
void initMap (const FWRecoGeom::InfoMap &map)
 
void loadMap (const char *fileName)
 
void localToGlobal (unsigned int id, const float *local, float *global) const
 
void localToGlobal (unsigned int id, const float *local1, float *global1, const float *local2, float *global2) const
 
void localToGlobal (const GeomDetInfo &info, const float *local, float *global) const
 
bool match_id (const GeomDetInfo &o, unsigned int mask) 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 Member Functions

TGeoShape * getShape (const GeomDetInfo &info) const
 

Private Attributes

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

Detailed Description

Definition at line 23 of file FWGeometry.h.

Member Typedef Documentation

Definition at line 95 of file FWGeometry.h.

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

Definition at line 96 of file FWGeometry.h.

Member Enumeration Documentation

Enumerator
Tracker 
Muon 
Ecal 
Hcal 
Calo 

Definition at line 29 of file FWGeometry.h.

Enumerator
PixelBarrel 
PixelEndcap 
TIB 
TID 
TOB 
TEC 
CSC 
DT 
RPCBarrel 
RPCEndcap 

Definition at line 30 of file FWGeometry.h.

Constructor & Destructor Documentation

FWGeometry::FWGeometry ( void  )

Definition at line 18 of file FWGeometry.cc.

19 {}
FWGeometry::~FWGeometry ( void  )

Definition at line 21 of file FWGeometry.cc.

22 {}

Member Function Documentation

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

Definition at line 355 of file FWGeometry.cc.

References begin, end, and m_idToInfo.

Referenced by FWCSCRecHitProxyBuilder::build(), FWRPCRecHitProxyBuilder::buildViewType(), FWDTDigiProxyBuilder::buildViewType(), contains(), getCorners(), getEveShape(), getMatrix(), getParameters(), getShape(), getShapePars(), localToGlobal(), and FWRPZViewGeometry::makeMuonGeometryRhoZ().

356 {
359  return std::lower_bound( begin, end, id );
360 }
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
IdToInfo m_idToInfo
Definition: FWGeometry.h:109
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:96
TFile * FWGeometry::findFile ( const char *  fileName)
static

Definition at line 25 of file FWGeometry.cc.

References mergeVDriftHistosByStation::file, convertXMLtoSQLite_cfg::fileName, i, scaleCards::path, and EgammaValidation_cff::paths.

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

26 {
27  TString file;
28  if( fileName[0] == '/' || ( fileName[0] == '.' && fileName[1] == '/' ))
29  {
30  file = fileName;
31  }
32  else
33  {
34  if( const char* cmspath = gSystem->Getenv( "CMSSW_BASE" ))
35  {
36  file += cmspath;
37  file += "/";
38  }
39  file += fileName;
40  }
41  if( !gSystem->AccessPathName( file.Data()))
42  {
43  return TFile::Open( file );
44  }
45 
46  const char* searchpath = gSystem->Getenv( "CMSSW_SEARCH_PATH" );
47  if( searchpath == 0 )
48  return 0;
49  TString paths( searchpath );
50  TObjArray* tokens = paths.Tokenize( ":" );
51  for( int i = 0; i < tokens->GetEntries(); ++i )
52  {
53  TObjString* path = (TObjString*)tokens->At( i );
54  TString fullFileName( path->GetString());
55  if (gSystem->Getenv("CMSSW_VERSION"))
56  fullFileName += "/Fireworks/Geometry/data/";
57  fullFileName += fileName;
58  if( !gSystem->AccessPathName( fullFileName.Data()))
59  return TFile::Open( fullFileName.Data());
60  }
61  return 0;
62 }
int i
Definition: DBlmapReader.cc:9
list path
Definition: scaleCards.py:51
const float * FWGeometry::getCorners ( unsigned int  id) const
TEveGeoShape * FWGeometry::getEveShape ( unsigned int  id) const

Definition at line 251 of file FWGeometry.cc.

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

Referenced by FWConvTrackHitsDetailView::addModules(), FWTrackHitsDetailView::addModules(), FWSiStripClusterProxyBuilder::build(), FWTracksModulesProxyBuilder::build(), FWSiPixelClusterDetProxyBuilder::build(), FWCSCSegmentProxyBuilder::build(), FWRPCRecHitProxyBuilder::buildViewType(), FWDTSegmentProxyBuilder::buildViewType(), FWRPZViewGeometry::makeMuonGeometryRhoPhi(), FW3DViewGeometry::showMuonBarrel(), FW3DViewGeometry::showMuonBarrelFull(), FW3DViewGeometry::showMuonEndcap(), FWRPZViewGeometry::showPixelBarrel(), FW3DViewGeometry::showPixelBarrel(), FWRPZViewGeometry::showPixelEndcap(), FW3DViewGeometry::showPixelEndcap(), FWRPZViewGeometry::showTrackerBarrel(), FW3DViewGeometry::showTrackerBarrel(), FWRPZViewGeometry::showTrackerEndcap(), and FW3DViewGeometry::showTrackerEndcap().

252 {
253  IdToInfoItr it = FWGeometry::find( id );
254  if( it == m_idToInfo.end())
255  {
256  fwLog( fwlog::kWarning ) << "no reco geoemtry found for id " << id << std::endl;
257  return 0;
258  }
259  else
260  {
261  const GeomDetInfo& info = *it;
262  double array[16] = { info.matrix[0], info.matrix[3], info.matrix[6], 0.,
263  info.matrix[1], info.matrix[4], info.matrix[7], 0.,
264  info.matrix[2], info.matrix[5], info.matrix[8], 0.,
265  info.translation[0], info.translation[1], info.translation[2], 1.
266  };
267  TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
268  TEveGeoShape* shape = new TEveGeoShape(TString::Format("RecoGeom Id=%u", id));
269  TGeoShape* geoShape = getShape( info );
270  shape->SetShape( geoShape );
271  // Set transformation matrix from a column-major array
272  shape->SetTransMatrix( array );
273  return shape;
274  }
275 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:355
TGeoShape * getShape(unsigned int id) const
Definition: FWGeometry.cc:210
#define fwLog(_level_)
Definition: fwLog.h:51
IdToInfo m_idToInfo
Definition: FWGeometry.h:109
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:96
std::vector< unsigned int > FWGeometry::getMatchedIds ( Detector  det,
SubDetector  subdet 
) const

Definition at line 195 of file FWGeometry.cc.

References m_idToInfo, and match_id().

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

196 {
197  std::vector<unsigned int> ids;
198  unsigned int mask = ( det << 4 ) | ( subdet );
199  for( IdToInfoItr it = m_idToInfo.begin(), itEnd = m_idToInfo.end();
200  it != itEnd; ++it )
201  {
202  if( FWGeometry::match_id( *it, mask ))
203  ids.push_back(( *it ).id );
204  }
205 
206  return ids;
207 }
bool match_id(const GeomDetInfo &o, unsigned int mask) const
Definition: FWGeometry.h:90
IdToInfo m_idToInfo
Definition: FWGeometry.h:109
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:96
const TGeoMatrix * FWGeometry::getMatrix ( unsigned int  id) const

Definition at line 167 of file FWGeometry.cc.

References find(), fwLog, errorMatrix2Lands_multiChannel::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(), ValidateGeometry::validateDTChamberGeometry(), ValidateGeometry::validateDTLayerGeometry(), ValidateGeometry::validateRPCGeometry(), and ValidateGeometry::validateTrackerGeometry().

168 {
169  std::map<unsigned int, TGeoMatrix*>::iterator mit = m_idToMatrix.find( id );
170  if( mit != m_idToMatrix.end()) return mit->second;
171 
172  IdToInfoItr it = FWGeometry::find( id );
173  if( it == m_idToInfo.end())
174  {
175  fwLog( fwlog::kWarning ) << "no reco geometry found for id " << id << std::endl;
176  return 0;
177  }
178  else
179  {
180  const GeomDetInfo& info = *it;
181  TGeoTranslation trans( info.translation[0], info.translation[1], info.translation[2] );
182  TGeoRotation rotation;
183  const Double_t matrix[9] = { info.matrix[0], info.matrix[1], info.matrix[2],
184  info.matrix[3], info.matrix[4], info.matrix[5],
185  info.matrix[6], info.matrix[7], info.matrix[8]
186  };
187  rotation.SetMatrix( matrix );
188 
189  m_idToMatrix[id] = new TGeoCombiTrans( trans, rotation );
190  return m_idToMatrix[id];
191  }
192 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:355
std::map< unsigned int, TGeoMatrix * > m_idToMatrix
Definition: FWGeometry.h:107
#define fwLog(_level_)
Definition: fwLog.h:51
IdToInfo m_idToInfo
Definition: FWGeometry.h:109
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:96
const float * FWGeometry::getParameters ( unsigned int  id) const

Definition at line 294 of file FWGeometry.cc.

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

Referenced by fireworks::addSiStripClusters(), FWSiStripClusterProxyBuilder::build(), FWCSCStripDigiProxyBuilder::build(), FWSiStripDigiProxyBuilder::build(), FWRPCDigiProxyBuilder::build(), FWSiPixelClusterProxyBuilder::build(), FWSiPixelDigiProxyBuilder::build(), FWDTDigiProxyBuilder::buildViewType(), fireworks::pushNearbyPixelHits(), fireworks::pushPixelHits(), ValidateGeometry::validateCSCLayerGeometry(), ValidateGeometry::validateDTLayerGeometry(), ValidateGeometry::validatePixelTopology(), ValidateGeometry::validateRPCGeometry(), and ValidateGeometry::validateStripTopology().

295 {
296  // reco geometry parameters
297  IdToInfoItr it = FWGeometry::find( id );
298  if( it == m_idToInfo.end())
299  {
300  fwLog( fwlog::kWarning ) << "no reco geometry found for id " << id << std::endl;
301  return 0;
302  }
303  else
304  {
305  return ( *it ).parameters;
306  }
307 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:355
#define fwLog(_level_)
Definition: fwLog.h:51
IdToInfo m_idToInfo
Definition: FWGeometry.h:109
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:96
TGeoShape * FWGeometry::getShape ( unsigned int  id) const

Definition at line 210 of file FWGeometry.cc.

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

Referenced by ShapeTools.ShapeBuilder::getData(), getEveShape(), ShapeTools.ShapeBuilder::getExtraNorm(), ShapeTools.ShapeBuilder::getPdf(), and ShapeTools.ShapeBuilder::isShapeSystematic().

211 {
212  IdToInfoItr it = FWGeometry::find( id );
213  if( it == m_idToInfo.end())
214  {
215  fwLog( fwlog::kWarning ) << "no reco geoemtry found for id " << id << std::endl;
216  return 0;
217  }
218  else
219  {
220  return getShape( *it );
221  }
222 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:355
TGeoShape * getShape(unsigned int id) const
Definition: FWGeometry.cc:210
#define fwLog(_level_)
Definition: fwLog.h:51
IdToInfo m_idToInfo
Definition: FWGeometry.h:109
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:96
TGeoShape * FWGeometry::getShape ( const GeomDetInfo info) const
private

Definition at line 225 of file FWGeometry.cc.

References FWGeometry::GeomDetInfo::shape.

Referenced by ShapeTools.ShapeBuilder::getData(), ShapeTools.ShapeBuilder::getExtraNorm(), ShapeTools.ShapeBuilder::getPdf(), and ShapeTools.ShapeBuilder::isShapeSystematic().

226 {
227  TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
228  TGeoShape* geoShape = 0;
229  if( info.shape[0] == 1 )
230  {
231  geoShape = new TGeoTrap(
232  info.shape[3], //dz
233  0, //theta
234  0, //phi
235  info.shape[4], //dy1
236  info.shape[1], //dx1
237  info.shape[2], //dx2
238  0, //alpha1
239  info.shape[4], //dy2
240  info.shape[1], //dx3
241  info.shape[2], //dx4
242  0); //alpha2
243  }
244  else
245  geoShape = new TGeoBBox( info.shape[1], info.shape[2], info.shape[3] );
246 
247  return geoShape;
248 }
const float * FWGeometry::getShapePars ( unsigned int  id) const

Definition at line 310 of file FWGeometry.cc.

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

Referenced by FWCSCStripDigiProxyBuilder::build(), FWCSCWireDigiProxyBuilder::build(), ValidateGeometry::validateCSChamberGeometry(), ValidateGeometry::validateCSCLayerGeometry(), ValidateGeometry::validateDTChamberGeometry(), ValidateGeometry::validateDTLayerGeometry(), ValidateGeometry::validateRPCGeometry(), and ValidateGeometry::validateTrackerGeometry().

311 {
312  // reco geometry parameters
313  IdToInfoItr it = FWGeometry::find( id );
314  if( it == m_idToInfo.end())
315  {
316  fwLog( fwlog::kWarning ) << "no reco geometry found for id " << id << std::endl;
317  return 0;
318  }
319  else
320  {
321  return ( *it ).shape;
322  }
323 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:355
#define fwLog(_level_)
Definition: fwLog.h:51
IdToInfo m_idToInfo
Definition: FWGeometry.h:109
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:96
void FWGeometry::initMap ( const FWRecoGeom::InfoMap map)

Definition at line 141 of file FWGeometry.cc.

References begin, end, i, j, m_idToInfo, and makeMuonMisalignmentScenario::matrix.

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

142 {
143  FWRecoGeom::InfoMapItr begin = map.begin();
145  unsigned int mapSize = map.size();
146  if( m_idToInfo.size() != mapSize )
147  m_idToInfo.resize( mapSize );
148  unsigned int i = 0;
149  for( FWRecoGeom::InfoMapItr it = begin;
150  it != end; ++it, ++i )
151  {
152  m_idToInfo[i].id = it->id;
153  for( unsigned int j = 0; j < 24; ++j )
154  m_idToInfo[i].points[j] = it->points[j];
155  for( unsigned int j = 0; j < 9; ++j )
156  m_idToInfo[i].parameters[j] = it->topology[j];
157  for( unsigned int j = 0; j < 5; ++j )
158  m_idToInfo[i].shape[j] = it->shape[j];
159  for( unsigned int j = 0; j < 3; ++j )
160  m_idToInfo[i].translation[j] = it->translation[j];
161  for( unsigned int j = 0; j < 9; ++j )
162  m_idToInfo[i].matrix[j] = it->matrix[j];
163  }
164 }
std::vector< FWRecoGeom::Info >::const_iterator InfoMapItr
Definition: FWRecoGeom.h:28
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
IdToInfo m_idToInfo
Definition: FWGeometry.h:109
void FWGeometry::loadMap ( const char *  fileName)

Definition at line 65 of file FWGeometry.cc.

References mergeVDriftHistosByStation::file, findFile(), i, errorMatrix2Lands_multiChannel::id, j, PhysicsTools::loadMatrix(), m_idToInfo, makeMuonMisalignmentScenario::matrix, Parameters::parameters, and MainPageGenerator::tree.

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

66 {
67  TFile* file = findFile( fileName );
68  if( ! file )
69  {
70  throw std::runtime_error( "ERROR: failed to find geometry file. Initialization failed." );
71  return;
72  }
73  TTree* tree = static_cast<TTree*>(file->Get( "idToGeo" ));
74  if( ! tree )
75  {
76  throw std::runtime_error( "ERROR: cannot find detector id map in the file. Initialization failed." );
77  return;
78  }
79 
80  unsigned int id;
81  Float_t points[24];
82  Float_t topology[9];
83  Float_t shape[5];
84  Float_t translation[3];
85  Float_t matrix[9];
86  bool loadPoints = tree->GetBranch( "points" ) != 0;
87  bool loadParameters = tree->GetBranch( "topology" ) != 0;
88  bool loadShape = tree->GetBranch( "shape" ) != 0;
89  bool loadTranslation = tree->GetBranch( "translation" ) != 0;
90  bool loadMatrix = tree->GetBranch( "matrix" ) != 0;
91  tree->SetBranchAddress( "id", &id );
92  if( loadPoints )
93  tree->SetBranchAddress( "points", &points );
94  if( loadParameters )
95  tree->SetBranchAddress( "topology", &topology );
96  if( loadShape )
97  tree->SetBranchAddress( "shape", &shape );
98  if( loadTranslation )
99  tree->SetBranchAddress( "translation", &translation );
100  if( loadMatrix )
101  tree->SetBranchAddress( "matrix", &matrix );
102 
103  unsigned int treeSize = tree->GetEntries();
104  if( m_idToInfo.size() != treeSize )
105  m_idToInfo.resize( treeSize );
106  for( unsigned int i = 0; i < treeSize; ++i )
107  {
108  tree->GetEntry( i );
109 
110  m_idToInfo[i].id = id;
111  if( loadPoints )
112  {
113  for( unsigned int j = 0; j < 24; ++j )
114  m_idToInfo[i].points[j] = points[j];
115  }
116  if( loadParameters )
117  {
118  for( unsigned int j = 0; j < 9; ++j )
119  m_idToInfo[i].parameters[j] = topology[j];
120  }
121  if( loadShape )
122  {
123  for( unsigned int j = 0; j < 5; ++j )
124  m_idToInfo[i].shape[j] = shape[j];
125  }
126  if( loadTranslation )
127  {
128  for( unsigned int j = 0; j < 3; ++j )
129  m_idToInfo[i].translation[j] = translation[j];
130  }
131  if( loadMatrix )
132  {
133  for( unsigned int j = 0; j < 9; ++j )
134  m_idToInfo[i].matrix[j] = matrix[j];
135  }
136  }
137  file->Close();
138 }
static TFile * findFile(const char *fileName)
Definition: FWGeometry.cc:25
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
static void loadMatrix(DOMElement *elem, unsigned int n, TMatrixDBase &matrix)
int j
Definition: DBlmapReader.cc:9
IdToInfo m_idToInfo
Definition: FWGeometry.h:109
void FWGeometry::localToGlobal ( unsigned int  id,
const float *  local,
float *  global 
) const

Definition at line 326 of file FWGeometry.cc.

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

Referenced by fireworks::addSiStripClusters(), FWTrackTrackingRecHitProxyBuilder::build(), FWSiStripClusterProxyBuilder::build(), FWCSCRecHitProxyBuilder::build(), FWSiStripDigiProxyBuilder::build(), FWCSCStripDigiProxyBuilder::build(), FWRPCDigiProxyBuilder::build(), FWCSCWireDigiProxyBuilder::build(), FWCSCSegmentProxyBuilder::build(), FWSiPixelClusterProxyBuilder::build(), FWSiPixelDigiProxyBuilder::build(), FWTrackingParticleProxyBuilder::build(), FWPSimHitProxyBuilder::buildViewType(), FWDTRecHitProxyBuilder::buildViewType(), FWRPCRecHitProxyBuilder::buildViewType(), FWDTSegmentProxyBuilder::buildViewType(), FWDTDigiProxyBuilder::buildViewType(), FWRPZViewGeometry::estimateProjectionSizeCSC(), FWRPZViewGeometry::estimateProjectionSizeDT(), localToGlobal(), and fireworks::pushPixelCluster().

327 {
328  IdToInfoItr it = FWGeometry::find( id );
329  if( it == m_idToInfo.end())
330  {
331  fwLog( fwlog::kWarning ) << "no reco geometry found for id " << id << std::endl;
332  }
333  else
334  {
335  localToGlobal( *it, local, global );
336  }
337 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:355
void localToGlobal(unsigned int id, const float *local, float *global) const
Definition: FWGeometry.cc:326
#define fwLog(_level_)
Definition: fwLog.h:51
IdToInfo m_idToInfo
Definition: FWGeometry.h:109
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:96
void FWGeometry::localToGlobal ( unsigned int  id,
const float *  local1,
float *  global1,
const float *  local2,
float *  global2 
) const

Definition at line 340 of file FWGeometry.cc.

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

341 {
342  IdToInfoItr it = FWGeometry::find( id );
343  if( it == m_idToInfo.end())
344  {
345  fwLog( fwlog::kWarning ) << "no reco geometry found for id " << id << std::endl;
346  }
347  else
348  {
349  localToGlobal( *it, local1, global1 );
350  localToGlobal( *it, local2, global2 );
351  }
352 }
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:355
void localToGlobal(unsigned int id, const float *local, float *global) const
Definition: FWGeometry.cc:326
#define fwLog(_level_)
Definition: fwLog.h:51
IdToInfo m_idToInfo
Definition: FWGeometry.h:109
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:96
void FWGeometry::localToGlobal ( const GeomDetInfo info,
const float *  local,
float *  global 
) const

Definition at line 363 of file FWGeometry.cc.

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

364 {
365  for( int i = 0; i < 3; ++i )
366  {
367  global[i] = info.translation[i]
368  + local[0] * info.matrix[3 * i]
369  + local[1] * info.matrix[3 * i + 1]
370  + local[2] * info.matrix[3 * i + 2];
371  }
372 }
int i
Definition: DBlmapReader.cc:9
bool FWGeometry::match_id ( const GeomDetInfo o,
unsigned int  mask 
) const
inline

Definition at line 90 of file FWGeometry.h.

References FWGeometry::GeomDetInfo::id, kDetOffset, and kSubdetOffset.

Referenced by getMatchedIds().

90  {
91  unsigned int id = o.id;
92  return ((((( id >> kDetOffset ) & 0xF ) << 4) | (( id >> kSubdetOffset ) & 0x7 )) == mask );
93  }
static const int kSubdetOffset
Definition: FWGeometry.h:27
static const int kDetOffset
Definition: FWGeometry.h:26

Member Data Documentation

const int FWGeometry::kDetOffset = 28
static

Definition at line 26 of file FWGeometry.h.

Referenced by match_id().

const int FWGeometry::kSubdetOffset = 25
static

Definition at line 27 of file FWGeometry.h.

Referenced by match_id().

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

Definition at line 107 of file FWGeometry.h.

Referenced by clear(), and getMatrix().