CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
JetMaker Namespace Reference

Make Jets from protoobjects. More...

Functions

HcalSubdetector hcalSubdetector (int fEta)
 converts eta to the corresponding HCAL subdetector. More...
 
bool makeSpecific (const JetReco::InputCollection &fConstituents, const CaloSubdetectorGeometry &fTowerGeometry, reco::CaloJet::Specific *fJetSpecific)
 Make CaloJet specifics. Assumes ProtoJet is made from CaloTowerCandidates. More...
 
bool makeSpecific (const JetReco::InputCollection &fConstituents, reco::PFJet::Specific *fJetSpecific)
 Make PFlowJet specifics. Assumes ProtoJet is made from ParticleFlowCandidates. More...
 
bool makeSpecific (const JetReco::InputCollection &fConstituents, reco::GenJet::Specific *fJetSpecific)
 Make GenJet specifics. Assumes ProtoJet is made from HepMCCandidate. More...
 

Detailed Description

Make Jets from protoobjects.

Function Documentation

HcalSubdetector JetMaker::hcalSubdetector ( int  fEta)

converts eta to the corresponding HCAL subdetector.

Definition at line 246 of file JetMaker.cc.

References funct::abs(), eta(), HcalBarrel, HcalEmpty, HcalEndcap, HcalForward, HcalTopology::lastHBRing(), HcalTopology::lastHERing(), HcalTopology::lastHFRing(), and HcalTopologyMode::LHC.

Referenced by makeSpecific().

246  {
247  // FIXME for SLHC
248  static const HcalTopology topology(HcalTopologyMode::LHC, 2, 3);
249  int eta = std::abs (fEta);
250  if (eta <= topology.lastHBRing()) return HcalBarrel;
251  else if (eta <= topology.lastHERing()) return HcalEndcap;
252  else if (eta <= topology.lastHFRing()) return HcalForward;
253  return HcalEmpty;
254 }
T eta() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool JetMaker::makeSpecific ( const JetReco::InputCollection fConstituents,
const CaloSubdetectorGeometry fTowerGeometry,
reco::CaloJet::Specific fJetSpecific 
)

Make CaloJet specifics. Assumes ProtoJet is made from CaloTowerCandidates.

Definition at line 20 of file JetMaker.cc.

References dtNoiseDBValidation_cfg::cerr, dPhi(), CaloTower::emEnergy(), reco::LeafCandidate::energy(), geometry, reco::Candidate::get(), CaloCellGeometry::getCorners(), CaloSubdetectorGeometry::getGeometry(), CaloTower::hadEnergy(), HcalBarrel, HcalEndcap, HcalForward, hcalSubdetector(), CaloTower::id(), CaloTowerDetId::ieta(), reco::CaloJet::Specific::mEmEnergyInEB, reco::CaloJet::Specific::mEmEnergyInEE, reco::CaloJet::Specific::mEmEnergyInHF, reco::CaloJet::Specific::mEnergyFractionEm, reco::CaloJet::Specific::mEnergyFractionHadronic, reco::CaloJet::Specific::mHadEnergyInHB, reco::CaloJet::Specific::mHadEnergyInHE, reco::CaloJet::Specific::mHadEnergyInHF, reco::CaloJet::Specific::mHadEnergyInHO, reco::CaloJet::Specific::mMaxEInEmTowers, reco::CaloJet::Specific::mMaxEInHadTowers, reco::CaloJet::Specific::mTowersArea, CaloTower::outerEnergy(), and python.multivaluedict::sort().

Referenced by PFRootEventManager::reconstructGenJets(), and PFRootEventManager::reconstructPFJets().

22  {
23  if (!fJetSpecific) return false;
24 
25  // 1.- Loop over the tower Ids,
26  // 2.- Get the corresponding CaloTower
27  // 3.- Calculate the different CaloJet specific quantities
28  vector<double> eECal_i;
29  vector<double> eHCal_i;
30  double eInHad = 0.;
31  double eInEm = 0.;
32  double eInHO = 0.;
33  double eInHB = 0.;
34  double eInHE = 0.;
35  double eHadInHF = 0.;
36  double eEmInHF = 0.;
37  double eInEB = 0.;
38  double eInEE = 0.;
39  double jetArea = 0.;
40 
41  for (JetReco::InputCollection::const_iterator towerCand = fTowers.begin(); towerCand != fTowers.end(); ++towerCand) {
42  const Candidate* candidate = towerCand->get ();
43  if (candidate) {
44  const CaloTower* tower = dynamic_cast<const CaloTower*> (candidate);
45  if (tower) {
46  //Array of energy in EM Towers:
47  eECal_i.push_back(tower->emEnergy());
48  eInEm += tower->emEnergy();
49  //Array of energy in HCAL Towers:
50  eHCal_i.push_back(tower->hadEnergy());
51  eInHad += tower->hadEnergy();
52 
53  // figure out contributions
54  switch (JetMaker::hcalSubdetector (tower->id().ieta())) {
55  case HcalBarrel:
56  eInHB += tower->hadEnergy();
57  eInHO += tower->outerEnergy();
58  eInEB += tower->emEnergy();
59  break;
60  case HcalEndcap:
61  eInHE += tower->hadEnergy();
62  eInEE += tower->emEnergy();
63  break;
64  case HcalForward:
65  eHadInHF += tower->hadEnergy();
66  eEmInHF += tower->emEnergy();
67  break;
68  default:
69  break;
70  }
71  // get area of the tower (++ minus --)
72  if ( tower->energy() > 0 ) {
73  const CaloCellGeometry* geometry = fTowerGeometry.getGeometry(tower->id());
74  if (geometry) {
75  float dEta = fabs (geometry->getCorners() [0].eta() - geometry->getCorners() [2].eta());
76  float dPhi = fabs (geometry->getCorners() [0].phi() - geometry->getCorners() [2].phi());
77  jetArea += dEta * dPhi;
78  }
79  }
80  else {
81  std::cerr << "JetMaker::makeSpecific (CaloJet)-> Geometry for cell " << tower->id() << " can not be found. Ignoring cell" << std::endl;
82  }
83  }
84  else {
85  std::cerr << "JetMaker::makeSpecific (CaloJet)-> Constituent is not of CaloTower type" << std::endl;
86  }
87  }
88  else {
89  std::cerr << "JetMaker::makeSpecific (CaloJet)-> Referred constituent is not available in the event" << std::endl;
90  }
91  }
92  double towerEnergy = eInHad + eInEm;
93  fJetSpecific->mHadEnergyInHO = eInHO;
94  fJetSpecific->mHadEnergyInHB = eInHB;
95  fJetSpecific->mHadEnergyInHE = eInHE;
96  fJetSpecific->mHadEnergyInHF = eHadInHF;
97  fJetSpecific->mEmEnergyInHF = eEmInHF;
98  fJetSpecific->mEmEnergyInEB = eInEB;
99  fJetSpecific->mEmEnergyInEE = eInEE;
100  if (towerEnergy > 0) {
101  fJetSpecific->mEnergyFractionHadronic = eInHad / towerEnergy;
102  fJetSpecific->mEnergyFractionEm = eInEm / towerEnergy;
103  }
104  else { // HO only jet
105  fJetSpecific->mEnergyFractionHadronic = 1.;
106  fJetSpecific->mEnergyFractionEm = 0.;
107  }
108  fJetSpecific->mTowersArea = jetArea;
109  fJetSpecific->mMaxEInEmTowers = 0;
110  fJetSpecific->mMaxEInHadTowers = 0;
111 
112  //Sort the arrays
113  sort(eECal_i.begin(), eECal_i.end(), greater<double>());
114  sort(eHCal_i.begin(), eHCal_i.end(), greater<double>());
115 
116  if (!fTowers.empty ()) {
117  //Highest value in the array is the first element of the array
118  fJetSpecific->mMaxEInEmTowers = eECal_i.front();
119  fJetSpecific->mMaxEInHadTowers = eHCal_i.front();
120 
121  }
122  return true;
123 }
float mMaxEInEmTowers
Maximum energy in EM towers.
Definition: CaloJet.h:53
virtual double energy() const GCC11_FINAL
energy
float mEmEnergyInHF
Em energy in HF.
Definition: CaloJet.h:69
float mEnergyFractionHadronic
Hadronic energy fraction.
Definition: CaloJet.h:71
float mEmEnergyInEB
Em energy in EB.
Definition: CaloJet.h:65
HcalSubdetector hcalSubdetector(int fEta)
converts eta to the corresponding HCAL subdetector.
Definition: JetMaker.cc:246
float mHadEnergyInHB
Hadronic energy in HB.
Definition: CaloJet.h:59
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
double emEnergy() const
Definition: CaloTower.h:77
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
float mEnergyFractionEm
Em energy fraction.
Definition: CaloJet.h:73
float mHadEnergyInHF
Hadronic energy in HF.
Definition: CaloJet.h:61
float mMaxEInHadTowers
Maximum energy in HCAL towers.
Definition: CaloJet.h:55
double hadEnergy() const
Definition: CaloTower.h:78
CaloTowerDetId id() const
Definition: CaloTower.h:70
float mHadEnergyInHO
Hadronic nergy fraction in HO.
Definition: CaloJet.h:57
ESHandle< TrackerGeometry > geometry
T get() const
get a component
Definition: Candidate.h:219
float mTowersArea
Area of contributing CaloTowers.
Definition: CaloJet.h:75
int ieta() const
get the tower ieta
float mEmEnergyInEE
Em energy in EE.
Definition: CaloJet.h:67
double outerEnergy() const
Definition: CaloTower.h:79
virtual const CornersVec & getCorners() const =0
Returns the corner points of this cell&#39;s volume.
float mHadEnergyInHE
Hadronic energy in HE.
Definition: CaloJet.h:63
bool JetMaker::makeSpecific ( const JetReco::InputCollection fConstituents,
reco::PFJet::Specific fJetSpecific 
)

Make PFlowJet specifics. Assumes ProtoJet is made from ParticleFlowCandidates.

@@ PFJET *************************

Definition at line 126 of file JetMaker.cc.

References dtNoiseDBValidation_cfg::cerr, alignCSCRings::e, reco::LeafCandidate::energy(), reco::Candidate::get(), h, reco::PFJet::Specific::mChargedEmEnergy, reco::PFJet::Specific::mChargedHadronEnergy, reco::PFJet::Specific::mChargedMuEnergy, reco::PFJet::Specific::mChargedMultiplicity, reco::PFJet::Specific::mMuonMultiplicity, reco::PFJet::Specific::mNeutralEmEnergy, reco::PFJet::Specific::mNeutralHadronEnergy, reco::PFJet::Specific::mNeutralMultiplicity, RPCpg::mu, and reco::PFCandidate::particleId().

127  {
128  if (!fJetSpecific) return false;
129 
130  // 1.- Loop over PFCandidates,
131  // 2.- Get the corresponding PFCandidate
132  // 3.- Calculate the different PFJet specific quantities
133 
134  float chargedHadronEnergy=0.;
135  float neutralHadronEnergy=0.;
136  float chargedEmEnergy=0.;
137  float neutralEmEnergy=0.;
138  float chargedMuEnergy=0.;
139  int chargedMultiplicity=0;
140  int neutralMultiplicity=0;
141  int muonMultiplicity=0;
142 
143  JetReco::InputCollection::const_iterator constituent = fPFCandidates.begin();
144  for (; constituent != fPFCandidates.end(); ++constituent) {
145  const Candidate* candidate = constituent->get ();
146  if (candidate) {
147  const PFCandidate* pfCand = dynamic_cast<const PFCandidate*> (candidate);
148  if (pfCand) {
149  switch ( PFCandidate::ParticleType (pfCand->particleId())) {
150  case PFCandidate::h: // charged hadron
151  chargedHadronEnergy += pfCand->energy();
152  chargedMultiplicity++;
153  break;
154 
155  case PFCandidate::e: // electron
156  chargedEmEnergy += pfCand->energy();
157  chargedMultiplicity++;
158  break;
159 
160  case PFCandidate::mu: // muon
161  chargedMuEnergy += pfCand->energy();
162  chargedMultiplicity++;
163  muonMultiplicity++;
164  break;
165 
166  case PFCandidate::gamma: // photon
167  case PFCandidate::egamma_HF : // electromagnetic in HF
168  neutralEmEnergy += pfCand->energy();
169  neutralMultiplicity++;
170  break;
171 
172  case PFCandidate::h0 : // neutral hadron
173  case PFCandidate::h_HF : // hadron in HF
174  neutralHadronEnergy += pfCand->energy();
175  neutralMultiplicity++;
176  break;
177 
178  default:
179  std::cerr << "JetMaker::makeSpecific (PFJetJet)-> Unknown PFCandidate::ParticleType: " << pfCand->particleId() << " is ignored" << std::endl;
180  break;
181  }
182  }
183  else {
184  std::cerr << "JetMaker::makeSpecific (PFJetJet)-> Referred constituent is not PFCandidate" << std::endl;
185  }
186  }
187  else {
188  std::cerr << "JetMaker::makeSpecific (PFJetJet)-> Referred constituent is not available in the event" << std::endl;
189  }
190  }
191  fJetSpecific->mChargedHadronEnergy=chargedHadronEnergy;
192  fJetSpecific->mNeutralHadronEnergy= neutralHadronEnergy;
193  fJetSpecific->mChargedEmEnergy=chargedEmEnergy;
194  fJetSpecific->mChargedMuEnergy=chargedMuEnergy;
195  fJetSpecific->mNeutralEmEnergy=neutralEmEnergy;
196  fJetSpecific->mChargedMultiplicity=chargedMultiplicity;
197  fJetSpecific->mNeutralMultiplicity=neutralMultiplicity;
198  fJetSpecific->mMuonMultiplicity=muonMultiplicity;
199  return true;
200 }
virtual double energy() const GCC11_FINAL
energy
ParticleType
particle types
Definition: PFCandidate.h:43
int mChargedMultiplicity
Definition: PFJet.h:73
float mNeutralHadronEnergy
Definition: PFJet.h:53
float mChargedMuEnergy
Definition: PFJet.h:71
float mChargedHadronEnergy
Definition: PFJet.h:52
float mChargedEmEnergy
Definition: PFJet.h:70
float mNeutralEmEnergy
Definition: PFJet.h:72
const int mu
Definition: Constants.h:22
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
int mNeutralMultiplicity
Definition: PFJet.h:74
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:38
T get() const
get a component
Definition: Candidate.h:219
virtual ParticleType particleId() const
Definition: PFCandidate.h:355
bool JetMaker::makeSpecific ( const JetReco::InputCollection fConstituents,
reco::GenJet::Specific fJetSpecific 
)

Make GenJet specifics. Assumes ProtoJet is made from HepMCCandidate.

Definition at line 203 of file JetMaker.cc.

References funct::abs(), dtNoiseDBValidation_cfg::cerr, alignCSCRings::e, reco::LeafCandidate::energy(), edm::RefToBase< T >::get(), reco::Candidate::get(), reco::Candidate::hasMasterClone(), reco::GenJet::Specific::m_AuxiliaryEnergy, reco::GenJet::Specific::m_EmEnergy, reco::GenJet::Specific::m_HadEnergy, reco::GenJet::Specific::m_InvisibleEnergy, reco::Candidate::masterClone(), and reco::LeafCandidate::pdgId().

204  {
205  for (JetReco::InputCollection::const_iterator genCand = fMcParticles.begin(); genCand != fMcParticles.end(); ++genCand) {
206  const Candidate* candidate = genCand->get ();
207  if (candidate->hasMasterClone ()) candidate = candidate->masterClone().get ();
208  if (candidate) {
209  const GenParticle* genParticle = GenJet::genParticle (candidate);
210  if (genParticle) {
211  double e = genParticle->energy();
212  switch (std::abs (genParticle->pdgId ())) {
213  case 22: // photon
214  case 11: // e
215  fJetSpecific->m_EmEnergy += e;
216  break;
217  case 211: // pi
218  case 321: // K
219  case 130: // KL
220  case 2212: // p
221  case 2112: // n
222  fJetSpecific->m_HadEnergy += e;
223  break;
224  case 13: // muon
225  case 12: // nu_e
226  case 14: // nu_mu
227  case 16: // nu_tau
228 
229  fJetSpecific->m_InvisibleEnergy += e;
230  break;
231  default:
232  fJetSpecific->m_AuxiliaryEnergy += e;
233  }
234  }
235  else {
236  std::cerr << "JetMaker::makeSpecific (GenJet)-> Referred GenParticleCandidate is not available in the event" << std::endl;
237  }
238  }
239  else {
240  std::cerr << "JetMaker::makeSpecific (GenJet)-> Referred constituent is not available in the event" << std::endl;
241  }
242  }
243  return true;
244 }
virtual double energy() const GCC11_FINAL
energy
virtual int pdgId() const GCC11_FINAL
PDG identifier.
virtual bool hasMasterClone() const =0
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float m_InvisibleEnergy
Invisible energy (mu, nu, ...)
Definition: GenJet.h:38
float m_AuxiliaryEnergy
Anything else (undecayed Sigmas etc.)
Definition: GenJet.h:40
float m_HadEnergy
Energy of Hadrons.
Definition: GenJet.h:36
T get() const
get a component
Definition: Candidate.h:219
float m_EmEnergy
Energy of EM particles.
Definition: GenJet.h:34
value_type const * get() const
Definition: RefToBase.h:212
virtual const CandidateBaseRef & masterClone() const =0