Skip to content

Commit

Permalink
added alternative functions and binning to datacards/workspace genera…
Browse files Browse the repository at this point in the history
…tion

added batch-submission scripts for workspaces and limit calculation
updated to newest scale factors and uncertainties
  • Loading branch information
daniSchaefer committed May 2, 2017
1 parent 19d718f commit 95c8f97
Show file tree
Hide file tree
Showing 20 changed files with 551 additions and 257 deletions.
34 changes: 34 additions & 0 deletions CalcImpactPlots.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!bin/bash
masses=(1900)
#models=("WZ" "BulkWW" "BulkZZ" "ZprimeWW")
category=("WWHP") #"WWLP" "ZZHP" "ZZLP" "VVnew")
models=("BulkWW")
#category=("qVnew")

for mass in ${masses[@]}
do
for model in ${models[@]}
do
for c in ${category[@]}
do
#mass=1400
#model="WZ"
#cat="WZLP"
datacard="datacards/CMS_jj_${model}_${mass}_13TeV_CMS_jj_${c}.txt"
workspace="datacards/CMS_jj_${model}_${mass}_13TeV_CMS_jj_${c}.root"

text2workspace.py $datacard -m $mass

combineTool.py -M Impacts -d $workspace -m $mass --doInitialFit --robustFit 1

combineTool.py -M Impacts -d $workspace -m $mass --robustFit 1 --doFits

combineTool.py -M Impacts -d $workspace -m $mass -o impacts.json

plotImpacts.py -i impacts.json -o impacts

mv ./impacts.pdf Impacts_${model}_${mass}_${c}.pdf
done
done
done

27 changes: 19 additions & 8 deletions MiniTreeProducerVV13TeV.C
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,23 @@
normWeight = 1.;


string sInFile = "/shome/thaarres/EXOVVAnalysisRunII/LimitCode/CMSSW_7_1_5/src/DijetCombineLimitCode/input/JetHT_qV.root";
// string sInFile = "/shome/thaarres/EXOVVAnalysisRunII/LimitCode/CMSSW_7_1_5/src/DijetCombineLimitCode/input/JetHT_qV.root";
// string sInFile = "/shome/dschafer/ExoDiBosonAnalysis/results/ReRecoData_qVdijet.root";
string sInFile = "/shome/dschafer/ExoDiBosonAnalysis/results/ReRecoData_VVdijet.root";
//string sInFile = "/shome/dschafer/ExoDiBosonAnalysis/results/QCD_pythia8_VV_summer16.root";
cout << sInFile.c_str() << endl;
TFile file0(sInFile.c_str(), "read");


string sOutFile("MiniTrees/Data_qV_13TeV/dijetVV_13TeV_miniTree.root");
//string sOutFile("MiniTrees/Data_qV_13TeV/dijetqV_13TeV_miniTree.root");
string sOutFile("MiniTrees/Data_VV_13TeV/dijetVV_13TeV_miniTree_test.root");
int nCategorie = 8;
int maxCategorie = 14;
if (sInFile.find("VV")!=std::string::npos)
{
nCategorie = 0;
maxCategorie = 8;
}
TFile f1(sOutFile.c_str(), "recreate");
f1.cd();

Expand All @@ -24,9 +35,9 @@
TCVARS->Branch("normWeight",&normWeight,"normWeight/D");

TCVARS->Branch("categories",&categories,"categories/I");

for (int iCat = 8; iCat < 14; iCat++){
TH1D* hMass = (TH1D*) file0.Get("DijetMassHighPuriVV;1");
TH1D* hMass;
for (int iCat = nCategorie; iCat < maxCategorie; iCat++){
if (iCat ==0 ) hMass = (TH1D*) file0.Get("DijetMassHighPuriVV;1");
if (iCat == 1) hMass = (TH1D*) file0.Get("DijetMassLowPuriVV;1");

if (iCat == 2) hMass = (TH1D*) file0.Get("DijetMassHighPuriWW;1");
Expand Down Expand Up @@ -55,13 +66,13 @@
// if (iCat == 19) hMass = (TH1D*) file0.Get("DijetMassNoPuriqW;1");
// if (iCat == 20) hMass = (TH1D*) file0.Get("DijetMassNoPuriqZ;1");

std::cout<<"Histogram = " << hMass.GetName() << std::endl;
std::cout<<"Histogram = " << hMass->GetName() << " category " << iCat<< std::endl;
TAxis* Axis = hMass->GetXaxis();
std::cout << hMass->GetEntries() << std::endl;
for (int i = 1 ; i < hMass->GetNbinsX()+1; i++){
double N = abs(hMass->GetBinContent(i));

if (i%10 == 0) cout << "i = " << i << "N = " << N << " binCenter = " << hMass->GetBinCenter(i) << endl;

//if (i%10 == 0) cout << "i = " << i << "N = " << N << " binCenter = " << hMass->GetBinCenter(i) << endl;
mgg = Axis->GetBinCenter(i);

normWeight = N;
Expand Down
2 changes: 1 addition & 1 deletion MiniTreeSignalProducerVV13TeV.C
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

for (int iMass = 0; iMass<massrange; iMass++){

string sInFile = "input/" + inFile + "_13TeV_" + Form("OUT%dGeV.root", 1000+iMass*100);
string sInFile = "input/" + inFile + "_13TeV_" + Form("10k_OUT%dGeV.root", 1000+iMass*100);
cout << sInFile.c_str() << endl;
TFile file0(sInFile.c_str(), "read");

Expand Down
7 changes: 4 additions & 3 deletions MiniTreeSignalProducerqV13TeV.C
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@
if (iSample == 7) outFile = string("dijetVV_13TeV_ZprimeWW");
if (iSample == 8) outFile = string("dijetVV_13TeV_WZ");

int massrange=56;
int massrange=60;

for (int iMass = 0; iMass<massrange; iMass++){

string sInFile = "input/" + inFile + "_13TeV_" + Form("OUT%dGeV.root", 1000+iMass*100);
string sInFile = "input/" + inFile + "_13TeV_10k_" + Form("OUT%dGeV.root", 1000+iMass*100);
cout << sInFile.c_str() << endl;
TFile file0(sInFile.c_str(), "read");

string sOutFile = "MiniTrees/Signal_qV_13TeV/" + outFile + Form("OUT%d_miniTree.root", 1000+iMass*100);
TFile f1(sOutFile.c_str(), "recreate");
f1.cd();

std::cout << sOutFile << std::endl;
TTree *TCVARS = new TTree("TCVARS", "VV selection");
TCVARS->Branch("mgg13TeV",&mgg,"mgg/D");

Expand Down Expand Up @@ -71,6 +71,7 @@

TAxis* Axis = hMass->GetXaxis();
for (int i = 1 ; i < hMass->GetNbinsX()+1; i++){
//std::cout << " loop over mass bins " << i << std::endl;
//if (hMass->GetBinCenter(i) < dMass*0.75 || hMass->GetBinCenter(i) > dMass*1.25) continue;
int N = abs(hMass->GetBinContent(i));
if (i%1000 == 0) cout << "i = " << i << " N = " << N << endl;
Expand Down
Binary file modified MiniTrees/Data_VV_13TeV/dijetVV_13TeV_miniTree.root
Binary file not shown.
5 changes: 3 additions & 2 deletions ProduceWorkspaces13TeV.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os,sys,time

masses =[m*100 for m in range(11,11+1)]#45+1)]
masses =[m*100 for m in range(11,43+1)]#45+1)]
# masses =[m*100 for m in range(12,62+1)]
samples = [4] # 0==RS1WW/ZZ 2==W'/Z' 4==BulkG WW/ZZ 6==qW/qZ
altfunc = '\"alt\"'
for sample in samples:
for mass in masses:
channel = 1 # 1==VV 2==qV 3==No purity
Expand All @@ -16,7 +17,7 @@
if sample == 6:
sample1 = "qW"
sample2 = "qZ"
command = 'qsub -q short.q submitWorkspaceJobs.sh %i %i %i %s %s'%(mass,sample,channel,sample1, sample2)
command = 'qsub -q short.q submitWorkspaces.sh %i %i %i %s %s %s'%(mass,sample,channel,altfunc, sample1, sample2)
print command
os.system(command)

Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ python scripts/sb-fit-bkgonly.py //VV analysis
```

## Produce workspaces:
To interpolate signal MC, take as input .root files of signal MC. with 1 GeV binned histograms of dijet invariant mass (0-7000 GeV). Names of histograms are names of analysis category, eg. "DijetMassHighPuriWW".
To interpolate signal MC, take as input .root files of signal MC. with 1 GeV binned histograms of dijet invariant mass (0-7000 GeV). Names of histograms are names of analysis category, eg. "DijetMassHighPuriWW". Attention: here you should use rootfiles with lumiweights applied and not scaled to the dataluminosity. This scaling is done in the workspace generation so it would be double if we did it here also!
These scripts are designed to run on the PSI T3 batch system (qsub protocol)! Needs adaption to run on alternate systems.
Modify interpolateAll.py to signal sample and masspoints you wish to run on
```
python interpolateAll.py -> if you want to do them manually do: python interpolateVV13TeV.py input/ZprimeWW_13TeV_ 2100 GeV
-> in this file the names of the used histograms have to be adjusted to qV <-> VV etc. !
```
Create data and signal MC minitrees
```
Expand All @@ -37,12 +38,16 @@ root -l MiniTreeSignalProducerVV13TeV.C //VV analysis
```
Produce workspaces and datacards. Remember to change which signals and masspoints you wanna run over! Need to be available as minitrees!
```
when changing parameters of fit functions change them here: BkgModelFitBernstein
and also here: MakeBkgWS
and also change the paramters written as nuisance in the datacard here: MakeDataCard_1Channel
python ProduceWorkspaces13TeV.py
```
Implement JES/JER/JMS/JMR and xross section uncertanties
Implement JES/JER/JMS/JMR and cross section uncertanties
```
python implement-JESJMRsystematics.py
python implement-XsecUncertainty.py
python implement-tau21PtUnc.py
```
## Run limits:
To run limits you need to have datacards and workspaces produced as instructed above.
Expand Down
Loading

0 comments on commit 95c8f97

Please sign in to comment.