CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FlavorHistory.cc
Go to the documentation of this file.
2 
3 using namespace reco;
4 using namespace edm;
5 using namespace std;
6 
8 {
9  flavorSource_ = FLAVOR_NULL;
10 }
11 
13  CandidatePtr const & parton,
14  CandidatePtr const & progenitor,
15  CandidatePtr const & sister,
16  reco::ShallowClonePtrCandidate const & matchedJet,
17  reco::ShallowClonePtrCandidate const & sisterJet ) :
18  flavorSource_(flavorSource),
19  parton_(parton),
20  progenitor_(progenitor),
21  sister_(sister),
22  matchedJet_(matchedJet),
23  sisterJet_(sisterJet)
24 {
25 
26 }
27 
29  Handle<View<Candidate> > h_partons,
30  int parton,
31  int progenitor,
32  int sister,
33  reco::ShallowClonePtrCandidate const & matchedJet,
34  reco::ShallowClonePtrCandidate const & sisterJet ) :
35  flavorSource_(flavorSource),
36  parton_ ( parton >= 0 && static_cast<unsigned int>(parton) < h_partons->size() ? CandidatePtr(h_partons,parton) : CandidatePtr()),
37  progenitor_( progenitor >= 0 && static_cast<unsigned int>(progenitor) < h_partons->size() ? CandidatePtr(h_partons,progenitor) : CandidatePtr()),
38  sister_ ( sister >= 0 && static_cast<unsigned int>(sister) < h_partons->size() ? CandidatePtr(h_partons,sister) : CandidatePtr()),
39  matchedJet_( matchedJet ),
40  sisterJet_ ( sisterJet )
41 {
42 
43 }
44 
47  int parton,
48  int progenitor,
49  int sister,
50  reco::ShallowClonePtrCandidate const & matchedJet,
51  reco::ShallowClonePtrCandidate const & sisterJet ) :
52  flavorSource_(flavorSource),
53  parton_ ( parton >= 0 && static_cast<unsigned int>(parton) < h_partons->size() ? CandidatePtr(h_partons,parton) : CandidatePtr()),
54  progenitor_( progenitor >= 0 && static_cast<unsigned int>(progenitor) < h_partons->size() ? CandidatePtr(h_partons,progenitor) : CandidatePtr()),
55  sister_ ( sister >= 0 && static_cast<unsigned int>(sister) < h_partons->size() ? CandidatePtr(h_partons,sister) : CandidatePtr()),
56  matchedJet_( matchedJet ),
57  sisterJet_ ( sisterJet )
58 {
59 
60 }
61 
62 
63 
64 ostream & operator<<( ostream & out, Candidate const & cand)
65 {
66  char buff[1000];
67  sprintf(buff, "%5d, status = %5d, nmo = %5d, nda = %5d, pt = %6.2f, eta = %6.2f, phi = %6.2f, m = %6.2f",
68  cand.pdgId(), cand.status(),
69  static_cast<int>(cand.numberOfMothers()),
70  static_cast<int>(cand.numberOfDaughters()),
71  cand.pt(), cand.eta(), cand.phi(), cand.mass() );
72  out << buff;
73  return out;
74 }
75 
76 ostream & operator<<( ostream & out, FlavorHistory const & cand)
77 {
78  out << "Source = " << cand.flavorSource() << endl;
79  if ( cand.hasParton() )
80  out << "Parton = " << cand.parton().key() << " : " << *(cand.parton()) << endl;
81  if ( cand.hasProgenitor() )
82  out << "Progenitor = " << cand.progenitor().key() << " : " << *(cand.progenitor()) << endl;
83  if ( cand.hasSister() )
84  out << "Sister = " << cand.sister().key() << " : " << *(cand.sister()) << endl;
85  if ( cand.hasMatchedJet() )
86  out << "jet = " << cand.matchedJet() << endl;
87  if ( cand.hasSisterJet() )
88  out << "sister jet = " << cand.sisterJet() << endl;
89  if ( cand.hasParton() ) {
90  out << "Ancestry: " << endl;
91  Candidate const * ipar = cand.parton()->mother();
92  while ( ipar->numberOfMothers() > 0 ) {
93  out << *ipar << endl;
94  ipar = ipar->mother();
95  }
96  }
97  return out;
98 }
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
key_type key() const
Definition: Ptr.h:169
virtual double pt() const =0
transverse momentum
virtual double mass() const =0
mass
virtual int status() const =0
status word
const reco::ShallowClonePtrCandidate & matchedJet() const
Definition: FlavorHistory.h:99
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
bool hasProgenitor() const
Definition: FlavorHistory.h:92
FLAVOR_T flavorSource() const
Definition: FlavorHistory.h:89
virtual size_type numberOfDaughters() const =0
number of daughters
bool hasParton() const
Definition: FlavorHistory.h:90
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:71
bool hasSisterJet() const
Definition: FlavorHistory.h:94
tuple out
Definition: dbtoconf.py:99
virtual int pdgId() const =0
PDG identifier.
const reco::CandidatePtr & sister() const
Definition: FlavorHistory.h:96
const reco::CandidatePtr & progenitor() const
Definition: FlavorHistory.h:97
const reco::ShallowClonePtrCandidate & sisterJet() const
bool hasSister() const
Definition: FlavorHistory.h:91
tuple size
Write out results.
bool hasMatchedJet() const
Definition: FlavorHistory.h:93
const reco::CandidatePtr & parton() const
Definition: FlavorHistory.h:95
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity