Skip to content

Commit

Permalink
closure miniIso_y_activity_n
Browse files Browse the repository at this point in the history
  • Loading branch information
hua wei committed Mar 30, 2015
1 parent f639d95 commit 744c8e9
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Tool/Activity.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ double Activity::getActivity()
double activity = 0;
for( unsigned int i = 0 ; i < jetLVec_in.size() ; i++ )
{
if( DeltaR( eta_lepton_in , phi_lepton_in , (jetLVec_in.at(i)).Eta() , (jetLVec_in.at(i)).Phi() ) < 0.5 )
if( DeltaR( eta_lepton_in , phi_lepton_in , (jetLVec_in.at(i)).Eta() , (jetLVec_in.at(i)).Phi() ) < 1.0 )
{
activity+= (jetLVec_in.at(i)).Pt() * (recoJetschargedEmEnergyFraction_in[i] + recoJetschargedHadronEnergyFraction_in[i]);
}
Expand Down
16 changes: 8 additions & 8 deletions Tool/EffsHeader_MuCS.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const double ttbar_mus_acc = 0.881829;
const double ttbar_mus_recoeff[8] = {0.906211,0.934775,0.94723,0.952031,0.958981,0.948467,0.948671,0.907143};
const double ttbar_mus_isoeff[8] = {0.523646,0.661701,0.767409,0.827249,0.856124,0.880562,0.893062,0.902887};
const double ttbar_els_acc = 0.901314;
const double ttbar_els_recoeff[8] = {0.323529,0.57732,0.780035,0.84218,0.859939,0.8662,0.886717,0.826568};
const double ttbar_els_isoeff[8] = {0.721818,0.840608,0.897508,0.929657,0.940256,0.950025,0.948119,0.958036};
const double ttbar_corrfactor_di_mus = 0.983865;
const double ttbar_corrfactor_di_els = 0.984722;
const double ttbar_mus_acc = 0.881023;
const double ttbar_mus_recoeff[8] = {0.905063,0.934978,0.946333,0.950326,0.958493,0.948989,0.948383,0.905941};
const double ttbar_mus_isoeff[8] = {0.809091,0.882894,0.93431,0.949314,0.96469,0.979177,0.986885,0.992714};
const double ttbar_els_acc = 0.900928;
const double ttbar_els_recoeff[8] = {0.396635,0.74364,0.862302,0.870841,0.885174,0.880489,0.889618,0.830626};
const double ttbar_els_isoeff[8] = {0.819697,0.899474,0.948168,0.966854,0.970777,0.980977,0.99061,0.989758};
const double ttbar_corrfactor_di_mus = 0.991476;
const double ttbar_corrfactor_di_els = 0.987959;
39 changes: 28 additions & 11 deletions Tool/LostLepton_MuCS_TTbar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ void passBaselineFunc(NTupleReader &tr)
TLorentzVector metLVec; metLVec.SetPtEtaPhiM(tr.getVar<double>("met"), 0, tr.getVar<double>("metphi"), 0);

//Calculate number of leptons
int nMuons = AnaFunctions::countMuons(tr.getVec<TLorentzVector>("muonsLVec"), tr.getVec<double>("muonsRelIso"), tr.getVec<double>("muonsMtw"), AnaConsts::muonsArr);
int nElectrons = AnaFunctions::countElectrons(tr.getVec<TLorentzVector>("elesLVec"), tr.getVec<double>("elesRelIso"), tr.getVec<double>("elesMtw"), AnaConsts::elesArr);
//int nMuons = AnaFunctions::countMuons(tr.getVec<TLorentzVector>("muonsLVec"), tr.getVec<double>("muonsRelIso"), tr.getVec<double>("muonsMtw"), AnaConsts::muonsArr);
int nMuons = AnaFunctions::countMuons(tr.getVec<TLorentzVector>("muonsLVec"), tr.getVec<double>("muonsMiniIso"), tr.getVec<double>("muonsMtw"), AnaConsts::muonsArr);

//int nElectrons = AnaFunctions::countElectrons(tr.getVec<TLorentzVector>("elesLVec"), tr.getVec<double>("elesRelIso"), tr.getVec<double>("elesMtw"), AnaConsts::elesArr);
int nElectrons = AnaFunctions::countElectrons(tr.getVec<TLorentzVector>("elesLVec"), tr.getVec<double>("elesMiniIso"), tr.getVec<double>("elesMtw"), AnaConsts::elesArr);

int nIsoTrks = AnaFunctions::countIsoTrks(tr.getVec<TLorentzVector>("loose_isoTrksLVec"), tr.getVec<double>("loose_isoTrks_iso"), tr.getVec<double>("loose_isoTrks_mtw"), AnaConsts::isoTrksArr);

//Calculate number of jets and b-tagged jets
Expand Down Expand Up @@ -186,8 +190,8 @@ int main(int argc, char* argv[])
const char *inputFileList = argv[1];
const char *outFileName = argv[2];

TChain *fChain = new TChain("stopTreeMaker/AUX");
//TChain *fChain = new TChain("AUX");
//TChain *fChain = new TChain("stopTreeMaker/AUX");
TChain *fChain = new TChain("AUX");

if(!FillChain(fChain, inputFileList))
{
Expand Down Expand Up @@ -276,6 +280,11 @@ int main(int argc, char* argv[])
vector<double> recoJetschargedHadronEnergyFraction = tr.getVec<double>("recoJetschargedHadronEnergyFraction");
vector<double> recoJetschargedEmEnergyFraction = tr.getVec<double>("recoJetschargedEmEnergyFraction");

//for( unsigned int i = 0 ; i < jetsLVec.size() ; i++ )
//{
//(myBaseHistgram.h_b_jet_pt)->Fill( ( jetsLVec.at(i) ).Pt() );
//}

for(int gen_emus_i = 0 ; gen_emus_i < gen_emus_count ; gen_emus_i++)
{
//determine if this gen particle is Muon;
Expand Down Expand Up @@ -354,11 +363,12 @@ int main(int argc, char* argv[])
{
myAccRecoIsoEffs.nmus_reco[ptbin_number]++;

vector<double> muonsRelIso = tr.getVec<double>("muonsRelIso");
//vector<double> muonsRelIso = tr.getVec<double>("muonsRelIso");
vector<double> muonsMiniIso = tr.getVec<double>("muonsMiniIso");

bool mus_pass_iso;
mus_pass_iso = false;
mus_pass_iso = ( muonsRelIso.at(mindeltar_index) < 0.2 );
mus_pass_iso = ( muonsMiniIso.at(mindeltar_index) < 0.2 );

if(mus_pass_iso)
{
Expand Down Expand Up @@ -456,10 +466,12 @@ int main(int argc, char* argv[])
{
myAccRecoIsoEffs.nels_reco[ptbin_number]++;

vector<double> elesRelIso = tr.getVec<double>("elesRelIso");
//vector<double> elesRelIso = tr.getVec<double>("elesRelIso");
vector<double> elesMiniIso = tr.getVec<double>("elesMiniIso");

bool els_pass_iso;
els_pass_iso = false;
els_pass_iso = ( elesRelIso.at(mindeltar_index) < 0.24 );
els_pass_iso = ( elesMiniIso.at(mindeltar_index) < 0.2 );

if(els_pass_iso)
{
Expand Down Expand Up @@ -660,7 +672,6 @@ int main(int argc, char* argv[])
}//end of first loop

//All numbers counted, now calculated effs and print out
myAccRecoIsoEffs.printOverview();
myAccRecoIsoEffs.NumberstoEffs();
myAccRecoIsoEffs.EffstoWeights();
myAccRecoIsoEffs.GetDiLeptonFactor();
Expand Down Expand Up @@ -700,15 +711,18 @@ int main(int argc, char* argv[])
//nMuons in flatree means no iso cut muons; CUT2 we add iso
if (nElectrons == 0 && nMuons == 1)
{
//counting the events for muon control sample
myAccRecoIsoEffs.nevents_cs_mus++;
//get muon variables
vector<TLorentzVector> muonsLVec = trCS.getVec<TLorentzVector>("muonsLVec");
vector<double> muonsRelIso = trCS.getVec<double>("muonsRelIso");
//vector<double> muonsRelIso = trCS.getVec<double>("muonsRelIso");
vector<double> muonsMiniIso = trCS.getVec<double>("muonsMiniIso");

double reco_mus_pt = 0, reco_mus_eta = 0, reco_mus_phi = 0;

for(unsigned int im = 0 ; im < muonsLVec.size() ; im++)
{
if( fabs(muonsLVec[im].Eta()) < 2.4 && muonsRelIso[im] < 0.2 )
if( fabs(muonsLVec[im].Eta()) < 2.4 && muonsMiniIso[im] < 0.2 )
{
reco_mus_pt = ( muonsLVec.at(im) ).Pt();
reco_mus_eta = ( muonsLVec.at(im) ).Eta();
Expand Down Expand Up @@ -836,6 +850,7 @@ int main(int argc, char* argv[])
}//baseline_nolepveto
}

myAccRecoIsoEffs.printOverview();
myAccRecoIsoEffs.NormalizeFlowNumber();
myAccRecoIsoEffs.printNormalizeFlowNumber();

Expand Down Expand Up @@ -863,6 +878,8 @@ void AccRecoIsoEffs::printOverview()
std::cout << "nevents_sel_mus = " << nevents_sel_mus << std::endl;
std::cout << "nevents_sel_els = " << nevents_sel_els << std::endl;

std::cout << "nevents_cs_mus = "<< nevents_cs_mus << std::endl;

return ;
}

Expand Down
4 changes: 4 additions & 0 deletions Tool/LostLepton_MuCS_TTbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class AccRecoIsoEffs
int nevents_sel_base = 0;
int nevents_sel_mus = 0;
int nevents_sel_els = 0;
int nevents_cs_mus = 0;

//define acceptance, reco eff and iso eff to be calculated
double mus_acc = 0, els_acc = 0;
Expand Down Expand Up @@ -156,6 +157,7 @@ class BaseHistgram
TH1D *h_b_reco_nMuons, *h_b_reco_njets, *h_b_reco_nbjetsCSVM, *h_b_reco_bestTopMass, *h_b_reco_MET, *h_b_reco_jetpt2, *h_b_reco_jetpt4, *h_b_reco_jet1_met_phi_diff, *h_b_reco_jet2_met_phi_diff, *h_b_reco_jet3_met_phi_diff;
TH1D *h_b_deltaR_mus, *h_b_deltaR_els;
TH1D *h_b_activity_mus, *h_b_activity_els;
TH1D *h_b_jet_pt;

//closure plots definition
TH1D *h_pred_mu_iso_met, *h_pred_mu_iso_njets, *h_pred_mu_iso_mt2, *h_pred_mu_iso_topmass, *h_pred_mu_iso_ht, *h_pred_mu_iso_mht, *h_pred_mu_iso_ntopjets;
Expand Down Expand Up @@ -228,6 +230,8 @@ void BaseHistgram::BookHistgram(const char *outFileName)
h_b_activity_mus = new TH1D("h_b_activity_mus","",1000,0,200);
h_b_activity_els = new TH1D("h_b_activity_els","",1000,0,200);

h_b_jet_pt = new TH1D("h_b_jet_pt","",1000,0,200);

//start closure plots
h_pred_mu_iso_met = new TH1D("h_pred_mu_iso_met","",100,0,1000);
h_pred_mu_iso_njets = new TH1D("h_pred_mu_iso_njets","",20,0,20);
Expand Down
6 changes: 3 additions & 3 deletions Tool/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LDFLAGS =

LIBS = $(shell root-config --glibs)

PROGRAMS = tupleTest makePlots LostLepton_MuCS_TTbar LostLepton_ElCS_TTbar LostLepton_MuCS_SingleTop ClosurePlots
PROGRAMS = tupleTest LostLepton_MuCS_TTbar LostLepton_ElCS_TTbar LostLepton_MuCS_SingleTop ClosurePlots

all: $(PROGRAMS)

Expand All @@ -40,8 +40,8 @@ $(ODIR)/%.o : $(IDIR)/%.cc
tupleTest: $(ODIR)/NTupleReader.o $(ODIR)/tupleReadTest.o
$(LD) $^ $(LIBS) -o $@

makePlots: $(ODIR)/NTupleReader.o $(ODIR)/Plotter.o $(ODIR)/MakePlots.o
$(LD) $^ $(LIBS) -L .TupleDict_h.so -o $@
#makePlots: $(ODIR)/NTupleReader.o $(ODIR)/Plotter.o $(ODIR)/MakePlots.o
# $(LD) $^ $(LIBS) -L .TupleDict_h.so -o $@

LostLepton_MuCS_TTbar: $(ODIR)/LostLepton_MuCS_TTbar.o $(ODIR)/NTupleReader.o
$(LD) $^ $(LIBS) -L${CMSSW_BASE}/lib/${SCRAM_ARCH}/ -lrecipeAUXOxbridgeMT2 -o $@
Expand Down
2 changes: 1 addition & 1 deletion Tool/runList_ttbar_skimmed_flattree.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/uscms/home/hwei/work/stop/CMSSW_7_2_0/src/flattrees/stop_ttbar_skimmed_tree.root
/uscms/home/hwei/work/stop/CMSSW_7_2_0/src/flattrees/stop_ttbar_skimmed_tree_v1.root

0 comments on commit 744c8e9

Please sign in to comment.