CMS 3D CMS Logo

PFchsMETcorrInputProducer.cc
Go to the documentation of this file.
2 
5 
7  : moduleLabel_(cfg.getParameter<std::string>("@module_label")),
8  token_(consumes<reco::VertexCollection>(cfg.getParameter<edm::InputTag>("src"))),
9  goodVtxNdof_(cfg.getParameter<unsigned int>("goodVtxNdof")),
10  goodVtxZ_(cfg.getParameter<double>("goodVtxZ"))
11 {
12  produces<CorrMETData>("type0");
13 }
14 
16 {
17 
18 }
19 
21 {
23  evt.getByToken(token_, recVtxs);
24 
25  std::unique_ptr<CorrMETData> chsSum(new CorrMETData());
26 
27  for (unsigned i = 1; i < recVtxs->size(); ++i)
28  {
29  const reco::Vertex& v = recVtxs->at(i);
30  if (v.isFake()) continue;
31  if (v.ndof() < goodVtxNdof_) continue;
32  if (fabs(v.z()) > goodVtxZ_) continue;
33 
35  {
36  if ((*track)->charge() != 0)
37  {
38  chsSum->mex += (*track)->px();
39  chsSum->mey += (*track)->py();
40  chsSum->sumet += (*track)->pt();
41  }
42  }
43  }
44 
45  evt.put(std::move(chsSum), "type0");
46 }
47 
49 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:81
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
PFchsMETcorrInputProducer(const edm::ParameterSet &)
double z() const
z coordinate
Definition: Vertex.h:115
double ndof() const
Definition: Vertex.h:105
bool isFake() const
Definition: Vertex.h:72
a MET correction term
Definition: CorrMETData.h:14
fixed size matrix
HLT enums.
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:37
edm::EDGetTokenT< reco::VertexCollection > token_
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:76
def move(src, dest)
Definition: eostools.py:511