test
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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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
 
- 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(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), HLT_25ns10e33_v2_cff::inputECAL, and HLT_25ns10e33_v2_cff::inputPS.

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(), HLT_25ns10e33_v2_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Implements edm::stream::EDProducerBase.

Definition at line 74 of file CorrectedECALPFClusterProducer.cc.

References _corrector, _inputECAL, _inputPS, _minimumPSEnergy, PFLayer::ECAL_ENDCAP, relval_parameters_module::energy, edm::Event::getByToken(), i, bookConverter::max, eostools::move(), PFLayer::PS1, PFLayer::PS2, and edm::Event::put().

74  {
75  std::unique_ptr<reco::PFClusterCollection> clusters_out(new reco::PFClusterCollection);
76  std::unique_ptr<reco::PFCluster::EEtoPSAssociation> association_out(new 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 }
int i
Definition: DBlmapReader.cc:9
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:462
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
def move
Definition: eostools.py:510
std::vector< std::pair< CaloClusterPtr::key_type, edm::Ptr< PFCluster > > > EEtoPSAssociation
Definition: PFCluster.h:50
edm::EDGetTokenT< reco::PFClusterCollection > _inputECAL
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 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().