#include <RecoEgamma/EgammaHLTProducers/interface/EgammaHLTElectronDetaDphiProducer.h>
Public Member Functions | |
EgammaHLTElectronDetaDphiProducer (const edm::ParameterSet &) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
~EgammaHLTElectronDetaDphiProducer () | |
Private Attributes | |
edm::InputTag | BSProducer_ |
edm::ParameterSet | conf_ |
edm::InputTag | electronProducer_ |
bool | useTrackProjectionToEcal_ |
Definition at line 32 of file EgammaHLTElectronDetaDphiProducer.h.
EgammaHLTElectronDetaDphiProducer::EgammaHLTElectronDetaDphiProducer | ( | const edm::ParameterSet & | config | ) | [explicit] |
Definition at line 45 of file EgammaHLTElectronDetaDphiProducer.cc.
References BSProducer_, conf_, electronProducer_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and useTrackProjectionToEcal_.
00045 : conf_(config) 00046 { 00047 00048 electronProducer_ = conf_.getParameter<edm::InputTag>("electronProducer"); 00049 BSProducer_ = conf_.getParameter<edm::InputTag>("BSProducer"); 00050 useTrackProjectionToEcal_ = conf_.getUntrackedParameter<bool>("useTrackProjectionToEcal",false); 00051 00052 //register your products 00053 produces < reco::ElectronIsolationMap >( "Deta" ).setBranchAlias( "deta" ); 00054 produces < reco::ElectronIsolationMap >( "Dphi" ).setBranchAlias( "dphi" ); 00055 00056 }
EgammaHLTElectronDetaDphiProducer::~EgammaHLTElectronDetaDphiProducer | ( | ) |
void EgammaHLTElectronDetaDphiProducer::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 67 of file EgammaHLTElectronDetaDphiProducer.cc.
References BSProducer_, ECALPositionCalculator::ecalPhi(), electronProducer_, edm::EventSetup::get(), edm::Event::getByLabel(), edm::AssociationMap< Tag >::insert(), edm::ESHandle< T >::product(), edm::Event::put(), and useTrackProjectionToEcal_.
00068 { 00069 00070 // Get the HLT filtered objects 00071 edm::Handle<reco::ElectronCollection> electronHandle; 00072 iEvent.getByLabel(electronProducer_,electronHandle); 00073 00074 edm::Handle<reco::BeamSpot> recoBeamSpotHandle; 00075 iEvent.getByLabel(BSProducer_,recoBeamSpotHandle); 00076 // gets its position 00077 const reco::BeamSpot::Point& BSPosition = recoBeamSpotHandle->position(); 00078 00079 edm::ESHandle<MagneticField> theMagField; 00080 iSetup.get<IdealMagneticFieldRecord>().get(theMagField); 00081 00082 reco::ElectronIsolationMap detaMap; 00083 reco::ElectronIsolationMap dphiMap; 00084 00085 for(reco::ElectronCollection::const_iterator iElectron = electronHandle->begin(); iElectron != electronHandle->end(); iElectron++){ 00086 00087 reco::ElectronRef eleref(reco::ElectronRef(electronHandle,iElectron - electronHandle->begin())); 00088 const reco::SuperClusterRef theClus = eleref->superCluster(); 00089 const math::XYZVector trackMom = eleref->track()->momentum(); 00090 00091 math::XYZPoint SCcorrPosition(theClus->x()-BSPosition.x(), theClus->y()-BSPosition.y() , theClus->z()-eleref->track()->vz() ); 00092 float deltaeta = fabs(SCcorrPosition.eta()-eleref->track()->eta()); 00093 float deltaphi; 00094 00095 if (useTrackProjectionToEcal_) { 00096 00097 ECALPositionCalculator posCalc; 00098 const math::XYZPoint vertex(BSPosition.x(),BSPosition.y(),eleref->track()->vz()); 00099 00100 float phi1= posCalc.ecalPhi(theMagField.product(),trackMom,vertex,1); 00101 float phi2= posCalc.ecalPhi(theMagField.product(),trackMom,vertex,-1); 00102 00103 float deltaphi1=fabs( phi1 - theClus->position().phi() ); 00104 if(deltaphi1>6.283185308) deltaphi1 -= 6.283185308; 00105 if(deltaphi1>3.141592654) deltaphi1 = 6.283185308-deltaphi1; 00106 00107 float deltaphi2=fabs( phi2 - theClus->position().phi() ); 00108 if(deltaphi2>6.283185308) deltaphi2 -= 6.283185308; 00109 if(deltaphi2>3.141592654) deltaphi2 = 6.283185308-deltaphi2; 00110 00111 deltaphi = deltaphi1; 00112 if(deltaphi2<deltaphi1){ deltaphi = deltaphi2;} 00113 00114 } else { 00115 00116 deltaphi=fabs(eleref->track()->outerPosition().phi()-theClus->phi()); 00117 if(deltaphi>6.283185308) deltaphi -= 6.283185308; 00118 if(deltaphi>3.141592654) deltaphi = 6.283185308-deltaphi; 00119 00120 } 00121 00122 detaMap.insert(eleref, deltaeta); 00123 dphiMap.insert(eleref, deltaphi); 00124 00125 } 00126 00127 std::auto_ptr<reco::ElectronIsolationMap> detMap(new reco::ElectronIsolationMap(detaMap)); 00128 std::auto_ptr<reco::ElectronIsolationMap> dphMap(new reco::ElectronIsolationMap(dphiMap)); 00129 iEvent.put(detMap, "Deta" ); 00130 iEvent.put(dphMap, "Dphi" ); 00131 00132 }
Definition at line 46 of file EgammaHLTElectronDetaDphiProducer.h.
Referenced by EgammaHLTElectronDetaDphiProducer(), and produce().
Definition at line 43 of file EgammaHLTElectronDetaDphiProducer.h.
Referenced by EgammaHLTElectronDetaDphiProducer().
Definition at line 42 of file EgammaHLTElectronDetaDphiProducer.h.
Referenced by EgammaHLTElectronDetaDphiProducer(), and produce().
Definition at line 45 of file EgammaHLTElectronDetaDphiProducer.h.
Referenced by EgammaHLTElectronDetaDphiProducer(), and produce().