CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 52 of file CorrectedECALPFClusterProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 54 of file CorrectedECALPFClusterProducer.cc.

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

54  :
55  _minimumPSEnergy(conf.getParameter<double>("minimumPSEnergy")) {
56  const edm::InputTag& inputECAL =
57  conf.getParameter<edm::InputTag>("inputECAL");
58  _inputECAL = consumes<reco::PFClusterCollection>( inputECAL );
59 
60  const edm::InputTag& inputPS =
61  conf.getParameter<edm::InputTag>("inputPS");
62  _inputPS = consumes<reco::PFClusterCollection>( inputPS );
63 
64  const edm::ParameterSet corConf = conf.getParameterSet("energyCorrector");
65  _corrector.reset(new PFClusterEMEnergyCorrector(corConf));
66 
67  produces<reco::PFCluster::EEtoPSAssociation>();
68  produces<reco::PFClusterCollection>();
69  }
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::produce ( edm::Event e,
const edm::EventSetup es 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 83 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().

83  {
84  std::auto_ptr<reco::PFClusterCollection> clusters_out;
85  clusters_out.reset(new reco::PFClusterCollection);
86  std::auto_ptr<reco::PFCluster::EEtoPSAssociation> association_out;
87  association_out.reset(new reco::PFCluster::EEtoPSAssociation);
88 
90  e.getByToken(_inputECAL,handleECAL);
92  e.getByToken(_inputPS,handlePS);
93 
94  clusters_out->reserve(handleECAL->size());
95  association_out->reserve(handleECAL->size());
96  clusters_out->insert(clusters_out->end(),
97  handleECAL->begin(),handleECAL->end());
98  //build the EE->PS association
99  double dist = -1.0, min_dist = -1.0;
100  for( unsigned i = 0; i < handlePS->size(); ++i ) {
101  switch( handlePS->at(i).layer() ) { // just in case this isn't the ES...
102  case PFLayer::PS1:
103  case PFLayer::PS2:
104  break;
105  default:
106  continue;
107  }
108  edm::Ptr<reco::PFCluster> psclus(handlePS,i);
109  if( psclus->energy() < _minimumPSEnergy ) continue;
110  edm::Ptr<reco::PFCluster> eematch,eeclus;
111  dist = min_dist = -1.0; // reset
112  for( size_t ic = 0; ic < handleECAL->size(); ++ic ) {
113  if( handleECAL->at(ic).layer() != PFLayer::ECAL_ENDCAP ) continue;
114  eeclus = edm::Ptr<reco::PFCluster>(handleECAL,ic);
115  dist = testPreshowerDistance(eeclus,psclus);
116  if( dist == -1.0 || (min_dist != -1.0 && dist > min_dist) ) continue;
117  if( dist < min_dist || min_dist == -1.0 ) {
118  eematch = eeclus;
119  min_dist = dist;
120  }
121  } // loop on EE clusters
122  if( eematch.isNonnull() ) {
123  association_out->push_back(std::make_pair(eematch.key(),psclus));
124  }
125  }
126  std::sort(association_out->begin(),association_out->end(),sortByKey);
127 
128  _corrector->setEEtoPSAssociation(*association_out);
129  _corrector->correctEnergies(*clusters_out);
130 
131  association_out->shrink_to_fit();
132 
133  e.put(association_out);
134  e.put(clusters_out);
135 }
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:446
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 75 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

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

Definition at line 76 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

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

Definition at line 77 of file CorrectedECALPFClusterProducer.cc.

Referenced by CorrectedECALPFClusterProducer(), and produce().

const double CorrectedECALPFClusterProducer::_minimumPSEnergy
private

Definition at line 74 of file CorrectedECALPFClusterProducer.cc.

Referenced by produce().