Skip to content

Commit

Permalink
Add EleMu-Loose
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminkreis committed Nov 26, 2018
1 parent d16349b commit fa2b7db
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 29 deletions.
Binary file added inputs/EleMuOSOFL_nSelectedAODCaloJetTag_GH.root
Binary file not shown.
1 change: 1 addition & 0 deletions inputs/cp.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cp ~/workspace/LLDJ/analyzer/nov7/LLDJ_slc6_530_CMSSW_8_0_26_patch1/src/LLDJstandalones/plots/mrtusDYsh/EleMuOSOF/GH/EleMuOSOF_nSelectedAODCaloJetTag_GH*.root .
cp ~/workspace/LLDJ/analyzer/nov7/LLDJ_slc6_530_CMSSW_8_0_26_patch1/src/LLDJstandalones/plots/mrtusDYsh/EleMuOSOFL/GH/EleMuOSOFL_nSelectedAODCaloJetTag_GH*.root .
cp ~/workspace/LLDJ/analyzer/nov7/LLDJ_slc6_530_CMSSW_8_0_26_patch1/src/LLDJstandalones/plots/mrtusDYsh/OnePho/GH/OnePho_nSelectedAODCaloJetTag_GH*.root .
cp ~/workspace/LLDJ/analyzer/nov7/LLDJ_slc6_530_CMSSW_8_0_26_patch1/src/LLDJstandalones/plots/mrtusDYsh/TwoMuZH/GH/TwoMuZH_nSelectedAODCaloJetTag_GH*.root .
cp ~/workspace/LLDJ/analyzer/nov7/LLDJ_slc6_530_CMSSW_8_0_26_patch1/src/LLDJstandalones/plots/mrtusDYsh/TwoEleZH/GH/TwoEleZH_nSelectedAODCaloJetTag_GH*.root .
Expand Down
8 changes: 8 additions & 0 deletions inputs/cpsb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cp ~/workspace/LLDJ/analyzer/nov7/LLDJ_slc6_530_CMSSW_8_0_26_patch1/src/LLDJstandalones/plots/mrtusDYsh/EleMuOSOF/GH/EleMuOSOF_nSelectedAODCaloJetTagSB*_GH*.root .
cp ~/workspace/LLDJ/analyzer/nov7/LLDJ_slc6_530_CMSSW_8_0_26_patch1/src/LLDJstandalones/plots/mrtusDYsh/EleMuOSOFL/GH/EleMuOSOFL_nSelectedAODCaloJetTagSB*_GH*.root .
cp ~/workspace/LLDJ/analyzer/nov7/LLDJ_slc6_530_CMSSW_8_0_26_patch1/src/LLDJstandalones/plots/mrtusDYsh/OnePho/GH/OnePho_nSelectedAODCaloJetTagSB*_GH*.root .
cp ~/workspace/LLDJ/analyzer/nov7/LLDJ_slc6_530_CMSSW_8_0_26_patch1/src/LLDJstandalones/plots/mrtusDYsh/TwoMuZH/GH/TwoMuZH_nSelectedAODCaloJetTagSB*_GH*.root .
cp ~/workspace/LLDJ/analyzer/nov7/LLDJ_slc6_530_CMSSW_8_0_26_patch1/src/LLDJstandalones/plots/mrtusDYsh/TwoEleZH/GH/TwoEleZH_nSelectedAODCaloJetTagSB*_GH*.root .
cp ~/workspace/LLDJ/analyzer/nov7/LLDJ_slc6_530_CMSSW_8_0_26_patch1/src/LLDJstandalones/plots/mrtusDYsh/TwoMuDY/GH/TwoMuDY_nSelectedAODCaloJetTagSB*_GH*.root .
cp ~/workspace/LLDJ/analyzer/nov7/LLDJ_slc6_530_CMSSW_8_0_26_patch1/src/LLDJstandalones/plots/mrtusDYsh/TwoEleDY/GH/TwoEleDY_nSelectedAODCaloJetTagSB*_GH*.root .

2 changes: 1 addition & 1 deletion model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build_ws()
.q
#combine data cards
combineCards.py EleMu=card_elemu.txt TwoMuDY=card_twomudy.txt TwoEleDY=card_twoeledy.txt TwoMuZH=card_twomuzh.txt TwoEleZH=card_twoelezh.txt > card.txt
combineCards.py EleMu=card_elemu.txt EleMuL=card_elemul.txt TwoMuDY=card_twomudy.txt TwoEleDY=card_twoeledy.txt TwoMuZH=card_twomuzh.txt TwoEleZH=card_twoelezh.txt > card.txt
#create final workspace
text2workspace.py card.txt
Expand Down
107 changes: 85 additions & 22 deletions model/build_ws.C
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void plot_syst(TH1F* h, TH1F* hu, TH1F* hd, TString name, bool doLog){
TString translate(TString in){
TString out = "";
if(in=="elemu") out = "EleMuOSOF";
else if(in == "elemul") out = "EleMuOSOFL";
else if(in == "twomuzh") out = "TwoMuZH";
else if(in == "twomudy") out = "TwoMuDY";
else if(in == "twoelezh") out = "TwoEleZH";
Expand Down Expand Up @@ -595,6 +596,67 @@ void build_elemu(RooWorkspace *wspace){
}


//---------------------------------------------------------------------------------------------------------------
//EleMu-Loose Region
//---------------------------------------------------------------------------------------------------------------
void build_elemul(RooWorkspace *wspace){

RooRealVar* ntags = wspace->var("ntags");
RooArgList vars(*ntags);


//Data
TFile* f_elemul = TFile::Open("../inputs/EleMuOSOFL_nSelectedAODCaloJetTag_GH.root", "READ");
TH1F* data_elemul_th1_file = (TH1F*)f_elemul->Get(data_string);
TH1F data_elemul_th1("data_obs_elemul","Data observed in EleMuL", 3, -0.5, 2.5);
data_elemul_th1.SetBinContent(1, data_elemul_th1_file->GetBinContent(1));
data_elemul_th1.SetBinContent(2, data_elemul_th1_file->GetBinContent(2));
data_elemul_th1.SetBinContent(3, data_elemul_th1_file->Integral(3,6));//assumes bin 6 is overflow TODO
RooDataHist data_elemul_hist("data_obs_elemul", "Data observed in EleMuL", vars, &data_elemul_th1);
wspace->import(data_elemul_hist);


//Light contamination
TH1F* light_elemul_th1_file = (TH1F*)f_elemul->Get("light");
TH1F light_elemul_th1("light_elemul","Light yield in EleMuL", 3, -0.5, 2.5);
light_elemul_th1.SetBinContent(1, light_elemul_th1_file->GetBinContent(1));
light_elemul_th1.SetBinContent(2, light_elemul_th1_file->GetBinContent(2));
light_elemul_th1.SetBinContent(3, light_elemul_th1_file->Integral(3,6));//assumes bin 6 is overflow TODO
RooDataHist light_elemul_hist("light_elemul", "Light yield in EleMuL", vars, &light_elemul_th1);
wspace->import(light_elemul_hist);


//Other contamination
TH1F* other_elemul_th1_file = (TH1F*)f_elemul->Get("other");
TH1F other_elemul_th1("other_elemul","Other yield in EleMuL", 3, -0.5, 2.5);
other_elemul_th1.SetBinContent(1, other_elemul_th1_file->GetBinContent(1));
other_elemul_th1.SetBinContent(2, other_elemul_th1_file->GetBinContent(2));
other_elemul_th1.SetBinContent(3, other_elemul_th1_file->Integral(3,6));//assumes bin 6 is overflow TODO
RooDataHist other_elemul_hist("other_elemul", "Other yield in EleMuL", vars, &other_elemul_th1);
wspace->import(other_elemul_hist);


//Heavy background
//Create one parameter per bin representing the yield
TH1F* h_heavy_elemul = (TH1F*)f_elemul->Get("heavy");
RooRealVar heavy_elemul_bin1("heavy_elemul_bin1", "Heavy background yield in EleMuL, bin 1",
h_heavy_elemul->GetBinContent(1), h_heavy_elemul->GetBinContent(1)*0.5,h_heavy_elemul->GetBinContent(1)*1.5 );
RooRealVar heavy_elemul_bin2("heavy_elemul_bin2", "Heavy background yield in EleMuL, bin 2",
h_heavy_elemul->GetBinContent(2), h_heavy_elemul->GetBinContent(2)*0.5,h_heavy_elemul->GetBinContent(2)*1.5 );
RooRealVar heavy_elemul_bin3("heavy_elemul_bin3", "Heavy background yield in EleMuL, bin 3",
h_heavy_elemul->GetBinContent(3), 0, 20);
RooArgList heavy_elemul_bins;
heavy_elemul_bins.add(heavy_elemul_bin1);
heavy_elemul_bins.add(heavy_elemul_bin2);
heavy_elemul_bins.add(heavy_elemul_bin3);
RooParametricHist p_heavy_elemul("heavy_elemul", "Heavy PDF in EleMuL Region", *ntags, heavy_elemul_bins, data_elemul_th1);
RooAddition p_heavy_elemul_norm("heavy_elemul_norm", "Total number of heavy events in EleMuL Region", heavy_elemul_bins);
wspace->import(p_heavy_elemul);
wspace->import(p_heavy_elemul_norm, RooFit::RecycleConflictNodes());

}


//---------------------------------------------------------------------------------------------------------------
//OnePho Region
//---------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -725,21 +787,21 @@ void build_twomudy(RooWorkspace* wspace){


//Get heavy
build_tf(wspace, "heavy", "elemu", "twomudy", sys_vec);
RooFormulaVar* tf_heavy_elemu_to_twomudy_bin1 = (RooFormulaVar*)wspace->arg("tf_heavy_elemu_to_twomudy_bin1");
RooFormulaVar* tf_heavy_elemu_to_twomudy_bin2 = (RooFormulaVar*)wspace->arg("tf_heavy_elemu_to_twomudy_bin2");
RooFormulaVar* tf_heavy_elemu_to_twomudy_bin3 = (RooFormulaVar*)wspace->arg("tf_heavy_elemu_to_twomudy_bin3");
build_tf(wspace, "heavy", "elemul", "twomudy", sys_vec);
RooFormulaVar* tf_heavy_elemul_to_twomudy_bin1 = (RooFormulaVar*)wspace->arg("tf_heavy_elemul_to_twomudy_bin1");
RooFormulaVar* tf_heavy_elemul_to_twomudy_bin2 = (RooFormulaVar*)wspace->arg("tf_heavy_elemul_to_twomudy_bin2");
RooFormulaVar* tf_heavy_elemul_to_twomudy_bin3 = (RooFormulaVar*)wspace->arg("tf_heavy_elemul_to_twomudy_bin3");

RooRealVar* heavy_elemu_bin1 = wspace->var("heavy_elemu_bin1");
RooRealVar* heavy_elemu_bin2 = wspace->var("heavy_elemu_bin2");
RooRealVar* heavy_elemu_bin3 = wspace->var("heavy_elemu_bin3");
RooRealVar* heavy_elemul_bin1 = wspace->var("heavy_elemul_bin1");
RooRealVar* heavy_elemul_bin2 = wspace->var("heavy_elemul_bin2");
RooRealVar* heavy_elemul_bin3 = wspace->var("heavy_elemul_bin3");

RooFormulaVar heavy_twomudy_bin1("heavy_twomudy_bin1", "Heavy background yield in TwoMuDY, bin 1",
"@0*@1", RooArgList(*tf_heavy_elemu_to_twomudy_bin1, *heavy_elemu_bin1));
"@0*@1", RooArgList(*tf_heavy_elemul_to_twomudy_bin1, *heavy_elemul_bin1));
RooFormulaVar heavy_twomudy_bin2("heavy_twomudy_bin2", "Heavy background yield in TwoMuDY, bin 2",
"@0*@1", RooArgList(*tf_heavy_elemu_to_twomudy_bin2, *heavy_elemu_bin2));
"@0*@1", RooArgList(*tf_heavy_elemul_to_twomudy_bin2, *heavy_elemul_bin2));
RooFormulaVar heavy_twomudy_bin3("heavy_twomudy_bin3", "Heavy background yield in TwoMuDY, bin 3",
"@0*@1", RooArgList(*tf_heavy_elemu_to_twomudy_bin3, *heavy_elemu_bin3));
"@0*@1", RooArgList(*tf_heavy_elemul_to_twomudy_bin3, *heavy_elemul_bin3));

RooArgList heavy_twomudy_bins;
heavy_twomudy_bins.add(heavy_twomudy_bin1);
Expand Down Expand Up @@ -814,21 +876,21 @@ void build_twoeledy(RooWorkspace* wspace){


//Get heavy
RooRealVar* heavy_elemu_bin1 = wspace->var("heavy_elemu_bin1");
RooRealVar* heavy_elemu_bin2 = wspace->var("heavy_elemu_bin2");
RooRealVar* heavy_elemu_bin3 = wspace->var("heavy_elemu_bin3");

build_tf(wspace, "heavy", "elemu", "twoeledy", sys_vec);
RooFormulaVar* tf_heavy_elemu_to_twoeledy_bin1 = (RooFormulaVar*)wspace->arg("tf_heavy_elemu_to_twoeledy_bin1");
RooFormulaVar* tf_heavy_elemu_to_twoeledy_bin2 = (RooFormulaVar*)wspace->arg("tf_heavy_elemu_to_twoeledy_bin2");
RooFormulaVar* tf_heavy_elemu_to_twoeledy_bin3 = (RooFormulaVar*)wspace->arg("tf_heavy_elemu_to_twoeledy_bin3");
RooRealVar* heavy_elemul_bin1 = wspace->var("heavy_elemul_bin1");
RooRealVar* heavy_elemul_bin2 = wspace->var("heavy_elemul_bin2");
RooRealVar* heavy_elemul_bin3 = wspace->var("heavy_elemul_bin3");

build_tf(wspace, "heavy", "elemul", "twoeledy", sys_vec);
RooFormulaVar* tf_heavy_elemul_to_twoeledy_bin1 = (RooFormulaVar*)wspace->arg("tf_heavy_elemul_to_twoeledy_bin1");
RooFormulaVar* tf_heavy_elemul_to_twoeledy_bin2 = (RooFormulaVar*)wspace->arg("tf_heavy_elemul_to_twoeledy_bin2");
RooFormulaVar* tf_heavy_elemul_to_twoeledy_bin3 = (RooFormulaVar*)wspace->arg("tf_heavy_elemul_to_twoeledy_bin3");

RooFormulaVar heavy_twoeledy_bin1("heavy_twoeledy_bin1", "Heavy background yield in TwoEleDY, bin 1",
"@0*@1", RooArgList(*tf_heavy_elemu_to_twoeledy_bin1, *heavy_elemu_bin1));
"@0*@1", RooArgList(*tf_heavy_elemul_to_twoeledy_bin1, *heavy_elemul_bin1));
RooFormulaVar heavy_twoeledy_bin2("heavy_twoeledy_bin2", "Heavy background yield in TwoEleDY, bin 2",
"@0*@1", RooArgList(*tf_heavy_elemu_to_twoeledy_bin2, *heavy_elemu_bin2));
"@0*@1", RooArgList(*tf_heavy_elemul_to_twoeledy_bin2, *heavy_elemul_bin2));
RooFormulaVar heavy_twoeledy_bin3("heavy_twoeledy_bin3", "Heavy background yield in TwoEleDY, bin 3",
"@0*@1", RooArgList(*tf_heavy_elemu_to_twoeledy_bin3, *heavy_elemu_bin3));
"@0*@1", RooArgList(*tf_heavy_elemul_to_twoeledy_bin3, *heavy_elemul_bin3));

RooArgList heavy_twoeledy_bins;
heavy_twoeledy_bins.add(heavy_twoeledy_bin1);
Expand Down Expand Up @@ -883,8 +945,9 @@ void build_ws(){
//build_onepho(wspace);
//build_twomuzh(wspace);

//ZH+EleMu+DY top-nontop-other-signal
//ZH+EleMu+EleMuL+DY top-nontop-other-signal
build_elemu(wspace);
build_elemul(wspace);
build_twomudy(wspace);
build_twoeledy(wspace);
build_twomuzh(wspace, "DY");
Expand Down
32 changes: 32 additions & 0 deletions model/card_elemul.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
EleMuL Datacard

imax * number of bins
jmax * number of processes minus 1
kmax * number of nuisance parameters

-------------------------------------------------------------------------------------------------------------------------------------------

#shapes process channel file histogram [histogram_with_systematics]

shapes data_obs elemul param_ws.root wspace:data_obs_elemul
shapes heavy elemul param_ws.root wspace:heavy_elemul
shapes light elemul param_ws.root wspace:light_elemul
shapes other elemul param_ws.root wspace:other_elemul

-------------------------------------------------------------------------------------------------------------------------------------------

bin elemul
observation -1
-------------------------------------------------------------------------------------------------------------------------------------------
# background rate must be taken from _norm param x 1
bin elemul elemul elemul
process heavy light other
process 1 2 3
rate 1 -1 -1
-------------------------------------------------------------------------------------------------------------------------------------------
#uncertainties
-------------------------------------------------------------------------------------------------------------------------------------------
#free floating parameters
heavy_elemul_bin1 flatParam
heavy_elemul_bin2 flatParam
heavy_elemul_bin3 flatParam
6 changes: 3 additions & 3 deletions model/card_twoeledy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ rate 1 1 -1 -1
#uncertainties
-------------------------------------------------------------------------------------------------------------------------------------------
#free floating parameters
rrv_heavy_elemu_to_twoeledy_bin1 param 0 1
rrv_heavy_elemu_to_twoeledy_bin2 param 0 1
rrv_heavy_elemu_to_twoeledy_bin3 param 0 1
rrv_heavy_elemul_to_twoeledy_bin1 param 0 1
rrv_heavy_elemul_to_twoeledy_bin2 param 0 1
rrv_heavy_elemul_to_twoeledy_bin3 param 0 1
light_twoeledy_bin1 flatParam
light_twoeledy_bin2 flatParam
light_twoeledy_bin3 flatParam
6 changes: 3 additions & 3 deletions model/card_twomudy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ rate 1 1 -1 -1
#uncertainties
-------------------------------------------------------------------------------------------------------------------------------------------
#free floating parameters
rrv_heavy_elemu_to_twomudy_bin1 param 0 1
rrv_heavy_elemu_to_twomudy_bin2 param 0 1
rrv_heavy_elemu_to_twomudy_bin3 param 0 1
rrv_heavy_elemul_to_twomudy_bin1 param 0 1
rrv_heavy_elemul_to_twomudy_bin2 param 0 1
rrv_heavy_elemul_to_twomudy_bin3 param 0 1
light_twomudy_bin1 flatParam
light_twomudy_bin2 flatParam
light_twomudy_bin3 flatParam
Expand Down

0 comments on commit fa2b7db

Please sign in to comment.