CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaHLTElectronTrackIsolationProducers.cc
Go to the documentation of this file.
1 
10 
11 // Framework
18 
21 
25 
29 
30 
31 
32 
34 {
35 
36  electronProducer_ = conf_.getParameter<edm::InputTag>("electronProducer");
37  trackProducer_ = conf_.getParameter<edm::InputTag>("trackProducer");
38 
39  egTrkIsoPtMin_ = conf_.getParameter<double>("egTrkIsoPtMin");
40  egTrkIsoConeSize_ = conf_.getParameter<double>("egTrkIsoConeSize");
41  egTrkIsoZSpan_ = conf_.getParameter<double>("egTrkIsoZSpan");
42  egTrkIsoRSpan_ = conf_.getParameter<double>("egTrkIsoRSpan");
43  egTrkIsoVetoConeSize_ = conf_.getParameter<double>("egTrkIsoVetoConeSize");
44  egCheckForOtherEleInCone_ = conf_.getUntrackedParameter<bool>("egCheckForOtherEleInCone",false);
45  double egTrkIsoStripBarrel = conf_.getParameter<double>("egTrkIsoStripBarrel");
46  double egTrkIsoStripEndcap = conf_.getParameter<double>("egTrkIsoStripEndcap");
47 
48  test_ = new EgammaHLTTrackIsolation(egTrkIsoPtMin_,egTrkIsoConeSize_,
49  egTrkIsoZSpan_,egTrkIsoRSpan_,egTrkIsoVetoConeSize_,egTrkIsoStripBarrel,egTrkIsoStripEndcap);
50 
51 
52  //register your products
53  produces < reco::ElectronIsolationMap >();
54 
55 }
56 
57 
59 
60 
61 //
62 // member functions
63 //
64 
65 // ------------ method called to produce the data ------------
66 void
68 {
69 
70  // Get the HLT filtered objects
72  iEvent.getByLabel(electronProducer_,electronHandle);
73 
74  // Get the general tracks
76  iEvent.getByLabel(trackProducer_, trackHandle);
77  const reco::TrackCollection* trackCollection = trackHandle.product();
78 
80 
81  for(reco::ElectronCollection::const_iterator iElectron = electronHandle->begin(); iElectron != electronHandle->end(); iElectron++){
82 
83 
84  reco::ElectronRef electronref(reco::ElectronRef(electronHandle,iElectron - electronHandle->begin()));
85  reco::TrackRef electrontrackref = iElectron->track();
86 
87  float isol;
89  isol = test_->electronPtSum(&(*electrontrackref),trackCollection);
90  } else {
91  isol = test_->electronPtSum(&(*electrontrackref),electronHandle.product(),trackCollection);
92  }
93  //if(electronref->pt() != 0. ) isol = isol/electronref->pt();
94 
95  isoMap.insert(electronref, isol);
96 
97  }
98 
99  std::auto_ptr<reco::ElectronIsolationMap> isolMap(new reco::ElectronIsolationMap(isoMap));
100  iEvent.put(isolMap);
101 
102 }
103 
104 //define this as a plug-in
105 //DEFINE_FWK_MODULE(EgammaHLTTrackIsolationProducers);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual void produce(edm::Event &, const edm::EventSetup &)
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
int iEvent
Definition: GenABIO.cc:243
float electronPtSum(const reco::Track *const tr, const reco::TrackCollection *isoTracks)
Get Pt sum of tracks inside an isolation cone for electrons.
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:359
void insert(const key_type &k, const data_type &v)
insert an association
T const * product() const
Definition: Handle.h:74
tuple config
Definition: cmsDriver.py:17