24 typename T::const_iterator
hit = fCollection.find (fId);
25 if (hit != fCollection.end())
return &*hit;
30 std::vector <const PCaloHit*>
result;
31 for (
unsigned i = 0;
i < fCollection.size (); ++
i) {
32 if (fCollection[
i].
id() == fId.
rawId()) {
33 result.push_back (&(fCollection[
i]));
42 mEBRecHitCollection (0),
43 mEERecHitCollection (0),
44 mHBHERecHitCollection (0),
45 mHORecHitCollection (0),
46 mHFRecHitCollection (0),
47 mEBSimHitCollection (0),
48 mEESimHitCollection (0),
49 mHcalSimHitCollection (0),
50 mSimTrackCollection (0),
51 mSimVertexCollection (0),
52 mGenParticleCollection (0)
148 std::vector <const CaloTower*>
result;
150 for (
unsigned i = 0;
i < constituents.size(); ++
i) result.push_back (&*(constituents[
i]));
155 std::vector <const CaloRecHit*>
result;
178 if (hit) result.push_back (hit);
179 else std::cerr <<
"Can not find rechit for id " <<
id.rawId () << std::endl;
186 std::vector <DetId>
result;
189 result.push_back (
id);
195 std::vector <const PCaloHit*>
result;
223 if (!track)
return -1;
226 std::cerr <<
"JetMatchingTools::generatorId-> No vertex for track " << *track << std::endl;
231 std::cerr <<
"JetMatchingTools::generatorId-> No track for vertex " << *vertex << std::endl;
250 std::set <const reco::GenParticle*>
result;
253 for (
unsigned itower = 0; itower < towers.size (); ++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) {
264 result.insert (genPart);
267 std::cerr <<
"JetMatchingTools::getGenParticles-> Can not convert genId " << genId <<
" to GenParticle" << std::endl;
271 std::cerr <<
"JetMatchingTools::getGenParticles-> Can not convert trackId " << trackId <<
" to genId" << std::endl;
275 std::cerr <<
"JetMatchingTools::getGenParticles-> Unknown trackId for PCaloHit " << *(phits[iphit]) << std::endl;
280 return std::vector <const reco::GenParticle*> (result.begin (), result.end());
290 double totalEnergy = 0;
291 double lostEnergy = 0;
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;
300 for (
unsigned iphit = 0; iphit < phits.size(); ++iphit) {
301 double simEnergy = phits[iphit]->energy ();
303 if (trackId < 0 ||
generatorId (trackId) < 0) lostSimEnergy += simEnergy;
304 else foundSimEnergy += simEnergy;
306 if (foundSimEnergy > 0 || lostSimEnergy > 0) {
307 totalEnergy += recHits[ihit]->energy ();
308 lostEnergy += recHits[ihit]->energy () * lostSimEnergy / (foundSimEnergy + lostSimEnergy);
312 return lostEnergy / totalEnergy;
317 const std::vector <const reco::GenParticle*>& fReference)
const {
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();
325 return overlapEnergy / totalEnergy;
std::vector< PCaloHit > PCaloHitContainer
Jets made from CaloTowers.
size_t constituentsSize() const
DetId constituent(size_t i) const
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
uint32_t rawId() const
get the raw id
int genpartIndex() const
index of the corresponding Generator particle in the Event container (-1 if no Genpart) ...
Jets made from MC generator particles.
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
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
Detector det() const
get the detector field from this detid
std::vector< SimTrack > SimTrackContainer
tuple size
Write out results.