File indexing completed on 2024-04-06 12:29:35
0001 #if !defined(SimCalorimetry_HGCalAssociatorProducers_interface_AssociatorTools_h)
0002 #define SimCalorimetry_HGCalAssociatorProducers_interface_AssociatorTools_h
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 #include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h"
0005 #include <vector>
0006
0007 static void removeCPFromPU(const std::vector<CaloParticle>& caloParticles,
0008 std::vector<size_t>& cPIndices,
0009 bool hardScatterOnly = true) {
0010
0011
0012 for (unsigned int cpId = 0; cpId < caloParticles.size(); ++cpId) {
0013 if (hardScatterOnly && (caloParticles[cpId].g4Tracks()[0].eventId().event() != 0 or
0014 caloParticles[cpId].g4Tracks()[0].eventId().bunchCrossing() != 0)) {
0015 LogDebug("HGCalValidator") << "Excluding CaloParticles from event: "
0016 << caloParticles[cpId].g4Tracks()[0].eventId().event()
0017 << " with BX: " << caloParticles[cpId].g4Tracks()[0].eventId().bunchCrossing()
0018 << std::endl;
0019 continue;
0020 }
0021 cPIndices.emplace_back(cpId);
0022 }
0023 }
0024
0025 #endif