CMS 3D CMS Logo

ZdcHardcodeGeometryLoader.cc

Go to the documentation of this file.
00001 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00002 #include "Geometry/ForwardGeometry/interface/ZdcHardcodeGeometryLoader.h"
00003 #include "Geometry/ForwardGeometry/interface/IdealZDCTrapezoid.h"
00004 #include "Geometry/ForwardGeometry/interface/ZdcGeometry.h"
00005 #include "ZdcHardcodeGeometryData.h"
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007 #include <algorithm>
00008 
00009 ZdcHardcodeGeometryLoader::ZdcHardcodeGeometryLoader() :
00010    theTopology ( new ZdcTopology ) ,
00011    extTopology ( theTopology )
00012 {
00013   init();
00014 }
00015 
00016 ZdcHardcodeGeometryLoader::ZdcHardcodeGeometryLoader(const ZdcTopology& ht) : 
00017    theTopology( 0   ) ,
00018    extTopology( &ht ) 
00019 {
00020   init();
00021 }
00022 
00023 void ZdcHardcodeGeometryLoader::init() {
00024   theEMSectiondX = 2.*dXPlate;
00025   theEMSectiondY = 2.*dYPlate;
00026   theEMSectiondZ = 99.0;
00027   theLUMSectiondX = 2.*dXPlate; 
00028   theLUMSectiondY = 2*dYLUM;
00029   theLUMSectiondZ = 94.0;
00030   theHADSectiondX = 2.*dXPlate; 
00031   theHADSectiondY = 2.*dYPlate;
00032   theHADSectiondZ = 139.2;
00033 }
00034 
00035 ZdcHardcodeGeometryLoader::ReturnType 
00036 ZdcHardcodeGeometryLoader::load(DetId::Detector det, int subdet)
00037 {
00038    ReturnType hg(new ZdcGeometry( extTopology ) );
00039    if(subdet == HcalZDCDetId::SubdetectorId)
00040    {
00041       fill(HcalZDCDetId::EM  ,hg );
00042       fill(HcalZDCDetId::LUM ,hg );
00043       fill(HcalZDCDetId::HAD ,hg );
00044    }
00045    return hg;
00046 }
00047 
00048 ZdcHardcodeGeometryLoader::ReturnType 
00049 ZdcHardcodeGeometryLoader::load() 
00050 {
00051    ReturnType hg(new ZdcGeometry( extTopology ) );
00052    fill(HcalZDCDetId::EM  ,hg );
00053    fill(HcalZDCDetId::LUM ,hg );
00054    fill(HcalZDCDetId::HAD ,hg );
00055    return hg;
00056 }
00057 
00058 void ZdcHardcodeGeometryLoader::fill( HcalZDCDetId::Section section, 
00059                                       ReturnType            geom     ) 
00060 {
00061   // start by making the new HcalDetIds
00062   std::vector<HcalZDCDetId> zdcIds;
00063   HcalZDCDetId id;
00064   int firstCell = extTopology->firstCell(section);
00065   int lastCell = extTopology->lastCell(section);
00066   for(int idepth = firstCell; idepth <= lastCell; ++idepth) {
00067     id = HcalZDCDetId(section, true, idepth);
00068     if(extTopology->valid(id)) zdcIds.push_back(id);
00069     id = HcalZDCDetId(section, false, idepth);
00070     if(extTopology->valid(id)) zdcIds.push_back(id);
00071    }
00072   if( geom->cornersMgr() == 0 ) geom->allocateCorners( 1000 ) ;
00073   if( geom->parMgr()     == 0 ) geom->allocatePar( 500, 3 ) ;
00074 
00075   edm::LogInfo("ZdcHardcodeGeometry") << "Number of ZDC DetIds made: " << section << " " << zdcIds.size();
00076  
00077   // for each new HcalZdcDetId, make a CaloCellGeometry
00078 
00079  for(std::vector<HcalZDCDetId>::const_iterator zdcIdItr = zdcIds.begin();
00080      zdcIdItr != zdcIds.end(); ++zdcIdItr)
00081    {
00082      const CaloCellGeometry * geometry = makeCell(*zdcIdItr, geom );
00083      geom->addCell(*zdcIdItr, geometry);
00084    }
00085 }
00086 
00087 const CaloCellGeometry*
00088 ZdcHardcodeGeometryLoader::makeCell(const HcalZDCDetId& detId,
00089                                     ReturnType          geom) const 
00090 {
00091   float zside = detId.zside();
00092   HcalZDCDetId::Section section = detId.section();
00093   int channel = detId.depth();
00094   
00095   float xMother = X0;
00096   float yMother = Y0;
00097   float zMother = Z0;
00098   float dx = 0;
00099   float dy = 0;
00100   float dz = 0;
00101   float theTiltAngle = 0;
00102   float xfaceCenter = 0;
00103   float yfaceCenter = 0;
00104   float zfaceCenter = 0;
00105 
00106   if(section==HcalZDCDetId::EM){
00107     dx = theEMSectiondX;
00108     dy = theEMSectiondY;
00109     dz = theEMSectiondZ;
00110     theTiltAngle = 0.0;
00111     xfaceCenter = xMother + (theXChannelBoundaries[channel-1] + theEMSectiondX/2);
00112     yfaceCenter = yMother; 
00113     zfaceCenter = (zMother + theZSectionBoundaries[0])*zside;
00114   }
00115 
00116   if(section==HcalZDCDetId::LUM){
00117     dx = theLUMSectiondX;
00118     dy = theLUMSectiondY;
00119     dz = theLUMSectiondZ;
00120     theTiltAngle = 0.0;
00121     xfaceCenter = xMother;
00122     yfaceCenter = yMother + YLUM; 
00123     zfaceCenter = (zMother + theZLUMChannelBoundaries[channel-1])*zside;
00124   }
00125 
00126   if(section==HcalZDCDetId::HAD){
00127     dx = theHADSectiondX;
00128     dy = theHADSectiondY;
00129     dz = theHADSectiondZ;
00130     theTiltAngle = tiltangle;
00131     xfaceCenter = xMother;
00132     yfaceCenter = yMother; 
00133     zfaceCenter = (zMother + theZLUMChannelBoundaries[channel-1])*zside;
00134   }
00135   GlobalPoint faceCenter(xfaceCenter, yfaceCenter, zfaceCenter);
00136 
00137   std::vector<float> zz ;
00138   zz.reserve(3) ;
00139   zz.push_back( dx ) ;
00140   zz.push_back( dy ) ;
00141   zz.push_back( dz ) ;
00142   return new calogeom::IdealZDCTrapezoid( 
00143      faceCenter, 
00144      geom->cornersMgr(),
00145      CaloCellGeometry::getParmPtr( zz, 
00146                                    geom->parMgr(), 
00147                                    geom->parVecVec() ) );
00148 }
00149 
00150 

Generated on Tue Jun 9 17:37:29 2009 for CMSSW by  doxygen 1.5.4