Skip to content

Commit

Permalink
fix gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
cmorgoth committed Jul 28, 2019
2 parents 5450e8f + 95587bb commit d98f326
Show file tree
Hide file tree
Showing 6 changed files with 869 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
*.o
*.so
*.root
*.pdf
*.C

28 changes: 25 additions & 3 deletions plotting/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,49 @@ REPO = $(shell git rev-parse --show-toplevel)/plotting
COMMON = $(shell git rev-parse --show-toplevel)/common

CPPFLAGS := $(shell root-config --cflags) -I$(REPO)/include -I$(COMMON)/include -I$(CMSSW_INC)/src
LDFLAGS := $(shell root-config --glibs) $(STDLIBDIR) -lRooFit -lRooFitCore -L$(CMSSW_INC)/lib/slc6_amd64_gcc530/ -lHiggsAnalysisCombinedLimit
#LDFLAGS := $(shell root-config --glibs) $(STDLIBDIR) -lRooFit -lRooFitCore -L$(CMSSW_INC)/lib/slc6_amd64_gcc530/ -lHiggsAnalysisCombinedLimit
LDFLAGS := $(shell root-config --glibs) $(STDLIBDIR) -lRooFit -lRooFitCore -L$(CMSSW_INC)/lib/slc6_amd64_gcc530/

CPPFLAGS += -g -std=c++1y

TARGET = PlotLimits
TARGET2 = PlotVR
TARGET3 = GetExtraSysUnc

SRC = $(REPO)/app/plot_limits.cc $(COMMON)/src/CommandLineInput.cc
SRC2 = $(REPO)/app/plot_validation_region.cc $(REPO)/src/helper_functions.cc $(COMMON)/src/CommandLineInput.cc
SRC3 = $(REPO)/app/get_extra_sys_unc.cc $(REPO)/src/helper_functions.cc $(COMMON)/src/CommandLineInput.cc

OBJ = $(SRC:.cc=.o)
OBJ2 = $(SRC2:.cc=.o)
OBJ3 = $(SRC3:.cc=.o)

all : $(TARGET)
all : $(TARGET) $(TARGET2) $(TARGET3)

$(TARGET) : $(OBJ)
$(LD) $(CPPFLAGS) -o $(TARGET) $(OBJ) $(LDFLAGS)
@echo $@
@echo $<
@echo $^

$(TARGET2) : $(OBJ2)
$(LD) $(CPPFLAGS) -o $(TARGET2) $(OBJ2) $(LDFLAGS)
@echo $@
@echo $<
@echo $^


$(TARGET3) : $(OBJ3)
$(LD) $(CPPFLAGS) -o $(TARGET3) $(OBJ3) $(LDFLAGS)
@echo $@
@echo $<
@echo $^


%.o : %.cc
$(CXX) $(CPPFLAGS) -o $@ -c $<
@echo $@
@echo $<

clean :
rm -f *.o app/*.o src/*.o include/*.o $(TARGET) *~
rm -f *.o app/*.o src/*.o include/*.o $(TARGET) $(TARGET2) $(TARGET3) *~
152 changes: 152 additions & 0 deletions plotting/app/get_extra_sys_unc.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
//C++
#include <iostream>
#include <fstream>
#include <map>
#include <stdlib.h>
#include <utility>
//ROOT
#include <TFile.h>
#include <TH1F.h>
#include <TTree.h>
#include <TGraph.h>
#include <TGraphErrors.h>
#include <TGraphAsymmErrors.h>
#include <TAxis.h>
#include <TCanvas.h>
#include <TStyle.h>
#include <TLatex.h>
#include <TLegend.h>
//LOCAL INCLUDES
#include <CommandLineInput.hh>
#include <helper_functions.hh>

const bool _info = true;
const bool _debug = false;

bool AddCMS( TCanvas* C );

int main( int argc, char** argv )
{

//-----------------
//Input File List
//-----------------
std::string inputList = ParseCommandLine( argc, argv, "-inputList=" );
if ( inputList == "" )
{
std::cerr << "[ERROR]: please provide an inputList. Use --inputList=" << std::endl;
return -1;
}
//std::ifstream ifs ( inputList.c_str(), std::ifstream::in );//input file list

//----------------------
//validation region name
//----------------------
//std::string vrName = ParseCommandLine( argc, argv, "-vrName=" );
//if ( vrName == "" )
//{
// std::cerr << "[ERROR]: please provide validation region name. Use --vrName=" << std::endl;
// return -1;
//}


if( _info )
{
std::cout << "[INFO]: input file: " << inputList << std::endl;
//std::cout << "[INFO]: validation region name: " << vrName << std::endl;
}

//--------------------------------
//Array with bin extra uncertainty
//--------------------------------
double err_ee[] = {0.0, 0.0, 0.0};
double err_mumu[] = {0.0, 0.0, 0.0};

TFile* fin;
std::ifstream ifs ( inputList.c_str(), std::ifstream::in);
if (ifs.is_open())
{
while (ifs.good())
{
std::string current_fname;
ifs >> current_fname;
if (ifs.eof()) break;
//-----------------
//Getting ROOT file
//-----------------
fin = new TFile( current_fname.c_str(), "READ");
//----------------------------------------------------------
//GETTING POST-FIT RESULTS FROM COMBINE
//----------------------------------------------------------
//---------------------
//TwoEleZH
//---------------------
TDirectory* dir_postfit_two_ee_zh = (TDirectory*)(((TDirectory*)fin->Get("shapes_fit_b"))->Get("TwoEleZH"));
TH1F* bkg_total_two_ee_zh_pf = (TH1F*)dir_postfit_two_ee_zh->Get("total_background");
TGraphAsymmErrors* data_two_ee_zh_pf = (TGraphAsymmErrors*)dir_postfit_two_ee_zh->Get("data");
for( unsigned int i = 1; i <= bkg_total_two_ee_zh_pf->GetNbinsX(); i++ )
{
//data treatment
double y_data, x_data;
data_two_ee_zh_pf->GetPoint(i-1, x_data, y_data);
//relative difference
double delta_y = y_data - bkg_total_two_ee_zh_pf->GetBinContent(i);
double delta_y_rel = delta_y/bkg_total_two_ee_zh_pf->GetBinContent(i);
double y_unc = bkg_total_two_ee_zh_pf->GetBinError(i);

if( fabs( delta_y ) > 2.*y_unc && y_data != 0.0 )
{
std::cout << "ee->"<< i-1 << " " << delta_y_rel<< std::endl;
err_ee[i-1] += pow(delta_y_rel,2.0);
}
}


//---------------------
//TwoMuZH
//---------------------
TDirectory* dir_postfit_two_mumu_zh = (TDirectory*)(((TDirectory*)fin->Get("shapes_fit_b"))->Get("TwoMuZH"));
TH1F* bkg_total_two_mumu_zh_pf = (TH1F*)dir_postfit_two_mumu_zh->Get("total_background");
TGraphAsymmErrors* data_two_mumu_zh_pf = (TGraphAsymmErrors*)dir_postfit_two_mumu_zh->Get("data");
for( unsigned int i = 1; i <= bkg_total_two_mumu_zh_pf->GetNbinsX(); i++ )
{
//data treatment
double y_data, x_data;
data_two_mumu_zh_pf->GetPoint(i-1, x_data, y_data);
//relative difference
double delta_y = y_data - bkg_total_two_mumu_zh_pf->GetBinContent(i);
double delta_y_rel = delta_y/bkg_total_two_mumu_zh_pf->GetBinContent(i);
double y_unc = bkg_total_two_mumu_zh_pf->GetBinError(i);
//std::cout << i-1 << " " << delta_y_rel<< std::endl;
if( fabs( delta_y ) > 2.*y_unc && y_data != 0.0 )
{
std::cout << "mumu->"<< i-1 << " " << delta_y_rel<< std::endl;
err_mumu[i-1] += pow(delta_y_rel,2.0);
}
}


//Close current root file
fin->Close();
}
}
else {
// show message:
std::cerr << "[ERROR]: Error opening file: " << inputList << std::endl;
std::cout << "Exiting program!!!" << std::endl;
return -1;
}

//--------------------
//ee extra uncertainty
//--------------------
std::cout << "ee extra_unc bins (0,1,2) is: (" << sqrt(err_ee[0]) << ", "
<< sqrt(err_ee[1]) << ", " << sqrt(err_ee[2]) << ")"<< std::endl;
//----------------------
//mumu extra uncertainty
//----------------------
std::cout << "mumu extra_unc bins (0,1,2) is: (" << sqrt(err_mumu[0]) << ", "
<< sqrt(err_mumu[1]) << ", " << sqrt(err_mumu[2]) << ")"<< std::endl;

return 0;
}
Loading

0 comments on commit d98f326

Please sign in to comment.