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 15 of file FastTimeGeometryLoader.cc.

15 {}
FastTimeGeometryLoader::~FastTimeGeometryLoader ( )

Definition at line 16 of file FastTimeGeometryLoader.cc.

16 {}

Member Function Documentation

FastTimeGeometry * FastTimeGeometryLoader::build ( const FastTimeTopology topology)

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

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

86  {
87 
88 #ifdef EDM_ML_DEBUG
89  std::cout << "Volume Parameters";
90  for (unsigned int i=0; i<12; ++i) std::cout << " : " << params[i];
91  std::cout << std::endl;
92 #endif
93  FastTimeDetId id = FastTimeDetId(detId);
94  std::vector<GlobalPoint> corners = topology.dddConstants().getCorners(id.type(),1,1,id.zside());
95 
96  FlatTrd::createCorners( params, ht3d, corners ) ;
97 
98  const CCGFloat* parmPtr (CaloCellGeometry::getParmPtr(params,
99  geom->parMgr(),
100  geom->parVecVec() ) ) ;
101 
102  GlobalPoint front ( 0.25*( corners[0].x() +
103  corners[1].x() +
104  corners[2].x() +
105  corners[3].x() ),
106  0.25*( corners[0].y() +
107  corners[1].y() +
108  corners[2].y() +
109  corners[3].y() ),
110  0.25*( corners[0].z() +
111  corners[1].z() +
112  corners[2].z() +
113  corners[3].z() ) ) ;
114 
115  GlobalPoint back ( 0.25*( corners[4].x() +
116  corners[5].x() +
117  corners[6].x() +
118  corners[7].x() ),
119  0.25*( corners[4].y() +
120  corners[5].y() +
121  corners[6].y() +
122  corners[7].y() ),
123  0.25*( corners[4].z() +
124  corners[5].z() +
125  corners[6].z() +
126  corners[7].z() ) ) ;
127 
128  if (front.mag2() > back.mag2()) { // front should always point to the center, so swap front and back
129  std::swap (front, back);
130  std::swap_ranges (corners.begin(), corners.begin()+4, corners.begin()+4);
131  }
132 
133  geom->newCell(front, back, corners[0], parmPtr, detId) ;
134 }
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:139
const FastTimeDDDConstants & dddConstants() const