CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
29 
30 using namespace std;
31 
32 using namespace egammaisolation;
33 using namespace reco::isodeposit;
34 
35 EgammaHcalExtractor::EgammaHcalExtractor ( const edm::ParameterSet& par ) :
36  extRadius_(par.getParameter<double>("extRadius")),
37  intRadius_(par.getParameter<double>("intRadius")),
38  etLow_(par.getParameter<double>("etMin")),
39  hcalRecHitProducer_(par.getParameter<edm::InputTag>("hcalRecHits")) {
40 }
41 
43 
45  const edm::EventSetup & iSetup, const reco::Candidate &emObject ) const {
46 
47  //Get MetaRecHit collection
48  edm::Handle<HBHERecHitCollection> hcalRecHitHandle;
49  iEvent.getByLabel(hcalRecHitProducer_, hcalRecHitHandle);
50  HBHERecHitMetaCollection mhbhe = HBHERecHitMetaCollection(*hcalRecHitHandle);
51 
52  //Get Calo Geometry
54  iSetup.get<CaloGeometryRecord>().get(pG);
55  const CaloGeometry* caloGeom = pG.product();
57 
58  //Take the SC position
60  math::XYZPoint caloPosition = sc->position();
61  GlobalPoint point(caloPosition.x(), caloPosition.y() , caloPosition.z());
62  // needed: coneSel.select(eta,phi,hits) is not the same!
63 
64  Direction candDir(caloPosition.eta(), caloPosition.phi());
65  reco::IsoDeposit deposit( candDir );
66  deposit.setVeto( reco::IsoDeposit::Veto(candDir, intRadius_) );
67  double sinTheta = sin(2*atan(exp(-sc->eta())));
68  deposit.addCandEnergy(sc->energy()*sinTheta);
69 
70  //Compute the HCAL energy behind ECAL
71  std::auto_ptr<CaloRecHitMetaCollectionV> chosen = coneSel.select(point, mhbhe);
72  for (CaloRecHitMetaCollectionV::const_iterator i = chosen->begin (), ed = chosen->end() ;
73  i!= ed; ++i) {
74  const GlobalPoint & hcalHit_position = caloGeom->getPosition(i->detid());
75  double hcalHit_eta = hcalHit_position.eta();
76  double hcalHit_Et = i->energy()*sin(2*atan(exp(-hcalHit_eta)));
77  if ( hcalHit_Et > etLow_) {
78  deposit.addDeposit( Direction(hcalHit_eta, hcalHit_position.phi()), hcalHit_Et);
79  }
80  }
81 
82  return deposit;
83 }
int i
Definition: DBlmapReader.cc:9
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
int iEvent
Definition: GenABIO.cc:243
std::auto_ptr< CaloRecHitMetaCollectionV > select(double eta, double phi, const CaloRecHitMetaCollectionV &inputCollection)
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:68
SimpleCaloRecHitMetaCollection< HBHERecHitCollection > HBHERecHitMetaCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
virtual reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
T eta() const
Definition: PV3DBase.h:76
T get() const
get a component
Definition: Candidate.h:219
*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