CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
PFClusterTimeAssigner Class Reference
Inheritance diagram for PFClusterTimeAssigner:
edm::stream::EDProducer<>

Public Member Functions

 PFClusterTimeAssigner (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

edm::EDGetTokenT< reco::PFClusterCollectionclustersTok_
 
edm::EDGetTokenT< edm::ValueMap< float > > timeResosTok_
 
edm::EDGetTokenT< edm::ValueMap< float > > timesTok_
 

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 20 of file PFClusterTimeAssigner.cc.

Constructor & Destructor Documentation

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

Definition at line 22 of file PFClusterTimeAssigner.cc.

References fastPrimaryVertexProducer_cfi::clusters, clustersTok_, MillePedeFileConverter_cfg::e, fillDescriptions(), edm::ParameterSet::getParameter(), produce(), timeResosTok_, create_public_lumi_plots::times, and timesTok_.

22  {
23  const edm::InputTag& clusters =
24  conf.getParameter<edm::InputTag>("src");
25  clustersTok_ = consumes<reco::PFClusterCollection>( clusters );
26 
27  const edm::InputTag& times =
28  conf.getParameter<edm::InputTag>("timeSrc");
29  timesTok_ = consumes<edm::ValueMap<float> >( times );
30 
31  const edm::InputTag& timeResos =
32  conf.getParameter<edm::InputTag>("timeResoSrc");
33  timeResosTok_ = consumes<edm::ValueMap<float> >( timeResos );
34 
35  produces<reco::PFClusterCollection>();
36  }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::ValueMap< float > > timesTok_
edm::EDGetTokenT< edm::ValueMap< float > > timeResosTok_
edm::EDGetTokenT< reco::PFClusterCollection > clustersTok_

Member Function Documentation

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

Definition at line 81 of file PFClusterTimeAssigner.cc.

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

Referenced by PFClusterTimeAssigner().

81  {
83  desc.add<edm::InputTag>("src",edm::InputTag("particleFlowClusterECALUncorrected"));
84  desc.add<edm::InputTag>("timeSrc",edm::InputTag("ecalBarrelClusterFastTimer"));
85  desc.add<edm::InputTag>("timeResoSrc",edm::InputTag("ecalBarrelClusterFastTimer"));
86  descriptions.add("particleFlowClusterTimeAssignerDefault",desc);
87 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void PFClusterTimeAssigner::produce ( edm::Event e,
const edm::EventSetup es 
)
override

Definition at line 50 of file PFClusterTimeAssigner.cc.

References fastPrimaryVertexProducer_cfi::clusters, clustersTok_, edm::Event::getByToken(), mps_fire::i, eostools::move(), MillePedeFileConverter_cfg::out, edm::Event::put(), ntuplemaker::time, timeResosTok_, create_public_lumi_plots::times, and timesTok_.

Referenced by PFClusterTimeAssigner().

50  {
51  auto clusters_out = std::make_unique<reco::PFClusterCollection>();
52 
54  e.getByToken(clustersTok_,clustersH);
55  edm::Handle<edm::ValueMap<float> > timesH, timeResosH;
56  e.getByToken(timesTok_,timesH);
57  e.getByToken(timeResosTok_,timeResosH);
58 
59  auto const & clusters = *clustersH;
60  auto const & times = *timesH;
61  auto const & timeResos = *timeResosH;
62 
63  clusters_out->reserve(clusters.size());
64  clusters_out->insert(clusters_out->end(),
65  clusters.begin(),clusters.end());
66 
67  //build the EE->PS association
68  auto& out = *clusters_out;
69  for( unsigned i = 0; i < out.size(); ++i ) {
70 
71  edm::Ref<reco::PFClusterCollection> clusterRef(clustersH,i);
72  const float time = times[clusterRef];
73  const float timeReso = timeResos[clusterRef];
74  out[i].setTime(time, timeReso);
75 
76  }
77 
78  e.put(std::move(clusters_out));
79 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::EDGetTokenT< edm::ValueMap< float > > timesTok_
edm::EDGetTokenT< edm::ValueMap< float > > timeResosTok_
edm::EDGetTokenT< reco::PFClusterCollection > clustersTok_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::EDGetTokenT<reco::PFClusterCollection> PFClusterTimeAssigner::clustersTok_
private

Definition at line 42 of file PFClusterTimeAssigner.cc.

Referenced by PFClusterTimeAssigner(), and produce().

edm::EDGetTokenT<edm::ValueMap<float> > PFClusterTimeAssigner::timeResosTok_
private

Definition at line 44 of file PFClusterTimeAssigner.cc.

Referenced by PFClusterTimeAssigner(), and produce().

edm::EDGetTokenT<edm::ValueMap<float> > PFClusterTimeAssigner::timesTok_
private

Definition at line 43 of file PFClusterTimeAssigner.cc.

Referenced by PFClusterTimeAssigner(), and produce().