20 typename T::const_iterator
hit = fCollection.find(fId);
21 if (
hit != fCollection.end())
27 std::vector<const PCaloHit*>
result;
28 for (
unsigned i = 0;
i < fCollection.size(); ++
i) {
29 if (fCollection[
i].
id() == fId.
rawId()) {
30 result.push_back(&(fCollection[
i]));
39 mEBRecHitCollection(nullptr),
40 mEERecHitCollection(nullptr),
41 mHBHERecHitCollection(nullptr),
42 mHORecHitCollection(nullptr),
43 mHFRecHitCollection(nullptr),
44 mEBSimHitCollection(nullptr),
45 mEESimHitCollection(nullptr),
46 mHcalSimHitCollection(nullptr),
47 mSimTrackCollection(nullptr),
48 mSimVertexCollection(nullptr),
49 mGenParticleCollection(nullptr) {
156 std::vector<const CaloTower*>
result;
158 for (
unsigned i = 0;
i < constituents.size(); ++
i)
159 result.push_back(&*(constituents[
i]));
165 std::vector<JetConstituent>
result;
183 std::cerr <<
"Can not find rechit for id " <<
id.rawId() << std::endl;
199 std::cerr <<
"Can not find rechit for id " <<
id.rawId() << std::endl;
208 std::vector<DetId>
result;
217 std::vector<const PCaloHit*>
result;
244 while (
track->noGenpart()) {
245 if (
track->noVertex()) {
246 std::cerr <<
"JetMatchingTools::generatorId-> No vertex for track " << *
track << std::endl;
251 std::cerr <<
"JetMatchingTools::generatorId-> No track for vertex " << *
vertex << std::endl;
256 return track->genpartIndex();
262 std::cerr <<
"JetMatchingTools::getGenParticle-> requested index " << fGeneratorId
272 std::set<const reco::GenParticle*>
result;
275 for (
unsigned itower = 0; itower <
towers.size(); ++itower) {
277 for (
unsigned iid = 0; iid < detids.size(); ++iid) {
279 for (
unsigned iphit = 0; iphit <
phits.size(); ++iphit) {
287 }
else if (fVerbose) {
288 std::cerr <<
"JetMatchingTools::getGenParticles-> Can not convert genId " << genId <<
" to GenParticle" 291 }
else if (fVerbose) {
292 std::cerr <<
"JetMatchingTools::getGenParticles-> Can not convert trackId " << trackId <<
" to genId" 295 }
else if (fVerbose) {
296 std::cerr <<
"JetMatchingTools::getGenParticles-> Unknown trackId for PCaloHit " << *(
phits[iphit])
302 return std::vector<const reco::GenParticle*>(
result.begin(),
result.end());
312 double totalEnergy = 0;
313 double lostEnergy = 0;
316 for (
unsigned itower = 0; itower <
towers.size(); ++itower) {
318 for (
unsigned ihit = 0; ihit <
recHits.size(); ++ihit) {
319 double foundSimEnergy = 0;
320 double lostSimEnergy = 0;
322 for (
unsigned iphit = 0; iphit <
phits.size(); ++iphit) {
323 double simEnergy =
phits[iphit]->energy();
326 lostSimEnergy += simEnergy;
328 foundSimEnergy += simEnergy;
330 if (foundSimEnergy > 0 || lostSimEnergy > 0) {
331 totalEnergy +=
recHits[ihit].energy;
332 lostEnergy +=
recHits[ihit].energy * lostSimEnergy / (foundSimEnergy + lostSimEnergy);
336 return lostEnergy / totalEnergy;
341 const std::vector<const reco::GenParticle*>& fReference)
const {
344 double totalEnergy = 0;
345 double overlapEnergy = 0;
346 for (
unsigned i = 0;
i < fObject.size(); ++
i) {
347 totalEnergy += fObject[
i]->energy();
348 if (
find(fReference.begin(), fReference.end(), fObject[
i]) != fReference.end())
349 overlapEnergy += fObject[
i]->
energy();
351 return overlapEnergy / totalEnergy;
virtual std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
std::vector< PCaloHit > PCaloHitContainer
Jets made from CaloTowers.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
constexpr Detector det() const
get the detector field from this detid
Container::value_type value_type
Jets made from MC generator particles.
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
DetId constituent(size_t i) const
constexpr uint32_t rawId() const
get the raw id
size_t constituentsSize() const
std::vector< SimVertex > SimVertexContainer
virtual std::vector< const GenParticle * > getGenConstituents() const
get all constituents
static const GenParticle * genParticle(const reco::Candidate *fConstituent)
convert generic constituent to specific type
std::vector< SimTrack > SimTrackContainer
caConstants::TupleMultiplicity const *__restrict__ HitsOnGPU const *__restrict__ tindex_type *__restrict__ double *__restrict__ phits