diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 5ad73f2f7660a..6a769f96fb61b 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -2296,11 +2296,13 @@ def setup_(self, step, stepName, stepDict, k, properties): mods = {'--era': stepDict[step][k]['--era']+',phase2_ecal_devel'} if 'Digi' in step: mods['-s'] = 'DIGI:pdigi_valid,DIGI2RAW' + mods['--custom_conditions'] = 'EcalSimPulseShapePhaseII,EcalSimPulseShapeRcd,frontier://FrontierProd/CMS_CONDITIONS' mods |= self.__digi elif 'Reco' in step: - mods['-s'] = 'RAW2DIGI,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly' + mods['-s'] = 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly' mods['--datatier'] = 'GEN-SIM-RECO,DQMIO' mods['--eventcontent'] = 'FEVTDEBUGHLT,DQM' + mods['--custom_conditions'] = 'EcalSimPulseShapePhaseII,EcalSimPulseShapeRcd,frontier://FrontierProd/CMS_CONDITIONS' mods |= self.__reco elif 'HARVEST' in step: mods['-s'] = 'HARVESTING:@ecalOnlyValidation+@ecal' diff --git a/Configuration/StandardSequences/python/RawToDigi_cff.py b/Configuration/StandardSequences/python/RawToDigi_cff.py index 23969bac65e28..83d01a34fb6d1 100644 --- a/Configuration/StandardSequences/python/RawToDigi_cff.py +++ b/Configuration/StandardSequences/python/RawToDigi_cff.py @@ -133,3 +133,8 @@ from Configuration.Eras.Modifier_phase2_hfnose_cff import phase2_hfnose phase2_hfnose.toReplaceWith(RawToDigiTask,_hfnose_RawToDigiTask) +# No preshower for Phase 2 ECAL +from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel +phase2_ecal_devel.toReplaceWith(RawToDigiTask, RawToDigiTask.copyAndExclude([ecalPreshowerDigis])) +phase2_ecal_devel.toReplaceWith(RawToDigiTask_ecalOnly, RawToDigiTask_ecalOnly.copyAndExclude([ecalPreshowerDigis])) + diff --git a/Configuration/StandardSequences/python/Reconstruction_cff.py b/Configuration/StandardSequences/python/Reconstruction_cff.py index 6ff4b06f0b766..69602fce5d61a 100644 --- a/Configuration/StandardSequences/python/Reconstruction_cff.py +++ b/Configuration/StandardSequences/python/Reconstruction_cff.py @@ -236,8 +236,13 @@ ) reconstruction_ecalOnly = cms.Sequence(reconstruction_ecalOnlyTask) +reconstruction_ecalOnlyPhase2Task = cms.Task( + bunchSpacingProducer, + ecalOnlyLocalRecoTask, + ecalClustersNoPFBoxTask +) from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel -phase2_ecal_devel.toReplaceWith(reconstruction_ecalOnlyTask, reconstruction_ecalOnlyTask.copyAndExclude([pfClusteringPSTask, pfClusteringECALTask, particleFlowSuperClusterECALOnly])) +phase2_ecal_devel.toReplaceWith(reconstruction_ecalOnlyTask, reconstruction_ecalOnlyPhase2Task) reconstruction_hcalOnlyTask = cms.Task( bunchSpacingProducer, diff --git a/DQM/EcalMonitorClient/python/EcalMonitorClient_cff.py b/DQM/EcalMonitorClient/python/EcalMonitorClient_cff.py new file mode 100644 index 0000000000000..916f931a0224c --- /dev/null +++ b/DQM/EcalMonitorClient/python/EcalMonitorClient_cff.py @@ -0,0 +1,20 @@ +import FWCore.ParameterSet.Config as cms + +from DQM.EcalMonitorClient.EcalMonitorClient_cfi import * + +ecalMonitorClientPhase2 = ecalMonitorClient.clone( + workers = cms.untracked.vstring( + "OccupancyClient", + "TimingClient", + "SummaryClient" + ), + # task parameters (included from indivitual cfis) + workerParameters = cms.untracked.PSet( + OccupancyClient = ecalOccupancyClient, + TimingClient = ecalTimingClient, + SummaryClient = ecalSummaryClient + ), + commonParameters = ecalCommonParams, + verbosity = cms.untracked.int32(0) +) + diff --git a/DQM/EcalMonitorTasks/python/CollectionTags_cfi.py b/DQM/EcalMonitorTasks/python/CollectionTags_cfi.py index 156fdc65a8df7..922257a8b0024 100644 --- a/DQM/EcalMonitorTasks/python/CollectionTags_cfi.py +++ b/DQM/EcalMonitorTasks/python/CollectionTags_cfi.py @@ -58,3 +58,14 @@ EBGpuRecHit = cms.untracked.InputTag("ecalRecHit", "EcalRecHitsEB"), EEGpuRecHit = cms.untracked.InputTag("ecalRecHit", "EcalRecHitsEE") ) + +ecalDQMCollectionTagsPhase2 = cms.PSet( + EBUncalibRecHit = cms.untracked.InputTag("ecalUncalibRecHitPhase2", "EcalUncalibRecHitsEB"), + EEUncalibRecHit = cms.untracked.InputTag("None"), + EBRecHit = cms.untracked.InputTag("ecalRecHit", "EcalRecHitsEB"), + EERecHit = cms.untracked.InputTag("None"), + EBBasicCluster = cms.untracked.InputTag("hybridSuperClusters", "hybridBarrelBasicClusters"), + EEBasicCluster = cms.untracked.InputTag("None"), + EBSuperCluster = cms.untracked.InputTag("hybridSuperClusters"), + EESuperCluster = cms.untracked.InputTag("None") +) diff --git a/DQM/EcalMonitorTasks/python/EcalMonitorTaskEcalOnly_cfi.py b/DQM/EcalMonitorTasks/python/EcalMonitorTaskEcalOnly_cfi.py index e26fad82013b2..504da58e5a293 100644 --- a/DQM/EcalMonitorTasks/python/EcalMonitorTaskEcalOnly_cfi.py +++ b/DQM/EcalMonitorTasks/python/EcalMonitorTaskEcalOnly_cfi.py @@ -3,9 +3,33 @@ from DQM.EcalMonitorTasks.EcalMonitorTask_cfi import ecalMonitorTask as _ecalMonitorTask ecalMonitorTaskEcalOnly = _ecalMonitorTask.clone( - collectionTags = dict( - EBSuperCluster = ("particleFlowSuperClusterECALOnly","particleFlowSuperClusterECALBarrel"), - EESuperCluster = ("particleFlowSuperClusterECALOnly","particleFlowSuperClusterECALEndcapWithPreshower") - ), - workerParameters = dict(ClusterTask = dict(params = dict(doExtra = False))) + collectionTags = dict( + EBSuperCluster = ("particleFlowSuperClusterECALOnly","particleFlowSuperClusterECALBarrel"), + EESuperCluster = ("particleFlowSuperClusterECALOnly","particleFlowSuperClusterECALEndcapWithPreshower") + ), + workerParameters = dict(ClusterTask = dict(params = dict(doExtra = False))) +) + +# Changes for Phase 2 +from DQM.EcalMonitorTasks.CollectionTags_cfi import ecalDQMCollectionTagsPhase2 +from DQM.EcalMonitorTasks.ClusterTask_cfi import ecalClusterTask +from DQM.EcalMonitorTasks.EnergyTask_cfi import ecalEnergyTask +from DQM.EcalMonitorTasks.TimingTask_cfi import ecalTimingTask +from DQM.EcalMonitorTasks.ecalPiZeroTask_cfi import ecalPiZeroTask + +ecalMonitorTaskEcalOnlyPhase2 = ecalMonitorTaskEcalOnly.clone( + workers = cms.untracked.vstring( + "ClusterTask", + "EnergyTask", + "TimingTask", + "PiZeroTask" + ), + workerParameters = cms.untracked.PSet( + ClusterTask = ecalClusterTask, + EnergyTask = ecalEnergyTask, + TimingTask = ecalTimingTask, + PiZeroTask = ecalPiZeroTask + ), + collectionTags = ecalDQMCollectionTagsPhase2, + skipCollections = cms.untracked.vstring('EcalRawData') ) diff --git a/DQM/EcalMonitorTasks/python/EcalMonitorTask_cff.py b/DQM/EcalMonitorTasks/python/EcalMonitorTask_cff.py index e6b8d05f9c331..44897ed3269aa 100644 --- a/DQM/EcalMonitorTasks/python/EcalMonitorTask_cff.py +++ b/DQM/EcalMonitorTasks/python/EcalMonitorTask_cff.py @@ -22,3 +22,22 @@ from Configuration.ProcessModifiers.alpaka_cff import alpaka alpaka.toModify(ecalMonitorTask.skipCollections, func = lambda skipCollections: skipCollections.append("EcalRawData")) + +# Changes for Phase 2 +from DQM.EcalMonitorTasks.CollectionTags_cfi import ecalDQMCollectionTagsPhase2 +ecalMonitorTaskPhase2 = ecalMonitorTask.clone( + workers = cms.untracked.vstring( + "ClusterTask", + "EnergyTask", + "TimingTask", + "PiZeroTask" + ), + workerParameters = cms.untracked.PSet( + ClusterTask = ecalClusterTask, + EnergyTask = ecalEnergyTask, + TimingTask = ecalTimingTask, + PiZeroTask = ecalPiZeroTask + ), + collectionTags = ecalDQMCollectionTagsPhase2, + skipCollections = cms.untracked.vstring('EcalRawData') +) diff --git a/DQMOffline/Configuration/python/DQMOffline_Certification_cff.py b/DQMOffline/Configuration/python/DQMOffline_Certification_cff.py index 836fb5821cee5..8c3956d09e332 100644 --- a/DQMOffline/Configuration/python/DQMOffline_Certification_cff.py +++ b/DQMOffline/Configuration/python/DQMOffline_Certification_cff.py @@ -28,6 +28,8 @@ DQMCertEcal = cms.Sequence(ecalDaqInfoTask * ecalPreshowerDaqInfoTask * ecalDcsInfoTask * ecalPreshowerDcsInfoTask * ecalCertification * ecalPreshowerDataCertificationTask) +from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel +phase2_ecal_devel.toReplaceWith(DQMCertEcal, DQMCertEcal.copyAndExclude([ecalPreshowerDaqInfoTask, ecalPreshowerDcsInfoTask, ecalPreshowerDataCertificationTask])) DQMCertJetMET = cms.Sequence(dataCertificationJetMETSequence) diff --git a/DQMOffline/Configuration/python/DQMOffline_SecondStep_cff.py b/DQMOffline/Configuration/python/DQMOffline_SecondStep_cff.py index 1217835e093d9..c02404d1d90ac 100644 --- a/DQMOffline/Configuration/python/DQMOffline_SecondStep_cff.py +++ b/DQMOffline/Configuration/python/DQMOffline_SecondStep_cff.py @@ -22,6 +22,8 @@ DQMOffline_SecondStepEcal = cms.Sequence( ecal_dqm_client_offline * es_dqm_client_offline ) +from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel +phase2_ecal_devel.toReplaceWith(DQMOffline_SecondStepEcal, DQMOffline_SecondStepEcal.copyAndExclude([es_dqm_client_offline])) DQMOffline_SecondStepTrackerStrip = cms.Sequence( SiStripOfflineDQMClient ) @@ -257,6 +259,7 @@ DQMHarvestEcal = cms.Sequence( ecal_dqm_client_offline * es_dqm_client_offline ) +phase2_ecal_devel.toReplaceWith(DQMHarvestEcal, DQMHarvestEcal.copyAndExclude([es_dqm_client_offline])) DQMHarvestHcal = cms.Sequence( hcalOfflineHarvesting ) diff --git a/DQMOffline/Configuration/python/DQMOffline_cff.py b/DQMOffline/Configuration/python/DQMOffline_cff.py index 8f0737a38b562..f6fbf4e742887 100644 --- a/DQMOffline/Configuration/python/DQMOffline_cff.py +++ b/DQMOffline/Configuration/python/DQMOffline_cff.py @@ -52,6 +52,7 @@ from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel phase2_ecal_devel.toReplaceWith(DQMOfflineEcalOnly, DQMOfflineEcalOnly.copyAndExclude([es_dqm_source_offline])) +phase2_ecal_devel.toReplaceWith(DQMOfflineEcal, DQMOfflineEcal.copyAndExclude([es_dqm_source_offline])) #offline version of the online DQM: used in validation/certification DQMOfflineHcal = cms.Sequence( hcalOfflineSourceSequence ) diff --git a/DQMOffline/Ecal/python/ecal_dqm_client_offline_cff.py b/DQMOffline/Ecal/python/ecal_dqm_client_offline_cff.py index 9b741eb9bf414..dc6eda14dece6 100644 --- a/DQMOffline/Ecal/python/ecal_dqm_client_offline_cff.py +++ b/DQMOffline/Ecal/python/ecal_dqm_client_offline_cff.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -from DQM.EcalMonitorClient.EcalMonitorClient_cfi import * +from DQM.EcalMonitorClient.EcalMonitorClient_cff import * from DQM.EcalCommon.EcalMEFormatter_cfi import ecalMEFormatter from DQMOffline.Ecal.EcalZmassClient_cfi import * @@ -24,3 +24,7 @@ ) ecalMonitorClient.workerParameters.TrigPrimClient.params.sourceFromEmul = False + +from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel +phase2_ecal_devel.toReplaceWith(ecalMonitorClient, ecalMonitorClientPhase2) +phase2_ecal_devel.toReplaceWith(ecal_dqm_client_offline, ecal_dqm_client_offline.copyAndExclude([ecalzmassclient])) diff --git a/DQMOffline/Ecal/python/ecal_dqm_source_offline_cff.py b/DQMOffline/Ecal/python/ecal_dqm_source_offline_cff.py index dd68a46582e0c..e56e1eef3e544 100644 --- a/DQMOffline/Ecal/python/ecal_dqm_source_offline_cff.py +++ b/DQMOffline/Ecal/python/ecal_dqm_source_offline_cff.py @@ -30,6 +30,21 @@ ecalzmasstask ) +# Phase 2 +ecal_dqm_source_offline_phase2 = cms.Sequence( + dqmInfoEcal + + ecalMonitorTaskPhase2 +) + +ecalOnly_dqm_source_offline_phase2 = cms.Sequence( + dqmInfoEcal + + ecalMonitorTaskEcalOnlyPhase2 +) + +from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel +phase2_ecal_devel.toReplaceWith(ecal_dqm_source_offline, ecal_dqm_source_offline_phase2) +phase2_ecal_devel.toReplaceWith(ecalOnly_dqm_source_offline, ecalOnly_dqm_source_offline_phase2) + ecalMonitorTask.workerParameters.TrigPrimTask.params.runOnEmul = False ecalMonitorTaskEcalOnly.workerParameters.TrigPrimTask.params.runOnEmul = False ecalMonitorTaskEcalOnly.workerParameters.RecoSummaryTask.params.fillRecoFlagReduced = False diff --git a/EventFilter/EcalRawToDigi/python/ecalDigis_cff.py b/EventFilter/EcalRawToDigi/python/ecalDigis_cff.py index 38274ff1c5f40..636381769f334 100644 --- a/EventFilter/EcalRawToDigi/python/ecalDigis_cff.py +++ b/EventFilter/EcalRawToDigi/python/ecalDigis_cff.py @@ -10,6 +10,10 @@ ecalDigis ) +# remove unpacker until a Phase 2 version exists +from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel +phase2_ecal_devel.toReplaceWith(ecalDigisTask, ecalDigisTask.copyAndExclude([ecalDigis])) + from Configuration.StandardSequences.Accelerators_cff import * # process modifier to run alpaka implementation @@ -35,17 +39,23 @@ ) alpaka.toReplaceWith(ecalDigis, _ecalDigisFromPortable.clone()) -alpaka.toReplaceWith(ecalDigisTask, cms.Task( +ecalDigisTask_alpaka = cms.Task( # ECAL conditions used by the portable unpacker ecalDigisPortableConditions, # run the portable ECAL unpacker ecalDigisPortable, # convert them from SoA to legacy format ecalDigis -)) +) + +# remove portable unpacker until a Phase 2 version exists +phase2_ecal_devel.toReplaceWith(ecalDigisTask_alpaka, ecalDigisTask_alpaka.copyAndExclude([ecalDigisPortableConditions, ecalDigisPortable, ecalDigis])) + +alpaka.toReplaceWith(ecalDigisTask, ecalDigisTask_alpaka) # for alpaka validation compare the legacy CPU module with the alpaka module from Configuration.ProcessModifiers.alpakaValidationEcal_cff import alpakaValidationEcal -_ecalDigisTaskValidation = ecalDigisTask.copy() +_ecalDigisTaskValidation = ecalDigisTask_alpaka.copy() _ecalDigisTaskValidation.add(ecalDigisLegacy) alpakaValidationEcal.toReplaceWith(ecalDigisTask, _ecalDigisTaskValidation) + diff --git a/RecoEcal/Configuration/python/RecoEcal_cff.py b/RecoEcal/Configuration/python/RecoEcal_cff.py index d1965c09152bc..97660fe912970 100644 --- a/RecoEcal/Configuration/python/RecoEcal_cff.py +++ b/RecoEcal/Configuration/python/RecoEcal_cff.py @@ -30,6 +30,8 @@ from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017 from Configuration.Eras.Modifier_ppRef_2017_cff import ppRef_2017 +from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel +phase2_ecal_devel.toReplaceWith(ecalClustersNoPFBoxTask, ecalClustersNoPFBoxTask.copyAndExclude([multi5x5ClusteringTask, multi5x5PreshowerClusteringTask])) from RecoEcal.EgammaClusterProducers.islandClusteringSequence_cff import * diff --git a/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h b/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h index 4bacd8b340742..a3c4e3d54894e 100644 --- a/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h +++ b/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h @@ -80,7 +80,7 @@ class EcalClusterLazyToolsBase { EcalClusterLazyToolsBase(const edm::Event &ev, ESData const &esData, edm::EDGetTokenT token1, - edm::EDGetTokenT token2, + std::optional> token2, std::optional> token3); // get time of basic cluster seed crystal @@ -136,6 +136,9 @@ class EcalClusterLazyToolsBase { template class EcalClusterLazyToolsT : public EcalClusterLazyToolsBase { public: + EcalClusterLazyToolsT(const edm::Event &ev, ESData const &esData, edm::EDGetTokenT token1) + : EcalClusterLazyToolsBase(ev, esData, token1, std::nullopt, std::nullopt) {} + EcalClusterLazyToolsT(const edm::Event &ev, ESData const &esData, edm::EDGetTokenT token1, diff --git a/RecoEcal/EgammaCoreTools/src/EcalClusterLazyTools.cc b/RecoEcal/EgammaCoreTools/src/EcalClusterLazyTools.cc index 4f8720f776437..ca137dd5b0c9c 100644 --- a/RecoEcal/EgammaCoreTools/src/EcalClusterLazyTools.cc +++ b/RecoEcal/EgammaCoreTools/src/EcalClusterLazyTools.cc @@ -18,12 +18,12 @@ EcalClusterLazyToolsBase::EcalClusterLazyToolsBase(const edm::Event &ev, ESData const &esData, edm::EDGetTokenT token1, - edm::EDGetTokenT token2, + std::optional> token2, std::optional> token3) : geometry_(&esData.caloGeometry), topology_(&esData.caloTopology), ebRecHits_(&edm::get(ev, token1)), - eeRecHits_(&edm::get(ev, token2)) { + eeRecHits_{token2 ? &edm::get(ev, *token2) : nullptr} { if (token3) { if (geometry_->getSubdetectorGeometry(DetId::Ecal, EcalPreshower)) { ecalPS_topology_ = std::make_unique(); @@ -82,6 +82,11 @@ const EcalRecHitCollection *EcalClusterLazyToolsBase::getEcalRecHitCollection(co if (id.subdetId() == EcalBarrel) { recHits = ebRecHits_; } else if (id.subdetId() == EcalEndcap) { + if (!eeRecHits_) { + throw cms::Exception("MissingCollection") + << "The subdetId() " << id.subdetId() + << " corresponds to the ECALEndcap but no ECALEndcap RecHit collection is set up"; + } recHits = eeRecHits_; } else { throw cms::Exception("InvalidSubdetector") diff --git a/Validation/Configuration/python/ecalSimValid_cff.py b/Validation/Configuration/python/ecalSimValid_cff.py index 945247e2171b6..ee1e855028341 100644 --- a/Validation/Configuration/python/ecalSimValid_cff.py +++ b/Validation/Configuration/python/ecalSimValid_cff.py @@ -22,8 +22,8 @@ ) validationECALPhase2 = cms.Sequence( - ecalSimHitsValidationSequence* - ecalDigisValidationSequence* + ecalSimHitsValidationSequencePhase2* + ecalDigisValidationSequencePhase2* ecalRecHitsValidationSequencePhase2* ecalClustersValidationSequence* ecalDQMSequencePhase2 diff --git a/Validation/Configuration/python/globalValidation_cff.py b/Validation/Configuration/python/globalValidation_cff.py index 02572fa69b79f..9fcf1c848e41c 100644 --- a/Validation/Configuration/python/globalValidation_cff.py +++ b/Validation/Configuration/python/globalValidation_cff.py @@ -165,6 +165,7 @@ + ecalRecHitsValidationSequence + ecalClustersValidationSequence ) + globalValidationECALOnly = cms.Sequence( ecalSimHitsValidationSequence + ecalDigisValidationSequence @@ -172,7 +173,10 @@ + pfClusterCaloOnlyValidationSequence ) from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel +phase2_ecal_devel.toReplaceWith(ecalSimHitsValidationSequence, ecalSimHitsValidationSequencePhase2) +phase2_ecal_devel.toReplaceWith(ecalDigisValidationSequence, ecalDigisValidationSequencePhase2) phase2_ecal_devel.toReplaceWith(ecalRecHitsValidationSequence, ecalRecHitsValidationSequencePhase2) +phase2_ecal_devel.toReplaceWith(pfClusterCaloOnlyValidationSequence, ecalClustersValidationSequence) # HCAL local reconstruction globalPrevalidationHCAL = cms.Sequence() diff --git a/Validation/EcalClusters/interface/EgammaBasicClusters.h b/Validation/EcalClusters/interface/EgammaBasicClusters.h index dd5dfccac33db..11bf39b07f9df 100644 --- a/Validation/EcalClusters/interface/EgammaBasicClusters.h +++ b/Validation/EcalClusters/interface/EgammaBasicClusters.h @@ -25,19 +25,21 @@ class EgammaBasicClusters : public DQMEDAnalyzer { explicit EgammaBasicClusters(const edm::ParameterSet &); ~EgammaBasicClusters() override; + static void fillDescriptions(edm::ConfigurationDescriptions &); void analyze(const edm::Event &, const edm::EventSetup &) override; void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; private: - edm::EDGetTokenT barrelBasicClusterCollection_; - edm::EDGetTokenT endcapBasicClusterCollection_; - - HistSpec hsSize_; - HistSpec hsNumRecHits_; - HistSpec hsET_; - HistSpec hsEta_; - HistSpec hsPhi_; - HistSpec hsR_; + const bool enableEndcaps_; + const edm::EDGetTokenT barrelBasicClusterCollection_; + const edm::EDGetTokenT endcapBasicClusterCollection_; + + const HistSpec hsSize_; + const HistSpec hsNumRecHits_; + const HistSpec hsET_; + const HistSpec hsEta_; + const HistSpec hsPhi_; + const HistSpec hsR_; MonitorElement *hist_EB_BC_Size_; MonitorElement *hist_EE_BC_Size_; diff --git a/Validation/EcalClusters/interface/EgammaSuperClusters.h b/Validation/EcalClusters/interface/EgammaSuperClusters.h index 1deb547e51122..a17f16c9a13e0 100644 --- a/Validation/EcalClusters/interface/EgammaSuperClusters.h +++ b/Validation/EcalClusters/interface/EgammaSuperClusters.h @@ -29,41 +29,43 @@ class EgammaSuperClusters : public DQMEDAnalyzer { explicit EgammaSuperClusters(const edm::ParameterSet &); ~EgammaSuperClusters() override; + static void fillDescriptions(edm::ConfigurationDescriptions &); void analyze(const edm::Event &, const edm::EventSetup &) override; void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; private: + const bool enableEndcaps_; // mc truth - edm::EDGetTokenT MCTruthCollectionToken_; + const edm::EDGetTokenT MCTruthCollectionToken_; // barrel clusters - edm::EDGetTokenT barrelRawSuperClusterCollectionToken_; - edm::EDGetTokenT barrelCorSuperClusterCollectionToken_; + const edm::EDGetTokenT barrelRawSuperClusterCollectionToken_; + const edm::EDGetTokenT barrelCorSuperClusterCollectionToken_; // endcap clusters - edm::EDGetTokenT endcapRawSuperClusterCollectionToken_; - edm::EDGetTokenT endcapPreSuperClusterCollectionToken_; - edm::EDGetTokenT endcapCorSuperClusterCollectionToken_; + const edm::EDGetTokenT endcapRawSuperClusterCollectionToken_; + const edm::EDGetTokenT endcapPreSuperClusterCollectionToken_; + const edm::EDGetTokenT endcapCorSuperClusterCollectionToken_; // collections of hits - edm::EDGetTokenT barrelRecHitCollectionToken_; - edm::EDGetTokenT endcapRecHitCollectionToken_; - - EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_; - - HistSpec hsSize_; - HistSpec hsNumBC_; - HistSpec hsET_; - HistSpec hsEta_; - HistSpec hsPhi_; - HistSpec hsS1toS9_; - HistSpec hsS25toE_; - HistSpec hsEoverTruth_; - HistSpec hsdeltaR_; - HistSpec hsphiWidth_; - HistSpec hsetaWidth_; - HistSpec hspreshowerE_; - HistSpec hsR_; + const edm::EDGetTokenT barrelRecHitCollectionToken_; + const edm::EDGetTokenT endcapRecHitCollectionToken_; + + const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_; + + const HistSpec hsSize_; + const HistSpec hsNumBC_; + const HistSpec hsET_; + const HistSpec hsEta_; + const HistSpec hsPhi_; + const HistSpec hsS1toS9_; + const HistSpec hsS25toE_; + const HistSpec hsEoverTruth_; + const HistSpec hsdeltaR_; + const HistSpec hsphiWidth_; + const HistSpec hsetaWidth_; + const HistSpec hspreshowerE_; + const HistSpec hsR_; MonitorElement *hist_EB_RawSC_Size_; MonitorElement *hist_EE_RawSC_Size_; diff --git a/Validation/EcalClusters/interface/HistSpec.h b/Validation/EcalClusters/interface/HistSpec.h index 9f7c20307e8e2..a729168ddbe3e 100644 --- a/Validation/EcalClusters/interface/HistSpec.h +++ b/Validation/EcalClusters/interface/HistSpec.h @@ -8,6 +8,12 @@ struct HistSpec { double max; int bins; + HistSpec() { + min = 0.; + max = 0.; + bins = 0; + } + HistSpec(edm::ParameterSet const &_ps, std::string const &_suffix) { min = _ps.getParameter("hist_min_" + _suffix); max = _ps.getParameter("hist_max_" + _suffix); diff --git a/Validation/EcalClusters/python/ecalClustersValidationSequence_cff.py b/Validation/EcalClusters/python/ecalClustersValidationSequence_cff.py index 6626d85493031..d3c960a1f0e0c 100644 --- a/Validation/EcalClusters/python/ecalClustersValidationSequence_cff.py +++ b/Validation/EcalClusters/python/ecalClustersValidationSequence_cff.py @@ -1,9 +1,9 @@ import FWCore.ParameterSet.Config as cms # analyzer to make histos from basic clusters -from Validation.EcalClusters.egammaBCAnalyzer_cfi import * +from Validation.EcalClusters.egammaBasicClusterAnalyzer_cff import * # analyzer to make histos from super clusters -from Validation.EcalClusters.egammaSCAnalyzer_cfi import * +from Validation.EcalClusters.egammaSuperClusterAnalyzer_cff import * ecalClustersValidationSequence = cms.Sequence(egammaBasicClusterAnalyzer+egammaSuperClusterAnalyzer) diff --git a/Validation/EcalClusters/python/egammaBCAnalyzer_cfi.py b/Validation/EcalClusters/python/egammaBCAnalyzer_cfi.py deleted file mode 100644 index daadccc417f1c..0000000000000 --- a/Validation/EcalClusters/python/egammaBCAnalyzer_cfi.py +++ /dev/null @@ -1,35 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# -# Author: Michael A. Balazs, University of Virginia -# -from Validation.EcalClusters.VerificationCommonParameters_cfi import * -from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer -egammaBasicClusterAnalyzer = DQMEDAnalyzer('EgammaBasicClusters', - VerificationCommonParameters, - endcapBasicClusterCollection = cms.InputTag("multi5x5SuperClusters","multi5x5EndcapBasicClusters"), - barrelBasicClusterCollection = cms.InputTag("hybridSuperClusters","hybridBarrelBasicClusters"), - hist_bins_Size = cms.int32(20), - hist_min_Size = cms.double(0.0), - hist_max_Size = cms.double(20.0), - hist_bins_Phi = cms.int32(181), - hist_min_Phi = cms.double(-3.14159), - hist_max_Phi = cms.double(3.14159), - hist_bins_Eta = cms.int32(91), - hist_min_Eta = cms.double(-2.5), - hist_max_Eta = cms.double(2.5), - hist_bins_ET = cms.int32(200), - hist_min_ET = cms.double(0.0), - hist_max_ET = cms.double(200.0), - hist_bins_NumRecHits = cms.int32(50), - hist_min_NumRecHits = cms.double(0.0), - hist_max_NumRecHits = cms.double(50.0), - hist_bins_R = cms.int32(55), - hist_min_R = cms.double(0.0), - hist_max_R = cms.double(175.0) - - -) - - - diff --git a/Validation/EcalClusters/python/egammaBasicClusterAnalyzer_cff.py b/Validation/EcalClusters/python/egammaBasicClusterAnalyzer_cff.py new file mode 100644 index 0000000000000..f54b7b8477415 --- /dev/null +++ b/Validation/EcalClusters/python/egammaBasicClusterAnalyzer_cff.py @@ -0,0 +1,5 @@ +import FWCore.ParameterSet.Config as cms + +from Validation.EcalClusters.egammaBasicClusterAnalyzer_cfi import * +from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel +phase2_ecal_devel.toModify(egammaBasicClusterAnalyzer, enableEndcaps = False, endcapBasicClusterCollection = None) diff --git a/Validation/EcalClusters/python/egammaSCAnalyzer_cfi.py b/Validation/EcalClusters/python/egammaSCAnalyzer_cfi.py deleted file mode 100644 index c35417c2b68ce..0000000000000 --- a/Validation/EcalClusters/python/egammaSCAnalyzer_cfi.py +++ /dev/null @@ -1,65 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.EcalClusters.VerificationCommonParameters_cfi import * -from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer -egammaSuperClusterAnalyzer = DQMEDAnalyzer('EgammaSuperClusters', - VerificationCommonParameters, - barrelRecHitCollection = cms.InputTag("reducedEcalRecHitsEB"), - barrelRawSuperClusterCollection = cms.InputTag("hybridSuperClusters"), - barrelCorSuperClusterCollection = cms.InputTag("correctedHybridSuperClusters"), - endcapRecHitCollection = cms.InputTag("reducedEcalRecHitsEE"), - endcapRawSuperClusterCollection = cms.InputTag("multi5x5SuperClusters","multi5x5EndcapSuperClusters"), - endcapCorSuperClusterCollection = cms.InputTag("correctedMulti5x5SuperClustersWithPreshower"), - endcapPreSuperClusterCollection = cms.InputTag("multi5x5SuperClustersWithPreshower"), - hist_max_Size = cms.double(5.0), - hist_min_Size = cms.double(0.0), - hist_bins_Size = cms.int32(5), - hist_bins_deltaR = cms.int32(50), - hist_min_deltaR = cms.double(0.0), - hist_max_deltaR = cms.double(0.5), - hist_min_preshowerE = cms.double(0.0), - hist_bins_preshowerE = cms.int32(100), - hist_max_preshowerE = cms.double(100.0), - hist_bins_etaWidth = cms.int32(100), - hist_min_etaWidth = cms.double(0.0), - hist_max_etaWidth = cms.double(0.1), - hist_bins_Eta = cms.int32(100), - hist_min_Eta = cms.double(-3.0), - hist_max_Eta = cms.double(3.0), - hist_bins_EoverTruth = cms.int32(100), - hist_min_EoverTruth = cms.double(0.5), - hist_max_EoverTruth = cms.double(1.5), - hist_bins_S25toE = cms.int32(50), - hist_min_S25toE = cms.double(0.0), - hist_max_S25toE = cms.double(1.0), - hist_bins_phiWidth = cms.int32(100), - hist_min_phiWidth = cms.double(0.0), - hist_max_phiWidth = cms.double(0.1), - hist_bins_Phi = cms.int32(181), - hist_min_Phi = cms.double(-3.14159), - hist_max_Phi = cms.double(3.14159), - hist_bins_S1toS9 = cms.int32(50), - hist_min_S1toS9 = cms.double(0.0), - hist_max_S1toS9 = cms.double(1.0), - hist_bins_ET = cms.int32(100), - hist_min_ET = cms.double(0.0), - hist_max_ET = cms.double(50.0), - hist_bins_NumBC = cms.int32(10), - hist_min_NumBC = cms.double(0.0), - hist_max_NumBC = cms.double(10.0), - hist_bins_R = cms.int32(55), - hist_min_R = cms.double(0.0), - hist_max_R = cms.double(175.0) - - -) - - -from Configuration.Eras.Modifier_peripheralPbPb_cff import peripheralPbPb -from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA -from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017 -for e in [peripheralPbPb, pp_on_AA, pp_on_XeXe_2017]: - e.toModify(egammaSuperClusterAnalyzer, barrelCorSuperClusterCollection = cms.InputTag("correctedIslandBarrelSuperClusters")) - e.toModify(egammaSuperClusterAnalyzer, barrelRawSuperClusterCollection = cms.InputTag("islandSuperClusters","islandBarrelSuperClusters")) - e.toModify(egammaSuperClusterAnalyzer, endcapCorSuperClusterCollection = cms.InputTag("correctedIslandEndcapSuperClusters")) - e.toModify(egammaSuperClusterAnalyzer, endcapRawSuperClusterCollection = cms.InputTag("islandSuperClusters","islandEndcapSuperClusters")) diff --git a/Validation/EcalClusters/python/egammaSuperClusterAnalyzer_cff.py b/Validation/EcalClusters/python/egammaSuperClusterAnalyzer_cff.py new file mode 100644 index 0000000000000..d08dbf0eabab2 --- /dev/null +++ b/Validation/EcalClusters/python/egammaSuperClusterAnalyzer_cff.py @@ -0,0 +1,25 @@ +import FWCore.ParameterSet.Config as cms + +from Validation.EcalClusters.egammaSuperClusterAnalyzer_cfi import * + +from Configuration.Eras.Modifier_peripheralPbPb_cff import peripheralPbPb +from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA +from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017 +for e in [peripheralPbPb, pp_on_AA, pp_on_XeXe_2017]: + e.toModify(egammaSuperClusterAnalyzer, barrelCorSuperClusterCollection = cms.InputTag("correctedIslandBarrelSuperClusters")) + e.toModify(egammaSuperClusterAnalyzer, barrelRawSuperClusterCollection = cms.InputTag("islandSuperClusters","islandBarrelSuperClusters")) + e.toModify(egammaSuperClusterAnalyzer, endcapCorSuperClusterCollection = cms.InputTag("correctedIslandEndcapSuperClusters")) + e.toModify(egammaSuperClusterAnalyzer, endcapRawSuperClusterCollection = cms.InputTag("islandSuperClusters","islandEndcapSuperClusters")) + +from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel +phase2_ecal_devel.toModify(egammaSuperClusterAnalyzer, + enableEndcaps = False, + barrelRecHitCollection = "ecalRecHit:EcalRecHitsEB", + endcapRecHitCollection = None, + endcapRawSuperClusterCollection = None, + endcapCorSuperClusterCollection = None, + endcapPreSuperClusterCollection = None, + hist_bins_preshowerE = None, + hist_min_preshowerE = None, + hist_max_preshowerE = None +) diff --git a/Validation/EcalClusters/src/EgammaBasicClusters.cc b/Validation/EcalClusters/src/EgammaBasicClusters.cc index ef1a780dc8417..8b42a8b619fb3 100644 --- a/Validation/EcalClusters/src/EgammaBasicClusters.cc +++ b/Validation/EcalClusters/src/EgammaBasicClusters.cc @@ -2,6 +2,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/EmptyGroupDescription.h" #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/EgammaReco/interface/BasicCluster.h" @@ -11,10 +12,12 @@ #include "FWCore/Framework/interface/MakerMacros.h" EgammaBasicClusters::EgammaBasicClusters(const edm::ParameterSet &ps) - : barrelBasicClusterCollection_( - consumes(ps.getParameter("barrelBasicClusterCollection"))), - endcapBasicClusterCollection_( - consumes(ps.getParameter("endcapBasicClusterCollection"))), + : enableEndcaps_{ps.getParameter("enableEndcaps")}, + barrelBasicClusterCollection_{ + consumes(ps.getParameter("barrelBasicClusterCollection"))}, + endcapBasicClusterCollection_{enableEndcaps_ ? consumes( + ps.getParameter("endcapBasicClusterCollection")) + : edm::EDGetTokenT{}}, hsSize_(ps, "Size"), hsNumRecHits_(ps, "NumRecHits"), hsET_(ps, "ET"), @@ -39,39 +42,76 @@ EgammaBasicClusters::EgammaBasicClusters(const edm::ParameterSet &ps) EgammaBasicClusters::~EgammaBasicClusters() {} +void EgammaBasicClusters::fillDescriptions(edm::ConfigurationDescriptions &confDesc) { + edm::ParameterSetDescription desc; + + desc.add("barrelBasicClusterCollection", + edm::InputTag("hybridSuperClusters", "hybridBarrelBasicClusters")); + desc.ifValue(edm::ParameterDescription("enableEndcaps", true, true), + true >> edm::ParameterDescription( + "endcapBasicClusterCollection", + edm::InputTag("multi5x5SuperClusters", "multi5x5EndcapBasicClusters"), + true) or + false >> edm::EmptyGroupDescription()); + desc.add("hist_bins_Size", 20); + desc.add("hist_min_Size", 0.); + desc.add("hist_max_Size", 20.); + desc.add("hist_bins_Phi", 181); + desc.add("hist_min_Phi", -3.14159); + desc.add("hist_max_Phi", 3.14159); + desc.add("hist_bins_Eta", 91); + desc.add("hist_min_Eta", -2.5); + desc.add("hist_max_Eta", 2.5); + desc.add("hist_bins_ET", 200); + desc.add("hist_min_ET", 0.); + desc.add("hist_max_ET", 200.); + desc.add("hist_bins_NumRecHits", 50); + desc.add("hist_min_NumRecHits", 0.); + desc.add("hist_max_NumRecHits", 50.); + desc.add("hist_bins_R", 55); + desc.add("hist_min_R", 0.); + desc.add("hist_max_R", 175.); + confDesc.add("egammaBasicClusterAnalyzer", desc); +} + void EgammaBasicClusters::bookHistograms(DQMStore::IBooker &_ibooker, edm::Run const &, edm::EventSetup const &) { _ibooker.setCurrentFolder("EcalClusterV/EcalBasicClusters/"); hist_EB_BC_Size_ = _ibooker.book1D("hist_EB_BC_Size_", "# Basic Clusters in Barrel", hsSize_.bins, hsSize_.min, hsSize_.max); - hist_EE_BC_Size_ = - _ibooker.book1D("hist_EE_BC_Size_", "# Basic Clusters in Endcap", hsSize_.bins, hsSize_.min, hsSize_.max); - hist_EB_BC_NumRecHits_ = _ibooker.book1D("hist_EB_BC_NumRecHits_", "# of RecHits in Basic Clusters in Barrel", hsNumRecHits_.bins, hsNumRecHits_.min, hsNumRecHits_.max); - hist_EE_BC_NumRecHits_ = _ibooker.book1D("hist_EE_BC_NumRecHits_", - "# of RecHits in Basic Clusters in Endcap", - hsNumRecHits_.bins, - hsNumRecHits_.min, - hsNumRecHits_.max); + + if (enableEndcaps_) { + hist_EE_BC_Size_ = + _ibooker.book1D("hist_EE_BC_Size_", "# Basic Clusters in Endcap", hsSize_.bins, hsSize_.min, hsSize_.max); + hist_EE_BC_NumRecHits_ = _ibooker.book1D("hist_EE_BC_NumRecHits_", + "# of RecHits in Basic Clusters in Endcap", + hsNumRecHits_.bins, + hsNumRecHits_.min, + hsNumRecHits_.max); + } hist_EB_BC_ET_ = _ibooker.book1D("hist_EB_BC_ET_", "ET of Basic Clusters in Barrel", hsET_.bins, hsET_.min, hsET_.max); - hist_EE_BC_ET_ = - _ibooker.book1D("hist_EE_BC_ET_", "ET of Basic Clusters in Endcap", hsET_.bins, hsET_.min, hsET_.max); - hist_EB_BC_Eta_ = _ibooker.book1D("hist_EB_BC_Eta_", "Eta of Basic Clusters in Barrel", hsEta_.bins, hsEta_.min, hsEta_.max); - hist_EE_BC_Eta_ = - _ibooker.book1D("hist_EE_BC_Eta_", "Eta of Basic Clusters in Endcap", hsEta_.bins, hsEta_.min, hsEta_.max); - hist_EB_BC_Phi_ = _ibooker.book1D("hist_EB_BC_Phi_", "Phi of Basic Clusters in Barrel", hsPhi_.bins, hsPhi_.min, hsPhi_.max); - hist_EE_BC_Phi_ = - _ibooker.book1D("hist_EE_BC_Phi_", "Phi of Basic Clusters in Endcap", hsPhi_.bins, hsPhi_.min, hsPhi_.max); + + if (enableEndcaps_) { + hist_EE_BC_ET_ = + _ibooker.book1D("hist_EE_BC_ET_", "ET of Basic Clusters in Endcap", hsET_.bins, hsET_.min, hsET_.max); + + hist_EE_BC_Eta_ = + _ibooker.book1D("hist_EE_BC_Eta_", "Eta of Basic Clusters in Endcap", hsEta_.bins, hsEta_.min, hsEta_.max); + + hist_EE_BC_Phi_ = + _ibooker.book1D("hist_EE_BC_Phi_", "Phi of Basic Clusters in Endcap", hsPhi_.bins, hsPhi_.min, hsPhi_.max); + } hist_EB_BC_ET_vs_Eta_ = _ibooker.book2D("hist_EB_BC_ET_vs_Eta_", "Basic Cluster ET versus Eta in Barrel", @@ -91,32 +131,34 @@ void EgammaBasicClusters::bookHistograms(DQMStore::IBooker &_ibooker, edm::Run c hsPhi_.min, hsPhi_.max); - hist_EE_BC_ET_vs_Eta_ = _ibooker.book2D("hist_EE_BC_ET_vs_Eta_", - "Basic Cluster ET versus Eta in Endcap", + if (enableEndcaps_) { + hist_EE_BC_ET_vs_Eta_ = _ibooker.book2D("hist_EE_BC_ET_vs_Eta_", + "Basic Cluster ET versus Eta in Endcap", + hsET_.bins, + hsET_.min, + hsET_.max, + hsEta_.bins, + hsEta_.min, + hsEta_.max); + + hist_EE_BC_ET_vs_Phi_ = _ibooker.book2D("hist_EE_BC_ET_vs_Phi_", + "Basic Cluster ET versus Phi in Endcap", + hsET_.bins, + hsET_.min, + hsET_.max, + hsPhi_.bins, + hsPhi_.min, + hsPhi_.max); + + hist_EE_BC_ET_vs_R_ = _ibooker.book2D("hist_EE_BC_ET_vs_R_", + "Basic Cluster ET versus Radius in Endcap", hsET_.bins, hsET_.min, hsET_.max, - hsEta_.bins, - hsEta_.min, - hsEta_.max); - - hist_EE_BC_ET_vs_Phi_ = _ibooker.book2D("hist_EE_BC_ET_vs_Phi_", - "Basic Cluster ET versus Phi in Endcap", - hsET_.bins, - hsET_.min, - hsET_.max, - hsPhi_.bins, - hsPhi_.min, - hsPhi_.max); - - hist_EE_BC_ET_vs_R_ = _ibooker.book2D("hist_EE_BC_ET_vs_R_", - "Basic Cluster ET versus Radius in Endcap", - hsET_.bins, - hsET_.min, - hsET_.max, - hsR_.bins, - hsR_.min, - hsR_.max); + hsR_.bins, + hsR_.min, + hsR_.max); + } } void EgammaBasicClusters::analyze(const edm::Event &evt, const edm::EventSetup &) { @@ -143,29 +185,31 @@ void EgammaBasicClusters::analyze(const edm::Event &evt, const edm::EventSetup & hist_EB_BC_ET_vs_Phi_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), aClus->phi()); } - edm::Handle pEndcapBasicClusters; - - evt.getByToken(endcapBasicClusterCollection_, pEndcapBasicClusters); - if (!pEndcapBasicClusters.isValid()) { - Labels l; - labelsForToken(endcapBasicClusterCollection_, l); - edm::LogError("EgammaBasicClusters") << "Error! can't get collection with label " << l.module; - } - - const reco::BasicClusterCollection *endcapBasicClusters = pEndcapBasicClusters.product(); - hist_EE_BC_Size_->Fill(endcapBasicClusters->size()); - - for (reco::BasicClusterCollection::const_iterator aClus = endcapBasicClusters->begin(); - aClus != endcapBasicClusters->end(); - aClus++) { - hist_EE_BC_NumRecHits_->Fill(aClus->size()); - hist_EE_BC_ET_->Fill(aClus->energy() / std::cosh(aClus->position().eta())); - hist_EE_BC_Eta_->Fill(aClus->position().eta()); - hist_EE_BC_Phi_->Fill(aClus->position().phi()); - - hist_EE_BC_ET_vs_Eta_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), aClus->eta()); - hist_EE_BC_ET_vs_Phi_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), aClus->phi()); - hist_EE_BC_ET_vs_R_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), - std::sqrt(std::pow(aClus->x(), 2) + std::pow(aClus->y(), 2))); + if (enableEndcaps_) { + edm::Handle pEndcapBasicClusters; + + evt.getByToken(endcapBasicClusterCollection_, pEndcapBasicClusters); + if (!pEndcapBasicClusters.isValid()) { + Labels l; + labelsForToken(endcapBasicClusterCollection_, l); + edm::LogError("EgammaBasicClusters") << "Error! can't get collection with label " << l.module; + } + + const reco::BasicClusterCollection *endcapBasicClusters = pEndcapBasicClusters.product(); + hist_EE_BC_Size_->Fill(endcapBasicClusters->size()); + + for (reco::BasicClusterCollection::const_iterator aClus = endcapBasicClusters->begin(); + aClus != endcapBasicClusters->end(); + aClus++) { + hist_EE_BC_NumRecHits_->Fill(aClus->size()); + hist_EE_BC_ET_->Fill(aClus->energy() / std::cosh(aClus->position().eta())); + hist_EE_BC_Eta_->Fill(aClus->position().eta()); + hist_EE_BC_Phi_->Fill(aClus->position().phi()); + + hist_EE_BC_ET_vs_Eta_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), aClus->eta()); + hist_EE_BC_ET_vs_Phi_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), aClus->phi()); + hist_EE_BC_ET_vs_R_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), + std::sqrt(std::pow(aClus->x(), 2) + std::pow(aClus->y(), 2))); + } } } diff --git a/Validation/EcalClusters/src/EgammaSuperClusters.cc b/Validation/EcalClusters/src/EgammaSuperClusters.cc index 6950a78b4ab2e..a6a38a89cf4df 100644 --- a/Validation/EcalClusters/src/EgammaSuperClusters.cc +++ b/Validation/EcalClusters/src/EgammaSuperClusters.cc @@ -2,6 +2,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/EmptyGroupDescription.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Common/interface/Handle.h" @@ -14,21 +15,29 @@ #include "FWCore/Framework/interface/MakerMacros.h" EgammaSuperClusters::EgammaSuperClusters(const edm::ParameterSet &ps) - : MCTruthCollectionToken_(consumes(ps.getParameter("MCTruthCollection"))), - barrelRawSuperClusterCollectionToken_( - consumes(ps.getParameter("barrelRawSuperClusterCollection"))), - barrelCorSuperClusterCollectionToken_( - consumes(ps.getParameter("barrelCorSuperClusterCollection"))), - endcapRawSuperClusterCollectionToken_( - consumes(ps.getParameter("endcapRawSuperClusterCollection"))), - endcapPreSuperClusterCollectionToken_( - consumes(ps.getParameter("endcapPreSuperClusterCollection"))), - endcapCorSuperClusterCollectionToken_( - consumes(ps.getParameter("endcapCorSuperClusterCollection"))), - barrelRecHitCollectionToken_( - consumes(ps.getParameter("barrelRecHitCollection"))), - endcapRecHitCollectionToken_( - consumes(ps.getParameter("endcapRecHitCollection"))), + : enableEndcaps_{ps.getParameter("enableEndcaps")}, + MCTruthCollectionToken_{consumes(ps.getParameter("MCTruthCollection"))}, + barrelRawSuperClusterCollectionToken_{ + consumes(ps.getParameter("barrelRawSuperClusterCollection"))}, + barrelCorSuperClusterCollectionToken_{ + consumes(ps.getParameter("barrelCorSuperClusterCollection"))}, + endcapRawSuperClusterCollectionToken_{enableEndcaps_ + ? consumes( + ps.getParameter("endcapRawSuperClusterCollection")) + : edm::EDGetTokenT{}}, + endcapPreSuperClusterCollectionToken_{enableEndcaps_ + ? consumes( + ps.getParameter("endcapPreSuperClusterCollection")) + : edm::EDGetTokenT{}}, + endcapCorSuperClusterCollectionToken_{enableEndcaps_ + ? consumes( + ps.getParameter("endcapCorSuperClusterCollection")) + : edm::EDGetTokenT{}}, + barrelRecHitCollectionToken_{ + consumes(ps.getParameter("barrelRecHitCollection"))}, + endcapRecHitCollectionToken_{ + enableEndcaps_ ? consumes(ps.getParameter("endcapRecHitCollection")) + : edm::EDGetTokenT{}}, ecalClusterToolsESGetTokens_{consumesCollector()}, hsSize_(ps, "Size"), hsNumBC_(ps, "NumBC"), @@ -41,7 +50,7 @@ EgammaSuperClusters::EgammaSuperClusters(const edm::ParameterSet &ps) hsdeltaR_(ps, "deltaR"), hsphiWidth_(ps, "phiWidth"), hsetaWidth_(ps, "etaWidth"), - hspreshowerE_(ps, "preshowerE"), + hspreshowerE_{enableEndcaps_ ? HistSpec(ps, "preshowerE") : HistSpec()}, hsR_(ps, "R"), hist_EB_RawSC_Size_(nullptr), hist_EE_RawSC_Size_(nullptr), @@ -102,6 +111,69 @@ EgammaSuperClusters::EgammaSuperClusters(const edm::ParameterSet &ps) EgammaSuperClusters::~EgammaSuperClusters() {} +void EgammaSuperClusters::fillDescriptions(edm::ConfigurationDescriptions &confDesc) { + edm::ParameterSetDescription desc; + + desc.add("MCTruthCollection", edm::InputTag("generatorSmeared")); + desc.add("barrelRecHitCollection", edm::InputTag("reducedEcalRecHitsEB")); + desc.add("barrelRawSuperClusterCollection", edm::InputTag("hybridSuperClusters")); + desc.add("barrelCorSuperClusterCollection", edm::InputTag("correctedHybridSuperClusters")); + desc.ifValue( + edm::ParameterDescription("enableEndcaps", true, true), + true >> (edm::ParameterDescription( + "endcapRecHitCollection", edm::InputTag("reducedEcalRecHitsEE"), true) and + edm::ParameterDescription( + "endcapRawSuperClusterCollection", + edm::InputTag("multi5x5SuperClusters", "multi5x5EndcapSuperClusters"), + true) and + edm::ParameterDescription("endcapCorSuperClusterCollection", + edm::InputTag("correctedMulti5x5SuperClustersWithPreshower"), + true) and + edm::ParameterDescription( + "endcapPreSuperClusterCollection", edm::InputTag("multi5x5SuperClustersWithPreshower"), true) and + edm::ParameterDescription("hist_bins_preshowerE", 100, true) and + edm::ParameterDescription("hist_min_preshowerE", 0., true) and + edm::ParameterDescription("hist_max_preshowerE", 100., true)) or + false >> edm::EmptyGroupDescription()); + desc.add("hist_max_Size", 5.); + desc.add("hist_min_Size", 0.); + desc.add("hist_bins_Size", 5); + desc.add("hist_bins_deltaR", 50); + desc.add("hist_min_deltaR", 0.); + desc.add("hist_max_deltaR", 0.5); + desc.add("hist_bins_etaWidth", 100); + desc.add("hist_min_etaWidth", 0.); + desc.add("hist_max_etaWidth", 0.1); + desc.add("hist_bins_Eta", 100); + desc.add("hist_min_Eta", -3.); + desc.add("hist_max_Eta", 3.); + desc.add("hist_bins_EoverTruth", 100); + desc.add("hist_min_EoverTruth", 0.5); + desc.add("hist_max_EoverTruth", 1.5); + desc.add("hist_bins_S25toE", 50); + desc.add("hist_min_S25toE", 0.); + desc.add("hist_max_S25toE", 1.); + desc.add("hist_bins_phiWidth", 100); + desc.add("hist_min_phiWidth", 0.); + desc.add("hist_max_phiWidth", 0.1); + desc.add("hist_bins_Phi", 181); + desc.add("hist_min_Phi", -3.14159); + desc.add("hist_max_Phi", 3.14159); + desc.add("hist_bins_S1toS9", 50); + desc.add("hist_min_S1toS9", 0.); + desc.add("hist_max_S1toS9", 1.); + desc.add("hist_bins_ET", 100); + desc.add("hist_min_ET", 0.); + desc.add("hist_max_ET", 50.); + desc.add("hist_bins_NumBC", 10); + desc.add("hist_min_NumBC", 0.); + desc.add("hist_max_NumBC", 10.); + desc.add("hist_bins_R", 55); + desc.add("hist_min_R", 0.); + desc.add("hist_max_R", 175.); + confDesc.add("egammaSuperClusterAnalyzer", desc); +} + void EgammaSuperClusters::bookHistograms(DQMStore::IBooker &_ibooker, edm::Run const &, edm::EventSetup const &) { _ibooker.setCurrentFolder("EcalClusterV/EcalSuperClusters/"); @@ -109,14 +181,16 @@ void EgammaSuperClusters::bookHistograms(DQMStore::IBooker &_ibooker, edm::Run c // hist_EB_RawSC_Size_ = _ibooker.book1D("hist_EB_RawSC_Size_", "# Raw SuperClusters in Barrel", hsSize_.bins, hsSize_.min, hsSize_.max); - hist_EE_RawSC_Size_ = - _ibooker.book1D("hist_EE_RawSC_Size_", "# Raw SuperClusters in Endcap", hsSize_.bins, hsSize_.min, hsSize_.max); hist_EB_CorSC_Size_ = _ibooker.book1D( "hist_EB_CorSC_Size_", "# Corrected SuperClusters in Barrel", hsSize_.bins, hsSize_.min, hsSize_.max); - hist_EE_CorSC_Size_ = _ibooker.book1D( - "hist_EE_CorSC_Size_", "# Corrected SuperClusters in Endcap", hsSize_.bins, hsSize_.min, hsSize_.max); - hist_EE_PreSC_Size_ = _ibooker.book1D( - "hist_EE_PreSC_Size_", "# SuperClusters with Preshower in Endcap", hsSize_.bins, hsSize_.min, hsSize_.max); + if (enableEndcaps_) { + hist_EE_RawSC_Size_ = + _ibooker.book1D("hist_EE_RawSC_Size_", "# Raw SuperClusters in Endcap", hsSize_.bins, hsSize_.min, hsSize_.max); + hist_EE_CorSC_Size_ = _ibooker.book1D( + "hist_EE_CorSC_Size_", "# Corrected SuperClusters in Endcap", hsSize_.bins, hsSize_.min, hsSize_.max); + hist_EE_PreSC_Size_ = _ibooker.book1D( + "hist_EE_PreSC_Size_", "# SuperClusters with Preshower in Endcap", hsSize_.bins, hsSize_.min, hsSize_.max); + } // Number of BasicClusters in SuperCluster // @@ -125,109 +199,121 @@ void EgammaSuperClusters::bookHistograms(DQMStore::IBooker &_ibooker, edm::Run c hsNumBC_.bins, hsNumBC_.min, hsNumBC_.max); - hist_EE_RawSC_NumBC_ = _ibooker.book1D("hist_EE_RawSC_NumBC_", - "# of Basic Clusters in Raw Super Clusters in Endcap", - hsNumBC_.bins, - hsNumBC_.min, - hsNumBC_.max); hist_EB_CorSC_NumBC_ = _ibooker.book1D("hist_EB_CorSC_NumBC_", "# of Basic Clusters in Corrected SuperClusters in Barrel", hsNumBC_.bins, hsNumBC_.min, hsNumBC_.max); - hist_EE_CorSC_NumBC_ = _ibooker.book1D("hist_EE_CorSC_NumBC_", - "# of Basic Clusters in Corrected SuperClusters in Endcap", - hsNumBC_.bins, - hsNumBC_.min, - hsNumBC_.max); - hist_EE_PreSC_NumBC_ = _ibooker.book1D("hist_EE_PreSC_NumBC_", - "# of Basic Clusters in SuperClusters with Preshower in Endcap", - hsNumBC_.bins, - hsNumBC_.min, - hsNumBC_.max); + if (enableEndcaps_) { + hist_EE_RawSC_NumBC_ = _ibooker.book1D("hist_EE_RawSC_NumBC_", + "# of Basic Clusters in Raw Super Clusters in Endcap", + hsNumBC_.bins, + hsNumBC_.min, + hsNumBC_.max); + hist_EE_CorSC_NumBC_ = _ibooker.book1D("hist_EE_CorSC_NumBC_", + "# of Basic Clusters in Corrected SuperClusters in Endcap", + hsNumBC_.bins, + hsNumBC_.min, + hsNumBC_.max); + hist_EE_PreSC_NumBC_ = _ibooker.book1D("hist_EE_PreSC_NumBC_", + "# of Basic Clusters in SuperClusters with Preshower in Endcap", + hsNumBC_.bins, + hsNumBC_.min, + hsNumBC_.max); + } // ET distribution of SuperClusters // hist_EB_RawSC_ET_ = _ibooker.book1D("hist_EB_RawSC_ET_", "ET of Raw SuperClusters in Barrel", hsET_.bins, hsET_.min, hsET_.max); - hist_EE_RawSC_ET_ = - _ibooker.book1D("hist_EE_RawSC_ET_", "ET of Raw SuperClusters in Endcap", hsET_.bins, hsET_.min, hsET_.max); hist_EB_CorSC_ET_ = _ibooker.book1D("hist_EB_CorSC_ET_", "ET of Corrected SuperClusters in Barrel", hsET_.bins, hsET_.min, hsET_.max); - hist_EE_CorSC_ET_ = - _ibooker.book1D("hist_EE_CorSC_ET_", "ET of Corrected SuperClusters in Endcap", hsET_.bins, hsET_.min, hsET_.max); - hist_EE_PreSC_ET_ = _ibooker.book1D( - "hist_EE_PreSC_ET_", "ET of SuperClusters with Preshower in Endcap", hsET_.bins, hsET_.min, hsET_.max); + if (enableEndcaps_) { + hist_EE_RawSC_ET_ = + _ibooker.book1D("hist_EE_RawSC_ET_", "ET of Raw SuperClusters in Endcap", hsET_.bins, hsET_.min, hsET_.max); + hist_EE_CorSC_ET_ = _ibooker.book1D( + "hist_EE_CorSC_ET_", "ET of Corrected SuperClusters in Endcap", hsET_.bins, hsET_.min, hsET_.max); + hist_EE_PreSC_ET_ = _ibooker.book1D( + "hist_EE_PreSC_ET_", "ET of SuperClusters with Preshower in Endcap", hsET_.bins, hsET_.min, hsET_.max); + } // Eta distribution of SuperClusters // hist_EB_RawSC_Eta_ = _ibooker.book1D("hist_EB_RawSC_Eta_", "Eta of Raw SuperClusters in Barrel", hsEta_.bins, hsEta_.min, hsEta_.max); - hist_EE_RawSC_Eta_ = - _ibooker.book1D("hist_EE_RawSC_Eta_", "Eta of Raw SuperClusters in Endcap", hsEta_.bins, hsEta_.min, hsEta_.max); hist_EB_CorSC_Eta_ = _ibooker.book1D( "hist_EB_CorSC_Eta_", "Eta of Corrected SuperClusters in Barrel", hsEta_.bins, hsEta_.min, hsEta_.max); - hist_EE_CorSC_Eta_ = _ibooker.book1D( - "hist_EE_CorSC_Eta_", "Eta of Corrected SuperClusters in Endcap", hsEta_.bins, hsEta_.min, hsEta_.max); - hist_EE_PreSC_Eta_ = _ibooker.book1D( - "hist_EE_PreSC_Eta_", "Eta of SuperClusters with Preshower in Endcap", hsEta_.bins, hsEta_.min, hsEta_.max); + if (enableEndcaps_) { + hist_EE_RawSC_Eta_ = _ibooker.book1D( + "hist_EE_RawSC_Eta_", "Eta of Raw SuperClusters in Endcap", hsEta_.bins, hsEta_.min, hsEta_.max); + hist_EE_CorSC_Eta_ = _ibooker.book1D( + "hist_EE_CorSC_Eta_", "Eta of Corrected SuperClusters in Endcap", hsEta_.bins, hsEta_.min, hsEta_.max); + hist_EE_PreSC_Eta_ = _ibooker.book1D( + "hist_EE_PreSC_Eta_", "Eta of SuperClusters with Preshower in Endcap", hsEta_.bins, hsEta_.min, hsEta_.max); + } // Phi distribution of SuperClusters // hist_EB_RawSC_Phi_ = _ibooker.book1D("hist_EB_RawSC_Phi_", "Phi of Raw SuperClusters in Barrel", hsPhi_.bins, hsPhi_.min, hsPhi_.max); - hist_EE_RawSC_Phi_ = - _ibooker.book1D("hist_EE_RawSC_Phi_", "Phi of Raw SuperClusters in Endcap", hsPhi_.bins, hsPhi_.min, hsPhi_.max); hist_EB_CorSC_Phi_ = _ibooker.book1D( "hist_EB_CorSC_Phi_", "Phi of Corrected SuperClusters in Barrel", hsPhi_.bins, hsPhi_.min, hsPhi_.max); - hist_EE_CorSC_Phi_ = _ibooker.book1D( - "hist_EE_CorSC_Phi_", "Phi of Corrected SuperClusters in Endcap", hsPhi_.bins, hsPhi_.min, hsPhi_.max); - hist_EE_PreSC_Phi_ = _ibooker.book1D( - "hist_EE_PreSC_Phi_", "Phi of SuperClusters with Preshower in Endcap", hsPhi_.bins, hsPhi_.min, hsPhi_.max); + if (enableEndcaps_) { + hist_EE_RawSC_Phi_ = _ibooker.book1D( + "hist_EE_RawSC_Phi_", "Phi of Raw SuperClusters in Endcap", hsPhi_.bins, hsPhi_.min, hsPhi_.max); + hist_EE_CorSC_Phi_ = _ibooker.book1D( + "hist_EE_CorSC_Phi_", "Phi of Corrected SuperClusters in Endcap", hsPhi_.bins, hsPhi_.min, hsPhi_.max); + hist_EE_PreSC_Phi_ = _ibooker.book1D( + "hist_EE_PreSC_Phi_", "Phi of SuperClusters with Preshower in Endcap", hsPhi_.bins, hsPhi_.min, hsPhi_.max); + } // S1/S9 distribution of SuperClusters // hist_EB_RawSC_S1toS9_ = _ibooker.book1D( "hist_EB_RawSC_S1toS9_", "S1/S9 of Raw Super Clusters in Barrel", hsS1toS9_.bins, hsS1toS9_.min, hsS1toS9_.max); - hist_EE_RawSC_S1toS9_ = _ibooker.book1D( - "hist_EE_RawSC_S1toS9_", "S1/S9 of Raw Super Clusters in Endcap", hsS1toS9_.bins, hsS1toS9_.min, hsS1toS9_.max); hist_EB_CorSC_S1toS9_ = _ibooker.book1D("hist_EB_CorSC_S1toS9_", "S1/S9 of Corrected SuperClusters in Barrel", hsS1toS9_.bins, hsS1toS9_.min, hsS1toS9_.max); - hist_EE_CorSC_S1toS9_ = _ibooker.book1D("hist_EE_CorSC_S1toS9_", - "S1/S9 of Corrected SuperClusters in Endcap", - hsS1toS9_.bins, - hsS1toS9_.min, - hsS1toS9_.max); - hist_EE_PreSC_S1toS9_ = _ibooker.book1D("hist_EE_PreSC_S1toS9_", - "S1/S9 of SuperClusters with Preshower in Endcap", - hsS1toS9_.bins, - hsS1toS9_.min, - hsS1toS9_.max); + if (enableEndcaps_) { + hist_EE_RawSC_S1toS9_ = _ibooker.book1D( + "hist_EE_RawSC_S1toS9_", "S1/S9 of Raw Super Clusters in Endcap", hsS1toS9_.bins, hsS1toS9_.min, hsS1toS9_.max); + hist_EE_CorSC_S1toS9_ = _ibooker.book1D("hist_EE_CorSC_S1toS9_", + "S1/S9 of Corrected SuperClusters in Endcap", + hsS1toS9_.bins, + hsS1toS9_.min, + hsS1toS9_.max); + hist_EE_PreSC_S1toS9_ = _ibooker.book1D("hist_EE_PreSC_S1toS9_", + "S1/S9 of SuperClusters with Preshower in Endcap", + hsS1toS9_.bins, + hsS1toS9_.min, + hsS1toS9_.max); + } // S25/E distribution of SuperClusters // hist_EB_RawSC_S25toE_ = _ibooker.book1D( "hist_EB_RawSC_S25toE_", "S25/E of Raw Super Clusters in Barrel", hsS25toE_.bins, hsS25toE_.min, hsS25toE_.max); - hist_EE_RawSC_S25toE_ = _ibooker.book1D( - "hist_EE_RawSC_S25toE_", "S25/E of Raw Super Clusters in Endcap", hsS25toE_.bins, hsS25toE_.min, hsS25toE_.max); hist_EB_CorSC_S25toE_ = _ibooker.book1D("hist_EB_CorSC_S25toE_", "S25/E of Corrected SuperClusters in Barrel", hsS25toE_.bins, hsS25toE_.min, hsS25toE_.max); - hist_EE_CorSC_S25toE_ = _ibooker.book1D("hist_EE_CorSC_S25toE_", - "S25/E of Corrected SuperClusters in Endcap", - hsS25toE_.bins, - hsS25toE_.min, - hsS25toE_.max); - hist_EE_PreSC_S25toE_ = _ibooker.book1D("hist_EE_PreSC_S25toE_", - "S25/E of SuperClusters with Preshower in Endcap", - hsS25toE_.bins, - hsS25toE_.min, - hsS25toE_.max); + if (enableEndcaps_) { + hist_EE_RawSC_S25toE_ = _ibooker.book1D( + "hist_EE_RawSC_S25toE_", "S25/E of Raw Super Clusters in Endcap", hsS25toE_.bins, hsS25toE_.min, hsS25toE_.max); + hist_EE_CorSC_S25toE_ = _ibooker.book1D("hist_EE_CorSC_S25toE_", + "S25/E of Corrected SuperClusters in Endcap", + hsS25toE_.bins, + hsS25toE_.min, + hsS25toE_.max); + hist_EE_PreSC_S25toE_ = _ibooker.book1D("hist_EE_PreSC_S25toE_", + "S25/E of SuperClusters with Preshower in Endcap", + hsS25toE_.bins, + hsS25toE_.min, + hsS25toE_.max); + } // E/E(true) distribution of SuperClusters // @@ -236,26 +322,28 @@ void EgammaSuperClusters::bookHistograms(DQMStore::IBooker &_ibooker, edm::Run c hsEoverTruth_.bins, hsEoverTruth_.min, hsEoverTruth_.max); - hist_EE_RawSC_EoverTruth_ = _ibooker.book1D("hist_EE_RawSC_EoverTruth_", - "E/True E of Raw SuperClusters in Endcap", - hsEoverTruth_.bins, - hsEoverTruth_.min, - hsEoverTruth_.max); hist_EB_CorSC_EoverTruth_ = _ibooker.book1D("hist_EB_CorSC_EoverTruth_", "E/True E of Corrected SuperClusters in Barrel", hsEoverTruth_.bins, hsEoverTruth_.min, hsEoverTruth_.max); - hist_EE_CorSC_EoverTruth_ = _ibooker.book1D("hist_EE_CorSC_EoverTruth_", - "E/True E of Corrected SuperClusters in Endcap", - hsEoverTruth_.bins, - hsEoverTruth_.min, - hsEoverTruth_.max); - hist_EE_PreSC_EoverTruth_ = _ibooker.book1D("hist_EE_PreSC_EoverTruth_", - "E/True E of SuperClusters with Preshower in Endcap", - hsEoverTruth_.bins, - hsEoverTruth_.min, - hsEoverTruth_.max); + if (enableEndcaps_) { + hist_EE_RawSC_EoverTruth_ = _ibooker.book1D("hist_EE_RawSC_EoverTruth_", + "E/True E of Raw SuperClusters in Endcap", + hsEoverTruth_.bins, + hsEoverTruth_.min, + hsEoverTruth_.max); + hist_EE_CorSC_EoverTruth_ = _ibooker.book1D("hist_EE_CorSC_EoverTruth_", + "E/True E of Corrected SuperClusters in Endcap", + hsEoverTruth_.bins, + hsEoverTruth_.min, + hsEoverTruth_.max); + hist_EE_PreSC_EoverTruth_ = _ibooker.book1D("hist_EE_PreSC_EoverTruth_", + "E/True E of SuperClusters with Preshower in Endcap", + hsEoverTruth_.bins, + hsEoverTruth_.min, + hsEoverTruth_.max); + } // dR distribution of SuperClusters from truth // @@ -264,26 +352,28 @@ void EgammaSuperClusters::bookHistograms(DQMStore::IBooker &_ibooker, edm::Run c hsdeltaR_.bins, hsdeltaR_.min, hsdeltaR_.max); - hist_EE_RawSC_deltaR_ = _ibooker.book1D("hist_EE_RawSC_deltaR_", - "dR to MC truth of Raw Super Clusters in Endcap", - hsdeltaR_.bins, - hsdeltaR_.min, - hsdeltaR_.max); hist_EB_CorSC_deltaR_ = _ibooker.book1D("hist_EB_CorSC_deltaR_", "dR to MC truth of Corrected SuperClusters in Barrel", hsdeltaR_.bins, hsdeltaR_.min, hsdeltaR_.max); - hist_EE_CorSC_deltaR_ = _ibooker.book1D("hist_EE_CorSC_deltaR_", - "dR to MC truth of Corrected SuperClusters in Endcap", - hsdeltaR_.bins, - hsdeltaR_.min, - hsdeltaR_.max); - hist_EE_PreSC_deltaR_ = _ibooker.book1D("hist_EE_PreSC_deltaR_", - "dR to MC truth of SuperClusters with Preshower in Endcap", - hsdeltaR_.bins, - hsdeltaR_.min, - hsdeltaR_.max); + if (enableEndcaps_) { + hist_EE_RawSC_deltaR_ = _ibooker.book1D("hist_EE_RawSC_deltaR_", + "dR to MC truth of Raw Super Clusters in Endcap", + hsdeltaR_.bins, + hsdeltaR_.min, + hsdeltaR_.max); + hist_EE_CorSC_deltaR_ = _ibooker.book1D("hist_EE_CorSC_deltaR_", + "dR to MC truth of Corrected SuperClusters in Endcap", + hsdeltaR_.bins, + hsdeltaR_.min, + hsdeltaR_.max); + hist_EE_PreSC_deltaR_ = _ibooker.book1D("hist_EE_PreSC_deltaR_", + "dR to MC truth of SuperClusters with Preshower in Endcap", + hsdeltaR_.bins, + hsdeltaR_.min, + hsdeltaR_.max); + } // phi width stored in corrected SuperClusters hist_EB_CorSC_phiWidth_ = _ibooker.book1D("hist_EB_CorSC_phiWidth_", @@ -291,11 +381,13 @@ void EgammaSuperClusters::bookHistograms(DQMStore::IBooker &_ibooker, edm::Run c hsphiWidth_.bins, hsphiWidth_.min, hsphiWidth_.max); - hist_EE_CorSC_phiWidth_ = _ibooker.book1D("hist_EE_CorSC_phiWidth_", - "phiWidth of Corrected Super Clusters in Endcap", - hsphiWidth_.bins, - hsphiWidth_.min, - hsphiWidth_.max); + if (enableEndcaps_) { + hist_EE_CorSC_phiWidth_ = _ibooker.book1D("hist_EE_CorSC_phiWidth_", + "phiWidth of Corrected Super Clusters in Endcap", + hsphiWidth_.bins, + hsphiWidth_.min, + hsphiWidth_.max); + } // eta width stored in corrected SuperClusters hist_EB_CorSC_etaWidth_ = _ibooker.book1D("hist_EB_CorSC_etaWidth_", @@ -303,23 +395,25 @@ void EgammaSuperClusters::bookHistograms(DQMStore::IBooker &_ibooker, edm::Run c hsetaWidth_.bins, hsetaWidth_.min, hsetaWidth_.max); - hist_EE_CorSC_etaWidth_ = _ibooker.book1D("hist_EE_CorSC_etaWidth_", - "etaWidth of Corrected Super Clusters in Endcap", - hsetaWidth_.bins, - hsetaWidth_.min, - hsetaWidth_.max); - - // preshower energy - hist_EE_PreSC_preshowerE_ = _ibooker.book1D("hist_EE_PreSC_preshowerE_", - "preshower energy in Super Clusters with Preshower in Endcap", - hspreshowerE_.bins, - hspreshowerE_.min, - hspreshowerE_.max); - hist_EE_CorSC_preshowerE_ = _ibooker.book1D("hist_EE_CorSC_preshowerE_", - "preshower energy in Corrected Super Clusters with Preshower in Endcap", - hspreshowerE_.bins, - hspreshowerE_.min, - hspreshowerE_.max); + if (enableEndcaps_) { + hist_EE_CorSC_etaWidth_ = _ibooker.book1D("hist_EE_CorSC_etaWidth_", + "etaWidth of Corrected Super Clusters in Endcap", + hsetaWidth_.bins, + hsetaWidth_.min, + hsetaWidth_.max); + + // preshower energy + hist_EE_PreSC_preshowerE_ = _ibooker.book1D("hist_EE_PreSC_preshowerE_", + "preshower energy in Super Clusters with Preshower in Endcap", + hspreshowerE_.bins, + hspreshowerE_.min, + hspreshowerE_.max); + hist_EE_CorSC_preshowerE_ = _ibooker.book1D("hist_EE_CorSC_preshowerE_", + "preshower energy in Corrected Super Clusters with Preshower in Endcap", + hspreshowerE_.bins, + hspreshowerE_.min, + hspreshowerE_.max); + } // hist_EB_CorSC_ET_vs_Eta_ = _ibooker.book2D("hist_EB_CorSC_ET_vs_Eta_", @@ -340,32 +434,34 @@ void EgammaSuperClusters::bookHistograms(DQMStore::IBooker &_ibooker, edm::Run c hsPhi_.min, hsPhi_.max); - hist_EE_CorSC_ET_vs_Eta_ = _ibooker.book2D("hist_EE_CorSC_ET_vs_Eta_", - "Corr Super Cluster ET versus Eta in Endcap", + if (enableEndcaps_) { + hist_EE_CorSC_ET_vs_Eta_ = _ibooker.book2D("hist_EE_CorSC_ET_vs_Eta_", + "Corr Super Cluster ET versus Eta in Endcap", + hsET_.bins, + hsET_.min, + hsET_.max, + hsEta_.bins, + hsEta_.min, + hsEta_.max); + + hist_EE_CorSC_ET_vs_Phi_ = _ibooker.book2D("hist_EE_CorSC_ET_vs_Phi_", + "Corr Super Cluster ET versus Phi in Endcap", + hsET_.bins, + hsET_.min, + hsET_.max, + hsPhi_.bins, + hsPhi_.min, + hsPhi_.max); + + hist_EE_CorSC_ET_vs_R_ = _ibooker.book2D("hist_EE_CorSC_ET_vs_R_", + "Corr Super Cluster ET versus Radius in Endcap", hsET_.bins, hsET_.min, hsET_.max, - hsEta_.bins, - hsEta_.min, - hsEta_.max); - - hist_EE_CorSC_ET_vs_Phi_ = _ibooker.book2D("hist_EE_CorSC_ET_vs_Phi_", - "Corr Super Cluster ET versus Phi in Endcap", - hsET_.bins, - hsET_.min, - hsET_.max, - hsPhi_.bins, - hsPhi_.min, - hsPhi_.max); - - hist_EE_CorSC_ET_vs_R_ = _ibooker.book2D("hist_EE_CorSC_ET_vs_R_", - "Corr Super Cluster ET versus Radius in Endcap", - hsET_.bins, - hsET_.min, - hsET_.max, - hsR_.bins, - hsR_.min, - hsR_.max); + hsR_.bins, + hsR_.min, + hsR_.max); + } } void EgammaSuperClusters::analyze(const edm::Event &evt, const edm::EventSetup &es) { @@ -407,19 +503,26 @@ void EgammaSuperClusters::analyze(const edm::Event &evt, const edm::EventSetup & edm::Handle pBarrelRecHitCollection; evt.getByToken(barrelRecHitCollectionToken_, pBarrelRecHitCollection); if (!pBarrelRecHitCollection.isValid()) { + edm::LogError("EgammaSuperClusters") << "Error! can't get EB RecHits collection"; skipBarrel = true; } - edm::Handle pEndcapRecHitCollection; - evt.getByToken(endcapRecHitCollectionToken_, pEndcapRecHitCollection); - if (!pEndcapRecHitCollection.isValid()) { - skipEndcap = true; + if (enableEndcaps_) { + edm::Handle pEndcapRecHitCollection; + evt.getByToken(endcapRecHitCollectionToken_, pEndcapRecHitCollection); + if (!pEndcapRecHitCollection.isValid()) { + edm::LogError("EgammaSuperClusters") << "Error! can't get EE RecHits collection"; + skipEndcap = true; + } } if (skipBarrel || skipEndcap) return; - EcalClusterLazyTools lazyTool( - evt, ecalClusterToolsESGetTokens_.get(es), barrelRecHitCollectionToken_, endcapRecHitCollectionToken_); + EcalClusterLazyTools lazyTool = + enableEndcaps_ + ? EcalClusterLazyTools( + evt, ecalClusterToolsESGetTokens_.get(es), barrelRecHitCollectionToken_, endcapRecHitCollectionToken_) + : EcalClusterLazyTools(evt, ecalClusterToolsESGetTokens_.get(es), barrelRecHitCollectionToken_); // Get the BARREL collections const reco::SuperClusterCollection *barrelRawSuperClusters = pBarrelRawSuperClusters.product(); @@ -491,114 +594,116 @@ void EgammaSuperClusters::analyze(const edm::Event &evt, const edm::EventSetup & // // Get the ENDCAP products // - edm::Handle pEndcapRawSuperClusters; - evt.getByToken(endcapRawSuperClusterCollectionToken_, pEndcapRawSuperClusters); - if (!pEndcapRawSuperClusters.isValid()) { - edm::LogError("EgammaSuperClusters") << "Error! can't get collection Raw EE SC"; - } - - edm::Handle pEndcapPreSuperClusters; - evt.getByToken(endcapPreSuperClusterCollectionToken_, pEndcapPreSuperClusters); - if (!pEndcapPreSuperClusters.isValid()) { - edm::LogError("EgammaSuperClusters") << "Error! can't get collection Pre EE SC"; - } - - edm::Handle pEndcapCorSuperClusters; - evt.getByToken(endcapCorSuperClusterCollectionToken_, pEndcapCorSuperClusters); - if (!pEndcapCorSuperClusters.isValid()) { - edm::LogError("EgammaSuperClusters") << "Error! can't get collection Cor EE SC"; - } - - // Get the ENDCAP collections - const reco::SuperClusterCollection *endcapRawSuperClusters = pEndcapRawSuperClusters.product(); - const reco::SuperClusterCollection *endcapPreSuperClusters = pEndcapPreSuperClusters.product(); - const reco::SuperClusterCollection *endcapCorSuperClusters = pEndcapCorSuperClusters.product(); - - // Number of entries in collections - hist_EE_RawSC_Size_->Fill(endcapRawSuperClusters->size()); - hist_EE_PreSC_Size_->Fill(endcapPreSuperClusters->size()); - hist_EE_CorSC_Size_->Fill(endcapCorSuperClusters->size()); - - // Do RAW ENDCAP SuperClusters - for (reco::SuperClusterCollection::const_iterator aClus = endcapRawSuperClusters->begin(); - aClus != endcapRawSuperClusters->end(); - aClus++) { - hist_EE_RawSC_NumBC_->Fill(aClus->clustersSize()); - hist_EE_RawSC_ET_->Fill(aClus->energy() / std::cosh(aClus->position().eta())); - hist_EE_RawSC_Eta_->Fill(aClus->position().eta()); - hist_EE_RawSC_Phi_->Fill(aClus->position().phi()); - - const reco::CaloClusterPtr seed = aClus->seed(); - hist_EE_RawSC_S1toS9_->Fill(lazyTool.eMax(*seed) / lazyTool.e3x3(*seed)); - hist_EE_RawSC_S25toE_->Fill(lazyTool.e5x5(*seed) / aClus->energy()); - - // truth - double dRClosest = 999.9; - double energyClosest = 0; - closestMCParticle(genEvent, *aClus, dRClosest, energyClosest); - - if (dRClosest < 0.1) { - hist_EE_RawSC_EoverTruth_->Fill(aClus->energy() / energyClosest); - hist_EE_RawSC_deltaR_->Fill(dRClosest); + if (enableEndcaps_) { + edm::Handle pEndcapRawSuperClusters; + evt.getByToken(endcapRawSuperClusterCollectionToken_, pEndcapRawSuperClusters); + if (!pEndcapRawSuperClusters.isValid()) { + edm::LogError("EgammaSuperClusters") << "Error! can't get collection Raw EE SC"; } - } - - // Do ENDCAP SuperClusters with PRESHOWER - for (reco::SuperClusterCollection::const_iterator aClus = endcapPreSuperClusters->begin(); - aClus != endcapPreSuperClusters->end(); - aClus++) { - hist_EE_PreSC_NumBC_->Fill(aClus->clustersSize()); - hist_EE_PreSC_ET_->Fill(aClus->energy() / std::cosh(aClus->position().eta())); - hist_EE_PreSC_Eta_->Fill(aClus->position().eta()); - hist_EE_PreSC_Phi_->Fill(aClus->position().phi()); - hist_EE_PreSC_preshowerE_->Fill(aClus->preshowerEnergy()); - const reco::CaloClusterPtr seed = aClus->seed(); - hist_EE_PreSC_S1toS9_->Fill(lazyTool.eMax(*seed) / lazyTool.e3x3(*seed)); - hist_EE_PreSC_S25toE_->Fill(lazyTool.e5x5(*seed) / aClus->energy()); - - // truth - double dRClosest = 999.9; - double energyClosest = 0; - closestMCParticle(genEvent, *aClus, dRClosest, energyClosest); - - if (dRClosest < 0.1) { - hist_EE_PreSC_EoverTruth_->Fill(aClus->energy() / energyClosest); - hist_EE_PreSC_deltaR_->Fill(dRClosest); + edm::Handle pEndcapPreSuperClusters; + evt.getByToken(endcapPreSuperClusterCollectionToken_, pEndcapPreSuperClusters); + if (!pEndcapPreSuperClusters.isValid()) { + edm::LogError("EgammaSuperClusters") << "Error! can't get collection Pre EE SC"; } - } - - // Do CORRECTED ENDCAP SuperClusters - for (reco::SuperClusterCollection::const_iterator aClus = endcapCorSuperClusters->begin(); - aClus != endcapCorSuperClusters->end(); - aClus++) { - hist_EE_CorSC_NumBC_->Fill(aClus->clustersSize()); - hist_EE_CorSC_ET_->Fill(aClus->energy() / std::cosh(aClus->position().eta())); - hist_EE_CorSC_Eta_->Fill(aClus->position().eta()); - hist_EE_CorSC_Phi_->Fill(aClus->position().phi()); - hist_EE_CorSC_preshowerE_->Fill(aClus->preshowerEnergy()); - hist_EE_CorSC_ET_vs_Eta_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), aClus->eta()); - hist_EE_CorSC_ET_vs_Phi_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), aClus->phi()); - hist_EE_CorSC_ET_vs_R_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), - std::sqrt(std::pow(aClus->x(), 2) + std::pow(aClus->y(), 2))); - - // correction variables - hist_EE_CorSC_phiWidth_->Fill(aClus->phiWidth()); - hist_EE_CorSC_etaWidth_->Fill(aClus->etaWidth()); + edm::Handle pEndcapCorSuperClusters; + evt.getByToken(endcapCorSuperClusterCollectionToken_, pEndcapCorSuperClusters); + if (!pEndcapCorSuperClusters.isValid()) { + edm::LogError("EgammaSuperClusters") << "Error! can't get collection Cor EE SC"; + } - const reco::CaloClusterPtr seed = aClus->seed(); - hist_EE_CorSC_S1toS9_->Fill(lazyTool.eMax(*seed) / lazyTool.e3x3(*seed)); - hist_EE_CorSC_S25toE_->Fill(lazyTool.e5x5(*seed) / aClus->energy()); + // Get the ENDCAP collections + const reco::SuperClusterCollection *endcapRawSuperClusters = pEndcapRawSuperClusters.product(); + const reco::SuperClusterCollection *endcapPreSuperClusters = pEndcapPreSuperClusters.product(); + const reco::SuperClusterCollection *endcapCorSuperClusters = pEndcapCorSuperClusters.product(); + + // Number of entries in collections + hist_EE_RawSC_Size_->Fill(endcapRawSuperClusters->size()); + hist_EE_PreSC_Size_->Fill(endcapPreSuperClusters->size()); + hist_EE_CorSC_Size_->Fill(endcapCorSuperClusters->size()); + + // Do RAW ENDCAP SuperClusters + for (reco::SuperClusterCollection::const_iterator aClus = endcapRawSuperClusters->begin(); + aClus != endcapRawSuperClusters->end(); + aClus++) { + hist_EE_RawSC_NumBC_->Fill(aClus->clustersSize()); + hist_EE_RawSC_ET_->Fill(aClus->energy() / std::cosh(aClus->position().eta())); + hist_EE_RawSC_Eta_->Fill(aClus->position().eta()); + hist_EE_RawSC_Phi_->Fill(aClus->position().phi()); + + const reco::CaloClusterPtr seed = aClus->seed(); + hist_EE_RawSC_S1toS9_->Fill(lazyTool.eMax(*seed) / lazyTool.e3x3(*seed)); + hist_EE_RawSC_S25toE_->Fill(lazyTool.e5x5(*seed) / aClus->energy()); + + // truth + double dRClosest = 999.9; + double energyClosest = 0; + closestMCParticle(genEvent, *aClus, dRClosest, energyClosest); + + if (dRClosest < 0.1) { + hist_EE_RawSC_EoverTruth_->Fill(aClus->energy() / energyClosest); + hist_EE_RawSC_deltaR_->Fill(dRClosest); + } + } - // truth - double dRClosest = 999.9; - double energyClosest = 0; - closestMCParticle(genEvent, *aClus, dRClosest, energyClosest); + // Do ENDCAP SuperClusters with PRESHOWER + for (reco::SuperClusterCollection::const_iterator aClus = endcapPreSuperClusters->begin(); + aClus != endcapPreSuperClusters->end(); + aClus++) { + hist_EE_PreSC_NumBC_->Fill(aClus->clustersSize()); + hist_EE_PreSC_ET_->Fill(aClus->energy() / std::cosh(aClus->position().eta())); + hist_EE_PreSC_Eta_->Fill(aClus->position().eta()); + hist_EE_PreSC_Phi_->Fill(aClus->position().phi()); + hist_EE_PreSC_preshowerE_->Fill(aClus->preshowerEnergy()); + + const reco::CaloClusterPtr seed = aClus->seed(); + hist_EE_PreSC_S1toS9_->Fill(lazyTool.eMax(*seed) / lazyTool.e3x3(*seed)); + hist_EE_PreSC_S25toE_->Fill(lazyTool.e5x5(*seed) / aClus->energy()); + + // truth + double dRClosest = 999.9; + double energyClosest = 0; + closestMCParticle(genEvent, *aClus, dRClosest, energyClosest); + + if (dRClosest < 0.1) { + hist_EE_PreSC_EoverTruth_->Fill(aClus->energy() / energyClosest); + hist_EE_PreSC_deltaR_->Fill(dRClosest); + } + } - if (dRClosest < 0.1) { - hist_EE_CorSC_EoverTruth_->Fill(aClus->energy() / energyClosest); - hist_EE_CorSC_deltaR_->Fill(dRClosest); + // Do CORRECTED ENDCAP SuperClusters + for (reco::SuperClusterCollection::const_iterator aClus = endcapCorSuperClusters->begin(); + aClus != endcapCorSuperClusters->end(); + aClus++) { + hist_EE_CorSC_NumBC_->Fill(aClus->clustersSize()); + hist_EE_CorSC_ET_->Fill(aClus->energy() / std::cosh(aClus->position().eta())); + hist_EE_CorSC_Eta_->Fill(aClus->position().eta()); + hist_EE_CorSC_Phi_->Fill(aClus->position().phi()); + hist_EE_CorSC_preshowerE_->Fill(aClus->preshowerEnergy()); + + hist_EE_CorSC_ET_vs_Eta_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), aClus->eta()); + hist_EE_CorSC_ET_vs_Phi_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), aClus->phi()); + hist_EE_CorSC_ET_vs_R_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), + std::sqrt(std::pow(aClus->x(), 2) + std::pow(aClus->y(), 2))); + + // correction variables + hist_EE_CorSC_phiWidth_->Fill(aClus->phiWidth()); + hist_EE_CorSC_etaWidth_->Fill(aClus->etaWidth()); + + const reco::CaloClusterPtr seed = aClus->seed(); + hist_EE_CorSC_S1toS9_->Fill(lazyTool.eMax(*seed) / lazyTool.e3x3(*seed)); + hist_EE_CorSC_S25toE_->Fill(lazyTool.e5x5(*seed) / aClus->energy()); + + // truth + double dRClosest = 999.9; + double energyClosest = 0; + closestMCParticle(genEvent, *aClus, dRClosest, energyClosest); + + if (dRClosest < 0.1) { + hist_EE_CorSC_EoverTruth_->Fill(aClus->energy() / energyClosest); + hist_EE_CorSC_deltaR_->Fill(dRClosest); + } } } } diff --git a/Validation/EcalClusters/test/runEgammaAnalyzers_cfg.py b/Validation/EcalClusters/test/runEgammaAnalyzers_cfg.py index 6a1191b3c28db..94207f9b322bb 100644 --- a/Validation/EcalClusters/test/runEgammaAnalyzers_cfg.py +++ b/Validation/EcalClusters/test/runEgammaAnalyzers_cfg.py @@ -8,8 +8,8 @@ process.load("Configuration.StandardSequences.GeometryIdeal_cff") #process.load("Geometry.CaloEventSetup.CaloTopology_cfi") -process.load("Validation.EcalClusters.egammaBCAnalyzer_cfi") -process.load("Validation.EcalClusters.egammaSCAnalyzer_cfi") +process.load("Validation.EcalClusters.egammaBasicClusterAnalyzer_cff") +process.load("Validation.EcalClusters.egammaSuperClusterAnalyzer_cff") process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring( 'file:testfile.root' ) diff --git a/Validation/EcalDigis/python/ecalDigisValidationSequence_cff.py b/Validation/EcalDigis/python/ecalDigisValidationSequence_cff.py index 99cd62759dfde..891111d35670c 100644 --- a/Validation/EcalDigis/python/ecalDigisValidationSequence_cff.py +++ b/Validation/EcalDigis/python/ecalDigisValidationSequence_cff.py @@ -8,3 +8,5 @@ from Validation.EcalDigis.ecalSelectiveReadoutValidation_cfi import * ecalDigisValidationSequence = cms.Sequence(ecalDigisValidation*ecalBarrelDigisValidation*ecalEndcapDigisValidation*ecalPreshowerDigisValidation*ecalSelectiveReadoutValidation) +ecalDigisValidationPhase2 = ecalDigisValidation.clone(EEdigiCollection=cms.InputTag("None"), ESdigiCollection=cms.InputTag("None")) +ecalDigisValidationSequencePhase2 = cms.Sequence(ecalDigisValidationPhase2*ecalBarrelDigisValidation) diff --git a/Validation/EcalHits/python/ecalSimHitsValidationSequence_cff.py b/Validation/EcalHits/python/ecalSimHitsValidationSequence_cff.py index d3f2f61dded17..e5d765e8062b1 100644 --- a/Validation/EcalHits/python/ecalSimHitsValidationSequence_cff.py +++ b/Validation/EcalHits/python/ecalSimHitsValidationSequence_cff.py @@ -7,3 +7,5 @@ from Validation.EcalHits.ecalPreshowerSimHitsValidation_cfi import * ecalSimHitsValidationSequence = cms.Sequence(ecalSimHitsValidation*ecalBarrelSimHitsValidation*ecalEndcapSimHitsValidation*ecalPreshowerSimHitsValidation) +ecalSimHitsValidationPhase2 = ecalSimHitsValidation.clone(EEHitsCollection='', ESHitsCollection='') +ecalSimHitsValidationSequencePhase2 = cms.Sequence(ecalSimHitsValidationPhase2*ecalBarrelSimHitsValidation) diff --git a/Validation/EcalRecHits/interface/EcalRecHitsValidation.h b/Validation/EcalRecHits/interface/EcalRecHitsValidation.h index ad86bdf29d701..160d6b24e4c5f 100644 --- a/Validation/EcalRecHits/interface/EcalRecHitsValidation.h +++ b/Validation/EcalRecHits/interface/EcalRecHitsValidation.h @@ -51,10 +51,11 @@ class EcalRecHitsValidation : public DQMEDAnalyzer { public: /// Constructor EcalRecHitsValidation(const edm::ParameterSet &ps); - /// Destructor ~EcalRecHitsValidation() override; + static void fillDescriptions(edm::ConfigurationDescriptions &); + protected: void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override; /// Analyze @@ -65,32 +66,20 @@ class EcalRecHitsValidation : public DQMEDAnalyzer { void findEndcapMatrix(int nCellInX, int nCellInY, int CentralX, int CentralY, int CentralZ, MapType &themap); private: - std::string HepMCLabel; - std::string hitsProducer_; - - bool verbose_; - - std::string outputFile_; - - edm::InputTag EBrechitCollection_; - edm::InputTag EErechitCollection_; - edm::InputTag ESrechitCollection_; - edm::InputTag EBuncalibrechitCollection_; - edm::InputTag EEuncalibrechitCollection_; - bool enableEndcaps_; - // fix for consumes - edm::EDGetTokenT HepMCLabel_Token_; - edm::EDGetTokenT EBrechitCollection_Token_; - edm::EDGetTokenT EErechitCollection_Token_; - edm::EDGetTokenT ESrechitCollection_Token_; - edm::EDGetTokenT EBuncalibrechitCollection_Token_; - edm::EDGetTokenT EEuncalibrechitCollection_Token_; - edm::EDGetTokenT> EBHits_Token_; - edm::EDGetTokenT> EEHits_Token_; - edm::EDGetTokenT> ESHits_Token_; - edm::ESGetToken pAgc; - edm::ESGetToken pEcsToken; - edm::ESGetToken pttMapToken; + const bool enableEndcaps_; + + const edm::EDGetTokenT HepMCLabel_Token_; + const edm::EDGetTokenT EBrechitCollection_Token_; + const edm::EDGetTokenT EErechitCollection_Token_; + const edm::EDGetTokenT ESrechitCollection_Token_; + const edm::EDGetTokenT EBuncalibrechitCollection_Token_; + const edm::EDGetTokenT EEuncalibrechitCollection_Token_; + const edm::EDGetTokenT> EBHits_Token_; + const edm::EDGetTokenT> EEHits_Token_; + const edm::EDGetTokenT> ESHits_Token_; + const edm::ESGetToken pAgc_; + const edm::ESGetToken pEcsToken_; + const edm::ESGetToken pttMapToken_; MonitorElement *meGunEnergy_; MonitorElement *meGunEta_; @@ -145,7 +134,7 @@ class EcalRecHitsValidation : public DQMEDAnalyzer { MonitorElement *meEERecHitSimHitFlag6_; MonitorElement *meEERecHitSimHitFlag7_; - std::vector crystalMatrix; + std::vector crystalMatrix_; }; #endif diff --git a/Validation/EcalRecHits/python/ecalBarrelRecHitsValidation_cfi.py b/Validation/EcalRecHits/python/ecalBarrelRecHitsValidation_cfi.py index 556b10f731224..962a198e254d0 100644 --- a/Validation/EcalRecHits/python/ecalBarrelRecHitsValidation_cfi.py +++ b/Validation/EcalRecHits/python/ecalBarrelRecHitsValidation_cfi.py @@ -7,5 +7,7 @@ verbose = cms.untracked.bool(False) ) - - +from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel +phase2_ecal_devel.toModify(ecalBarrelRecHitsValidation, + EBuncalibrechitCollection = "ecalUncalibRecHitPhase2:EcalUncalibRecHitsEB" +) diff --git a/Validation/EcalRecHits/python/ecalRecHitsValidationSequence_cff.py b/Validation/EcalRecHits/python/ecalRecHitsValidationSequence_cff.py index 8ec12879e432e..1df3f87e9c4e6 100644 --- a/Validation/EcalRecHits/python/ecalRecHitsValidationSequence_cff.py +++ b/Validation/EcalRecHits/python/ecalRecHitsValidationSequence_cff.py @@ -1,11 +1,18 @@ import FWCore.ParameterSet.Config as cms # Run the complete ECAL rechits validation set -from Validation.EcalRecHits.ecalRecHitsValidation_cfi import * +from Validation.EcalRecHits.ecalRecHitsValidation_cff import * from Validation.EcalRecHits.ecalBarrelRecHitsValidation_cfi import * from Validation.EcalRecHits.ecalEndcapRecHitsValidation_cfi import * from Validation.EcalRecHits.ecalPreshowerRecHitsValidation_cfi import * -ecalRecHitsValidationSequence = cms.Sequence(ecalRecHitsValidation*ecalBarrelRecHitsValidation*ecalEndcapRecHitsValidation*ecalPreshowerRecHitsValidation) +ecalRecHitsValidationSequence = cms.Sequence( + ecalRecHitsValidation* + ecalBarrelRecHitsValidation* + ecalEndcapRecHitsValidation* + ecalPreshowerRecHitsValidation +) -ecalRecHitsValidationPhase2 = ecalRecHitsValidation.clone(enableEndcaps = False) -ecalRecHitsValidationSequencePhase2 = cms.Sequence(ecalRecHitsValidationPhase2*ecalBarrelRecHitsValidation) +ecalRecHitsValidationSequencePhase2 = cms.Sequence( + ecalRecHitsValidationPhase2* + ecalBarrelRecHitsValidation +) diff --git a/Validation/EcalRecHits/python/ecalRecHitsValidation_cff.py b/Validation/EcalRecHits/python/ecalRecHitsValidation_cff.py new file mode 100644 index 0000000000000..628da87d96947 --- /dev/null +++ b/Validation/EcalRecHits/python/ecalRecHitsValidation_cff.py @@ -0,0 +1,14 @@ +import FWCore.ParameterSet.Config as cms + +from Validation.EcalRecHits.ecalRecHitsValidation_cfi import * + +from Configuration.Eras.Modifier_fastSim_cff import fastSim +fastSim.toModify(ecalRecHitsValidation, hitsProducer = "fastSimProducer") + +ecalRecHitsValidationPhase2 = ecalRecHitsValidation.clone( + EBuncalibrechitCollection = "ecalUncalibRecHitPhase2:EcalUncalibRecHitsEB", + EEuncalibrechitCollection = None, + EErechitCollection = None, + ESrechitCollection = None, + enableEndcaps = False +) diff --git a/Validation/EcalRecHits/python/ecalRecHitsValidation_cfi.py b/Validation/EcalRecHits/python/ecalRecHitsValidation_cfi.py deleted file mode 100644 index 88b32937aa83c..0000000000000 --- a/Validation/EcalRecHits/python/ecalRecHitsValidation_cfi.py +++ /dev/null @@ -1,18 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer -ecalRecHitsValidation = DQMEDAnalyzer('EcalRecHitsValidation', - hitsProducer = cms.string('g4SimHits'), - outputFile = cms.untracked.string(''), - EEuncalibrechitCollection = cms.InputTag("ecalMultiFitUncalibRecHit","EcalUncalibRecHitsEE"), - verbose = cms.untracked.bool(False), - EErechitCollection = cms.InputTag("ecalRecHit","EcalRecHitsEE"), - ESrechitCollection = cms.InputTag("ecalPreshowerRecHit","EcalRecHitsES"), - EBuncalibrechitCollection = cms.InputTag("ecalMultiFitUncalibRecHit","EcalUncalibRecHitsEB"), - EBrechitCollection = cms.InputTag("ecalRecHit","EcalRecHitsEB"), - moduleLabelMC = cms.string('generatorSmeared'), - enableEndcaps = cms.untracked.bool(True) -) - -from Configuration.Eras.Modifier_fastSim_cff import fastSim -fastSim.toModify(ecalRecHitsValidation, hitsProducer = "fastSimProducer") diff --git a/Validation/EcalRecHits/python/ecalUnsuppressedRecHitsValidationSequence_cff.py b/Validation/EcalRecHits/python/ecalUnsuppressedRecHitsValidationSequence_cff.py index 203990de58140..8d8ab02aa7ebd 100644 --- a/Validation/EcalRecHits/python/ecalUnsuppressedRecHitsValidationSequence_cff.py +++ b/Validation/EcalRecHits/python/ecalUnsuppressedRecHitsValidationSequence_cff.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms # Run the complete ECAL rechits validation set -from Validation.EcalRecHits.ecalRecHitsValidation_cfi import * +from Validation.EcalRecHits.ecalRecHitsValidation_cff import * from Validation.EcalRecHits.ecalBarrelRecHitsValidation_cfi import * from Validation.EcalRecHits.ecalEndcapRecHitsValidation_cfi import * from Validation.EcalRecHits.ecalPreshowerRecHitsValidation_cfi import * diff --git a/Validation/EcalRecHits/src/EcalRecHitsValidation.cc b/Validation/EcalRecHits/src/EcalRecHitsValidation.cc index 7682e1340b134..a70deaed77dbb 100644 --- a/Validation/EcalRecHits/src/EcalRecHitsValidation.cc +++ b/Validation/EcalRecHits/src/EcalRecHitsValidation.cc @@ -8,6 +8,7 @@ #include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h" #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" #include "DQMServices/Core/interface/DQMStore.h" +#include "FWCore/ParameterSet/interface/EmptyGroupDescription.h" #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include @@ -21,107 +22,109 @@ using namespace edm; using namespace std; EcalRecHitsValidation::EcalRecHitsValidation(const ParameterSet &ps) - : pAgc(esConsumes()), pEcsToken(esConsumes()), pttMapToken(esConsumes()) { - // ---------------------- - HepMCLabel = ps.getParameter("moduleLabelMC"); - hitsProducer_ = ps.getParameter("hitsProducer"); - EBrechitCollection_ = ps.getParameter("EBrechitCollection"); - EErechitCollection_ = ps.getParameter("EErechitCollection"); - ESrechitCollection_ = ps.getParameter("ESrechitCollection"); - EBuncalibrechitCollection_ = ps.getParameter("EBuncalibrechitCollection"); - EEuncalibrechitCollection_ = ps.getParameter("EEuncalibrechitCollection"); - // switch to allow disabling endcaps for phase 2 - enableEndcaps_ = ps.getUntrackedParameter("enableEndcaps", true); - - // fix for consumes - HepMCLabel_Token_ = consumes(ps.getParameter("moduleLabelMC")); - EBrechitCollection_Token_ = consumes(ps.getParameter("EBrechitCollection")); - EBuncalibrechitCollection_Token_ = - consumes(ps.getParameter("EBuncalibrechitCollection")); - - EBHits_Token_ = consumes>( - edm::InputTag(std::string("mix"), ps.getParameter("hitsProducer") + std::string("EcalHitsEB"))); - if (enableEndcaps_) { - EErechitCollection_Token_ = consumes(ps.getParameter("EErechitCollection")); - ESrechitCollection_Token_ = consumes(ps.getParameter("ESrechitCollection")); - EEuncalibrechitCollection_Token_ = - consumes(ps.getParameter("EEuncalibrechitCollection")); - EEHits_Token_ = consumes>( - edm::InputTag(std::string("mix"), ps.getParameter("hitsProducer") + std::string("EcalHitsEE"))); - ESHits_Token_ = consumes>( - edm::InputTag(std::string("mix"), ps.getParameter("hitsProducer") + std::string("EcalHitsES"))); - } - - // ---------------------- - // DQM ROOT output - outputFile_ = ps.getUntrackedParameter("outputFile", ""); - - if (!outputFile_.empty()) { - LogInfo("OutputInfo") << " Ecal RecHits Task histograms will be saved to '" << outputFile_.c_str() << "'"; - } else { - LogInfo("OutputInfo") << " Ecal RecHits Task histograms will NOT be saved"; - } + : enableEndcaps_{ps.getUntrackedParameter("enableEndcaps", true)}, + HepMCLabel_Token_{consumes(ps.getParameter("moduleLabelMC"))}, + EBrechitCollection_Token_{consumes(ps.getParameter("EBrechitCollection"))}, + EErechitCollection_Token_{enableEndcaps_ + ? consumes(ps.getParameter("EErechitCollection")) + : edm::EDGetTokenT{}}, + ESrechitCollection_Token_{enableEndcaps_ + ? consumes(ps.getParameter("ESrechitCollection")) + : edm::EDGetTokenT{}}, + EBuncalibrechitCollection_Token_{ + consumes(ps.getParameter("EBuncalibrechitCollection"))}, + EEuncalibrechitCollection_Token_{enableEndcaps_ ? consumes( + ps.getParameter("EEuncalibrechitCollection")) + : edm::EDGetTokenT{}}, + EBHits_Token_{consumes>( + edm::InputTag(std::string("mix"), ps.getParameter("hitsProducer") + std::string("EcalHitsEB")))}, + EEHits_Token_{enableEndcaps_ ? consumes>(edm::InputTag( + std::string("mix"), + ps.getParameter("hitsProducer") + std::string("EcalHitsEE"))) + : edm::EDGetTokenT>{}}, + ESHits_Token_{enableEndcaps_ ? consumes>(edm::InputTag( + std::string("mix"), + ps.getParameter("hitsProducer") + std::string("EcalHitsES"))) + : edm::EDGetTokenT>{}}, + pAgc_(esConsumes()), + pEcsToken_(esConsumes()), + pttMapToken_(esConsumes()), + meGunEnergy_(nullptr), + meGunEta_(nullptr), + meGunPhi_(nullptr), + meEBRecHitSimHitRatio_(nullptr), + meEERecHitSimHitRatio_(nullptr), + meESRecHitSimHitRatio_(nullptr), + meEBRecHitSimHitRatio1011_(nullptr), + meEERecHitSimHitRatio1011_(nullptr), + meEBRecHitSimHitRatio12_(nullptr), + meEERecHitSimHitRatio12_(nullptr), + meEBRecHitSimHitRatio13_(nullptr), + meEERecHitSimHitRatio13_(nullptr), + meEBRecHitSimHitRatioGt35_(nullptr), + meEERecHitSimHitRatioGt35_(nullptr), + meEBUnRecHitSimHitRatio_(nullptr), + meEEUnRecHitSimHitRatio_(nullptr), + meEBUnRecHitSimHitRatioGt35_(nullptr), + meEEUnRecHitSimHitRatioGt35_(nullptr), + meEBe5x5_(nullptr), + meEBe5x5OverSimHits_(nullptr), + meEBe5x5OverGun_(nullptr), + meEEe5x5_(nullptr), + meEEe5x5OverSimHits_(nullptr), + meEEe5x5OverGun_(nullptr), + + meEBRecHitLog10Energy_(nullptr), + meEERecHitLog10Energy_(nullptr), + meESRecHitLog10Energy_(nullptr), + meEBRecHitLog10EnergyContr_(nullptr), + meEERecHitLog10EnergyContr_(nullptr), + meESRecHitLog10EnergyContr_(nullptr), + meEBRecHitLog10Energy5x5Contr_(nullptr), + meEERecHitLog10Energy5x5Contr_(nullptr), + + meEBRecHitsOccupancyFlag5_6_(nullptr), + meEBRecHitsOccupancyFlag8_9_(nullptr), + meEERecHitsOccupancyPlusFlag5_6_(nullptr), + meEERecHitsOccupancyMinusFlag5_6_(nullptr), + meEERecHitsOccupancyPlusFlag8_9_(nullptr), + meEERecHitsOccupancyMinusFlag8_9_(nullptr), + + meEBRecHitFlags_(nullptr), + meEBRecHitSimHitvsSimHitFlag5_6_(nullptr), + meEBRecHitSimHitFlag6_(nullptr), + meEBRecHitSimHitFlag7_(nullptr), + meEB5x5RecHitSimHitvsSimHitFlag8_(nullptr), + + meEERecHitFlags_(nullptr), + meEERecHitSimHitvsSimHitFlag5_6_(nullptr), + meEERecHitSimHitFlag6_(nullptr), + meEERecHitSimHitFlag7_(nullptr) {} - // ---------------------- - // verbosity switch - verbose_ = ps.getUntrackedParameter("verbose", false); +EcalRecHitsValidation::~EcalRecHitsValidation() {} - // ---------------------- - meGunEnergy_ = nullptr; - meGunEta_ = nullptr; - meGunPhi_ = nullptr; - meEBRecHitSimHitRatio_ = nullptr; - meEERecHitSimHitRatio_ = nullptr; - meESRecHitSimHitRatio_ = nullptr; - meEBRecHitSimHitRatio1011_ = nullptr; - meEERecHitSimHitRatio1011_ = nullptr; - meEBRecHitSimHitRatio12_ = nullptr; - meEERecHitSimHitRatio12_ = nullptr; - meEBRecHitSimHitRatio13_ = nullptr; - meEERecHitSimHitRatio13_ = nullptr; - meEBRecHitSimHitRatioGt35_ = nullptr; - meEERecHitSimHitRatioGt35_ = nullptr; - meEBUnRecHitSimHitRatio_ = nullptr; - meEEUnRecHitSimHitRatio_ = nullptr; - meEBUnRecHitSimHitRatioGt35_ = nullptr; - meEEUnRecHitSimHitRatioGt35_ = nullptr; - meEBe5x5_ = nullptr; - meEBe5x5OverSimHits_ = nullptr; - meEBe5x5OverGun_ = nullptr; - meEEe5x5_ = nullptr; - meEEe5x5OverSimHits_ = nullptr; - meEEe5x5OverGun_ = nullptr; - - meEBRecHitLog10Energy_ = nullptr; - meEERecHitLog10Energy_ = nullptr; - meESRecHitLog10Energy_ = nullptr; - meEBRecHitLog10EnergyContr_ = nullptr; - meEERecHitLog10EnergyContr_ = nullptr; - meESRecHitLog10EnergyContr_ = nullptr; - meEBRecHitLog10Energy5x5Contr_ = nullptr; - meEERecHitLog10Energy5x5Contr_ = nullptr; - - meEBRecHitsOccupancyFlag5_6_ = nullptr; - meEBRecHitsOccupancyFlag8_9_ = nullptr; - meEERecHitsOccupancyPlusFlag5_6_ = nullptr; - meEERecHitsOccupancyMinusFlag5_6_ = nullptr; - meEERecHitsOccupancyPlusFlag8_9_ = nullptr; - meEERecHitsOccupancyMinusFlag8_9_ = nullptr; - - meEBRecHitFlags_ = nullptr; - meEBRecHitSimHitvsSimHitFlag5_6_ = nullptr; - meEBRecHitSimHitFlag6_ = nullptr; - meEBRecHitSimHitFlag7_ = nullptr; - meEB5x5RecHitSimHitvsSimHitFlag8_ = nullptr; - - meEERecHitFlags_ = nullptr; - meEERecHitSimHitvsSimHitFlag5_6_ = nullptr; - meEERecHitSimHitFlag6_ = nullptr; - meEERecHitSimHitFlag7_ = nullptr; +void EcalRecHitsValidation::fillDescriptions(edm::ConfigurationDescriptions &confDesc) { + edm::ParameterSetDescription desc; + + desc.addUntracked("verbose", false); + desc.add("moduleLabelMC", "generatorSmeared"); + desc.add("hitsProducer", "g4SimHits"); + desc.add("EBrechitCollection", edm::InputTag("ecalRecHit", "EcalRecHitsEB")); + desc.add("EBuncalibrechitCollection", + edm::InputTag("ecalMultiFitUncalibRecHit", "EcalUncalibRecHitsEB")); + desc.ifValue(edm::ParameterDescription("enableEndcaps", true, false), + true >> (edm::ParameterDescription( + "EErechitCollection", edm::InputTag("ecalRecHit", "EcalRecHitsEE"), true) and + edm::ParameterDescription( + "ESrechitCollection", edm::InputTag("ecalPreshowerRecHit", "EcalRecHitsES"), true) and + edm::ParameterDescription( + "EEuncalibrechitCollection", + edm::InputTag("ecalMultiFitUncalibRecHit", "EcalUncalibRecHitsEE"), + true)) or + false >> edm::EmptyGroupDescription()); + confDesc.add("ecalRecHitsValidation", desc); } -EcalRecHitsValidation::~EcalRecHitsValidation() {} - void EcalRecHitsValidation::bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) { std::string histo; @@ -295,7 +298,7 @@ void EcalRecHitsValidation::analyze(const Event &e, const EventSetup &c) { LogInfo("EcalRecHitsTask, EventInfo: ") << " Run = " << e.id().run() << " Event = " << e.id().event(); // ADC -> GeV Scale - const EcalADCToGeVConstant *agc = &c.getData(pAgc); + const EcalADCToGeVConstant *agc = &c.getData(pAgc_); const double barrelADCtoGeV_ = agc->getEBValue(); const double endcapADCtoGeV_ = agc->getEEValue(); @@ -470,12 +473,11 @@ void EcalRecHitsValidation::analyze(const Event &e, const EventSetup &c) { } uint16_t sc = 0; - c.getData(pEcsToken); - auto pEcs = c.getHandle(pEcsToken); + auto pEcs = c.getHandle(pEcsToken_); const EcalChannelStatus *ecs = nullptr; if (pEcs.isValid()) - ecs = &c.getData(pEcsToken); - ; + ecs = &c.getData(pEcsToken_); + if (ecs != nullptr) { EcalChannelStatusMap::const_iterator csmi = ecs->find(EBid.rawId()); EcalChannelStatusCode csc = 0; @@ -491,10 +493,10 @@ void EcalRecHitsValidation::analyze(const Event &e, const EventSetup &c) { meEBRecHitSimHitRatio12_->Fill(myRecHit->energy() / ebSimMap[EBid.rawId()]); } - auto pttMap = c.getHandle(pttMapToken); + auto pttMap = c.getHandle(pttMapToken_); const EcalTrigTowerConstituentsMap *ttMap = nullptr; if (pttMap.isValid()) - ttMap = &c.getData(pttMapToken); + ttMap = &c.getData(pttMapToken_); double ttSimEnergy = 0; if (ttMap != nullptr) { EcalTrigTowerDetId ttDetId = EBid.tower(); @@ -541,13 +543,13 @@ void EcalRecHitsValidation::analyze(const Event &e, const EventSetup &c) { findBarrelMatrix(5, 5, bx, by, bz, ebRecMap); double e5x5rec = 0.; double e5x5sim = 0.; - for (unsigned int i = 0; i < crystalMatrix.size(); i++) { - e5x5rec += ebRecMap[crystalMatrix[i]]; - e5x5sim += ebSimMap[crystalMatrix[i]]; - if (ebRecMap[crystalMatrix[i]] > 0) { - int log10i25 = int((log10(ebRecMap[crystalMatrix[i]]) + 5.) * 10.); + for (unsigned int i = 0; i < crystalMatrix_.size(); i++) { + e5x5rec += ebRecMap[crystalMatrix_[i]]; + e5x5sim += ebSimMap[crystalMatrix_[i]]; + if (ebRecMap[crystalMatrix_[i]] > 0) { + int log10i25 = int((log10(ebRecMap[crystalMatrix_[i]]) + 5.) * 10.); if (log10i25 >= 0 && log10i25 < ebcSize) - ebcontr25[log10i25] += ebRecMap[crystalMatrix[i]]; + ebcontr25[log10i25] += ebRecMap[crystalMatrix_[i]]; } } @@ -643,10 +645,10 @@ void EcalRecHitsValidation::analyze(const Event &e, const EventSetup &c) { meEERecHitSimHitRatioGt35_->Fill(myRecHit->energy() / eeSimMap[EEid.rawId()]); } - auto pEcs = c.getHandle(pEcsToken); + auto pEcs = c.getHandle(pEcsToken_); const EcalChannelStatus *ecs = nullptr; if (pEcs.isValid()) - ecs = &c.getData(pEcsToken); + ecs = &c.getData(pEcsToken_); if (ecs != nullptr) { EcalChannelStatusMap::const_iterator csmi = ecs->find(EEid.rawId()); EcalChannelStatusCode csc = 0; @@ -705,13 +707,13 @@ void EcalRecHitsValidation::analyze(const Event &e, const EventSetup &c) { findEndcapMatrix(5, 5, bx, by, bz, eeRecMap); double e5x5rec = 0.; double e5x5sim = 0.; - for (unsigned int i = 0; i < crystalMatrix.size(); i++) { - e5x5rec += eeRecMap[crystalMatrix[i]]; - e5x5sim += eeSimMap[crystalMatrix[i]]; - if (eeRecMap[crystalMatrix[i]] > 0) { - int log10i25 = int((log10(eeRecMap[crystalMatrix[i]]) + 5.) * 10.); + for (unsigned int i = 0; i < crystalMatrix_.size(); i++) { + e5x5rec += eeRecMap[crystalMatrix_[i]]; + e5x5sim += eeSimMap[crystalMatrix_[i]]; + if (eeRecMap[crystalMatrix_[i]] > 0) { + int log10i25 = int((log10(eeRecMap[crystalMatrix_[i]]) + 5.) * 10.); if (log10i25 >= 0 && log10i25 < eecSize) - eecontr25[log10i25] += eeRecMap[crystalMatrix[i]]; + eecontr25[log10i25] += eeRecMap[crystalMatrix_[i]]; } } @@ -811,8 +813,8 @@ void EcalRecHitsValidation::findBarrelMatrix( int goBackInEta = nCellInEta / 2; int goBackInPhi = nCellInPhi / 2; int matrixSize = nCellInEta * nCellInPhi; - crystalMatrix.clear(); - crystalMatrix.resize(matrixSize); + crystalMatrix_.clear(); + crystalMatrix_.resize(matrixSize); int startEta = CentralZ * CentralEta - goBackInEta; int startPhi = CentralPhi - goBackInPhi; @@ -831,7 +833,7 @@ void EcalRecHitsValidation::findBarrelMatrix( } else { index = EBDetId(ieta, iphi).rawId(); } - crystalMatrix[i++] = index; + crystalMatrix_[i++] = index; } } } @@ -840,7 +842,7 @@ void EcalRecHitsValidation::findEndcapMatrix( int nCellInX, int nCellInY, int CentralX, int CentralY, int CentralZ, MapType &themap) { int goBackInX = nCellInX / 2; int goBackInY = nCellInY / 2; - crystalMatrix.clear(); + crystalMatrix_.clear(); int startX = CentralX - goBackInX; int startY = CentralY - goBackInY; @@ -854,7 +856,7 @@ void EcalRecHitsValidation::findEndcapMatrix( } else { continue; } - crystalMatrix.push_back(index); + crystalMatrix_.push_back(index); } } }