Skip to content

Commit 8c8fe33

Browse files
authored
Merge pull request #47682 from AuroraPerego/fixCPfromPU
Fix missing `CaloParticle`s from pileup
2 parents 08ef9cc + 2c1ff13 commit 8c8fe33

File tree

4 files changed

+53
-15
lines changed

4 files changed

+53
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import FWCore.ParameterSet.Config as cms
2+
3+
# This modifier enables the CaloParticles from pileup in the HGCAL associators and simulated objects.
4+
enableCPfromPU = cms.Modifier()

Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py

+32
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,38 @@ def condition(self, fragment, stepList, key, hasHarvest):
900900
'--customise': 'RecoHGCal/TICL/customiseTICLFromReco.customiseTICLForDumper'}
901901
upgradeWFs['ticl_v5_withDumper'].step4 = {'--procModifiers': 'ticl_v5'}
902902

903+
class UpgradeWorkflow_CPfromPU(UpgradeWorkflow):
904+
def setup_(self, step, stepName, stepDict, k, properties):
905+
if ('Digi' in step and 'NoHLT' not in step) or ('HLTOnly' in step):
906+
stepDict[stepName][k] = merge([self.step2, stepDict[step][k]])
907+
if 'RecoGlobal' in step:
908+
stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
909+
if 'HARVESTGlobal' in step:
910+
stepDict[stepName][k] = merge([self.step4, stepDict[step][k]])
911+
def condition(self, fragment, stepList, key, hasHarvest):
912+
return (fragment=="TTbar_14TeV" or 'CloseByP' in fragment or 'Eta1p7_2p7' in fragment) and 'Run4' in key
913+
914+
upgradeWFs['CPfromPU'] = UpgradeWorkflow_CPfromPU(
915+
steps = [
916+
'HLTOnly',
917+
'DigiTrigger',
918+
'RecoGlobal',
919+
'HARVESTGlobal'
920+
],
921+
PU = [
922+
'HLTOnly',
923+
'DigiTrigger',
924+
'RecoGlobal',
925+
'HARVESTGlobal'
926+
],
927+
suffix = '_withCPfromPU',
928+
offset = 0.208,
929+
)
930+
931+
upgradeWFs['CPfromPU'].step2 = {'--procModifiers': 'enableCPfromPU'}
932+
upgradeWFs['CPfromPU'].step3 = {'--procModifiers': 'enableCPfromPU'}
933+
upgradeWFs['CPfromPU'].step4 = {'--procModifiers': 'enableCPfromPU'}
934+
903935
# Improved L2 seeding from L1Tk Muons and L3 Tracker Muon Inside-Out reconstruction first (Phase-2 Muon default)
904936
class UpgradeWorkflow_phase2L2AndL3Muons(UpgradeWorkflow):
905937
def setup_(self, step, stepName, stepDict, k, properties):
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1-
from SimCalorimetry.HGCalAssociatorProducers.hgCalLCToCPAssociatorByEnergyScoreProducer_cfi import hgCalLCToCPAssociatorByEnergyScoreProducer as lcAssocByEnergyScoreProducer
1+
import FWCore.ParameterSet.Config as cms
2+
from SimCalorimetry.HGCalAssociatorProducers.hgCalLCToCPAssociatorByEnergyScoreProducer_cfi import hgCalLCToCPAssociatorByEnergyScoreProducer as _lcAssocByEnergyScoreProducer
3+
from SimCalorimetry.HGCalAssociatorProducers.hgCalLCToSCAssociatorByEnergyScoreProducer_cfi import hgCalLCToSCAssociatorByEnergyScoreProducer as _scAssocByEnergyScoreProducer
24

3-
from SimCalorimetry.HGCalAssociatorProducers.hgCalLCToSCAssociatorByEnergyScoreProducer_cfi import hgCalLCToSCAssociatorByEnergyScoreProducer as scAssocByEnergyScoreProducer
5+
lcAssocByEnergyScoreProducer = _lcAssocByEnergyScoreProducer.clone(hardScatterOnly = cms.bool(True))
6+
scAssocByEnergyScoreProducer = _scAssocByEnergyScoreProducer.clone(hardScatterOnly = cms.bool(True))
7+
8+
from Configuration.ProcessModifiers.enableCPfromPU_cff import enableCPfromPU
9+
10+
enableCPfromPU.toModify(lcAssocByEnergyScoreProducer, hardScatterOnly = cms.bool(False))
11+
enableCPfromPU.toModify(scAssocByEnergyScoreProducer, hardScatterOnly = cms.bool(False))

SimDataFormats/Track/src/classes_def.xml

+7-13
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,14 @@
99
<version ClassVersion="12" checksum="3470347245"/>
1010
<version ClassVersion="11" checksum="1785575744"/>
1111
<version ClassVersion="10" checksum="1430205451"/>
12-
<ioread sourceClass = "SimTrack" version="[-12]" targetClass="SimTrack" source="" target="">
12+
<ioread sourceClass = "SimTrack" version="[-12]" targetClass="SimTrack" source="bool crossedBoundary_; int idAtBoundary_; math::XYZTLorentzVectorF positionAtBoundary_; math::XYZTLorentzVectorF momentumAtBoundary_; int igenpart" target="trackInfo_, idAtBoundary_, positionAtBoundary_, momentumAtBoundary_">
1313
<![CDATA[
14-
SimTrack tmp(newObj->type(), newObj->momentum(), newObj->vertIndex(), newObj->genpartIndex(), newObj->trackerSurfacePosition(), newObj->trackerSurfaceMomentum());
15-
tmp.setTrackId(newObj->trackId());
16-
tmp.setEventId(newObj->eventId());
17-
tmp.setCrossedBoundaryVars(
18-
newObj->crossedBoundary(), newObj->getIDAtBoundary(), newObj->getPositionAtBoundary(), newObj->getMomentumAtBoundary());
19-
if (newObj->isFromBackScattering()) {
20-
tmp.setFromBackScattering();
21-
}
22-
if (newObj->genpartIndex() != -1) {
23-
tmp.setIsPrimary();
24-
}
25-
*newObj=tmp;
14+
// set crossedBoundary infos
15+
newObj->setCrossedBoundaryVars(onfile.crossedBoundary_, onfile.idAtBoundary_, onfile.positionAtBoundary_, onfile.momentumAtBoundary_);
16+
// set isPrimary info of trackInfo_
17+
if (onfile.igenpart != -1)
18+
newObj->setIsPrimary();
19+
// it's not possible to set the isFromBackScattering info for old simTracks
2620
]]>
2721
</ioread>
2822
</class>

0 commit comments

Comments
 (0)