CMS 3D CMS Logo

EgammaTowerExtractor.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaTowerExtractor.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matthias Mozer
5 // Institute: IIHE-VUB
6 //=============================================================================
7 //*****************************************************************************
8 //C++ includes
9 #include <vector>
10 #include <functional>
11 #include <cmath>
12 
13 //ROOT includes
14 #include <Math/VectorUtil.h>
15 
16 //CMSSW includes
24 
25 using namespace ROOT::Math::VectorUtil;
26 
27 using namespace egammaisolation;
28 using namespace reco::isodeposit;
29 
30 EgammaTowerExtractor::~EgammaTowerExtractor() {}
31 
32 reco::IsoDeposit EgammaTowerExtractor::deposit(const edm::Event &iEvent,
33  const edm::EventSetup &iSetup,
34  const reco::Candidate &emObject) const {
35  edm::Handle<CaloTowerCollection> towercollectionH;
36  iEvent.getByToken(caloTowerToken, towercollectionH);
37 
38  //Take the SC position
40  math::XYZPoint caloPosition = sc->position();
41 
42  Direction candDir(caloPosition.eta(), caloPosition.phi());
43  reco::IsoDeposit deposit(candDir);
44  deposit.setVeto(reco::IsoDeposit::Veto(candDir, intRadius_));
45  deposit.addCandEnergy(sc->energy() * sin(2 * atan(exp(-sc->eta()))));
46 
47  //loop over tracks
48  for (CaloTowerCollection::const_iterator trItr = towercollectionH->begin(), trEnd = towercollectionH->end();
49  trItr != trEnd;
50  ++trItr) {
51  double depEt = 0;
52  //the hcal can be seperated into different depths
53  //currently it is setup to check that the depth is valid in constructor
54  //if the depth is not valid it fails gracefully
55  //small bug fix, hadEnergyHeInnerLater returns zero for towers which are only depth 1
56  //but we want Depth1 isolation to include these so we have to manually check for this
57  if (depth_ == AllDepths)
58  depEt = trItr->hadEt();
59  else if (depth_ == Depth1)
60  depEt = trItr->ietaAbs() < 18 || trItr->ietaAbs() > 29
61  ? trItr->hadEt()
62  : trItr->hadEnergyHeInnerLayer() * sin(trItr->p4().theta());
63  else if (depth_ == Depth2)
64  depEt = trItr->hadEnergyHeOuterLayer() * sin(trItr->p4().theta());
65 
66  if (depEt < etLow_)
67  continue;
68 
69  Direction towerDir(trItr->eta(), trItr->phi());
70  double dR2 = candDir.deltaR2(towerDir);
71 
72  if (dR2 < extRadius2_) {
73  deposit.addDeposit(towerDir, depEt);
74  }
75 
76  } //end loop over tracks
77 
78  return deposit;
79 }
edm::SortedCollection< CaloTower >::const_iterator
std::vector< CaloTower >::const_iterator const_iterator
Definition: SortedCollection.h:80
CaloTower.h
egammaisolation
Definition: EgammaTrackSelector.h:11
reco::Candidate::get
T get() const
get a component
Definition: Candidate.h:221
reco::IsoDeposit::Veto
Definition: IsoDeposit.h:59
edm::Handle
Definition: AssociativeIterator.h:50
RecoCandidate.h
edm::Ref< SuperClusterCollection >
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
reco::isodeposit::Direction::deltaR2
double deltaR2(const Direction &dir2) const
Definition: IsoDepositDirection.h:46
reco::isodeposit
Definition: IsoDeposit.h:31
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
reco::Candidate
Definition: Candidate.h:27
SuperClusterFwd.h
reco::isodeposit::Direction
Definition: IsoDepositDirection.h:19
SuperCluster.h
GlobalVector.h
reco::IsoDeposit
Definition: IsoDeposit.h:49
EgammaTowerExtractor.h
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
edm::Event
Definition: Event.h:73
GlobalPoint.h