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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

std::unique_ptr< PFClusterEMEnergyCorrectorcorrector_
 
edm::EDGetTokenT< reco::PFClusterCollectioninputECAL_
 
edm::EDGetTokenT< reco::PFClusterCollectioninputPS_
 
const double minimumPSEnergy_
 
const bool skipPS_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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.

References corrector_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), HLT_2023v12_cff::inputECAL, inputECAL_, HLT_2023v12_cff::inputPS, inputPS_, and skipPS_.

47  : minimumPSEnergy_(conf.getParameter<double>("minimumPSEnergy")), skipPS_(conf.getParameter<bool>("skipPS")) {
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  if (!skipPS_)
53  inputPS_ = consumes<reco::PFClusterCollection>(inputPS);
54 
55  const edm::ParameterSet& corConf = conf.getParameterSet("energyCorrector");
56  corrector_ = std::make_unique<PFClusterEMEnergyCorrector>(corConf, consumesCollector());
57 
58  produces<reco::PFCluster::EEtoPSAssociation>();
59  produces<reco::PFClusterCollection>();
60  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::PFClusterCollection > inputECAL_
edm::EDGetTokenT< reco::PFClusterCollection > inputPS_
ParameterSet const & getParameterSet(std::string const &) const
std::unique_ptr< PFClusterEMEnergyCorrector > corrector_

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 133 of file CorrectedECALPFClusterProducer.cc.

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

133  {
135  desc.add<double>("minimumPSEnergy", 0.0);
136  desc.ifValue(
137  edm::ParameterDescription<bool>("skipPS", false, true),
138  true >> (edm::ParameterDescription<edm::InputTag>("inputPS", edm::InputTag(""), true)) or
139  false >> (edm::ParameterDescription<edm::InputTag>("inputPS", edm::InputTag("particleFlowClusterPS"), true)));
140  {
142  psd0.add<bool>("applyCrackCorrections", false);
143  psd0.add<bool>("applyMVACorrections", false);
144  psd0.add<bool>("srfAwareCorrection", false);
145  psd0.add<bool>("setEnergyUncertainty", false);
146  psd0.add<bool>("autoDetectBunchSpacing", true);
147  psd0.add<int>("bunchSpacing", 25);
148  psd0.add<double>("maxPtForMVAEvaluation", -99.);
149  psd0.add<edm::InputTag>("recHitsEBLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
150  psd0.add<edm::InputTag>("recHitsEELabel", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
151  psd0.add<edm::InputTag>("ebSrFlagLabel", edm::InputTag("ecalDigis"));
152  psd0.add<edm::InputTag>("eeSrFlagLabel", edm::InputTag("ecalDigis"));
153  desc.add<edm::ParameterSetDescription>("energyCorrector", psd0);
154  }
155  desc.add<edm::InputTag>("inputECAL", edm::InputTag("particleFlowClusterECALUncorrected"));
156  descriptions.add("particleFlowClusterECAL", desc);
157 }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 75 of file CorrectedECALPFClusterProducer.cc.

References corrector_, MillePedeFileConverter_cfg::e, PFLayer::ECAL_ENDCAP, hcalRecHitTable_cff::energy, mps_fire::i, inputECAL_, inputPS_, nano_mu_digi_cff::layer, SiStripPI::max, minimumPSEnergy_, eostools::move(), PFLayer::PS1, PFLayer::PS2, skipPS_, jetUpdater_cfi::sort, and sortByKey().

75  {
76  auto clusters_out = std::make_unique<reco::PFClusterCollection>();
77  auto association_out = std::make_unique<reco::PFCluster::EEtoPSAssociation>();
78 
80  e.getByToken(inputECAL_, handleECAL);
82  if (!skipPS_)
83  e.getByToken(inputPS_, handlePS);
84 
85  auto const& ecals = *handleECAL;
86 
87  clusters_out->reserve(ecals.size());
88  association_out->reserve(ecals.size());
89  clusters_out->insert(clusters_out->end(), ecals.begin(), ecals.end());
90 
91  //build the EE->PS association
92  if (!skipPS_) {
93  auto const& pss = *handlePS;
94  for (unsigned i = 0; i < pss.size(); ++i) {
95  switch (pss[i].layer()) { // just in case this isn't the ES...
96  case PFLayer::PS1:
97  case PFLayer::PS2:
98  break;
99  default:
100  continue;
101  }
102  if (pss[i].energy() < minimumPSEnergy_)
103  continue;
104  int eematch = -1;
105  auto min_dist = std::numeric_limits<double>::max();
106  for (size_t ic = 0; ic < ecals.size(); ++ic) {
107  if (ecals[ic].layer() != PFLayer::ECAL_ENDCAP)
108  continue;
109  auto dist = testPreshowerDistance(ecals[ic], pss[i]);
110  if (dist == -1.0)
112  if (dist < min_dist) {
113  eematch = ic;
114  min_dist = dist;
115  }
116  } // loop on EE clusters
117  if (eematch >= 0) {
118  edm::Ptr<reco::PFCluster> psclus(handlePS, i);
119  association_out->push_back(std::make_pair(eematch, psclus));
120  }
121  }
122  }
123  std::sort(association_out->begin(), association_out->end(), sortByKey);
124 
125  corrector_->correctEnergies(e, es, *association_out, *clusters_out);
126 
127  association_out->shrink_to_fit();
128 
129  e.put(std::move(association_out));
130  e.put(std::move(clusters_out));
131 }
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:25
edm::EDGetTokenT< reco::PFClusterCollection > inputECAL_
edm::EDGetTokenT< reco::PFClusterCollection > inputPS_
bool sortByKey(const EEPSPair &a, const EEPSPair &b)
std::unique_ptr< PFClusterEMEnergyCorrector > corrector_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ corrector_

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

Definition at line 68 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

◆ inputECAL_

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

Definition at line 69 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

◆ inputPS_

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

Definition at line 70 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

◆ minimumPSEnergy_

const double CorrectedECALPFClusterProducer::minimumPSEnergy_
private

Definition at line 66 of file CorrectedECALPFClusterProducer.cc.

Referenced by produce().

◆ skipPS_

const bool CorrectedECALPFClusterProducer::skipPS_
private

Definition at line 67 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().