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
0006
0007
0008
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
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
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
0036
0037 GlobalAlgo.SetMaxSegmentTheta((float)iConfig.getParameter<double>("MaxSegmentTheta"));
0038
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
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
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
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
0092 edm::ESHandle<CSCGeometry> TheCSCGeometry = iSetup.getHandle(cscgeometry_token_);
0093
0094
0095 edm::ESHandle<GlobalTrackingGeometry> TheGlobalTrackingGeometry = iSetup.getHandle(globaltrackinggeometry_token_);
0096
0097
0098 edm::ESHandle<CaloGeometry> TheCaloGeometry = iSetup.getHandle(calogeometry_token_);
0099
0100
0101 edm::Handle<edm::View<Candidate> > TheCaloTowers;
0102
0103 iEvent.getByToken(calotower_token_, TheCaloTowers);
0104
0105
0106 edm::Handle<reco::CaloMETCollection> TheCaloMET;
0107
0108 iEvent.getByToken(calomet_token_, TheCaloMET);
0109
0110
0111 edm::Handle<CSCSegmentCollection> TheCSCSegments;
0112
0113 iEvent.getByToken(cscsegment_token_, TheCSCSegments);
0114
0115
0116 edm::Handle<CSCRecHit2DCollection> TheCSCRecHits;
0117
0118 iEvent.getByToken(cscrechit_token_, TheCSCRecHits);
0119
0120
0121 edm::Handle<reco::MuonCollection> TheMuons;
0122 iEvent.getByToken(muon_token_, TheMuons);
0123
0124
0125 edm::Handle<reco::CSCHaloData> TheCSCHaloData;
0126
0127 iEvent.getByToken(cschalo_token_, TheCSCHaloData);
0128
0129
0130 edm::Handle<reco::EcalHaloData> TheEcalHaloData;
0131
0132 iEvent.getByToken(ecalhalo_token_, TheEcalHaloData);
0133
0134
0135 edm::Handle<reco::HcalHaloData> TheHcalHaloData;
0136
0137 iEvent.getByToken(hcalhalo_token_, TheHcalHaloData);
0138
0139
0140 GlobalAlgo.SetEcalMatchingRadius(EcalMinMatchingRadius, EcalMaxMatchingRadius);
0141 GlobalAlgo.SetHcalMatchingRadius(HcalMinMatchingRadius, HcalMaxMatchingRadius);
0142 GlobalAlgo.SetCaloTowerEtThreshold(CaloTowerEtThreshold);
0143
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() {}