CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CaloTowerHardcodeGeometryLoader Class Reference

#include <CaloTowerHardcodeGeometryLoader.h>

List of all members.

Public Member Functions

std::auto_ptr
< CaloSubdetectorGeometry
load ()

Private Member Functions

void makeCell (int ieta, int iphi, CaloSubdetectorGeometry *geom) const

Private Attributes

HcalTopology limits

Detailed Description

Date:
2011/06/04 19:07:17
Revision:
1.5
Author:
J. Mans - Minnesota

Definition at line 14 of file CaloTowerHardcodeGeometryLoader.h.


Member Function Documentation

std::auto_ptr< CaloSubdetectorGeometry > CaloTowerHardcodeGeometryLoader::load ( )

Definition at line 10 of file CaloTowerHardcodeGeometryLoader.cc.

References abs, CaloSubdetectorGeometry::allocateCorners(), CaloSubdetectorGeometry::allocatePar(), CaloSubdetectorGeometry::cornersMgr(), HcalTopology::firstHEDoublePhiRing(), HcalTopology::firstHFQuadPhiRing(), relativeConstraints::geom, CaloTowerGeometry::k_NumberOfCellsForCorners, CaloTowerGeometry::k_NumberOfParametersPerShape, CaloTowerGeometry::k_NumberOfShapes, HcalTopology::lastHFRing(), limits, makeCell(), n, and CaloSubdetectorGeometry::parMgr().

Referenced by CaloTowerHardcodeGeometryEP::produce().

                                                                           {
  CaloTowerGeometry* geom=new CaloTowerGeometry();

  if( 0 == geom->cornersMgr() ) geom->allocateCorners ( 
     CaloTowerGeometry::k_NumberOfCellsForCorners ) ;
  if( 0 == geom->parMgr() ) geom->allocatePar (
     CaloTowerGeometry::k_NumberOfParametersPerShape*CaloTowerGeometry::k_NumberOfShapes,
     CaloTowerGeometry::k_NumberOfParametersPerShape ) ;

  int nnn=0;
  // simple loop
  for (int ieta=-limits.lastHFRing(); ieta<=limits.lastHFRing(); ieta++) {
    if (ieta==0) continue; // skip not existing eta=0 ring
    for (int iphi=1; iphi<=72; iphi++) {
      if (abs(ieta)>=limits.firstHFQuadPhiRing() && ((iphi-1)%4)==0) continue;
      if (abs(ieta)>=limits.firstHEDoublePhiRing() && ((iphi-1)%2)!=0) continue;
      ++nnn;
    }
  }
  if( geom->cornersMgr() == 0 ) geom->allocateCorners( nnn ) ; 
  if( geom->parMgr()     == 0 ) geom->allocatePar( 41, 3 ) ;

  int n=0;
  // simple loop
  for (int ieta=-limits.lastHFRing(); ieta<=limits.lastHFRing(); ieta++) {
    if (ieta==0) continue; // skip not existing eta=0 ring
    for (int iphi=1; iphi<=72; iphi++) {
      if (abs(ieta)>=limits.firstHFQuadPhiRing() && ((iphi-1)%4)==0) continue;
      if (abs(ieta)>=limits.firstHEDoublePhiRing() && ((iphi-1)%2)!=0) continue;
      makeCell(ieta,iphi, geom);
      n++;
    }
  }
  edm::LogInfo("Geometry") << "CaloTowersHardcodeGeometry made " << n << " towers.";
  return std::auto_ptr<CaloSubdetectorGeometry>(geom); 
}
void CaloTowerHardcodeGeometryLoader::makeCell ( int  ieta,
int  iphi,
CaloSubdetectorGeometry geom 
) const [private]

Definition at line 48 of file CaloTowerHardcodeGeometryLoader.cc.

References abs, funct::cos(), eta(), HcalTopology::firstHFRing(), CaloCellGeometry::getParmPtr(), HcalTopology::lastHERing(), limits, M_PI, CaloSubdetectorGeometry::newCell(), HcalTopology::nPhiBins(), CaloSubdetectorGeometry::parMgr(), CaloSubdetectorGeometry::parVecVec(), phi, point, alignCSCRings::r, funct::sin(), theHBHEEtaBounds, theHFEtaBounds, x, detailsBasic3DVector::y, and z.

Referenced by load().

                                                                                 {
  const double EBradius = 143.0; // cm
  const double HOradius = 406.0+1.0;
  const double EEz = 320.0; // rough (cm)
  const double HEz = 568.0; // back (cm)
  const double HFz = 1100.0;
  const double HFthick = 165;
  // Tower 17 is the last EB tower

  int etaRing=abs(ieta);
  int sign=(ieta>0)?(1):(-1);
  double eta1, eta2;
  if (etaRing>limits.lastHERing()) {
    eta1 = theHFEtaBounds[etaRing-limits.firstHFRing()];
    eta2 = theHFEtaBounds[etaRing-limits.firstHFRing()+1];
  } else {
    eta1 = theHBHEEtaBounds[etaRing-1];
    eta2 = theHBHEEtaBounds[etaRing];
  }
  double eta = 0.5*(eta1+eta2);
  double deta = (eta2-eta1);  

  // in radians
  double dphi_nominal = 2.0*M_PI / limits.nPhiBins(1); // always the same
  double dphi_half = M_PI / limits.nPhiBins(etaRing); // half-width
  
  double phi_low = dphi_nominal*(iphi-1); // low-edge boundaries are constant...
  double phi = phi_low+dphi_half;

  double x,y,z,thickness;
  bool alongZ=true;
  if (etaRing>limits.lastHERing()) { // forward
    z=HFz;
    double r=z/sinh(eta);
    x=r * cos(phi);
    y=r * sin(phi);
    thickness=HFthick/tanh(eta);
  } else if (etaRing>17) { // EE-containing
    z=EEz;
    double r=z/sinh(eta);
    x=r * cos(phi);
    y=r * sin(phi);
    thickness=(HEz-EEz)/tanh(eta);
  } else { // EB-containing
    x=EBradius * cos(phi);
    y=EBradius * sin(phi);
    alongZ=false;
    z=EBradius * sinh(eta);
    thickness=(HOradius-EBradius) * cosh(eta);
  }

  z*=sign;
  GlobalPoint point(x,y,z);

  const double mysign ( !alongZ ? 1 : -1 ) ;
  std::vector<CCGFloat> hh ;
  hh.reserve(5) ;
  hh.push_back( deta/2 ) ;
  hh.push_back( dphi_half ) ;
  hh.push_back( mysign*thickness/2. ) ;

  hh.push_back( fabs( eta ) ) ;
  hh.push_back( fabs( z ) ) ;

  geom->newCell( point, point, point,
                 CaloCellGeometry::getParmPtr( hh, 
                                               geom->parMgr(), 
                                               geom->parVecVec() ),
                 CaloTowerDetId( ieta, iphi ) ) ;
}

Member Data Documentation

Definition at line 19 of file CaloTowerHardcodeGeometryLoader.h.

Referenced by load(), and makeCell().