CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/TopQuarkAnalysis/TopEventSelection/src/TtSemiLepSignalSel.cc

Go to the documentation of this file.
00001 #include "TopQuarkAnalysis/TopEventSelection/interface/TtSemiLepSignalSel.h"
00002 #include "TVector3.h"
00003 
00004 TtSemiLepSignalSel::TtSemiLepSignalSel(){}
00005 
00006 TtSemiLepSignalSel::TtSemiLepSignalSel(const std::vector<pat::Jet>& topJets, math::XYZTLorentzVector lepton, 
00007                                  const edm::View<pat::MET>& MET)
00008 { //function
00009 
00010   unsigned int nJetsMax = topJets.size();
00011   
00012   var_MET = MET.begin()->et();
00013   var_sumEt = 0.;
00014   
00015   math::XYZTLorentzVector Jetsum(0.,0.,0.,0.);
00016   
00017   for(unsigned int i=0; i<nJetsMax; i++) {
00018     math::XYZTLorentzVector aJet = topJets[i].p4();
00019     Jetsum += aJet;
00020     var_sumEt += topJets[i].et();
00021   }
00022   massalljets = Jetsum.M();
00023   
00024   var_lepeta = lepton.Eta();
00025 
00026   math::XYZTLorentzVector Met = MET.begin()->p4();
00027   math::XYZTLorentzVector Lep = lepton;
00028   double Etjet[4];
00029   double Jetjet[6];
00030   double dijetmass;
00031   var_mindijetmass = 99999.;
00032   var_maxdijetmass = -1.;
00033   int counter = 0;
00034   for(int i=0; i<4; i++) {
00035     math::XYZTLorentzVector aJet = topJets[i].p4();
00036     Etjet[i] = aJet.Et();
00037     for(int j=i+1; j<4; j++) {
00038       math::XYZTLorentzVector asecJet = topJets[j].p4();
00039       dijetmass = (aJet+asecJet).M();
00040       if(dijetmass<var_mindijetmass) var_mindijetmass = dijetmass;
00041       if(dijetmass>var_maxdijetmass) var_maxdijetmass = dijetmass;
00042       counter++;
00043     }
00044   }
00045 
00046   var_Et1 = Etjet[0];
00047    
00048   var_dphiMETlepton = DeltaPhi(Met,Lep);
00049 
00050 
00051 
00052   counter=0;
00053   for(int i=0; i<4; i++) {
00054     math::XYZTLorentzVector aJet = topJets[i].p4();
00055     for(int j=i+1; j<4; j++) {
00056       math::XYZTLorentzVector asecJet = topJets[j].p4();
00057       Jetjet[counter] = fabs(aJet.Eta()-asecJet.Eta());
00058       counter++;
00059     }
00060   }
00061 
00062   var_detajet2jet3 = Jetjet[3];
00063   var_detajet3jet4 = Jetjet[5];
00064 
00065  
00066   double Lepjet[4];
00067   var_mindRjetlepton = 99999.;
00068   for(int i=0; i<4; i++) {
00069     math::XYZTLorentzVector aJet = topJets[i].p4();
00070     Lepjet[i] = DeltaR(Lep,aJet);
00071     if(Lepjet[i]<var_mindRjetlepton) var_mindRjetlepton = Lepjet[i];
00072   }
00073   
00074 }
00075 
00076 double TtSemiLepSignalSel::DeltaPhi(math::XYZTLorentzVector v1, math::XYZTLorentzVector v2)
00077 {
00078   double dPhi = fabs(v1.Phi() - v2.Phi());
00079   if (dPhi > TMath::Pi()) dPhi =  2*TMath::Pi() - dPhi;
00080   return dPhi;
00081 }
00082 
00083 double TtSemiLepSignalSel::DeltaR(math::XYZTLorentzVector v1, math::XYZTLorentzVector v2)
00084 {
00085   double dPhi = DeltaPhi(v1,v2);
00086   double dR = TMath::Sqrt((v1.Eta()-v2.Eta())*(v1.Eta()-v2.Eta())+dPhi*dPhi);
00087   return dR;
00088 }
00089 
00090 TtSemiLepSignalSel::~TtSemiLepSignalSel() 
00091 {
00092 }