CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 53 of file CorrectedECALPFClusterProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 55 of file CorrectedECALPFClusterProducer.cc.

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

55  :
56  _minimumPSEnergy(conf.getParameter<double>("minimumPSEnergy")) {
57  const edm::InputTag& inputECAL =
58  conf.getParameter<edm::InputTag>("inputECAL");
59  _inputECAL = consumes<reco::PFClusterCollection>( inputECAL );
60 
61  const edm::InputTag& inputPS =
62  conf.getParameter<edm::InputTag>("inputPS");
63  _inputPS = consumes<reco::PFClusterCollection>( inputPS );
64 
65  const edm::ParameterSet corConf = conf.getParameterSet("energyCorrector");
67 
68  produces<reco::PFCluster::EEtoPSAssociation>();
69  produces<reco::PFClusterCollection>();
70  }
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 138 of file CorrectedECALPFClusterProducer.cc.

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

138  {
140  desc.add<double>("minimumPSEnergy",0.0);
141  desc.add<edm::InputTag>("inputPS",edm::InputTag("particleFlowClusterPS"));
142  {
144  psd0.add<bool>("applyCrackCorrections",false);
145  psd0.add<bool>("applyMVACorrections",false);
146  psd0.add<std::string>("algoName","PFClusterEMEnergyCorrector");
147  psd0.add<edm::InputTag>("recHitsEBLabel",edm::InputTag("ecalRecHit","EcalRecHitsEB"));
148  psd0.add<edm::InputTag>("recHitsEELabel",edm::InputTag("ecalRecHit","EcalRecHitsEE"));
149  psd0.add<edm::InputTag>("verticesLabel",edm::InputTag("offlinePrimaryVertices"));
150  psd0.add<bool>("autoDetectBunchSpacing",true);
151  psd0.add<int>("bunchSpacing",25);
152  desc.add<edm::ParameterSetDescription>("energyCorrector",psd0);
153  }
154  desc.add<edm::InputTag>("inputECAL",edm::InputTag("particleFlowClusterECALUncorrected"));
155  descriptions.add("particleFlowClusterECAL",desc);
156 }
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

Implements edm::stream::EDProducerBase.

Definition at line 85 of file CorrectedECALPFClusterProducer.cc.

References _corrector, _inputECAL, _inputPS, _minimumPSEnergy, PFLayer::ECAL_ENDCAP, edm::Event::getByToken(), i, edm::Ptr< T >::isNonnull(), edm::Ptr< T >::key(), PFLayer::PS1, PFLayer::PS2, edm::Event::put(), and python.multivaluedict::sort().

85  {
86  std::auto_ptr<reco::PFClusterCollection> clusters_out;
87  clusters_out.reset(new reco::PFClusterCollection);
88  std::auto_ptr<reco::PFCluster::EEtoPSAssociation> association_out;
89  association_out.reset(new reco::PFCluster::EEtoPSAssociation);
90 
92  e.getByToken(_inputECAL,handleECAL);
94  e.getByToken(_inputPS,handlePS);
95 
96  clusters_out->reserve(handleECAL->size());
97  association_out->reserve(handleECAL->size());
98  clusters_out->insert(clusters_out->end(),
99  handleECAL->begin(),handleECAL->end());
100  //build the EE->PS association
101  double dist = -1.0, min_dist = -1.0;
102  for( unsigned i = 0; i < handlePS->size(); ++i ) {
103  switch( handlePS->at(i).layer() ) { // just in case this isn't the ES...
104  case PFLayer::PS1:
105  case PFLayer::PS2:
106  break;
107  default:
108  continue;
109  }
110  edm::Ptr<reco::PFCluster> psclus(handlePS,i);
111  if( psclus->energy() < _minimumPSEnergy ) continue;
112  edm::Ptr<reco::PFCluster> eematch,eeclus;
113  dist = min_dist = -1.0; // reset
114  for( size_t ic = 0; ic < handleECAL->size(); ++ic ) {
115  if( handleECAL->at(ic).layer() != PFLayer::ECAL_ENDCAP ) continue;
116  eeclus = edm::Ptr<reco::PFCluster>(handleECAL,ic);
117  dist = testPreshowerDistance(eeclus,psclus);
118  if( dist == -1.0 || (min_dist != -1.0 && dist > min_dist) ) continue;
119  if( dist < min_dist || min_dist == -1.0 ) {
120  eematch = eeclus;
121  min_dist = dist;
122  }
123  } // loop on EE clusters
124  if( eematch.isNonnull() ) {
125  association_out->push_back(std::make_pair(eematch.key(),psclus));
126  }
127  }
128  std::sort(association_out->begin(),association_out->end(),sortByKey);
129 
130  _corrector->correctEnergies(e,es,*association_out,*clusters_out);
131 
132  association_out->shrink_to_fit();
133 
134  e.put(association_out);
135  e.put(clusters_out);
136 }
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< reco::PFClusterCollection > _inputPS
key_type key() const
Definition: Ptr.h:169
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
std::vector< std::pair< CaloClusterPtr::key_type, edm::Ptr< PFCluster > > > EEtoPSAssociation
Definition: PFCluster.h:50
edm::EDGetTokenT< reco::PFClusterCollection > _inputECAL
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:152
std::unique_ptr< PFClusterEMEnergyCorrector > _corrector
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9

Member Data Documentation

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

Definition at line 77 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

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

Definition at line 78 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

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

Definition at line 79 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

const double CorrectedECALPFClusterProducer::_minimumPSEnergy
private

Definition at line 76 of file CorrectedECALPFClusterProducer.cc.

Referenced by produce().