CMS 3D CMS Logo

PFClusterTimeAssigner.cc
Go to the documentation of this file.
1 #ifndef __PFClusterTimeAssigner__
2 #define __PFClusterTimeAssigner__
3 
4 // user include files
7 
13 
16 
18 
20 public:
22  const edm::InputTag& clusters = conf.getParameter<edm::InputTag>("src");
23  clustersTok_ = consumes<reco::PFClusterCollection>(clusters);
24 
25  const edm::InputTag& times = conf.getParameter<edm::InputTag>("timeSrc");
26  timesTok_ = consumes<edm::ValueMap<float> >(times);
27 
28  const edm::InputTag& timeResos = conf.getParameter<edm::InputTag>("timeResoSrc");
29  timeResosTok_ = consumes<edm::ValueMap<float> >(timeResos);
30 
31  produces<reco::PFClusterCollection>();
32  }
33 
34  void produce(edm::Event& e, const edm::EventSetup& es) override;
35  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
36 
37 private:
41 };
42 
44 
46  auto clusters_out = std::make_unique<reco::PFClusterCollection>();
47 
49  e.getByToken(clustersTok_, clustersH);
50  edm::Handle<edm::ValueMap<float> > timesH, timeResosH;
51  e.getByToken(timesTok_, timesH);
52  e.getByToken(timeResosTok_, timeResosH);
53 
54  auto const& clusters = *clustersH;
55  auto const& times = *timesH;
56  auto const& timeResos = *timeResosH;
57 
58  clusters_out->reserve(clusters.size());
59  clusters_out->insert(clusters_out->end(), clusters.begin(), clusters.end());
60 
61  //build the EE->PS association
62  auto& out = *clusters_out;
63  for (unsigned i = 0; i < out.size(); ++i) {
64  edm::Ref<reco::PFClusterCollection> clusterRef(clustersH, i);
65  const float time = times[clusterRef];
66  const float timeReso = timeResos[clusterRef];
67  out[i].setTime(time, timeReso);
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  desc.add<edm::InputTag>("timeResoSrc", edm::InputTag("ecalBarrelClusterFastTimer"));
78  descriptions.add("particleFlowClusterTimeAssignerDefault", desc);
79 }
80 
81 #endif
ConfigurationDescriptions.h
mps_fire.i
i
Definition: mps_fire.py:428
PFClusterTimeAssigner::timesTok_
edm::EDGetTokenT< edm::ValueMap< float > > timesTok_
Definition: PFClusterTimeAssigner.cc:39
edm::EDGetTokenT< reco::PFClusterCollection >
PFClusterTimeAssigner
Definition: PFClusterTimeAssigner.cc:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDProducer.h
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref
Definition: AssociativeIterator.h:58
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
PFCluster.h
PFClusterTimeAssigner::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: PFClusterTimeAssigner.cc:73
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
edm::ParameterSet
Definition: ParameterSet.h:47
PFClusterTimeAssigner::produce
void produce(edm::Event &e, const edm::EventSetup &es) override
Definition: PFClusterTimeAssigner.cc:45
Event.h
PFClusterTimeAssigner::clustersTok_
edm::EDGetTokenT< reco::PFClusterCollection > clustersTok_
Definition: PFClusterTimeAssigner.cc:38
PFClusterFwd.h
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:57
ValueMap.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
Frameworkfwd.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
ParameterSet.h
ntuplemaker.time
time
Definition: ntuplemaker.py:310
edm::Event
Definition: Event.h:73
PFClusterTimeAssigner::PFClusterTimeAssigner
PFClusterTimeAssigner(const edm::ParameterSet &conf)
Definition: PFClusterTimeAssigner.cc:21
edm::InputTag
Definition: InputTag.h:15
PFClusterTimeAssigner::timeResosTok_
edm::EDGetTokenT< edm::ValueMap< float > > timeResosTok_
Definition: PFClusterTimeAssigner.cc:40
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37