CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaHLTBcHcalIsolationProducersRegional.cc
Go to the documentation of this file.
1 /* \class EgammaHLTBcHcalIsolationProducersRegional
2  *
3  * \author Matteo Sani (UCSD)
4  *
5  */
6 
9 
16 
24 
25 
30 
33 
35 
37 
38  recoEcalCandidateProducer_ = config.getParameter<edm::InputTag>("recoEcalCandidateProducer");
39  caloTowerProducer_ = config.getParameter<edm::InputTag>("caloTowerProducer");
40  rhoProducer_ = config.getParameter<edm::InputTag>("rhoProducer");
41  doRhoCorrection_ = config.getParameter<bool>("doRhoCorrection");
42  rhoMax_ = config.getParameter<double>("rhoMax");
43  rhoScale_ = config.getParameter<double>("rhoScale");
44 
45  etMin_ = config.getParameter<double>("etMin");
46  innerCone_ = config.getParameter<double>("innerCone");
47  outerCone_ = config.getParameter<double>("outerCone");
48  depth_ = config.getParameter<int>("depth");
49  doEtSum_ = config.getParameter<bool>("doEtSum"); //this variable (which I cant change the name of) switches between hcal isolation and H for H/E
50  effectiveAreaBarrel_ = config.getParameter<double>("effectiveAreaBarrel");
51  effectiveAreaEndcap_ = config.getParameter<double>("effectiveAreaEndcap");
52 
53  hcalCfg_.hOverEConeSize = 0.15;
54  hcalCfg_.useTowers = true;
57 
59 
60  produces <reco::RecoEcalCandidateIsolationMap>();
61 }
62 
64  delete hcalHelper_;
65 }
66 
67 
69 
70  // Get the HLT filtered objects
72  iEvent.getByLabel(recoEcalCandidateProducer_, recoEcalCandHandle);
73 
74  edm::Handle<CaloTowerCollection> caloTowersHandle;
75  iEvent.getByLabel(caloTowerProducer_, caloTowersHandle);
76 
77  edm::Handle<double> rhoHandle;
78  double rho = 0.0;
79 
80  if (doRhoCorrection_) {
81  iEvent.getByLabel(rhoProducer_, rhoHandle);
82  rho = *(rhoHandle.product());
83  }
84 
85  if (rho > rhoMax_)
86  rho = rhoMax_;
87 
88  rho = rho*rhoScale_;
89 
90  hcalHelper_->checkSetup(iSetup);
91  hcalHelper_->readEvent(iEvent);
92 
94 
95  for(unsigned int iRecoEcalCand=0; iRecoEcalCand <recoEcalCandHandle->size(); iRecoEcalCand++) {
96 
97  reco::RecoEcalCandidateRef recoEcalCandRef(recoEcalCandHandle, iRecoEcalCand);
98 
99  float isol = 0;
100 
101  std::vector<CaloTowerDetId> towersBehindCluster = hcalHelper_->hcalTowersBehindClusters(*(recoEcalCandRef->superCluster()));
102 
103  if (doEtSum_) { //calculate hcal isolation excluding the towers behind the cluster which will be used for H for H/E
104  EgammaTowerIsolation isolAlgo(outerCone_, innerCone_, etMin_, depth_, caloTowersHandle.product());
105  isol = isolAlgo.getTowerEtSum(&(*recoEcalCandRef), &(towersBehindCluster)); // towersBehindCluster are excluded from the isolation sum
106 
107  if (doRhoCorrection_) {
108  if (fabs(recoEcalCandRef->superCluster()->eta()) < 1.442)
109  isol = isol - rho*effectiveAreaBarrel_;
110  else
111  isol = isol - rho*effectiveAreaEndcap_;
112  }
113  } else { //calcuate H for H/E
114  isol = hcalHelper_->hcalESumDepth1BehindClusters(towersBehindCluster) + hcalHelper_->hcalESumDepth2BehindClusters(towersBehindCluster); //towers beind the cluster are for H for H/E
115  }
116 
117  isoMap.insert(recoEcalCandRef, isol);
118  }
119 
120  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> isolMap(new reco::RecoEcalCandidateIsolationMap(isoMap));
121  iEvent.put(isolMap);
122 }
T getParameter(std::string const &) const
void readEvent(const edm::Event &)
virtual void produce(edm::Event &, const edm::EventSetup &)
Definition: DDAxes.h:10
double hcalESumDepth2BehindClusters(const std::vector< CaloTowerDetId > &towers)
std::vector< CaloTowerDetId > hcalTowersBehindClusters(const reco::SuperCluster &sc)
void checkSetup(const edm::EventSetup &)
double hcalESumDepth1BehindClusters(const std::vector< CaloTowerDetId > &towers)
double getTowerEtSum(const reco::Candidate *, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
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
void insert(const key_type &k, const data_type &v)
insert an association
T const * product() const
Definition: Handle.h:74