CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions
FastTimeGeometryLoader Class Reference

#include <FastTimeGeometryLoader.h>

Public Types

typedef CaloCellGeometry::CCGFloat CCGFloat
 
typedef std::vector< float > ParmVec
 

Public Member Functions

FastTimeGeometrybuild (const FastTimeTopology &)
 
 FastTimeGeometryLoader ()
 
 ~FastTimeGeometryLoader ()
 

Private Member Functions

void buildGeom (const ParmVec &, const HepGeom::Transform3D &, const DetId &, const FastTimeTopology &, FastTimeGeometry *)
 

Detailed Description

Definition at line 8 of file FastTimeGeometryLoader.h.

Member Typedef Documentation

Definition at line 11 of file FastTimeGeometryLoader.h.

typedef std::vector<float> FastTimeGeometryLoader::ParmVec

Definition at line 12 of file FastTimeGeometryLoader.h.

Constructor & Destructor Documentation

FastTimeGeometryLoader::FastTimeGeometryLoader ( )

Definition at line 13 of file FastTimeGeometryLoader.cc.

13 {}
FastTimeGeometryLoader::~FastTimeGeometryLoader ( )

Definition at line 14 of file FastTimeGeometryLoader.cc.

14 {}

Member Function Documentation

FastTimeGeometry * FastTimeGeometryLoader::build ( const FastTimeTopology topology)

Definition at line 16 of file FastTimeGeometryLoader.cc.

References CaloSubdetectorGeometry::allocateCorners(), CaloSubdetectorGeometry::allocatePar(), buildGeom(), MessageLogger_cfi::cerr, counter, gather_cfg::cout, FastTimeTopology::dddConstants(), FastTimeTopology::detectorType(), relativeConstraints::geom, FastTimeDDDConstants::getRin(), FastTimeDDDConstants::getRout(), FastTimeDDDConstants::getZHalf(), FastTimeDDDConstants::getZPos(), AnalysisDataFormats_SUSYBSMObjects::hr, FastTimeGeometry::k_NumberOfParametersPerShape, FastTimeGeometry::k_NumberOfShapes, idealTransformation::rotation, FastTimeGeometry::sortDetIds(), FastTimeTopology::subDetector(), FastTimeTopology::totalGeomModules(), and ecaldqm::zside().

Referenced by FastTimeGeometryESProducer::produce().

16  {
17 
18  // allocate geometry
19  FastTimeGeometry* geom = new FastTimeGeometry (topology);
20  unsigned int numberOfCells = topology.totalGeomModules(); // both sides
21  int detType = topology.detectorType();
22 #ifdef EDM_ML_DEBUG
23  std::cout << "Number of Cells " << numberOfCells << " for type " << detType
24  << " of sub-detector " << topology.subDetector()
25  << " Shape parameters " << FastTimeGeometry::k_NumberOfShapes
27  << std::endl;
28 #endif
29  geom->allocateCorners( numberOfCells ) ;
32 
33  // loop over modules
35  unsigned int counter(0);
36 #ifdef EDM_ML_DEBUG
37  std::cout << "FastTimeGeometryLoader with # of transformation matrices "
38  << numberOfCells << std::endl;
39 #endif
40  for (unsigned itr=0; itr<numberOfCells; ++itr) {
41  int zside = (itr == 0) ? 1 : -1;
42 #ifdef EDM_ML_DEBUG
43  std::cout << "FastTimeGeometryLoader:: Z:Layer:Type " << zside
44  << ":" << detType <<std::endl;
45 #endif
46  double zv = zside*(topology.dddConstants().getZPos(detType));
47  const CLHEP::HepRep3x3 rotation = (zside > 0) ?
48  CLHEP::HepRep3x3(1,0,0,0,1,0,0,0,1) :
49  CLHEP::HepRep3x3(-1,0,0,0,1,0,0,0,-1);
50  const CLHEP::HepRotation hr ( rotation );
51  const CLHEP::Hep3Vector h3v(0,0,zv);
52  const HepGeom::Transform3D ht3d (hr, h3v);
53  DetId detId = (DetId)(FastTimeDetId(detType,0,0,zside));
54 #ifdef EDM_ML_DEBUG
55  std::cout << "FastTimeGeometryLoader:: transf " << ht3d.getTranslation()
56  << " and " << ht3d.getRotation();
57 #endif
58  params[0] = topology.dddConstants().getZHalf(detType);
59  params[1] = params[2] = 0;
60  params[3] = params[7] = topology.dddConstants().getRin(detType);
61  params[4] = params[8] = topology.dddConstants().getRout(detType);
62  params[5] = params[9] = topology.dddConstants().getRout(detType);
63  params[6] = params[10]= 0;
64  params[11]= zside;
65  buildGeom(params, ht3d, detId, topology, geom);
66  counter++;
67  }
68 
69  geom->sortDetIds();
70 
71  if (counter != numberOfCells) {
72  std::cerr << "inconsistent # of cells: expected " << numberOfCells
73  << " , inited " << counter << std::endl;
74  assert( counter == numberOfCells ) ;
75  }
76 
77  return geom;
78 }
double getZPos(int type) const
unsigned int totalGeomModules() const
ForwardSubdetector subDetector() const
std::vector< float > ParmVec
int detectorType() const
int zside(DetId const &)
void allocatePar(ParVec::size_type n, unsigned int m)
void buildGeom(const ParmVec &, const HepGeom::Transform3D &, const DetId &, const FastTimeTopology &, FastTimeGeometry *)
susybsm::HSCParticleRef hr
Definition: classes.h:26
Definition: DetId.h:18
double getRin(int type) const
double getRout(int type) const
static std::atomic< unsigned int > counter
double getZHalf(int type) const
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
const FastTimeDDDConstants & dddConstants() const
void FastTimeGeometryLoader::buildGeom ( const ParmVec params,
const HepGeom::Transform3D &  ht3d,
const DetId detId,
const FastTimeTopology topology,
FastTimeGeometry geom 
)
private

Definition at line 80 of file FastTimeGeometryLoader.cc.

References gather_cfg::cout, FlatTrd::createCorners(), FastTimeTopology::dddConstants(), FastTimeDDDConstants::getCorners(), CaloCellGeometry::getParmPtr(), mps_fire::i, PV3DBase< T, PVType, FrameType >::mag2(), FastTimeGeometry::newCell(), CaloSubdetectorGeometry::parMgr(), CaloSubdetectorGeometry::parVecVec(), std::swap(), x, y, z, and ecaldqm::zside().

Referenced by build().

84  {
85 
86 #ifdef EDM_ML_DEBUG
87  std::cout << "Volume Parameters";
88  for (unsigned int i=0; i<12; ++i) std::cout << " : " << params[i];
89  std::cout << std::endl;
90 #endif
91  FastTimeDetId id = FastTimeDetId(detId);
92  std::vector<GlobalPoint> corners = topology.dddConstants().getCorners(id.type(),1,1,id.zside());
93 
94  FlatTrd::createCorners( params, ht3d, corners ) ;
95 
96  const CCGFloat* parmPtr (CaloCellGeometry::getParmPtr(params,
97  geom->parMgr(),
98  geom->parVecVec() ) ) ;
99 
100  GlobalPoint front ( 0.25*( corners[0].x() +
101  corners[1].x() +
102  corners[2].x() +
103  corners[3].x() ),
104  0.25*( corners[0].y() +
105  corners[1].y() +
106  corners[2].y() +
107  corners[3].y() ),
108  0.25*( corners[0].z() +
109  corners[1].z() +
110  corners[2].z() +
111  corners[3].z() ) ) ;
112 
113  GlobalPoint back ( 0.25*( corners[4].x() +
114  corners[5].x() +
115  corners[6].x() +
116  corners[7].x() ),
117  0.25*( corners[4].y() +
118  corners[5].y() +
119  corners[6].y() +
120  corners[7].y() ),
121  0.25*( corners[4].z() +
122  corners[5].z() +
123  corners[6].z() +
124  corners[7].z() ) ) ;
125 
126  if (front.mag2() > back.mag2()) { // front should always point to the center, so swap front and back
127  std::swap (front, back);
128  std::swap_ranges (corners.begin(), corners.begin()+4, corners.begin()+4);
129  }
130 
131  geom->newCell(front, back, corners[0], parmPtr, detId) ;
132 }
type
Definition: HCALResponse.h:21
int zside(DetId const &)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
CaloCellGeometry::CCGFloat CCGFloat
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
std::vector< GlobalPoint > getCorners(int type, int izeta, int iphi, int zside) const
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
Definition: FlatTrd.cc:152
const FastTimeDDDConstants & dddConstants() const