ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFrameTools/src/EventCalc.cxx
(Generate patch)

Comparing UserCode/UHHAnalysis/SFrameTools/src/EventCalc.cxx (file contents):
Revision 1.5 by peiffer, Thu Jun 28 15:57:26 2012 UTC vs.
Revision 1.8 by peiffer, Tue Aug 21 15:49:48 2012 UTC

# Line 26 | Line 26 | EventCalc::EventCalc() : m_logger( "Even
26    m_bcc = NULL;
27    m_lumi = NULL;
28    m_primlep = NULL;
29 +  m_ttgen = NULL;
30   }
31  
32   EventCalc::~EventCalc()
# Line 48 | Line 49 | void EventCalc::Reset()
49    // reset booleans
50    b_HT = false;
51    b_HTlep = false;
52 +  b_Reconstruction = false;
53  
54 +  m_TotalWeight = 1.;
55 +  
56    m_primlep = NULL;
57 +  m_ttgen = NULL;
58  
59   }
60  
# Line 152 | Line 157 | Particle* EventCalc::GetPrimaryLepton(){
157    return m_primlep;
158   }
159  
160 + TTbarGen* EventCalc::GetTTbarGen(){
161 +
162 +  if(!m_ttgen){
163 +    m_ttgen = new TTbarGen();
164 +  }
165 +
166 +  return m_ttgen;
167 + }
168 +
169  
170   std::vector<LorentzVector> EventCalc::NeutrinoReconstruction(const LorentzVector lepton, const LorentzVector met){
171  
# Line 215 | Line 229 | std::vector<LorentzVector> EventCalc::Ne
229  
230   void EventCalc::FillHighMassTTbarHypotheses(){
231  
232 +  if(b_Reconstruction) return;
233 +  b_Reconstruction=true;
234 +
235    //clear hypothesis list
236    m_bcc->recoHyps->clear();
237  
# Line 236 | Line 253 | void EventCalc::FillHighMassTTbarHypothe
253  
254      unsigned int n_jets = m_bcc->jets->size();
255      unsigned int max_j = myPow(3, n_jets);
256 +    if(max_j>10) max_j=10; //avoid crashes in events with many jets
257      for (unsigned int j=0; j < max_j; j++) {
258        LorentzVector tophad_v4(0,0,0,0);
259        LorentzVector toplep_v4 = wlep_v4;
# Line 268 | Line 286 | void EventCalc::FillHighMassTTbarHypothe
286          num /= 3;
287        }
288        
289 +      //search jet with highest pt assigned to leptonic top
290 +      float maxpt=-999;
291 +      int maxind=-1;
292 +      for(unsigned int i=0; i<hyp.toplep_jets_indices().size(); ++i){
293 +        float pt = m_bcc->jets->at(hyp.toplep_jets_indices().at(i)).pt();
294 +        if(pt>maxpt){
295 +          maxpt=pt;
296 +          maxind=hyp.toplep_jets_indices().at(i);
297 +        }
298 +      }
299 +      hyp.set_blep_index(maxind);
300 +
301        
302 <      //fill only hypotheses with at least on ejet assigned to each top quark
302 >      //fill only hypotheses with at least one jet assigned to each top quark
303        if(hadjets>0 && lepjets>0){
304          hyp.set_tophad_v4(tophad_v4);
305          hyp.set_toplep_v4(toplep_v4);
# Line 323 | Line 353 | void EventCalc::PrintEventContent(){
353      }
354    }
355   }
356 +
357 +
358 + void EventCalc::ProduceWeight(double weight)
359 + {
360 +  m_TotalWeight = m_TotalWeight * weight;
361 + }
362 +
363 + double EventCalc::GetWeight()
364 + {
365 +
366 + return m_TotalWeight;
367 + }
368 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines