CMS 3D CMS Logo

EcalTBHodoscopeGeometryLoaderFromDDD Class Reference

Id
EcalTBHodoscopeGeometryLoaderFromDDD.h,v 1.1 2007/04/15 23:16:29 wmtan Exp
More...

#include <Geometry/EcalTestBeam/plugins/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.1 2007/04/15 23:16:29 wmtan Exp

Author:
P. Meridiani - INFN Roma 1

Definition at line 23 of file EcalTBHodoscopeGeometryLoaderFromDDD.h.


Constructor & Destructor Documentation

EcalTBHodoscopeGeometryLoaderFromDDD::EcalTBHodoscopeGeometryLoaderFromDDD (  ) 

Definition at line 24 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.

References _scheme.

00024                                                                           : _scheme(0) 
00025 {
00026   _scheme=new EcalHodoscopeNumberingScheme();
00027 }

virtual EcalTBHodoscopeGeometryLoaderFromDDD::~EcalTBHodoscopeGeometryLoaderFromDDD (  )  [inline, virtual]

Definition at line 28 of file EcalTBHodoscopeGeometryLoaderFromDDD.h.

References _scheme.

00029     {
00030       if (_scheme)
00031         delete _scheme;
00032     };


Member Function Documentation

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

Referenced by makeGeometry().

DDFilter * EcalTBHodoscopeGeometryLoaderFromDDD::getDDFilter (  )  [private]

Definition at line 125 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.

References DDSpecificsFilter::AND, DDSpecificsFilter::equals, filter, and DDSpecificsFilter::setCriteria().

Referenced by makeGeometry().

00126 {
00127   DDSpecificsFilter *filter = new DDSpecificsFilter();
00128   filter->setCriteria(DDValue("SensitiveDetector","EcalTBH4BeamDetector",0),DDSpecificsFilter::equals,DDSpecificsFilter::AND,true,true);
00129   filter->setCriteria(DDValue("ReadOutName","EcalTBH4BeamHits",0),DDSpecificsFilter::equals,DDSpecificsFilter::AND,true,true);
00130   return filter;
00131 }

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

Definition at line 107 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.

References _scheme, DDFilteredView::geoHistory(), EcalHodoscopeNumberingScheme::getUnitID(), and i.

Referenced by makeGeometry().

00108 {
00109   // perform some consistency checks
00110   // get the parents and grandparents of this node
00111   DDGeoHistory parents = fv.geoHistory();
00112   
00113   assert(parents.size() >= 3);
00114 
00115   EcalBaseNumber baseNumber;
00116   //baseNumber.setSize(parents.size());
00117 
00118   for (unsigned int i=1 ;i <= parents.size(); i++)
00119     baseNumber.addLevel(parents[parents.size()-i].logicalPart().name().name(),parents[parents.size()-i].copyno());
00120 
00121   return (_scheme->getUnitID(baseNumber));
00122   
00123 }

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

Definition at line 29 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and makeGeometry().

Referenced by EcalTBHodoscopeGeometryEP::produce().

00029                                                                                                         {
00030   std::cout << "[EcalTBHodoscopeGeometryLoaderFromDDD]:: start the construction of EcalTBHodoscope" << std::endl;
00031   std::auto_ptr<CaloSubdetectorGeometry> ebg(new CaloSubdetectorGeometry());
00032   makeGeometry(cpv,dynamic_cast<CaloSubdetectorGeometry*>(ebg.get()));
00033   std::cout << "[EcalTBHodoscopeGeometryLoaderFromDDD]:: Returning EcalTBHodoscopeGeometry" << std::endl;
00034   return ebg;
00035 }

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

Definition at line 37 of file EcalTBHodoscopeGeometryLoaderFromDDD.cc.

References CaloSubdetectorGeometry::addCell(), DDFilteredView::addFilter(), CaloSubdetectorGeometry::allocateCorners(), CaloSubdetectorGeometry::allocatePar(), CaloSubdetectorGeometry::cornersMgr(), ddbox, filter, DDFilteredView::firstChild(), getDDDString(), getDDFilter(), getDetIdForDDDNode(), CaloCellGeometry::getParmPtr(), i, CaloCellGeometry::k_ScaleFromDDDtoGeant, DDFilteredView::logicalPart(), DDFilteredView::nextSibling(), DDSolid::parameters(), CaloSubdetectorGeometry::parMgr(), CaloSubdetectorGeometry::parVecVec(), pv, DDFilteredView::rotation(), DDSolid::shape(), DDLogicalPart::solid(), DDFilteredView::translation(), vv, x, y, and z.

Referenced by load().

00038 {
00039 
00040    if( ebg->cornersMgr() == 0 ) ebg->allocateCorners( 256 ) ;
00041    if( ebg->parMgr()     == 0 ) ebg->allocatePar( 10, 3 ) ;
00042   
00043   DDFilter* filter = getDDFilter();
00044 
00045   DDFilteredView fv(*cpv);
00046   fv.addFilter(*filter);
00047   
00048   bool doSubDets;
00049   for (doSubDets = fv.firstChild(); doSubDets ; doSubDets = fv.nextSibling())
00050     {
00051       
00052 #if 0
00053       string answer = getDDDString("ReadOutName",&fv);
00054       if (answer != "EcalTBH4BeamHits")
00055         continue;
00056 #endif
00057       
00058       const DDSolid & solid = fv.logicalPart().solid();
00059 
00060       if (solid.shape() != ddbox) {
00061         throw DDException(std::string(__FILE__) 
00062                           +"\n CaloGeometryEcalTBHodoscope::upDate(...): currently only box fiber shapes supported ");
00063         edm::LogWarning("EcalTBHodoscopeGeometry") << "Wrong shape for sensitive volume!" << solid;
00064       }
00065        
00066        vector<double> pv = solid.parameters();      
00067 
00068       // use preshower strip as box in space representation
00069 
00070        // rotate the box and then move it
00071       DD3Vector x, y, z;
00072       fv.rotation().GetComponents(x,y,z);
00073       Hep3Vector hx(x.X(), x.Y(), x.Z());
00074       Hep3Vector hy(y.X(), y.Y(), y.Z());
00075       Hep3Vector hz(z.X(), z.Y(), z.Z());
00076       HepRotation hrot(hx, hy, hz);
00077       Hep3Vector htran(fv.translation().X(), fv.translation().Y(), fv.translation().Z());
00078 
00079       const HepTransform3D ht3d ( hrot,                        // only scale translation
00080                                   CaloCellGeometry::k_ScaleFromDDDtoGeant*htran ) ;    
00081 
00082 
00083       const HepPoint3D ctr ( ht3d*HepPoint3D(0,0,0) ) ;
00084 
00085       const GlobalPoint refPoint ( ctr.x(), ctr.y(), ctr.z() ) ;
00086 
00087 
00088       std::vector<float> vv ;
00089       vv.reserve( pv.size() ) ;
00090       for( unsigned int i ( 0 ) ; i != pv.size() ; ++i )
00091       {
00092          vv.push_back( CaloCellGeometry::k_ScaleFromDDDtoGeant*pv[i] ) ;
00093       }
00094       const float* pP ( CaloCellGeometry::getParmPtr( vv, 
00095                                                       ebg->parMgr(), 
00096                                                       ebg->parVecVec() ) ) ;
00097 
00098       PreshowerStrip* cell ( new PreshowerStrip( refPoint,
00099                                                  ebg->cornersMgr(),
00100                                                  pP ) ) ;
00101 
00102       //Adding cell to the Geometry
00103       ebg->addCell(DetId(getDetIdForDDDNode(fv)),cell);
00104     } // loop over all children (i.e. crystals)
00105 }


Member Data Documentation

EcalHodoscopeNumberingScheme* EcalTBHodoscopeGeometryLoaderFromDDD::_scheme [private]

Definition at line 41 of file EcalTBHodoscopeGeometryLoaderFromDDD.h.

Referenced by EcalTBHodoscopeGeometryLoaderFromDDD(), getDetIdForDDDNode(), and ~EcalTBHodoscopeGeometryLoaderFromDDD().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:57 2009 for CMSSW by  doxygen 1.5.4