CMS 3D CMS Logo

EgammaHcalExtractor.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaHcalExtractor.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matthias Mozer
5 // Institute: IIHE-VUB
6 //=============================================================================
7 //*****************************************************************************
8 //C++ includes
9 #include <vector>
10 #include <functional>
11 
12 //ROOT includes
13 #include <Math/VectorUtil.h>
14 
15 //CMSSW includes
28 
29 using namespace std;
30 
31 using namespace egammaisolation;
32 using namespace reco::isodeposit;
33 
34 EgammaHcalExtractor::EgammaHcalExtractor(const edm::ParameterSet& par, edm::ConsumesCollector& iC)
35  : extRadius_(par.getParameter<double>("extRadius")),
36  intRadius_(par.getParameter<double>("intRadius")),
37  etLow_(par.getParameter<double>("etMin")),
38  hcalRecHitProducerToken_(iC.consumes<HBHERecHitCollection>(par.getParameter<edm::InputTag>("hcalRecHits"))) {}
39 
41 
43  const edm::EventSetup& iSetup,
44  const reco::Candidate& emObject) const {
45  //Get MetaRecHit collection
46  edm::Handle<HBHERecHitCollection> hcalRecHitHandle;
47  iEvent.getByToken(hcalRecHitProducerToken_, hcalRecHitHandle);
48 
49  //Get Calo Geometry
51  iSetup.get<CaloGeometryRecord>().get(pG);
52  const CaloGeometry* caloGeom = pG.product();
54 
55  //Take the SC position
57  math::XYZPoint caloPosition = sc->position();
58  GlobalPoint point(caloPosition.x(), caloPosition.y(), caloPosition.z());
59  // needed: coneSel.select(eta,phi,hits) is not the same!
60 
61  Direction candDir(caloPosition.eta(), caloPosition.phi());
62  reco::IsoDeposit deposit(candDir);
64  double sinTheta = sin(2 * atan(exp(-sc->eta())));
65  deposit.addCandEnergy(sc->energy() * sinTheta);
66 
67  //Compute the HCAL energy behind ECAL
68  coneSel.selectCallback(point, *hcalRecHitHandle, [&](const HBHERecHit& i) {
69  const GlobalPoint& hcalHit_position = caloGeom->getPosition(i.detid());
70  double hcalHit_eta = hcalHit_position.eta();
71  double hcalHit_Et = i.energy() * sin(2 * atan(exp(-hcalHit_eta)));
72  if (hcalHit_Et > etLow_) {
73  deposit.addDeposit(Direction(hcalHit_eta, hcalHit_position.phi()), hcalHit_Et);
74  }
75  });
76 
77  return deposit;
78 }
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
mps_fire.i
i
Definition: mps_fire.py:428
egammaisolation
Definition: EgammaTrackSelector.h:11
EgammaHcalExtractor.h
CaloGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
HBHERecHit
Definition: HBHERecHit.h:13
reco::IsoDeposit::addDeposit
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
Definition: IsoDeposit.cc:19
DetId::Hcal
Definition: DetId.h:28
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
egammaisolation::EgammaHcalExtractor::hcalRecHitProducerToken_
edm::EDGetTokenT< HBHERecHitCollection > hcalRecHitProducerToken_
Definition: EgammaHcalExtractor.h:60
edm::SortedCollection
Definition: SortedCollection.h:49
TrackingGeometry.h
egammaisolation::EgammaHcalExtractor::intRadius_
double intRadius_
Definition: EgammaHcalExtractor.h:57
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
egammaisolation::EgammaHcalExtractor::etLow_
double etLow_
Definition: EgammaHcalExtractor.h:58
edm::Ref< SuperClusterCollection >
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
CaloGeometry
Definition: CaloGeometry.h:21
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
reco::isodeposit
Definition: IsoDeposit.h:31
edm::ESHandle< CaloGeometry >
CaloDualConeSelector::selectCallback
void selectCallback(double eta, double phi, const edm::SortedCollection< T > &inputCollection, std::function< void(const T &)> callback)
Definition: CaloDualConeSelector.h:22
Point3DBase< float, GlobalTag >
CaloGeometryRecord.h
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition: ParameterSet.h:47
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
egammaisolation::EgammaHcalExtractor::~EgammaHcalExtractor
~EgammaHcalExtractor() override
Definition: EgammaHcalExtractor.cc:40
HcalDetId.h
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
iEvent
int iEvent
Definition: GenABIO.cc:224
egammaisolation::EgammaHcalExtractor::deposit
reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const override
Definition: EgammaHcalExtractor.h:45
edm::EventSetup
Definition: EventSetup.h:57
CaloDualConeSelector< HBHERecHit >
get
#define get
reco::Candidate
Definition: Candidate.h:27
reco::IsoDeposit::addCandEnergy
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:132
std
Definition: JetResolutionObject.h:76
SuperClusterFwd.h
reco::isodeposit::Direction
Definition: IsoDepositDirection.h:19
EgammaRecHitIsolation.h
SuperCluster.h
GlobalVector.h
reco::IsoDeposit
Definition: IsoDeposit.h:49
CaloDualConeSelector.h
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
edm::Event
Definition: Event.h:73
GlobalPoint.h
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
reco::IsoDeposit::setVeto
void setVeto(const Veto &aVeto)
Set veto.
Definition: IsoDeposit.h:82
egammaisolation::EgammaHcalExtractor::extRadius_
double extRadius_
Definition: EgammaHcalExtractor.h:56