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 
33 
34 #include <Math/VectorUtil.h>
35 
36 #include <vector>
37 #include <functional>
38 
39 namespace egammaisolation {
40 
42  public:
45 
46  ~EgammaHcalExtractor() override;
47 
48  void fillVetos(const edm::Event& ev, const edm::EventSetup& evSetup, const reco::TrackCollection& tracks) override {
49  }
51  const edm::EventSetup& evSetup,
52  const reco::Track& track) const override {
53  throw cms::Exception("Configuration Error")
54  << "This extractor " << (typeid(this).name()) << " is not made for tracks";
55  }
57  const edm::EventSetup& evSetup,
58  const reco::Candidate& c) const override;
59 
60  private:
61  double extRadius_;
62  double intRadius_;
63  double etLow_;
64 
66  };
67 } // namespace egammaisolation
68 
72 
73 using namespace std;
74 
75 using namespace egammaisolation;
76 using namespace reco::isodeposit;
77 
78 EgammaHcalExtractor::EgammaHcalExtractor(const edm::ParameterSet& par, edm::ConsumesCollector& iC)
79  : extRadius_(par.getParameter<double>("extRadius")),
80  intRadius_(par.getParameter<double>("intRadius")),
81  etLow_(par.getParameter<double>("etMin")),
82  hcalRecHitProducerToken_(iC.consumes<HBHERecHitCollection>(par.getParameter<edm::InputTag>("hcalRecHits"))) {}
83 
85 
87  const edm::EventSetup& iSetup,
88  const reco::Candidate& emObject) const {
89  //Get MetaRecHit collection
90  auto const& hcalRecHits = iEvent.get(hcalRecHitProducerToken_);
91 
92  //Get Calo Geometry
94  iSetup.get<CaloGeometryRecord>().get(pG);
95  const CaloGeometry* caloGeom = pG.product();
97 
98  //Take the SC position
100  math::XYZPoint caloPosition = sc->position();
101  GlobalPoint point(caloPosition.x(), caloPosition.y(), caloPosition.z());
102  // needed: coneSel.select(eta,phi,hits) is not the same!
103 
104  Direction candDir(caloPosition.eta(), caloPosition.phi());
105  reco::IsoDeposit deposit(candDir);
107  double sinTheta = sin(2 * atan(exp(-sc->eta())));
108  deposit.addCandEnergy(sc->energy() * sinTheta);
109 
110  //Compute the HCAL energy behind ECAL
111  coneSel.selectCallback(point, hcalRecHits, [&](const HBHERecHit& i) {
112  const GlobalPoint& hcalHit_position = caloGeom->getPosition(i.detid());
113  double hcalHit_eta = hcalHit_position.eta();
114  double hcalHit_Et = i.energy() * sin(2 * atan(exp(-hcalHit_eta)));
115  if (hcalHit_Et > etLow_) {
116  deposit.addDeposit(Direction(hcalHit_eta, hcalHit_position.phi()), hcalHit_Et);
117  }
118  });
119 
120  return deposit;
121 }
egammaisolation::EgammaHcalExtractor
Definition: EgammaHcalExtractor.cc:41
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
ESHandle.h
egammaisolation
Definition: EgammaTrackSelector.h:11
CaloGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
edm::EDGetTokenT
Definition: EDGetToken.h:33
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:89281
egammaisolation::EgammaHcalExtractor::hcalRecHitProducerToken_
edm::EDGetTokenT< HBHERecHitCollection > hcalRecHitProducerToken_
Definition: EgammaHcalExtractor.cc:65
edm::SortedCollection
Definition: SortedCollection.h:49
TrackingGeometry.h
egammaisolation::EgammaHcalExtractor::intRadius_
double intRadius_
Definition: EgammaHcalExtractor.cc:62
reco::Candidate::get
T get() const
get a component
Definition: Candidate.h:221
reco::IsoDeposit::Veto
Definition: IsoDeposit.h:59
RecoCandidate.h
egammaisolation::EgammaHcalExtractor::etLow_
double etLow_
Definition: EgammaHcalExtractor.cc:63
edm::Ref< SuperClusterCollection >
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
MakerMacros.h
CaloGeometry
Definition: CaloGeometry.h:21
Track.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
TrackFwd.h
reco::isodeposit
Definition: IsoDeposit.h:31
reco::Track
Definition: Track.h:27
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 >
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
IsoDeposit.h
CaloGeometryRecord.h
egammaisolation::EgammaHcalExtractor::EgammaHcalExtractor
EgammaHcalExtractor(const edm::ParameterSet &par, edm::ConsumesCollector &&iC)
Definition: EgammaHcalExtractor.cc:43
IsoDepositExtractor.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:84
Event.h
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:159
edmplugin::PluginFactory
Definition: PluginFactory.h:34
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.cc:50
edm::EventSetup
Definition: EventSetup.h:58
CaloDualConeSelector< HBHERecHit >
get
#define get
eleHcalExtractorBlocks_cff.hcalRecHits
hcalRecHits
Definition: eleHcalExtractorBlocks_cff.py:8
InputTag.h
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
egammaisolation::EgammaHcalExtractor::fillVetos
void fillVetos(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &tracks) override
Definition: EgammaHcalExtractor.cc:48
SuperClusterFwd.h
reco::isodeposit::Direction
Definition: IsoDepositDirection.h:19
EgammaRecHitIsolation.h
SuperCluster.h
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
Exception
Definition: hltDiff.cc:245
IsoDepositExtractorFactory.h
CaloGeometry.h
GlobalVector.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EventSetup.h
reco::IsoDeposit
Definition: IsoDeposit.h:49
HcalRecHitCollections.h
ConsumesCollector.h
Candidate.h
CaloDualConeSelector.h
ParameterSet.h
reco::isodeposit::IsoDepositExtractor
Definition: IsoDepositExtractor.h:24
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
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
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
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.cc:61