Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse dependency #32826

Merged
merged 2 commits into from Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,15 @@
void removeCPFromPU(const std::vector<CaloParticle>& caloParticles, std::vector<size_t>& cPIndices) {
//Consider CaloParticles coming from the hard scatterer
//excluding the PU contribution and save the indices.
for (unsigned int cpId = 0; cpId < caloParticles.size(); ++cpId) {
if (caloParticles[cpId].g4Tracks()[0].eventId().event() != 0 or
caloParticles[cpId].g4Tracks()[0].eventId().bunchCrossing() != 0) {
LogDebug("HGCalValidator") << "Excluding CaloParticles from event: "
<< caloParticles[cpId].g4Tracks()[0].eventId().event()
<< " with BX: " << caloParticles[cpId].g4Tracks()[0].eventId().bunchCrossing()
<< std::endl;
continue;
}
cPIndices.emplace_back(cpId);
}
}
Expand Up @@ -7,6 +7,8 @@
#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h"
#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h"

#include "SimCalorimetry/HGCalAssociatorProducers/interface/AssociatorTools.h"

LayerClusterAssociatorByEnergyScoreImpl::LayerClusterAssociatorByEnergyScoreImpl(
edm::EDProductGetter const& productGetter,
bool hardScatterOnly,
Expand All @@ -23,21 +25,11 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections(
const auto& caloParticles = *cPCH.product();
auto nLayerClusters = clusters.size();
//Consider CaloParticles coming from the hard scatterer, excluding the PU contribution.
auto nCaloParticles = caloParticles.size();
std::vector<size_t> cPIndices;
//Consider CaloParticles coming from the hard scatterer
//excluding the PU contribution and save the indices.
for (unsigned int cpId = 0; cpId < nCaloParticles; ++cpId) {
if (hardScatterOnly_ && (caloParticles[cpId].g4Tracks()[0].eventId().event() != 0 or
caloParticles[cpId].g4Tracks()[0].eventId().bunchCrossing() != 0)) {
LogDebug("LayerClusterAssociatorByEnergyScoreImpl")
<< "Excluding CaloParticles from event: " << caloParticles[cpId].g4Tracks()[0].eventId().event()
<< " with BX: " << caloParticles[cpId].g4Tracks()[0].eventId().bunchCrossing() << std::endl;
continue;
}
cPIndices.emplace_back(cpId);
}
nCaloParticles = cPIndices.size();
removeCPFromPU(caloParticles, cPIndices);
auto nCaloParticles = cPIndices.size();

// Initialize cPOnLayer. To be returned outside, since it contains the
// information to compute the CaloParticle-To-LayerCluster score.
Expand Down
@@ -0,0 +1,12 @@
import FWCore.ParameterSet.Config as cms

layerClusterCaloParticleAssociation = cms.EDProducer("LCToCPAssociatorEDProducer",
associator = cms.InputTag('lcAssocByEnergyScoreProducer'),
label_cp = cms.InputTag("mix","MergedCaloTruth"),
label_lc = cms.InputTag("hgcalLayerClusters")
)

from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2
premix_stage2.toModify(layerClusterCaloParticleAssociation,
label_cp = "mixData:MergedCaloTruth"
)
@@ -0,0 +1,12 @@
import FWCore.ParameterSet.Config as cms

layerClusterSimClusterAssociation = cms.EDProducer("LCToSCAssociatorEDProducer",
associator = cms.InputTag('scAssocByEnergyScoreProducer'),
label_scl = cms.InputTag("mix","MergedCaloTruth"),
label_lcl = cms.InputTag("hgcalLayerClusters")
)

from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2
premix_stage2.toModify(layerClusterSimClusterAssociation,
label_scl = "mixData:MergedCaloTruth"
)
8 changes: 0 additions & 8 deletions SimDataFormats/Associations/python/LCToCPAssociation_cfi.py

This file was deleted.

8 changes: 0 additions & 8 deletions SimDataFormats/Associations/python/LCToSCAssociation_cfi.py

This file was deleted.

4 changes: 2 additions & 2 deletions Validation/Configuration/python/hgcalSimValid_cff.py
@@ -1,8 +1,8 @@
import FWCore.ParameterSet.Config as cms

from SimCalorimetry.HGCalSimProducers.hgcHitAssociation_cfi import lcAssocByEnergyScoreProducer, scAssocByEnergyScoreProducer
from SimDataFormats.Associations.LCToCPAssociation_cfi import layerClusterCaloParticleAssociation as layerClusterCaloParticleAssociationProducer
from SimDataFormats.Associations.LCToSCAssociation_cfi import layerClusterSimClusterAssociation as layerClusterSimClusterAssociationProducer
from SimCalorimetry.HGCalAssociatorProducers.LCToCPAssociation_cfi import layerClusterCaloParticleAssociation as layerClusterCaloParticleAssociationProducer
from SimCalorimetry.HGCalAssociatorProducers.LCToSCAssociation_cfi import layerClusterSimClusterAssociation as layerClusterSimClusterAssociationProducer

from Validation.HGCalValidation.simhitValidation_cff import *
from Validation.HGCalValidation.digiValidation_cff import *
Expand Down
15 changes: 3 additions & 12 deletions Validation/HGCalValidation/plugins/HGCalValidator.cc
@@ -1,5 +1,7 @@
#include "Validation/HGCalValidation/interface/HGCalValidator.h"

#include "SimCalorimetry/HGCalAssociatorProducers/interface/AssociatorTools.h"

#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

Expand Down Expand Up @@ -250,21 +252,10 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event,
histoProducerAlgo_->fill_info_histos(histograms.histoProducerAlgo, totallayers_to_monitor_);
}

auto nCaloParticles = caloParticles.size();
std::vector<size_t> cPIndices;
//Consider CaloParticles coming from the hard scatterer
//excluding the PU contribution and save the indices.
for (unsigned int cpId = 0; cpId < nCaloParticles; ++cpId) {
if (caloParticles[cpId].g4Tracks()[0].eventId().event() != 0 or
caloParticles[cpId].g4Tracks()[0].eventId().bunchCrossing() != 0) {
LogDebug("HGCalValidator") << "Excluding CaloParticles from event: "
<< caloParticles[cpId].g4Tracks()[0].eventId().event()
<< " with BX: " << caloParticles[cpId].g4Tracks()[0].eventId().bunchCrossing()
<< std::endl;
continue;
}
cPIndices.emplace_back(cpId);
}
removeCPFromPU(caloParticles, cPIndices);

// ##############################################
// fill caloparticles histograms
Expand Down
13 changes: 7 additions & 6 deletions Validation/HGCalValidation/python/HGCalValidator_cfi.py
Expand Up @@ -3,6 +3,9 @@
from Validation.HGCalValidation.CaloParticleSelectionForEfficiency_cfi import *
from Validation.HGCalValidation.HGVHistoProducerAlgoBlock_cfi import *

from SimCalorimetry.HGCalAssociatorProducers.LCToCPAssociation_cfi import layerClusterCaloParticleAssociation
from SimCalorimetry.HGCalAssociatorProducers.LCToSCAssociation_cfi import layerClusterSimClusterAssociation

from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
hgcalValidator = DQMEDAnalyzer(
"HGCalValidator",
Expand All @@ -13,7 +16,7 @@

### reco input configuration ###
#2dlayerclusters, pfclusters, multiclusters
label_lcl = cms.InputTag("hgcalLayerClusters"),
label_lcl = layerClusterCaloParticleAssociation.label_lc,
label_mcl = cms.VInputTag(
cms.InputTag("ticlMultiClustersFromTrackstersTrk"),
cms.InputTag("ticlMultiClustersFromTrackstersEM"),
Expand Down Expand Up @@ -43,10 +46,10 @@
cummatbudinxo = cms.FileInPath('Validation/HGCalValidation/data/D41.cumulative.xo'),

### sim input configuration ###
label_cp_effic = cms.InputTag("mix","MergedCaloTruth"),
label_cp_effic = layerClusterCaloParticleAssociation.label_cp,
label_cp_fake = cms.InputTag("mix","MergedCaloTruth"),
#simClusters
label_scl = cms.InputTag("mix","MergedCaloTruth"),
label_scl = layerClusterSimClusterAssociation.label_scl,

simVertices = cms.InputTag("g4SimHits"),

Expand All @@ -73,9 +76,7 @@

from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2
premix_stage2.toModify(hgcalValidator,
label_cp_effic = "mixData:MergedCaloTruth",
label_cp_fake = "mixData:MergedCaloTruth",
label_scl = "mixData:MergedCaloTruth"
label_cp_fake = "mixData:MergedCaloTruth"
)

from Configuration.Eras.Modifier_phase2_hgcalV10_cff import phase2_hgcalV10
Expand Down