CMS 3D CMS Logo

FlavorHistory.cc
Go to the documentation of this file.
2 
3 using namespace reco;
4 using namespace edm;
5 using namespace std;
6 
7 FlavorHistory::FlavorHistory() { flavorSource_ = FLAVOR_NULL; }
8 
10  CandidatePtr const& parton,
11  CandidatePtr const& progenitor,
12  CandidatePtr const& sister,
13  reco::ShallowClonePtrCandidate const& matchedJet,
14  reco::ShallowClonePtrCandidate const& sisterJet)
15  : flavorSource_(flavorSource),
16  parton_(parton),
17  progenitor_(progenitor),
18  sister_(sister),
19  matchedJet_(matchedJet),
20  sisterJet_(sisterJet) {}
21 
23  Handle<View<Candidate> > h_partons,
24  int parton,
25  int progenitor,
26  int sister,
27  reco::ShallowClonePtrCandidate const& matchedJet,
28  reco::ShallowClonePtrCandidate const& sisterJet)
29  : flavorSource_(flavorSource),
30  parton_(parton >= 0 && static_cast<unsigned int>(parton) < h_partons->size() ? CandidatePtr(h_partons, parton)
31  : CandidatePtr()),
32  progenitor_(progenitor >= 0 && static_cast<unsigned int>(progenitor) < h_partons->size()
33  ? CandidatePtr(h_partons, progenitor)
34  : CandidatePtr()),
35  sister_(sister >= 0 && static_cast<unsigned int>(sister) < h_partons->size() ? CandidatePtr(h_partons, sister)
36  : CandidatePtr()),
37  matchedJet_(matchedJet),
38  sisterJet_(sisterJet) {}
39 
42  int parton,
43  int progenitor,
44  int sister,
45  reco::ShallowClonePtrCandidate const& matchedJet,
46  reco::ShallowClonePtrCandidate const& sisterJet)
47  : flavorSource_(flavorSource),
48  parton_(parton >= 0 && static_cast<unsigned int>(parton) < h_partons->size() ? CandidatePtr(h_partons, parton)
49  : CandidatePtr()),
50  progenitor_(progenitor >= 0 && static_cast<unsigned int>(progenitor) < h_partons->size()
51  ? CandidatePtr(h_partons, progenitor)
52  : CandidatePtr()),
53  sister_(sister >= 0 && static_cast<unsigned int>(sister) < h_partons->size() ? CandidatePtr(h_partons, sister)
54  : CandidatePtr()),
55  matchedJet_(matchedJet),
56  sisterJet_(sisterJet) {}
57 
58 ostream& operator<<(ostream& out, Candidate const& cand) {
59  char buff[1000];
60  sprintf(buff,
61  "%5d, status = %5d, nmo = %5d, nda = %5d, pt = %6.2f, eta = %6.2f, phi = %6.2f, m = %6.2f",
62  cand.pdgId(),
63  cand.status(),
64  static_cast<int>(cand.numberOfMothers()),
65  static_cast<int>(cand.numberOfDaughters()),
66  cand.pt(),
67  cand.eta(),
68  cand.phi(),
69  cand.mass());
70  out << buff;
71  return out;
72 }
73 
74 ostream& operator<<(ostream& out, FlavorHistory const& cand) {
75  out << "Source = " << cand.flavorSource() << endl;
76  if (cand.hasParton())
77  out << "Parton = " << cand.parton().key() << " : " << *(cand.parton()) << endl;
78  if (cand.hasProgenitor())
79  out << "Progenitor = " << cand.progenitor().key() << " : " << *(cand.progenitor()) << endl;
80  if (cand.hasSister())
81  out << "Sister = " << cand.sister().key() << " : " << *(cand.sister()) << endl;
82  if (cand.hasMatchedJet())
83  out << "jet = " << cand.matchedJet() << endl;
84  if (cand.hasSisterJet())
85  out << "sister jet = " << cand.sisterJet() << endl;
86  if (cand.hasParton()) {
87  out << "Ancestry: " << endl;
88  Candidate const* ipar = cand.parton()->mother();
89  while (ipar->numberOfMothers() > 0) {
90  out << *ipar << endl;
91  ipar = ipar->mother();
92  }
93  }
94  return out;
95 }
FlavorHistory.h
reco::FlavorHistory
Definition: FlavorHistory.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::Candidate::mother
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
edm::Handle
Definition: AssociativeIterator.h:50
reco::Candidate::numberOfMothers
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
reco::FlavorHistory::FLAVOR_T
FLAVOR_T
Definition: FlavorHistory.h:47
edm::View
Definition: CaloClusterFwd.h:14
cand
Definition: decayParser.h:32
createfilelist.int
int
Definition: createfilelist.py:10
reco::operator<<
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:66
edm::Ptr< Candidate >
reco::Candidate
Definition: Candidate.h:27
std
Definition: JetResolutionObject.h:76
reco::FlavorHistory::FlavorHistory
FlavorHistory()
Definition: FlavorHistory.cc:7
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
reco::ShallowClonePtrCandidate
Definition: ShallowClonePtrCandidate.h:15
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443