CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalTBHodoscopeGeometryLoaderFromDDD Class Reference

#include <EcalTBHodoscopeGeometryLoaderFromDDD.h>

Public Member Functions

 EcalTBHodoscopeGeometryLoaderFromDDD ()
 
std::unique_ptr< CaloSubdetectorGeometryload (const DDCompactView *cpv)
 
virtual ~EcalTBHodoscopeGeometryLoaderFromDDD ()
 

Private Member Functions

std::string getDDDString (std::string s, DDFilteredView *fv)
 
DDFiltergetDDFilter ()
 
unsigned int getDetIdForDDDNode (const DDFilteredView &fv)
 
void makeGeometry (const DDCompactView *cpv, CaloSubdetectorGeometry *ebg)
 

Private Attributes

EcalHodoscopeNumberingScheme _scheme
 

Detailed Description

Author
P. Meridiani - INFN Roma 1

Definition at line 22 of file EcalTBHodoscopeGeometryLoaderFromDDD.h.

Constructor & Destructor Documentation

◆ EcalTBHodoscopeGeometryLoaderFromDDD()

EcalTBHodoscopeGeometryLoaderFromDDD::EcalTBHodoscopeGeometryLoaderFromDDD ( )
inline

Definition at line 24 of file EcalTBHodoscopeGeometryLoaderFromDDD.h.

24 {};

◆ ~EcalTBHodoscopeGeometryLoaderFromDDD()

virtual EcalTBHodoscopeGeometryLoaderFromDDD::~EcalTBHodoscopeGeometryLoaderFromDDD ( )
inlinevirtual

Definition at line 26 of file EcalTBHodoscopeGeometryLoaderFromDDD.h.

26 {};

Member Function Documentation

◆ getDDDString()

std::string EcalTBHodoscopeGeometryLoaderFromDDD::getDDDString ( std::string  s,
DDFilteredView fv 
)
private

Referenced by makeGeometry().

◆ getDDFilter()

DDFilter * EcalTBHodoscopeGeometryLoaderFromDDD::getDDFilter ( )
private

Definition at line 115 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.

Referenced by makeGeometry().

115  {
117  DDSpecificsMatchesValueFilter{DDValue("SensitiveDetector", "EcalTBH4BeamDetector", 0)},
118  DDSpecificsMatchesValueFilter{DDValue("ReadOutName", "EcalTBH4BeamHits", 0)});
119 }

◆ getDetIdForDDDNode()

unsigned int EcalTBHodoscopeGeometryLoaderFromDDD::getDetIdForDDDNode ( const DDFilteredView fv)
private

Definition at line 98 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.

References _scheme, EcalBaseNumber::addLevel(), cms::cuda::assert(), DDFilteredView::geoHistory(), EcalHodoscopeNumberingScheme::getUnitID(), mps_fire::i, and parents.

Referenced by makeGeometry().

98  {
99  // perform some consistency checks
100  // get the parents and grandparents of this node
102 
103  assert(parents.size() >= 3);
104 
105  EcalBaseNumber baseNumber;
106  //baseNumber.setSize(parents.size());
107 
108  for (unsigned int i = 1; i <= parents.size(); i++) {
109  baseNumber.addLevel(parents[parents.size() - i].logicalPart().name().name(), parents[parents.size() - i].copyno());
110  }
111 
112  return _scheme.getUnitID(baseNumber);
113 }
TPRegexp parents
Definition: eve_filter.cc:21
assert(be >=bs)
void addLevel(const std::string &name, const int &copyNumber)
std::vector< DDExpandedNode > DDGeoHistory
Geometrical &#39;path&#39; of the current node up to the root-node.
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
uint32_t getUnitID(const EcalBaseNumber &baseNumber) const override

◆ load()

std::unique_ptr< CaloSubdetectorGeometry > EcalTBHodoscopeGeometryLoaderFromDDD::load ( const DDCompactView cpv)

Definition at line 21 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.

References makeGeometry().

Referenced by EcalTBHodoscopeGeometryEP::produce().

21  {
22  edm::LogVerbatim("EcalTBHodoscopeGeometry")
23  << "[EcalTBHodoscopeGeometryLoaderFromDDD]:: start the construction of EcalTBHodoscope";
24 
25  std::unique_ptr<CaloSubdetectorGeometry> ebg(new EcalTBHodoscopeGeometry());
26 
27  makeGeometry(cpv, ebg.get());
28 
29  edm::LogVerbatim("EcalTBHodoscopeGeometry")
30  << "[EcalTBHodoscopeGeometryLoaderFromDDD]:: Returning EcalTBHodoscopeGeometry";
31 
32  return ebg;
33 }
Log< level::Info, true > LogVerbatim
void makeGeometry(const DDCompactView *cpv, CaloSubdetectorGeometry *ebg)

◆ makeGeometry()

void EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry ( const DDCompactView cpv,
CaloSubdetectorGeometry ebg 
)
private

Definition at line 35 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.

References CaloSubdetectorGeometry::allocateCorners(), CaloSubdetectorGeometry::allocatePar(), CaloSubdetectorGeometry::cornersMgr(), dqmiodatasetharvest::ctr, ddbox, hcalRecHitTable_cff::detId, Exception, ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), getDDDString(), getDDFilter(), getDetIdForDDDNode(), CaloCellGeometry::getParmPtr(), mps_fire::i, CaloCellGeometry::k_ScaleFromDDDtoGeant, EBDetId::kSizeForDenseIndexing, DDFilteredView::logicalPart(), CaloSubdetectorGeometry::newCell(), DDFilteredView::nextSibling(), DDSolid::parameters(), CaloSubdetectorGeometry::parMgr(), CaloSubdetectorGeometry::parVecVec(), DDFilteredView::rotation(), DDSolid::shape(), DDLogicalPart::solid(), AlCaHLTBitMon_QueryRunRegistry::string, DDFilteredView::translation(), x, y, and z.

Referenced by load().

35  {
36  if (ebg->cornersMgr() == nullptr)
38  if (ebg->parMgr() == nullptr)
39  ebg->allocatePar(10, 3);
40 
41  std::unique_ptr<DDFilter> filter{getDDFilter()};
42 
43  DDFilteredView fv(*cpv, *filter);
44 
45  bool doSubDets;
46  for (doSubDets = fv.firstChild(); doSubDets; doSubDets = fv.nextSibling()) {
47 #if 0
48  std::string answer = getDDDString("ReadOutName",&fv);
49  if (answer != "EcalTBH4BeamHits")
50  continue;
51 #endif
52 
53  const DDSolid& solid = fv.logicalPart().solid();
54 
55  if (solid.shape() != DDSolidShape::ddbox) {
56  throw cms::Exception("DDException")
57  << std::string(__FILE__)
58  << "\n CaloGeometryEcalTBHodoscope::upDate(...): currently only box fiber shapes supported ";
59  edm::LogWarning("EcalTBHodoscopeGeometry") << "Wrong shape for sensitive volume!" << solid;
60  }
61 
62  std::vector<double> pv = solid.parameters();
63 
64  // use preshower strip as box in space representation
65 
66  // rotate the box and then move it
67  DD3Vector x, y, z;
68  fv.rotation().GetComponents(x, y, z);
69  CLHEP::Hep3Vector hx(x.X(), x.Y(), x.Z());
70  CLHEP::Hep3Vector hy(y.X(), y.Y(), y.Z());
71  CLHEP::Hep3Vector hz(z.X(), z.Y(), z.Z());
72  CLHEP::HepRotation hrot(hx, hy, hz);
73  CLHEP::Hep3Vector htran(fv.translation().X(), fv.translation().Y(), fv.translation().Z());
74 
75  const HepGeom::Transform3D ht3d(hrot, // only scale translation
77 
78  const HepGeom::Point3D<float> ctr(ht3d * HepGeom::Point3D<float>(0, 0, 0));
79 
80  const GlobalPoint refPoint(ctr.x(), ctr.y(), ctr.z());
81 
82  std::vector<CCGFloat> vv;
83  vv.reserve(pv.size() + 1);
84  for (unsigned int i(0); i != pv.size(); ++i) {
85  vv.emplace_back(CaloCellGeometry::k_ScaleFromDDDtoGeant * pv[i]);
86  }
87  vv.emplace_back(0.); // tilt=0 here
88  const CCGFloat* pP(CaloCellGeometry::getParmPtr(vv, ebg->parMgr(), ebg->parVecVec()));
89 
90  const DetId detId(getDetIdForDDDNode(fv));
91 
92  //Adding cell to the Geometry
93 
94  ebg->newCell(refPoint, refPoint, refPoint, pP, detId);
95  } // loop over all children
96 }
virtual void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)=0
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
void allocatePar(ParVec::size_type n, unsigned int m)
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
std::string getDDDString(std::string s, DDFilteredView *fv)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
CaloCellGeometry::CCGFloat CCGFloat
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
static const CCGFloat k_ScaleFromDDDtoGeant
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:123
Definition: DetId.h:17
CaloCellGeometry::CornersMgr * cornersMgr()
unsigned int getDetIdForDDDNode(const DDFilteredView &fv)
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
Log< level::Warning, false > LogWarning

Member Data Documentation

◆ _scheme

EcalHodoscopeNumberingScheme EcalTBHodoscopeGeometryLoaderFromDDD::_scheme
private

Definition at line 39 of file EcalTBHodoscopeGeometryLoaderFromDDD.h.

Referenced by getDetIdForDDDNode().