ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFrameTools/include/ReconstructionHypothesis.h
Revision: 1.1
Committed: Thu Jun 28 15:57:30 2012 UTC (12 years, 10 months ago) by peiffer
Content type: text/plain
Branch: MAIN
Log Message:
reconstruction hypothesis tools

File Contents

# User Rev Content
1 peiffer 1.1 #ifndef ReconstructionHypothesis_H
2     #define ReconstructionHypothesis_H
3    
4     #include "Objects.h"
5    
6     struct qualityflag{
7     std::string label;
8     float discriminator;
9     };
10    
11     /**
12     * @short container class to store the results of the top quark reconstruction
13     */
14    
15     class ReconstructionHypothesis{
16    
17     public:
18    
19    
20     ReconstructionHypothesis(){
21     m_tophad_jets_ind.clear();
22     m_toplep_jets_ind.clear();
23     LorentzVector v4(0,0,0,0);
24     m_toplep_v4=v4;
25     m_tophad_v4=v4;
26     m_neutrino_v4=v4;
27     m_lepton.set_v4(v4);
28     m_lepton.set_charge(0);
29     m_qualityflags.clear();
30     };
31     ~ReconstructionHypothesis(){};
32    
33     LorentzVector toplep_v4() const{return m_toplep_v4;}
34     LorentzVector tophad_v4() const{return m_toplep_v4;}
35     LorentzVector neutrino_v4() const{return m_neutrino_v4;}
36     Particle lepton() const{return m_lepton;}
37     std::vector<unsigned int> tophad_jets_indices() const{return m_tophad_jets_ind;}
38     std::vector<unsigned int> toplep_jets_indices() const{return m_toplep_jets_ind;}
39     LorentzVector top_v4() const{ return m_lepton.charge() > 0 ? m_toplep_v4 : m_tophad_v4;}
40     LorentzVector antitop_v4() const{ return m_lepton.charge() < 0 ? m_toplep_v4 : m_tophad_v4;}
41     LorentzVector wlep_v4() const{ return m_neutrino_v4+m_lepton.v4();}
42    
43     /// get the discriminator value for this hypothesis
44     float discriminator(std::string l){
45     float discr=0;
46     bool found=false;
47     for(unsigned int i=0; i<m_qualityflags.size(); ++i){
48     if(l==m_qualityflags[i].label){
49     discr = m_qualityflags[i].discriminator;
50     found = true;
51     break;
52     }
53     }
54     if(!found) std::cerr << "WARNING: discriminator with label " << l << " not found in hypothesis, return 0." <<std::endl;
55     return discr;
56     }
57    
58     void set_toplep_v4(LorentzVector v4){m_toplep_v4=v4;}
59     void set_tophad_v4(LorentzVector v4){m_tophad_v4=v4;}
60     void set_neutrino_v4(LorentzVector v4){m_neutrino_v4=v4;}
61     void add_toplep_jet_index(unsigned int j){m_toplep_jets_ind.push_back(j);}
62     void add_tophad_jet_index(unsigned int j){m_tophad_jets_ind.push_back(j);}
63     void set_lepton(Particle p){m_lepton=p;}
64     void add_qualityflag(qualityflag q){m_qualityflags.push_back(q);}
65     void add_qualityflag(std::string label, float discr){
66     qualityflag qflag;
67     qflag.label = label;
68     qflag.discriminator = discr;
69     add_qualityflag(qflag);
70     };
71    
72     void clear_jetindices(){
73     m_tophad_jets_ind.clear();
74     m_toplep_jets_ind.clear();
75     }
76    
77     /// test if a discriminator value with a certian label has already been added
78     bool has_discriminator(std::string label){
79     for(unsigned int i=0; i< m_qualityflags.size(); ++i){
80     if(m_qualityflags[i].label == label) return true;
81     }
82     return false;
83     }
84    
85     private:
86    
87     LorentzVector m_toplep_v4;
88     LorentzVector m_tophad_v4;
89     LorentzVector m_neutrino_v4;
90    
91     //indices to the jets in the jet list assigned to hadronic and leptonic tops
92     std::vector<unsigned int> m_tophad_jets_ind;
93     std::vector<unsigned int> m_toplep_jets_ind;
94    
95     Particle m_lepton;
96    
97     std::vector<qualityflag> m_qualityflags;
98    
99     };
100    
101    
102     #endif