Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:08:10

0001 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0002 #include "Geometry/ForwardGeometry/interface/ZdcHardcodeGeometryLoader.h"
0003 #include "Geometry/ForwardGeometry/interface/IdealZDCTrapezoid.h"
0004 #include "Geometry/ForwardGeometry/interface/ZdcGeometry.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 #include <algorithm>
0007 
0008 typedef CaloCellGeometry::CCGFloat CCGFloat;
0009 
0010 ZdcHardcodeGeometryLoader::ZdcHardcodeGeometryLoader() : theTopology(new ZdcTopology), extTopology(theTopology) {
0011   init();
0012 }
0013 
0014 ZdcHardcodeGeometryLoader::ZdcHardcodeGeometryLoader(const ZdcTopology& ht) : theTopology(nullptr), extTopology(&ht) {
0015   init();
0016 }
0017 
0018 void ZdcHardcodeGeometryLoader::init() {}
0019 
0020 ZdcHardcodeGeometryLoader::ReturnType ZdcHardcodeGeometryLoader::load(DetId::Detector /*det*/, int subdet) {
0021   ReturnType hg(new ZdcGeometry(extTopology));
0022   if (subdet == HcalZDCDetId::SubdetectorId) {
0023     fill(HcalZDCDetId::EM, hg);
0024     fill(HcalZDCDetId::LUM, hg);
0025     fill(HcalZDCDetId::HAD, hg);
0026     //      fill(HcalZDCDetId::RPD ,hg ); // line will be needed in next version of code, but is commented out for now in order to ensure run1 compatability.
0027   }
0028   return hg;
0029 }
0030 
0031 ZdcHardcodeGeometryLoader::ReturnType ZdcHardcodeGeometryLoader::load() {
0032   ReturnType hg(new ZdcGeometry(extTopology));
0033   fill(HcalZDCDetId::EM, hg);
0034   fill(HcalZDCDetId::LUM, hg);
0035   fill(HcalZDCDetId::HAD, hg);
0036   //   fill(HcalZDCDetId::RPD ,hg );
0037   return hg;
0038 }
0039 
0040 void ZdcHardcodeGeometryLoader::fill(HcalZDCDetId::Section section, ReturnType geom) {
0041   // start by making the new HcalDetIds
0042   std::vector<HcalZDCDetId> zdcIds;
0043   HcalZDCDetId id;
0044   int firstCell = extTopology->firstCell(section);
0045   int lastCell = extTopology->lastCell(section);
0046   for (int ichannel = firstCell; ichannel <= lastCell; ++ichannel) {
0047     id = HcalZDCDetId(section, true, ichannel);
0048     if (extTopology->valid(id))
0049       zdcIds.emplace_back(id);
0050     id = HcalZDCDetId(section, false, ichannel);
0051     if (extTopology->valid(id))
0052       zdcIds.emplace_back(id);
0053   }
0054   if (geom->cornersMgr() == nullptr)
0055     geom->allocateCorners(HcalZDCDetId::kSizeForDenseIndexing);
0056   if (geom->parMgr() == nullptr)
0057     geom->allocatePar(ZdcGeometry::k_NumberOfParametersPerShape * ZdcGeometry::k_NumberOfShapes,
0058                       ZdcGeometry::k_NumberOfParametersPerShape);
0059 
0060   edm::LogInfo("ZdcHardcodeGeometry") << "Number of ZDC DetIds made: " << section << " " << zdcIds.size();
0061 
0062   // for each new HcalZdcDetId, make a CaloCellGeometry
0063 
0064   for (std::vector<HcalZDCDetId>::const_iterator zdcIdItr = zdcIds.begin(); zdcIdItr != zdcIds.end(); ++zdcIdItr) {
0065     makeCell(*zdcIdItr, geom);
0066   }
0067 }
0068 
0069 void ZdcHardcodeGeometryLoader::makeCell(const HcalZDCDetId& detId, ReturnType geom) const {
0070   double zside(detId.zside());
0071 
0072   const HcalZDCDetId::Section section(detId.section());
0073 
0074   const int channel(detId.channel());
0075 
0076   //********* Here are all the hardcoded numbers you need to know, in **cm**
0077   //********* Most are from the zdc.xml and zdclum.xml files ******
0078 
0079   static const double x0(0);  // these 3 are for the "mother" volume
0080   static const double y0(0);
0081   static const double z0(14000);
0082 
0083   static const double angEM(0);  // the angles of front face wrt vertical
0084   static const double angLUM(0);
0085   static const double angRPD(0);
0086   static const double angHAD(atan(1.));  // this is 45 deg
0087 
0088   // these dimensions are **half**-sizes
0089 
0090   static const double dxHAD(4.8);
0091   static const double dxEM(dxHAD / 5.);
0092   static const double dxLUM(4.8);  // to be updated when known
0093   static const double dxRPD(4.8);  // to be updated when known
0094 
0095   static const double dhEM(6.25);
0096   static const double dhLUM(6.25);  // to be updated when known
0097   static const double dhHAD(6.25);
0098   static const double dhRPD(6.25);  // to be updated when known
0099 
0100   static const double dzEM(33. * 0.15);
0101   static const double dzLUM(23.5);  // to be updated when known
0102   static const double dzHAD(0.82 * 6. / cos(angHAD));
0103   static const double dzRPD(23.5);  // to be updated when known
0104 
0105   // these are not half-dimensions, they are offsets from nominal
0106   // for the center-of-front-face points
0107 
0108   static const double xOffEM(-4. * dxEM);
0109   static const double xOffLUM(0);
0110   static const double xOffHAD(0);
0111   static const double xOffRPD(0);
0112 
0113   static const double yOffEM(0);
0114   static const double yOffLUM(0);
0115   static const double yOffHAD(0);
0116   static const double yOffRPD(0);
0117 
0118   static const double zOffEM(-49.85 - 0.15);
0119   static const double zOffLUM(-39.555);
0120   static const double zOffHAD(-29.00);
0121   static const double zOffRPD(-39.555);
0122 
0123   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
0124 
0125   double dx, dh, dz, x, y, z, an;
0126 
0127   if (section == HcalZDCDetId::EM) {
0128     dx = dxEM;
0129     dh = dhEM;
0130     dz = dzEM;
0131     an = angEM;
0132     x = zside * (x0 + xOffEM + (channel - 1.0) * dxEM * 2.);
0133     y = y0 + yOffEM;
0134     z = zside * (z0 + zOffEM);
0135   } else if (section == HcalZDCDetId::LUM) {
0136     dx = dxLUM;
0137     dh = dhLUM;
0138     dz = dzLUM;
0139     an = angLUM;
0140     x = zside * (x0 + xOffLUM);
0141     y = y0 + yOffLUM;
0142     z = zside * (z0 + zOffLUM + (channel - 1.0) * dzLUM * 2.);
0143   } else if (section == HcalZDCDetId::RPD) {
0144     dx = dxRPD;
0145     dh = dhRPD;
0146     dz = dzRPD;
0147     an = angRPD;
0148     x = zside * (x0 + xOffRPD);
0149     y = y0 + yOffRPD;
0150     z = zside * (z0 + zOffRPD + (channel - 1.0) * dzRPD * 2.);
0151   } else {
0152     assert(section == HcalZDCDetId::HAD);
0153     dx = dxHAD;
0154     dh = dhHAD;
0155     dz = dzHAD;
0156     an = angHAD;
0157     x = zside * (x0 + xOffHAD);
0158     y = y0 + yOffHAD;
0159     z = zside * (z0 + zOffHAD + (channel - 1.0) * dzHAD * 2.);
0160   }
0161 
0162   const GlobalPoint fc(x, y, z);
0163 
0164   const double dy(dh * cos(an));
0165 
0166   std::vector<CCGFloat> zz;
0167   zz.reserve(ZdcGeometry::k_NumberOfParametersPerShape);
0168   zz.emplace_back(an);
0169   zz.emplace_back(dx);
0170   zz.emplace_back(dy);
0171   zz.emplace_back(dz);
0172 
0173   geom->newCell(fc, fc, fc, CaloCellGeometry::getParmPtr(zz, geom->parMgr(), geom->parVecVec()), detId);
0174 }