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  // I guess this can be removed completely
66  //DetId maxEId = (lazyTools.getMaximum(*(recoecalcandref->superCluster()->seed()) )).first;
67  //float EcalSeverityLevelAlgo::swissCross( const DetId id, const EcalRecHitCollection & recHits, float recHitEtThreshold )
69  iEvent.getByLabel( ecalRechitEBTag_, pEBRecHits );
70  r9 = -1;//EcalSeverityLevelAlgo::swissCross( maxEId, *(pEBRecHits.product()), 0. );
71  }
72  else{
73  float e9 = lazyTools.e3x3( *(recoecalcandref->superCluster()->seed()) );
74  if (e9 != 0 ) {r9 = lazyTools.eMax(*(recoecalcandref->superCluster()->seed()) )/e9;}
75  }
76 
77  r9Map.insert(recoecalcandref, r9);
78 
79  }
80 
81  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> R9Map(new reco::RecoEcalCandidateIsolationMap(r9Map));
82  iEvent.put(R9Map);
83 
84 }
85 
86 //define this as a plug-in
87 //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:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edm::ParameterSet conf_
EgammaHLTR9Producer(const edm::ParameterSet &)
virtual void produce(edm::Event &, const edm::EventSetup &)
void insert(const key_type &k, const data_type &v)
insert an association
edm::InputTag ecalRechitEETag_