CMS 3D CMS Logo

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