Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:14

0001 #include "TopQuarkAnalysis/TopEventSelection/interface/TtSemiLepSignalSel.h"
0002 #include "TVector3.h"
0003 
0004 TtSemiLepSignalSel::TtSemiLepSignalSel() {}
0005 
0006 TtSemiLepSignalSel::TtSemiLepSignalSel(const std::vector<pat::Jet>& topJets,
0007                                        const math::XYZTLorentzVector& lepton,
0008                                        const edm::View<pat::MET>& MET) {  //function
0009 
0010   unsigned int nJetsMax = topJets.size();
0011 
0012   var_MET = MET.begin()->et();
0013   var_sumEt = 0.;
0014 
0015   math::XYZTLorentzVector Jetsum(0., 0., 0., 0.);
0016 
0017   for (unsigned int i = 0; i < nJetsMax; i++) {
0018     math::XYZTLorentzVector aJet = topJets[i].p4();
0019     Jetsum += aJet;
0020     var_sumEt += topJets[i].et();
0021   }
0022   massalljets = Jetsum.M();
0023 
0024   var_lepeta = lepton.Eta();
0025 
0026   math::XYZTLorentzVector Met = MET.begin()->p4();
0027   const math::XYZTLorentzVector& Lep = lepton;
0028   double Etjet[4];
0029   double Jetjet[6];
0030   double dijetmass;
0031   var_mindijetmass = 99999.;
0032   var_maxdijetmass = -1.;
0033   int counter = 0;
0034   for (int i = 0; i < 4; i++) {
0035     math::XYZTLorentzVector aJet = topJets[i].p4();
0036     Etjet[i] = aJet.Et();
0037     for (int j = i + 1; j < 4; j++) {
0038       math::XYZTLorentzVector asecJet = topJets[j].p4();
0039       dijetmass = (aJet + asecJet).M();
0040       if (dijetmass < var_mindijetmass)
0041         var_mindijetmass = dijetmass;
0042       if (dijetmass > var_maxdijetmass)
0043         var_maxdijetmass = dijetmass;
0044       counter++;
0045     }
0046   }
0047 
0048   var_Et1 = Etjet[0];
0049 
0050   var_dphiMETlepton = DeltaPhi(Met, Lep);
0051 
0052   counter = 0;
0053   for (int i = 0; i < 4; i++) {
0054     math::XYZTLorentzVector aJet = topJets[i].p4();
0055     for (int j = i + 1; j < 4; j++) {
0056       math::XYZTLorentzVector asecJet = topJets[j].p4();
0057       Jetjet[counter] = fabs(aJet.Eta() - asecJet.Eta());
0058       counter++;
0059     }
0060   }
0061 
0062   var_detajet2jet3 = Jetjet[3];
0063   var_detajet3jet4 = Jetjet[5];
0064 
0065   double Lepjet[4];
0066   var_mindRjetlepton = 99999.;
0067   for (int i = 0; i < 4; i++) {
0068     math::XYZTLorentzVector aJet = topJets[i].p4();
0069     Lepjet[i] = DeltaR(Lep, aJet);
0070     if (Lepjet[i] < var_mindRjetlepton)
0071       var_mindRjetlepton = Lepjet[i];
0072   }
0073 }
0074 
0075 double TtSemiLepSignalSel::DeltaPhi(const math::XYZTLorentzVector& v1, const math::XYZTLorentzVector& v2) {
0076   double dPhi = fabs(v1.Phi() - v2.Phi());
0077   if (dPhi > TMath::Pi())
0078     dPhi = 2 * TMath::Pi() - dPhi;
0079   return dPhi;
0080 }
0081 
0082 double TtSemiLepSignalSel::DeltaR(const math::XYZTLorentzVector& v1, const math::XYZTLorentzVector& v2) {
0083   double dPhi = DeltaPhi(v1, v2);
0084   double dR = TMath::Sqrt((v1.Eta() - v2.Eta()) * (v1.Eta() - v2.Eta()) + dPhi * dPhi);
0085   return dR;
0086 }
0087 
0088 TtSemiLepSignalSel::~TtSemiLepSignalSel() {}