CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFchsMETcorrInputProducer.cc
Go to the documentation of this file.
2 
6 
8  : moduleLabel_(cfg.getParameter<std::string>("@module_label")),
9  src_(cfg.getParameter<edm::InputTag>("src")),
10  goodVtxNdof_(cfg.getParameter<unsigned int>("goodVtxNdof")),
11  goodVtxZ_(cfg.getParameter<double>("goodVtxZ"))
12 {
13  produces<CorrMETData>("type0");
14 }
15 
17 {
18 
19 }
20 
22 {
24  evt.getByLabel(src_, recVtxs);
25 
26  std::auto_ptr<CorrMETData> chsSum(new CorrMETData());
27 
28  for (unsigned i = 1; i < recVtxs->size(); ++i)
29  {
30  const reco::Vertex& v = recVtxs->at(i);
31  if (v.isFake()) continue;
32  if (v.ndof() < goodVtxNdof_) continue;
33  if (fabs(v.z()) > goodVtxZ_) continue;
34 
35  for (reco::Vertex::trackRef_iterator track = v.tracks_begin(); track != v.tracks_end(); ++track)
36  {
37  if ((*track)->charge() != 0)
38  {
39  chsSum->mex += (*track)->px();
40  chsSum->mey += (*track)->py();
41  chsSum->sumet += (*track)->pt();
42  }
43  }
44  }
45 
46  evt.put(chsSum, "type0");
47 }
48 
50 
int i
Definition: DBlmapReader.cc:9
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:45
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
PFchsMETcorrInputProducer(const edm::ParameterSet &)
double z() const
y coordinate
Definition: Vertex.h:99
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
double ndof() const
Definition: Vertex.h:89
bool isFake() const
Definition: Vertex.h:65
a MET correction term
Definition: CorrMETData.h:14
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:38
void produce(edm::Event &, const edm::EventSetup &)
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:40
mathSSE::Vec4< T > v