195 const std::vector<CaloParticle>&
caloParticles = *caloParticleHandle;
207 std::map<DetId, const HGCRecHit*> hitmap;
213 const auto& rechitsEE = *recHitHandleEE;
214 const auto& rechitsFH = *recHitHandleFH;
215 const auto& rechitsBH = *recHitHandleBH;
216 for (
unsigned int i = 0;
i < rechitsEE.size(); ++
i) {
217 hitmap[rechitsEE[
i].detid()] = &rechitsEE[
i];
219 for (
unsigned int i = 0;
i < rechitsFH.size(); ++
i) {
220 hitmap[rechitsFH[
i].detid()] = &rechitsFH[
i];
222 for (
unsigned int i = 0;
i < rechitsBH.size(); ++
i) {
223 hitmap[rechitsBH[
i].detid()] = &rechitsBH[
i];
230 for (
unsigned int i = 0;
i < rechitsEE.
size();
i++) {
231 hitmap[rechitsEE[
i].detid()] = &rechitsEE[
i];
238 const auto& rechitsFH = *recHitHandleFH;
239 const auto& rechitsBH = *recHitHandleBH;
240 for (
unsigned int i = 0;
i < rechitsFH.size();
i++) {
241 hitmap[rechitsFH[
i].detid()] = &rechitsFH[
i];
243 for (
unsigned int i = 0;
i < rechitsBH.size();
i++) {
244 hitmap[rechitsBH[
i].detid()] = &rechitsBH[
i];
255 float seedEnergy = 0.;
257 <<
"Number of caloParticles: " << caloParticles.size() << std::endl;
258 for (
const auto& it_caloPart : caloParticles) {
265 for (
const auto& it_sc : simClusterRefVector) {
268 <<
">>> SC.energy(): " << simCluster.
energy()
269 <<
" SC.simEnergy(): " << simCluster.
simEnergy()
271 const std::vector<std::pair<uint32_t, float> >& hits_and_fractions =
275 for (
const auto& it_haf : hits_and_fractions) {
277 DetId hitid = (it_haf.first);
296 <<
">>> MC Energy: " << it_caloPart.energy()
297 <<
" reco energy: " << sumCalibRecHitCalib_fraction
301 it_caloPart.energy());
304 const auto&
clusters = *hgcalMultiClustersHandle;
305 float total_energy = 0.;
306 float max_dR2 = 0.0025;
307 auto closest = std::min_element(
clusters.begin(),
314 auto ERatio_b =
b.correctedEnergy()/it_caloPart.energy();
317 if (dR2_a < max_dR2 && dR2_b < max_dR2)
318 return ERatio_a > ERatio_b;
319 return dR2_a < dR2_b;
323 total_energy = closest->correctedEnergy();
327 it_caloPart.energy());
331 auto closest_fcn = [&](
auto const &
a,
auto const&
b){
334 auto ERatio_a = a.
energy()/it_caloPart.energy();
335 auto ERatio_b =
b.energy()/it_caloPart.energy();
338 if (dR2_a < max_dR2 && dR2_b < max_dR2)
339 return ERatio_a > ERatio_b;
340 return dR2_a < dR2_b;
343 if (PFElectronHandle.
isValid()) {
344 auto const & ele = (*PFElectronHandle);
345 auto closest = std::min_element(ele.begin(),
348 if (closest != ele.end()
349 && (closest->superCluster()->seed()->seed().det() ==
DetId::Forward ||
355 it_caloPart.energy());
361 if (PFPhotonHandle.
isValid()) {
362 auto const &
photon = (*PFPhotonHandle);
363 auto closest = std::min_element(
photon.begin(),
366 if (closest !=
photon.end()
367 && (closest->superCluster()->seed()->seed().det() ==
DetId::Forward ||
373 it_caloPart.energy());
edm::EDGetTokenT< std::vector< CaloParticle > > caloParticles_
edm::EDGetTokenT< std::vector< reco::Photon > > photons_
std::array< float, layers_ > Energy_layer_calib_fraction_
edm::EDGetTokenT< std::vector< reco::PFCluster > > hgcalMultiClusters_
std::map< int, MonitorElement * > hgcal_EoP_CPene_calib_fraction_
double correctedEnergy() const
edm::EDGetTokenT< HGCRecHitCollection > recHitsFH_
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
edm::EDGetTokenT< HGCRecHitCollection > recHitsEE_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::map< int, MonitorElement * > hgcal_ele_EoP_CPene_calib_fraction_
#define IfLogTrace(cond, cat)
std::map< int, MonitorElement * > hgcal_photon_EoP_CPene_calib_fraction_
edm::EDGetTokenT< HGCRecHitCollection > recHitsBH_
Monte Carlo truth information used for tracking validation.
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
float energy() const
Energy. Note this is taken from the first SimTrack only.
double energy() const
cluster energy
hgcal::RecHitTools recHitTools_
float simEnergy() const
returns the accumulated sim energy in the cluster
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
edm::EDGetTokenT< std::vector< reco::GsfElectron > > electrons_
std::map< int, MonitorElement * > h_EoP_CPene_calib_fraction_
void fillWithRecHits(std::map< DetId, const HGCRecHit * > &, DetId, unsigned int, float, int &, float &)
std::array< float, layers_ > Energy_layer_calib_
std::vector< std::pair< uint32_t, float > > hits_and_fractions() const
Returns list of rechit IDs and fractions for this SimCluster.
constexpr Detector det() const
get the detector field from this detid