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/EcalDetId/interface/EcalSubdetector.h"
00026 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00027
00028
00029
00030 CaloGeometryBuilder::CaloGeometryBuilder( const edm::ParameterSet& iConfig )
00031 {
00032
00033
00034 setWhatProduced( this,
00035 &CaloGeometryBuilder::produceAligned );
00036
00037
00038
00039
00040
00041
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
00049
00050 CaloGeometryBuilder::ReturnType
00051 CaloGeometryBuilder::produceIdeal( const IdealGeometryRecord& iRecord )
00052 {
00053 edm::ESHandle<CaloSubdetectorGeometry> pG;
00054
00055 ReturnType pCalo ( new CaloGeometry() );
00056
00057
00058
00059 for ( std::vector<std::string>::const_iterator ite ( theCaloList.begin() );
00060 ite != theCaloList.end(); ite++ )
00061 {
00062
00063
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
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
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
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
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
00129
00130 for ( std::vector<std::string>::const_iterator ite ( theCaloList.begin() ) ;
00131 ite != theCaloList.end(); ++ite )
00132 {
00133
00134
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
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
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
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
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
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 }