diff --git a/DQM/CSCMonitorModule/plugins/CSCDQM_Lock.h b/DQM/CSCMonitorModule/plugins/CSCDQM_Lock.h index a8282ade3f800..1c3f217785080 100644 --- a/DQM/CSCMonitorModule/plugins/CSCDQM_Lock.h +++ b/DQM/CSCMonitorModule/plugins/CSCDQM_Lock.h @@ -45,7 +45,7 @@ namespace cscdqm { #ifdef DQMMT boost::recursive_mutex mutex; #else - bool mutex; + bool mutex = false; #endif /** diff --git a/Fireworks/Core/src/FWItemValueGetter.cc b/Fireworks/Core/src/FWItemValueGetter.cc index 832013757ad0f..dc503588b4e97 100644 --- a/Fireworks/Core/src/FWItemValueGetter.cc +++ b/Fireworks/Core/src/FWItemValueGetter.cc @@ -73,7 +73,11 @@ FWItemValueGetter::FWItemValueGetter(const edm::TypeWithDict& iType, const std:: } else if (iPurpose == "HGCal Trigger Cell" || iPurpose == "HGCal Trigger Cluster") { addEntry("detId", 0); } else if (iPurpose == "CaloParticle") { - addEntry("energy", 1); + addEntry("energy", 3); + addEntry("pdgId()", 3, "pdgId"); + addEntry("simClusters().size()", 3, "SimClSize"); + } else if (iPurpose == "HGCal MultiCluster") { + addEntry("energy", 3); } else { // by the default add pt, et, or energy bool x = addEntry("pt", 1); diff --git a/Geometry/HGCalCommonData/data/TB181/Oct183/hgcal.xml b/Geometry/HGCalCommonData/data/TB181/Oct183/hgcal.xml index ce437b9adcadf..ba89ba3a204b3 100644 --- a/Geometry/HGCalCommonData/data/TB181/Oct183/hgcal.xml +++ b/Geometry/HGCalCommonData/data/TB181/Oct183/hgcal.xml @@ -249,5 +249,11 @@ + + + + + + diff --git a/RecoLocalCalo/Configuration/python/RecoLocalCalo_Commissioning_cff.py b/RecoLocalCalo/Configuration/python/RecoLocalCalo_Commissioning_cff.py index 35b8024a74870..32838d6984b21 100644 --- a/RecoLocalCalo/Configuration/python/RecoLocalCalo_Commissioning_cff.py +++ b/RecoLocalCalo/Configuration/python/RecoLocalCalo_Commissioning_cff.py @@ -26,11 +26,12 @@ # # sequence CaloLocalReco and CaloGlobalReco # -calolocalreco = cms.Sequence(ecalLocalRecoSequence+hcalLocalRecoSequence) -caloglobalreco = cms.Sequence(hcalGlobalRecoSequence) +calolocalrecoTask = cms.Task(ecalLocalRecoTask,hcalLocalRecoTask) +calolocalreco = cms.Sequence(calolocalrecoTask) # # R.Ofierzynski (29.Oct.2009): add NZS sequence # from RecoLocalCalo.Configuration.hcalLocalRecoNZS_cff import * -calolocalrecoNZS = cms.Sequence(ecalLocalRecoSequence+hcalLocalRecoSequence+hcalLocalRecoSequenceNZS) +calolocalrecoTaskNZS = cms.Task(ecalLocalRecoTask,hcalLocalRecoTask,hcalLocalRecoTaskNZS) +calolocalrecoNZS = cms.Sequence(calolocalrecoTaskNZS) diff --git a/RecoLocalCalo/Configuration/python/RecoLocalCalo_Cosmics_cff.py b/RecoLocalCalo/Configuration/python/RecoLocalCalo_Cosmics_cff.py index 5bed18e5a5362..47c486365424d 100644 --- a/RecoLocalCalo/Configuration/python/RecoLocalCalo_Cosmics_cff.py +++ b/RecoLocalCalo/Configuration/python/RecoLocalCalo_Cosmics_cff.py @@ -80,31 +80,32 @@ def hbheCosmic(module): from RecoLocalCalo.HcalRecProducers.hbheplan1_cfi import hbheplan1 # redefine hcal sequence -hcalLocalRecoSequence = cms.Sequence(hbhereco+hfreco+horeco+zdcreco) +hcalLocalRecoTask = cms.Task(hbhereco,hfreco,horeco,zdcreco) +hcalLocalRecoSequence = cms.Sequence(hcalLocalRecoTask) -_phase1_hcalLocalRecoSequence = hcalLocalRecoSequence.copy() -_phase1_hcalLocalRecoSequence.insert(0,hfprereco) -run2_HF_2017.toReplaceWith(hcalLocalRecoSequence, _phase1_hcalLocalRecoSequence) +_phase1_hcalLocalRecoTask = hcalLocalRecoTask.copy() +_phase1_hcalLocalRecoTask.add(hfprereco) +run2_HF_2017.toReplaceWith(hcalLocalRecoTask, _phase1_hcalLocalRecoTask) # shuffle modules so "hbheplan1" produces final collection of hits named "hbhereco" -_plan1_hcalLocalRecoSequence = _phase1_hcalLocalRecoSequence.copy() +_plan1_hcalLocalRecoTask = _phase1_hcalLocalRecoTask.copy() hbheprereco = hbhereco.clone() -_plan1_hcalLocalRecoSequence.insert(0,hbheprereco) +_plan1_hcalLocalRecoTask.add(hbheprereco) from Configuration.Eras.Modifier_run2_HEPlan1_2017_cff import run2_HEPlan1_2017 run2_HEPlan1_2017.toReplaceWith(hbhereco, hbheplan1) -run2_HEPlan1_2017.toReplaceWith(hcalLocalRecoSequence, _plan1_hcalLocalRecoSequence) +run2_HEPlan1_2017.toReplaceWith(hcalLocalRecoTask, _plan1_hcalLocalRecoTask) hbhecollapse = hbheplan1.clone() -_collapse_hcalLocalRecoSequence = _phase1_hcalLocalRecoSequence.copy() -_collapse_hcalLocalRecoSequence.insert(0,hbheprereco) +_collapse_hcalLocalRecoTask = _phase1_hcalLocalRecoTask.copy() +_collapse_hcalLocalRecoTask.add(hbheprereco) from Configuration.ProcessModifiers.run2_HECollapse_2018_cff import run2_HECollapse_2018 run2_HECollapse_2018.toReplaceWith(hbhereco, hbhecollapse) -run2_HECollapse_2018.toReplaceWith(hcalLocalRecoSequence, _collapse_hcalLocalRecoSequence) - -calolocalrecoCosmics = cms.Sequence(ecalLocalRecoSequenceCosmics+hcalLocalRecoSequence) - +run2_HECollapse_2018.toReplaceWith(hcalLocalRecoTask, _collapse_hcalLocalRecoTask) +calolocalrecoTaskCosmics = cms.Task(ecalLocalRecoTaskCosmics,hcalLocalRecoTask) +calolocalrecoCosmics = cms.Sequence(calolocalrecoTaskCosmics) # # R.Ofierzynski (29.Oct.2009): add NZS sequence # from RecoLocalCalo.Configuration.hcalLocalRecoNZS_cff import * -calolocalrecoCosmicsNZS = cms.Sequence(ecalLocalRecoSequenceCosmics+hcalLocalRecoSequence+hcalLocalRecoSequenceNZS) +calolocalrecoTaskCosmicsNZS = cms.Task(ecalLocalRecoTaskCosmics,hcalLocalRecoTask,hcalLocalRecoTaskNZS) +calolocalrecoCosmicsNZS = cms.Sequence(calolocalrecoTaskCosmicsNZS) diff --git a/RecoLocalCalo/Configuration/python/RecoLocalCalo_cff.py b/RecoLocalCalo/Configuration/python/RecoLocalCalo_cff.py index 9eb2ab324d49b..c899a980b2879 100644 --- a/RecoLocalCalo/Configuration/python/RecoLocalCalo_cff.py +++ b/RecoLocalCalo/Configuration/python/RecoLocalCalo_cff.py @@ -20,8 +20,8 @@ # # sequence CaloLocalReco and CaloGlobalReco # -calolocalreco = cms.Sequence(ecalLocalRecoSequence+hcalLocalRecoSequence) -caloglobalreco = cms.Sequence(hcalGlobalRecoSequence) +calolocalrecoTask = cms.Task(ecalLocalRecoTask,hcalLocalRecoTask) +calolocalreco = cms.Sequence(calolocalrecoTask) from RecoLocalCalo.HcalRecProducers.HcalHitSelection_cfi import * reducedHcalRecHitsSequence = cms.Sequence( reducedHcalRecHits ) @@ -30,11 +30,12 @@ # R.Ofierzynski (29.Oct.2009): add NZS sequence # from RecoLocalCalo.Configuration.hcalLocalRecoNZS_cff import * -calolocalrecoNZS = cms.Sequence(ecalLocalRecoSequence+hcalLocalRecoSequence+hcalLocalRecoSequenceNZS) +calolocalrecoTaskNZS = cms.Task(ecalLocalRecoTask,hcalLocalRecoTask,hcalLocalRecoTaskNZS) +calolocalrecoNZS = cms.Sequence(calolocalrecoTaskNZS) from RecoLocalCalo.Configuration.hgcalLocalReco_cff import * -_phase2_calolocalreco = calolocalreco.copy() -_phase2_calolocalreco += hgcalLocalRecoSequence +_phase2_calolocalrecoTask = calolocalrecoTask.copy() +_phase2_calolocalrecoTask.add(hgcalLocalRecoTask) from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal -phase2_hgcal.toReplaceWith( calolocalreco , _phase2_calolocalreco ) +phase2_hgcal.toReplaceWith( calolocalrecoTask , _phase2_calolocalrecoTask ) diff --git a/RecoLocalCalo/Configuration/python/ecalLocalRecoSequenceCosmics_cff.py b/RecoLocalCalo/Configuration/python/ecalLocalRecoSequenceCosmics_cff.py index 9238c8935c126..ce74351bc8c33 100644 --- a/RecoLocalCalo/Configuration/python/ecalLocalRecoSequenceCosmics_cff.py +++ b/RecoLocalCalo/Configuration/python/ecalLocalRecoSequenceCosmics_cff.py @@ -15,7 +15,8 @@ from RecoLocalCalo.EcalRecProducers.ecalRecHit_cfi import * from RecoLocalCalo.EcalRecProducers.ecalPreshowerRecHit_cfi import * from RecoLocalCalo.EcalRecProducers.ecalDetIdToBeRecovered_cfi import * -ecalLocalRecoSequenceCosmics = cms.Sequence(ecalFixedAlphaBetaFitUncalibRecHit*ecalWeightUncalibRecHit*ecalDetIdToBeRecovered*ecalRecHit+ecalPreshowerRecHit) +ecalLocalRecoTaskCosmics = cms.Task(ecalFixedAlphaBetaFitUncalibRecHit,ecalWeightUncalibRecHit,ecalDetIdToBeRecovered,ecalRecHit,ecalPreshowerRecHit) +ecalLocalRecoSequenceCosmics = cms.Sequence(ecalLocalRecoTaskCosmics) ecalRecHit.EBuncalibRecHitCollection = 'ecalFixedAlphaBetaFitUncalibRecHit:EcalUncalibRecHitsEB' ecalRecHit.EEuncalibRecHitCollection = 'ecalFixedAlphaBetaFitUncalibRecHit:EcalUncalibRecHitsEE' ecalRecHit.ChannelStatusToBeExcluded = [ diff --git a/RecoLocalCalo/Configuration/python/ecalLocalRecoSequence_cff.py b/RecoLocalCalo/Configuration/python/ecalLocalRecoSequence_cff.py index 5bdae46ed1e79..4e5f5c342e6f0 100644 --- a/RecoLocalCalo/Configuration/python/ecalLocalRecoSequence_cff.py +++ b/RecoLocalCalo/Configuration/python/ecalLocalRecoSequence_cff.py @@ -23,24 +23,29 @@ #ecalUncalibRecHitSequence = cms.Sequence(ecalGlobalUncalibRecHit* # ecalDetIdToBeRecovered) -ecalUncalibRecHitSequence = cms.Sequence(ecalMultiFitUncalibRecHit* +ecalUncalibRecHitTask = cms.Task(ecalMultiFitUncalibRecHit, ecalDetIdToBeRecovered) -ecalRecHitSequence = cms.Sequence(ecalRecHit* - ecalCompactTrigPrim* - ecalTPSkim+ +ecalRecHitTask = cms.Task(ecalRecHit, + ecalCompactTrigPrim, + ecalTPSkim, ecalPreshowerRecHit) -ecalLocalRecoSequence = cms.Sequence(ecalUncalibRecHitSequence* - ecalRecHitSequence) +ecalLocalRecoTask = cms.Task(ecalUncalibRecHitTask, + ecalRecHitTask) + +ecalUncalibRecHitSequence = cms.Sequence(ecalUncalibRecHitTask) +ecalRecHitSequence = cms.Sequence(ecalRecHitTask) +ecalLocalRecoSequence = cms.Sequence(ecalLocalRecoTask) + from RecoLocalCalo.EcalRecProducers.ecalDetailedTimeRecHit_cfi import * -_phase2_timing_ecalRecHitSequence = cms.Sequence( ecalRecHitSequence.copy() + ecalDetailedTimeRecHit ) +_phase2_timing_ecalRecHitTask = cms.Task( ecalRecHitTask.copy() , ecalDetailedTimeRecHit ) from Configuration.Eras.Modifier_phase2_timing_cff import phase2_timing -phase2_timing.toReplaceWith( ecalRecHitSequence, _phase2_timing_ecalRecHitSequence ) +phase2_timing.toReplaceWith( ecalRecHitTask, _phase2_timing_ecalRecHitTask ) -_fastSim_ecalRecHitSequence = ecalRecHitSequence.copyAndExclude([ecalCompactTrigPrim,ecalTPSkim]) -_fastSim_ecalUncalibRecHitSequence = ecalUncalibRecHitSequence.copyAndExclude([ecalDetIdToBeRecovered]) +_fastSim_ecalRecHitTask = ecalRecHitTask.copyAndExclude([ecalCompactTrigPrim,ecalTPSkim]) +_fastSim_ecalUncalibRecHitTask = ecalUncalibRecHitTask.copyAndExclude([ecalDetIdToBeRecovered]) from Configuration.Eras.Modifier_fastSim_cff import fastSim -fastSim.toReplaceWith(ecalRecHitSequence, _fastSim_ecalRecHitSequence) -fastSim.toReplaceWith(ecalUncalibRecHitSequence, _fastSim_ecalUncalibRecHitSequence) +fastSim.toReplaceWith(ecalRecHitTask, _fastSim_ecalRecHitTask) +fastSim.toReplaceWith(ecalUncalibRecHitTask, _fastSim_ecalUncalibRecHitTask) diff --git a/RecoLocalCalo/Configuration/python/hcalLocalRecoNZS_cff.py b/RecoLocalCalo/Configuration/python/hcalLocalRecoNZS_cff.py index 0b3d51db68c4a..1df23ad827e25 100644 --- a/RecoLocalCalo/Configuration/python/hcalLocalRecoNZS_cff.py +++ b/RecoLocalCalo/Configuration/python/hcalLocalRecoNZS_cff.py @@ -29,7 +29,8 @@ hfrecoMB.dropZSmarkedPassed = cms.bool(False) horecoMB.dropZSmarkedPassed = cms.bool(False) -hcalLocalRecoSequenceNZS = cms.Sequence(hbherecoMB*hfrecoMB*horecoMB) +hcalLocalRecoTaskNZS = cms.Task(hbherecoMB,hfrecoMB,horecoMB) +hcalLocalRecoSequenceNZS = cms.Sequence(hcalLocalRecoTaskNZS) import RecoLocalCalo.HcalRecProducers.hfprereco_cfi import RecoLocalCalo.HcalRecProducers.HFPhase1Reconstructor_cfi @@ -50,12 +51,13 @@ hbheInput = cms.InputTag("hbheprerecoMB") ) -_phase1_hcalLocalRecoSequenceNZS = hcalLocalRecoSequenceNZS.copy() -_phase1_hcalLocalRecoSequenceNZS.insert(0,hfprerecoMB) - +_phase1_hcalLocalRecoTaskNZS = hcalLocalRecoTaskNZS.copy() +_phase1_hcalLocalRecoTaskNZS.add(hfprerecoMB) + from Configuration.Eras.Modifier_run2_HF_2017_cff import run2_HF_2017 -run2_HF_2017.toReplaceWith( hcalLocalRecoSequenceNZS, _phase1_hcalLocalRecoSequenceNZS ) +run2_HF_2017.toReplaceWith( hcalLocalRecoTaskNZS, _phase1_hcalLocalRecoTaskNZS ) run2_HF_2017.toReplaceWith( hfrecoMB, _phase1_hfrecoMB ) + from Configuration.Eras.Modifier_run2_HCAL_2017_cff import run2_HCAL_2017 run2_HCAL_2017.toModify( hbherecoMB, processQIE11 = cms.bool(True), @@ -63,16 +65,16 @@ # setNoiseFlagsQIE11 = cms.bool(True), ) -_plan1_hcalLocalRecoSequenceNZS = _phase1_hcalLocalRecoSequenceNZS.copy() +_plan1_hcalLocalRecoTaskNZS = _phase1_hcalLocalRecoTaskNZS.copy() hbheprerecoMB = hbherecoMB.clone() -_plan1_hcalLocalRecoSequenceNZS.insert(0,hbheprerecoMB) +_plan1_hcalLocalRecoTaskNZS.add(hbheprerecoMB) from Configuration.Eras.Modifier_run2_HEPlan1_2017_cff import run2_HEPlan1_2017 run2_HEPlan1_2017.toReplaceWith(hbherecoMB, hbheplan1MB) -run2_HEPlan1_2017.toReplaceWith(hcalLocalRecoSequenceNZS, _plan1_hcalLocalRecoSequenceNZS) +run2_HEPlan1_2017.toReplaceWith(hcalLocalRecoTaskNZS, _plan1_hcalLocalRecoTaskNZS) hbhecollapseMB = hbheplan1MB.clone() -_collapse_hcalLocalRecoSequenceNZS = _phase1_hcalLocalRecoSequenceNZS.copy() -_collapse_hcalLocalRecoSequenceNZS.insert(0,hbheprerecoMB) +_collapse_hcalLocalRecoTaskNZS = _phase1_hcalLocalRecoTaskNZS.copy() +_collapse_hcalLocalRecoTaskNZS.add(hbheprerecoMB) from Configuration.ProcessModifiers.run2_HECollapse_2018_cff import run2_HECollapse_2018 run2_HECollapse_2018.toReplaceWith(hbherecoMB, hbhecollapseMB) -run2_HECollapse_2018.toReplaceWith(hcalLocalRecoSequenceNZS, _collapse_hcalLocalRecoSequenceNZS) +run2_HECollapse_2018.toReplaceWith(hcalLocalRecoTaskNZS, _collapse_hcalLocalRecoTaskNZS) diff --git a/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py b/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py index d6f1582e56f93..057707c80534e 100644 --- a/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py +++ b/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py @@ -15,7 +15,8 @@ from RecoLocalCalo.HcalRecProducers.HcalHitReconstructor_ho_cfi import * from RecoLocalCalo.HcalRecProducers.HcalHitReconstructor_hf_cfi import * from RecoLocalCalo.HcalRecProducers.HcalHitReconstructor_zdc_cfi import * -hcalLocalRecoSequence = cms.Sequence(hbheprereco+hfreco+horeco+zdcreco) +hcalLocalRecoTask = cms.Task(hbheprereco,hfreco,horeco,zdcreco) +hcalLocalRecoSequence = cms.Sequence(hcalLocalRecoTask) from RecoLocalCalo.HcalRecProducers.hfprereco_cfi import hfprereco from RecoLocalCalo.HcalRecProducers.HFPhase1Reconstructor_cfi import hfreco as _phase1_hfreco @@ -24,33 +25,33 @@ # copy for cosmics _default_hfreco = hfreco.clone() -_phase1_hcalLocalRecoSequence = hcalLocalRecoSequence.copy() -_phase1_hcalLocalRecoSequence.insert(0,hfprereco) +_phase1_hcalLocalRecoTask = hcalLocalRecoTask.copy() +_phase1_hcalLocalRecoTask.add(hfprereco) from Configuration.Eras.Modifier_run2_HF_2017_cff import run2_HF_2017 -run2_HF_2017.toReplaceWith( hcalLocalRecoSequence, _phase1_hcalLocalRecoSequence ) +run2_HF_2017.toReplaceWith( hcalLocalRecoTask, _phase1_hcalLocalRecoTask ) run2_HF_2017.toReplaceWith( hfreco, _phase1_hfreco ) from Configuration.Eras.Modifier_run2_HCAL_2017_cff import run2_HCAL_2017 run2_HCAL_2017.toReplaceWith( hbheprereco, _phase1_hbheprereco ) -_plan1_hcalLocalRecoSequence = _phase1_hcalLocalRecoSequence.copy() -_plan1_hcalLocalRecoSequence += hbheplan1 +_plan1_hcalLocalRecoTask = _phase1_hcalLocalRecoTask.copy() +_plan1_hcalLocalRecoTask.add(hbheplan1) from Configuration.Eras.Modifier_run2_HEPlan1_2017_cff import run2_HEPlan1_2017 -run2_HEPlan1_2017.toReplaceWith(hcalLocalRecoSequence, _plan1_hcalLocalRecoSequence) +run2_HEPlan1_2017.toReplaceWith(hcalLocalRecoTask, _plan1_hcalLocalRecoTask) hbhecollapse = hbheplan1.clone() -_collapse_hcalLocalRecoSequence = _phase1_hcalLocalRecoSequence.copy() -_collapse_hcalLocalRecoSequence += hbhecollapse +_collapse_hcalLocalRecoTask = _phase1_hcalLocalRecoTask.copy() +_collapse_hcalLocalRecoTask.add(hbhecollapse) from Configuration.ProcessModifiers.run2_HECollapse_2018_cff import run2_HECollapse_2018 -run2_HECollapse_2018.toReplaceWith(hcalLocalRecoSequence, _collapse_hcalLocalRecoSequence) +run2_HECollapse_2018.toReplaceWith(hcalLocalRecoTask, _collapse_hcalLocalRecoTask) -_phase2_hcalLocalRecoSequence = hcalLocalRecoSequence.copy() -_phase2_hcalLocalRecoSequence.remove(hbheprereco) +_phase2_hcalLocalRecoTask = hcalLocalRecoTask.copy() +_phase2_hcalLocalRecoTask.remove(hbheprereco) from Configuration.Eras.Modifier_phase2_hcal_cff import phase2_hcal -phase2_hcal.toReplaceWith( hcalLocalRecoSequence, _phase2_hcalLocalRecoSequence ) +phase2_hcal.toReplaceWith( hcalLocalRecoTask, _phase2_hcalLocalRecoTask ) -_fastSim_hcalLocalRecoSequence = hcalLocalRecoSequence.copyAndExclude([zdcreco]) +_fastSim_hcalLocalRecoTask = hcalLocalRecoTask.copyAndExclude([zdcreco]) from Configuration.Eras.Modifier_fastSim_cff import fastSim -fastSim.toReplaceWith( hcalLocalRecoSequence, _fastSim_hcalLocalRecoSequence ) +fastSim.toReplaceWith( hcalLocalRecoTask, _fastSim_hcalLocalRecoTask ) diff --git a/RecoLocalCalo/Configuration/python/hgcalLocalReco_cff.py b/RecoLocalCalo/Configuration/python/hgcalLocalReco_cff.py index fe984f4baa979..9cbac5488d53f 100644 --- a/RecoLocalCalo/Configuration/python/hgcalLocalReco_cff.py +++ b/RecoLocalCalo/Configuration/python/hgcalLocalReco_cff.py @@ -5,15 +5,16 @@ # patch particle flow clusters for HGC into local reco sequence # (for now until global reco is going with some sort of clustering) -from RecoParticleFlow.PFClusterProducer.particleFlowRecHitHGC_cff import * +from RecoParticleFlow.PFClusterProducer.particleFlowRecHitHGC_cfi import * from RecoParticleFlow.PFClusterProducer.particleFlowClusterHGC_cfi import * from RecoLocalCalo.HGCalRecProducers.hgcalMultiClusters_cfi import * from RecoLocalCalo.HGCalRecProducers.hgcalLayerClusters_cff import hgcalLayerClusters -hgcalLocalRecoSequence = cms.Sequence( HGCalUncalibRecHit+ - HGCalRecHit+ - hgcalLayerClusters+ - hgcalMultiClusters+ - particleFlowRecHitHGCSeq+ - particleFlowClusterHGCal+ +hgcalLocalRecoTask = cms.Task( HGCalUncalibRecHit, + HGCalRecHit, + hgcalLayerClusters, + hgcalMultiClusters, + particleFlowRecHitHGC, + particleFlowClusterHGCal, particleFlowClusterHGCalFromMultiCl ) +hgcalLocalRecoSequence = cms.Sequence(hgcalLocalRecoTask) diff --git a/RecoLocalCalo/HGCalRecAlgos/src/RecHitTools.cc b/RecoLocalCalo/HGCalRecAlgos/src/RecHitTools.cc index cf96b4fe8b409..f53a9b6e151be 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/RecHitTools.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/RecHitTools.cc @@ -138,7 +138,7 @@ GlobalPoint RecHitTools::getPosition(const DetId& id) const { } GlobalPoint RecHitTools::getPositionLayer(int layer, bool nose) const { - int lay = std::abs(layer); + unsigned int lay = std::abs(layer); double z(0); if (nose) { auto geomNose = @@ -150,6 +150,10 @@ GlobalPoint RecHitTools::getPositionLayer(int layer, bool nose) const { } } else { const HGCalDDDConstants* ddd = get_ddd(geom_, geometryType_, fhOffset_, lay); + if (geometryType_ == 1) { + if (lay > fhOffset_) + lay -= fhOffset_; + } z = (layer > 0) ? ddd->waferZ(lay, true) : -ddd->waferZ(lay, true); } return GlobalPoint(0, 0, z); diff --git a/RecoLocalCalo/HGCalRecProducers/python/HGCalLocalRecoTestBeamSequence_cff.py b/RecoLocalCalo/HGCalRecProducers/python/HGCalLocalRecoTestBeamSequence_cff.py index 1c09fae00798e..7d25e841c3295 100644 --- a/RecoLocalCalo/HGCalRecProducers/python/HGCalLocalRecoTestBeamSequence_cff.py +++ b/RecoLocalCalo/HGCalRecProducers/python/HGCalLocalRecoTestBeamSequence_cff.py @@ -6,4 +6,5 @@ from RecoLocalCalo.HGCalRecProducers.hgcalLayerClusters_cff import hgcalLayerClusters from RecoLocalCalo.HGCalRecProducers.hgcalMultiClusters_cfi import * -HGCalLocalRecoTestBeamSequence = cms.Sequence(HGCalUncalibRecHit*HGCalRecHit*hgcalLayerClusters*hgcalMultiClusters) +HGCalLocalRecoTestBeamTask = cms.Task(HGCalUncalibRecHit,HGCalRecHit,hgcalLayerClusters,hgcalMultiClusters) +HGCalLocalRecoTestBeamSequence = cms.Sequence(HGCalLocalRecoTestBeamTask) diff --git a/SimG4CMS/Calo/data/APD1ProdCuts.xml b/SimG4CMS/Calo/data/APD1ProdCuts.xml new file mode 100644 index 0000000000000..b50bf6a89ff29 --- /dev/null +++ b/SimG4CMS/Calo/data/APD1ProdCuts.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/SimG4CMS/Calo/data/APD1sens.xml b/SimG4CMS/Calo/data/APD1sens.xml new file mode 100644 index 0000000000000..7527ee8981be6 --- /dev/null +++ b/SimG4CMS/Calo/data/APD1sens.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimG4CMS/Calo/python/GeometryAPD1XML_cfi.py b/SimG4CMS/Calo/python/GeometryAPD1XML_cfi.py new file mode 100644 index 0000000000000..5b743de00d945 --- /dev/null +++ b/SimG4CMS/Calo/python/GeometryAPD1XML_cfi.py @@ -0,0 +1,262 @@ +import FWCore.ParameterSet.Config as cms + +XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", + geomXMLFiles = cms.vstring('Geometry/CMSCommonData/data/materials.xml', + 'Geometry/CMSCommonData/data/rotations.xml', + 'Geometry/CMSCommonData/data/normal/cmsextent.xml', + 'Geometry/CMSCommonData/data/cms.xml', + 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/cmsTracker.xml', + 'Geometry/CMSCommonData/data/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', + 'Geometry/CMSCommonData/data/muonBase.xml', + 'Geometry/CMSCommonData/data/cmsMuon.xml', + 'Geometry/CMSCommonData/data/mgnt.xml', + 'Geometry/CMSCommonData/data/beampipe.xml', + 'Geometry/CMSCommonData/data/cmsBeam.xml', + 'Geometry/CMSCommonData/data/muonMB.xml', + 'Geometry/CMSCommonData/data/muonMagnet.xml', + 'Geometry/TrackerCommonData/data/trackerParameters.xml', + 'Geometry/TrackerCommonData/data/pixfwdMaterials.xml', + 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', + 'Geometry/TrackerCommonData/data/pixfwdPlaq.xml', + 'Geometry/TrackerCommonData/data/pixfwdPlaq1x2.xml', + 'Geometry/TrackerCommonData/data/pixfwdPlaq1x5.xml', + 'Geometry/TrackerCommonData/data/pixfwdPlaq2x3.xml', + 'Geometry/TrackerCommonData/data/pixfwdPlaq2x4.xml', + 'Geometry/TrackerCommonData/data/pixfwdPlaq2x5.xml', + 'Geometry/TrackerCommonData/data/pixfwdPanelBase.xml', + 'Geometry/TrackerCommonData/data/pixfwdPanel.xml', + 'Geometry/TrackerCommonData/data/pixfwdBlade.xml', + 'Geometry/TrackerCommonData/data/pixfwdNipple.xml', + 'Geometry/TrackerCommonData/data/pixfwdDisk.xml', + 'Geometry/TrackerCommonData/data/pixfwdCylinder.xml', + 'Geometry/TrackerCommonData/data/pixfwd.xml', + 'Geometry/TrackerCommonData/data/pixbarmaterial.xml', + 'Geometry/TrackerCommonData/data/pixbarladder.xml', + 'Geometry/TrackerCommonData/data/pixbarladderfull.xml', + 'Geometry/TrackerCommonData/data/pixbarladderhalf.xml', + 'Geometry/TrackerCommonData/data/pixbarlayer.xml', + 'Geometry/TrackerCommonData/data/pixbarlayer0.xml', + 'Geometry/TrackerCommonData/data/pixbarlayer1.xml', + 'Geometry/TrackerCommonData/data/pixbarlayer2.xml', + 'Geometry/TrackerCommonData/data/pixbar.xml', + 'Geometry/TrackerCommonData/data/tibtidcommonmaterial.xml', + 'Geometry/TrackerCommonData/data/tibmaterial.xml', + 'Geometry/TrackerCommonData/data/tibmodpar.xml', + 'Geometry/TrackerCommonData/data/tibmodule0.xml', + 'Geometry/TrackerCommonData/data/tibmodule0a.xml', + 'Geometry/TrackerCommonData/data/tibmodule0b.xml', + 'Geometry/TrackerCommonData/data/tibmodule2.xml', + 'Geometry/TrackerCommonData/data/tibstringpar.xml', + 'Geometry/TrackerCommonData/data/tibstring0ll.xml', + 'Geometry/TrackerCommonData/data/tibstring0lr.xml', + 'Geometry/TrackerCommonData/data/tibstring0ul.xml', + 'Geometry/TrackerCommonData/data/tibstring0ur.xml', + 'Geometry/TrackerCommonData/data/tibstring0.xml', + 'Geometry/TrackerCommonData/data/tibstring1ll.xml', + 'Geometry/TrackerCommonData/data/tibstring1lr.xml', + 'Geometry/TrackerCommonData/data/tibstring1ul.xml', + 'Geometry/TrackerCommonData/data/tibstring1ur.xml', + 'Geometry/TrackerCommonData/data/tibstring1.xml', + 'Geometry/TrackerCommonData/data/tibstring2ll.xml', + 'Geometry/TrackerCommonData/data/tibstring2lr.xml', + 'Geometry/TrackerCommonData/data/tibstring2ul.xml', + 'Geometry/TrackerCommonData/data/tibstring2ur.xml', + 'Geometry/TrackerCommonData/data/tibstring2.xml', + 'Geometry/TrackerCommonData/data/tibstring3ll.xml', + 'Geometry/TrackerCommonData/data/tibstring3lr.xml', + 'Geometry/TrackerCommonData/data/tibstring3ul.xml', + 'Geometry/TrackerCommonData/data/tibstring3ur.xml', + 'Geometry/TrackerCommonData/data/tibstring3.xml', + 'Geometry/TrackerCommonData/data/tiblayerpar.xml', + 'Geometry/TrackerCommonData/data/tiblayer0.xml', + 'Geometry/TrackerCommonData/data/tiblayer1.xml', + 'Geometry/TrackerCommonData/data/tiblayer2.xml', + 'Geometry/TrackerCommonData/data/tiblayer3.xml', + 'Geometry/TrackerCommonData/data/tib.xml', + 'Geometry/TrackerCommonData/data/tidmaterial.xml', + 'Geometry/TrackerCommonData/data/tidmodpar.xml', + 'Geometry/TrackerCommonData/data/tidmodule0.xml', + 'Geometry/TrackerCommonData/data/tidmodule0r.xml', + 'Geometry/TrackerCommonData/data/tidmodule0l.xml', + 'Geometry/TrackerCommonData/data/tidmodule1.xml', + 'Geometry/TrackerCommonData/data/tidmodule1r.xml', + 'Geometry/TrackerCommonData/data/tidmodule1l.xml', + 'Geometry/TrackerCommonData/data/tidmodule2.xml', + 'Geometry/TrackerCommonData/data/tidringpar.xml', + 'Geometry/TrackerCommonData/data/tidring0.xml', + 'Geometry/TrackerCommonData/data/tidring0f.xml', + 'Geometry/TrackerCommonData/data/tidring0b.xml', + 'Geometry/TrackerCommonData/data/tidring1.xml', + 'Geometry/TrackerCommonData/data/tidring1f.xml', + 'Geometry/TrackerCommonData/data/tidring1b.xml', + 'Geometry/TrackerCommonData/data/tidring2.xml', + 'Geometry/TrackerCommonData/data/tid.xml', + 'Geometry/TrackerCommonData/data/tidf.xml', + 'Geometry/TrackerCommonData/data/tidb.xml', + 'Geometry/TrackerCommonData/data/tibtidservices.xml', + 'Geometry/TrackerCommonData/data/tibtidservicesf.xml', + 'Geometry/TrackerCommonData/data/tibtidservicesb.xml', + 'Geometry/TrackerCommonData/data/tobmaterial.xml', + 'Geometry/TrackerCommonData/data/tobmodpar.xml', + 'Geometry/TrackerCommonData/data/tobmodule0.xml', + 'Geometry/TrackerCommonData/data/tobmodule2.xml', + 'Geometry/TrackerCommonData/data/tobmodule4.xml', + 'Geometry/TrackerCommonData/data/tobrodpar.xml', + 'Geometry/TrackerCommonData/data/tobrod0c.xml', + 'Geometry/TrackerCommonData/data/tobrod0l.xml', + 'Geometry/TrackerCommonData/data/tobrod0h.xml', + 'Geometry/TrackerCommonData/data/tobrod0.xml', + 'Geometry/TrackerCommonData/data/tobrod1l.xml', + 'Geometry/TrackerCommonData/data/tobrod1h.xml', + 'Geometry/TrackerCommonData/data/tobrod1.xml', + 'Geometry/TrackerCommonData/data/tobrod2c.xml', + 'Geometry/TrackerCommonData/data/tobrod2l.xml', + 'Geometry/TrackerCommonData/data/tobrod2h.xml', + 'Geometry/TrackerCommonData/data/tobrod2.xml', + 'Geometry/TrackerCommonData/data/tobrod3l.xml', + 'Geometry/TrackerCommonData/data/tobrod3h.xml', + 'Geometry/TrackerCommonData/data/tobrod3.xml', + 'Geometry/TrackerCommonData/data/tobrod4c.xml', + 'Geometry/TrackerCommonData/data/tobrod4l.xml', + 'Geometry/TrackerCommonData/data/tobrod4h.xml', + 'Geometry/TrackerCommonData/data/tobrod4.xml', + 'Geometry/TrackerCommonData/data/tobrod5l.xml', + 'Geometry/TrackerCommonData/data/tobrod5h.xml', + 'Geometry/TrackerCommonData/data/tobrod5.xml', + 'Geometry/TrackerCommonData/data/tob.xml', + 'Geometry/TrackerCommonData/data/tecmaterial.xml', + 'Geometry/TrackerCommonData/data/tecmodpar.xml', + 'Geometry/TrackerCommonData/data/tecmodule0.xml', + 'Geometry/TrackerCommonData/data/tecmodule0r.xml', + 'Geometry/TrackerCommonData/data/tecmodule0s.xml', + 'Geometry/TrackerCommonData/data/tecmodule1.xml', + 'Geometry/TrackerCommonData/data/tecmodule1r.xml', + 'Geometry/TrackerCommonData/data/tecmodule1s.xml', + 'Geometry/TrackerCommonData/data/tecmodule2.xml', + 'Geometry/TrackerCommonData/data/tecmodule3.xml', + 'Geometry/TrackerCommonData/data/tecmodule4.xml', + 'Geometry/TrackerCommonData/data/tecmodule4r.xml', + 'Geometry/TrackerCommonData/data/tecmodule4s.xml', + 'Geometry/TrackerCommonData/data/tecmodule5.xml', + 'Geometry/TrackerCommonData/data/tecmodule6.xml', + 'Geometry/TrackerCommonData/data/tecpetpar.xml', + 'Geometry/TrackerCommonData/data/tecring0.xml', + 'Geometry/TrackerCommonData/data/tecring1.xml', + 'Geometry/TrackerCommonData/data/tecring2.xml', + 'Geometry/TrackerCommonData/data/tecring3.xml', + 'Geometry/TrackerCommonData/data/tecring4.xml', + 'Geometry/TrackerCommonData/data/tecring5.xml', + 'Geometry/TrackerCommonData/data/tecring6.xml', + 'Geometry/TrackerCommonData/data/tecring0f.xml', + 'Geometry/TrackerCommonData/data/tecring1f.xml', + 'Geometry/TrackerCommonData/data/tecring2f.xml', + 'Geometry/TrackerCommonData/data/tecring3f.xml', + 'Geometry/TrackerCommonData/data/tecring4f.xml', + 'Geometry/TrackerCommonData/data/tecring5f.xml', + 'Geometry/TrackerCommonData/data/tecring6f.xml', + 'Geometry/TrackerCommonData/data/tecring0b.xml', + 'Geometry/TrackerCommonData/data/tecring1b.xml', + 'Geometry/TrackerCommonData/data/tecring2b.xml', + 'Geometry/TrackerCommonData/data/tecring3b.xml', + 'Geometry/TrackerCommonData/data/tecring4b.xml', + 'Geometry/TrackerCommonData/data/tecring5b.xml', + 'Geometry/TrackerCommonData/data/tecring6b.xml', + 'Geometry/TrackerCommonData/data/tecpetalf.xml', + 'Geometry/TrackerCommonData/data/tecpetalb.xml', + 'Geometry/TrackerCommonData/data/tecpetal0.xml', + 'Geometry/TrackerCommonData/data/tecpetal0f.xml', + 'Geometry/TrackerCommonData/data/tecpetal0b.xml', + 'Geometry/TrackerCommonData/data/tecpetal3.xml', + 'Geometry/TrackerCommonData/data/tecpetal3f.xml', + 'Geometry/TrackerCommonData/data/tecpetal3b.xml', + 'Geometry/TrackerCommonData/data/tecpetal6f.xml', + 'Geometry/TrackerCommonData/data/tecpetal6b.xml', + 'Geometry/TrackerCommonData/data/tecpetal8f.xml', + 'Geometry/TrackerCommonData/data/tecpetal8b.xml', + 'Geometry/TrackerCommonData/data/tecwheel.xml', + 'Geometry/TrackerCommonData/data/tecwheela.xml', + 'Geometry/TrackerCommonData/data/tecwheelb.xml', + 'Geometry/TrackerCommonData/data/tecwheelc.xml', + 'Geometry/TrackerCommonData/data/tecwheeld.xml', + 'Geometry/TrackerCommonData/data/tecwheel6.xml', + 'Geometry/TrackerCommonData/data/tecservices.xml', + 'Geometry/TrackerCommonData/data/tecbackplate.xml', + 'Geometry/TrackerCommonData/data/tec.xml', + 'Geometry/TrackerCommonData/data/trackermaterial.xml', + 'Geometry/TrackerCommonData/data/tracker.xml', + 'Geometry/TrackerCommonData/data/trackerpixbar.xml', + 'Geometry/TrackerCommonData/data/trackerpixfwd.xml', + 'Geometry/TrackerCommonData/data/trackertibtidservices.xml', + 'Geometry/TrackerCommonData/data/trackertib.xml', + 'Geometry/TrackerCommonData/data/trackertid.xml', + 'Geometry/TrackerCommonData/data/trackertob.xml', + 'Geometry/TrackerCommonData/data/trackertec.xml', + 'Geometry/TrackerCommonData/data/trackerbulkhead.xml', + 'Geometry/TrackerCommonData/data/trackerother.xml', + 'Geometry/EcalCommonData/data/eregalgo.xml', + 'Geometry/EcalCommonData/data/ebNoAPD/ebalgo.xml', + 'Geometry/EcalCommonData/data/ebcon.xml', + 'Geometry/EcalCommonData/data/ebrot.xml', + 'Geometry/EcalCommonData/data/eecon.xml', + 'Geometry/EcalCommonData/data/eefixed.xml', + 'Geometry/EcalCommonData/data/eehier.xml', + 'Geometry/EcalCommonData/data/eealgo.xml', + 'Geometry/EcalCommonData/data/escon.xml', + 'Geometry/EcalCommonData/data/esalgo.xml', + 'Geometry/EcalCommonData/data/eeF.xml', + 'Geometry/EcalCommonData/data/eeB.xml', + 'Geometry/EcalCommonData/data/ectkcable.xml', + 'Geometry/HcalCommonData/data/hcalrotations.xml', + 'Geometry/HcalCommonData/data/hcalalgo.xml', + 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', + 'Geometry/HcalCommonData/data/hcalendcapalgo.xml', + 'Geometry/HcalCommonData/data/hcalouteralgo.xml', + 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', + 'Geometry/HcalCommonData/data/hcalforwardfibre.xml', + 'Geometry/HcalCommonData/data/hcalforwardmaterial.xml', + 'Geometry/HcalCommonData/data/hcalSimNumbering.xml', + 'Geometry/HcalCommonData/data/hcalRecNumbering.xml', + 'Geometry/MuonCommonData/data/mbCommon.xml', + 'Geometry/MuonCommonData/data/mb1.xml', + 'Geometry/MuonCommonData/data/mb2.xml', + 'Geometry/MuonCommonData/data/mb3.xml', + 'Geometry/MuonCommonData/data/mb4.xml', + 'Geometry/MuonCommonData/data/muonYoke.xml', + 'Geometry/MuonCommonData/data/mf.xml', + 'Geometry/ForwardCommonData/data/forward.xml', + 'Geometry/ForwardCommonData/data/forwardshield.xml', + 'Geometry/ForwardCommonData/data/brmrotations.xml', + 'Geometry/ForwardCommonData/data/brm.xml', + 'Geometry/ForwardCommonData/data/totemMaterials.xml', + 'Geometry/ForwardCommonData/data/totemRotations.xml', + 'Geometry/ForwardCommonData/data/totemt1.xml', + 'Geometry/ForwardCommonData/data/totemt2.xml', + 'Geometry/ForwardCommonData/data/ionpump.xml')+cms.vstring( + 'Geometry/MuonCommonData/data/muonNumbering.xml', + 'Geometry/TrackerCommonData/data/trackerStructureTopology.xml', + 'Geometry/TrackerSimData/data/trackersens.xml', + 'Geometry/TrackerRecoData/data/trackerRecoMaterial.xml', + 'SimG4CMS/Calo/data/APD1sens.xml', + 'Geometry/HcalCommonData/data/hcalsens/Run1/hcalsens.xml', + 'Geometry/HcalSimData/data/CaloUtil.xml', + 'Geometry/HcalSimData/data/hf.xml', + 'Geometry/HcalSimData/data/hffibre.xml', + 'Geometry/MuonSimData/data/muonSens.xml', + 'Geometry/DTGeometryBuilder/data/dtSpecsFilter.xml', + 'Geometry/CSCGeometryBuilder/data/cscSpecsFilter.xml', + 'Geometry/CSCGeometryBuilder/data/cscSpecs.xml', + 'Geometry/RPCGeometryBuilder/data/RPCSpecs.xml', + 'Geometry/ForwardCommonData/data/brmsens.xml', + 'Geometry/HcalSimData/data/HcalProdCuts.xml', + 'SimG4CMS/Calo/data/APD1ProdCuts.xml', + 'Geometry/EcalSimData/data/ESProdCuts.xml', + 'Geometry/TrackerSimData/data/trackerProdCuts.xml', + 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', + 'Geometry/MuonSimData/data/muonProdCuts.xml', + 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', + 'Geometry/CMSCommonData/data/FieldParameters.xml'), + rootNodeName = cms.string('cms:OCMS') +) + diff --git a/SimG4CMS/Calo/test/python/runWithAPDTest_cfg.py b/SimG4CMS/Calo/test/python/runWithAPDTest_cfg.py index 969e18b88b762..7aab202af4b3d 100644 --- a/SimG4CMS/Calo/test/python/runWithAPDTest_cfg.py +++ b/SimG4CMS/Calo/test/python/runWithAPDTest_cfg.py @@ -5,7 +5,7 @@ process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") process.load('FWCore.MessageService.MessageLogger_cfi') process.load("IOMC.EventVertexGenerators.VtxSmearedGauss_cfi") -process.load("Geometry.CMSCommonData.cmsIdealGeometryAPD1XML_cfi") +process.load("SimG4CMS.Calo.GeometryAPD1XML_cfi") process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi") process.load("Geometry.HcalCommonData.hcalParameters_cfi") process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi") diff --git a/SimG4CMS/Calo/test/python/runWithGun_cfg.py b/SimG4CMS/Calo/test/python/runWithGun_cfg.py index 7fa86bfc927a3..36d129c7873f7 100644 --- a/SimG4CMS/Calo/test/python/runWithGun_cfg.py +++ b/SimG4CMS/Calo/test/python/runWithGun_cfg.py @@ -4,7 +4,7 @@ process.load("SimG4CMS.Calo.pythiapdt_cfi") process.load('FWCore.MessageService.MessageLogger_cfi') process.load("IOMC.EventVertexGenerators.VtxSmearedGauss_cfi") -process.load("Geometry.CMSCommonData.cmsIdealGeometryAPD1XML_cfi") +process.load("Geometry.CMSCommonData.cmsExtendedGeometry2021XML_cfi") process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi") process.load("Geometry.HcalCommonData.hcalParameters_cfi") process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi") @@ -15,7 +15,7 @@ process.load("SimG4CMS.Calo.CaloSimHitStudy_cfi") process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") from Configuration.AlCa.autoCond import autoCond -process.GlobalTag.globaltag = autoCond['run1_mc'] +process.GlobalTag.globaltag = autoCond['run2_mc'] if 'MessageLogger' in process.__dict__: process.MessageLogger.categories.append('G4cerr') diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py index dfa7b80292686..c38ec5c7c3eb5 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py @@ -89,7 +89,7 @@ process.schedule = cms.Schedule(process.generation_step, process.genfiltersummary_step, process.simulation_step, - process.gunfilter_step, +# process.gunfilter_step, process.endjob_step, ) # filter all path with the production filter sequence diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py index b982747a76b69..dbd43bac7bf4d 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py @@ -89,7 +89,7 @@ process.schedule = cms.Schedule(process.generation_step, process.genfiltersummary_step, process.simulation_step, - process.gunfilter_step, +# process.gunfilter_step, process.endjob_step, ) # filter all path with the production filter sequence diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py index ad3610decc73c..0c6553d0105ce 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py @@ -89,7 +89,7 @@ process.schedule = cms.Schedule(process.generation_step, process.genfiltersummary_step, process.simulation_step, - process.gunfilter_step, +# process.gunfilter_step, process.endjob_step, ) # filter all path with the production filter sequence diff --git a/SimG4CMS/HGCalTestBeam/test/dumpTBGeometry_cfg.py b/SimG4CMS/HGCalTestBeam/test/dumpTBGeometry_cfg.py new file mode 100644 index 0000000000000..0ad34f5b08ce5 --- /dev/null +++ b/SimG4CMS/HGCalTestBeam/test/dumpTBGeometry_cfg.py @@ -0,0 +1,26 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("DUMP") +process.load("SimG4CMS.HGCalTestBeam.HGCalTB181Oct3XML_cfi") +process.load('FWCore.MessageService.MessageLogger_cfi') + +if 'MessageLogger' in process.__dict__: + process.MessageLogger.categories.append('G4cerr') + process.MessageLogger.categories.append('G4cout') + process.MessageLogger.categories.append('HGCalGeom') + +process.source = cms.Source("EmptySource") + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +process.add_(cms.ESProducer("TGeoMgrFromDdd", + verbose = cms.untracked.bool(False), + level = cms.untracked.int32(14) +)) + +process.dump = cms.EDAnalyzer("DumpSimGeometry", + outputFileName = cms.untracked.string('TBGeom.root')) + +process.p = cms.Path(process.dump) diff --git a/SimG4Core/Geometry/interface/DDDWorld.h b/SimG4Core/Geometry/interface/DDDWorld.h index a934208662cd7..cc8de84286e98 100644 --- a/SimG4Core/Geometry/interface/DDDWorld.h +++ b/SimG4Core/Geometry/interface/DDDWorld.h @@ -1,8 +1,9 @@ #ifndef SimG4Core_DDDWorld_h #define SimG4Core_DDDWorld_h +#include "SimG4Core/Geometry/interface/G4LogicalVolumeToDDLogicalPartMap.h" +#include "SimG4Core/Geometry/interface/SensitiveDetectorCatalog.h" #include "G4VPhysicalVolume.hh" -#include "SimG4Core/Geometry/interface/DDGeometryReturnType.h" #include "DDG4/Geant4GeometryInfo.h" class DDG4Builder; @@ -14,7 +15,7 @@ namespace cms { class DDDWorld { public: - DDDWorld(const DDCompactView *, G4LogicalVolumeToDDLogicalPartMap &, SensitiveDetectorCatalog &, bool check = false); + DDDWorld(const DDCompactView *, G4LogicalVolumeToDDLogicalPartMap &, SensitiveDetectorCatalog &, bool check); DDDWorld(const cms::DDDetector *, dd4hep::sim::Geant4GeometryMaps::VolumeMap &); ~DDDWorld(); G4VPhysicalVolume *GetWorldVolume() const { return m_world; } diff --git a/SimG4Core/Geometry/interface/DDG4Builder.h b/SimG4Core/Geometry/interface/DDG4Builder.h index 80dc313be70fa..0d27ff1790cc7 100644 --- a/SimG4Core/Geometry/interface/DDG4Builder.h +++ b/SimG4Core/Geometry/interface/DDG4Builder.h @@ -1,8 +1,8 @@ #ifndef SimG4Core_DDG4Builder_h #define SimG4Core_DDG4Builder_h -#include "SimG4Core/Geometry/interface/DDGeometryReturnType.h" #include "SimG4Core/Notification/interface/DDG4DispContainer.h" +#include "SimG4Core/Geometry/interface/G4LogicalVolumeToDDLogicalPartMap.h" #include "DetectorDescription/Core/interface/DDLogicalPart.h" #include "DetectorDescription/Core/interface/DDMaterial.h" @@ -18,31 +18,29 @@ class G4VPhysicalVolume; class G4Material; class G4VSolid; class DDCompactView; +class SensitiveDetectorCatalog; class DDG4Builder { public: - DDG4Builder(const DDCompactView *, bool check = false); + DDG4Builder(const DDCompactView *, G4LogicalVolumeToDDLogicalPartMap &, bool check); ~DDG4Builder(); - DDGeometryReturnType BuildGeometry(); - static DDG4DispContainer *theVectorOfDDG4Dispatchables(); + G4LogicalVolume *BuildGeometry(SensitiveDetectorCatalog &); -protected: +private: G4VSolid *convertSolid(const DDSolid &dSolid); G4LogicalVolume *convertLV(const DDLogicalPart &dLogical); G4Material *convertMaterial(const DDMaterial &dMaterial); int getInt(const std::string &s, const DDLogicalPart &dLogical); double getDouble(const std::string &s, const DDLogicalPart &dLogical); -protected: DDG4SolidConverter *solidConverter_; std::map mats_; std::map sols_; std::map logs_; -private: - const DDCompactView *compactView; - static DDG4DispContainer *theVectorOfDDG4Dispatchables_; - G4LogicalVolumeToDDLogicalPartMap map_; + const DDCompactView *compactView_; + G4LogicalVolumeToDDLogicalPartMap &map_; + DDG4DispContainer *theVectorOfDDG4Dispatchables_; bool check_; }; diff --git a/SimG4Core/Geometry/interface/DDG4SensitiveConverter.h b/SimG4Core/Geometry/interface/DDG4SensitiveConverter.h index 3b430f967102c..a83fb63b5fa62 100644 --- a/SimG4Core/Geometry/interface/DDG4SensitiveConverter.h +++ b/SimG4Core/Geometry/interface/DDG4SensitiveConverter.h @@ -1,19 +1,20 @@ #ifndef SimG4Core_DDG4SensitiveConverter_h #define SimG4Core_DDG4SensitiveConverter_h -#include "DetectorDescription/Core/interface/DDLogicalPart.h" -#include "SimG4Core/Geometry/interface/SensitiveDetectorCatalog.h" #include "SimG4Core/Notification/interface/DDG4DispContainer.h" #include #include #include +class SensitiveDetectorCatalog; +class DDLogicalPart; + class DDG4SensitiveConverter { public: DDG4SensitiveConverter(); virtual ~DDG4SensitiveConverter(); - SensitiveDetectorCatalog upDate(const DDG4DispContainer &ddg4s); + void upDate(const DDG4DispContainer &ddg4s, SensitiveDetectorCatalog &); private: std::string getString(const std::string &, const DDLogicalPart *); diff --git a/SimG4Core/Geometry/src/DDDWorld.cc b/SimG4Core/Geometry/src/DDDWorld.cc index 7f70f41861d58..aa0beb95d5112 100644 --- a/SimG4Core/Geometry/src/DDDWorld.cc +++ b/SimG4Core/Geometry/src/DDDWorld.cc @@ -17,18 +17,15 @@ using namespace dd4hep; using namespace dd4hep::sim; DDDWorld::DDDWorld(const DDCompactView *cpv, - G4LogicalVolumeToDDLogicalPartMap &map, + G4LogicalVolumeToDDLogicalPartMap &lvmap, SensitiveDetectorCatalog &catalog, bool check) { LogVerbatim("SimG4CoreApplication") << "DDDWorld: initialization of Geant4 geometry"; - std::unique_ptr theBuilder(new DDG4Builder(cpv, check)); + std::unique_ptr theBuilder(new DDG4Builder(cpv, lvmap, check)); - DDGeometryReturnType ret = theBuilder->BuildGeometry(); - G4LogicalVolume *world = ret.logicalVolume(); + G4LogicalVolume *world = theBuilder->BuildGeometry(catalog); m_world = new G4PVPlacement(nullptr, G4ThreeVector(), world, "DDDWorld", nullptr, false, 0); - map = ret.lvToDDLPMap(); - catalog = ret.sdCatalog(); LogVerbatim("SimG4CoreApplication") << "DDDWorld: initialization of Geant4 geometry is done."; } diff --git a/SimG4Core/Geometry/src/DDG4Builder.cc b/SimG4Core/Geometry/src/DDG4Builder.cc index 32a4156076a16..9fa70949455e2 100644 --- a/SimG4Core/Geometry/src/DDG4Builder.cc +++ b/SimG4Core/Geometry/src/DDG4Builder.cc @@ -1,20 +1,17 @@ -#include "DetectorDescription/Core/interface/DDSpecifics.h" - #include "FWCore/Utilities/interface/Exception.h" -#include "DetectorDescription/Core/interface/DDCompactView.h" #include "SimG4Core/Geometry/interface/DDG4Builder.h" #include "SimG4Core/Geometry/interface/DDG4SensitiveConverter.h" #include "SimG4Core/Geometry/interface/DDG4SolidConverter.h" +#include "SimG4Core/Geometry/interface/SensitiveDetectorCatalog.h" + +#include "DetectorDescription/Core/interface/DDCompactView.h" +#include "DetectorDescription/Core/interface/DDSpecifics.h" -#include "G4Box.hh" -#include "G4Cons.hh" #include "G4LogicalVolume.hh" #include "G4Material.hh" #include "G4PVPlacement.hh" #include "G4ReflectionFactory.hh" -#include "G4Trap.hh" -#include "G4Tubs.hh" #include "G4VPhysicalVolume.hh" #include "G4VSolid.hh" @@ -25,12 +22,8 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" -DDG4DispContainer *DDG4Builder::theVectorOfDDG4Dispatchables_ = nullptr; - -DDG4DispContainer *DDG4Builder::theVectorOfDDG4Dispatchables() { return theVectorOfDDG4Dispatchables_; } - -DDG4Builder::DDG4Builder(const DDCompactView *cpv, bool check) - : solidConverter_(new DDG4SolidConverter), compactView(cpv), check_(check) { +DDG4Builder::DDG4Builder(const DDCompactView *cpv, G4LogicalVolumeToDDLogicalPartMap &lvmap, bool check) + : solidConverter_(new DDG4SolidConverter), compactView_(cpv), map_(lvmap), check_(check) { theVectorOfDDG4Dispatchables_ = new DDG4DispContainer(); } @@ -104,12 +97,12 @@ G4Material *DDG4Builder::convertMaterial(const DDMaterial &material) { return result; } -DDGeometryReturnType DDG4Builder::BuildGeometry() { +G4LogicalVolume *DDG4Builder::BuildGeometry(SensitiveDetectorCatalog &catalog) { G4ReflectionFactory *refFact = G4ReflectionFactory::Instance(); refFact->SetScalePrecision(100. * refFact->GetScalePrecision()); using Graph = DDCompactView::Graph; - const auto &gra = compactView->graph(); + const auto &gra = compactView_->graph(); using adjl_iterator = Graph::const_adj_iterator; adjl_iterator git = gra.begin(); adjl_iterator gend = gra.end(); @@ -188,15 +181,15 @@ DDGeometryReturnType DDG4Builder::BuildGeometry() { } } - G4LogicalVolume *world = logs_[compactView->root()]; + G4LogicalVolume *world = logs_[compactView_->root()]; // // needed for building sensitive detectors // DDG4SensitiveConverter conv_; - SensitiveDetectorCatalog catalog = conv_.upDate(*theVectorOfDDG4Dispatchables_); + conv_.upDate(*theVectorOfDDG4Dispatchables_, catalog); - return DDGeometryReturnType(world, map_, catalog); + return world; } int DDG4Builder::getInt(const std::string &ss, const DDLogicalPart &part) { diff --git a/SimG4Core/Geometry/src/DDG4SensitiveConverter.cc b/SimG4Core/Geometry/src/DDG4SensitiveConverter.cc index f4c7cc9c788fa..5aa05c36d07f6 100644 --- a/SimG4Core/Geometry/src/DDG4SensitiveConverter.cc +++ b/SimG4Core/Geometry/src/DDG4SensitiveConverter.cc @@ -1,4 +1,7 @@ #include "SimG4Core/Geometry/interface/DDG4SensitiveConverter.h" +#include "SimG4Core/Geometry/interface/SensitiveDetectorCatalog.h" + +#include "DetectorDescription/Core/interface/DDLogicalPart.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" @@ -9,9 +12,8 @@ DDG4SensitiveConverter::DDG4SensitiveConverter() {} DDG4SensitiveConverter::~DDG4SensitiveConverter() {} -SensitiveDetectorCatalog DDG4SensitiveConverter::upDate(const DDG4DispContainer &ddg4s) { +void DDG4SensitiveConverter::upDate(const DDG4DispContainer &ddg4s, SensitiveDetectorCatalog &catalog) { LogDebug("SimG4CoreGeometry") << " DDG4SensitiveConverter::upDate() starts"; - SensitiveDetectorCatalog catalog; for (auto ddg4 : ddg4s) { const DDLogicalPart *part = (ddg4->getDDLogicalPart()); @@ -27,7 +29,6 @@ SensitiveDetectorCatalog DDG4SensitiveConverter::upDate(const DDG4DispContainer catalog.insert(sClassName, sROUName, fff); } } - return catalog; } std::string DDG4SensitiveConverter::getString(const std::string &ss, const DDLogicalPart *part) { diff --git a/Validation/Configuration/python/ECALHCAL.py b/Validation/Configuration/python/ECALHCAL.py index e699246bfab6c..50013e0859c30 100644 --- a/Validation/Configuration/python/ECALHCAL.py +++ b/Validation/Configuration/python/ECALHCAL.py @@ -68,7 +68,7 @@ def customise(process): cms.InputTag("interestingEcalDetIdEE"), ) - process.local_digireco = cms.Path(process.mix * process.addPileupInfo * process.bunchSpacingProducer * process.calDigi * process.ecalPacker * process.esDigiToRaw * process.hcalRawData * process.rawDataCollector * process.ecalDigis * process.ecalPreshowerDigis * process.hcalDigis * process.calolocalreco *(process.ecalClustersNoPFBox+process.caloTowersRec) * process.reducedEcalRecHitsSequenceEcalOnly ) + process.local_digireco = cms.Path(process.mix * process.addPileupInfo * process.bunchSpacingProducer * process.calDigi * process.ecalPacker * process.esDigiToRaw * process.hcalRawData * process.rawDataCollector * process.ecalDigis * process.ecalPreshowerDigis * process.hcalDigis * process.calolocalreco * process.hbhereco * process.hfreco * process.horeco *(process.ecalClustersNoPFBox+process.caloTowersRec) * process.reducedEcalRecHitsSequenceEcalOnly ) process.schedule.append(process.local_digireco) diff --git a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h index b6c647dc3dfc9..2a86d884248e1 100644 --- a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h +++ b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h @@ -174,11 +174,13 @@ class HGVHistoProducerAlgo { void layerClusters_to_CaloParticles(const Histograms& histograms, const reco::CaloClusterCollection& clusters, std::vector const& cP, + std::vector const& cPIndices, std::map const&, unsigned layers) const; void multiClusters_to_CaloParticles(const Histograms& histograms, const std::vector& multiClusters, std::vector const& cP, + std::vector const& cPIndices, std::map const&, unsigned layers, std::vector contimulti) const; @@ -193,6 +195,7 @@ class HGVHistoProducerAlgo { const reco::CaloClusterCollection& clusters, const Density& densities, std::vector const& cP, + std::vector const& cPIndices, std::map const&, std::map cummatbudg, unsigned layers, @@ -201,6 +204,7 @@ class HGVHistoProducerAlgo { int count, const std::vector& multiClusters, std::vector const& cP, + std::vector const& cPIndices, std::map const&, unsigned layers) const; double distance2(const double x1, const double y1, const double x2, const double y2) const; @@ -212,14 +216,14 @@ class HGVHistoProducerAlgo { struct detIdInfoInCluster { bool operator==(const detIdInfoInCluster& o) const { return clusterId == o.clusterId; }; - unsigned int clusterId; + long unsigned int clusterId; float fraction; }; struct detIdInfoInMultiCluster { bool operator==(const detIdInfoInMultiCluster& o) const { return multiclusterId == o.multiclusterId; }; unsigned int multiclusterId; - unsigned int clusterId; + long unsigned int clusterId; float fraction; }; diff --git a/Validation/HGCalValidation/plugins/HGCalValidator.cc b/Validation/HGCalValidation/plugins/HGCalValidator.cc index 3174fd4fb9e8f..eea9bd53f821c 100644 --- a/Validation/HGCalValidation/plugins/HGCalValidator.cc +++ b/Validation/HGCalValidation/plugins/HGCalValidator.cc @@ -192,6 +192,22 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, histoProducerAlgo_->fill_info_histos(histograms.histoProducerAlgo, totallayers_to_monitor_); } + auto nCaloParticles = caloParticles.size(); + std::vector 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); + } + // ############################################## // fill caloparticles histograms // ############################################## @@ -225,6 +241,7 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, clusters, densities, caloParticles, + cPIndices, hitMap, cummatbudg, totallayers_to_monitor_, @@ -238,7 +255,7 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, if (domulticlustersPlots_) { w++; histoProducerAlgo_->fill_multi_cluster_histos( - histograms.histoProducerAlgo, w, multiClusters, caloParticles, hitMap, totallayers_to_monitor_); + histograms.histoProducerAlgo, w, multiClusters, caloParticles, cPIndices, hitMap, totallayers_to_monitor_); } //General Info diff --git a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc index 42e775b273b03..96043d576b260 100644 --- a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc +++ b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc @@ -868,10 +868,12 @@ void HGVHistoProducerAlgo::fill_cluster_histos(const Histograms& histograms, void HGVHistoProducerAlgo::layerClusters_to_CaloParticles(const Histograms& histograms, const reco::CaloClusterCollection& clusters, std::vector const& cP, + std::vector const& cPIndices, std::map const& hitMap, unsigned layers) const { auto nLayerClusters = clusters.size(); - auto nCaloParticles = cP.size(); + //Consider CaloParticles coming from the hard scatterer, excluding the PU contribution. + auto nCaloParticles = cPIndices.size(); std::unordered_map> detIdToCaloParticleId_Map; std::unordered_map> detIdToLayerClusterId_Map; @@ -891,7 +893,7 @@ void HGVHistoProducerAlgo::layerClusters_to_CaloParticles(const Histograms& hist } } - for (unsigned int cpId = 0; cpId < nCaloParticles; ++cpId) { + for (const auto& cpId : cPIndices) { const SimClusterRefVector& simClusterRefVector = cP[cpId].simClusters(); for (const auto& it_sc : simClusterRefVector) { const SimCluster& simCluster = (*(it_sc)); @@ -1220,7 +1222,7 @@ void HGVHistoProducerAlgo::layerClusters_to_CaloParticles(const Histograms& hist histograms.h_denom_layercl_phi_perlayer.at(lcLayerId).fill(clusters[lcId].phi()); } // End of loop over LayerClusters - for (unsigned int cpId = 0; cpId < nCaloParticles; ++cpId) { + for (const auto& cpId : cPIndices) { for (unsigned int layerId = 0; layerId < layers * 2; ++layerId) { unsigned int CPNumberOfHits = cPOnLayer[cpId][layerId].hits_and_fractions.size(); float CPenergy = cPOnLayer[cpId][layerId].energy; @@ -1335,6 +1337,7 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr const reco::CaloClusterCollection& clusters, const Density& densities, std::vector const& cP, + std::vector const& cPIndices, std::map const& hitMap, std::map cummatbudg, unsigned layers, @@ -1363,7 +1366,7 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr tnlcpthplus.insert(std::pair("mixed", 0)); tnlcpthminus.insert(std::pair("mixed", 0)); - layerClusters_to_CaloParticles(histograms, clusters, cP, hitMap, layers); + layerClusters_to_CaloParticles(histograms, clusters, cP, cPIndices, hitMap, layers); //To find out the total amount of energy clustered per layer //Initialize with zeros because I see clear gives weird numbers. @@ -1374,12 +1377,12 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr //We need to compare with the total amount of energy coming from caloparticles double caloparteneplus = 0.; double caloparteneminus = 0.; - for (auto const caloParticle : cP) { - if (caloParticle.eta() >= 0.) { - caloparteneplus = caloparteneplus + caloParticle.energy(); + for (const auto& cpId : cPIndices) { + if (cP[cpId].eta() >= 0.) { + caloparteneplus = caloparteneplus + cP[cpId].energy(); } - if (caloParticle.eta() < 0.) { - caloparteneminus = caloparteneminus + caloParticle.energy(); + if (cP[cpId].eta() < 0.) { + caloparteneminus = caloparteneminus + cP[cpId].energy(); } } @@ -1644,11 +1647,13 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& histograms, const std::vector& multiClusters, std::vector const& cP, + std::vector const& cPIndices, std::map const& hitMap, unsigned layers, std::vector contimulti) const { auto nMultiClusters = multiClusters.size(); - auto nCaloParticles = cP.size(); + //Consider CaloParticles coming from the hard scatterer, excluding the PU contribution. + auto nCaloParticles = cPIndices.size(); std::unordered_map> detIdToCaloParticleId_Map; std::unordered_map> detIdToMultiClusterId_Map; @@ -1677,7 +1682,7 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist } } - for (unsigned int cpId = 0; cpId < nCaloParticles; ++cpId) { + for (const auto& cpId : cPIndices) { //take sim clusters const SimClusterRefVector& simClusterRefVector = cP[cpId].simClusters(); //loop through sim clusters @@ -2073,21 +2078,25 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist std::vector> mclsharedenergyfrac; mclsharedenergyfrac.resize(nCaloParticles); - //Loop though caloparticles - for (unsigned int cpId = 0; cpId < nCaloParticles; ++cpId) { - for (unsigned int i = 0; i < nCaloParticles; ++i) { - score3d[i].resize(nMultiClusters); - mclsharedenergy[i].resize(nMultiClusters); - mclsharedenergyfrac[i].resize(nMultiClusters); - for (unsigned int j = 0; j < nMultiClusters; ++j) { - score3d[i][j] = 0.f; - mclsharedenergy[i][j] = 0.f; - mclsharedenergyfrac[i][j] = 0.f; - } + for (unsigned int i = 0; i < nCaloParticles; ++i) { + score3d[i].resize(nMultiClusters); + mclsharedenergy[i].resize(nMultiClusters); + mclsharedenergyfrac[i].resize(nMultiClusters); + for (unsigned int j = 0; j < nMultiClusters; ++j) { + score3d[i][j] = 0.f; + mclsharedenergy[i][j] = 0.f; + mclsharedenergyfrac[i][j] = 0.f; } + } - float CPenergy = 0.f; + //Loop though caloparticles + for (const auto& cpId : cPIndices) { + //We need to keep the multiclusters ids that are related to + //CaloParticle under study for the final filling of the score. + std::vector cpId_mclId_related; + cpId_mclId_related.clear(); + float CPenergy = 0.f; for (unsigned int layerId = 0; layerId < layers * 2; ++layerId) { unsigned int CPNumberOfHits = cPOnLayer[cpId][layerId].hits_and_fractions.size(); //Below gives the CP energy related to multicluster per layer. @@ -2134,6 +2143,7 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist float hitEnergyWeight = hit->energy() * hit->energy(); for (auto& lcPair : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) { unsigned int multiClusterId = lcPair.first; + cpId_mclId_related.emplace_back(multiClusterId); float mclFraction = 0.f; if (!hitWithNoMCL) { @@ -2143,57 +2153,9 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist if (findHitIt != detIdToMultiClusterId_Map[cp_hitDetId].end()) mclFraction = findHitIt->fraction; } - if (mclFraction == 0.) { - mclFraction = -1.; - } - //Observe here that we do not divide as before by the layer cluster energy weight. We should sum first - //over all layers and divide with the total CP energy over all layers. - lcPair.second.second += (mclFraction - cpFraction) * (mclFraction - cpFraction) * hitEnergyWeight; - LogDebug("HGCalValidator") << "multiClusterId:\t" << multiClusterId << "\t" - << "mclfraction,cpfraction:\t" << mclFraction << ", " << cpFraction << "\t" - << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" - << "currect score numerator:\t" << lcPair.second.second << "\n"; - } - } //end of loop through sim hits of current calo particle - - LogDebug("HGCalValidator") << std::setw(8) << "LayerId:\t" << std::setw(12) << "caloparticle\t" << std::setw(15) - << "cp total energy\t" << std::setw(15) << "cpEnergyOnLayer\t" << std::setw(14) - << "CPNhitsOnLayer\t" << std::setw(18) << "mclWithMaxEnergyInCP\t" << std::setw(15) - << "maxEnergyMCLinCP\t" << std::setw(20) << "CPEnergyFractionInMCL" - << "\n"; - LogDebug("HGCalValidator") << std::setw(8) << layerId << "\t" << std::setw(12) << cpId << "\t" << std::setw(15) - << cP[cpId].energy() << "\t" << std::setw(15) << CPenergy << "\t" << std::setw(14) - << CPNumberOfHits << "\t" << std::setw(18) << mclWithMaxEnergyInCP << "\t" - << std::setw(15) << maxEnergyMCLperlayerinCP << "\t" << std::setw(20) - << CPEnergyFractionInMCLperlayer << "\n"; - - for (unsigned int i = 0; i < CPNumberOfHits; ++i) { - auto& cp_hitDetId = cPOnLayer[cpId][layerId].hits_and_fractions[i].first; - auto& cpFraction = cPOnLayer[cpId][layerId].hits_and_fractions[i].second; - - bool hitWithNoMCL = false; - if (cpFraction == 0.f) - continue; //hopefully this should never happen - auto hit_find_in_MCL = detIdToMultiClusterId_Map.find(cp_hitDetId); - if (hit_find_in_MCL == detIdToMultiClusterId_Map.end()) - hitWithNoMCL = true; - auto itcheck = hitMap.find(cp_hitDetId); - const HGCRecHit* hit = itcheck->second; - float hitEnergyWeight = hit->energy() * hit->energy(); - for (auto& lcPair : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) { - unsigned int multiClusterId = lcPair.first; - float mclFraction = 0.f; - - if (!hitWithNoMCL) { - auto findHitIt = std::find(detIdToMultiClusterId_Map[cp_hitDetId].begin(), - detIdToMultiClusterId_Map[cp_hitDetId].end(), - HGVHistoProducerAlgo::detIdInfoInMultiCluster{multiClusterId, 0, 0.f}); - if (findHitIt != detIdToMultiClusterId_Map[cp_hitDetId].end()) - mclFraction = findHitIt->fraction; - } - if (mclFraction == 0.) { - mclFraction = -1.; - } + // if (mclFraction == 0.) { + // mclFraction = -1.; + // } //Observe here that we do not divide as before by the layer cluster energy weight. We should sum first //over all layers and divide with the total CP energy over all layers. lcPair.second.second += (mclFraction - cpFraction) * (mclFraction - cpFraction) * hitEnergyWeight; @@ -2218,13 +2180,14 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist float invCPEnergyWeight = 1.f / (CPenergy * CPenergy); - //Loop through multiclusters here - for (unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) { + //Loop through related multiclusters here + for (unsigned int i = 0; i < cpId_mclId_related.size(); ++i) { + unsigned int mclId = cpId_mclId_related[i]; //Now time for the denominator score3d[cpId][mclId] = score3d[cpId][mclId] * invCPEnergyWeight; mclsharedenergyfrac[cpId][mclId] = (mclsharedenergy[cpId][mclId] / CPenergy); - LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t MCL id: \t" << mclId << "\t score \t" + LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t MCL id: \t" << mclId << "\t score \t" // << score3d[cpId][mclId] << "\t" << "invCPEnergyWeight \t" << invCPEnergyWeight << "\t" << "shared energy:\t" << mclsharedenergy[cpId][mclId] << "\t" @@ -2277,6 +2240,7 @@ void HGVHistoProducerAlgo::fill_multi_cluster_histos(const Histograms& histogram int count, const std::vector& multiClusters, std::vector const& cP, + std::vector const& cPIndices, std::map const& hitMap, unsigned layers) const { //Each event to be treated as two events: @@ -2459,7 +2423,7 @@ void HGVHistoProducerAlgo::fill_multi_cluster_histos(const Histograms& histogram histograms.h_noncontmulticlusternum.fill(tnnoncontmclmz); } - multiClusters_to_CaloParticles(histograms, multiClusters, cP, hitMap, layers, contmulti); + multiClusters_to_CaloParticles(histograms, multiClusters, cP, cPIndices, hitMap, layers, contmulti); } double HGVHistoProducerAlgo::distance2(const double x1,