CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/Geometry/GlobalTrackingGeometryBuilder/plugins/GlobalTrackingGeometryESProducer.cc

Go to the documentation of this file.
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       
00038   try {
00039     record.getRecord<TrackerDigiGeometryRecord>().get(tk);
00040   } catch (edm::eventsetup::NoProxyException<TrackerGeometry>& e) {
00041     // No Tk geo available
00042     LogWarning("GeometryGlobalTrackingGeometryBuilder") << "No Tracker geometry is available.";
00043   } catch (edm::eventsetup::NoRecordException<TrackerDigiGeometryRecord>& e){
00044     LogWarning("GeometryGlobalTrackingGeometryBuilder") << "No TrackerDigiGeometryRecord is available.";    
00045   }
00046 
00047 
00048   try {
00049     try {  
00050       record.getRecord<MuonGeometryRecord>().get(dt);
00051     } catch (edm::eventsetup::NoProxyException<DTGeometry>& e) {
00052       // No DT geo available
00053       LogWarning("GeometryGlobalTrackingGeometryBuilder") << "No DT geometry is available.";
00054     } 
00055 
00056     try {
00057       record.getRecord<MuonGeometryRecord>().get(csc);
00058     } catch (edm::eventsetup::NoProxyException<CSCGeometry>& e) {
00059       // No CSC geo available
00060       LogWarning("GeometryGlobalTrackingGeometryBuilder") << "No CSC geometry is available.";
00061     }    
00062     
00063     try {
00064       record.getRecord<MuonGeometryRecord>().get(rpc);      
00065     } catch (edm::eventsetup::NoProxyException<RPCGeometry>& e) {
00066       // No RPC geo available
00067       LogWarning("GeometryGlobalTrackingGeometryBuilder") << "No RPC geometry is available.";
00068     }
00069   } catch (edm::eventsetup::NoRecordException<MuonGeometryRecord>& e){
00070     LogWarning("GeometryGlobalTrackingGeometryBuilder") << "No MuonGeometryRecord is available.";    
00071   }
00072   
00073 
00074   GlobalTrackingGeometryBuilder builder;
00075   return boost::shared_ptr<GlobalTrackingGeometry>(builder.build(&(*tk), &(*dt), &(*csc), &(*rpc)));
00076 }
00077 
00078 DEFINE_FWK_EVENTSETUP_MODULE(GlobalTrackingGeometryESProducer);