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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CorrectedECALPFClusterProducer (const edm::ParameterSet &conf)
 
virtual void produce (edm::Event &e, const edm::EventSetup &es)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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, edm::EDConsumerBase::consumesCollector(), MillePedeFileConverter_cfg::e, fillDescriptions(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), particleFlowCluster_cff::inputECAL, particleFlowClusterECAL_cfi::inputPS, 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");
56 
57  produces<reco::PFCluster::EEtoPSAssociation>();
58  produces<reco::PFClusterCollection>();
59  }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::PFClusterCollection > _inputPS
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
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<double>("maxPtForMVAEvaluation",-99.);
135  psd0.add<std::string>("algoName","PFClusterEMEnergyCorrector");
136  psd0.add<edm::InputTag>("recHitsEBLabel",edm::InputTag("ecalRecHit","EcalRecHitsEB"));
137  psd0.add<edm::InputTag>("recHitsEELabel",edm::InputTag("ecalRecHit","EcalRecHitsEE"));
138  psd0.add<edm::InputTag>("verticesLabel",edm::InputTag("offlinePrimaryVertices"));
139  psd0.add<bool>("autoDetectBunchSpacing",true);
140  psd0.add<int>("bunchSpacing",25);
141  desc.add<edm::ParameterSetDescription>("energyCorrector",psd0);
142  }
143  desc.add<edm::InputTag>("inputECAL",edm::InputTag("particleFlowClusterECALUncorrected"));
144  descriptions.add("particleFlowClusterECAL",desc);
145 }
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 
)
virtual

Definition at line 74 of file CorrectedECALPFClusterProducer.cc.

References _corrector, _inputECAL, _inputPS, _minimumPSEnergy, PFLayer::ECAL_ENDCAP, edm::Event::getByToken(), mps_fire::i, hpstanc_transforms::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:122
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:460
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:510

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().