CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CastorHardcodeGeometryLoader Class Reference

#include <CastorHardcodeGeometryLoader.h>

List of all members.

Public Member Functions

 CastorHardcodeGeometryLoader ()
 CastorHardcodeGeometryLoader (const CastorTopology &ht)
virtual std::auto_ptr
< CaloSubdetectorGeometry
load (DetId::Detector det, int subdet)
std::auto_ptr
< CaloSubdetectorGeometry
load ()
virtual ~CastorHardcodeGeometryLoader ()

Private Member Functions

void fill (HcalCastorDetId::Section section, CaloSubdetectorGeometry *cg)
void init ()
CaloCellGeometrymakeCell (const HcalCastorDetId &detId, CaloSubdetectorGeometry *geom) const

Private Attributes

const CastorTopologyextTopology
float theEMSectiondX
float theEMSectiondY
float theEMSectiondZ
float theHADSectiondX
float theHADSectiondY
float theHADSectiondZ
CastorTopologytheTopology

Detailed Description

Definition at line 12 of file CastorHardcodeGeometryLoader.h.


Constructor & Destructor Documentation

CastorHardcodeGeometryLoader::CastorHardcodeGeometryLoader ( )

Definition at line 9 of file CastorHardcodeGeometryLoader.cc.

References init().

CastorHardcodeGeometryLoader::CastorHardcodeGeometryLoader ( const CastorTopology ht) [explicit]

Definition at line 16 of file CastorHardcodeGeometryLoader.cc.

References init().

                                                                                     : 
   theTopology( 0 ) , 
   extTopology ( &ht )
{
   init();
}
virtual CastorHardcodeGeometryLoader::~CastorHardcodeGeometryLoader ( ) [inline, virtual]

Definition at line 16 of file CastorHardcodeGeometryLoader.h.

References theTopology.

{ delete theTopology ; };

Member Function Documentation

void CastorHardcodeGeometryLoader::fill ( HcalCastorDetId::Section  section,
CaloSubdetectorGeometry cg 
) [private]

Definition at line 57 of file CastorHardcodeGeometryLoader.cc.

References CaloSubdetectorGeometry::addCell(), CaloSubdetectorGeometry::allocateCorners(), CaloSubdetectorGeometry::allocatePar(), CaloSubdetectorGeometry::cornersMgr(), extTopology, CastorTopology::firstCell(), ExpressReco_HICollisions_FallBack::id, CastorGeometry::k_NumberOfParametersPerShape, CastorGeometry::k_NumberOfShapes, HcalCastorDetId::kNumberSectorsPerEnd, HcalCastorDetId::kSizeForDenseIndexing, CastorTopology::lastCell(), makeCell(), CaloSubdetectorGeometry::parMgr(), and CastorTopology::valid().

Referenced by load().

{
   if( geom->cornersMgr() == 0 ) geom->allocateCorners(
      HcalCastorDetId::kSizeForDenseIndexing ) ;
   if( geom->parMgr()     == 0 ) geom->allocatePar( 
      CastorGeometry::k_NumberOfShapes*
      CastorGeometry::k_NumberOfParametersPerShape,
      CastorGeometry::k_NumberOfParametersPerShape ) ;

   // start by making the new HcalDetIds
   std::vector<HcalCastorDetId> castorIds ;

   const int firstCell ( extTopology->firstCell( section ) ) ;
   const int lastCell  ( extTopology->lastCell(  section ) );

   for( int imodule ( firstCell ) ; imodule <= lastCell ; ++imodule ) 
   {
      for( int isector ( 1 ) ;
           isector <= HcalCastorDetId::kNumberSectorsPerEnd ; ++isector ) 
      {
         const HcalCastorDetId id ( section, false, isector, imodule ) ;
         if( extTopology->valid( id ) )  castorIds.push_back( id ) ;
      }
   }
//   edm::LogInfo("CastorHardcodeGeometry") 
//      << "Number of Castor DetIds made: " << section 
//      << " " << castorIds.size();
 
   // for each new HcalCastorDetId, make a CaloCellGeometry

   for( std::vector<HcalCastorDetId>::const_iterator 
           castorIdItr ( castorIds.begin() ) ;
        castorIdItr != castorIds.end() ; ++castorIdItr )
   {
      geom->addCell( *castorIdItr, makeCell( *castorIdItr, geom ) ) ;
   }
}
void CastorHardcodeGeometryLoader::init ( void  ) [private]
std::auto_ptr< CaloSubdetectorGeometry > CastorHardcodeGeometryLoader::load ( )

Definition at line 47 of file CastorHardcodeGeometryLoader.cc.

References HcalCastorDetId::EM, extTopology, fill(), and HcalCastorDetId::HAD.

{
   std::auto_ptr<CaloSubdetectorGeometry> hg
      ( new CastorGeometry( extTopology ) ) ;
   fill( HcalCastorDetId::EM,  hg.get() ) ;
   fill( HcalCastorDetId::HAD, hg.get() ) ;
   return hg;
}
std::auto_ptr< CaloSubdetectorGeometry > CastorHardcodeGeometryLoader::load ( DetId::Detector  det,
int  subdet 
) [virtual]

Definition at line 34 of file CastorHardcodeGeometryLoader.cc.

References HcalCastorDetId::EM, extTopology, fill(), HcalCastorDetId::HAD, and HcalCastorDetId::SubdetectorId.

Referenced by CastorHardcodeGeometryEP::produce().

{
   std::auto_ptr<CaloSubdetectorGeometry> hg(new CastorGeometry( extTopology ));
   if( subdet == HcalCastorDetId::SubdetectorId )
   {
      fill( HcalCastorDetId::EM,  hg.get() ) ;
      fill( HcalCastorDetId::HAD, hg.get() ) ;
   }
   return hg;
}
CaloCellGeometry * CastorHardcodeGeometryLoader::makeCell ( const HcalCastorDetId detId,
CaloSubdetectorGeometry geom 
) const [private]

Definition at line 97 of file CastorHardcodeGeometryLoader.cc.

References CaloSubdetectorGeometry::cornersMgr(), funct::cos(), HcalCastorDetId::EM, benchmark_cfg::fc, CaloCellGeometry::getParmPtr(), CastorGeometry::k_NumberOfParametersPerShape, HcalCastorDetId::kNumberSectorsPerEnd, M_PI, module(), HcalCastorDetId::module(), CaloSubdetectorGeometry::parMgr(), CaloSubdetectorGeometry::parVecVec(), phi, HcalCastorDetId::section(), HcalCastorDetId::sector(), funct::sin(), mathSSE::sqrt(), and HcalCastorDetId::zside().

Referenced by fill().

{
   const double                   zside   ( 1.0*detId.zside()  ) ;
   const HcalCastorDetId::Section section ( detId.section()    ) ;
   const int                      module  ( detId.module()     ) ;
   const int                      isect   ( detId.sector()     ) ;
   const double                   sector  ( 1.0*isect          ) ;

// length units are cm


   const double sign ( 0 == isect%2 ? -1 : 1 ) ;

//********* HERE ARE HARDWIRED GEOMETRY NUMBERS ACTUALLY USED *****

   static const double an     ( atan( 1.)); //angle of cant w.r.t. beam
   static const double can    ( cos( an ));
   static const double san    ( sin( an ));
   static const double dxlEM  ( 1.55/2. ) ; //halflength of side near beam
   static const double dxhEM  ( 5.73/2. ) ; //halflength of side away from beam
   static const double dhEM   ( 14.26/2. ); //halflength of 2nd longest side
   static const double dR     ( 0.1 + 2.*dhEM*san*dxlEM/( dxhEM-dxlEM ) ) ;
   static const double dhHAD  ( 19.88/2. ); //halflength of 2nd longest side 

   static const double dxhHAD ( dxhEM*( 2.*dhHAD*san + dR )/
                                ( 2.*dhEM*san + dR ) ) ; //halflength of side away from beam
   static const double zm     ( 1439.0  ) ;  //z of start of EM
   static const double dzEM   ( 5.45/2 ) ;   // halflength in z of EM
   static const double dzHAD  ( 10.075/2 ) ; // halflength in z of HAD

//*****************************************************************

   const double dxl ( sign*dxlEM ) ; // same for EM and HAD

   const double dxh ( sign*( section == HcalCastorDetId::EM ?
                             dxhEM : dxhHAD ) ) ;
   const double dh  ( section == HcalCastorDetId::EM ?
                      dhEM : dhHAD ) ;
   const double dz  ( section == HcalCastorDetId::EM ?
                      dzEM : dzHAD ) ;

   const double delz  ( dh*can ) ;
   const double dy  ( dh*san ) ;
   const double dx  ( ( dxl + dxh )/2. ) ;
   const double leg ( dR + dy ) ;
   const double len ( sqrt( leg*leg + dx*dx ) ) ;

   static const double dphi 
      ( 2.*M_PI/(1.0*HcalCastorDetId::kNumberSectorsPerEnd ) ) ;

   const double fphi ( atan( dx/( dR + dy ) ) ) ;

   const double phi  ( 0==isect%2 ? (sector-1.)*dphi - fphi :
                       sector*dphi - fphi ) ;

   const double sphi ( sin( phi ) ) ;
   const double cphi ( cos( phi ) ) ;

   const double xc ( len*cphi ) ;
   const double yc ( len*sphi ) ; 
   const double zc ( zside*( zm + delz + 
                             ( module<3 ? ( 1.*module - 1.0 )*2.*dzEM :
                               4.*dzEM +  ( 1.*(module-2) - 1 )*2.*dzHAD ) ) ) ;

   const GlobalPoint fc ( xc, yc, zc ) ;

   std::vector<double> zz ;
   zz.reserve( CastorGeometry::k_NumberOfParametersPerShape ) ;
   zz.push_back( dxl ) ;
   zz.push_back( dxh ) ;
   zz.push_back( dh ) ;
   zz.push_back( dz ) ;
   zz.push_back( an ) ;
   zz.push_back( dR ) ;

   return new calogeom::IdealCastorTrapezoid( 
      fc, 
      geom->cornersMgr(),
      CaloCellGeometry::getParmPtr( zz, 
                                    geom->parMgr(), 
                                    geom->parVecVec() ) );
}

Member Data Documentation

Definition at line 28 of file CastorHardcodeGeometryLoader.h.

Referenced by fill(), and load().

Definition at line 31 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

Definition at line 32 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

Definition at line 33 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

Definition at line 34 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

Definition at line 35 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

Definition at line 36 of file CastorHardcodeGeometryLoader.h.

Referenced by init().

Definition at line 27 of file CastorHardcodeGeometryLoader.h.

Referenced by ~CastorHardcodeGeometryLoader().