CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
JetMatchingTools Class Reference

#include <JetMatchingTools.h>

Public Member Functions

int generatorId (unsigned fSimTrackId)
 Generator ID. More...
 
std::vector< const CaloRecHit * > getCaloRecHits (int fGeneratorId)
 CaloRecHits. More...
 
std::vector< const CaloTower * > getCaloTowers (int fGeneratorId)
 CaloTowers. More...
 
std::vector< DetIdgetConstituentIds (const CaloTower &fTower)
 get cells contributing to the tower More...
 
std::vector< const CaloTower * > getConstituents (const reco::CaloJet &fJet)
 get towers contributing to CaloJet More...
 
std::vector< const CaloRecHit * > getConstituents (const CaloTower &fTower)
 get CaloRecHits contributing to the tower More...
 
const EBRecHitCollectiongetEBRecHitCollection ()
 
const edm::PCaloHitContainergetEBSimHitCollection ()
 
const EERecHitCollectiongetEERecHitCollection ()
 
const edm::PCaloHitContainergetEESimHitCollection ()
 
const reco::GenParticlegetGenParticle (int fGeneratorId)
 GenParticle. More...
 
std::vector< const
reco::GenParticle * > 
getGenParticles (const reco::CaloJet &fJet, bool fVerbose=true)
 GenParticles for CaloJet. More...
 
std::vector< const
reco::GenParticle * > 
getGenParticles (const reco::GenJet &fJet)
 GenParticles for GenJet. More...
 
const reco::CandidateCollectiongetGenParticlesCollection ()
 
const HBHERecHitCollectiongetHBHERecHitCollection ()
 
const edm::PCaloHitContainergetHcalSimHitCollection ()
 
const HFRecHitCollectiongetHFRecHitCollection ()
 
const HORecHitCollectiongetHORecHitCollection ()
 
std::vector< const PCaloHit * > getPCaloHits (DetId fId)
 get PCaloHits contributing to the detId More...
 
std::vector< const PCaloHit * > getPCaloHits (int fGeneratorId)
 CaloSimHits. More...
 
const edm::SimTrackContainergetSimTrackCollection ()
 
const edm::SimVertexContainergetSimVertexCollection ()
 
const SimTrackgetTrack (unsigned fSimTrackId)
 convert trackId to SimTrack More...
 
int getTrackId (const PCaloHit &fHit)
 GEANT track ID. More...
 
 JetMatchingTools (const edm::Event &fEvent)
 
double lostEnergyFraction (const reco::CaloJet &fJet)
 energy in broken links More...
 
double overlapEnergyFraction (const std::vector< const reco::GenParticle * > &fObject, const std::vector< const reco::GenParticle * > &fReference) const
 energy overlap More...
 
 ~JetMatchingTools ()
 

Private Attributes

const EBRecHitCollectionmEBRecHitCollection
 
const edm::PCaloHitContainermEBSimHitCollection
 
const EERecHitCollectionmEERecHitCollection
 
const edm::PCaloHitContainermEESimHitCollection
 
const edm::EventmEvent
 
const reco::CandidateCollectionmGenParticleCollection
 
const HBHERecHitCollectionmHBHERecHitCollection
 
const edm::PCaloHitContainermHcalSimHitCollection
 
const HFRecHitCollectionmHFRecHitCollection
 
const HORecHitCollectionmHORecHitCollection
 
const edm::SimTrackContainermSimTrackCollection
 
const edm::SimVertexContainermSimVertexCollection
 

Detailed Description

Definition at line 25 of file JetMatchingTools.h.

Constructor & Destructor Documentation

JetMatchingTools::JetMatchingTools ( const edm::Event fEvent)

Definition at line 40 of file JetMatchingTools.cc.

41  : mEvent (&fEvent),
53 {}
const edm::PCaloHitContainer * mHcalSimHitCollection
const EBRecHitCollection * mEBRecHitCollection
const edm::PCaloHitContainer * mEBSimHitCollection
const reco::CandidateCollection * mGenParticleCollection
const edm::PCaloHitContainer * mEESimHitCollection
const edm::SimTrackContainer * mSimTrackCollection
const EERecHitCollection * mEERecHitCollection
const edm::SimVertexContainer * mSimVertexCollection
const edm::Event * mEvent
const HORecHitCollection * mHORecHitCollection
const HFRecHitCollection * mHFRecHitCollection
const HBHERecHitCollection * mHBHERecHitCollection
JetMatchingTools::~JetMatchingTools ( )

Definition at line 55 of file JetMatchingTools.cc.

55 {}

Member Function Documentation

int JetMatchingTools::generatorId ( unsigned  fSimTrackId)

Generator ID.

Definition at line 221 of file JetMatchingTools.cc.

References dtNoiseDBValidation_cfg::cerr, SimTrack::genpartIndex(), getSimVertexCollection(), getTrack(), SimTrack::noGenpart(), SimVertex::noParent(), SimTrack::noVertex(), SimVertex::parentIndex(), and SimTrack::vertIndex().

Referenced by getGenParticles(), and lostEnergyFraction().

221  {
222  const SimTrack* track = getTrack (fSimTrackId);
223  if (!track) return -1;
224  while (track->noGenpart ()) {
225  if (track->noVertex ()) {
226  std::cerr << "JetMatchingTools::generatorId-> No vertex for track " << *track << std::endl;
227  return -1;
228  }
229  const SimVertex* vertex = &((*getSimVertexCollection ())[track->vertIndex ()]);
230  if (vertex->noParent()) {
231  std::cerr << "JetMatchingTools::generatorId-> No track for vertex " << *vertex << std::endl;
232  return -1;
233  }
234  track = getTrack (vertex->parentIndex ());
235  }
236  return track->genpartIndex ();
237 }
const edm::SimVertexContainer * getSimVertexCollection()
bool noGenpart() const
Definition: SimTrack.h:34
int parentIndex() const
Definition: SimVertex.h:33
int genpartIndex() const
index of the corresponding Generator particle in the Event container (-1 if no Genpart) ...
Definition: SimTrack.h:33
bool noVertex() const
Definition: SimTrack.h:30
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
Definition: SimTrack.h:29
const SimTrack * getTrack(unsigned fSimTrackId)
convert trackId to SimTrack
bool noParent() const
Definition: SimVertex.h:34
std::vector<const CaloRecHit*> JetMatchingTools::getCaloRecHits ( int  fGeneratorId)

CaloRecHits.

std::vector<const CaloTower*> JetMatchingTools::getCaloTowers ( int  fGeneratorId)

CaloTowers.

std::vector< DetId > JetMatchingTools::getConstituentIds ( const CaloTower fTower)

get cells contributing to the tower

Definition at line 185 of file JetMatchingTools.cc.

References CaloTower::constituent(), CaloTower::constituentsSize(), i, and query::result.

Referenced by getGenParticles().

185  {
186  std::vector <DetId> result;
187  for (unsigned i = 0; i < fTower.constituentsSize(); ++i) {
188  DetId id = fTower.constituent (i);
189  result.push_back (id);
190  }
191  return result;
192 }
int i
Definition: DBlmapReader.cc:9
size_t constituentsSize() const
Definition: CaloTower.h:74
DetId constituent(size_t i) const
Definition: CaloTower.h:75
tuple result
Definition: query.py:137
Definition: DetId.h:20
std::vector< const CaloTower * > JetMatchingTools::getConstituents ( const reco::CaloJet fJet)

get towers contributing to CaloJet

Definition at line 147 of file JetMatchingTools.cc.

References reco::CaloJet::getCaloConstituents(), i, and query::result.

Referenced by getGenParticles(), and lostEnergyFraction().

147  {
148  std::vector <const CaloTower*> result;
149  std::vector<CaloTowerPtr> constituents = fJet.getCaloConstituents ();
150  for (unsigned i = 0; i < constituents.size(); ++i) result.push_back (&*(constituents[i]));
151  return result;
152 }
int i
Definition: DBlmapReader.cc:9
virtual std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
Definition: CaloJet.cc:94
tuple result
Definition: query.py:137
std::vector< const CaloRecHit * > JetMatchingTools::getConstituents ( const CaloTower fTower)

get CaloRecHits contributing to the tower

Definition at line 154 of file JetMatchingTools.cc.

References dtNoiseDBValidation_cfg::cerr, CaloTower::constituent(), CaloTower::constituentsSize(), DetId::Ecal, EcalBarrel, EcalEndcap, getEBRecHitCollection(), getEERecHitCollection(), getHBHERecHitCollection(), getHFRecHitCollection(), getHORecHitCollection(), DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, i, and query::result.

154  {
155  std::vector <const CaloRecHit*> result;
156  for (unsigned i = 0; i < fTower.constituentsSize(); ++i) {
157  DetId id = fTower.constituent (i);
158  const CaloRecHit* hit = 0;
159  if (id.det () == DetId::Ecal) {
160  if ((EcalSubdetector) id.subdetId () == EcalBarrel) {
161  hit = getHit (*getEBRecHitCollection (), id);
162  }
163  else if ((EcalSubdetector) id.subdetId () == EcalEndcap) {
164  hit = getHit (*getEERecHitCollection (), id);
165  }
166  }
167  else if (id.det () == DetId::Hcal) {
168  if ((HcalSubdetector) id.subdetId () == HcalBarrel || (HcalSubdetector) id.subdetId () == HcalEndcap) {
169  hit = getHit (*getHBHERecHitCollection (), id);
170  }
171  else if ((HcalSubdetector) id.subdetId () == HcalOuter) {
172  hit = getHit (*getHORecHitCollection (), id);
173  }
174  if ((HcalSubdetector) id.subdetId () == HcalForward) {
175  hit = getHit (*getHFRecHitCollection (), id);
176  }
177  }
178  if (hit) result.push_back (hit);
179  else std::cerr << "Can not find rechit for id " << id.rawId () << std::endl;
180  }
181  return result;
182 }
int i
Definition: DBlmapReader.cc:9
size_t constituentsSize() const
Definition: CaloTower.h:74
const HFRecHitCollection * getHFRecHitCollection()
DetId constituent(size_t i) const
Definition: CaloTower.h:75
tuple result
Definition: query.py:137
const EBRecHitCollection * getEBRecHitCollection()
HcalSubdetector
Definition: HcalAssistant.h:32
const EERecHitCollection * getEERecHitCollection()
const HORecHitCollection * getHORecHitCollection()
const HBHERecHitCollection * getHBHERecHitCollection()
Definition: DetId.h:20
EcalSubdetector
const EBRecHitCollection * JetMatchingTools::getEBRecHitCollection ( )

Definition at line 57 of file JetMatchingTools.cc.

References edm::Event::getByLabel(), mEBRecHitCollection, and mEvent.

Referenced by getConstituents().

57  {
58  if (!mEBRecHitCollection) {
60  mEvent->getByLabel (edm::InputTag ("ecalRecHit:EcalRecHitsEB"), recHits);
61  mEBRecHitCollection = &*recHits;
62  }
63  return mEBRecHitCollection;
64 }
const EBRecHitCollection * mEBRecHitCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const edm::Event * mEvent
const PCaloHitContainer * JetMatchingTools::getEBSimHitCollection ( )

Definition at line 97 of file JetMatchingTools.cc.

References edm::Event::getByLabel(), mEBSimHitCollection, mEvent, and trackerHits::simHits.

Referenced by getPCaloHits().

97  {
98  if (!mEBSimHitCollection) {
100  mEvent->getByLabel (edm::InputTag ("g4SimHits:EcalHitsEB"), simHits);
102  }
103  return mEBSimHitCollection;
104 }
const edm::PCaloHitContainer * mEBSimHitCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
tuple simHits
Definition: trackerHits.py:16
const edm::Event * mEvent
const EERecHitCollection * JetMatchingTools::getEERecHitCollection ( )

Definition at line 65 of file JetMatchingTools.cc.

References edm::Event::getByLabel(), mEERecHitCollection, and mEvent.

Referenced by getConstituents().

65  {
66  if (!mEERecHitCollection) {
68  mEvent->getByLabel (edm::InputTag ("ecalRecHit:EcalRecHitsEE"), recHits);
69  mEERecHitCollection = &*recHits;
70  }
71  return mEERecHitCollection;
72 }
const EERecHitCollection * mEERecHitCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const edm::Event * mEvent
const PCaloHitContainer * JetMatchingTools::getEESimHitCollection ( )

Definition at line 105 of file JetMatchingTools.cc.

References edm::Event::getByLabel(), mEESimHitCollection, mEvent, and trackerHits::simHits.

Referenced by getPCaloHits().

105  {
106  if (!mEESimHitCollection) {
108  mEvent->getByLabel (edm::InputTag ("g4SimHits:EcalHitsEE"), simHits);
110  }
111  return mEESimHitCollection;
112 }
const edm::PCaloHitContainer * mEESimHitCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
tuple simHits
Definition: trackerHits.py:16
const edm::Event * mEvent
const reco::GenParticle * JetMatchingTools::getGenParticle ( int  fGeneratorId)

GenParticle.

Definition at line 240 of file JetMatchingTools.cc.

References dtNoiseDBValidation_cfg::cerr, reco::GenJet::genParticle(), getGenParticlesCollection(), edm::OwnVector< T, P >::size(), and findQualityFiles::size.

Referenced by getGenParticles().

240  {
241  if (fGeneratorId > int (getGenParticlesCollection ()->size())) {
242  std::cerr << "JetMatchingTools::getGenParticle-> requested index " << fGeneratorId << " is grater then container size " << getGenParticlesCollection ()->size() << std::endl;
243  return 0;
244  }
245  return reco::GenJet::genParticle ( &(*getGenParticlesCollection ())[fGeneratorId-1]); // knowhow: index is shifted by 1
246 }
const reco::CandidateCollection * getGenParticlesCollection()
size_type size() const
Definition: OwnVector.h:247
static const GenParticle * genParticle(const reco::Candidate *fConstituent)
convert generic constituent to specific type
Definition: GenJet.cc:39
tuple size
Write out results.
std::vector< const reco::GenParticle * > JetMatchingTools::getGenParticles ( const reco::CaloJet fJet,
bool  fVerbose = true 
)

GenParticles for CaloJet.

Definition at line 249 of file JetMatchingTools.cc.

References dtNoiseDBValidation_cfg::cerr, generatorId(), getConstituentIds(), getConstituents(), getGenParticle(), getPCaloHits(), getTrackId(), and query::result.

Referenced by CaloJetTesterUnCorr::analyze(), CaloJetTesterUnCorr_HeavyIons::analyze(), CaloJetTester::analyze(), and IsolatedParticlesGeneratedJets::analyze().

249  {
250  std::set <const reco::GenParticle*> result;
251  // follow the chain
252  std::vector <const CaloTower*> towers = getConstituents (fJet) ;
253  for (unsigned itower = 0; itower < towers.size (); ++itower) {
254  std::vector <DetId> detids = getConstituentIds (*(towers[itower])) ;
255  for (unsigned iid = 0; iid < detids.size(); ++iid) {
256  std::vector <const PCaloHit*> phits = getPCaloHits (detids[iid]);
257  for (unsigned iphit = 0; iphit < phits.size(); ++iphit) {
258  int trackId = getTrackId (*(phits[iphit]));
259  if (trackId >= 0) {
260  int genId = generatorId (trackId);
261  if (genId >= 0) {
262  const reco::GenParticle* genPart = getGenParticle (genId);
263  if (genPart) {
264  result.insert (genPart);
265  }
266  else if (fVerbose) {
267  std::cerr << "JetMatchingTools::getGenParticles-> Can not convert genId " << genId << " to GenParticle" << std::endl;
268  }
269  }
270  else if (fVerbose) {
271  std::cerr << "JetMatchingTools::getGenParticles-> Can not convert trackId " << trackId << " to genId" << std::endl;
272  }
273  }
274  else if (fVerbose) {
275  std::cerr << "JetMatchingTools::getGenParticles-> Unknown trackId for PCaloHit " << *(phits[iphit]) << std::endl;
276  }
277  }
278  }
279  }
280  return std::vector <const reco::GenParticle*> (result.begin (), result.end());
281 }
std::vector< const PCaloHit * > getPCaloHits(DetId fId)
get PCaloHits contributing to the detId
int generatorId(unsigned fSimTrackId)
Generator ID.
std::vector< DetId > getConstituentIds(const CaloTower &fTower)
get cells contributing to the tower
const reco::GenParticle * getGenParticle(int fGeneratorId)
GenParticle.
tuple result
Definition: query.py:137
std::vector< const CaloTower * > getConstituents(const reco::CaloJet &fJet)
get towers contributing to CaloJet
int getTrackId(const PCaloHit &fHit)
GEANT track ID.
std::vector< const reco::GenParticle * > JetMatchingTools::getGenParticles ( const reco::GenJet fJet)

GenParticles for GenJet.

Definition at line 284 of file JetMatchingTools.cc.

References reco::GenJet::getGenConstituents().

284  {
285  return fJet.getGenConstituents ();
286 }
virtual std::vector< const GenParticle * > getGenConstituents() const
get all constituents
Definition: GenJet.cc:59
const reco::CandidateCollection * JetMatchingTools::getGenParticlesCollection ( )

Definition at line 137 of file JetMatchingTools.cc.

References edm::Event::getByLabel(), patZpeak::handle, mEvent, and mGenParticleCollection.

Referenced by getGenParticle().

137  {
138  if (!mGenParticleCollection) {
140  mEvent->getByLabel (edm::InputTag ("genParticleCandidates"), handle);
142  }
143  return mGenParticleCollection;
144 }
const reco::CandidateCollection * mGenParticleCollection
tuple handle
Definition: patZpeak.py:22
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const edm::Event * mEvent
const HBHERecHitCollection * JetMatchingTools::getHBHERecHitCollection ( )

Definition at line 73 of file JetMatchingTools.cc.

References edm::Event::getByLabel(), mEvent, and mHBHERecHitCollection.

Referenced by getConstituents().

73  {
74  if (!mHBHERecHitCollection) {
76  mEvent->getByLabel (edm::InputTag ("hbhereco"), recHits);
77  mHBHERecHitCollection = &*recHits;
78  }
79  return mHBHERecHitCollection;
80 }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const edm::Event * mEvent
const HBHERecHitCollection * mHBHERecHitCollection
const PCaloHitContainer * JetMatchingTools::getHcalSimHitCollection ( )

Definition at line 113 of file JetMatchingTools.cc.

References edm::Event::getByLabel(), mEvent, mHcalSimHitCollection, and trackerHits::simHits.

Referenced by getPCaloHits().

113  {
114  if (!mHcalSimHitCollection) {
116  mEvent->getByLabel (edm::InputTag ("g4SimHits:HcalHits"), simHits);
118  }
119  return mHcalSimHitCollection;
120 }
const edm::PCaloHitContainer * mHcalSimHitCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
tuple simHits
Definition: trackerHits.py:16
const edm::Event * mEvent
const HFRecHitCollection * JetMatchingTools::getHFRecHitCollection ( )

Definition at line 89 of file JetMatchingTools.cc.

References edm::Event::getByLabel(), mEvent, and mHFRecHitCollection.

Referenced by getConstituents().

89  {
90  if (!mHFRecHitCollection) {
92  mEvent->getByLabel (edm::InputTag ("hfreco"), recHits);
93  mHFRecHitCollection = &*recHits;
94  }
95  return mHFRecHitCollection;
96 }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const edm::Event * mEvent
const HFRecHitCollection * mHFRecHitCollection
const HORecHitCollection * JetMatchingTools::getHORecHitCollection ( )

Definition at line 81 of file JetMatchingTools.cc.

References edm::Event::getByLabel(), mEvent, and mHORecHitCollection.

Referenced by getConstituents().

81  {
82  if (!mHORecHitCollection) {
84  mEvent->getByLabel (edm::InputTag ("horeco"), recHits);
85  mHORecHitCollection = &*recHits;
86  }
87  return mHORecHitCollection;
88 }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const edm::Event * mEvent
const HORecHitCollection * mHORecHitCollection
std::vector< const PCaloHit * > JetMatchingTools::getPCaloHits ( DetId  fId)

get PCaloHits contributing to the detId

Definition at line 194 of file JetMatchingTools.cc.

References DetId::det(), DetId::Ecal, EcalBarrel, EcalEndcap, getEBSimHitCollection(), getEESimHitCollection(), getHcalSimHitCollection(), DetId::Hcal, query::result, and DetId::subdetId().

Referenced by getGenParticles(), and lostEnergyFraction().

194  {
195  std::vector <const PCaloHit*> result;
196  if (fId.det () == DetId::Ecal) {
197  if ((EcalSubdetector) fId.subdetId () == EcalBarrel) {
198  result = getSimHits (*getEBSimHitCollection (), fId);
199  }
200  else if ((EcalSubdetector) fId.subdetId () == EcalEndcap) {
201  result = getSimHits (*getEESimHitCollection (), fId);
202  }
203  }
204  else if (fId.det () == DetId::Hcal) {
205  result = getSimHits (*getHcalSimHitCollection (), fId);
206  }
207  return result;
208 }
const edm::PCaloHitContainer * getEESimHitCollection()
const edm::PCaloHitContainer * getEBSimHitCollection()
tuple result
Definition: query.py:137
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
const edm::PCaloHitContainer * getHcalSimHitCollection()
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
EcalSubdetector
std::vector<const PCaloHit*> JetMatchingTools::getPCaloHits ( int  fGeneratorId)

CaloSimHits.

const SimTrackContainer * JetMatchingTools::getSimTrackCollection ( )

Definition at line 121 of file JetMatchingTools.cc.

References edm::Event::getByLabel(), mEvent, mSimTrackCollection, and trackerHits::simHits.

Referenced by getTrack().

121  {
122  if (!mSimTrackCollection) {
124  mEvent->getByLabel (edm::InputTag ("g4SimHits"), simHits);
126  }
127  return mSimTrackCollection;
128 }
const edm::SimTrackContainer * mSimTrackCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
tuple simHits
Definition: trackerHits.py:16
const edm::Event * mEvent
const SimVertexContainer * JetMatchingTools::getSimVertexCollection ( )

Definition at line 129 of file JetMatchingTools.cc.

References edm::Event::getByLabel(), mEvent, mSimVertexCollection, and trackerHits::simHits.

Referenced by generatorId().

129  {
130  if (!mSimVertexCollection) {
132  mEvent->getByLabel (edm::InputTag ("g4SimHits"), simHits);
134  }
135  return mSimVertexCollection;
136 }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const edm::SimVertexContainer * mSimVertexCollection
tuple simHits
Definition: trackerHits.py:16
const edm::Event * mEvent
const SimTrack * JetMatchingTools::getTrack ( unsigned  fSimTrackId)

convert trackId to SimTrack

Definition at line 214 of file JetMatchingTools.cc.

References getSimTrackCollection(), and i.

Referenced by generatorId().

214  {
215  for (unsigned i = 0; i < getSimTrackCollection ()->size (); ++i) {
216  if ((*getSimTrackCollection ())[i].trackId() == fSimTrackId) return &(*getSimTrackCollection ())[i];
217  }
218  return 0;
219 }
int i
Definition: DBlmapReader.cc:9
const edm::SimTrackContainer * getSimTrackCollection()
int JetMatchingTools::getTrackId ( const PCaloHit fHit)

GEANT track ID.

Definition at line 210 of file JetMatchingTools.cc.

References PCaloHit::geantTrackId().

Referenced by getGenParticles(), and lostEnergyFraction().

210  {
211  return fHit.geantTrackId ();
212 }
int geantTrackId() const
Definition: PCaloHit.h:37
double JetMatchingTools::lostEnergyFraction ( const reco::CaloJet fJet)

energy in broken links

Definition at line 289 of file JetMatchingTools.cc.

References cond::rpcobgas::detid, generatorId(), getConstituents(), getPCaloHits(), and getTrackId().

289  {
290  double totalEnergy = 0;
291  double lostEnergy = 0;
292  // follow the chain
293  std::vector <const CaloTower*> towers = getConstituents (fJet) ;
294  for (unsigned itower = 0; itower < towers.size (); ++itower) {
295  std::vector <const CaloRecHit*> recHits = getConstituents (*(towers[itower]));
296  for (unsigned ihit = 0; ihit < recHits.size(); ++ihit) {
297  double foundSimEnergy = 0;
298  double lostSimEnergy = 0;
299  std::vector <const PCaloHit*> phits = getPCaloHits (recHits[ihit]->detid());
300  for (unsigned iphit = 0; iphit < phits.size(); ++iphit) {
301  double simEnergy = phits[iphit]->energy ();
302  int trackId = getTrackId (*(phits[iphit]));
303  if (trackId < 0 || generatorId (trackId) < 0) lostSimEnergy += simEnergy;
304  else foundSimEnergy += simEnergy;
305  }
306  if (foundSimEnergy > 0 || lostSimEnergy > 0) {
307  totalEnergy += recHits[ihit]->energy ();
308  lostEnergy += recHits[ihit]->energy () * lostSimEnergy / (foundSimEnergy + lostSimEnergy);
309  }
310  }
311  }
312  return lostEnergy / totalEnergy;
313 }
std::vector< const PCaloHit * > getPCaloHits(DetId fId)
get PCaloHits contributing to the detId
int generatorId(unsigned fSimTrackId)
Generator ID.
std::vector< const CaloTower * > getConstituents(const reco::CaloJet &fJet)
get towers contributing to CaloJet
int getTrackId(const PCaloHit &fHit)
GEANT track ID.
double JetMatchingTools::overlapEnergyFraction ( const std::vector< const reco::GenParticle * > &  fObject,
const std::vector< const reco::GenParticle * > &  fReference 
) const

energy overlap

Definition at line 316 of file JetMatchingTools.cc.

References relval_parameters_module::energy, spr::find(), and i.

Referenced by CaloJetTesterUnCorr::analyze(), CaloJetTesterUnCorr_HeavyIons::analyze(), and CaloJetTester::analyze().

317  {
318  if (fObject.empty()) return 0;
319  double totalEnergy = 0;
320  double overlapEnergy = 0;
321  for (unsigned i = 0; i < fObject.size(); ++i) {
322  totalEnergy += fObject [i]->energy();
323  if (find (fReference.begin(), fReference.end(), fObject [i]) != fReference.end ()) overlapEnergy += fObject [i]->energy();
324  }
325  return overlapEnergy / totalEnergy;
326 }
int i
Definition: DBlmapReader.cc:9
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7

Member Data Documentation

const EBRecHitCollection* JetMatchingTools::mEBRecHitCollection
private

Definition at line 83 of file JetMatchingTools.h.

Referenced by getEBRecHitCollection().

const edm::PCaloHitContainer* JetMatchingTools::mEBSimHitCollection
private

Definition at line 88 of file JetMatchingTools.h.

Referenced by getEBSimHitCollection().

const EERecHitCollection* JetMatchingTools::mEERecHitCollection
private

Definition at line 84 of file JetMatchingTools.h.

Referenced by getEERecHitCollection().

const edm::PCaloHitContainer* JetMatchingTools::mEESimHitCollection
private

Definition at line 89 of file JetMatchingTools.h.

Referenced by getEESimHitCollection().

const edm::Event* JetMatchingTools::mEvent
private
const reco::CandidateCollection* JetMatchingTools::mGenParticleCollection
private

Definition at line 93 of file JetMatchingTools.h.

Referenced by getGenParticlesCollection().

const HBHERecHitCollection* JetMatchingTools::mHBHERecHitCollection
private

Definition at line 85 of file JetMatchingTools.h.

Referenced by getHBHERecHitCollection().

const edm::PCaloHitContainer* JetMatchingTools::mHcalSimHitCollection
private

Definition at line 90 of file JetMatchingTools.h.

Referenced by getHcalSimHitCollection().

const HFRecHitCollection* JetMatchingTools::mHFRecHitCollection
private

Definition at line 87 of file JetMatchingTools.h.

Referenced by getHFRecHitCollection().

const HORecHitCollection* JetMatchingTools::mHORecHitCollection
private

Definition at line 86 of file JetMatchingTools.h.

Referenced by getHORecHitCollection().

const edm::SimTrackContainer* JetMatchingTools::mSimTrackCollection
private

Definition at line 91 of file JetMatchingTools.h.

Referenced by getSimTrackCollection().

const edm::SimVertexContainer* JetMatchingTools::mSimVertexCollection
private

Definition at line 92 of file JetMatchingTools.h.

Referenced by getSimVertexCollection().