Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:46

0001 #include "RecoMET/METProducers/interface/GlobalHaloDataProducer.h"
0002 #include "FWCore/Framework/interface/ConsumesCollector.h"
0003 
0004 /*
0005   [class]:  GlobalHaloDataProducer
0006   [authors]: R. Remington, The University of Florida
0007   [description]: See GlobalHaloDataProducer.h
0008   [date]: October 15, 2009
0009 */
0010 
0011 using namespace edm;
0012 using namespace std;
0013 using namespace reco;
0014 
0015 GlobalHaloDataProducer::GlobalHaloDataProducer(const edm::ParameterSet& iConfig) {
0016   ishlt = iConfig.getParameter<bool>("IsHLT");
0017 
0018   //Higher Level Reco
0019   IT_met = iConfig.getParameter<edm::InputTag>("metLabel");
0020   IT_CaloTower = iConfig.getParameter<edm::InputTag>("calotowerLabel");
0021   IT_CSCSegment = iConfig.getParameter<edm::InputTag>("CSCSegmentLabel");
0022   IT_CSCRecHit = iConfig.getParameter<edm::InputTag>("CSCRecHitLabel");
0023   IT_Muon = iConfig.getParameter<edm::InputTag>("MuonLabel");
0024   //Halo Data from Sub-detectors
0025   IT_CSCHaloData = iConfig.getParameter<edm::InputTag>("CSCHaloDataLabel");
0026   IT_EcalHaloData = iConfig.getParameter<edm::InputTag>("EcalHaloDataLabel");
0027   IT_HcalHaloData = iConfig.getParameter<edm::InputTag>("HcalHaloDataLabel");
0028 
0029   EcalMinMatchingRadius = (float)iConfig.getParameter<double>("EcalMinMatchingRadiusParam");
0030   EcalMaxMatchingRadius = (float)iConfig.getParameter<double>("EcalMaxMatchingRadiusParam");
0031   HcalMinMatchingRadius = (float)iConfig.getParameter<double>("HcalMinMatchingRadiusParam");
0032   HcalMaxMatchingRadius = (float)iConfig.getParameter<double>("HcalMaxMatchingRadiusParam");
0033   CaloTowerEtThreshold = (float)iConfig.getParameter<double>("CaloTowerEtThresholdParam");
0034 
0035   //Parameters for CSC-calo matching
0036   //Flat segment theta condition:
0037   GlobalAlgo.SetMaxSegmentTheta((float)iConfig.getParameter<double>("MaxSegmentTheta"));
0038   //EB
0039   GlobalAlgo.setEtThresholdforCSCCaloMatchingEB((float)iConfig.getParameter<double>("rh_et_threshforcscmatching_eb"));
0040   GlobalAlgo.setRcaloMinRsegmLowThresholdforCSCCaloMatchingEB(
0041       (float)iConfig.getParameter<double>("rcalominrsegm_lowthresh_eb"));
0042   GlobalAlgo.setRcaloMinRsegmHighThresholdforCSCCaloMatchingEB(
0043       (float)iConfig.getParameter<double>("rcalominrsegm_highthresh_eb"));
0044   GlobalAlgo.setDtcalosegmThresholdforCSCCaloMatchingEB((float)iConfig.getParameter<double>("dtcalosegm_thresh_eb"));
0045   GlobalAlgo.setDPhicalosegmThresholdforCSCCaloMatchingEB(
0046       (float)iConfig.getParameter<double>("dphicalosegm_thresh_eb"));
0047   //EE
0048   GlobalAlgo.setEtThresholdforCSCCaloMatchingEE((float)iConfig.getParameter<double>("rh_et_threshforcscmatching_ee"));
0049   GlobalAlgo.setRcaloMinRsegmLowThresholdforCSCCaloMatchingEE(
0050       (float)iConfig.getParameter<double>("rcalominrsegm_lowthresh_ee"));
0051   GlobalAlgo.setRcaloMinRsegmHighThresholdforCSCCaloMatchingEE(
0052       (float)iConfig.getParameter<double>("rcalominrsegm_highthresh_ee"));
0053   GlobalAlgo.setDtcalosegmThresholdforCSCCaloMatchingEE((float)iConfig.getParameter<double>("dtcalosegm_thresh_ee"));
0054   GlobalAlgo.setDPhicalosegmThresholdforCSCCaloMatchingEE(
0055       (float)iConfig.getParameter<double>("dphicalosegm_thresh_ee"));
0056   //HB
0057   GlobalAlgo.setEtThresholdforCSCCaloMatchingHB((float)iConfig.getParameter<double>("rh_et_threshforcscmatching_hb"));
0058   GlobalAlgo.setRcaloMinRsegmLowThresholdforCSCCaloMatchingHB(
0059       (float)iConfig.getParameter<double>("rcalominrsegm_lowthresh_hb"));
0060   GlobalAlgo.setRcaloMinRsegmHighThresholdforCSCCaloMatchingHB(
0061       (float)iConfig.getParameter<double>("rcalominrsegm_highthresh_hb"));
0062   GlobalAlgo.setDtcalosegmThresholdforCSCCaloMatchingHB((float)iConfig.getParameter<double>("dtcalosegm_thresh_hb"));
0063   GlobalAlgo.setDPhicalosegmThresholdforCSCCaloMatchingHB(
0064       (float)iConfig.getParameter<double>("dphicalosegm_thresh_hb"));
0065   //HE
0066   GlobalAlgo.setEtThresholdforCSCCaloMatchingHE((float)iConfig.getParameter<double>("rh_et_threshforcscmatching_he"));
0067   GlobalAlgo.setRcaloMinRsegmLowThresholdforCSCCaloMatchingHE(
0068       (float)iConfig.getParameter<double>("rcalominrsegm_lowthresh_he"));
0069   GlobalAlgo.setRcaloMinRsegmHighThresholdforCSCCaloMatchingHE(
0070       (float)iConfig.getParameter<double>("rcalominrsegm_highthresh_he"));
0071   GlobalAlgo.setDtcalosegmThresholdforCSCCaloMatchingHE((float)iConfig.getParameter<double>("dtcalosegm_thresh_he"));
0072   GlobalAlgo.setDPhicalosegmThresholdforCSCCaloMatchingHE(
0073       (float)iConfig.getParameter<double>("dphicalosegm_thresh_he"));
0074 
0075   calotower_token_ = consumes<edm::View<Candidate> >(IT_CaloTower);
0076   calomet_token_ = consumes<reco::CaloMETCollection>(IT_met);
0077   cscsegment_token_ = consumes<CSCSegmentCollection>(IT_CSCSegment);
0078   cscrechit_token_ = consumes<CSCRecHit2DCollection>(IT_CSCRecHit);
0079   muon_token_ = consumes<reco::MuonCollection>(IT_Muon);
0080   cschalo_token_ = consumes<CSCHaloData>(IT_CSCHaloData);
0081   ecalhalo_token_ = consumes<EcalHaloData>(IT_EcalHaloData);
0082   hcalhalo_token_ = consumes<HcalHaloData>(IT_HcalHaloData);
0083   cscgeometry_token_ = esConsumes<CSCGeometry, MuonGeometryRecord>();
0084   globaltrackinggeometry_token_ = esConsumes<GlobalTrackingGeometry, GlobalTrackingGeometryRecord>();
0085   calogeometry_token_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
0086 
0087   produces<GlobalHaloData>();
0088 }
0089 
0090 void GlobalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup) {
0091   //Get CSC Geometry
0092   edm::ESHandle<CSCGeometry> TheCSCGeometry = iSetup.getHandle(cscgeometry_token_);
0093 
0094   //Get Global Tracking Geometry
0095   edm::ESHandle<GlobalTrackingGeometry> TheGlobalTrackingGeometry = iSetup.getHandle(globaltrackinggeometry_token_);
0096 
0097   //Get CaloGeometry
0098   edm::ESHandle<CaloGeometry> TheCaloGeometry = iSetup.getHandle(calogeometry_token_);
0099 
0100   //Get CaloTowers
0101   edm::Handle<edm::View<Candidate> > TheCaloTowers;
0102   //  iEvent.getByLabel(IT_CaloTower,TheCaloTowers);
0103   iEvent.getByToken(calotower_token_, TheCaloTowers);
0104 
0105   //Get MET
0106   edm::Handle<reco::CaloMETCollection> TheCaloMET;
0107   //  iEvent.getByLabel(IT_met, TheCaloMET);
0108   iEvent.getByToken(calomet_token_, TheCaloMET);
0109 
0110   //Get CSCSegments
0111   edm::Handle<CSCSegmentCollection> TheCSCSegments;
0112   //  iEvent.getByLabel(IT_CSCSegment, TheCSCSegments);
0113   iEvent.getByToken(cscsegment_token_, TheCSCSegments);
0114 
0115   //Get CSCRecHits
0116   edm::Handle<CSCRecHit2DCollection> TheCSCRecHits;
0117   //  iEvent.getByLabel(IT_CSCRecHit, TheCSCRecHits );
0118   iEvent.getByToken(cscrechit_token_, TheCSCRecHits);
0119 
0120   //Collision Muon Collection
0121   edm::Handle<reco::MuonCollection> TheMuons;
0122   iEvent.getByToken(muon_token_, TheMuons);
0123 
0124   //Get CSCHaloData
0125   edm::Handle<reco::CSCHaloData> TheCSCHaloData;
0126   //  iEvent.getByLabel(IT_CSCHaloData, TheCSCHaloData );
0127   iEvent.getByToken(cschalo_token_, TheCSCHaloData);
0128 
0129   // Get EcalHaloData
0130   edm::Handle<reco::EcalHaloData> TheEcalHaloData;
0131   //  iEvent.getByLabel(IT_EcalHaloData, TheEcalHaloData );
0132   iEvent.getByToken(ecalhalo_token_, TheEcalHaloData);
0133 
0134   // Get HcalHaloData
0135   edm::Handle<reco::HcalHaloData> TheHcalHaloData;
0136   //  iEvent.getByLabel(IT_HcalHaloData, TheHcalHaloData );
0137   iEvent.getByToken(hcalhalo_token_, TheHcalHaloData);
0138 
0139   // Run the GlobalHaloAlgo to reconstruct the GlobalHaloData object
0140   GlobalAlgo.SetEcalMatchingRadius(EcalMinMatchingRadius, EcalMaxMatchingRadius);
0141   GlobalAlgo.SetHcalMatchingRadius(HcalMinMatchingRadius, HcalMaxMatchingRadius);
0142   GlobalAlgo.SetCaloTowerEtThreshold(CaloTowerEtThreshold);
0143   //  GlobalHaloData GlobalData;
0144 
0145   if (TheCaloGeometry.isValid() && TheCaloMET.isValid() && TheCaloTowers.isValid() && TheCSCHaloData.isValid() &&
0146       TheEcalHaloData.isValid() && TheHcalHaloData.isValid()) {
0147     iEvent.put(std::make_unique<GlobalHaloData>(GlobalHaloData(GlobalAlgo.Calculate(*TheCaloGeometry,
0148                                                                                     *TheCSCGeometry,
0149                                                                                     *(&TheCaloMET.product()->front()),
0150                                                                                     TheCaloTowers,
0151                                                                                     TheCSCSegments,
0152                                                                                     TheCSCRecHits,
0153                                                                                     TheMuons,
0154                                                                                     *TheCSCHaloData.product(),
0155                                                                                     *TheEcalHaloData.product(),
0156                                                                                     *TheHcalHaloData.product(),
0157                                                                                     ishlt))));
0158   } else {
0159     iEvent.put(std::make_unique<GlobalHaloData>());
0160   }
0161 
0162   return;
0163 }
0164 
0165 GlobalHaloDataProducer::~GlobalHaloDataProducer() {}