Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-04-18 22:50:33

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   //Consider CaloParticles coming from the hard scatterer
0011   //excluding the PU contribution and save the indices.
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