Changeset 16 in huonglan


Ignore:
Timestamp:
Aug 27, 2011, 12:20:55 AM (13 years ago)
Author:
huonglan
Message:

Add a muon to jet - first try

Location:
ANA2011
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • ANA2011/MyAdd.h

    r8 r16  
    1010//bool GoodElectron(int,bool);
    1111bool GoodMuon(int);
     12bool GoodMuonJet(int,bool,bool,vector<int>);//this function will be used to choose muon and add to jets
     13std::vector<std::pair<TLorentzVector,TLorentzVector> > AddMuonJet(bool,bool,std::vector<int>);
    1214bool GoodJets(int);
    1315bool MatchTrigger(int,vector<TLorentzVector>,vector<TLorentzVector>);
  • ANA2011/ana2011.C

    r8 r16  
    7171#include "emuOverlap.C"
    7272#include "SF.C"
     73#include "AddMuonJetFunction.C"
    7374
    7475bool sortdecreaseSV0(TVector2 v1, TVector2 v2)
     
    504505
    505506  //###### SELECTION OF MUON ######
     507  vector<int> indGoodMuon;
    506508  for (unsigned int i = 0; i < mu_pt->size(); i++) {
    507509    if(GoodMuon(i)) {
     510      indGoodMuon.push_back(i);
    508511      TLorentzVector v4m;
    509512
     
    718721  m_loose->Fill(10,weight);
    719722  if (ncate==12||ncate==13||ncate==21||ncate==31) m_looseSig->Fill(10,weight);
     723
     724  //Before selecting jets, look if there is a muon coming from jet
     725  std::vector<std::pair<TLorentzVector,TLorentzVector> > MuonJetPairs = AddMuonJet(RealData,m_smearMC,indGoodMuon);
     726  //cout << "Number of pair muon and jet that overlap " << MuonJetPairs.size() << endl;
     727
     728  vector<TLorentzVector> vMuon, vJet;
     729  for (unsigned int i = 0; i < MuonJetPairs.size(); i++){
     730    pair<TLorentzVector,TLorentzVector> MuonJet = MuonJetPairs.at(i);
     731    vMuon.push_back(MuonJet.first);
     732    vJet.push_back(MuonJet.second);
     733  }
    720734
    721735  //SELECTION OF JETS
     
    729743    TLorentzVector v4j;
    730744    v4j.SetPtEtaPhiM(jet_pt->at(i),jet_eta->at(i),jet_phi->at(i),jet_m->at(i));
     745
     746    if (vJet.size()>0){
     747      for (unsigned int iJ = 0; iJ < vJet.size(); iJ++){
     748        TLorentzVector vJ = vJet.at(iJ);
     749        if (v4j==vJ) v4j += vMuon.at(iJ);
     750      }
     751    }
     752
     753    jet_pt->at(i) = v4j.Pt();
     754    jet_E->at(i)  = v4j.E();
     755
    731756    if(GoodJets(i)) {
    732757      double sv0 = jet_flavor_weight_SV0->at(i);
     
    10691094    m_mjj3->Fill(mjj3,weight); 
    10701095
     1096  /*
    10711097  bool isMuonJet = false;
    10721098  TLorentzVector vMuonJet;
     
    11151141    }
    11161142  }
     1143  */ // comment for 26 August
    11171144
    11181145  // #####################    START THE FIRST ANALYSIS    #######################
     
    14791506      if (!bjetusedforchi2) continue;
    14801507
    1481       //cout << "enter here???" << endl;
    1482      
    1483       //cout << "vGoodJets size = " << vGoodJets.size() << endl;
    1484       //cout << "bjetsInd size = " << bjetsInd.size() << endl;
    1485       //cout << "index of bjets in vGoodJets : ";
    1486       /*for (unsigned int i = 0; i < bjetsInd.size(); i++) {
    1487         cout << bjetsInd.at(i) << " " ;
    1488         }*/
    1489       //cout << endl;
    1490 
    14911508      if (vGoodJets.size()==4 && bjetsInd.size()==3){
    14921509        threebjets4GoodJets = true;
     
    15111528    }//end of (askbtagged)
    15121529   
    1513     for (unsigned int j=0; j < index.size(); j++){
     1530    /*for (unsigned int j=0; j < index.size(); j++){
    15141531      if (PRINT) cout << "index : " << index.at(j) << endl;
    15151532      TLorentzVector vp4 = vGoodJets.at(index.at(j));
     
    15191536    }
    15201537    vecpars2.push_back(goodLepton.at(0).vector4());
     1538    */ //comment for 26 August
     1539   
     1540    for (unsigned int j=0; j < index.size(); j++){
     1541      if (PRINT) cout << "index : " << index.at(j) << endl;
     1542      TLorentzVector vp4 = vGoodJets.at(index.at(j));
     1543      vecpars2.push_back(vp4);
     1544    }
     1545    vecpars2.push_back(goodLepton.at(0).vector4());   
    15211546
    15221547    //##############################################################
Note: See TracChangeset for help on using the changeset viewer.