CMS 3D CMS Logo

CaloGeometryBuilder.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    CaloGeometryBuilder
00004 // Class:      CaloGeometryBuilder
00005 // 
00013 //
00014 // Original Author:  Jeremiah Mans
00015 //         Created:  Mon Oct  3 11:35:27 CDT 2005
00016 // $Id: CaloGeometryBuilder.cc,v 1.8 2008/05/19 20:12:41 heltsley Exp $
00017 //
00018 //
00019 
00020 
00021 // user include files
00022 #include "Geometry/CaloEventSetup/plugins/CaloGeometryBuilder.h"
00023 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00024 #include "DataFormats/HcalDetId/interface/HcalZDCDetId.h"
00025 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00026 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00027 //
00028 // member functions
00029 //
00030 CaloGeometryBuilder::CaloGeometryBuilder( const edm::ParameterSet& iConfig )
00031 {
00032    //the following line is needed to tell the framework what
00033    // data is being produced
00034    setWhatProduced( this, 
00035                     &CaloGeometryBuilder::produceAligned );
00036 
00037 // disable
00038 //   setWhatProduced( this, 
00039 //                  &CaloGeometryBuilder::produceIdeal ) ;
00040 
00041    //now do what ever other initialization is needed
00042    
00043    theCaloList = iConfig.getParameter< std::vector<std::string> >("SelectedCalos");
00044    if ( theCaloList.size() == 0 ) throw cms::Exception("Configuration") 
00045       << "No calorimeter specified for geometry, aborting";
00046 }
00047 
00048 // ------------ method called to produce the data  ------------
00049 
00050 CaloGeometryBuilder::ReturnType
00051 CaloGeometryBuilder::produceIdeal( const IdealGeometryRecord& iRecord )
00052 {
00053    edm::ESHandle<CaloSubdetectorGeometry> pG;
00054 
00055    ReturnType pCalo ( new CaloGeometry() );
00056 
00057    // loop on selected calorimeters
00058 
00059    for ( std::vector<std::string>::const_iterator ite ( theCaloList.begin() );
00060          ite != theCaloList.end(); ite++ ) 
00061    {
00062       // look for HCAL parts
00063       // assume 'HCAL' for all of HCAL.  
00064       if ( (*ite) == "HCAL" ) 
00065       {  
00066          edm::LogInfo("CaloGeometryBuilder") << "Building IDEAL HCAL reconstruction geometry";
00067          iRecord.get("HCAL", pG); 
00068          pCalo->setSubdetGeometry(DetId::Hcal,HcalBarrel,pG.product());
00069          pCalo->setSubdetGeometry(DetId::Hcal,HcalEndcap,pG.product());
00070          pCalo->setSubdetGeometry(DetId::Hcal,HcalOuter,pG.product());
00071          pCalo->setSubdetGeometry(DetId::Hcal,HcalForward,pG.product());
00072       } 
00073      
00074       // look for zdc parts
00075       else if ( (*ite) == "ZDC" ) 
00076       {
00077          edm::LogInfo("CaloGeometryBuilder") << "Building IDEAL ZDC reconstruction geometry";
00078          iRecord.get("ZDC", pG);
00079          pCalo->setSubdetGeometry(DetId::Calo, HcalZDCDetId::SubdetectorId,pG.product());
00080       }
00081      
00082       // look for Ecal Barrel
00083       else if ( (*ite) == "EcalBarrel" ) 
00084       {
00085          edm::LogInfo("CaloGeometryBuilder") << "Building IDEAL EcalBarrel reconstruction geometry";
00086          iRecord.get("EcalBarrel", pG); 
00087          pCalo->setSubdetGeometry(DetId::Ecal,EcalBarrel,pG.product());
00088       }
00089 
00090       // look for Ecal Endcap
00091       else if ( (*ite) == "EcalEndcap" ) 
00092       {
00093          edm::LogInfo("CaloGeometryBuilder") << "Building IDEAL EcalEndcap reconstruction geometry";
00094          iRecord.get("EcalEndcap", pG); 
00095          pCalo->setSubdetGeometry(DetId::Ecal,EcalEndcap,pG.product());
00096       }
00097 
00098       // look for Ecal Preshower
00099       else if ( (*ite) == "EcalPreshower" ) 
00100       {
00101          edm::LogInfo("CaloGeometryBuilder") << "Building IDEAL EcalPreshower reconstruction geometry";
00102          iRecord.get("EcalPreshower", pG); 
00103          pCalo->setSubdetGeometry(DetId::Ecal,EcalPreshower,pG.product());
00104       }
00105       else if ( (*ite) == "TOWER" ) 
00106       {
00107          edm::LogInfo("CaloGeometryBuilder") << "Building TOWER reconstruction geometry";
00108          iRecord.get("TOWER",pG);
00109          pCalo->setSubdetGeometry(DetId::Calo,1,pG.product());
00110       }
00111       else 
00112       { 
00113          edm::LogWarning("CaloGeometryBuilder") 
00114             << "IDEAL Reconstrcution geometry requested for a not implemented sub-detector: " 
00115             << (*ite); 
00116       }
00117    }
00118    return pCalo;
00119 }
00120 
00121 CaloGeometryBuilder::ReturnType
00122 CaloGeometryBuilder::produceAligned( const CaloGeometryRecord& iRecord )
00123 {
00124    edm::ESHandle< CaloSubdetectorGeometry > pG;
00125 
00126    ReturnType pCalo ( new CaloGeometry() ) ;
00127 
00128    // loop on selected calorimeters
00129 
00130    for ( std::vector<std::string>::const_iterator ite ( theCaloList.begin() ) ;
00131          ite != theCaloList.end(); ++ite ) 
00132    {
00133       // look for HCAL parts
00134       // assume 'HCAL' for all of HCAL.  
00135       if ( (*ite) == "HCAL" ) 
00136       {
00137          edm::LogInfo("CaloGeometryBuilder") << "Building HCAL reconstruction geometry";
00138 
00139          iRecord.getRecord< HcalGeometryRecord >().get("HCAL", pG);  
00140          pCalo->setSubdetGeometry( DetId::Hcal, HcalBarrel , pG.product() );
00141          pCalo->setSubdetGeometry( DetId::Hcal, HcalEndcap , pG.product() );
00142          pCalo->setSubdetGeometry( DetId::Hcal, HcalOuter  , pG.product() );
00143          pCalo->setSubdetGeometry( DetId::Hcal, HcalForward, pG.product() );
00144       }
00145       // look for zdc parts
00146       else if ( (*ite) == "ZDC" ) 
00147       {
00148          edm::LogInfo("CaloGeometryBuilder") << "Building ZDC reconstruction geometry";
00149          iRecord.getRecord< ZDCGeometryRecord >().get("ZDC", pG); 
00150          pCalo->setSubdetGeometry( DetId::Calo, HcalZDCDetId::SubdetectorId,pG.product());
00151       }
00152       // look for Ecal Barrel
00153       else if ( (*ite) == "EcalBarrel" ) 
00154       {
00155          edm::LogInfo("CaloGeometryBuilder") << "Building EcalBarrel reconstruction geometry";
00156          iRecord.getRecord<EcalBarrelGeometryRecord>().get("EcalBarrel", pG); 
00157          pCalo->setSubdetGeometry(DetId::Ecal,EcalBarrel,pG.product());
00158       }
00159       // look for Ecal Endcap
00160       else if ( (*ite) == "EcalEndcap" ) 
00161       {
00162          edm::LogInfo("CaloGeometryBuilder") << "Building EcalEndcap reconstruction geometry";
00163          iRecord.getRecord<EcalEndcapGeometryRecord>().get("EcalEndcap", pG); 
00164          pCalo->setSubdetGeometry(DetId::Ecal,EcalEndcap,pG.product());
00165       }
00166       // look for Ecal Preshower
00167       else if ( (*ite) == "EcalPreshower" ) 
00168       {
00169          edm::LogInfo("CaloGeometryBuilder") << "Building EcalPreshower reconstruction geometry";
00170          iRecord.getRecord<EcalPreshowerGeometryRecord>().get("EcalPreshower", pG); 
00171          pCalo->setSubdetGeometry(DetId::Ecal,EcalPreshower,pG.product());
00172       }
00173       // look for TOWER parts
00174       else if ( (*ite) == "TOWER" ) 
00175       {
00176          edm::LogInfo("CaloGeometryBuilder") << "Building TOWER reconstruction geometry";
00177          iRecord.getRecord<IdealGeometryRecord>().get("TOWER",pG);
00178          pCalo->setSubdetGeometry(DetId::Calo,1,pG.product());
00179       }
00180       else 
00181       {
00182          edm::LogWarning("CaloGeometryBuilder") 
00183             << "Reconstrcution geometry requested for a not implemented sub-detector: " 
00184             << (*ite); 
00185       }
00186    }
00187    return pCalo ;
00188 }

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