#include <TopElectronHLTOfflineSource.h>
Definition at line 26 of file TopElectronHLTOfflineSource.h.
TopElectronHLTOfflineSource::TopElectronHLTOfflineSource | ( | const edm::ParameterSet & | conf | ) |
Definition at line 25 of file TopElectronHLTOfflineSource.cc.
References addExtraId_, dbe_, dirName_, electronIdNames_, electronLabel_, electronMaxEta_, electronMinEt_, electronTriggerNames_, excludeCloseJets_, extraIdCutsDzPV_, extraIdCutsSigmaEta_, extraIdCutsSigmaPhi_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hltTag_, cmsCodeRules::cppFunctionSkipper::operator, primaryVertexLabel_, requireTriggerMatch_, DQMStore::setVerbose(), superTriggerNames_, triggerElectronFilterLabel_, triggerJetFilterLabel_, triggerResultsLabel_, and triggerSummaryLabel_.
{ dbe_ = edm::Service<DQMStore>().operator->(); if (!dbe_) { edm::LogInfo("TopElectronHLTOfflineSource") << "unable to get DQMStore service?"; } if(conf.getUntrackedParameter<bool>("DQMStore", false)) { if(!dbe_) dbe_->setVerbose(0); } dirName_ = conf.getParameter<std::string>("DQMDirName"); electronIdNames_ = conf.getParameter<std::vector<std::string> >("electronIdNames"); hltTag_ = conf.getParameter<std::string>("hltTag"); superTriggerNames_ = conf.getParameter<std::vector<std::string> >("superTriggerNames"); electronTriggerNames_ = conf.getParameter<std::vector<std::string> >("electronTriggerNames"); triggerResultsLabel_ = conf.getParameter<edm::InputTag>("triggerResultsLabel"); triggerSummaryLabel_ = conf.getParameter<edm::InputTag>("triggerSummaryLabel"); electronLabel_ = conf.getParameter<edm::InputTag>("electronCollection"); primaryVertexLabel_ = conf.getParameter<edm::InputTag>("primaryVertexCollection"); triggerJetFilterLabel_ = conf.getParameter<edm::InputTag>("triggerJetFilterLabel"); triggerElectronFilterLabel_ = conf.getParameter<edm::InputTag>("triggerElectronFilterLabel"); excludeCloseJets_ = conf.getParameter<bool>("excludeCloseJets"); requireTriggerMatch_ = conf.getParameter<bool>("requireTriggerMatch"); electronMinEt_ = conf.getParameter<double>("electronMinEt"); electronMaxEta_ = conf.getParameter<double>("electronMaxEta"); addExtraId_ = conf.getParameter<bool>("addExtraId"); extraIdCutsSigmaEta_ = conf.getParameter<double>("extraIdCutsSigmaEta"); extraIdCutsSigmaPhi_ = conf.getParameter<double>("extraIdCutsSigmaPhi"); extraIdCutsDzPV_ = conf.getParameter<double>("extraIdCutsDzPV"); }
TopElectronHLTOfflineSource::~TopElectronHLTOfflineSource | ( | ) | [virtual] |
Definition at line 64 of file TopElectronHLTOfflineSource.cc.
{ }
void TopElectronHLTOfflineSource::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 102 of file TopElectronHLTOfflineSource.cc.
References abs, accept(), dbe_, electronLabel_, electronMaxEta_, electronMinEt_, electronTriggerNames_, eleHandle_, eleMEs_, reco::LeafCandidate::et(), reco::LeafCandidate::eta(), fill(), edm::Event::getByLabel(), edm::Event::getByType(), hltConfig_, hltConfigValid_, JetPDSkim_cfg::hltResults, i, getHLTprescales::index, j, reco::Vertex::position(), primaryVertexLabel_, edm::Handle< T >::product(), findQualityFiles::size, superTriggerNames_, triggerElectronFilterLabel_, triggerEvent_, HLTConfigProvider::triggerIndex(), triggerJetFilterLabel_, triggerResultsLabel_, and triggerSummaryLabel_.
{ if(!dbe_) return; // ---- Get Trigger Decisions for all triggers under investigation ---- edm::Handle<edm::TriggerResults> hltResults; if(!iEvent.getByLabel(triggerResultsLabel_, hltResults) || !hltResults.product()) return; //bail if we didnt get trigger results if (!hltConfigValid_) return; std::vector<bool> superTriggerAccepts; std::vector<bool> electronTriggerAccepts; for (size_t i = 0; i < superTriggerNames_.size(); ++i) { unsigned int triggerIndex( hltConfig_.triggerIndex(superTriggerNames_[i]) ); bool accept = false; if (triggerIndex < hltResults->size()) { accept = hltResults->accept(triggerIndex); } superTriggerAccepts.push_back(accept); } for (size_t i = 0; i < electronTriggerNames_.size(); ++i) { unsigned int triggerIndex( hltConfig_.triggerIndex(electronTriggerNames_[i]) ); bool accept = false; if (triggerIndex < hltResults->size()) { accept = hltResults->accept(triggerIndex); } electronTriggerAccepts.push_back(accept); } // get reconstructed electron collection if(!iEvent.getByLabel(electronLabel_, eleHandle_) || !eleHandle_.product()) return; // Get Trigger Event, providing the information about trigger objects if(!iEvent.getByLabel(triggerSummaryLabel_, triggerEvent_) || !triggerEvent_.product()) return; edm::Handle<reco::VertexCollection> vertexHandle; if(!iEvent.getByLabel(primaryVertexLabel_, vertexHandle) || !vertexHandle.product()) return; reco::Vertex::Point vertexPoint(0., 0., 0.); if (vertexHandle.product()->size() != 0) { const reco::Vertex& theVertex = vertexHandle.product()->front(); vertexPoint = theVertex.position(); } else { edm::Handle<reco::BeamSpot> recoBeamSpotHandle; if(!iEvent.getByType(recoBeamSpotHandle) || !recoBeamSpotHandle.product()) return; vertexPoint = recoBeamSpotHandle->position(); } trigger::size_type jetFilterPos = triggerEvent_->filterIndex(triggerJetFilterLabel_); std::vector<const trigger::TriggerObject*> triggerJets; if (jetFilterPos != triggerEvent_->sizeFilters()) { for (size_t i = 0; i < triggerEvent_->filterKeys(jetFilterPos).size(); ++i) { size_t objNr = triggerEvent_->filterKeys(jetFilterPos)[i]; if(objNr<triggerEvent_->sizeObjects()){ triggerJets.push_back(& triggerEvent_->getObjects()[objNr]); } } } trigger::size_type eleFilterPos = triggerEvent_->filterIndex(triggerElectronFilterLabel_); std::vector<const trigger::TriggerObject*> triggerElectrons; if (eleFilterPos != triggerEvent_->sizeFilters()) { for (size_t i = 0; i < triggerEvent_->filterKeys(eleFilterPos).size(); ++i) { size_t objNr = triggerEvent_->filterKeys(eleFilterPos)[i]; if(objNr<triggerEvent_->sizeObjects()){ triggerElectrons.push_back(& triggerEvent_->getObjects()[objNr]); } } } const reco::GsfElectronCollection& eles = *eleHandle_; for(size_t eleNr=0; eleNr < eles.size(); ++eleNr) { const reco::GsfElectron& ele = eles[eleNr]; // electron selection if(ele.et() > electronMinEt_ && std::abs(ele.eta()) < electronMaxEta_) { size_t index = 0; for (size_t i = 0; i < superTriggerNames_.size(); ++i) { if (superTriggerAccepts[i]) fill(eleMEs_[index], iEvent, eleNr, triggerJets, triggerElectrons, vertexPoint); index++; for (size_t j = 0; j < electronTriggerNames_.size(); ++j) { if (superTriggerAccepts[i] && electronTriggerAccepts[j]) fill(eleMEs_[index], iEvent, eleNr, triggerJets, triggerElectrons, vertexPoint); index++; } } } } }
void TopElectronHLTOfflineSource::beginJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 68 of file TopElectronHLTOfflineSource.cc.
References addExtraId_, dbe_, dirName_, electronIdNames_, electronTriggerNames_, eleMEs_, i, j, DQMStore::setCurrentFolder(), and superTriggerNames_.
{ if(!dbe_) return; dbe_->setCurrentFolder(dirName_); for (size_t i = 0; i < superTriggerNames_.size(); ++i) { eleMEs_.push_back(EleMEs(dbe_, electronIdNames_, addExtraId_, superTriggerNames_[i])); for (size_t j = 0; j < electronTriggerNames_.size(); ++j) { eleMEs_.push_back(EleMEs(dbe_, electronIdNames_, addExtraId_, superTriggerNames_[i]+"_"+electronTriggerNames_[j])); //std::cout <<superTriggerNames_[i]+"_"+electronTriggerNames_[j]<<std::endl; } } //std::cout <<"done"<<std::endl; }
void TopElectronHLTOfflineSource::beginRun | ( | const edm::Run & | run, |
const edm::EventSetup & | c | ||
) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 94 of file TopElectronHLTOfflineSource.cc.
References hltConfig_, hltConfigChanged_, hltConfigValid_, hltTag_, and HLTConfigProvider::init().
{ hltConfigValid_=hltConfig_.init(run,c,hltTag_,hltConfigChanged_); }
void TopElectronHLTOfflineSource::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 91 of file TopElectronHLTOfflineSource.cc.
{ }
void TopElectronHLTOfflineSource::endRun | ( | const edm::Run & | run, |
const edm::EventSetup & | c | ||
) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 98 of file TopElectronHLTOfflineSource.cc.
{ }
void TopElectronHLTOfflineSource::fill | ( | EleMEs & | eleMEs, |
const edm::Event & | iEvent, | ||
size_t | eleIndex, | ||
const std::vector< const trigger::TriggerObject * > & | triggerJets, | ||
const std::vector< const trigger::TriggerObject * > & | triggerElectrons, | ||
const reco::Vertex::Point & | vertexPoint | ||
) |
Definition at line 266 of file TopElectronHLTOfflineSource.cc.
References abs, addExtraId_, deltaR(), eleHandle_, TopElectronHLTOfflineSource::EleMEs::eleIdNames(), TopElectronHLTOfflineSource::EleMEs::eleMENames(), trigger::TriggerObject::et(), excludeCloseJets_, extraIdCutsDzPV_, extraIdCutsSigmaEta_, extraIdCutsSigmaPhi_, TopElectronHLTOfflineSource::EleMEs::fill(), edm::Event::getByLabel(), TopElectronHLTOfflineSource::EleMEs::getMESet(), reco::GsfElectron::gsfTrack(), i, reco::GsfElectron::isEB(), reco::GsfElectron::isEE(), reco::GsfElectron::isGap(), j, metsig::jet, reco::GsfElectron::p4(), requireTriggerMatch_, and reco::Candidate::size.
Referenced by analyze().
{ const reco::GsfElectron& ele = (*eleHandle_)[eleIndex]; float dzPV = std::abs(ele.gsfTrack()->dz(vertexPoint)); bool isTriggerMatched = false; for (size_t i = 0; i < triggerElectrons.size(); ++i) { if (deltaR(*(triggerElectrons[i]), ele.p4()) < 0.3) isTriggerMatched = true; } if (requireTriggerMatch_ && !isTriggerMatched) return; // Calculate minimum deltaR to closest jet and sumEt (all jets) float minDeltaR = 999.; float sumEt = 0.; for (size_t jetNr = 0; jetNr < triggerJets.size(); ++jetNr) { const trigger::TriggerObject& jet = *triggerJets[jetNr]; sumEt += jet.et(); float dr = deltaR(jet, ele.p4()); if (!excludeCloseJets_ && dr < minDeltaR) minDeltaR = dr; if (excludeCloseJets_ && dr > 0.1 && dr < minDeltaR) minDeltaR = dr; } for (size_t j = 0; j < eleMEs.eleIdNames().size(); ++j) { bool eId = true; edm::Handle<edm::ValueMap<float> > eIdMapHandle; iEvent.getByLabel(eleMEs.eleIdNames()[j], eIdMapHandle); const edm::ValueMap<float>& eIdMap = *eIdMapHandle; eId = eIdMap[edm::Ref<reco::GsfElectronCollection>(eleHandle_, eleIndex)]; bool extraId = true; if (addExtraId_) { if (ele.gsfTrack()->etaError() > extraIdCutsSigmaEta_) extraId = false; if (ele.gsfTrack()->phiError() > extraIdCutsSigmaPhi_) extraId = false; if (dzPV > extraIdCutsDzPV_) extraId = false; } for (size_t i = 0; i < eleMEs.eleMENames().size(); ++i) { if (eId && eleMEs.eleMENames()[i] == "EB" && ele.isEB()&& !ele.isGap()) eleMEs.fill(eleMEs.getMESet(i, j), ele, minDeltaR, sumEt, triggerJets.size(), dzPV); if (eId && eleMEs.eleMENames()[i] == "EE" && ele.isEE()&& !ele.isGap()) eleMEs.fill(eleMEs.getMESet(i, j), ele, minDeltaR, sumEt, triggerJets.size(), dzPV); if (addExtraId_) { if (eId && extraId && eleMEs.eleMENames()[i] == "EB" && ele.isEB()&& !ele.isGap()) eleMEs.fill(eleMEs.getMESet(i, j+1), ele, minDeltaR, sumEt, triggerJets.size(), dzPV); if (eId && extraId && eleMEs.eleMENames()[i] == "EE" && ele.isEE()&& !ele.isGap()) eleMEs.fill(eleMEs.getMESet(i, j+1), ele, minDeltaR, sumEt, triggerJets.size(), dzPV); } } if (addExtraId_) ++j; } }
void TopElectronHLTOfflineSource::setupHistos | ( | const std::vector< EleMEs > | topEleHists | ) | [virtual] |
bool TopElectronHLTOfflineSource::addExtraId_ [private] |
Definition at line 171 of file TopElectronHLTOfflineSource.h.
Referenced by beginJob(), fill(), and TopElectronHLTOfflineSource().
DQMStore* TopElectronHLTOfflineSource::dbe_ [private] |
Definition at line 138 of file TopElectronHLTOfflineSource.h.
Referenced by analyze(), beginJob(), and TopElectronHLTOfflineSource().
std::string TopElectronHLTOfflineSource::dirName_ [private] |
Definition at line 140 of file TopElectronHLTOfflineSource.h.
Referenced by beginJob(), and TopElectronHLTOfflineSource().
std::vector<std::string> TopElectronHLTOfflineSource::electronIdNames_ [private] |
Definition at line 144 of file TopElectronHLTOfflineSource.h.
Referenced by beginJob(), and TopElectronHLTOfflineSource().
Definition at line 155 of file TopElectronHLTOfflineSource.h.
Referenced by analyze(), and TopElectronHLTOfflineSource().
double TopElectronHLTOfflineSource::electronMaxEta_ [private] |
Definition at line 168 of file TopElectronHLTOfflineSource.h.
Referenced by analyze(), and TopElectronHLTOfflineSource().
double TopElectronHLTOfflineSource::electronMinEt_ [private] |
Definition at line 167 of file TopElectronHLTOfflineSource.h.
Referenced by analyze(), and TopElectronHLTOfflineSource().
std::vector<std::string> TopElectronHLTOfflineSource::electronTriggerNames_ [private] |
Definition at line 148 of file TopElectronHLTOfflineSource.h.
Referenced by analyze(), beginJob(), and TopElectronHLTOfflineSource().
Definition at line 160 of file TopElectronHLTOfflineSource.h.
std::vector<EleMEs> TopElectronHLTOfflineSource::eleMEs_ [private] |
Definition at line 142 of file TopElectronHLTOfflineSource.h.
Referenced by analyze(), beginJob(), and setupHistos().
bool TopElectronHLTOfflineSource::excludeCloseJets_ [private] |
Definition at line 163 of file TopElectronHLTOfflineSource.h.
Referenced by fill(), and TopElectronHLTOfflineSource().
double TopElectronHLTOfflineSource::extraIdCutsDzPV_ [private] |
Definition at line 176 of file TopElectronHLTOfflineSource.h.
Referenced by fill(), and TopElectronHLTOfflineSource().
double TopElectronHLTOfflineSource::extraIdCutsSigmaEta_ [private] |
Definition at line 174 of file TopElectronHLTOfflineSource.h.
Referenced by fill(), and TopElectronHLTOfflineSource().
double TopElectronHLTOfflineSource::extraIdCutsSigmaPhi_ [private] |
Definition at line 175 of file TopElectronHLTOfflineSource.h.
Referenced by fill(), and TopElectronHLTOfflineSource().
Definition at line 180 of file TopElectronHLTOfflineSource.h.
Referenced by analyze(), and beginRun().
bool TopElectronHLTOfflineSource::hltConfigChanged_ [private] |
Definition at line 178 of file TopElectronHLTOfflineSource.h.
Referenced by beginRun().
bool TopElectronHLTOfflineSource::hltConfigValid_ [private] |
Definition at line 179 of file TopElectronHLTOfflineSource.h.
Referenced by analyze(), and beginRun().
std::string TopElectronHLTOfflineSource::hltTag_ [private] |
Definition at line 145 of file TopElectronHLTOfflineSource.h.
Referenced by beginRun(), and TopElectronHLTOfflineSource().
Definition at line 156 of file TopElectronHLTOfflineSource.h.
Referenced by analyze(), and TopElectronHLTOfflineSource().
bool TopElectronHLTOfflineSource::requireTriggerMatch_ [private] |
Definition at line 165 of file TopElectronHLTOfflineSource.h.
Referenced by fill(), and TopElectronHLTOfflineSource().
std::vector<std::string> TopElectronHLTOfflineSource::superTriggerNames_ [private] |
Definition at line 147 of file TopElectronHLTOfflineSource.h.
Referenced by analyze(), beginJob(), and TopElectronHLTOfflineSource().
Definition at line 154 of file TopElectronHLTOfflineSource.h.
Referenced by analyze(), and TopElectronHLTOfflineSource().
Definition at line 158 of file TopElectronHLTOfflineSource.h.
Referenced by analyze().
Definition at line 153 of file TopElectronHLTOfflineSource.h.
Referenced by analyze(), and TopElectronHLTOfflineSource().
Definition at line 152 of file TopElectronHLTOfflineSource.h.
Definition at line 151 of file TopElectronHLTOfflineSource.h.
Referenced by analyze(), and TopElectronHLTOfflineSource().
Definition at line 150 of file TopElectronHLTOfflineSource.h.
Referenced by analyze(), and TopElectronHLTOfflineSource().