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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 ( const edm::ParameterSet conf)
inline

Definition at line 44 of file CorrectedECALPFClusterProducer.cc.

References _corrector, _inputECAL, _inputPS, MillePedeFileConverter_cfg::e, fillDescriptions(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), particleFlowCluster_cff::inputECAL, and produce().

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

Member Function Documentation

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

Definition at line 126 of file CorrectedECALPFClusterProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by CorrectedECALPFClusterProducer().

126  {
128  desc.add<double>("minimumPSEnergy",0.0);
129  desc.add<edm::InputTag>("inputPS",edm::InputTag("particleFlowClusterPS"));
130  {
132  psd0.add<bool>("applyCrackCorrections",false);
133  psd0.add<bool>("applyMVACorrections",false);
134  psd0.add<bool>("srfAwareCorrection",false);
135  psd0.add<bool>("setEnergyUncertainty",false);
136  psd0.add<bool>("autoDetectBunchSpacing",true);
137  psd0.add<int>("bunchSpacing",25);
138  psd0.add<double>("maxPtForMVAEvaluation",-99.);
139  psd0.add<std::string>("algoName","PFClusterEMEnergyCorrector");
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>("verticesLabel",edm::InputTag("offlinePrimaryVertices"));
143  psd0.add<edm::InputTag>("ebSrFlagLabel",edm::InputTag("ecalDigis"));
144  psd0.add<edm::InputTag>("eeSrFlagLabel",edm::InputTag("ecalDigis"));
145  desc.add<edm::ParameterSetDescription>("energyCorrector",psd0);
146  }
147  desc.add<edm::InputTag>("inputECAL",edm::InputTag("particleFlowClusterECALUncorrected"));
148  descriptions.add("particleFlowClusterECAL",desc);
149 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void CorrectedECALPFClusterProducer::produce ( edm::Event e,
const edm::EventSetup es 
)
override

Definition at line 74 of file CorrectedECALPFClusterProducer.cc.

References _corrector, _inputECAL, _inputPS, _minimumPSEnergy, PFLayer::ECAL_ENDCAP, edm::Event::getByToken(), mps_fire::i, SiStripPI::max, eostools::move(), PFLayer::PS1, PFLayer::PS2, edm::Event::put(), and sortByKey().

Referenced by CorrectedECALPFClusterProducer().

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

Member Data Documentation

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

Definition at line 66 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

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

Definition at line 67 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

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

Definition at line 68 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

const double CorrectedECALPFClusterProducer::_minimumPSEnergy
private

Definition at line 65 of file CorrectedECALPFClusterProducer.cc.

Referenced by produce().