CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/Geometry/CaloEventSetup/plugins/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.17 2013/01/27 04:28:25 dlange 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/HcalDetId/interface/HcalCastorDetId.h"
00026 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00027 #include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h"
00028 #include "Geometry/EcalAlgo/interface/EcalEndcapGeometry.h"
00029 #include "Geometry/EcalAlgo/interface/EcalPreshowerGeometry.h"
00030 #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h"
00031 #include "Geometry/HcalTowerAlgo/interface/CaloTowerGeometry.h"
00032 #include "Geometry/ForwardGeometry/interface/CastorGeometry.h"
00033 #include "Geometry/ForwardGeometry/interface/ZdcGeometry.h"
00034 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00035 //
00036 // member functions
00037 //
00038 CaloGeometryBuilder::CaloGeometryBuilder( const edm::ParameterSet& iConfig )
00039 {
00040     
00041    //the following line is needed to tell the framework what
00042    // data is being produced
00043    setWhatProduced( this, 
00044                     &CaloGeometryBuilder::produceAligned );
00045 
00046    //now do what ever other initialization is needed
00047    
00048    theCaloList = iConfig.getParameter< std::vector<std::string> >("SelectedCalos");
00049    if ( theCaloList.size() == 0 ) throw cms::Exception("Configuration") 
00050       << "No calorimeter specified for geometry, aborting";
00051 }
00052 
00053 // ------------ method called to produce the data  ------------
00054 
00055 CaloGeometryBuilder::ReturnType
00056 CaloGeometryBuilder::produceAligned( const CaloGeometryRecord& iRecord )
00057 {
00058 //   std::cout<<"*****************************entering geometry builder***********"<<std::endl;
00059 
00060    edm::ESHandle< CaloSubdetectorGeometry > pG;
00061 
00062    ReturnType pCalo ( new CaloGeometry() ) ;
00063 
00064    // loop on selected calorimeters
00065 
00066    for ( std::vector<std::string>::const_iterator ite ( theCaloList.begin() ) ;
00067          ite != theCaloList.end(); ++ite ) 
00068    {
00069       // look for HCAL parts
00070       // assume 'HCAL' for all of HCAL.  
00071       if ( (*ite) == HcalGeometry::producerTag() ) 
00072       {
00073          edm::LogInfo("CaloGeometryBuilder") << "Building HCAL reconstruction geometry";
00074 
00075          iRecord.getRecord< HcalGeometryRecord >().get( HcalGeometry::producerTag(), pG );  
00076          pCalo->setSubdetGeometry( DetId::Hcal, HcalBarrel , pG.product() );
00077          pCalo->setSubdetGeometry( DetId::Hcal, HcalEndcap , pG.product() );
00078          pCalo->setSubdetGeometry( DetId::Hcal, HcalOuter  , pG.product() );
00079          pCalo->setSubdetGeometry( DetId::Hcal, HcalForward, pG.product() );
00080       }
00081       else if ( (*ite) == ZdcGeometry::producerTag() ) 
00082       {
00083          edm::LogInfo("CaloGeometryBuilder") << "Building ZDC reconstruction geometry";
00084          iRecord.getRecord< ZDCGeometryRecord >().get( ZdcGeometry::producerTag(), pG ); 
00085          pCalo->setSubdetGeometry( DetId::Calo, HcalZDCDetId::SubdetectorId,pG.product());
00086       }
00087       else if ( (*ite) == CastorGeometry::producerTag() ) 
00088       {
00089          edm::LogInfo("CaloGeometryBuilder") << "Building CASTOR reconstruction geometry";
00090          iRecord.getRecord< CastorGeometryRecord >().get( CastorGeometry::producerTag(), pG ); 
00091          pCalo->setSubdetGeometry( DetId::Calo, HcalCastorDetId::SubdetectorId,pG.product());
00092       }
00093       // look for Ecal Barrel
00094       else if ( (*ite) == EcalBarrelGeometry::producerTag() ) 
00095       {
00096 //       std::cout<< "Building EcalBarrel reconstruction geometry"<<std::endl;
00097          edm::LogInfo("CaloGeometryBuilder") << "Building EcalBarrel reconstruction geometry";
00098          iRecord.getRecord<EcalBarrelGeometryRecord>().get( EcalBarrelGeometry::producerTag(), pG ); 
00099          pCalo->setSubdetGeometry(DetId::Ecal,EcalBarrel,pG.product());
00100       }
00101       // look for Ecal Endcap
00102       else if ( (*ite) == EcalEndcapGeometry::producerTag() ) 
00103       {
00104          edm::LogInfo("CaloGeometryBuilder") << "Building EcalEndcap reconstruction geometry";
00105          iRecord.getRecord<EcalEndcapGeometryRecord>().get( EcalEndcapGeometry::producerTag(), pG ); 
00106          pCalo->setSubdetGeometry(DetId::Ecal,EcalEndcap,pG.product());
00107       }
00108       // look for Ecal Preshower
00109       else if ( (*ite) == EcalPreshowerGeometry::producerTag() ) 
00110       {
00111          edm::LogInfo("CaloGeometryBuilder") << "Building EcalPreshower reconstruction geometry";
00112          iRecord.getRecord<EcalPreshowerGeometryRecord>().get(EcalPreshowerGeometry::producerTag(), pG); 
00113          pCalo->setSubdetGeometry(DetId::Ecal,EcalPreshower,pG.product());
00114       }
00115       // look for TOWER parts
00116       else if ( (*ite) == CaloTowerGeometry::producerTag() ) 
00117       {
00118          edm::LogInfo("CaloGeometryBuilder") << "Building TOWER reconstruction geometry";
00119          iRecord.getRecord<CaloTowerGeometryRecord>().get(CaloTowerGeometry::producerTag(),pG);
00120          pCalo->setSubdetGeometry(DetId::Calo,1,pG.product());
00121       }
00122       else 
00123       {
00124          edm::LogWarning("CaloGeometryBuilder") 
00125             << "Reconstrcution geometry requested for a not implemented sub-detector: " 
00126             << (*ite); 
00127       }
00128    }
00129    return pCalo ;
00130 }