CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoMET/METProducers/src/GlobalHaloDataProducer.cc

Go to the documentation of this file.
00001 #include "RecoMET/METProducers/interface/GlobalHaloDataProducer.h"
00002 
00003 /*
00004   [class]:  GlobalHaloDataProducer
00005   [authors]: R. Remington, The University of Florida
00006   [description]: See GlobalHaloDataProducer.h
00007   [date]: October 15, 2009
00008 */
00009 
00010 using namespace edm;
00011 using namespace std;
00012 using namespace reco;
00013 
00014 GlobalHaloDataProducer::GlobalHaloDataProducer(const edm::ParameterSet& iConfig)
00015 {
00016   //Higher Level Reco 
00017   IT_met = iConfig.getParameter<edm::InputTag>("metLabel");
00018   IT_CaloTower = iConfig.getParameter<edm::InputTag>("calotowerLabel");
00019   IT_CSCSegment = iConfig.getParameter<edm::InputTag>("CSCSegmentLabel");
00020   IT_CSCRecHit = iConfig.getParameter<edm::InputTag>("CSCRecHitLabel");
00021 
00022   //Halo Data from Sub-detectors
00023   IT_CSCHaloData = iConfig.getParameter<edm::InputTag>("CSCHaloDataLabel");
00024   IT_EcalHaloData = iConfig.getParameter<edm::InputTag> ("EcalHaloDataLabel");
00025   IT_HcalHaloData = iConfig.getParameter<edm::InputTag> ("HcalHaloDataLabel");
00026 
00027   EcalMinMatchingRadius = (float)iConfig.getParameter<double>("EcalMinMatchingRadiusParam");
00028   EcalMaxMatchingRadius = (float)iConfig.getParameter<double>("EcalMaxMatchingRadiusParam");
00029   HcalMinMatchingRadius = (float)iConfig.getParameter<double>("HcalMinMatchingRadiusParam");
00030   HcalMaxMatchingRadius = (float)iConfig.getParameter<double>("HcalMaxMatchingRadiusParam");
00031   CaloTowerEtThreshold  = (float)iConfig.getParameter<double>("CaloTowerEtThresholdParam");
00032   
00033   produces<GlobalHaloData>();
00034 }
00035 
00036 void GlobalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup)
00037 {
00038   //Get CSC Geometry
00039   edm::ESHandle<CSCGeometry> TheCSCGeometry;
00040   iSetup.get<MuonGeometryRecord>().get(TheCSCGeometry);
00041 
00042   //Get Global Tracking Geometry
00043   edm::ESHandle<GlobalTrackingGeometry> TheGlobalTrackingGeometry;
00044   iSetup.get<GlobalTrackingGeometryRecord>().get(TheGlobalTrackingGeometry);
00045 
00046   //Get CaloGeometry
00047   edm::ESHandle<CaloGeometry> TheCaloGeometry;
00048   iSetup.get<CaloGeometryRecord>().get(TheCaloGeometry);
00049 
00050   //Get CaloTowers
00051   edm::Handle<edm::View<Candidate> > TheCaloTowers;
00052   iEvent.getByLabel(IT_CaloTower,TheCaloTowers);
00053 
00054   //Get MET
00055   edm::Handle< reco::CaloMETCollection > TheCaloMET;
00056   iEvent.getByLabel(IT_met, TheCaloMET);
00057 
00058   //Get CSCSegments
00059   edm::Handle<CSCSegmentCollection> TheCSCSegments;
00060   iEvent.getByLabel(IT_CSCSegment, TheCSCSegments);
00061 
00062   //Get CSCRecHits
00063   edm::Handle<CSCRecHit2DCollection> TheCSCRecHits;
00064   iEvent.getByLabel(IT_CSCRecHit, TheCSCRecHits );
00065 
00066   //Get CSCHaloData
00067   edm::Handle<reco::CSCHaloData> TheCSCHaloData;
00068   iEvent.getByLabel(IT_CSCHaloData, TheCSCHaloData );
00069 
00070   // Get EcalHaloData
00071   edm::Handle<reco::EcalHaloData> TheEcalHaloData;
00072   iEvent.getByLabel(IT_EcalHaloData, TheEcalHaloData );
00073   
00074   // Get HcalHaloData
00075   edm::Handle<reco::HcalHaloData> TheHcalHaloData;
00076   iEvent.getByLabel(IT_HcalHaloData, TheHcalHaloData );
00077 
00078   // Run the GlobalHaloAlgo to reconstruct the GlobalHaloData object 
00079   GlobalHaloAlgo GlobalAlgo;
00080   GlobalAlgo.SetEcalMatchingRadius(EcalMinMatchingRadius,EcalMaxMatchingRadius);
00081   GlobalAlgo.SetHcalMatchingRadius(HcalMinMatchingRadius,HcalMaxMatchingRadius);
00082   GlobalAlgo.SetCaloTowerEtThreshold(CaloTowerEtThreshold);
00083   //  GlobalHaloData GlobalData;
00084 
00085   if(TheCaloGeometry.isValid() && TheCaloMET.isValid() && TheCaloTowers.isValid() && TheCSCHaloData.isValid() && TheEcalHaloData.isValid() && TheHcalHaloData.isValid() )
00086     {
00087       std::auto_ptr<GlobalHaloData> GlobalData( new GlobalHaloData(GlobalAlgo.Calculate(*TheCaloGeometry, *TheCSCGeometry,  *(&TheCaloMET.product()->front()), TheCaloTowers, TheCSCSegments, TheCSCRecHits, *TheCSCHaloData.product(), *TheEcalHaloData.product(), *TheHcalHaloData.product() )) );
00088       iEvent.put(GlobalData);
00089     }
00090   else 
00091     {
00092       std::auto_ptr<GlobalHaloData> GlobalData( new GlobalHaloData() ) ;
00093       iEvent.put(GlobalData);
00094     }
00095 
00096   return;
00097 }
00098 
00099 void GlobalHaloDataProducer::beginJob(){return;}
00100 void GlobalHaloDataProducer::endJob(){return;}
00101 void GlobalHaloDataProducer::beginRun(edm::Run&, const edm::EventSetup&){return;}
00102 void GlobalHaloDataProducer::endRun(edm::Run&, const edm::EventSetup&){return;}
00103 GlobalHaloDataProducer::~GlobalHaloDataProducer(){}