Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-01-08 03:36:30

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 void GlobalHaloDataProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0016   edm::ParameterSetDescription desc;
0017   desc.add<bool>("IsHLT", false);
0018 
0019   // Higher Level Reco
0020   desc.add<edm::InputTag>("metLabel", edm::InputTag("caloMet"));
0021   desc.add<edm::InputTag>("calotowerLabel", edm::InputTag("towerMaker"));
0022   desc.add<edm::InputTag>("CSCSegmentLabel", edm::InputTag("cscSegments"));
0023   desc.add<edm::InputTag>("CSCRecHitLabel", edm::InputTag("csc2DRecHits"));
0024   desc.add<edm::InputTag>("MuonLabel", edm::InputTag("muons"));
0025   desc.add<edm::InputTag>("CSCHaloDataLabel", edm::InputTag("CSCHaloData"));
0026   desc.add<edm::InputTag>("EcalHaloDataLabel", edm::InputTag("EcalHaloData"));
0027   desc.add<edm::InputTag>("HcalHaloDataLabel", edm::InputTag("HcalHaloData"));
0028   desc.add<double>("EcalMinMatchingRadiusParam", 110.);
0029   desc.add<double>("EcalMaxMatchingRadiusParam", 330.);
0030   desc.add<double>("HcalMinMatchingRadiusParam", 110.);
0031   desc.add<double>("HcalMaxMatchingRadiusParam", 490.);
0032   desc.add<double>("CaloTowerEtThresholdParam", 0.3);
0033 
0034   // Parameters for CSC-calo matching
0035   desc.add<double>("MaxSegmentTheta", 0.7);
0036   desc.add<double>("rh_et_threshforcscmatching_eb", 10.);
0037   desc.add<double>("rcalominrsegm_lowthresh_eb", -30.);
0038   desc.add<double>("rcalominrsegm_highthresh_eb", 15.);
0039   desc.add<double>("dtcalosegm_thresh_eb", 15.);
0040   desc.add<double>("dphicalosegm_thresh_eb", 0.04);
0041   desc.add<double>("rh_et_threshforcscmatching_ee", 10.);
0042   desc.add<double>("rcalominrsegm_lowthresh_ee", -30.);
0043   desc.add<double>("rcalominrsegm_highthresh_ee", 30.);
0044   desc.add<double>("dtcalosegm_thresh_ee", 15.);
0045   desc.add<double>("dphicalosegm_thresh_ee", 0.04);
0046   desc.add<double>("rh_et_threshforcscmatching_hb", 20.);
0047   desc.add<double>("rcalominrsegm_lowthresh_hb", -100.);
0048   desc.add<double>("rcalominrsegm_highthresh_hb", 20.);
0049   desc.add<double>("dtcalosegm_thresh_hb", 15.);
0050   desc.add<double>("dphicalosegm_thresh_hb", 0.15);
0051   desc.add<double>("rh_et_threshforcscmatching_he", 20.);
0052   desc.add<double>("rcalominrsegm_lowthresh_he", -30.);
0053   desc.add<double>("rcalominrsegm_highthresh_he", 30.);
0054   desc.add<double>("dtcalosegm_thresh_he", 15.);
0055   desc.add<double>("dphicalosegm_thresh_he", 0.1);
0056   descriptions.addWithDefaultLabel(desc);
0057 }
0058 
0059 GlobalHaloDataProducer::GlobalHaloDataProducer(const edm::ParameterSet& iConfig) {
0060   ishlt = iConfig.getParameter<bool>("IsHLT");
0061 
0062   //Higher Level Reco
0063   IT_met = iConfig.getParameter<edm::InputTag>("metLabel");
0064   IT_CaloTower = iConfig.getParameter<edm::InputTag>("calotowerLabel");
0065   IT_CSCSegment = iConfig.getParameter<edm::InputTag>("CSCSegmentLabel");
0066   IT_CSCRecHit = iConfig.getParameter<edm::InputTag>("CSCRecHitLabel");
0067   IT_Muon = iConfig.getParameter<edm::InputTag>("MuonLabel");
0068   //Halo Data from Sub-detectors
0069   IT_CSCHaloData = iConfig.getParameter<edm::InputTag>("CSCHaloDataLabel");
0070   IT_EcalHaloData = iConfig.getParameter<edm::InputTag>("EcalHaloDataLabel");
0071   IT_HcalHaloData = iConfig.getParameter<edm::InputTag>("HcalHaloDataLabel");
0072 
0073   EcalMinMatchingRadius = (float)iConfig.getParameter<double>("EcalMinMatchingRadiusParam");
0074   EcalMaxMatchingRadius = (float)iConfig.getParameter<double>("EcalMaxMatchingRadiusParam");
0075   HcalMinMatchingRadius = (float)iConfig.getParameter<double>("HcalMinMatchingRadiusParam");
0076   HcalMaxMatchingRadius = (float)iConfig.getParameter<double>("HcalMaxMatchingRadiusParam");
0077   CaloTowerEtThreshold = (float)iConfig.getParameter<double>("CaloTowerEtThresholdParam");
0078 
0079   //Parameters for CSC-calo matching
0080   //Flat segment theta condition:
0081   GlobalAlgo.SetMaxSegmentTheta((float)iConfig.getParameter<double>("MaxSegmentTheta"));
0082   //EB
0083   GlobalAlgo.setEtThresholdforCSCCaloMatchingEB((float)iConfig.getParameter<double>("rh_et_threshforcscmatching_eb"));
0084   GlobalAlgo.setRcaloMinRsegmLowThresholdforCSCCaloMatchingEB(
0085       (float)iConfig.getParameter<double>("rcalominrsegm_lowthresh_eb"));
0086   GlobalAlgo.setRcaloMinRsegmHighThresholdforCSCCaloMatchingEB(
0087       (float)iConfig.getParameter<double>("rcalominrsegm_highthresh_eb"));
0088   GlobalAlgo.setDtcalosegmThresholdforCSCCaloMatchingEB((float)iConfig.getParameter<double>("dtcalosegm_thresh_eb"));
0089   GlobalAlgo.setDPhicalosegmThresholdforCSCCaloMatchingEB(
0090       (float)iConfig.getParameter<double>("dphicalosegm_thresh_eb"));
0091   //EE
0092   GlobalAlgo.setEtThresholdforCSCCaloMatchingEE((float)iConfig.getParameter<double>("rh_et_threshforcscmatching_ee"));
0093   GlobalAlgo.setRcaloMinRsegmLowThresholdforCSCCaloMatchingEE(
0094       (float)iConfig.getParameter<double>("rcalominrsegm_lowthresh_ee"));
0095   GlobalAlgo.setRcaloMinRsegmHighThresholdforCSCCaloMatchingEE(
0096       (float)iConfig.getParameter<double>("rcalominrsegm_highthresh_ee"));
0097   GlobalAlgo.setDtcalosegmThresholdforCSCCaloMatchingEE((float)iConfig.getParameter<double>("dtcalosegm_thresh_ee"));
0098   GlobalAlgo.setDPhicalosegmThresholdforCSCCaloMatchingEE(
0099       (float)iConfig.getParameter<double>("dphicalosegm_thresh_ee"));
0100   //HB
0101   GlobalAlgo.setEtThresholdforCSCCaloMatchingHB((float)iConfig.getParameter<double>("rh_et_threshforcscmatching_hb"));
0102   GlobalAlgo.setRcaloMinRsegmLowThresholdforCSCCaloMatchingHB(
0103       (float)iConfig.getParameter<double>("rcalominrsegm_lowthresh_hb"));
0104   GlobalAlgo.setRcaloMinRsegmHighThresholdforCSCCaloMatchingHB(
0105       (float)iConfig.getParameter<double>("rcalominrsegm_highthresh_hb"));
0106   GlobalAlgo.setDtcalosegmThresholdforCSCCaloMatchingHB((float)iConfig.getParameter<double>("dtcalosegm_thresh_hb"));
0107   GlobalAlgo.setDPhicalosegmThresholdforCSCCaloMatchingHB(
0108       (float)iConfig.getParameter<double>("dphicalosegm_thresh_hb"));
0109   //HE
0110   GlobalAlgo.setEtThresholdforCSCCaloMatchingHE((float)iConfig.getParameter<double>("rh_et_threshforcscmatching_he"));
0111   GlobalAlgo.setRcaloMinRsegmLowThresholdforCSCCaloMatchingHE(
0112       (float)iConfig.getParameter<double>("rcalominrsegm_lowthresh_he"));
0113   GlobalAlgo.setRcaloMinRsegmHighThresholdforCSCCaloMatchingHE(
0114       (float)iConfig.getParameter<double>("rcalominrsegm_highthresh_he"));
0115   GlobalAlgo.setDtcalosegmThresholdforCSCCaloMatchingHE((float)iConfig.getParameter<double>("dtcalosegm_thresh_he"));
0116   GlobalAlgo.setDPhicalosegmThresholdforCSCCaloMatchingHE(
0117       (float)iConfig.getParameter<double>("dphicalosegm_thresh_he"));
0118 
0119   calotower_token_ = consumes<edm::View<Candidate> >(IT_CaloTower);
0120   calomet_token_ = consumes<reco::CaloMETCollection>(IT_met);
0121   cscsegment_token_ = consumes<CSCSegmentCollection>(IT_CSCSegment);
0122   cscrechit_token_ = consumes<CSCRecHit2DCollection>(IT_CSCRecHit);
0123   muon_token_ = consumes<reco::MuonCollection>(IT_Muon);
0124   cschalo_token_ = consumes<CSCHaloData>(IT_CSCHaloData);
0125   ecalhalo_token_ = consumes<EcalHaloData>(IT_EcalHaloData);
0126   hcalhalo_token_ = consumes<HcalHaloData>(IT_HcalHaloData);
0127   cscgeometry_token_ = esConsumes<CSCGeometry, MuonGeometryRecord>();
0128   globaltrackinggeometry_token_ = esConsumes<GlobalTrackingGeometry, GlobalTrackingGeometryRecord>();
0129   calogeometry_token_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
0130 
0131   produces<GlobalHaloData>();
0132 }
0133 
0134 void GlobalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup) {
0135   //Get CSC Geometry
0136   edm::ESHandle<CSCGeometry> TheCSCGeometry = iSetup.getHandle(cscgeometry_token_);
0137 
0138   //Get Global Tracking Geometry
0139   edm::ESHandle<GlobalTrackingGeometry> TheGlobalTrackingGeometry = iSetup.getHandle(globaltrackinggeometry_token_);
0140 
0141   //Get CaloGeometry
0142   edm::ESHandle<CaloGeometry> TheCaloGeometry = iSetup.getHandle(calogeometry_token_);
0143 
0144   //Get CaloTowers
0145   edm::Handle<edm::View<Candidate> > TheCaloTowers;
0146   //  iEvent.getByLabel(IT_CaloTower,TheCaloTowers);
0147   iEvent.getByToken(calotower_token_, TheCaloTowers);
0148 
0149   //Get MET
0150   edm::Handle<reco::CaloMETCollection> TheCaloMET;
0151   //  iEvent.getByLabel(IT_met, TheCaloMET);
0152   iEvent.getByToken(calomet_token_, TheCaloMET);
0153 
0154   //Get CSCSegments
0155   edm::Handle<CSCSegmentCollection> TheCSCSegments;
0156   //  iEvent.getByLabel(IT_CSCSegment, TheCSCSegments);
0157   iEvent.getByToken(cscsegment_token_, TheCSCSegments);
0158 
0159   //Get CSCRecHits
0160   edm::Handle<CSCRecHit2DCollection> TheCSCRecHits;
0161   //  iEvent.getByLabel(IT_CSCRecHit, TheCSCRecHits );
0162   iEvent.getByToken(cscrechit_token_, TheCSCRecHits);
0163 
0164   //Collision Muon Collection
0165   edm::Handle<reco::MuonCollection> TheMuons;
0166   iEvent.getByToken(muon_token_, TheMuons);
0167 
0168   //Get CSCHaloData
0169   edm::Handle<reco::CSCHaloData> TheCSCHaloData;
0170   //  iEvent.getByLabel(IT_CSCHaloData, TheCSCHaloData );
0171   iEvent.getByToken(cschalo_token_, TheCSCHaloData);
0172 
0173   // Get EcalHaloData
0174   edm::Handle<reco::EcalHaloData> TheEcalHaloData;
0175   //  iEvent.getByLabel(IT_EcalHaloData, TheEcalHaloData );
0176   iEvent.getByToken(ecalhalo_token_, TheEcalHaloData);
0177 
0178   // Get HcalHaloData
0179   edm::Handle<reco::HcalHaloData> TheHcalHaloData;
0180   //  iEvent.getByLabel(IT_HcalHaloData, TheHcalHaloData );
0181   iEvent.getByToken(hcalhalo_token_, TheHcalHaloData);
0182 
0183   // Run the GlobalHaloAlgo to reconstruct the GlobalHaloData object
0184   GlobalAlgo.SetEcalMatchingRadius(EcalMinMatchingRadius, EcalMaxMatchingRadius);
0185   GlobalAlgo.SetHcalMatchingRadius(HcalMinMatchingRadius, HcalMaxMatchingRadius);
0186   GlobalAlgo.SetCaloTowerEtThreshold(CaloTowerEtThreshold);
0187   //  GlobalHaloData GlobalData;
0188 
0189   if (TheCaloGeometry.isValid() && TheCaloMET.isValid() && TheCaloTowers.isValid() && TheCSCHaloData.isValid() &&
0190       TheEcalHaloData.isValid() && TheHcalHaloData.isValid()) {
0191     iEvent.put(std::make_unique<GlobalHaloData>(GlobalHaloData(GlobalAlgo.Calculate(*TheCaloGeometry,
0192                                                                                     *TheCSCGeometry,
0193                                                                                     *(&TheCaloMET.product()->front()),
0194                                                                                     TheCaloTowers,
0195                                                                                     TheCSCSegments,
0196                                                                                     TheCSCRecHits,
0197                                                                                     TheMuons,
0198                                                                                     *TheCSCHaloData.product(),
0199                                                                                     *TheEcalHaloData.product(),
0200                                                                                     *TheHcalHaloData.product(),
0201                                                                                     ishlt))));
0202   } else {
0203     iEvent.put(std::make_unique<GlobalHaloData>());
0204   }
0205 
0206   return;
0207 }
0208 
0209 GlobalHaloDataProducer::~GlobalHaloDataProducer() {}