CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
EgammaHLTElectronDetaDphiProducer Class Reference

#include <RecoEgamma/EgammaHLTProducers/interface/EgammaHLTElectronDetaDphiProducer.h>

Inheritance diagram for EgammaHLTElectronDetaDphiProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 EgammaHLTElectronDetaDphiProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~EgammaHLTElectronDetaDphiProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

edm::InputTag BSProducer_
 
edm::ParameterSet conf_
 
edm::InputTag electronProducer_
 
bool useTrackProjectionToEcal_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Author
Roberto Covarelli (CERN)
Id:
EgammaHLTElectronDetaDphiProducer.cc,v 1.1 2009/01/15 14:28:28 covarell Exp

Definition at line 32 of file EgammaHLTElectronDetaDphiProducer.h.

Constructor & Destructor Documentation

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_.

45  : conf_(config)
46 {
47 
48  electronProducer_ = conf_.getParameter<edm::InputTag>("electronProducer");
50  useTrackProjectionToEcal_ = conf_.getUntrackedParameter<bool>("useTrackProjectionToEcal",false);
51 
52  //register your products
53  produces < reco::ElectronIsolationMap >( "Deta" ).setBranchAlias( "deta" );
54  produces < reco::ElectronIsolationMap >( "Dphi" ).setBranchAlias( "dphi" );
55 
56 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
EgammaHLTElectronDetaDphiProducer::~EgammaHLTElectronDetaDphiProducer ( )

Definition at line 58 of file EgammaHLTElectronDetaDphiProducer.cc.

58 {}

Member Function Documentation

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< class >::product(), edm::Event::put(), and useTrackProjectionToEcal_.

68 {
69 
70  // Get the HLT filtered objects
72  iEvent.getByLabel(electronProducer_,electronHandle);
73 
74  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
75  iEvent.getByLabel(BSProducer_,recoBeamSpotHandle);
76  // gets its position
77  const reco::BeamSpot::Point& BSPosition = recoBeamSpotHandle->position();
78 
79  edm::ESHandle<MagneticField> theMagField;
80  iSetup.get<IdealMagneticFieldRecord>().get(theMagField);
81 
84 
85  for(reco::ElectronCollection::const_iterator iElectron = electronHandle->begin(); iElectron != electronHandle->end(); iElectron++){
86 
87  reco::ElectronRef eleref(reco::ElectronRef(electronHandle,iElectron - electronHandle->begin()));
88  const reco::SuperClusterRef theClus = eleref->superCluster();
89  const math::XYZVector trackMom = eleref->track()->momentum();
90 
91  math::XYZPoint SCcorrPosition(theClus->x()-BSPosition.x(), theClus->y()-BSPosition.y() , theClus->z()-eleref->track()->vz() );
92  float deltaeta = fabs(SCcorrPosition.eta()-eleref->track()->eta());
93  float deltaphi;
94 
96 
97  ECALPositionCalculator posCalc;
98  const math::XYZPoint vertex(BSPosition.x(),BSPosition.y(),eleref->track()->vz());
99 
100  float phi1= posCalc.ecalPhi(theMagField.product(),trackMom,vertex,1);
101  float phi2= posCalc.ecalPhi(theMagField.product(),trackMom,vertex,-1);
102 
103  float deltaphi1=fabs( phi1 - theClus->position().phi() );
104  if(deltaphi1>6.283185308) deltaphi1 -= 6.283185308;
105  if(deltaphi1>3.141592654) deltaphi1 = 6.283185308-deltaphi1;
106 
107  float deltaphi2=fabs( phi2 - theClus->position().phi() );
108  if(deltaphi2>6.283185308) deltaphi2 -= 6.283185308;
109  if(deltaphi2>3.141592654) deltaphi2 = 6.283185308-deltaphi2;
110 
111  deltaphi = deltaphi1;
112  if(deltaphi2<deltaphi1){ deltaphi = deltaphi2;}
113 
114  } else {
115 
116  deltaphi=fabs(eleref->track()->outerPosition().phi()-theClus->phi());
117  if(deltaphi>6.283185308) deltaphi -= 6.283185308;
118  if(deltaphi>3.141592654) deltaphi = 6.283185308-deltaphi;
119 
120  }
121 
122  detaMap.insert(eleref, deltaeta);
123  dphiMap.insert(eleref, deltaphi);
124 
125  }
126 
127  std::auto_ptr<reco::ElectronIsolationMap> detMap(new reco::ElectronIsolationMap(detaMap));
128  std::auto_ptr<reco::ElectronIsolationMap> dphMap(new reco::ElectronIsolationMap(dphiMap));
129  iEvent.put(detMap, "Deta" );
130  iEvent.put(dphMap, "Dphi" );
131 
132 }
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:30
double ecalPhi(const MagneticField *magField, const math::XYZVector &momentum, const math::XYZPoint &vertex, const int charge)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
void insert(const key_type &k, const data_type &v)
insert an association
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62

Member Data Documentation

edm::InputTag EgammaHLTElectronDetaDphiProducer::BSProducer_
private
edm::ParameterSet EgammaHLTElectronDetaDphiProducer::conf_
private
edm::InputTag EgammaHLTElectronDetaDphiProducer::electronProducer_
private
bool EgammaHLTElectronDetaDphiProducer::useTrackProjectionToEcal_
private