CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaHLTHcalIsolationProducersRegional.cc
Go to the documentation of this file.
1 
11 
12 // Framework
19 
27 
28 
33 
36 
38 
40 {
41  // use configuration file to setup input/output collection names
42  recoEcalCandidateProducer_ = config.getParameter<edm::InputTag>("recoEcalCandidateProducer");
43  hbheRecHitProducer_ = config.getParameter<edm::InputTag>("hbheRecHitProducer");
44  rhoProducer_ = config.getParameter<edm::InputTag>("rhoProducer");
45  doRhoCorrection_ = config.getParameter<bool>("doRhoCorrection");
46  rhoMax_ = config.getParameter<double>("rhoMax");
47  rhoScale_ = config.getParameter<double>("rhoScale");
48 
49  double eMinHB = config.getParameter<double>("eMinHB");
50  double eMinHE = config.getParameter<double>("eMinHE");
51  double etMinHB = config.getParameter<double>("etMinHB");
52  double etMinHE = config.getParameter<double>("etMinHE");
53  double innerCone = config.getParameter<double>("innerCone");
54  double outerCone = config.getParameter<double>("outerCone");
55  int depth = config.getParameter<int>("depth");
56  doEtSum_ = config.getParameter<bool>("doEtSum");
57  effectiveAreaBarrel_ = config.getParameter<double>("effectiveAreaBarrel");
58  effectiveAreaEndcap_ = config.getParameter<double>("effectiveAreaEndcap");
59  isolAlgo_ = new EgammaHLTHcalIsolation(eMinHB,eMinHE,etMinHB,etMinHE,innerCone,outerCone,depth);
60 
61 
62  //register your products
63  produces < reco::RecoEcalCandidateIsolationMap >();
64 }
65 
67 {
68  delete isolAlgo_;
69 }
70 
71 
72 
73 //
74 // member functions
75 //
76 
77 // ------------ method called to produce the data ------------
78 void
80 {
81 
82  // Get the HLT filtered objects
84  iEvent.getByLabel(recoEcalCandidateProducer_,recoEcalCandHandle);
85 
86  // Get the barrel hcal hits
87  edm::Handle<HBHERecHitCollection> hbheRecHitHandle;
88  iEvent.getByLabel(hbheRecHitProducer_, hbheRecHitHandle);
89  const HBHERecHitCollection* hbheRecHitCollection = hbheRecHitHandle.product();
90 
92  iSetup.get<HcalChannelQualityRcd>().get(hcalChStatus);
93 
95  iSetup.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComp);
96 
97  edm::Handle<double> rhoHandle;
98  double rho = 0.0;
99  if (doRhoCorrection_) {
100  iEvent.getByLabel(rhoProducer_, rhoHandle);
101  rho = *(rhoHandle.product());
102  }
103 
104  if (rho > rhoMax_)
105  rho = rhoMax_;
106 
107  rho = rho*rhoScale_;
108 
109  edm::ESHandle<CaloGeometry> caloGeomHandle;
110  iSetup.get<CaloGeometryRecord>().get(caloGeomHandle);
111  const CaloGeometry* caloGeom = caloGeomHandle.product();
112 
114 
115 
116  for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoEcalCandHandle->begin(); iRecoEcalCand != recoEcalCandHandle->end(); iRecoEcalCand++){
117 
118  reco::RecoEcalCandidateRef recoEcalCandRef(recoEcalCandHandle,iRecoEcalCand -recoEcalCandHandle ->begin());
119 
120  float isol = 0;
121  if(doEtSum_) {
122  isol = isolAlgo_->getEtSum(recoEcalCandRef->superCluster()->eta(),
123  recoEcalCandRef->superCluster()->phi(),hbheRecHitCollection,caloGeom,
124  hcalSevLvlComp.product(),hcalChStatus.product());
125 
126  if (doRhoCorrection_) {
127  if (fabs(recoEcalCandRef->superCluster()->eta()) < 1.442)
128  isol = isol - rho*effectiveAreaBarrel_;
129  else
130  isol = isol - rho*effectiveAreaEndcap_;
131  }
132  } else {
133  isol = isolAlgo_->getESum(recoEcalCandRef->superCluster()->eta(),recoEcalCandRef->superCluster()->phi(),
134  hbheRecHitCollection,caloGeom,
135  hcalSevLvlComp.product(),hcalChStatus.product());
136  }
137 
138  isoMap.insert(recoEcalCandRef, isol);
139  }
140 
141  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> isolMap(new reco::RecoEcalCandidateIsolationMap(isoMap));
142  iEvent.put(isolMap);
143 
144 }
145 
146 //define this as a plug-in
147 //DEFINE_FWK_MODULE(EgammaHLTHcalIsolationProducersRegional);
T getParameter(std::string const &) const
Definition: DDAxes.h:10
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
float getEtSum(float candEta, float candPhi, const HBHERecHitCollection *hbhe, const CaloGeometry *geometry) const
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
float getESum(float candEta, float candPhi, const HBHERecHitCollection *hbhe, const CaloGeometry *geometry) const