CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
CorrectedECALPFClusterProducer Class Reference
Inheritance diagram for CorrectedECALPFClusterProducer:
edm::stream::EDProducer<>

Public Member Functions

 CorrectedECALPFClusterProducer (const edm::ParameterSet &conf)
 
void produce (edm::Event &e, const edm::EventSetup &es) override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

std::unique_ptr< PFClusterEMEnergyCorrector_corrector
 
edm::EDGetTokenT< reco::PFClusterCollection_inputECAL
 
edm::EDGetTokenT< reco::PFClusterCollection_inputPS
 
const double _minimumPSEnergy
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 44 of file CorrectedECALPFClusterProducer.cc.

Constructor & Destructor Documentation

◆ CorrectedECALPFClusterProducer()

CorrectedECALPFClusterProducer::CorrectedECALPFClusterProducer ( const edm::ParameterSet conf)
inline

Definition at line 46 of file CorrectedECALPFClusterProducer.cc.

47  : _minimumPSEnergy(conf.getParameter<double>("minimumPSEnergy")) {
48  const edm::InputTag& inputECAL = conf.getParameter<edm::InputTag>("inputECAL");
49  _inputECAL = consumes<reco::PFClusterCollection>(inputECAL);
50 
51  const edm::InputTag& inputPS = conf.getParameter<edm::InputTag>("inputPS");
52  _inputPS = consumes<reco::PFClusterCollection>(inputPS);
53 
54  const edm::ParameterSet& corConf = conf.getParameterSet("energyCorrector");
55  _corrector = std::make_unique<PFClusterEMEnergyCorrector>(corConf, consumesCollector());
56 
57  produces<reco::PFCluster::EEtoPSAssociation>();
58  produces<reco::PFClusterCollection>();
59  }

References _corrector, _inputECAL, _inputPS, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), HLT_FULL_cff::inputECAL, and HLT_FULL_cff::inputPS.

Member Function Documentation

◆ fillDescriptions()

void CorrectedECALPFClusterProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 127 of file CorrectedECALPFClusterProducer.cc.

127  {
129  desc.add<double>("minimumPSEnergy", 0.0);
130  desc.add<edm::InputTag>("inputPS", edm::InputTag("particleFlowClusterPS"));
131  {
133  psd0.add<bool>("applyCrackCorrections", false);
134  psd0.add<bool>("applyMVACorrections", false);
135  psd0.add<bool>("srfAwareCorrection", false);
136  psd0.add<bool>("setEnergyUncertainty", false);
137  psd0.add<bool>("autoDetectBunchSpacing", true);
138  psd0.add<int>("bunchSpacing", 25);
139  psd0.add<double>("maxPtForMVAEvaluation", -99.);
140  psd0.add<edm::InputTag>("recHitsEBLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
141  psd0.add<edm::InputTag>("recHitsEELabel", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
142  psd0.add<edm::InputTag>("ebSrFlagLabel", edm::InputTag("ecalDigis"));
143  psd0.add<edm::InputTag>("eeSrFlagLabel", edm::InputTag("ecalDigis"));
144  desc.add<edm::ParameterSetDescription>("energyCorrector", psd0);
145  }
146  desc.add<edm::InputTag>("inputECAL", edm::InputTag("particleFlowClusterECALUncorrected"));
147  descriptions.add("particleFlowClusterECAL", desc);
148 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

◆ produce()

void CorrectedECALPFClusterProducer::produce ( edm::Event e,
const edm::EventSetup es 
)
override

Definition at line 73 of file CorrectedECALPFClusterProducer.cc.

73  {
74  auto clusters_out = std::make_unique<reco::PFClusterCollection>();
75  auto association_out = std::make_unique<reco::PFCluster::EEtoPSAssociation>();
76 
78  e.getByToken(_inputECAL, handleECAL);
80  e.getByToken(_inputPS, handlePS);
81 
82  auto const& ecals = *handleECAL;
83  auto const& pss = *handlePS;
84 
85  clusters_out->reserve(ecals.size());
86  association_out->reserve(ecals.size());
87  clusters_out->insert(clusters_out->end(), ecals.begin(), ecals.end());
88  //build the EE->PS association
89  for (unsigned i = 0; i < pss.size(); ++i) {
90  switch (pss[i].layer()) { // just in case this isn't the ES...
91  case PFLayer::PS1:
92  case PFLayer::PS2:
93  break;
94  default:
95  continue;
96  }
97  if (pss[i].energy() < _minimumPSEnergy)
98  continue;
99  int eematch = -1;
100  auto min_dist = std::numeric_limits<double>::max();
101  for (size_t ic = 0; ic < ecals.size(); ++ic) {
102  if (ecals[ic].layer() != PFLayer::ECAL_ENDCAP)
103  continue;
104  auto dist = testPreshowerDistance(ecals[ic], pss[i]);
105  if (dist == -1.0)
107  if (dist < min_dist) {
108  eematch = ic;
109  min_dist = dist;
110  }
111  } // loop on EE clusters
112  if (eematch >= 0) {
113  edm::Ptr<reco::PFCluster> psclus(handlePS, i);
114  association_out->push_back(std::make_pair(eematch, psclus));
115  }
116  }
117  std::sort(association_out->begin(), association_out->end(), sortByKey);
118 
119  _corrector->correctEnergies(e, es, *association_out, *clusters_out);
120 
121  association_out->shrink_to_fit();
122 
123  e.put(std::move(association_out));
124  e.put(std::move(clusters_out));
125 }

References _corrector, _inputECAL, _inputPS, _minimumPSEnergy, MillePedeFileConverter_cfg::e, PFLayer::ECAL_ENDCAP, HCALHighEnergyHPDFilter_cfi::energy, mps_fire::i, phase1PixelTopology::layer, SiStripPI::max, eostools::move(), PFLayer::PS1, PFLayer::PS2, jetUpdater_cfi::sort, and sortByKey().

Member Data Documentation

◆ _corrector

std::unique_ptr<PFClusterEMEnergyCorrector> CorrectedECALPFClusterProducer::_corrector
private

Definition at line 66 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

◆ _inputECAL

edm::EDGetTokenT<reco::PFClusterCollection> CorrectedECALPFClusterProducer::_inputECAL
private

Definition at line 67 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

◆ _inputPS

edm::EDGetTokenT<reco::PFClusterCollection> CorrectedECALPFClusterProducer::_inputPS
private

Definition at line 68 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

◆ _minimumPSEnergy

const double CorrectedECALPFClusterProducer::_minimumPSEnergy
private

Definition at line 65 of file CorrectedECALPFClusterProducer.cc.

Referenced by produce().

mps_fire.i
i
Definition: mps_fire.py:428
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
pss
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:25
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::Handle
Definition: AssociativeIterator.h:50
PFLayer::PS1
Definition: PFLayer.h:31
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
CorrectedECALPFClusterProducer::_inputECAL
edm::EDGetTokenT< reco::PFClusterCollection > _inputECAL
Definition: CorrectedECALPFClusterProducer.cc:67
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
CorrectedECALPFClusterProducer::_corrector
std::unique_ptr< PFClusterEMEnergyCorrector > _corrector
Definition: CorrectedECALPFClusterProducer.cc:66
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
CorrectedECALPFClusterProducer::_inputPS
edm::EDGetTokenT< reco::PFClusterCollection > _inputPS
Definition: CorrectedECALPFClusterProducer.cc:68
HLT_FULL_cff.inputPS
inputPS
Definition: HLT_FULL_cff.py:13397
edm::Ptr< reco::PFCluster >
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
HLT_FULL_cff.inputECAL
inputECAL
Definition: HLT_FULL_cff.py:13400
CorrectedECALPFClusterProducer::_minimumPSEnergy
const double _minimumPSEnergy
Definition: CorrectedECALPFClusterProducer.cc:65
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
sortByKey
bool sortByKey(const EEPSPair &a, const EEPSPair &b)
Definition: PFClusterMatchedToPhotonsSelector.cc:41
PFLayer::ECAL_ENDCAP
Definition: PFLayer.h:32
PFLayer::PS2
Definition: PFLayer.h:30
edm::InputTag
Definition: InputTag.h:15
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2128
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37