ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbbAnalysis/HbbAnalyzer/plugins/HbbCandidateFinderAlgo.cc
(Generate patch)

Comparing UserCode/VHbbAnalysis/HbbAnalyzer/plugins/HbbCandidateFinderAlgo.cc (file contents):
Revision 1.1 by tboccali, Tue Jun 28 12:03:54 2011 UTC vs.
Revision 1.7 by tboccali, Wed Jul 20 09:32:55 2011 UTC

# Line 1 | Line 1
1   #include "VHbbAnalysis/HbbAnalyzer/interface/HbbCandidateFinderAlgo.h"
2 < #include "VHbbAnalysis/HbbAnalyzer/interface/VHbbCandidateTools.h"
2 > #include "VHbbAnalysis/VHbbDataFormats/interface/VHbbCandidateTools.h"
3  
4   #include <iostream>
5   #include<cstdlib>
# Line 16 | Line 16 | struct CompareBTag {
16    }
17   };
18  
19 float HbbCandidateFinderAlgo::getDeltaTheta( const VHbbEvent::SimpleJet & j1, const VHbbEvent::SimpleJet & j2 ) const{
20
21 double deltaTheta = 1e10;
22 TLorentzVector pi(0,0,0,0);
23 TLorentzVector v_j1 = j1.chargedTracksFourMomentum;
24 TLorentzVector v_j2 = j2.chargedTracksFourMomentum;
25
26 if( v_j2.Mag() == 0
27     || v_j1.Mag() == 0 )
28   return deltaTheta = 1e10;
29
30 //use j1 to calculate the pull vector
31 TVector2 t = j1.tVector;
32
33 if( t.Mod() == 0 )
34   return deltaTheta = 1e10;
35
36 Double_t dphi =  v_j2.Phi()- v_j1.Phi();
37 if ( dphi > M_PI ) {
38   dphi -= 2.0*M_PI;
39 } else if ( dphi <= -M_PI ) {
40   dphi += 2.0*M_PI;
41 }
42 Double_t deltaeta = v_j2.Rapidity() - v_j1.Rapidity();
43 TVector2 BBdir( deltaeta, dphi );
44
45 deltaTheta = t.DeltaPhi(BBdir);
46
47 return deltaTheta;
48
49 }
50
51
19  
20  
21  
# Line 57 | Line 24 | void HbbCandidateFinderAlgo::run (const
24    // first find the jets
25    //
26  
27 +  VHbbCandidateTools selector(verbose_);
28 +
29    VHbbEvent::SimpleJet j1,j2;
30    std::vector<VHbbEvent::SimpleJet> addJets;
31    bool foundJets = findDiJets(event->simpleJets2,j1,j2,addJets) ;
# Line 91 | Line 60 | void HbbCandidateFinderAlgo::run (const
60    temp.H.jets.push_back(j1);
61    temp.H.jets.push_back(j2);
62    temp.H.fourMomentum = (j1).fourMomentum+(j2).fourMomentum;
63 <  temp.H.deltaTheta = getDeltaTheta(j1,j2);
64 <  //  temp.H.deltaTheta = getDeltaTheta()
63 >  TVector3 higgsBoost;
64 >  higgsBoost = (temp.H.fourMomentum).BoostVector();
65 >  temp.H.helicities.push_back(selector.getHelicity(j1,higgsBoost));
66 >  temp.H.helicities.push_back(selector.getHelicity(j2,higgsBoost));
67 >  temp.H.deltaTheta = selector.getDeltaTheta(j1,j2);
68    temp.additionalJets = addJets;
69    temp.V.mets = met;
70    temp.V.muons = mu;
71    temp.V.electrons = ele;
72 <
72 >  
73    //
74    // now see which kind of andidate this can be
75    //
104  VHbbCandidateTools selector;
76  
77    VHbbCandidate result;
78    bool ok = false;
# Line 109 | Line 80 | void HbbCandidateFinderAlgo::run (const
80    // first: hZmumu
81    //
82    
83 +  if (verbose_){
84 +    std::cout <<" START SELECTION "<<std::endl;
85 +  }
86 +  
87    result = selector.getHZmumuCandidate(temp,ok);
88 +  if ( ok == true ){
89 +    result.setCandidateType(VHbbCandidate::Zmumu);
90 +    candidates.push_back(result);
91 +  }else{
92 +    //      HZee
93 +    result = selector. getHZeeCandidate(temp,ok);
94      if ( ok == true ){
95 <      result.setCandidateType(VHbbCandidate::Zmumu);
95 >      result.setCandidateType(VHbbCandidate::Zee);
96        candidates.push_back(result);
97 +      return;
98      }else{
99 <      //      HZee
100 <      result = selector. getHZeeCandidate(temp,ok);
99 >      //HWmunu
100 >      result = selector. getHWmunCandidate(temp,ok);
101 >      if ( ok == true ){
102 >        result.setCandidateType(VHbbCandidate::Wmun);
103 >        candidates.push_back(result);
104 >        return;
105 >      }else{
106 >        // HWenu
107 >        result = selector. getHWenCandidate(temp,ok);
108          if ( ok == true ){
109 <          result.setCandidateType(VHbbCandidate::Zee);
109 >          result.setCandidateType(VHbbCandidate::Wen);
110            candidates.push_back(result);
111            return;
112          }else{
113 <          //HWmunu
114 <          result = selector. getHWmunCandidate(temp,ok);
113 >          // HZnn
114 >          result = selector. getHZnnCandidate(temp,ok);
115            if ( ok == true ){
116 <            result.setCandidateType(VHbbCandidate::Wmun);
116 >            result.setCandidateType(VHbbCandidate::Znn);
117              candidates.push_back(result);
118              return;
130          }else{
131            // HWenu
132            result = selector. getHWenCandidate(temp,ok);
133            if ( ok == true ){
134              result.setCandidateType(VHbbCandidate::Wen);
135              candidates.push_back(result);
136              return;
137            }else{
138              // HZnn
139              result = selector. getHZnnCandidate(temp,ok);
140              if ( ok == true ){
141                result.setCandidateType(VHbbCandidate::Znn);
142                candidates.push_back(result);
143                return;
144              }
145            }
119            }
120          }
121 +      }
122      }
123 +  }
124    return;
125   }
126  
127   void HbbCandidateFinderAlgo::findMET(const VHbbEvent::METInfo & met, std::vector<VHbbEvent::METInfo>& out){
128    //
129 +
130    //  just preselection: met significance > 2
131 +
132      if (met.metSig >2 ) out.push_back(met);
133 <  
133 >    if (verbose_){
134 >      std::cout <<" CandidateFinder: Input MET = "<<met.metSig<<" Output MET = "<<out.size()<<std::endl;
135 >    }
136 >    
137   }
138  
139  
140   bool HbbCandidateFinderAlgo::findDiJets (const std::vector<VHbbEvent::SimpleJet>& jets, VHbbEvent::SimpleJet& j1, VHbbEvent::SimpleJet& j2,std::vector<VHbbEvent::SimpleJet>& addJets){
141    
142   std::vector<VHbbEvent::SimpleJet> tempJets;
143 <
143 >
144 > if (verbose_){
145 >   std::cout <<" CandidateFinder: Input Jets = "<<jets.size()<<std::endl;
146 > }
147 >
148   for (unsigned int i=0 ; i< jets.size(); ++i){
149     if (jets[i].fourMomentum.Pt()> jetPtThreshold)
150       tempJets.push_back(jets[i]);
151   }
152  
153   CompareBTag  bTagComparator;
154 + CompareJetPt ptComparator;
155 +
156 + if (verbose_){
157 +   std::cout <<" CandidateFinder: Intermediate Jets = "<<tempJets.size()<<std::endl;
158 + }
159 +
160  
161   if (tempJets.size()<2) return false;
162  
163   std::sort(tempJets.begin(), tempJets.end(), bTagComparator);
164  
165 < j1 = tempJets[0];
166 < j2 = tempJets[1];
167 < //
165 > if (tempJets[0].fourMomentum.Pt()>(tempJets[1].fourMomentum.Pt())){
166 >   j1 = tempJets[0];
167 >   j2 = tempJets[1];
168 > }else{
169 >   j2 = tempJets[0];
170 >   j1 = tempJets[1];
171 > }
172 >
173 > //
174   // additional jets
175   //
176   if (tempJets.size()>2){
# Line 182 | Line 178 | bool HbbCandidateFinderAlgo::findDiJets
178       addJets.push_back(tempJets[i]);
179     }
180   }
181 <  CompareJetPt ptComparator;
181 >
182 > if (verbose_){
183 >   std::cout <<" CandidateFinder: Output Jets = "<<2<<" Additional = "<<addJets.size()<<std::endl;
184 > }
185 >
186  
187    std::sort(addJets.begin(), addJets.end(), ptComparator);
188   return true;
189 +
190 +
191   }
192  
193   void HbbCandidateFinderAlgo::findMuons(const std::vector<VHbbEvent::MuonInfo>& muons, std::vector<VHbbEvent::MuonInfo>& out){
# Line 220 | Line 222 | For both W -> mu nu and Z -> mu mu, we a
222        out.push_back(*it);
223      }
224    }
225 +
226 +    if (verbose_){
227 +      std::cout <<" CandidateFinder: Input Muons = "<<muons.size()<<" Output Muons = "<<out.size()<<std::endl;
228 +    }
229 +
230 +
231 +
232   }
233  
234  
# Line 251 | Line 260 | We adopt the standard cut-based selectio
260        out.push_back(*it);
261      }  
262    }
263 +    if (verbose_){
264 +      std::cout <<" CandidateFinder: Input Electrons = "<<electrons.size()<<" Output Electrons = "<<out.size()<<std::endl;
265 +    }
266 +
267 +
268   }
269  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines