CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/RecoMET/METProducers/src/CSCHaloDataProducer.cc

Go to the documentation of this file.
00001 #include "RecoMET/METProducers/interface/CSCHaloDataProducer.h"
00002 #include "FWCore/Common/interface/TriggerNames.h"
00003 
00004 /*
00005   [class]:  CSCHaloDataProducer
00006   [authors]: R. Remington, The University of Florida
00007   [description]: See CSCHaloDataProducer.h
00008   [date]: October 15, 2009
00009 */
00010 
00011 using namespace edm;
00012 using namespace std;
00013 using namespace reco;
00014 
00015 CSCHaloDataProducer::CSCHaloDataProducer(const edm::ParameterSet& iConfig)
00016 {
00017   //Digi Level 
00018   IT_L1MuGMTReadout = iConfig.getParameter<edm::InputTag>("L1MuGMTReadoutLabel");
00019 
00020   //HLT Level
00021   IT_HLTResult    = iConfig.getParameter<edm::InputTag>("HLTResultLabel");
00022   CSCAlgo.vIT_HLTBit = iConfig.getParameter< std::vector< edm::InputTag> >("HLTBitLabel");
00023   
00024   //RecHit Level
00025   IT_CSCRecHit   = iConfig.getParameter<edm::InputTag>("CSCRecHitLabel");
00026 
00027   //Higher Level Reco 
00028   IT_CSCSegment = iConfig.getParameter<edm::InputTag>("CSCSegmentLabel");  
00029   IT_CosmicMuon = iConfig.getParameter<edm::InputTag>("CosmicMuonLabel"); 
00030   IT_Muon = iConfig.getParameter<edm::InputTag>("MuonLabel");
00031   IT_SA   = iConfig.getParameter<edm::InputTag>("SALabel"); 
00032   IT_ALCT = iConfig.getParameter<edm::InputTag>("ALCTDigiLabel"); 
00033 
00034   //Muon to Segment Matching
00035   edm::ParameterSet serviceParameters = iConfig.getParameter<edm::ParameterSet>("ServiceParameters");
00036   TheService = new MuonServiceProxy(serviceParameters);
00037   edm::ParameterSet matchParameters = iConfig.getParameter<edm::ParameterSet>("MatchParameters");
00038   TheMatcher = new MuonSegmentMatcher(matchParameters, TheService);
00039 
00040   // Cosmic track selection parameters
00041   CSCAlgo.SetDetaThreshold( (float) iConfig.getParameter<double>("DetaParam"));
00042   CSCAlgo.SetDphiThreshold( (float) iConfig.getParameter<double>("DphiParam"));
00043   CSCAlgo.SetMinMaxInnerRadius( (float) iConfig.getParameter<double>("InnerRMinParam") ,  (float) iConfig.getParameter<double>("InnerRMaxParam") );
00044   CSCAlgo.SetMinMaxOuterRadius( (float) iConfig.getParameter<double>("OuterRMinParam"), (float) iConfig.getParameter<double>("OuterRMaxParam"));
00045   CSCAlgo.SetNormChi2Threshold( (float) iConfig.getParameter<double>("NormChi2Param") );
00046  
00047   // MLR
00048   CSCAlgo.SetMaxSegmentRDiff( (float) iConfig.getParameter<double>("MaxSegmentRDiff") );
00049   CSCAlgo.SetMaxSegmentPhiDiff( (float) iConfig.getParameter<double>("MaxSegmentPhiDiff") );
00050   CSCAlgo.SetMaxSegmentTheta( (float) iConfig.getParameter<double>("MaxSegmentTheta") );
00051   // End MLR
00052 
00053   CSCAlgo.SetMaxDtMuonSegment( (float) iConfig.getParameter<double>("MaxDtMuonSegment") );
00054   CSCAlgo.SetMaxFreeInverseBeta( (float) iConfig.getParameter<double>("MaxFreeInverseBeta") );
00055   CSCAlgo.SetExpectedBX( (short int) iConfig.getParameter<int>("ExpectedBX") );
00056   CSCAlgo.SetRecHitTime0( (float) iConfig.getParameter<double>("RecHitTime0") );
00057   CSCAlgo.SetRecHitTimeWindow( (float) iConfig.getParameter<double>("RecHitTimeWindow") );
00058   CSCAlgo.SetMinMaxOuterMomentumTheta( (float)iConfig.getParameter<double>("MinOuterMomentumTheta"), (float)iConfig.getParameter<double>("MaxOuterMomentumTheta") );
00059   CSCAlgo.SetMatchingDPhiThreshold( (float)iConfig.getParameter<double>("MatchingDPhiThreshold") );
00060   CSCAlgo.SetMatchingDEtaThreshold( (float)iConfig.getParameter<double>("MatchingDEtaThreshold") );
00061   CSCAlgo.SetMatchingDWireThreshold(iConfig.getParameter<int>("MatchingDWireThreshold") );
00062 
00063   produces<CSCHaloData>();
00064 }
00065 
00066 void CSCHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup)
00067 {
00068   //Get CSC Geometry
00069   edm::ESHandle<CSCGeometry> TheCSCGeometry;
00070   iSetup.get<MuonGeometryRecord>().get(TheCSCGeometry);
00071 
00072   //Get Muons Collection from Cosmic Reconstruction 
00073   edm::Handle< reco::MuonCollection > TheCosmics;
00074   iEvent.getByLabel(IT_CosmicMuon, TheCosmics);
00075   
00076   //Get Muon Time Information from Cosmic Reconstruction
00077   edm::Handle<reco::MuonTimeExtraMap> TheCSCTimeMap;
00078   iEvent.getByLabel(IT_CosmicMuon.label(),"csc",TheCSCTimeMap);
00079 
00080  //Collision Muon Collection
00081   edm::Handle< reco::MuonCollection> TheMuons;
00082   iEvent.getByLabel(IT_Muon, TheMuons);
00083 
00084   //Get CSC Segments
00085   edm::Handle<CSCSegmentCollection> TheCSCSegments;
00086   iEvent.getByLabel(IT_CSCSegment, TheCSCSegments);
00087 
00088   //Get CSC RecHits
00089   Handle<CSCRecHit2DCollection> TheCSCRecHits;
00090   iEvent.getByLabel(IT_CSCRecHit, TheCSCRecHits);
00091 
00092   //Get L1MuGMT 
00093   edm::Handle < L1MuGMTReadoutCollection > TheL1GMTReadout ;
00094   iEvent.getByLabel (IT_L1MuGMTReadout, TheL1GMTReadout);
00095 
00096   //Get Chamber Anode Trigger Information
00097   edm::Handle<CSCALCTDigiCollection> TheALCTs;
00098   iEvent.getByLabel (IT_ALCT, TheALCTs);
00099 
00100   //Get HLT Results                                                                                                                                                       
00101   edm::Handle<edm::TriggerResults> TheHLTResults;
00102   iEvent.getByLabel( IT_HLTResult , TheHLTResults);
00103 
00104   const edm::TriggerNames * triggerNames = 0;
00105   if (TheHLTResults.isValid()) {
00106     triggerNames = &iEvent.triggerNames(*TheHLTResults);
00107   }
00108 
00109   std::auto_ptr<CSCHaloData> TheCSCData(new CSCHaloData( CSCAlgo.Calculate(*TheCSCGeometry, TheCosmics, TheCSCTimeMap, TheMuons, TheCSCSegments, TheCSCRecHits, TheL1GMTReadout, TheHLTResults, triggerNames, TheALCTs, TheMatcher, iEvent) ) );
00110   // Put it in the event                                                                                                                                                
00111   iEvent.put(TheCSCData);
00112   return;
00113 }
00114 
00115 void CSCHaloDataProducer::beginJob(){return;}
00116 void CSCHaloDataProducer::endJob(){return;}
00117 void CSCHaloDataProducer::beginRun(edm::Run&, const edm::EventSetup&){return;}
00118 void CSCHaloDataProducer::endRun(edm::Run&, const edm::EventSetup&){return;}
00119 CSCHaloDataProducer::~CSCHaloDataProducer(){}