CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TtEvent.cc
Go to the documentation of this file.
4 #include <cstring>
5 
6 // find corresponding hypotheses based on JetLepComb
7 int
8 TtEvent::correspondingHypo(const HypoClassKey& key1, const unsigned& hyp1, const HypoClassKey& key2) const
9 {
10  for(unsigned hyp2 = 0; hyp2 < this->numberOfAvailableHypos(key2); ++hyp2) {
11  if( this->jetLeptonCombination(key1, hyp1) == this->jetLeptonCombination(key2, hyp2) )
12  return hyp2;
13  }
14  return -1; // if no corresponding hypothesis was found
15 }
16 
17 // return the corresponding enum value from a string
20 {
21  return (HypoClassKey) StringToEnumValue<HypoClassKey>(label);
22 }
23 
24 // print pt, eta, phi, mass of a given candidate into an existing LogInfo
25 void
26 TtEvent::printParticle(edm::LogInfo &log, const char* name, const reco::Candidate* cand) const
27 {
28  if(!cand) {
29  log << std::setw(15) << name << ": not available!\n";
30  return;
31  }
32  log << std::setprecision(3) << setiosflags(std::ios::fixed | std::ios::showpoint);
33  log << std::setw(15) << name << ": "
34  << std::setw( 7) << cand->pt() << "; "
35  << std::setw( 7) << cand->eta() << "; "
36  << std::setw( 7) << cand->phi() << "; "
37  << resetiosflags(std::ios::fixed | std::ios::showpoint) << setiosflags(std::ios::scientific)
38  << std::setw(10) << cand->mass() << "\n";
39  log << resetiosflags(std::ios::scientific);
40 }
HypoClassKey
supported classes of event hypotheses
Definition: TtEvent.h:31
virtual float mass() const =0
mass
unsigned int numberOfAvailableHypos(const std::string &key) const
return number of available hypotheses within a given hypothesis class
Definition: TtEvent.h:70
virtual float eta() const =0
momentum pseudorapidity
virtual float phi() const =0
momentum azimuthal angle
void printParticle(edm::LogInfo &log, const char *name, const reco::Candidate *cand) const
print pt, eta, phi, mass of a given candidate into an existing LogInfo
Definition: TtEvent.cc:26
virtual float pt() const =0
transverse momentum
HypoClassKey hypoClassKeyFromString(const std::string &label) const
return the corresponding enum value from a string
Definition: TtEvent.cc:19
int correspondingHypo(const std::string &key1, const unsigned &hyp1, const std::string &key2) const
return the hypothesis in hypothesis class &#39;key2&#39;, which corresponds to hypothesis &#39;hyp1&#39; in hypothesi...
Definition: TtEvent.h:102
std::vector< int > jetLeptonCombination(const std::string &key, const unsigned &cmb=0) const
return the vector of jet lepton combinatorics for a given hypothesis and class
Definition: TtEvent.h:78