CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

EcalTBHodoscopeGeometryLoaderFromDDD Class Reference

#include <EcalTBHodoscopeGeometryLoaderFromDDD.h>

List of all members.

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)
DDFiltergetDDFilter ()
unsigned int getDetIdForDDDNode (const DDFilteredView &fv)
void makeGeometry (const DDCompactView *cpv, CaloSubdetectorGeometry *ebg)

Private Attributes

EcalHodoscopeNumberingScheme _scheme

Detailed Description

Id:
EcalTBHodoscopeGeometryLoaderFromDDD.h,v 1.3 2011/06/03 19:20:55 heltsley Exp
Author:
P. Meridiani - INFN Roma 1

Definition at line 24 of file EcalTBHodoscopeGeometryLoaderFromDDD.h.


Constructor & Destructor Documentation

EcalTBHodoscopeGeometryLoaderFromDDD::EcalTBHodoscopeGeometryLoaderFromDDD ( ) [inline]

Definition at line 28 of file EcalTBHodoscopeGeometryLoaderFromDDD.h.

{} ;
virtual EcalTBHodoscopeGeometryLoaderFromDDD::~EcalTBHodoscopeGeometryLoaderFromDDD ( ) [inline, virtual]

Definition at line 30 of file EcalTBHodoscopeGeometryLoaderFromDDD.h.

{} ;

Member Function Documentation

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

Referenced by makeGeometry().

DDFilter * EcalTBHodoscopeGeometryLoaderFromDDD::getDDFilter ( ) [private]

Definition at line 133 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.

References DDSpecificsFilter::AND, DDSpecificsFilter::equals, alcazmumu_cfi::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 112 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 21 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 EcalTBHodoscopeGeometry() ) ;

   makeGeometry( cpv, ebg.get() ) ;

   std::cout << "[EcalTBHodoscopeGeometryLoaderFromDDD]:: Returning EcalTBHodoscopeGeometry" << std::endl;

   return ebg;
}
void EcalTBHodoscopeGeometryLoaderFromDDD::makeGeometry ( const DDCompactView cpv,
CaloSubdetectorGeometry ebg 
) [private]

Definition at line 36 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.

References DDFilteredView::addFilter(), CaloSubdetectorGeometry::allocateCorners(), CaloSubdetectorGeometry::allocatePar(), submit::answer, CaloSubdetectorGeometry::cornersMgr(), ddbox, Exception, alcazmumu_cfi::filter, DDFilteredView::firstChild(), getDDDString(), getDDFilter(), getDetIdForDDDNode(), CaloCellGeometry::getParmPtr(), i, CaloCellGeometry::k_ScaleFromDDDtoGeant, CaloTowerDetId::kSizeForDenseIndexing, DDFilteredView::logicalPart(), CaloSubdetectorGeometry::newCell(), 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( CaloTowerDetId::kSizeForDenseIndexing ) ;
   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 cms::Exception("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<float> ctr (
         ht3d*HepGeom::Point3D<float> (0,0,0) ) ;

      const GlobalPoint refPoint ( ctr.x(), ctr.y(), ctr.z() ) ;

      std::vector<CCGFloat> vv ;
      vv.reserve( pv.size() + 1 ) ;
      for( unsigned int i ( 0 ) ; i != pv.size() ; ++i )
      {
         vv.push_back( CaloCellGeometry::k_ScaleFromDDDtoGeant*pv[i] ) ;
      }
      vv.push_back( 0. ) ; // tilt=0 here
      const CCGFloat* pP ( CaloCellGeometry::getParmPtr( vv, 
                                                         ebg->parMgr(), 
                                                         ebg->parVecVec() ) ) ;

      const DetId detId ( getDetIdForDDDNode(fv) ) ;

      //Adding cell to the Geometry

      ebg->newCell( refPoint, refPoint, refPoint,
                    pP, 
                    detId ) ;
   } // loop over all children
}

Member Data Documentation

Definition at line 45 of file EcalTBHodoscopeGeometryLoaderFromDDD.h.

Referenced by getDetIdForDDDNode().