CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaHLTClusterShapeProducer.cc
Go to the documentation of this file.
1 
10 
11 // Framework
18 
21 
24 
26 {
27  // use configuration file to setup input/output collection names
28  recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer");
29 
30  ecalRechitEBTag_ = conf_.getParameter< edm::InputTag > ("ecalRechitEB");
31  ecalRechitEETag_ = conf_.getParameter< edm::InputTag > ("ecalRechitEE");
32  EtaOrIeta_ = conf_.getParameter< bool > ("isIeta");
33 
34  //register your products
35  produces < reco::RecoEcalCandidateIsolationMap >();
36 }
37 
38 
40 
41 
42 //
43 // member functions
44 //
45 
46 // ------------ method called to produce the data ------------
47 void
49 {
50 
51  // Get the HLT filtered objects
53  iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle);
54 
55  EcalClusterLazyTools lazyTools( iEvent, iSetup, ecalRechitEBTag_, ecalRechitEETag_ );
56 
58 
59  for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){
60 
61  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand-recoecalcandHandle->begin());
62 
63  std::vector<float> vCov ;
64  double sigmaee;
65  if (EtaOrIeta_) {
66  vCov = lazyTools.localCovariances( *(recoecalcandref->superCluster()->seed()) );
67  sigmaee = sqrt(vCov[0]);
68  } else {
69  vCov = lazyTools.covariances( *(recoecalcandref->superCluster()->seed()) );
70  sigmaee = sqrt(vCov[0]);
71  double EtaSC = recoecalcandref->eta();
72  if (EtaSC > 1.479) sigmaee = sigmaee - 0.02*(EtaSC - 2.3);
73  }
74 
75  clshMap.insert(recoecalcandref, sigmaee);
76 
77  }
78 
79  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> clushMap(new reco::RecoEcalCandidateIsolationMap(clshMap));
80  iEvent.put(clushMap);
81 
82 }
83 
84 //define this as a plug-in
85 //DEFINE_FWK_MODULE(EgammaHLTClusterShapeProducer);
std::vector< float > localCovariances(const reco::BasicCluster &cluster, float w0=4.7)
T getParameter(std::string const &) const
EgammaHLTClusterShapeProducer(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
T sqrt(T t)
Definition: SSEVec.h:46
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::vector< float > covariances(const reco::BasicCluster &cluster, float w0=4.7)
void insert(const key_type &k, const data_type &v)
insert an association
virtual void produce(edm::Event &, const edm::EventSetup &)