CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

HcalDDDGeometryLoader Class Reference

#include <HcalDDDGeometryLoader.h>

List of all members.

Public Types

typedef CaloSubdetectorGeometryReturnType

Public Member Functions

 HcalDDDGeometryLoader (const DDCompactView &cpv)
ReturnType load ()
 Load all of HCAL.
ReturnType load (DetId::Detector, int)
virtual ~HcalDDDGeometryLoader ()

Private Member Functions

void fill (HcalSubdetector, HcalDDDGeometry *, CaloSubdetectorGeometry *)
 HcalDDDGeometryLoader ()
CaloCellGeometrymakeCell (const HcalDetId &, HcalCellType, double, double, CaloSubdetectorGeometry *geom) const

Private Attributes

HcalNumberingFromDDDnumberingFromDDD

Detailed Description

Note:
The Geometry as loaded from DDD
Date:
2010/04/12 23:35:37
Revision:
1.5
Author:
S. Banerjee

Definition at line 22 of file HcalDDDGeometryLoader.h.


Member Typedef Documentation

Definition at line 29 of file HcalDDDGeometryLoader.h.


Constructor & Destructor Documentation

HcalDDDGeometryLoader::HcalDDDGeometryLoader ( const DDCompactView cpv) [explicit]

Definition at line 13 of file HcalDDDGeometryLoader.cc.

References mergeVDriftHistosByStation::name, and numberingFromDDD.

                                                                      {
  std::string name = "HcalHits";
  numberingFromDDD = new HcalNumberingFromDDD(name, cpv);
}
HcalDDDGeometryLoader::~HcalDDDGeometryLoader ( ) [virtual]

Definition at line 18 of file HcalDDDGeometryLoader.cc.

References numberingFromDDD.

                                              {
  delete numberingFromDDD;
}
HcalDDDGeometryLoader::HcalDDDGeometryLoader ( ) [private]

Member Function Documentation

void HcalDDDGeometryLoader::fill ( HcalSubdetector  subdet,
HcalDDDGeometry geometryDDD,
CaloSubdetectorGeometry geom 
) [private]

helper functions to make all the ids and cells, and put them into the vectors and mpas passed in.

Definition at line 68 of file HcalDDDGeometryLoader.cc.

References CaloSubdetectorGeometry::addCell(), HcalNumberingFromDDD::HcalCellTypes(), i, HcalDDDGeometry::insertCell(), gen::k, LogDebug, M_PI, makeCell(), numberingFromDDD, convertSQLiteXML::ok, and phi.

Referenced by load().

                                                                           {

  // start by making the new HcalDetIds
  std::vector<HcalCellType> hcalCells = numberingFromDDD->HcalCellTypes(subdet);
  geometryDDD->insertCell(hcalCells);
#ifdef DebugLog
  LogDebug("HCalGeom") << "HcalDDDGeometryLoader::fill gets " 
                       << hcalCells.size() << " cells for subdetector " 
                       << subdet;
#endif                   
  // Make the new HcalDetIds and the cells

  double deg = M_PI/180.;
  std::vector<HcalDetId> hcalIds;
  for (unsigned int i=0; i<hcalCells.size(); i++) {
    int etaRing  = hcalCells[i].etaBin();
    int depthBin = hcalCells[i].depthSegment();
    int phiInc   = 4/hcalCells[i].nPhiModule();
    unsigned int iphi = 1;
    if (hcalCells[i].unitPhi() == 4) iphi = 3;
    double  dphi = (hcalCells[i].phiBinWidth())*deg;
    double   phi =-(hcalCells[i].phiOffset())*deg + 0.5*dphi;
    std::vector<int>missPlus  = hcalCells[i].missingPhiPlus();
    std::vector<int>missMinus = hcalCells[i].missingPhiMinus();
#ifdef DebugLog
    LogDebug("HCalGeom") << "HcalDDDGeometryLoader: Subdet " << subdet
                         << " eta " << etaRing << " depth " << depthBin
                         << " modules " << hcalCells[i].nPhiModule() << " "
                         << phiInc << " phi " << phi/deg << " " << dphi/deg
                         << " Missing " << missPlus.size() << "/"
                         << missMinus.size();
#endif
    for (int k = 0; k < hcalCells[i].nPhiBins(); k++) {
      bool ok = true;
      for (unsigned int kk = 0; kk < missPlus.size(); kk++)
        if (iphi == (unsigned int)(missPlus[kk])) ok = false;
      if (ok) {
#ifdef DebugLog
        LogDebug("HCalGeom") << "HcalDDDGeometryLoader::fill Cell " << i
                             << " eta " << etaRing << " phi " << iphi << "("
                             << phi/deg << ", " << dphi/deg << ") depth "
                             << depthBin;
#endif
        HcalDetId id(subdet, etaRing, iphi, depthBin);
        hcalIds.push_back(id);
        geom->addCell( id, makeCell(id,hcalCells[i],phi,dphi,geom) );
      }
      if (hcalCells[i].nHalves() > 1) {
        ok = true;
        for (unsigned int kk = 0; kk < missMinus.size(); kk++)
          if (iphi == (unsigned int)(missMinus[kk])) ok = false;
        if (ok) {
#ifdef DebugLog
          LogDebug("HCalGeom") << "HcalDDDGeometryLoader::fill Cell " << i
                               << " eta " << -etaRing << " phi " << iphi <<" ("
                               << phi/deg << ", " << dphi/deg << ") depth "
                               << depthBin;
#endif
          HcalDetId id(subdet, -etaRing, iphi, depthBin);
          hcalIds.push_back(id);
          geom->addCell( id, makeCell(id,hcalCells[i],phi,dphi,geom) );
        }
      }
      iphi += phiInc;
      phi  += dphi;
    }
  }
  
  edm::LogInfo("HCalGeom") << "Number of HCAL DetIds made for " << subdet
                           << " is " << hcalIds.size();
}
HcalDDDGeometryLoader::ReturnType HcalDDDGeometryLoader::load ( )
HcalDDDGeometryLoader::ReturnType HcalDDDGeometryLoader::load ( DetId::Detector  det,
int  subdet 
)
CaloCellGeometry * HcalDDDGeometryLoader::makeCell ( const HcalDetId detId,
HcalCellType  hcalCell,
double  phi,
double  dphi,
CaloSubdetectorGeometry geom 
) const [private]

Definition at line 143 of file HcalDDDGeometryLoader.cc.

References abs, CaloSubdetectorGeometry::cornersMgr(), funct::cos(), HcalCellType::depthMax(), HcalCellType::depthMin(), HcalCellType::depthType(), eta(), HcalCellType::etaMax(), HcalCellType::etaMin(), funct::exp(), CaloCellGeometry::getParmPtr(), HcalCellType::halfSize(), HcalBarrel, HcalForward, HcalOuter, LogDebug, CaloSubdetectorGeometry::parMgr(), CaloSubdetectorGeometry::parVecVec(), point, csvReporter::r, funct::sin(), HcalDetId::subdet(), funct::tan(), theta(), x, detailsBasic3DVector::y, z, and HcalDetId::zside().

Referenced by fill().

                                                                      {

  // the two eta boundaries of the cell
  double          eta1   = hcalCell.etaMin();
  double          eta2   = hcalCell.etaMax();
  HcalSubdetector subdet = detId.subdet();
  double          eta    = 0.5*(eta1+eta2) * detId.zside();
  double          deta   = (eta2-eta1);
  double          theta  = 2.0*atan(exp(-eta));

  // barrel vs forward
  bool rzType   = hcalCell.depthType();
  bool isBarrel = (subdet == HcalBarrel || subdet == HcalOuter);

  double          z, r, thickness;
#ifdef DebugLog
  double          r0, r1, r2;
#endif
  if (rzType) {
    r          = hcalCell.depthMin();
    if (isBarrel) {
      z         = r * sinh(eta); // sinh(eta) == 1/tan(theta)
      thickness = (hcalCell.depthMax() - r) * cosh(eta); // cosh(eta) == 1/sin(theta)
#ifdef DebugLog
      r1        = r;
      r2        = hcalCell.depthMax();
      r0        = 0.5*(r1+r2);
#endif
    } else {
      z         = r * sinh(eta2);
      thickness = 2. * hcalCell.halfSize();
      r         = z/sinh(std::abs(eta));
#ifdef DebugLog
      r0        = z/sinh(std::abs(eta));
      r1        = z/sinh(std::abs(eta)+0.5*deta);
      r2        = z/sinh(std::abs(eta)-0.5*deta);
#endif
    }
#ifdef DebugLog
    LogDebug("HCalGeom") << "HcalDDDGeometryLoader::makeCell SubDet " << subdet
                         << " eta = " << eta << " theta = " << theta
                         << " r = " << r << " thickness = " << thickness
                         << " r0-r2 (" << r0 << ":" << r1 << ":" << r2 << ")";
#endif
  } else {
    z          = hcalCell.depthMin();
    thickness  = hcalCell.depthMax() - z;
    z         *= detId.zside(); // get the sign right.
    r          = z * tan(theta);
    thickness /= std::abs(cos(theta));
#ifdef DebugLog
    r0         = z/sinh(std::abs(eta));
    r1         = z/sinh(std::abs(eta)+0.5*deta);
    r2         = z/sinh(std::abs(eta)-0.5*deta);
    LogDebug("HCalGeom") << "HcalDDDGeometryLoader::makeCell SubDet " << subdet
                         << " eta = " << eta << " theta = " << theta
                         << " z = " << z << " r = " << r << " thickness = "
                         << thickness << " r0-r2 (" << r0 << ":" << r1 << ":"
                         << r2 << ")";    
#endif
  }

  double x = r * cos(phi);
  double y = r * sin(phi);
  GlobalPoint point(x,y,z);

#ifdef DebugLog
  LogDebug("HCalGeom") << "HcalDDDGeometryLoader::makeCell for " << detId
                       << " Point " << point << " deta = " << deta 
                       << " dphi = " << dphi << " thickness = " << thickness
                       << " isBarrel = " << isBarrel << " " << rzType;
#endif
  
  if (subdet==HcalForward) {
    std::vector<double> hf ;
    hf.reserve(3) ;
    hf.push_back(deta/2.) ;
    hf.push_back(dphi/2.) ;
    hf.push_back(thickness/2.) ;
    return new calogeom::IdealZPrism(point, 
                                     geom->cornersMgr(),
                                     CaloCellGeometry::getParmPtr(hf, 
                                                                  geom->parMgr(), 
                                                                  geom->parVecVec() ) );
  } else  { 
    const double sign ( isBarrel ? 1 : -1 ) ;
    std::vector<double> hh ;
    hh.reserve(3) ;
    hh.push_back(deta/2.) ;
    hh.push_back(dphi/2.) ;
    hh.push_back(sign*thickness/2.) ;
    return new calogeom::IdealObliquePrism(point,
                                           geom->cornersMgr(),
                                           CaloCellGeometry::getParmPtr(hh, 
                                                                        geom->parMgr(), 
                                                                        geom->parVecVec() ) );
  }
}

Member Data Documentation

Definition at line 46 of file HcalDDDGeometryLoader.h.

Referenced by fill(), HcalDDDGeometryLoader(), load(), and ~HcalDDDGeometryLoader().