CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaHLTR9Producer.cc
Go to the documentation of this file.
1 
10 
11 // Framework
18 
21 
25 
27 {
28  // use configuration file to setup input/output collection names
29  recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer");
30  ecalRechitEBTag_ = conf_.getParameter< edm::InputTag > ("ecalRechitEB");
31  ecalRechitEETag_ = conf_.getParameter< edm::InputTag > ("ecalRechitEE");
32  useSwissCross_ = conf_.getParameter< bool > ("useSwissCross");
33  //register your products
34  produces < reco::RecoEcalCandidateIsolationMap >();
35 }
36 
37 
39 
40 
41 //
42 // member functions
43 //
44 
45 // ------------ method called to produce the data ------------
46 void
48 {
49 
50  // Get the HLT filtered objects
52  iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle);
53 
54  EcalClusterLazyTools lazyTools( iEvent, iSetup, ecalRechitEBTag_, ecalRechitEETag_ );
55 
57 
58  for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){
59 
60  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand-recoecalcandHandle->begin());
61 
62  float r9 = -1;
63 
64  if (useSwissCross_){
65  DetId maxEId = (lazyTools.getMaximum(*(recoecalcandref->superCluster()->seed()) )).first;
66  //float EcalSeverityLevelAlgo::swissCross( const DetId id, const EcalRecHitCollection & recHits, float recHitEtThreshold )
68  iEvent.getByLabel( ecalRechitEBTag_, pEBRecHits );
69  r9 = EcalSeverityLevelAlgo::swissCross( maxEId, *(pEBRecHits.product()), 0. );
70  }
71  else{
72  float e9 = lazyTools.e3x3( *(recoecalcandref->superCluster()->seed()) );
73  if (e9 != 0 ) {r9 = lazyTools.eMax(*(recoecalcandref->superCluster()->seed()) )/e9;}
74  }
75 
76  r9Map.insert(recoecalcandref, r9);
77 
78  }
79 
80  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> R9Map(new reco::RecoEcalCandidateIsolationMap(r9Map));
81  iEvent.put(R9Map);
82 
83 }
84 
85 //define this as a plug-in
86 //DEFINE_FWK_MODULE(EgammaHLTR9Producer);
T getParameter(std::string const &) const
edm::InputTag ecalRechitEBTag_
float e3x3(const reco::BasicCluster &cluster)
float eMax(const reco::BasicCluster &cluster)
edm::InputTag recoEcalCandidateProducer_
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool first
Definition: L1TdeRCT.cc:79
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
edm::ParameterSet conf_
EgammaHLTR9Producer(const edm::ParameterSet &)
Definition: DetId.h:20
virtual void produce(edm::Event &, const edm::EventSetup &)
void insert(const key_type &k, const data_type &v)
insert an association
std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster)
T const * product() const
Definition: Handle.h:74
static float swissCross(const DetId id, const EcalRecHitCollection &, float recHitEtThreshold=0., bool avoidIeta85=true)
tuple config
Definition: cmsDriver.py:17
edm::InputTag ecalRechitEETag_