00001 00008 #include <Geometry/GlobalTrackingGeometryBuilder/plugins/GlobalTrackingGeometryESProducer.h> 00009 #include <Geometry/GlobalTrackingGeometryBuilder/plugins/GlobalTrackingGeometryBuilder.h> 00010 00011 #include <Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h> 00012 00013 #include <FWCore/Framework/interface/ESHandle.h> 00014 #include <FWCore/Framework/interface/ModuleFactory.h> 00015 00016 #include <FWCore/MessageLogger/interface/MessageLogger.h> 00017 #include <FWCore/Framework/interface/NoProxyException.h> 00018 #include <FWCore/Framework/interface/NoRecordException.h> 00019 00020 #include <memory> 00021 00022 using namespace edm; 00023 00024 GlobalTrackingGeometryESProducer::GlobalTrackingGeometryESProducer(const edm::ParameterSet & p){ 00025 setWhatProduced(this); 00026 } 00027 00028 GlobalTrackingGeometryESProducer::~GlobalTrackingGeometryESProducer(){} 00029 00030 boost::shared_ptr<GlobalTrackingGeometry> 00031 GlobalTrackingGeometryESProducer::produce(const GlobalTrackingGeometryRecord& record) { 00032 00033 edm::ESHandle<TrackerGeometry> tk; 00034 edm::ESHandle<DTGeometry> dt; 00035 edm::ESHandle<CSCGeometry> csc; 00036 edm::ESHandle<RPCGeometry> rpc; 00037 edm::ESHandle<GEMGeometry> gem; 00038 00039 try { 00040 record.getRecord<TrackerDigiGeometryRecord>().get(tk); 00041 } catch (edm::eventsetup::NoProxyException<TrackerGeometry>& e) { 00042 // No Tk geo available 00043 LogWarning("GeometryGlobalTrackingGeometryBuilder") << "No Tracker geometry is available."; 00044 } catch (edm::eventsetup::NoRecordException<TrackerDigiGeometryRecord>& e){ 00045 LogWarning("GeometryGlobalTrackingGeometryBuilder") << "No TrackerDigiGeometryRecord is available."; 00046 } 00047 00048 00049 try { 00050 try { 00051 record.getRecord<MuonGeometryRecord>().get(dt); 00052 } catch (edm::eventsetup::NoProxyException<DTGeometry>& e) { 00053 // No DT geo available 00054 LogWarning("GeometryGlobalTrackingGeometryBuilder") << "No DT geometry is available."; 00055 } 00056 00057 try { 00058 record.getRecord<MuonGeometryRecord>().get(csc); 00059 } catch (edm::eventsetup::NoProxyException<CSCGeometry>& e) { 00060 // No CSC geo available 00061 LogWarning("GeometryGlobalTrackingGeometryBuilder") << "No CSC geometry is available."; 00062 } 00063 00064 try { 00065 record.getRecord<MuonGeometryRecord>().get(rpc); 00066 } catch (edm::eventsetup::NoProxyException<RPCGeometry>& e) { 00067 // No RPC geo available 00068 LogWarning("GeometryGlobalTrackingGeometryBuilder") << "No RPC geometry is available."; 00069 } 00070 00071 try { 00072 record.getRecord<MuonGeometryRecord>().get(gem); 00073 } catch (edm::eventsetup::NoProxyException<GEMGeometry>& e) { 00074 // No GEM geo available 00075 LogWarning("GeometryGlobalTrackingGeometryBuilder") << "No GEM geometry is available."; 00076 } 00077 00078 } catch (edm::eventsetup::NoRecordException<MuonGeometryRecord>& e){ 00079 LogWarning("GeometryGlobalTrackingGeometryBuilder") << "No MuonGeometryRecord is available."; 00080 } 00081 00082 00083 GlobalTrackingGeometryBuilder builder; 00084 return boost::shared_ptr<GlobalTrackingGeometry>(builder.build(&(*tk), &(*dt), &(*csc), &(*rpc), &(*gem))); 00085 } 00086 00087 DEFINE_FWK_EVENTSETUP_MODULE(GlobalTrackingGeometryESProducer);