CMS 3D CMS Logo

CaloJet.cc
Go to the documentation of this file.
1 // CaloJet.cc
2 // Fedor Ratnikov UMd
3 #include <sstream>
4 
7 
8 //Own header file
10 
11 using namespace reco;
12 
13 CaloJet::CaloJet(const LorentzVector& fP4, const Point& fVertex, const Specific& fSpecific)
14  : Jet(fP4, fVertex), m_specific(fSpecific) {}
15 
17  const Point& fVertex,
18  const Specific& fSpecific,
19  const Jet::Constituents& fConstituents)
20  : Jet(fP4, fVertex, fConstituents), m_specific(fSpecific) {}
21 
22 CaloJet::CaloJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents)
23  : Jet(fP4, Point(0, 0, 0), fConstituents), m_specific(fSpecific) {}
24 
26 //float CaloJet::physicsEtaQuick (float fZVertex) const {
27 // return Jet::physicsEta (fZVertex, eta());
28 //}
29 
31 //float CaloJet::physicsEtaDetailed (float fZVertex) const {
32 // Jet::LorentzVector correctedMomentum;
33 // std::vector<const Candidate*> towers = getJetConstituentsQuick ();
34 // for (unsigned i = 0; i < towers.size(); ++i) {
35 // const Candidate* c = towers[i];
36 // double etaRef = Jet::physicsEta (fZVertex, c->eta());
37 // math::PtEtaPhiMLorentzVectorD p4 (c->p()/cosh(etaRef), etaRef, c->phi(), c->mass());
38 // correctedMomentum += p4;
39 // }
40 // return correctedMomentum.eta();
41 //}
42 
44 //deprecated, with 3d vertex correction not clear anymore!
45 //CaloJet::LorentzVector CaloJet::physicsP4 (float fZVertex) const {
46 // double physicsEta = Jet::physicsEta (fZVertex, eta());
47 // math::PtEtaPhiMLorentzVectorD p4 (p()/cosh(physicsEta), physicsEta, phi(), mass());
48 // return CaloJet::LorentzVector (p4);
49 //}
50 
52  return Jet::physicsP4(vertex, *this, this->vertex());
53 }
54 
56 
57 CaloTowerPtr CaloJet::getCaloConstituent(unsigned fIndex) const {
58  Constituent dau = daughterPtr(fIndex);
59 
60  if (dau.isNonnull() && dau.isAvailable()) {
61  const CaloTower* towerCandidate = dynamic_cast<const CaloTower*>(dau.get());
62 
63  if (towerCandidate) {
64  // return towerCandidate;
65  // 086 Ptr(ProductID const& productID, T const* item, key_type item_key) :
66  return edm::Ptr<CaloTower>(dau.id(), towerCandidate, dau.key());
67  } else {
68  throw cms::Exception("Invalid Constituent") << "CaloJet constituent is not of CaloTowere type";
69  }
70 
71  }
72 
73  else {
74  return CaloTowerPtr();
75  }
76 }
77 
78 std::vector<CaloTowerPtr> CaloJet::getCaloConstituents() const {
79  std::vector<CaloTowerPtr> result;
80  for (unsigned i = 0; i < numberOfDaughters(); i++)
81  result.push_back(getCaloConstituent(i));
82  return result;
83 }
84 
85 CaloJet* CaloJet::clone() const { return new CaloJet(*this); }
86 
87 bool CaloJet::overlap(const Candidate&) const { return false; }
88 
90  std::ostringstream out;
91  out << Jet::print() // generic jet info
92  << " CaloJet specific:" << std::endl
93  << " energy fractions em/had: " << emEnergyFraction() << '/' << energyFractionHadronic() << std::endl
94  << " em energy in EB/EE/HF: " << emEnergyInEB() << '/' << emEnergyInEE() << '/' << emEnergyInHF()
95  << std::endl
96  << " had energy in HB/HO/HE/HF: " << hadEnergyInHB() << '/' << hadEnergyInHO() << '/' << hadEnergyInHE()
97  << '/' << hadEnergyInHF() << std::endl
98  << " constituent towers area: " << towersArea() << std::endl;
99  out << " Towers:" << std::endl;
100  std::vector<CaloTowerPtr> towers = getCaloConstituents();
101  for (unsigned i = 0; i < towers.size(); i++) {
102  if (towers[i].get()) {
103  out << " #" << i << " " << *(towers[i]) << std::endl;
104  } else {
105  out << " #" << i << " tower is not available in the event" << std::endl;
106  }
107  }
108  return out.str();
109 }
110 
111 //----------------------------------------------------------
112 // here are methods extracting information from constituents
113 //----------------------------------------------------------
114 
115 std::vector<CaloTowerDetId> CaloJet::getTowerIndices() const {
116  std::vector<CaloTowerDetId> result;
117  std::vector<CaloTowerPtr> towers = getCaloConstituents();
118  for (unsigned i = 0; i < towers.size(); ++i) {
119  result.push_back(towers[i]->id());
120  }
121  return result;
122 }
HLT_FULL_cff.towers
towers
Definition: HLT_FULL_cff.py:36428
reco::CaloJet
Jets made from CaloTowers.
Definition: CaloJet.h:27
CaloJet.h
mps_fire.i
i
Definition: mps_fire.py:428
reco::Jet::Constituents
std::vector< Constituent > Constituents
Definition: Jet.h:23
reco::CaloJet::energyFractionHadronic
float energyFractionHadronic() const
Definition: CaloJet.h:95
reco::CaloJet::getCaloConstituent
virtual CaloTowerPtr getCaloConstituent(unsigned fIndex) const
Physics Eta (loop over constituents)
Definition: CaloJet.cc:57
reco::CaloJet::print
std::string print() const override
Print object.
Definition: CaloJet.cc:89
reco::CaloJet::CaloJet
CaloJet()
Definition: CaloJet.h:74
reco::CaloJet::hadEnergyInHF
float hadEnergyInHF() const
Definition: CaloJet.h:105
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::CaloJet::hadEnergyInHB
float hadEnergyInHB() const
Definition: CaloJet.h:99
reco::CaloJet::emEnergyInEE
float emEnergyInEE() const
Definition: CaloJet.h:109
reco::CaloJet::physicsP4
LorentzVector physicsP4(const Particle::Point &vertex) const
Physics Eta (use jet Z and kinematics only)
Definition: CaloJet.cc:51
reco::CaloJet::hadEnergyInHE
float hadEnergyInHE() const
Definition: CaloJet.h:103
Jet
Definition: Jet.py:1
reco::CompositePtrCandidate::dau
daughters dau
collection of references to daughters
Definition: CompositePtrCandidate.h:79
reco::Jet::print
virtual std::string print() const
Print object.
reco::CaloJet::emEnergyInEB
float emEnergyInEB() const
Definition: CaloJet.h:107
reco::CaloJet::hadEnergyInHO
float hadEnergyInHO() const
Definition: CaloJet.h:101
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
reco::LeafCandidate::get
T get() const
get a component
Definition: LeafCandidate.h:239
reco::CaloJet::towersArea
float towersArea() const
Definition: CaloJet.h:113
CaloTower
Definition: CaloTower.h:26
reco::CaloJet::getCaloConstituents
virtual std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
Definition: CaloJet.cc:78
reco::CaloJet::detectorP4
LorentzVector detectorP4() const
detector p4 for full 3d vertex correction.
Definition: CaloJet.cc:55
reco::CaloJet::clone
CaloJet * clone() const override
Polymorphic clone.
Definition: CaloJet.cc:85
CaloTowerPtr
edm::Ptr< CaloTower > CaloTowerPtr
Definition: CaloTowerDefs.h:14
reco::LeafCandidate::vertex
const Point & vertex() const override
vertex position (overwritten by PF...)
Definition: LeafCandidate.h:165
reco::CompositePtrCandidate::numberOfDaughters
size_t numberOfDaughters() const override
number of daughters
Definition: CompositePtrCandidate.cc:18
reco::CaloJet::overlap
bool overlap(const Candidate &) const override
Polymorphic overlap.
Definition: CaloJet.cc:87
edm::Ptr
Definition: AssociationVector.h:31
reco::Candidate
Definition: Candidate.h:27
reco::Jet::detectorP4
static Candidate::LorentzVector detectorP4(const Candidate::Point &vertex, const Candidate &inParticle)
Exception
Definition: hltDiff.cc:246
Exception.h
reco::CaloJet::getTowerIndices
std::vector< CaloTowerDetId > getTowerIndices() const
CaloTowers indexes.
Definition: CaloJet.cc:115
reco::Jet::physicsP4
static Candidate::LorentzVector physicsP4(const Candidate::Point &newVertex, const Candidate &inParticle, const Candidate::Point &oldVertex=Candidate::Point(0, 0, 0))
reco::Particle::Point
math::XYZPoint Point
point in the space
Definition: Particle.h:25
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
mps_fire.result
result
Definition: mps_fire.py:311
RecoCaloTowerCandidate.h
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
reco::CaloJet::Specific
Definition: CaloJet.h:32
reco::CaloJet::emEnergyInHF
float emEnergyInHF() const
Definition: CaloJet.h:111
reco::CaloJet::emEnergyFraction
float emEnergyFraction() const
Definition: CaloJet.h:97
reco::CompositePtrCandidate::daughterPtr
virtual CandidatePtr daughterPtr(size_type i) const
reference to daughter at given position
Definition: CompositePtrCandidate.h:61