CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFClusterTimeAssigner.cc
Go to the documentation of this file.
1 #ifndef __PFClusterTimeAssigner__
2 #define __PFClusterTimeAssigner__
3 
4 // user include files
7 
13 
16 
18 
19 
21 public:
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  produces<reco::PFClusterCollection>();
32  }
33 
34  virtual void produce(edm::Event& e, const edm::EventSetup& es);
35  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
36 
37 private:
40 };
41 
43 
46  auto clusters_out = std::make_unique<reco::PFClusterCollection>();
47 
49  e.getByToken(clustersTok_,clustersH);
51  e.getByToken(timesTok_,timesH);
52 
53  auto const & clusters = *clustersH;
54  auto const & times = *timesH;
55 
56  clusters_out->reserve(clusters.size());
57  clusters_out->insert(clusters_out->end(),
58  clusters.begin(),clusters.end());
59 
60  //build the EE->PS association
61  auto& out = *clusters_out;
62  for( unsigned i = 0; i < out.size(); ++i ) {
63 
64  edm::Ref<reco::PFClusterCollection> clusterRef(clustersH,i);
65  const float time = times[clusterRef];
66  out[i].setTime(time);
67 
68  }
69 
70  e.put(std::move(clusters_out));
71 }
72 
75  desc.add<edm::InputTag>("src",edm::InputTag("particleFlowClusterECALUncorrected"));
76  desc.add<edm::InputTag>("timeSrc",edm::InputTag("ecalBarrelClusterFastTimer"));
77  descriptions.add("particleFlowClusterTimeAssignerDefault",desc);
78 }
79 
80 #endif
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
PFClusterTimeAssigner(const edm::ParameterSet &conf)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< edm::ValueMap< float > > timesTok_
def move
Definition: eostools.py:510
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual void produce(edm::Event &e, const edm::EventSetup &es)
edm::EDGetTokenT< reco::PFClusterCollection > clustersTok_