CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
printParticle.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: AnalysisDataFormats/TopObjects
4 // Class : printParticle
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Christopher Jones
10 // Created: Fri, 16 Oct 2020 13:25:54 GMT
11 //
12 
13 // system include files
14 
15 // user include files
17 
18 namespace ttevent {
19  // print pt, eta, phi, mass of a given candidate into an existing LogInfo
20  void printParticle(edm::LogInfo& log, const char* name, const reco::Candidate* cand) {
21  if (!cand) {
22  log << std::setw(15) << name << ": not available!\n";
23  return;
24  }
25  log << std::setprecision(3) << setiosflags(std::ios::fixed | std::ios::showpoint);
26  log << std::setw(15) << name << ": " << std::setw(7) << cand->pt() << "; " << std::setw(7) << cand->eta() << "; "
27  << std::setw(7) << cand->phi() << "; " << resetiosflags(std::ios::fixed | std::ios::showpoint)
28  << setiosflags(std::ios::scientific) << std::setw(10) << cand->mass() << "\n";
29  log << resetiosflags(std::ios::scientific);
30  }
31 
32 } // namespace ttevent
static std::vector< std::string > checklist log
virtual double pt() const =0
transverse momentum
virtual double mass() const =0
mass
void printParticle(edm::LogInfo &log, const char *name, const reco::Candidate *cand)
print pt, eta, phi, mass of a given candidate into an existing LogInfo
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity