#include <EcalTBHodoscopeGeometryLoaderFromDDD.h>
Public Member Functions | |
EcalTBHodoscopeGeometryLoaderFromDDD () | |
std::auto_ptr < CaloSubdetectorGeometry > | load (const DDCompactView *cpv) |
virtual | ~EcalTBHodoscopeGeometryLoaderFromDDD () |
Private Member Functions | |
std::string | getDDDString (std::string s, DDFilteredView *fv) |
DDFilter * | getDDFilter () |
unsigned int | getDetIdForDDDNode (const DDFilteredView &fv) |
void | makeGeometry (const DDCompactView *cpv, CaloSubdetectorGeometry *ebg) |
Private Attributes | |
EcalHodoscopeNumberingScheme * | _scheme |
Definition at line 24 of file EcalTBHodoscopeGeometryLoaderFromDDD.h.
EcalTBHodoscopeGeometryLoaderFromDDD::EcalTBHodoscopeGeometryLoaderFromDDD | ( | ) |
Definition at line 22 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.
References _scheme.
: _scheme(0) { _scheme=new EcalHodoscopeNumberingScheme(); }
virtual EcalTBHodoscopeGeometryLoaderFromDDD::~EcalTBHodoscopeGeometryLoaderFromDDD | ( | ) | [inline, virtual] |
Definition at line 29 of file EcalTBHodoscopeGeometryLoaderFromDDD.h.
References _scheme.
std::string EcalTBHodoscopeGeometryLoaderFromDDD::getDDDString | ( | std::string | s, |
DDFilteredView * | fv | ||
) | [private] |
Referenced by makeGeometry().
DDFilter * EcalTBHodoscopeGeometryLoaderFromDDD::getDDFilter | ( | ) | [private] |
Definition at line 123 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.
References DDSpecificsFilter::AND, DDSpecificsFilter::equals, align_tpl::filter, and DDSpecificsFilter::setCriteria().
Referenced by makeGeometry().
{ DDSpecificsFilter *filter = new DDSpecificsFilter(); filter->setCriteria(DDValue("SensitiveDetector","EcalTBH4BeamDetector",0),DDSpecificsFilter::equals,DDSpecificsFilter::AND,true,true); filter->setCriteria(DDValue("ReadOutName","EcalTBH4BeamHits",0),DDSpecificsFilter::equals,DDSpecificsFilter::AND,true,true); return filter; }
unsigned int EcalTBHodoscopeGeometryLoaderFromDDD::getDetIdForDDDNode | ( | const DDFilteredView & | fv | ) | [private] |
Definition at line 105 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.
References _scheme, EcalBaseNumber::addLevel(), DDFilteredView::geoHistory(), EcalHodoscopeNumberingScheme::getUnitID(), i, and parents.
Referenced by makeGeometry().
{ // perform some consistency checks // get the parents and grandparents of this node DDGeoHistory parents = fv.geoHistory(); assert(parents.size() >= 3); EcalBaseNumber baseNumber; //baseNumber.setSize(parents.size()); for (unsigned int i=1 ;i <= parents.size(); i++) baseNumber.addLevel(parents[parents.size()-i].logicalPart().name().name(),parents[parents.size()-i].copyno()); return (_scheme->getUnitID(baseNumber)); }
std::auto_ptr< CaloSubdetectorGeometry > EcalTBHodoscopeGeometryLoaderFromDDD::load | ( | const DDCompactView * | cpv | ) |
Definition at line 27 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.
References gather_cfg::cout, and makeGeometry().
Referenced by EcalTBHodoscopeGeometryEP::produce().
{ std::cout << "[EcalTBHodoscopeGeometryLoaderFromDDD]:: start the construction of EcalTBHodoscope" << std::endl; std::auto_ptr<CaloSubdetectorGeometry> ebg(new CaloSubdetectorGeometry()); makeGeometry(cpv,dynamic_cast<CaloSubdetectorGeometry*>(ebg.get())); std::cout << "[EcalTBHodoscopeGeometryLoaderFromDDD]:: Returning EcalTBHodoscopeGeometry" << std::endl; return ebg; }
void EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry | ( | const DDCompactView * | cpv, |
CaloSubdetectorGeometry * | ebg | ||
) | [private] |
Definition at line 35 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.
References CaloSubdetectorGeometry::addCell(), DDFilteredView::addFilter(), CaloSubdetectorGeometry::allocateCorners(), CaloSubdetectorGeometry::allocatePar(), submit::answer, CaloSubdetectorGeometry::cornersMgr(), ddbox, align_tpl::filter, DDFilteredView::firstChild(), getDDDString(), getDDFilter(), getDetIdForDDDNode(), CaloCellGeometry::getParmPtr(), i, CaloCellGeometry::k_ScaleFromDDDtoGeant, DDFilteredView::logicalPart(), DDFilteredView::nextSibling(), DDSolid::parameters(), CaloSubdetectorGeometry::parMgr(), CaloSubdetectorGeometry::parVecVec(), DDFilteredView::rotation(), DDSolid::shape(), DDLogicalPart::solid(), DDFilteredView::translation(), x, detailsBasic3DVector::y, and z.
Referenced by load().
{ if( ebg->cornersMgr() == 0 ) ebg->allocateCorners( 256 ) ; if( ebg->parMgr() == 0 ) ebg->allocatePar( 10, 3 ) ; DDFilter* filter = getDDFilter(); DDFilteredView fv(*cpv); fv.addFilter(*filter); bool doSubDets; for (doSubDets = fv.firstChild(); doSubDets ; doSubDets = fv.nextSibling()) { #if 0 std::string answer = getDDDString("ReadOutName",&fv); if (answer != "EcalTBH4BeamHits") continue; #endif const DDSolid & solid = fv.logicalPart().solid(); if (solid.shape() != ddbox) { throw DDException(std::string(__FILE__) +"\n CaloGeometryEcalTBHodoscope::upDate(...): currently only box fiber shapes supported "); edm::LogWarning("EcalTBHodoscopeGeometry") << "Wrong shape for sensitive volume!" << solid; } std::vector<double> pv = solid.parameters(); // use preshower strip as box in space representation // rotate the box and then move it DD3Vector x, y, z; fv.rotation().GetComponents(x,y,z); CLHEP::Hep3Vector hx(x.X(), x.Y(), x.Z()); CLHEP::Hep3Vector hy(y.X(), y.Y(), y.Z()); CLHEP::Hep3Vector hz(z.X(), z.Y(), z.Z()); CLHEP::HepRotation hrot(hx, hy, hz); CLHEP::Hep3Vector htran(fv.translation().X(), fv.translation().Y(), fv.translation().Z()); const HepGeom::Transform3D ht3d ( hrot, // only scale translation CaloCellGeometry::k_ScaleFromDDDtoGeant*htran ) ; const HepGeom::Point3D<double> ctr ( ht3d*HepGeom::Point3D<double> (0,0,0) ) ; const GlobalPoint refPoint ( ctr.x(), ctr.y(), ctr.z() ) ; std::vector<double> vv ; vv.reserve( pv.size() ) ; for( unsigned int i ( 0 ) ; i != pv.size() ; ++i ) { vv.push_back( CaloCellGeometry::k_ScaleFromDDDtoGeant*pv[i] ) ; } const double* pP ( CaloCellGeometry::getParmPtr( vv, ebg->parMgr(), ebg->parVecVec() ) ) ; PreshowerStrip* cell ( new PreshowerStrip( refPoint, ebg->cornersMgr(), pP ) ) ; //Adding cell to the Geometry ebg->addCell(DetId(getDetIdForDDDNode(fv)),cell); } // loop over all children (i.e. crystals) }
Definition at line 42 of file EcalTBHodoscopeGeometryLoaderFromDDD.h.
Referenced by EcalTBHodoscopeGeometryLoaderFromDDD(), getDetIdForDDDNode(), and ~EcalTBHodoscopeGeometryLoaderFromDDD().