Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
00037
00038 CaloGeometryBuilder::CaloGeometryBuilder( const edm::ParameterSet& iConfig )
00039 {
00040
00041
00042 setWhatProduced( this,
00043 &CaloGeometryBuilder::produceAligned );
00044
00045
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
00053
00054 CaloGeometryBuilder::ReturnType
00055 CaloGeometryBuilder::produceAligned( const CaloGeometryRecord& iRecord )
00056 {
00057 edm::ESHandle< CaloSubdetectorGeometry > pG;
00058
00059 ReturnType pCalo ( new CaloGeometry() ) ;
00060
00061
00062
00063 for ( std::vector<std::string>::const_iterator ite ( theCaloList.begin() ) ;
00064 ite != theCaloList.end(); ++ite )
00065 {
00066
00067
00068 if ( (*ite) == HcalGeometry::producerTag() )
00069 {
00070 edm::LogInfo("CaloGeometryBuilder") << "Building HCAL reconstruction geometry";
00071
00072 iRecord.getRecord< HcalGeometryRecord >().get( HcalGeometry::producerTag(), pG );
00073 pCalo->setSubdetGeometry( DetId::Hcal, HcalBarrel , pG.product() );
00074 pCalo->setSubdetGeometry( DetId::Hcal, HcalEndcap , pG.product() );
00075 pCalo->setSubdetGeometry( DetId::Hcal, HcalOuter , pG.product() );
00076 pCalo->setSubdetGeometry( DetId::Hcal, HcalForward, pG.product() );
00077 }
00078 else if ( (*ite) == ZdcGeometry::producerTag() )
00079 {
00080 edm::LogInfo("CaloGeometryBuilder") << "Building ZDC reconstruction geometry";
00081 iRecord.getRecord< ZDCGeometryRecord >().get( ZdcGeometry::producerTag(), pG );
00082 pCalo->setSubdetGeometry( DetId::Calo, HcalZDCDetId::SubdetectorId,pG.product());
00083 }
00084 else if ( (*ite) == CastorGeometry::producerTag() )
00085 {
00086 edm::LogInfo("CaloGeometryBuilder") << "Building CASTOR reconstruction geometry";
00087 iRecord.getRecord< CastorGeometryRecord >().get( CastorGeometry::producerTag(), pG );
00088 pCalo->setSubdetGeometry( DetId::Calo, HcalCastorDetId::SubdetectorId,pG.product());
00089 }
00090
00091 else if ( (*ite) == EcalBarrelGeometry::producerTag() )
00092 {
00093 edm::LogInfo("CaloGeometryBuilder") << "Building EcalBarrel reconstruction geometry";
00094 iRecord.getRecord<EcalBarrelGeometryRecord>().get( EcalBarrelGeometry::producerTag(), pG );
00095 pCalo->setSubdetGeometry(DetId::Ecal,EcalBarrel,pG.product());
00096 }
00097
00098 else if ( (*ite) == EcalEndcapGeometry::producerTag() )
00099 {
00100 edm::LogInfo("CaloGeometryBuilder") << "Building EcalEndcap reconstruction geometry";
00101 iRecord.getRecord<EcalEndcapGeometryRecord>().get( EcalEndcapGeometry::producerTag(), pG );
00102 pCalo->setSubdetGeometry(DetId::Ecal,EcalEndcap,pG.product());
00103 }
00104
00105 else if ( (*ite) == EcalPreshowerGeometry::producerTag() )
00106 {
00107 edm::LogInfo("CaloGeometryBuilder") << "Building EcalPreshower reconstruction geometry";
00108 iRecord.getRecord<EcalPreshowerGeometryRecord>().get(EcalPreshowerGeometry::producerTag(), pG);
00109 pCalo->setSubdetGeometry(DetId::Ecal,EcalPreshower,pG.product());
00110 }
00111
00112 else if ( (*ite) == CaloTowerGeometry::producerTag() )
00113 {
00114 edm::LogInfo("CaloGeometryBuilder") << "Building TOWER reconstruction geometry";
00115 iRecord.getRecord<CaloTowerGeometryRecord>().get(CaloTowerGeometry::producerTag(),pG);
00116 pCalo->setSubdetGeometry(DetId::Calo,1,pG.product());
00117 }
00118 else
00119 {
00120 edm::LogWarning("CaloGeometryBuilder")
00121 << "Reconstrcution geometry requested for a not implemented sub-detector: "
00122 << (*ite);
00123 }
00124 }
00125 return pCalo ;
00126 }