CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaHLTHcalIsolationDoubleConeProducers.cc
Go to the documentation of this file.
1 
12 
13 // Framework
16 // For160 #include "FWCore/Framework/interface/Handle.h"
17 #include "DataFormats/Common/interface/Handle.h" //For160
21 
24 
28 
33 
35 
37 {
38  // use configuration file to setup input/output collection names
39  recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer");
40 
41  hbRecHitProducer_ = conf_.getParameter<edm::InputTag>("hbRecHitProducer");
42  hfRecHitProducer_ = conf_.getParameter<edm::InputTag>("hfRecHitProducer");
43 
44  egHcalIsoPtMin_ = conf_.getParameter<double>("egHcalIsoPtMin");
45  egHcalIsoConeSize_ = conf_.getParameter<double>("egHcalIsoConeSize");
46  egHcalExclusion_ = conf_.getParameter<double>("egHcalExclusion");
47 
48  test_ = new EgammaHLTHcalIsolationDoubleCone(egHcalIsoPtMin_,egHcalIsoConeSize_,egHcalExclusion_);
49 
50 
51  //register your products
52  produces < reco::RecoEcalCandidateIsolationMap >();
53 }
54 
55 
57 
58 
59 //
60 // member functions
61 //
62 
63 // ------------ method called to produce the data ------------
64 void
66 {
67  // std::cout << "YYY" << egHcalIsoConeSize_ << " " << egHcalExclusion_ <<std::endl;
68  // Get the HLT filtered objects
70  iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle);
71 
72  // Get the barrel hcal hits
73  edm::Handle<HBHERecHitCollection> hhitBarrelHandle;
74  iEvent.getByLabel(hbRecHitProducer_, hhitBarrelHandle);
75  const HBHERecHitCollection* hcalhitBarrelCollection = hhitBarrelHandle.product();
76  // Get the forward hcal hits
77  edm::Handle<HFRecHitCollection> hhitEndcapHandle;
78  iEvent.getByLabel(hfRecHitProducer_, hhitEndcapHandle);
79  const HFRecHitCollection* hcalhitEndcapCollection = hhitEndcapHandle.product();
80  //Get Calo Geometry
82  iSetup.get<CaloGeometryRecord>().get(pG);
83  const CaloGeometry* caloGeom = pG.product();
84 
86 
87 
88  for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){
89 
90  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand -recoecalcandHandle ->begin());
91 
92  const reco::RecoCandidate *tempiRecoEcalCand = &(*recoecalcandref);
93  float isol = test_->isolPtSum(tempiRecoEcalCand,hcalhitBarrelCollection,hcalhitEndcapCollection,caloGeom);
94 
95  isoMap.insert(recoecalcandref, isol);
96  // std::cout << isol << std::endl;
97  }
98 
99  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> isolMap(new reco::RecoEcalCandidateIsolationMap(isoMap));
100  iEvent.put(isolMap);
101 
102 }
103 
104 //define this as a plug-in
105 //DEFINE_FWK_MODULE(EgammaHLTHcalIsolationDoubleConeProducers);
T getParameter(std::string const &) const
float isolPtSum(const reco::RecoCandidate *recocandidate, const HBHERecHitCollection *hbhe, const HFRecHitCollection *hf, const CaloGeometry *geometry)
virtual void produce(edm::Event &, const edm::EventSetup &)
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
void insert(const key_type &k, const data_type &v)
insert an association
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:74
#define begin
Definition: vmac.h:31