CMS 3D CMS Logo

TtEvent.h
Go to the documentation of this file.
1 #ifndef TopObjects_TtEvent_h
2 #define TopObjects_TtEvent_h
3 
4 #include <vector>
5 #include <string>
6 
11 
23 namespace edm {
24  class LogInfo;
25 }
26 
27 class TtEvent {
28 public:
30  enum HypoClassKey {
40  };
42  typedef std::pair<reco::CompositeCandidate, std::vector<int> > HypoCombPair;
45  const char* label;
47  };
48 
49 protected:
52 
53 public:
55  TtEvent(){};
57  virtual ~TtEvent(){};
58 
60  std::pair<WDecay::LeptonType, WDecay::LeptonType> lepDecays() const { return lepDecays_; }
63  const reco::CompositeCandidate& eventHypo(const HypoClassKey& key, const unsigned& cmb = 0) const {
64  return (evtHyp_.find(key)->second)[cmb].first;
65  };
67  const edm::RefProd<TtGenEvent>& genEvent() const { return genEvt_; };
68 
72  bool isHypoClassAvailable(const HypoClassKey& key) const { return (evtHyp_.find(key) != evtHyp_.end()); };
73  // check if hypothesis 'cmb' is available within the hypothesis class
74  bool isHypoAvailable(const std::string& key, const unsigned& cmb = 0) const {
76  };
78  bool isHypoAvailable(const HypoClassKey& key, const unsigned& cmb = 0) const {
79  return isHypoClassAvailable(key) ? (cmb < evtHyp_.find(key)->second.size()) : false;
80  };
82  bool isHypoValid(const std::string& key, const unsigned& cmb = 0) const {
84  };
86  bool isHypoValid(const HypoClassKey& key, const unsigned& cmb = 0) const {
87  return isHypoAvailable(key, cmb) ? !eventHypo(key, cmb).roles().empty() : false;
88  };
90  unsigned int numberOfAvailableHypoClasses() const { return evtHyp_.size(); };
92  unsigned int numberOfAvailableHypos(const std::string& key) const {
94  };
96  unsigned int numberOfAvailableHypos(const HypoClassKey& key) const {
97  return isHypoAvailable(key) ? evtHyp_.find(key)->second.size() : 0;
98  };
102  };
105  return (isHypoAvailable(key) ? nJetsConsidered_.find(key)->second : -1);
106  };
108  std::vector<int> jetLeptonCombination(const std::string& key, const unsigned& cmb = 0) const {
110  };
112  std::vector<int> jetLeptonCombination(const HypoClassKey& key, const unsigned& cmb = 0) const {
113  return (evtHyp_.find(key)->second)[cmb].second;
114  };
116  double genMatchSumPt(const unsigned& cmb = 0) const {
117  return (cmb < genMatchSumPt_.size() ? genMatchSumPt_[cmb] : -1.);
118  };
120  double genMatchSumDR(const unsigned& cmb = 0) const {
121  return (cmb < genMatchSumDR_.size() ? genMatchSumDR_[cmb] : -1.);
122  };
124  std::string mvaMethod() const { return mvaMethod_; }
126  double mvaDisc(const unsigned& cmb = 0) const { return (cmb < mvaDisc_.size() ? mvaDisc_[cmb] : -1.); }
128  double fitChi2(const unsigned& cmb = 0) const { return (cmb < fitChi2_.size() ? fitChi2_[cmb] : -1.); }
130  double hitFitChi2(const unsigned& cmb = 0) const { return (cmb < hitFitChi2_.size() ? hitFitChi2_[cmb] : -1.); }
132  double fitProb(const unsigned& cmb = 0) const { return (cmb < fitProb_.size() ? fitProb_[cmb] : -1.); }
134  double hitFitProb(const unsigned& cmb = 0) const { return (cmb < hitFitProb_.size() ? hitFitProb_[cmb] : -1.); }
136  double hitFitMT(const unsigned& cmb = 0) const { return (cmb < hitFitMT_.size() ? hitFitMT_[cmb] : -1.); }
138  double hitFitSigMT(const unsigned& cmb = 0) const { return (cmb < hitFitSigMT_.size() ? hitFitSigMT_[cmb] : -1.); }
140  int correspondingHypo(const std::string& key1, const unsigned& hyp1, const std::string& key2) const {
142  };
144  int correspondingHypo(const HypoClassKey& key1, const unsigned& hyp1, const HypoClassKey& key2) const;
145 
147  const reco::Candidate* topPair(const std::string& key, const unsigned& cmb = 0) const {
148  return topPair(hypoClassKeyFromString(key), cmb);
149  };
151  const reco::Candidate* topPair(const HypoClassKey& key, const unsigned& cmb = 0) const {
152  return !isHypoValid(key, cmb) ? nullptr : (reco::Candidate*)&eventHypo(key, cmb);
153  };
155  const math::XYZTLorentzVector* topPair() const { return (!genEvt_ ? nullptr : this->genEvent()->topPair()); };
156 
158  void printParticle(edm::LogInfo& log, const char* name, const reco::Candidate* cand) const;
159 
161  void setLepDecays(const WDecay::LeptonType& lepDecTop1, const WDecay::LeptonType& lepDecTop2) {
162  lepDecays_ = std::make_pair(lepDecTop1, lepDecTop2);
163  };
167  void addEventHypo(const HypoClassKey& key, const HypoCombPair& hyp) { evtHyp_[key].push_back(hyp); };
169  void setNumberOfConsideredJets(const HypoClassKey& key, const unsigned int nJets) { nJetsConsidered_[key] = nJets; };
171  void setGenMatchSumPt(const std::vector<double>& val) { genMatchSumPt_ = val; };
173  void setGenMatchSumDR(const std::vector<double>& val) { genMatchSumDR_ = val; };
177  void setMvaDiscriminators(const std::vector<double>& val) { mvaDisc_ = val; };
179  void setFitChi2(const std::vector<double>& val) { fitChi2_ = val; };
181  void setHitFitChi2(const std::vector<double>& val) { hitFitChi2_ = val; };
183  void setFitProb(const std::vector<double>& val) { fitProb_ = val; };
185  void setHitFitProb(const std::vector<double>& val) { hitFitProb_ = val; };
187  void setHitFitMT(const std::vector<double>& val) { hitFitMT_ = val; };
189  void setHitFitSigMT(const std::vector<double>& val) { hitFitSigMT_ = val; };
190 
191 protected:
193  std::pair<WDecay::LeptonType, WDecay::LeptonType> lepDecays_;
198  std::map<HypoClassKey, std::vector<HypoCombPair> > evtHyp_;
200  std::map<HypoClassKey, int> nJetsConsidered_;
201 
203  std::vector<double> fitChi2_;
204  std::vector<double> hitFitChi2_;
206  std::vector<double> fitProb_;
207  std::vector<double> hitFitProb_;
209  std::vector<double> hitFitMT_;
210  std::vector<double> hitFitSigMT_;
212  std::vector<double> genMatchSumPt_;
214  std::vector<double> genMatchSumDR_;
218  std::vector<double> mvaDisc_;
219 };
220 
221 #endif
TtEvent::setHitFitMT
void setHitFitMT(const std::vector< double > &val)
set fitted top mass of kHitFit hypothesis
Definition: TtEvent.h:187
edm::RefProd< TtGenEvent >
TtEvent::kWMassMaxSumPt
Definition: TtEvent.h:32
RefProd.h
TtEvent::mvaDisc_
std::vector< double > mvaDisc_
MVA discriminants.
Definition: TtEvent.h:218
TtEvent::setGenMatchSumDR
void setGenMatchSumDR(const std::vector< double > &val)
set sum dr of kGenMatch hypothesis
Definition: TtEvent.h:173
TtEvent::genEvt_
edm::RefProd< TtGenEvent > genEvt_
reference to TtGenEvent (has to be kept in the event!)
Definition: TtEvent.h:195
Handle.h
TtEvent::isHypoClassAvailable
bool isHypoClassAvailable(const HypoClassKey &key) const
check if hypothesis class 'key' was added to the event structure
Definition: TtEvent.h:72
TtEvent::hitFitSigMT
double hitFitSigMT(const unsigned &cmb=0) const
return the hitfit top mass uncertainty of hypothesis 'cmb' if available; -1 else
Definition: TtEvent.h:138
TtEvent::lepDecays
std::pair< WDecay::LeptonType, WDecay::LeptonType > lepDecays() const
get leptonic decay channels
Definition: TtEvent.h:60
CompositeCandidate.h
TtEvent::hitFitSigMT_
std::vector< double > hitFitSigMT_
Definition: TtEvent.h:210
TtEvent::addEventHypo
void addEventHypo(const HypoClassKey &key, const HypoCombPair &hyp)
add new hypotheses
Definition: TtEvent.h:167
TtEvent::isHypoValid
bool isHypoValid(const std::string &key, const unsigned &cmb=0) const
check if hypothesis 'cmb' within the hypothesis class was valid; if not it lead to an empty Composite...
Definition: TtEvent.h:82
TtEvent::setFitProb
void setFitProb(const std::vector< double > &val)
set fit probability of kKinFit hypothesis
Definition: TtEvent.h:183
TtEvent::~TtEvent
virtual ~TtEvent()
default destructor
Definition: TtEvent.h:57
TtEvent::isHypoAvailable
bool isHypoAvailable(const std::string &key, const unsigned &cmb=0) const
Definition: TtEvent.h:74
TtEvent::mvaMethod_
std::string mvaMethod_
label of the MVA method
Definition: TtEvent.h:216
TtEvent::numberOfConsideredJets
int numberOfConsideredJets(const std::string &key) const
return number of jets that were considered when building a given hypothesis
Definition: TtEvent.h:100
TtEvent::TtEvent
TtEvent()
empty constructor
Definition: TtEvent.h:55
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::LogInfo
Definition: MessageLogger.h:254
TtEvent::evtHyp_
std::map< HypoClassKey, std::vector< HypoCombPair > > evtHyp_
Definition: TtEvent.h:198
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
TtEvent::printParticle
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:21
TtEvent::HypoCombPair
std::pair< reco::CompositeCandidate, std::vector< int > > HypoCombPair
pair of hypothesis and lepton jet combinatorics for a given hypothesis
Definition: TtEvent.h:42
TtEvent::jetLeptonCombination
std::vector< int > jetLeptonCombination(const HypoClassKey &key, const unsigned &cmb=0) const
return the vector of jet lepton combinatorics for a given hypothesis and class
Definition: TtEvent.h:112
TtEvent::genMatchSumDR
double genMatchSumDR(const unsigned &cmb=0) const
return the sum dr of the generator match if available; -1 else
Definition: TtEvent.h:120
TtEvent::kKinFit
Definition: TtEvent.h:36
TtEvent::hitFitMT
double hitFitMT(const unsigned &cmb=0) const
return the hitfit top mass of hypothesis 'cmb' if available; -1 else
Definition: TtEvent.h:136
TtEvent::fitChi2
double fitChi2(const unsigned &cmb=0) const
return the chi2 of the kinematic fit of hypothesis 'cmb' if available; -1 else
Definition: TtEvent.h:128
TtEvent::fitProb
double fitProb(const unsigned &cmb=0) const
return the fit probability of hypothesis 'cmb' if available; -1 else
Definition: TtEvent.h:132
edm::Handle
Definition: AssociativeIterator.h:50
dqmdumpme.first
first
Definition: dqmdumpme.py:55
TtEvent::jetLeptonCombination
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:108
TtEvent::hitFitProb_
std::vector< double > hitFitProb_
Definition: TtEvent.h:207
TtEvent::eventHypo
const reco::CompositeCandidate & eventHypo(const HypoClassKey &key, const unsigned &cmb=0) const
Definition: TtEvent.h:63
TtEvent::numberOfAvailableHypos
unsigned int numberOfAvailableHypos(const std::string &key) const
return number of available hypotheses within a given hypothesis class
Definition: TtEvent.h:92
TtEvent::HypoClassKeyStringToEnum::label
const char * label
Definition: TtEvent.h:45
TtEvent::isHypoClassAvailable
bool isHypoClassAvailable(const std::string &key) const
check if hypothesis class 'key' was added to the event structure
Definition: TtEvent.h:70
TtEvent
Base class to hold information for ttbar event interpretation.
Definition: TtEvent.h:27
TtEvent::fitProb_
std::vector< double > fitProb_
result of kinematic fit
Definition: TtEvent.h:206
TtEvent::genMatchSumPt_
std::vector< double > genMatchSumPt_
result of gen match
Definition: TtEvent.h:212
TtEvent::numberOfAvailableHypos
unsigned int numberOfAvailableHypos(const HypoClassKey &key) const
return number of available hypotheses within a given hypothesis class
Definition: TtEvent.h:96
TtEvent::mvaDisc
double mvaDisc(const unsigned &cmb=0) const
return the mva discriminant value of hypothesis 'cmb' if available; -1 else
Definition: TtEvent.h:126
TtEvent::genEvent
const edm::RefProd< TtGenEvent > & genEvent() const
get TtGenEvent
Definition: TtEvent.h:67
TtEvent::setNumberOfConsideredJets
void setNumberOfConsideredJets(const HypoClassKey &key, const unsigned int nJets)
set number of jets considered when building a given hypothesis
Definition: TtEvent.h:169
TtEvent::setGenEvent
void setGenEvent(const edm::Handle< TtGenEvent > &evt)
set TtGenEvent
Definition: TtEvent.h:165
TtEvent::setHitFitProb
void setHitFitProb(const std::vector< double > &val)
set fit probability of kHitFit hypothesis
Definition: TtEvent.h:185
TtEvent::hitFitChi2_
std::vector< double > hitFitChi2_
Definition: TtEvent.h:204
reco::CompositeCandidate::roles
role_collection const & roles() const
get the roles
Definition: CompositeCandidate.h:49
TtEvent::hypoClassKeyFromString
HypoClassKey hypoClassKeyFromString(const std::string &label) const
return the corresponding enum value from a string
Definition: TtEvent.cc:16
TtEvent::kMVADisc
Definition: TtEvent.h:35
TtEvent::hitFitMT_
std::vector< double > hitFitMT_
result of hitfit
Definition: TtEvent.h:209
TtEvent::lepDecays_
std::pair< WDecay::LeptonType, WDecay::LeptonType > lepDecays_
leptonic decay channels
Definition: TtEvent.h:189
TtEvent::setMvaDiscriminators
void setMvaDiscriminators(const std::vector< double > &val)
set mva discriminant values of kMVADisc hypothesis
Definition: TtEvent.h:177
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TtEvent::setHitFitSigMT
void setHitFitSigMT(const std::vector< double > &val)
set fitted top mass uncertainty of kHitFit hypothesis
Definition: TtEvent.h:189
TtEvent::nJetsConsidered_
std::map< HypoClassKey, int > nJetsConsidered_
number of jets considered when building the hypotheses
Definition: TtEvent.h:200
TtEvent::kHitFit
Definition: TtEvent.h:39
TtEvent::HypoClassKey
HypoClassKey
supported classes of event hypotheses
Definition: TtEvent.h:30
TtEvent::hitFitProb
double hitFitProb(const unsigned &cmb=0) const
return the hitfit probability of hypothesis 'cmb' if available; -1 else
Definition: TtEvent.h:134
TtGenEvent.h
cand
Definition: decayParser.h:34
TtEvent::setMvaMethod
void setMvaMethod(const std::string &name)
set label of mva method for kMVADisc hypothesis
Definition: TtEvent.h:175
TtEvent::numberOfConsideredJets
int numberOfConsideredJets(const HypoClassKey &key) const
return number of jets that were considered when building a given hypothesis
Definition: TtEvent.h:104
TtEvent::hitFitChi2
double hitFitChi2(const unsigned &cmb=0) const
return the hitfit chi2 of hypothesis 'cmb' if available; -1 else
Definition: TtEvent.h:130
TtEvent::setLepDecays
void setLepDecays(const WDecay::LeptonType &lepDecTop1, const WDecay::LeptonType &lepDecTop2)
set leptonic decay channels
Definition: TtEvent.h:161
TtEvent::topPair
const reco::Candidate * topPair(const HypoClassKey &key, const unsigned &cmb=0) const
get combined 4-vector of top and topBar of the given hypothesis
Definition: TtEvent.h:151
TtEvent::HypoClassKeyStringToEnum
a lightweight map for selection type string label and enum value
Definition: TtEvent.h:44
TtEvent::HypoClassKeyStringToEnum::value
HypoClassKey value
Definition: TtEvent.h:46
TtEvent::kWMassDeltaTopMass
Definition: TtEvent.h:38
TtEvent::fitChi2_
std::vector< double > fitChi2_
result of kinematic fit
Definition: TtEvent.h:203
TtEvent::isHypoValid
bool isHypoValid(const HypoClassKey &key, const unsigned &cmb=0) const
check if hypothesis 'cmb' within the hypothesis class was valid; if not it lead to an empty Composite...
Definition: TtEvent.h:86
reco::Candidate
Definition: Candidate.h:27
WDecay::LeptonType
LeptonType
Definition: TopGenEvent.h:27
TtEvent::genMatchSumDR_
std::vector< double > genMatchSumDR_
result of gen match
Definition: TtEvent.h:214
TtEvent::kGenMatch
Definition: TtEvent.h:34
heppy_batch.val
val
Definition: heppy_batch.py:351
TtEvent::setGenMatchSumPt
void setGenMatchSumPt(const std::vector< double > &val)
set sum pt of kGenMatch hypothesis
Definition: TtEvent.h:171
TtEvent::kKinSolution
Definition: TtEvent.h:37
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
TtEvent::topPair
const math::XYZTLorentzVector * topPair() const
get combined 4-vector of top and topBar from the TtGenEvent
Definition: TtEvent.h:155
TtEvent::isHypoAvailable
bool isHypoAvailable(const HypoClassKey &key, const unsigned &cmb=0) const
check if hypothesis 'cmb' is available within the hypothesis class
Definition: TtEvent.h:78
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
TtEvent::mvaMethod
std::string mvaMethod() const
return the label of the mva method in use for the jet parton association (if kMVADisc is not availabl...
Definition: TtEvent.h:124
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
TtEvent::kMaxSumPtWMass
Definition: TtEvent.h:33
TtEvent::correspondingHypo
int correspondingHypo(const std::string &key1, const unsigned &hyp1, const std::string &key2) const
return the hypothesis in hypothesis class 'key2', which corresponds to hypothesis 'hyp1' in hypothesi...
Definition: TtEvent.h:140
TtEvent::numberOfAvailableHypoClasses
unsigned int numberOfAvailableHypoClasses() const
return number of available hypothesis classes
Definition: TtEvent.h:90
TtEvent::setFitChi2
void setFitChi2(const std::vector< double > &val)
set chi2 of kKinFit hypothesis
Definition: TtEvent.h:179
crabWrapper.key
key
Definition: crabWrapper.py:19
TtEvent::topPair
const reco::Candidate * topPair(const std::string &key, const unsigned &cmb=0) const
get combined 4-vector of top and topBar of the given hypothesis
Definition: TtEvent.h:147
label
const char * label
Definition: PFTauDecayModeTools.cc:11
reco::CompositeCandidate
Definition: CompositeCandidate.h:21
TtEvent::kGeom
Definition: TtEvent.h:31
TtEvent::setHitFitChi2
void setHitFitChi2(const std::vector< double > &val)
set chi2 of kHitFit hypothesis
Definition: TtEvent.h:181
TtEvent::genMatchSumPt
double genMatchSumPt(const unsigned &cmb=0) const
return the sum pt of the generator match if available; -1 else
Definition: TtEvent.h:116