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 
67  };
68 } // namespace egammaisolation
69 
73 
74 using namespace std;
75 
76 using namespace egammaisolation;
77 using namespace reco::isodeposit;
78 
79 EgammaHcalExtractor::EgammaHcalExtractor(const edm::ParameterSet& par, edm::ConsumesCollector& iC)
80  : extRadius_(par.getParameter<double>("extRadius")),
81  intRadius_(par.getParameter<double>("intRadius")),
82  etLow_(par.getParameter<double>("etMin")),
83  hcalRecHitProducerToken_(iC.consumes<HBHERecHitCollection>(par.getParameter<edm::InputTag>("hcalRecHits"))),
84  geometryToken_(iC.esConsumes()) {}
85 
87 
89  const edm::EventSetup& iSetup,
90  const reco::Candidate& emObject) const {
91  //Get MetaRecHit collection
92  auto const& hcalRecHits = iEvent.get(hcalRecHitProducerToken_);
93 
94  //Get Calo Geometry
95  const CaloGeometry* caloGeom = &iSetup.getData(geometryToken_);
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 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
void setVeto(const Veto &aVeto)
Set veto.
Definition: IsoDeposit.h:82
T get() const
get a component
Definition: Candidate.h:221
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T eta() const
Definition: PV3DBase.h:73
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::EDGetTokenT< HBHERecHitCollection > hcalRecHitProducerToken_
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
Definition: IsoDeposit.cc:19
reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const override
int iEvent
Definition: GenABIO.cc:224
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:132
bool getData(T &iHolder) const
Definition: EventSetup.h:122
EgammaHcalExtractor(const edm::ParameterSet &par, edm::ConsumesCollector &&iC)
auto const & tracks
cannot be loose
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
void selectCallback(double eta, double phi, const edm::SortedCollection< T > &inputCollection, std::function< void(const T &)> callback)
HLT enums.
#define DEFINE_EDM_PLUGIN(factory, type, name)
void fillVetos(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &tracks) override
*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