Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

DeepSC algorithm for ECAL SuperClusters #37115

Merged
merged 16 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Configuration/ProcessModifiers/python/ecal_deepsc_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import FWCore.ParameterSet.Config as cms

# This modifier is for ECAL SuperCluster with ML studies

ecal_deepsc = cms.Modifier()

1 change: 1 addition & 0 deletions Configuration/PyReleaseValidation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ The offsets currently in use are:
* 0.13: MLPF algorithm
* 0.15: JME NanoAOD
* 0.17: Run-3 deep core seeding for JetCore iteration
* 0.19: ECAL SuperClustering with DeepSC algorithm
* 0.21: Production-like sequence
* 0.24: 0 Tesla (Run-2, Run-3)
* 0.31: Photon energy corrections with DRN architecture
Expand Down
6 changes: 4 additions & 2 deletions Configuration/PyReleaseValidation/python/relval_2017.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
# (Patatrack HCAL-only: TTbar - on CPU)
# (TTbar 0T, TTbar PU 0T)
# (TTbar FastSim)
# (TTbar PU MLPF)
# (TTbar PU MLPF ecal_deepsc)
# (ZEE ecal_deesc)
# (TTbar PU prod-like)
# (QCD 1.8TeV DeepCore)
# (TTbar DigiNoHLT)
Expand Down Expand Up @@ -71,7 +72,8 @@
11634.521,
11634.24,11834.24,
11634.301,
11834.13,
11834.13, 11834.19,
11846.19,
11834.21,
11723.17,
11634.601,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,35 @@ def condition(self, fragment, stepList, key, hasHarvest):
'--procModifiers': 'mlpf'
}


# ECAL DeepSC clustering studies workflow
class UpgradeWorkflow_ecalclustering(UpgradeWorkflow):
def setup_(self, step, stepName, stepDict, k, properties):
if 'Reco' in step:
stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
def condition(self, fragment, stepList, key, hasHarvest):
return (fragment=="ZEE_14" or fragment=="TTbar_14TeV" or fragment=="WprimeTolNu_M3000_13TeV_pythia8"
or fragment=="DisplacedSUSY_stopToBottom_M_300_1000mm_13" or fragment=="RunEGamma2018D" )

upgradeWFs['ecalDeepSC'] = UpgradeWorkflow_ecalclustering(
steps = [
'Reco',
'RecoNano',
],
PU = [
'Reco',
'RecoNano',
],
suffix = '_ecalDeepSC',
offset = 0.19,
)
upgradeWFs['ecalDeepSC'].step3 = {
'--datatier': 'RECOSIM,MINIAODSIM,NANOAODSIM,DQMIO',
'--eventcontent': 'RECOSIM,MINIAODSIM,NANOEDMAODSIM,DQM',
'--procModifiers': 'ecal_deepsc'
}


# photonDRN workflows
class UpgradeWorkflow_photonDRN(UpgradeWorkflow):
def setup_(self, step, stepName, stepDict, k, properties):
Expand All @@ -543,6 +572,7 @@ def condition(self, fragment, stepList, key, hasHarvest):
'--procModifiers': 'enableSonicTriton,photonDRN'
}


# Patatrack workflows:
# - 2018 conditions, TTbar
# - 2018 conditions, Z->mumu,
Expand Down
8 changes: 7 additions & 1 deletion RecoEcal/EgammaClusterAlgos/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
<use name="FWCore/Framework"/>
<use name="FWCore/Utilities"/>
<use name="FWCore/ParameterSet"/>
<use name="DataFormats/EcalRecHit"/>
<use name="DataFormats/EcalDetId"/>
<use name="DataFormats/CaloRecHit"/>
<use name="DataFormats/EgammaReco"/>
<use name="DataFormats/Math"/>
<use name="DataFormats/ParticleFlowReco"/>
<use name="DataFormats/VertexReco"/>
<use name="DataFormats/BeamSpot"/>
<use name="CommonTools/ParticleFlow"/>
<use name="CondFormats/ESObjects"/>
<use name="CondFormats/GBRForest"/>
<use name="CondFormats/DataRecord"/>
<use name="RecoEcal/EgammaCoreTools"/>
<use name="CondFormats/EcalObjects"/>
<use name="Geometry/CaloGeometry"/>
<use name="Geometry/CaloTopology"/>
<use name="Geometry/Records"/>
<use name="RecoEgamma/EgammaTools"/>
<use name="RecoEcal/EgammaCoreTools"/>
<use name="RecoParticleFlow/PFClusterTools"/>
<use name="HeterogeneousCore/SonicTriton"/>
<use name="clhep"/>
Expand Down
54 changes: 33 additions & 21 deletions RecoEcal/EgammaClusterAlgos/interface/PFECALSuperClusterAlgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,22 @@
#include "DataFormats/EgammaReco/interface/BasicCluster.h"
#include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"

#include "DataFormats/EcalDetId/interface/EBDetId.h"
valsdav marked this conversation as resolved.
Show resolved Hide resolved
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "DataFormats/CaloRecHit/interface/CaloCluster.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"

#include "Geometry/CaloTopology/interface/CaloTopology.h"
#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
#include "Geometry/Records/interface/CaloTopologyRecord.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"

#include "RecoParticleFlow/PFClusterTools/interface/PFEnergyCalibration.h"

#include "RecoEcal/EgammaClusterAlgos/interface/SCEnergyCorrectorSemiParm.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClustersGraph.h"
#include "RecoEcal/EgammaCoreTools/interface/CalibratedPFCluster.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/ESHandle.h"
Expand All @@ -37,6 +48,8 @@
#include "CondFormats/EcalObjects/interface/EcalSCDynamicDPhiParameters.h"
#include "CondFormats/DataRecord/interface/EcalSCDynamicDPhiParametersRcd.h"

#include "RecoEcal/EgammaCoreTools/interface/SCProducerCache.h"

#include <vector>
#include <memory>

Expand All @@ -48,31 +61,16 @@
\date July 2012
*/

typedef std::shared_ptr<CalibratedPFCluster> CalibratedClusterPtr;
typedef std::vector<CalibratedClusterPtr> CalibratedClusterPtrVector;

class PFECALSuperClusterAlgo {
public:
enum clustering_type { kBOX = 1, kMustache = 2 };
enum clustering_type { kBOX = 1, kMustache = 2, kDeepSC = 3 };
enum energy_weight { kRaw, kCalibratedNoPS, kCalibratedTotal };

// simple class for associating calibrated energies
class CalibratedPFCluster {
public:
CalibratedPFCluster(const edm::Ptr<reco::PFCluster>& p) : cluptr(p) {}

double energy() const { return cluptr->correctedEnergy(); }
double energy_nocalib() const { return cluptr->energy(); }
double eta() const { return cluptr->positionREP().eta(); }
double phi() const { return cluptr->positionREP().phi(); }

edm::Ptr<reco::PFCluster> the_ptr() const { return cluptr; }

private:
edm::Ptr<reco::PFCluster> cluptr;
};
typedef std::shared_ptr<CalibratedPFCluster> CalibratedClusterPtr;
typedef std::vector<CalibratedClusterPtr> CalibratedClusterPtrVector;

/// constructor
PFECALSuperClusterAlgo();
PFECALSuperClusterAlgo(const reco::SCProducerCache* cache);

void setVerbosityLevel(bool verbose) { verbose_ = verbose; }

Expand Down Expand Up @@ -110,6 +108,7 @@ class PFECALSuperClusterAlgo {
void setCrackCorrections(bool applyCrackCorrections) { applyCrackCorrections_ = applyCrackCorrections; }

void setTokens(const edm::ParameterSet&, edm::ConsumesCollector&&);

void update(const edm::EventSetup&);
void updateSCParams(const edm::EventSetup&);

Expand All @@ -129,9 +128,17 @@ class PFECALSuperClusterAlgo {
edm::ESGetToken<ESChannelStatus, ESChannelStatusRcd> esChannelStatusToken_;
edm::ESGetToken<EcalMustacheSCParameters, EcalMustacheSCParametersRcd> ecalMustacheSCParametersToken_;
edm::ESGetToken<EcalSCDynamicDPhiParameters, EcalSCDynamicDPhiParametersRcd> ecalSCDynamicDPhiParametersToken_;
edm::ESGetToken<CaloTopology, CaloTopologyRecord> caloTopologyToken_;
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometryToken_;

const reco::BeamSpot* beamSpot_;
const ESChannelStatus* channelStatus_;
const CaloGeometry* geometry_;
const CaloSubdetectorGeometry* ebGeom_;
const CaloSubdetectorGeometry* eeGeom_;
const CaloSubdetectorGeometry* esGeom_;
const CaloTopology* topology_;

const EcalMustacheSCParameters* mustacheSCParams_;
const EcalSCDynamicDPhiParameters* scDynamicDPhiParams_;

Expand All @@ -144,7 +151,10 @@ class PFECALSuperClusterAlgo {
clustering_type _clustype;
energy_weight _eweight;
void buildAllSuperClusters(CalibratedClusterPtrVector&, double seedthresh);
void buildSuperCluster(CalibratedClusterPtr&, CalibratedClusterPtrVector&);
void buildAllSuperClustersMustache(CalibratedClusterPtrVector&, double seedthresh);
void buildAllSuperClustersDeepSC(CalibratedClusterPtrVector&, double seedthresh);
void buildSuperClusterMustache(CalibratedClusterPtr&, CalibratedClusterPtrVector&);
void finalizeSuperCluster(CalibratedClusterPtr& seed, CalibratedClusterPtrVector& clustered, bool isEE);

bool verbose_;

Expand Down Expand Up @@ -173,6 +183,8 @@ class PFECALSuperClusterAlgo {
bool applyCrackCorrections_;
bool threshIsET_;

const reco::SCProducerCache* SCProducerCache_;

// OOT photons
bool isOOTCollection_;
edm::EDGetTokenT<EcalRecHitCollection> inputTagBarrelRecHits_;
Expand Down
Loading