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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () 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 42 of file CorrectedECALPFClusterProducer.cc.

Constructor & Destructor Documentation

◆ CorrectedECALPFClusterProducer()

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

Definition at line 44 of file CorrectedECALPFClusterProducer.cc.

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

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

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 125 of file CorrectedECALPFClusterProducer.cc.

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

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HLT_2018_cff::InputTag.

◆ produce()

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

Definition at line 71 of file CorrectedECALPFClusterProducer.cc.

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

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

Member Data Documentation

◆ _corrector

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

Definition at line 64 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

◆ _inputECAL

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

Definition at line 65 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

◆ _inputPS

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

Definition at line 66 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

◆ _minimumPSEnergy

const double CorrectedECALPFClusterProducer::_minimumPSEnergy
private

Definition at line 63 of file CorrectedECALPFClusterProducer.cc.

Referenced by produce().

mps_fire.i
i
Definition: mps_fire.py:355
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
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:65
HLT_2018_cff.inputPS
inputPS
Definition: HLT_2018_cff.py:12005
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
CorrectedECALPFClusterProducer::_corrector
std::unique_ptr< PFClusterEMEnergyCorrector > _corrector
Definition: CorrectedECALPFClusterProducer.cc:64
CorrectedECALPFClusterProducer::_inputPS
edm::EDGetTokenT< reco::PFClusterCollection > _inputPS
Definition: CorrectedECALPFClusterProducer.cc:66
edm::Ptr< reco::PFCluster >
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
CorrectedECALPFClusterProducer::_minimumPSEnergy
const double _minimumPSEnergy
Definition: CorrectedECALPFClusterProducer.cc:63
sortByKey
bool sortByKey(const EEPSPair &a, const EEPSPair &b)
Definition: PFClusterMatchedToPhotonsSelector.cc:41
HLT_2018_cff.inputECAL
inputECAL
Definition: HLT_2018_cff.py:12008
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:2121
PFClusterEMEnergyCorrector
Definition: PFClusterEMEnergyCorrector.h:26
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37