18 #include "TDirectory.h" 30 int main(
int argc,
char *argv[]){
37 string model =
"T1tttt";
48 string glu_lsp(
"mGluino-"+to_string(mglu)+
"_mLSP-"+to_string(mlsp));
54 ostringstream command;
55 string done =
" < /dev/null &> /dev/null; ";
61 <<
"export origdir=$(pwd); " 62 <<
"cd ~/cmssw/CMSSW_7_4_14/src; " 63 <<
"eval `scramv1 runtime -sh`; " 65 <<
"ln -s $(readlink -f " <<
file_name <<
") " << workdir << done
66 <<
"ln -s $(readlink -f " << up_file_name <<
") " << workdir << done
67 <<
"ln -s $(readlink -f " << down_file_name <<
") " << workdir << done
68 <<
"cd " << workdir << done
70 <<
"combine -M Asymptotic --run observed --name Up " <<
GetBaseName(up_file_name) << done
71 <<
"combine -M Asymptotic --run observed --name Down " <<
GetBaseName(down_file_name) << done;
74 <<
"combine -M ProfileLikelihood --significance --expectSignal=1 --verbose=999999 --rMin=-10. --uncapped=1 " <<
GetBaseName(
file_name)
75 <<
" < /dev/null &> signif_obs.log; " 76 <<
"combine -M ProfileLikelihood --significance --expectSignal=1 -t -1 --verbose=999999 --rMin=-10. --uncapped=1 " <<
GetBaseName(
file_name)
77 <<
" < /dev/null &> signif_exp.log; ";
82 string limits_file_name = workdir+
"/higgsCombineTest.Asymptotic.mH120.root";
83 TFile limits_file(limits_file_name.c_str(),
"read");
84 if(!limits_file.IsOpen())
ERROR(
"Could not open limits file "+limits_file_name);
85 TTree *tree =
static_cast<TTree*
>(limits_file.Get(
"limit"));
86 if(tree ==
nullptr)
ERROR(
"Could not get limits tree");
88 tree->SetBranchAddress(
"limit", &limit);
89 int num_entries = tree->GetEntries();
90 if(num_entries != 6)
ERROR(
"Expected 6 tree entries. Saw "+to_string(num_entries));
92 double exp_down =
limit;
96 double exp_up =
limit;
101 string up_limits_file_name = workdir+
"/higgsCombineUp.Asymptotic.mH120.root";
102 TFile up_limits_file(up_limits_file_name.c_str(),
"read");
103 if(!up_limits_file.IsOpen())
ERROR(
"No \"up\" file "+up_limits_file_name);
104 tree =
static_cast<TTree*
>(up_limits_file.Get(
"limit"));
105 if(tree ==
nullptr)
ERROR(
"Could not get \"up\" limits tree");
106 tree->SetBranchAddress(
"limit", &limit);
107 num_entries = tree->GetEntries();
108 if(num_entries != 1)
ERROR(
"Expected 1 \"up\" tree entry. Saw "+to_string(num_entries));
110 double obs_up =
limit;
111 up_limits_file.Close();
113 string down_limits_file_name = workdir+
"/higgsCombineDown.Asymptotic.mH120.root";
114 TFile down_limits_file(down_limits_file_name.c_str(),
"read");
115 if(!down_limits_file.IsOpen())
ERROR(
"No \"down\" file "+down_limits_file_name);
116 tree =
static_cast<TTree*
>(down_limits_file.Get(
"limit"));
117 if(tree ==
nullptr)
ERROR(
"Could not get \"down\" limits tree");
118 tree->SetBranchAddress(
"limit", &limit);
119 num_entries = tree->GetEntries();
120 if(num_entries != 1)
ERROR(
"Expected 1 \"down\" tree entry. Saw "+to_string(num_entries));
122 double obs_down =
limit;
123 down_limits_file.Close();
125 double sig_obs, sig_exp;
127 sig_obs =
GetSignif(workdir+
"/signif_obs.log");
128 sig_exp =
GetSignif(workdir+
"/signif_exp.log");
134 << setprecision(numeric_limits<double>::max_digits10)
151 string txtname(workdir+
"/limits_"+model+
"_"+glu_lsp+
".txt");
152 ofstream txtfile(txtname);
154 << setprecision(numeric_limits<double>::max_digits10)
174 ifstream file(filename);
176 while(getline(file, line)){
177 auto pos = line.find(
"Significance: ");
178 if(pos != 0)
continue;
179 string val = line.substr(14);
186 auto pos = path.rfind(
"/");
187 if(pos == string::npos){
190 return path.substr(pos+1);
195 auto pos = results.find(key);
196 if(pos != string::npos){
198 istringstream iss(results.substr(pos));
209 static struct option long_options[] = {
210 {
"filename", required_argument, 0,
'f'},
211 {
"signif", required_argument, 0,
's'},
217 opt = getopt_long(argc, argv,
"f:s", long_options, &option_index);
218 if( opt == -1)
break;
229 cerr <<
"Bad option! getopt_long returned character code " <<
static_cast<int>(opt) << endl;
double ExtractNumber(const string &results, const string &key)
string GetBaseName(const string &path)
void parseMasses(const std::string &str, int &mglu, int &mlsp)
void ReplaceAll(std::string &str, const std::string &orig, const std::string &rep)
void stopCrossSection(int stop_mass, float &xsec, float &xsec_unc)
bool Contains(const std::string &str, const std::string &pat)
std::string execute(const std::string &cmd)
void GetOptions(int argc, char *argv[])
void signalCrossSection(int glu_mass, float &xsec, float &xsec_unc)
double GetSignif(const string &filename)
int main(int argc, char *argv[])
std::string MakeDir(std::string prefix)