-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved isolation prudcers that will run during RECO from EgammaAnalysi…
…s/EgammaIsolationProducers --- yaml --- svn_rev: 53413 current_ref: refs/heads/CMSSW_7_2_X current_commit: b9278cf head_branch: refs/heads/CMSSW_7_2_X migrated_from: v3
- Loading branch information
Matthias Ulrich Mozer
committed
Oct 15, 2008
1 parent
7c910ad
commit 4d8e15f
Showing
13 changed files
with
875 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/CMSSW_7_2_X: 9ee4ea890a4db58ba508f09381f883b5cef602f0 | ||
refs/heads/CMSSW_7_2_X: b9278cf6ca06275d9fe652a9cdf87460ad156162 |
149 changes: 149 additions & 0 deletions
149
trunk/RecoEgamma/EgammaIsolationAlgos/plugins/EgammaEcalRecHitIsolationProducer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
//***************************************************************************** | ||
// File: EgammaEcalRecHitIsolationProducer.cc | ||
// ---------------------------------------------------------------------------- | ||
// OrigAuth: Matthias Mozer | ||
// Institute: IIHE-VUB | ||
//============================================================================= | ||
//***************************************************************************** | ||
|
||
|
||
#include "RecoEgamma/EgammaIsolationAlgos/plugins/EgammaEcalRecHitIsolationProducer.h" | ||
|
||
// Framework | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "DataFormats/Common/interface/Handle.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
|
||
#include "DataFormats/Candidate/interface/Candidate.h" | ||
#include "DataFormats/Candidate/interface/CandAssociation.h" | ||
#include "DataFormats/RecoCandidate/interface/RecoCandidate.h" | ||
#include "DataFormats/EgammaReco/interface/SuperCluster.h" | ||
#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" | ||
|
||
#include "DataFormats/DetId/interface/DetId.h" | ||
#include "Geometry/CaloGeometry/interface/CaloGeometry.h" | ||
|
||
#include "Geometry/Records/interface/CaloGeometryRecord.h" | ||
|
||
EgammaEcalRecHitIsolationProducer::EgammaEcalRecHitIsolationProducer(const edm::ParameterSet& config) : conf_(config) | ||
{ | ||
// use configuration file to setup input/output collection names | ||
//inputs | ||
emObjectProducer_ = conf_.getParameter<edm::InputTag>("emObjectProducer"); | ||
ecalBarrelRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitProducer"); | ||
ecalBarrelRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitCollection"); | ||
ecalEndcapRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitProducer"); | ||
ecalEndcapRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitCollection"); | ||
|
||
//vetos | ||
egIsoPtMinBarrel_ = conf_.getParameter<double>("etMinBarrel"); | ||
egIsoEMinBarrel_ = conf_.getParameter<double>("eMinBarrel"); | ||
egIsoPtMinEndcap_ = conf_.getParameter<double>("etMinEndcap"); | ||
egIsoEMinEndcap_ = conf_.getParameter<double>("eMinEndcap"); | ||
egIsoConeSizeInBarrel_ = conf_.getParameter<double>("intRadiusBarrel"); | ||
egIsoConeSizeInEndcap_ = conf_.getParameter<double>("intRadiusEndcap"); | ||
egIsoConeSizeOut_ = conf_.getParameter<double>("extRadius"); | ||
egIsoJurassicWidth_ = conf_.getParameter<double>("jurassicWidth"); | ||
|
||
|
||
// options | ||
useIsolEt_ = conf_.getParameter<bool>("useIsolEt"); | ||
tryBoth_ = conf_.getParameter<bool>("tryBoth"); | ||
subtract_ = conf_.getParameter<bool>("subtract"); | ||
|
||
//register your products | ||
produces < edm::ValueMap<double> >(); | ||
} | ||
|
||
|
||
EgammaEcalRecHitIsolationProducer::~EgammaEcalRecHitIsolationProducer(){} | ||
|
||
|
||
// | ||
// member functions | ||
// | ||
|
||
// ------------ method called to produce the data ------------ | ||
void | ||
EgammaEcalRecHitIsolationProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) | ||
{ | ||
|
||
|
||
// Get the filtered objects | ||
edm::Handle< edm::View<reco::Candidate> > emObjectHandle; | ||
iEvent.getByLabel(emObjectProducer_,emObjectHandle); | ||
|
||
// Next get Ecal hits barrel | ||
edm::Handle<EcalRecHitCollection> ecalBarrelRecHitHandle; //EcalRecHitCollection is a typedef to | ||
iEvent.getByLabel(ecalBarrelRecHitProducer_.label(),ecalBarrelRecHitCollection_.label(), ecalBarrelRecHitHandle); | ||
|
||
// Next get Ecal hits endcap | ||
edm::Handle<EcalRecHitCollection> ecalEndcapRecHitHandle; | ||
iEvent.getByLabel(ecalEndcapRecHitProducer_.label(), ecalEndcapRecHitCollection_.label(),ecalEndcapRecHitHandle); | ||
|
||
//create the meta hit collections inorder that we can pass them into the isolation objects | ||
|
||
EcalRecHitMetaCollection ecalBarrelHits(*ecalBarrelRecHitHandle); | ||
EcalRecHitMetaCollection ecalEndcapHits(*ecalEndcapRecHitHandle); | ||
|
||
//Get Calo Geometry | ||
edm::ESHandle<CaloGeometry> pG; | ||
iSetup.get<CaloGeometryRecord>().get(pG); | ||
const CaloGeometry* caloGeom = pG.product(); | ||
|
||
//reco::CandViewDoubleAssociations* isoMap = new reco::CandViewDoubleAssociations( reco::CandidateBaseRefProd( emObjectHandle ) ); | ||
std::auto_ptr<edm::ValueMap<double> > isoMap(new edm::ValueMap<double>()); | ||
edm::ValueMap<double>::Filler filler(*isoMap); | ||
std::vector<double> retV(emObjectHandle->size(),0); | ||
|
||
|
||
EgammaRecHitIsolation ecalBarrelIsol(egIsoConeSizeOut_,egIsoConeSizeInBarrel_,egIsoJurassicWidth_,egIsoPtMinBarrel_,egIsoEMinBarrel_,caloGeom,&ecalBarrelHits,DetId::Ecal); | ||
EgammaRecHitIsolation ecalEndcapIsol(egIsoConeSizeOut_,egIsoConeSizeInEndcap_,egIsoJurassicWidth_,egIsoPtMinEndcap_,egIsoEMinEndcap_,caloGeom,&ecalEndcapHits,DetId::Ecal); | ||
|
||
|
||
for( size_t i = 0 ; i < emObjectHandle->size(); ++i) { | ||
|
||
//i need to know if its in the barrel/endcap so I get the supercluster handle to find out the detector eta | ||
//this might not be the best way, are we guaranteed that eta<1.5 is barrel | ||
//this can be safely replaced by another method which determines where the emobject is | ||
//then we either get the isolation Et or isolation Energy depending on user selection | ||
double isoValue =0.; | ||
|
||
reco::SuperClusterRef superClus = emObjectHandle->at(i).get<reco::SuperClusterRef>(); | ||
|
||
if(tryBoth_){ //barrel + endcap | ||
if(useIsolEt_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i))); | ||
else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i))); | ||
} | ||
else if( fabs(superClus->eta())<1.479) { //barrel | ||
if(useIsolEt_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i))); | ||
else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i))); | ||
} | ||
else{ //endcap | ||
if(useIsolEt_) isoValue = ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i))); | ||
else isoValue = ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i))); | ||
} | ||
|
||
//we subtract off the electron energy here as well | ||
double subtractVal=0; | ||
|
||
if(useIsolEt_) subtractVal = superClus.get()->rawEnergy()*sin(2*atan(exp(-superClus.get()->eta()))); | ||
else subtractVal = superClus.get()->rawEnergy(); | ||
|
||
if(subtract_) isoValue-= subtractVal; | ||
|
||
retV[i]=isoValue; | ||
//all done, isolation is now in the map | ||
|
||
}//end of loop over em objects | ||
|
||
filler.insert(emObjectHandle,retV.begin(),retV.end()); | ||
filler.fill(); | ||
|
||
//std::auto_ptr<reco::CandViewDoubleAssociations> isolMap(isoMap); | ||
iEvent.put(isoMap); | ||
|
||
} | ||
|
||
//define this as a plug-in | ||
//DEFINE_FWK_MODULE(EgammaRecHitIsolation,Producer); |
67 changes: 67 additions & 0 deletions
67
trunk/RecoEgamma/EgammaIsolationAlgos/plugins/EgammaEcalRecHitIsolationProducer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#ifndef EgammaIsolationProducers_EgammaEcalRecHitIsolationProducer_h | ||
#define EgammaIsolationProducers_EgammaEcalRecHitIsolationProducer_h | ||
|
||
//***************************************************************************** | ||
// File: EgammaRecHitIsolationProducer.h | ||
// ---------------------------------------------------------------------------- | ||
// OrigAuth: Matthias Mozer, adapted from EgammaHcalIsolationProducer by S. Harper | ||
// Institute: IIHE-VUB, RAL | ||
//============================================================================= | ||
//***************************************************************************** | ||
|
||
// -*- C++ -*- | ||
// | ||
|
||
|
||
// system include files | ||
#include <memory> | ||
|
||
// user include files | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/EDProducer.h" | ||
|
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaRecHitIsolation.h" | ||
|
||
// | ||
// class declaration | ||
// | ||
|
||
class EgammaEcalRecHitIsolationProducer : public edm::EDProducer { | ||
public: | ||
explicit EgammaEcalRecHitIsolationProducer(const edm::ParameterSet&); | ||
~EgammaEcalRecHitIsolationProducer(); | ||
|
||
|
||
virtual void produce(edm::Event&, const edm::EventSetup&); | ||
private: | ||
// ----------member data --------------------------- | ||
|
||
edm::InputTag emObjectProducer_; | ||
edm::InputTag ecalBarrelRecHitProducer_; | ||
edm::InputTag ecalBarrelRecHitCollection_; | ||
edm::InputTag ecalEndcapRecHitProducer_; | ||
edm::InputTag ecalEndcapRecHitCollection_; | ||
|
||
double egIsoPtMinBarrel_; //minimum Et noise cut | ||
double egIsoEMinBarrel_; //minimum E noise cut | ||
double egIsoPtMinEndcap_; //minimum Et noise cut | ||
double egIsoEMinEndcap_; //minimum E noise cut | ||
double egIsoConeSizeOut_; //outer cone size | ||
double egIsoConeSizeInBarrel_; //inner cone size | ||
double egIsoConeSizeInEndcap_; //inner cone size | ||
double egIsoJurassicWidth_ ; // exclusion strip width for jurassic veto | ||
|
||
bool useIsolEt_; //switch for isolEt rather than isolE | ||
bool tryBoth_ ; // use rechits from barrel + endcap | ||
bool subtract_ ; // subtract SC energy (allows veto cone of zero size) | ||
|
||
edm::ParameterSet conf_; | ||
|
||
}; | ||
|
||
#endif |
80 changes: 80 additions & 0 deletions
80
trunk/RecoEgamma/EgammaIsolationAlgos/plugins/EgammaElectronTkIsolationProducer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
//***************************************************************************** | ||
// File: EgammaElectronTkIsolationProducer.cc | ||
// ---------------------------------------------------------------------------- | ||
// OrigAuth: Matthias Mozer | ||
// Institute: IIHE-VUB | ||
//============================================================================= | ||
//***************************************************************************** | ||
|
||
|
||
// Framework | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "DataFormats/Common/interface/Handle.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/Utilities/interface/Exception.h" | ||
#include "DataFormats/BeamSpot/interface/BeamSpot.h" | ||
|
||
#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" | ||
#include "DataFormats/Candidate/interface/CandAssociation.h" | ||
|
||
|
||
#include "RecoEgamma/EgammaIsolationAlgos/plugins/EgammaElectronTkIsolationProducer.h" | ||
#include "RecoEgamma/EgammaIsolationAlgos/interface/ElectronTkIsolation.h" | ||
|
||
EgammaElectronTkIsolationProducer::EgammaElectronTkIsolationProducer(const edm::ParameterSet& config) : conf_(config) | ||
{ | ||
// use configuration file to setup input/output collection names | ||
electronProducer_ = conf_.getParameter<edm::InputTag>("electronProducer"); | ||
|
||
trackProducer_ = conf_.getParameter<edm::InputTag>("trackProducer"); | ||
beamspotProducer_ = conf_.getParameter<edm::InputTag>("BeamspotProducer"); | ||
|
||
ptMin_ = conf_.getParameter<double>("ptMin"); | ||
intRadius_ = conf_.getParameter<double>("intRadius"); | ||
extRadius_ = conf_.getParameter<double>("extRadius"); | ||
maxVtxDist_ = conf_.getParameter<double>("maxVtxDist"); | ||
drb_ = conf_.getParameter<double>("maxVtxDistXY"); | ||
|
||
//register your products | ||
produces < edm::ValueMap<double> >(); | ||
|
||
} | ||
|
||
EgammaElectronTkIsolationProducer::~EgammaElectronTkIsolationProducer(){} | ||
|
||
|
||
|
||
void EgammaElectronTkIsolationProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) | ||
{ | ||
// Get the filtered objects | ||
edm::Handle< reco::PixelMatchGsfElectronCollection> electronHandle; | ||
iEvent.getByLabel(electronProducer_,electronHandle); | ||
|
||
//get the tracks | ||
edm::Handle<reco::TrackCollection> tracks; | ||
iEvent.getByLabel(trackProducer_,tracks); | ||
const reco::TrackCollection* trackCollection = tracks.product(); | ||
|
||
//prepare product | ||
std::auto_ptr<edm::ValueMap<double> > isoMap(new edm::ValueMap<double>()); | ||
edm::ValueMap<double>::Filler filler(*isoMap); | ||
std::vector<double> retV(electronHandle->size(),0); | ||
|
||
edm::Handle<reco::BeamSpot> beamSpotH; | ||
iEvent.getByLabel(beamspotProducer_,beamSpotH); | ||
reco::TrackBase::Point beamspot = beamSpotH->position(); | ||
|
||
ElectronTkIsolation myTkIsolation (extRadius_,intRadius_,ptMin_,maxVtxDist_,drb_,trackCollection,beamspot) ; | ||
|
||
for(unsigned int i = 0 ; i < electronHandle->size(); ++i ){ | ||
double isoValue = myTkIsolation.getPtTracks(&(electronHandle->at(i))); | ||
retV[i] = isoValue; | ||
} | ||
|
||
//fill and insert valuemap | ||
filler.insert(electronHandle,retV.begin(),retV.end()); | ||
filler.fill(); | ||
iEvent.put(isoMap); | ||
} |
43 changes: 43 additions & 0 deletions
43
trunk/RecoEgamma/EgammaIsolationAlgos/plugins/EgammaElectronTkIsolationProducer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef EgammaIsolationProducers_EgammaElectronTkIsolationProducer_h | ||
#define EgammaIsolationProducers_EgammaElectronTkIsolationProducer_h | ||
|
||
//***************************************************************************** | ||
// File: EgammaElectronTkIsolationProducer.h | ||
// ---------------------------------------------------------------------------- | ||
// OrigAuth: Matthias Mozer | ||
// Institute: IIHE-VUB | ||
//============================================================================= | ||
//***************************************************************************** | ||
|
||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/EDProducer.h" | ||
|
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
class EgammaElectronTkIsolationProducer : public edm::EDProducer { | ||
public: | ||
explicit EgammaElectronTkIsolationProducer(const edm::ParameterSet&); | ||
~EgammaElectronTkIsolationProducer(); | ||
|
||
virtual void produce(edm::Event&, const edm::EventSetup&); | ||
|
||
private: | ||
edm::InputTag electronProducer_; | ||
edm::InputTag trackProducer_; | ||
edm::InputTag beamspotProducer_; | ||
|
||
double ptMin_; | ||
double intRadius_; | ||
double extRadius_; | ||
double maxVtxDist_; | ||
double drb_; | ||
|
||
edm::ParameterSet conf_; | ||
|
||
}; | ||
|
||
|
||
#endif |
Oops, something went wrong.