Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add consumes interface to METProducers #2960

Merged
merged 1 commit into from Mar 29, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions RecoMET/METProducers/interface/BeamHaloSummaryProducer.h
Expand Up @@ -24,6 +24,7 @@
#include <cstdlib>

// user include files
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
Expand Down Expand Up @@ -69,6 +70,11 @@ namespace reco
edm::InputTag IT_HcalHaloData;
edm::InputTag IT_GlobalHaloData;

edm::EDGetTokenT<CSCHaloData> cschalodata_token_;
edm::EDGetTokenT<EcalHaloData> ecalhalodata_token_;
edm::EDGetTokenT<HcalHaloData> hcalhalodata_token_;
edm::EDGetTokenT<GlobalHaloData> globalhalodata_token_;

float L_EcalPhiWedgeEnergy;
int L_EcalPhiWedgeConstituents;
float L_EcalPhiWedgeToF;
Expand Down
11 changes: 10 additions & 1 deletion RecoMET/METProducers/interface/CSCHaloDataProducer.h
Expand Up @@ -24,6 +24,7 @@
#include <cstdlib>

// user include files
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
Expand Down Expand Up @@ -163,7 +164,15 @@ class CSCHaloDataProducer : public edm::EDProducer {
edm::InputTag IT_Muon;
edm::InputTag IT_SA;


// TOKENS
edm::EDGetTokenT<reco::MuonCollection> cosmicmuon_token_;
edm::EDGetTokenT<reco::MuonTimeExtraMap> csctimemap_token_;
edm::EDGetTokenT<reco::MuonCollection> muon_token_;
edm::EDGetTokenT<CSCSegmentCollection> cscsegment_token_;
edm::EDGetTokenT<CSCRecHit2DCollection> cscrechit_token_;
edm::EDGetTokenT<CSCALCTDigiCollection> cscalct_token_;
edm::EDGetTokenT<L1MuGMTReadoutCollection> l1mugmtro_token_;
edm::EDGetTokenT<edm::TriggerResults> hltresult_token_;
};
}

Expand Down
7 changes: 7 additions & 0 deletions RecoMET/METProducers/interface/EcalHaloDataProducer.h
Expand Up @@ -24,6 +24,7 @@
#include <cstdlib>

// user include files
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
Expand Down Expand Up @@ -108,6 +109,12 @@ namespace reco
//Higher Level Reco
edm::InputTag IT_SuperCluster;
edm::InputTag IT_Photon;

edm::EDGetTokenT<EBRecHitCollection> ebrechit_token_;
edm::EDGetTokenT<EERecHitCollection> eerechit_token_;
edm::EDGetTokenT<ESRecHitCollection> esrechit_token_;
edm::EDGetTokenT<reco::SuperClusterCollection> supercluster_token_;
edm::EDGetTokenT<reco::PhotonCollection> photon_token_;

float EBRecHitEnergyThreshold;
float EERecHitEnergyThreshold;
Expand Down
9 changes: 9 additions & 0 deletions RecoMET/METProducers/interface/GlobalHaloDataProducer.h
Expand Up @@ -24,6 +24,7 @@
#include <cstdlib>

// user include files
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
Expand Down Expand Up @@ -197,6 +198,14 @@ namespace reco
edm::InputTag IT_EcalHaloData;
edm::InputTag IT_HcalHaloData;

edm::EDGetTokenT<edm::View<reco::Candidate> > calotower_token_;
edm::EDGetTokenT<reco::CaloMETCollection> calomet_token_;
edm::EDGetTokenT<CSCSegmentCollection> cscsegment_token_;
edm::EDGetTokenT<CSCRecHit2DCollection> cscrechit_token_;
edm::EDGetTokenT<CSCHaloData> cschalo_token_;
edm::EDGetTokenT<EcalHaloData> ecalhalo_token_;
edm::EDGetTokenT<HcalHaloData> hcalhalo_token_;

float EcalMinMatchingRadius;
float EcalMaxMatchingRadius;
float HcalMinMatchingRadius;
Expand Down
4 changes: 4 additions & 0 deletions RecoMET/METProducers/interface/HcalHaloDataProducer.h
Expand Up @@ -24,6 +24,7 @@
#include <cstdlib>

// user include files
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
Expand Down Expand Up @@ -97,6 +98,9 @@ namespace reco
edm::InputTag IT_HORecHit;
edm::InputTag IT_HFRecHit;

edm::EDGetTokenT<HBHERecHitCollection> hbherechit_token_;
edm::EDGetTokenT<HFRecHitCollection> hfrechit_token_;

float HBRecHitEnergyThreshold;
float HERecHitEnergyThreshold;
float SumHcalEnergyThreshold;
Expand Down
13 changes: 13 additions & 0 deletions RecoMET/METProducers/interface/HcalNoiseInfoProducer.h
Expand Up @@ -18,6 +18,7 @@
#include <memory>

// user include files
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
Expand All @@ -28,6 +29,12 @@
#include "RecoMET/METAlgorithms/interface/HcalNoiseRBXArray.h"
#include "DataFormats/METReco/interface/HcalNoiseSummary.h"

#include "RecoMET/METProducers/interface/HcalNoiseInfoProducer.h"
#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/TrackReco/interface/Track.h"

namespace reco {

Expand Down Expand Up @@ -86,6 +93,12 @@ namespace reco {
std::string caloTowerCollName_; // name of the caloTower collection
std::string trackCollName_; // name of the track collection

edm::EDGetTokenT<HBHEDigiCollection> hbhedigi_token_;
edm::EDGetTokenT<HcalCalibDigiCollection> hcalcalibdigi_token_;
edm::EDGetTokenT<HBHERecHitCollection> hbherechit_token_;
edm::EDGetTokenT<CaloTowerCollection> calotower_token_;
edm::EDGetTokenT<reco::TrackCollection> track_token_;

double TotalCalibCharge; // placeholder to calculate total charge in calibration channels

double minRecHitE_, minLowHitE_, minHighHitE_; // parameters used to determine noise status
Expand Down
28 changes: 20 additions & 8 deletions RecoMET/METProducers/interface/MinMETProducerT.h
Expand Up @@ -20,6 +20,7 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"

#include <vector>

Expand All @@ -30,11 +31,14 @@ class MinMETProducerT : public edm::EDProducer

public:

explicit MinMETProducerT(const edm::ParameterSet& cfg)
: moduleLabel_(cfg.getParameter<std::string>("@module_label"))
explicit MinMETProducerT(const edm::ParameterSet& cfg) : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
{
src_ = cfg.getParameter<vInputTag>("src");

for ( vInputTag::const_iterator src_i = src_.begin();
src_i != src_.end(); ++src_i ) {
src_token_.push_back( consumes<METCollection>(*src_i) );
}
produces<METCollection>();
}
~MinMETProducerT() {}
Expand All @@ -47,10 +51,13 @@ class MinMETProducerT : public edm::EDProducer

// check that all MET collections given as input have the same number of entries
int numMEtObjects = -1;
for ( vInputTag::const_iterator src_i = src_.begin();
src_i != src_.end(); ++src_i ) {
// for ( vInputTag::const_iterator src_i = src_.begin();
// src_i != src_.end(); ++src_i ) {
for ( typename vInputToken::const_iterator src_i = src_token_.begin();
src_i != src_token_.end(); ++src_i ) {
edm::Handle<METCollection> inputMETs;
evt.getByLabel(*src_i, inputMETs);
// evt.getByLabel(*src_i, inputMETs);
evt.getByToken(*src_i, inputMETs);
if ( numMEtObjects == -1 ) numMEtObjects = inputMETs->size();
else if ( numMEtObjects != (int)inputMETs->size() )
throw cms::Exception("MinMETProducer::produce")
Expand All @@ -59,10 +66,13 @@ class MinMETProducerT : public edm::EDProducer

for ( int iMEtObject = 0; iMEtObject < numMEtObjects; ++iMEtObject ) {
const T* minMET = 0;
for ( vInputTag::const_iterator src_i = src_.begin();
src_i != src_.end(); ++src_i ) {
// for ( vInputTag::const_iterator src_i = src_.begin();
// src_i != src_.end(); ++src_i ) {
for ( typename vInputToken::const_iterator src_i = src_token_.begin();
src_i != src_token_.end(); ++src_i ) {
edm::Handle<METCollection> inputMETs;
evt.getByLabel(*src_i, inputMETs);
// evt.getByLabel(*src_i, inputMETs);
evt.getByToken(*src_i, inputMETs);
const T& inputMET = inputMETs->at(iMEtObject);
if ( minMET == 0 || inputMET.pt() < minMET->pt() ) minMET = &inputMET;
}
Expand All @@ -77,6 +87,8 @@ class MinMETProducerT : public edm::EDProducer

typedef std::vector<edm::InputTag> vInputTag;
vInputTag src_;
typedef std::vector<edm::EDGetTokenT<METCollection> > vInputToken;
vInputToken src_token_;
};

#include "DataFormats/METReco/interface/CaloMET.h"
Expand Down
22 changes: 17 additions & 5 deletions RecoMET/METProducers/src/BeamHaloSummaryProducer.cc
@@ -1,4 +1,5 @@
#include "RecoMET/METProducers/interface/BeamHaloSummaryProducer.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"

/*
[class]: BeamHaloSummaryProducer
Expand Down Expand Up @@ -46,6 +47,11 @@ BeamHaloSummaryProducer::BeamHaloSummaryProducer(const edm::ParameterSet& iConfi
T_HcalPhiWedgeToF = (float)iConfig.getParameter<double>("t_HcalPhiWedgeToF");
T_HcalPhiWedgeConfidence = (float)iConfig.getParameter<double>("t_HcalPhiWedgeConfidence");

cschalodata_token_ = consumes<CSCHaloData>(IT_CSCHaloData);
ecalhalodata_token_ = consumes<EcalHaloData>(IT_EcalHaloData);
hcalhalodata_token_ = consumes<HcalHaloData>(IT_HcalHaloData);
globalhalodata_token_ = consumes<GlobalHaloData>(IT_GlobalHaloData);

produces<BeamHaloSummary>();
}

Expand All @@ -56,7 +62,8 @@ void BeamHaloSummaryProducer::produce(Event& iEvent, const EventSetup& iSetup)

// CSC Specific Halo Data
Handle<CSCHaloData> TheCSCHaloData;
iEvent.getByLabel(IT_CSCHaloData, TheCSCHaloData);
// iEvent.getByLabel(IT_CSCHaloData, TheCSCHaloData);
iEvent.getByToken(cschalodata_token_, TheCSCHaloData);

const CSCHaloData CSCData = (*TheCSCHaloData.product() );

Expand Down Expand Up @@ -90,8 +97,9 @@ void BeamHaloSummaryProducer::produce(Event& iEvent, const EventSetup& iSetup)

//Ecal Specific Halo Data
Handle<EcalHaloData> TheEcalHaloData;
iEvent.getByLabel(IT_EcalHaloData, TheEcalHaloData);

// iEvent.getByLabel(IT_EcalHaloData, TheEcalHaloData);
iEvent.getByToken(ecalhalodata_token_, TheEcalHaloData);

const EcalHaloData EcalData = (*TheEcalHaloData.product() );

bool EcalLooseId = false, EcalTightId = false;
Expand Down Expand Up @@ -162,7 +170,9 @@ void BeamHaloSummaryProducer::produce(Event& iEvent, const EventSetup& iSetup)

// Hcal Specific Halo Data
Handle<HcalHaloData> TheHcalHaloData;
iEvent.getByLabel(IT_HcalHaloData, TheHcalHaloData);
// iEvent.getByLabel(IT_HcalHaloData, TheHcalHaloData);
iEvent.getByToken(hcalhalodata_token_, TheHcalHaloData);

const HcalHaloData HcalData = (*TheHcalHaloData.product() );
const std::vector<PhiWedge> HcalWedges = HcalData.GetPhiWedges();
bool HcalLooseId = false, HcalTightId = false;
Expand Down Expand Up @@ -202,7 +212,9 @@ void BeamHaloSummaryProducer::produce(Event& iEvent, const EventSetup& iSetup)

// Global Halo Data
Handle<GlobalHaloData> TheGlobalHaloData;
iEvent.getByLabel(IT_GlobalHaloData, TheGlobalHaloData);
// iEvent.getByLabel(IT_GlobalHaloData, TheGlobalHaloData);
iEvent.getByToken(globalhalodata_token_, TheGlobalHaloData);

bool GlobalLooseId = false;
bool GlobalTightId = false;
const GlobalHaloData GlobalData = (*TheGlobalHaloData.product() );
Expand Down
36 changes: 27 additions & 9 deletions RecoMET/METProducers/src/CSCHaloDataProducer.cc
@@ -1,5 +1,6 @@
#include "RecoMET/METProducers/interface/CSCHaloDataProducer.h"
#include "FWCore/Common/interface/TriggerNames.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"

/*
[class]: CSCHaloDataProducer
Expand Down Expand Up @@ -61,6 +62,15 @@ CSCHaloDataProducer::CSCHaloDataProducer(const edm::ParameterSet& iConfig)
CSCAlgo.SetMatchingDEtaThreshold( (float)iConfig.getParameter<double>("MatchingDEtaThreshold") );
CSCAlgo.SetMatchingDWireThreshold(iConfig.getParameter<int>("MatchingDWireThreshold") );

cosmicmuon_token_ = consumes<reco::MuonCollection>(IT_CosmicMuon);
csctimemap_token_ = consumes<reco::MuonTimeExtraMap>(edm::InputTag(IT_CosmicMuon.label(), "csc"));
muon_token_ = consumes<reco::MuonCollection>(IT_Muon);
cscsegment_token_ = consumes<CSCSegmentCollection>(IT_CSCSegment);
cscrechit_token_ = consumes<CSCRecHit2DCollection>(IT_CSCRecHit);
cscalct_token_ = consumes<CSCALCTDigiCollection>(IT_ALCT);
l1mugmtro_token_ = consumes<L1MuGMTReadoutCollection>(IT_L1MuGMTReadout);
hltresult_token_ = consumes<edm::TriggerResults>(IT_HLTResult);

produces<CSCHaloData>();
}

Expand All @@ -72,35 +82,43 @@ void CSCHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup)

//Get Muons Collection from Cosmic Reconstruction
edm::Handle< reco::MuonCollection > TheCosmics;
iEvent.getByLabel(IT_CosmicMuon, TheCosmics);

// iEvent.getByLabel(IT_CosmicMuon, TheCosmics);
iEvent.getByToken(cosmicmuon_token_, TheCosmics);

//Get Muon Time Information from Cosmic Reconstruction
edm::Handle<reco::MuonTimeExtraMap> TheCSCTimeMap;
iEvent.getByLabel(IT_CosmicMuon.label(),"csc",TheCSCTimeMap);
// iEvent.getByLabel(IT_CosmicMuon.label(),"csc",TheCSCTimeMap);
iEvent.getByToken(csctimemap_token_, TheCSCTimeMap);

//Collision Muon Collection
edm::Handle< reco::MuonCollection> TheMuons;
iEvent.getByLabel(IT_Muon, TheMuons);
// iEvent.getByLabel(IT_Muon, TheMuons);
iEvent.getByToken(muon_token_, TheMuons);

//Get CSC Segments
edm::Handle<CSCSegmentCollection> TheCSCSegments;
iEvent.getByLabel(IT_CSCSegment, TheCSCSegments);
// iEvent.getByLabel(IT_CSCSegment, TheCSCSegments);
iEvent.getByToken(cscsegment_token_, TheCSCSegments);

//Get CSC RecHits
Handle<CSCRecHit2DCollection> TheCSCRecHits;
iEvent.getByLabel(IT_CSCRecHit, TheCSCRecHits);
// iEvent.getByLabel(IT_CSCRecHit, TheCSCRecHits);
iEvent.getByToken(cscrechit_token_, TheCSCRecHits);

//Get L1MuGMT
edm::Handle < L1MuGMTReadoutCollection > TheL1GMTReadout ;
iEvent.getByLabel (IT_L1MuGMTReadout, TheL1GMTReadout);
// iEvent.getByLabel (IT_L1MuGMTReadout, TheL1GMTReadout);
iEvent.getByToken(l1mugmtro_token_, TheL1GMTReadout);

//Get Chamber Anode Trigger Information
edm::Handle<CSCALCTDigiCollection> TheALCTs;
iEvent.getByLabel (IT_ALCT, TheALCTs);
// iEvent.getByLabel (IT_ALCT, TheALCTs);
iEvent.getByToken(cscalct_token_, TheALCTs);

//Get HLT Results
edm::Handle<edm::TriggerResults> TheHLTResults;
iEvent.getByLabel( IT_HLTResult , TheHLTResults);
// iEvent.getByLabel( IT_HLTResult , TheHLTResults);
iEvent.getByToken(hltresult_token_, TheHLTResults);

const edm::TriggerNames * triggerNames = 0;
if (TheHLTResults.isValid()) {
Expand Down
22 changes: 17 additions & 5 deletions RecoMET/METProducers/src/EcalHaloDataProducer.cc
@@ -1,4 +1,5 @@
#include "RecoMET/METProducers/interface/EcalHaloDataProducer.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"

/*
[class]: EcalHaloDataProducer
Expand Down Expand Up @@ -36,6 +37,12 @@ EcalHaloDataProducer::EcalHaloDataProducer(const edm::ParameterSet& iConfig)
RoundnessCut = iConfig.getParameter<double>("RoundnessCutParam");
AngleCut = iConfig.getParameter<double>("AngleCutParam");

ebrechit_token_ = consumes<EBRecHitCollection>(IT_EBRecHit);
eerechit_token_ = consumes<EERecHitCollection>(IT_EERecHit);
esrechit_token_ = consumes<ESRecHitCollection>(IT_ESRecHit);
supercluster_token_ = consumes<reco::SuperClusterCollection>(IT_SuperCluster);
photon_token_ = consumes<reco::PhotonCollection>(IT_Photon);

produces<EcalHaloData>();
}

Expand All @@ -47,23 +54,28 @@ void EcalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup)

//Get EB RecHits
edm::Handle<EBRecHitCollection> TheEBRecHits;
iEvent.getByLabel(IT_EBRecHit, TheEBRecHits);
// iEvent.getByLabel(IT_EBRecHit, TheEBRecHits);
iEvent.getByToken(ebrechit_token_, TheEBRecHits);

//Get EE RecHits
edm::Handle<EERecHitCollection> TheEERecHits;
iEvent.getByLabel(IT_EERecHit, TheEERecHits);
// iEvent.getByLabel(IT_EERecHit, TheEERecHits);
iEvent.getByToken(eerechit_token_, TheEERecHits);

//Get ES RecHits
edm::Handle<ESRecHitCollection> TheESRecHits;
iEvent.getByLabel(IT_ESRecHit, TheESRecHits);
// iEvent.getByLabel(IT_ESRecHit, TheESRecHits);
iEvent.getByToken(esrechit_token_, TheESRecHits);

//Get ECAL Barrel SuperClusters
edm::Handle<reco::SuperClusterCollection> TheSuperClusters;
iEvent.getByLabel(IT_SuperCluster, TheSuperClusters);
// iEvent.getByLabel(IT_SuperCluster, TheSuperClusters);
iEvent.getByToken(supercluster_token_, TheSuperClusters);

//Get Photons
edm::Handle<reco::PhotonCollection> ThePhotons;
iEvent.getByLabel(IT_Photon, ThePhotons);
// iEvent.getByLabel(IT_Photon, ThePhotons);
iEvent.getByToken(photon_token_, ThePhotons);

//Run the EcalHaloAlgo to reconstruct the EcalHaloData object
EcalHaloAlgo EcalAlgo;
Expand Down