Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-23 03:25:26

0001 #include "RecoMET/METProducers/interface/CSCHaloDataProducer.h"
0002 #include "FWCore/Common/interface/TriggerNames.h"
0003 #include "FWCore/Framework/interface/ConsumesCollector.h"
0004 
0005 /*
0006   [class]:  CSCHaloDataProducer
0007   [authors]: R. Remington, The University of Florida
0008   [description]: See CSCHaloDataProducer.h
0009   [date]: October 15, 2009
0010 */
0011 
0012 using namespace edm;
0013 using namespace std;
0014 using namespace reco;
0015 
0016 CSCHaloDataProducer::CSCHaloDataProducer(const edm::ParameterSet& iConfig) : CSCAlgo(consumesCollector()) {
0017   //Digi Level
0018   IT_L1MuGMTReadout = iConfig.getParameter<edm::InputTag>("L1MuGMTReadoutLabel");
0019 
0020   //HLT Level
0021   IT_HLTResult = iConfig.getParameter<edm::InputTag>("HLTResultLabel");
0022   CSCAlgo.vIT_HLTBit = iConfig.getParameter<std::vector<edm::InputTag> >("HLTBitLabel");
0023 
0024   //RecHit Level
0025   IT_CSCRecHit = iConfig.getParameter<edm::InputTag>("CSCRecHitLabel");
0026 
0027   //Calo RecHit
0028   IT_HBHErh = iConfig.getParameter<edm::InputTag>("HBHErhLabel");
0029   IT_ECALBrh = iConfig.getParameter<edm::InputTag>("ECALBrhLabel");
0030   IT_ECALErh = iConfig.getParameter<edm::InputTag>("ECALErhLabel");
0031   //Higher Level Reco
0032   IT_CSCSegment = iConfig.getParameter<edm::InputTag>("CSCSegmentLabel");
0033   IT_CosmicMuon = iConfig.getParameter<edm::InputTag>("CosmicMuonLabel");
0034   IT_Muon = iConfig.getParameter<edm::InputTag>("MuonLabel");
0035   IT_SA = iConfig.getParameter<edm::InputTag>("SALabel");
0036   IT_ALCT = iConfig.getParameter<edm::InputTag>("ALCTDigiLabel");
0037 
0038   //Muon to Segment Matching
0039   edm::ParameterSet matchParameters = iConfig.getParameter<edm::ParameterSet>("MatchParameters");
0040   edm::ConsumesCollector iC = consumesCollector();
0041   TheMatcher = new MuonSegmentMatcher(matchParameters, iC);
0042 
0043   // Cosmic track selection parameters
0044   CSCAlgo.SetDetaThreshold((float)iConfig.getParameter<double>("DetaParam"));
0045   CSCAlgo.SetDphiThreshold((float)iConfig.getParameter<double>("DphiParam"));
0046   CSCAlgo.SetMinMaxInnerRadius((float)iConfig.getParameter<double>("InnerRMinParam"),
0047                                (float)iConfig.getParameter<double>("InnerRMaxParam"));
0048   CSCAlgo.SetMinMaxOuterRadius((float)iConfig.getParameter<double>("OuterRMinParam"),
0049                                (float)iConfig.getParameter<double>("OuterRMaxParam"));
0050   CSCAlgo.SetNormChi2Threshold((float)iConfig.getParameter<double>("NormChi2Param"));
0051 
0052   // MLR
0053   CSCAlgo.SetMaxSegmentRDiff((float)iConfig.getParameter<double>("MaxSegmentRDiff"));
0054   CSCAlgo.SetMaxSegmentPhiDiff((float)iConfig.getParameter<double>("MaxSegmentPhiDiff"));
0055   CSCAlgo.SetMaxSegmentTheta((float)iConfig.getParameter<double>("MaxSegmentTheta"));
0056   // End MLR
0057 
0058   CSCAlgo.SetMaxDtMuonSegment((float)iConfig.getParameter<double>("MaxDtMuonSegment"));
0059   CSCAlgo.SetMaxFreeInverseBeta((float)iConfig.getParameter<double>("MaxFreeInverseBeta"));
0060   CSCAlgo.SetExpectedBX((short int)iConfig.getParameter<int>("ExpectedBX"));
0061   CSCAlgo.SetRecHitTime0((float)iConfig.getParameter<double>("RecHitTime0"));
0062   CSCAlgo.SetRecHitTimeWindow((float)iConfig.getParameter<double>("RecHitTimeWindow"));
0063   CSCAlgo.SetMinMaxOuterMomentumTheta((float)iConfig.getParameter<double>("MinOuterMomentumTheta"),
0064                                       (float)iConfig.getParameter<double>("MaxOuterMomentumTheta"));
0065   CSCAlgo.SetMatchingDPhiThreshold((float)iConfig.getParameter<double>("MatchingDPhiThreshold"));
0066   CSCAlgo.SetMatchingDEtaThreshold((float)iConfig.getParameter<double>("MatchingDEtaThreshold"));
0067   CSCAlgo.SetMatchingDWireThreshold(iConfig.getParameter<int>("MatchingDWireThreshold"));
0068 
0069   cscGeometry_token = esConsumes<CSCGeometry, MuonGeometryRecord>();
0070   cosmicmuon_token_ = consumes<reco::MuonCollection>(IT_CosmicMuon);
0071   csctimemap_token_ = consumes<reco::MuonTimeExtraMap>(edm::InputTag(IT_CosmicMuon.label(), "csc"));
0072   muon_token_ = consumes<reco::MuonCollection>(IT_Muon);
0073   cscsegment_token_ = consumes<CSCSegmentCollection>(IT_CSCSegment);
0074   cscrechit_token_ = consumes<CSCRecHit2DCollection>(IT_CSCRecHit);
0075   cscalct_token_ = consumes<CSCALCTDigiCollection>(IT_ALCT);
0076   l1mugmtro_token_ = consumes<L1MuGMTReadoutCollection>(IT_L1MuGMTReadout);
0077   hbhereco_token_ = consumes<HBHERecHitCollection>(IT_HBHErh);
0078   EcalRecHitsEB_token_ = consumes<EcalRecHitCollection>(IT_ECALBrh);
0079   EcalRecHitsEE_token_ = consumes<EcalRecHitCollection>(IT_ECALErh);
0080   hltresult_token_ = consumes<edm::TriggerResults>(IT_HLTResult);
0081 
0082   produces<CSCHaloData>();
0083 }
0084 
0085 void CSCHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup) {
0086   //Get CSC Geometry
0087   edm::ESHandle<CSCGeometry> TheCSCGeometry = iSetup.getHandle(cscGeometry_token);
0088 
0089   //Get Muons Collection from Cosmic Reconstruction
0090   edm::Handle<reco::MuonCollection> TheCosmics;
0091   //  iEvent.getByLabel(IT_CosmicMuon, TheCosmics);
0092   iEvent.getByToken(cosmicmuon_token_, TheCosmics);
0093 
0094   //Get Muon Time Information from Cosmic Reconstruction
0095   edm::Handle<reco::MuonTimeExtraMap> TheCSCTimeMap;
0096   //  iEvent.getByLabel(IT_CosmicMuon.label(),"csc",TheCSCTimeMap);
0097   iEvent.getByToken(csctimemap_token_, TheCSCTimeMap);
0098 
0099   //Collision Muon Collection
0100   edm::Handle<reco::MuonCollection> TheMuons;
0101   //  iEvent.getByLabel(IT_Muon, TheMuons);
0102   iEvent.getByToken(muon_token_, TheMuons);
0103 
0104   //Get CSC Segments
0105   edm::Handle<CSCSegmentCollection> TheCSCSegments;
0106   //  iEvent.getByLabel(IT_CSCSegment, TheCSCSegments);
0107   iEvent.getByToken(cscsegment_token_, TheCSCSegments);
0108 
0109   //Get CSC RecHits
0110   Handle<CSCRecHit2DCollection> TheCSCRecHits;
0111   //  iEvent.getByLabel(IT_CSCRecHit, TheCSCRecHits);
0112   iEvent.getByToken(cscrechit_token_, TheCSCRecHits);
0113 
0114   //Get L1MuGMT
0115   edm::Handle<L1MuGMTReadoutCollection> TheL1GMTReadout;
0116   //  iEvent.getByLabel (IT_L1MuGMTReadout, TheL1GMTReadout);
0117   iEvent.getByToken(l1mugmtro_token_, TheL1GMTReadout);
0118 
0119   //Get Chamber Anode Trigger Information
0120   edm::Handle<CSCALCTDigiCollection> TheALCTs;
0121   //  iEvent.getByLabel (IT_ALCT, TheALCTs);
0122   iEvent.getByToken(cscalct_token_, TheALCTs);
0123 
0124   //Calo rec hits
0125   Handle<HBHERecHitCollection> hbhehits;
0126   iEvent.getByToken(hbhereco_token_, hbhehits);
0127   Handle<EcalRecHitCollection> ecalebhits;
0128   iEvent.getByToken(EcalRecHitsEB_token_, ecalebhits);
0129   Handle<EcalRecHitCollection> ecaleehits;
0130   iEvent.getByToken(EcalRecHitsEE_token_, ecaleehits);
0131 
0132   //Get HLT Results
0133   edm::Handle<edm::TriggerResults> TheHLTResults;
0134   //  iEvent.getByLabel( IT_HLTResult , TheHLTResults);
0135   iEvent.getByToken(hltresult_token_, TheHLTResults);
0136 
0137   const edm::TriggerNames* triggerNames = nullptr;
0138   if (TheHLTResults.isValid()) {
0139     triggerNames = &iEvent.triggerNames(*TheHLTResults);
0140   }
0141 
0142   // Put it in the event
0143   iEvent.put(std::make_unique<CSCHaloData>(CSCAlgo.Calculate(*TheCSCGeometry,
0144                                                              TheCosmics,
0145                                                              TheCSCTimeMap,
0146                                                              TheMuons,
0147                                                              TheCSCSegments,
0148                                                              TheCSCRecHits,
0149                                                              TheL1GMTReadout,
0150                                                              hbhehits,
0151                                                              ecalebhits,
0152                                                              ecaleehits,
0153                                                              TheHLTResults,
0154                                                              triggerNames,
0155                                                              TheALCTs,
0156                                                              TheMatcher,
0157                                                              iEvent,
0158                                                              iSetup)));
0159   return;
0160 }
0161 
0162 CSCHaloDataProducer::~CSCHaloDataProducer() {}