20 typename T::const_iterator
hit = fCollection.find (fId);
21 if (hit != fCollection.end())
return &*hit;
26 std::vector <const PCaloHit*>
result;
27 for (
unsigned i = 0;
i < fCollection.size (); ++
i) {
28 if (fCollection[
i].
id() == fId.
rawId()) {
29 result.push_back (&(fCollection[
i]));
40 mHBHERecHitCollection (
nullptr),
45 mHcalSimHitCollection (
nullptr),
48 mGenParticleCollection (
nullptr)
158 std::vector <const CaloTower*>
result;
160 for (
unsigned i = 0;
i < constituents.size(); ++
i) result.push_back (&*(constituents[
i]));
166 std::vector<JetConstituent>
result;
181 assert(hit !=
nullptr);
183 else std::cerr <<
"Can not find rechit for id " <<
id.rawId () << std::endl;
198 else std::cerr <<
"Can not find rechit for id " <<
id.rawId () << std::endl;
207 std::vector <DetId>
result;
210 result.push_back (
id);
216 std::vector <const PCaloHit*>
result;
244 if (!track)
return -1;
247 std::cerr <<
"JetMatchingTools::generatorId-> No vertex for track " << *track << std::endl;
252 std::cerr <<
"JetMatchingTools::generatorId-> No track for vertex " << *vertex << std::endl;
271 std::set <const reco::GenParticle*>
result;
274 for (
unsigned itower = 0; itower < towers.size (); ++itower) {
276 for (
unsigned iid = 0; iid < detids.size(); ++iid) {
277 std::vector <const PCaloHit*> phits =
getPCaloHits (detids[iid]);
278 for (
unsigned iphit = 0; iphit < phits.size(); ++iphit) {
285 result.insert (genPart);
288 std::cerr <<
"JetMatchingTools::getGenParticles-> Can not convert genId " << genId <<
" to GenParticle" << std::endl;
292 std::cerr <<
"JetMatchingTools::getGenParticles-> Can not convert trackId " << trackId <<
" to genId" << std::endl;
296 std::cerr <<
"JetMatchingTools::getGenParticles-> Unknown trackId for PCaloHit " << *(phits[iphit]) << std::endl;
301 return std::vector <const reco::GenParticle*> (result.begin (), result.end());
311 double totalEnergy = 0;
312 double lostEnergy = 0;
315 for (
unsigned itower = 0; itower < towers.size (); ++itower) {
317 for (
unsigned ihit = 0; ihit < recHits.size(); ++ihit) {
318 double foundSimEnergy = 0;
319 double lostSimEnergy = 0;
320 std::vector <const PCaloHit*> phits =
getPCaloHits (recHits[ihit].
id);
321 for (
unsigned iphit = 0; iphit < phits.size(); ++iphit) {
322 double simEnergy = phits[iphit]->energy ();
324 if (trackId < 0 ||
generatorId (trackId) < 0) lostSimEnergy += simEnergy;
325 else foundSimEnergy += simEnergy;
327 if (foundSimEnergy > 0 || lostSimEnergy > 0) {
328 totalEnergy += recHits[ihit].energy;
329 lostEnergy += recHits[ihit].energy * lostSimEnergy / (foundSimEnergy + lostSimEnergy);
333 return lostEnergy / totalEnergy;
338 const std::vector <const reco::GenParticle*>& fReference)
const {
339 if (fObject.empty())
return 0;
340 double totalEnergy = 0;
341 double overlapEnergy = 0;
342 for (
unsigned i = 0;
i < fObject.size(); ++
i) {
343 totalEnergy += fObject [
i]->energy();
344 if (
find (fReference.begin(), fReference.end(), fObject [
i]) != fReference.end ()) overlapEnergy += fObject [
i]->
energy();
346 return overlapEnergy / totalEnergy;
std::vector< PCaloHit > PCaloHitContainer
Jets made from CaloTowers.
size_t constituentsSize() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
DetId constituent(size_t i) const
constexpr uint32_t rawId() const
get the raw id
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
virtual std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
Container::value_type value_type
int genpartIndex() const
index of the corresponding Generator particle in the Event container (-1 if no Genpart) ...
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Jets made from MC generator particles.
virtual std::vector< const GenParticle * > getGenConstituents() const
get all constituents
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
std::vector< SimVertex > SimVertexContainer
static const GenParticle * genParticle(const reco::Candidate *fConstituent)
convert generic constituent to specific type
std::vector< SimTrack > SimTrackContainer
constexpr Detector det() const
get the detector field from this detid