11 #include "TDirectory.h" 13 #include "utilities.hh" 14 #include "cross_sections.hh" 18 int main(
int argc,
char *argv[]){
19 time_t begtime, endtime;
23 cout<<
"Format: ./run/change_xsec.exe infile <outfolder>"<<endl;
28 TString infile(
"/net/cms2/cms2r0/babymaker/babies/2016_02_09/mc/T2tt/baby_SMS-T2tt_mGluino-550_mLSP-375_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_RunIISpring15FSPremix-MCRUN2_74_V9-v1_renorm.root"),
outfolder(
"new_stops");
29 if(argc>=2) infile = argv[1];
30 if(argc>=3) outfolder=argv[2];
31 if(!outfolder.EndsWith(
"/")) outfolder.Append(
"/");
32 gSystem->mkdir(outfolder, kTRUE);
34 TString
folder(infile), file(infile);
36 file.Remove(0, file.Last(
'/')+1);
39 TString mstop_s(infile);
40 mstop_s.Remove(0,mstop_s.Index(
"ino-")+4);
41 mstop_s.Remove(mstop_s.Index(
'_'), mstop_s.Length());
42 int mstop(mstop_s.Atoi());
43 TString mlsp_s(infile);
44 mlsp_s.Remove(0,mlsp_s.Index(
"LSP-")+4);
45 mlsp_s.Remove(mlsp_s.Index(
'_'), mlsp_s.Length());
46 int mlsp(mlsp_s.Atoi());
47 TString stop_lsp =
"mGluino-"+mstop_s+
"_mLSP-"+mlsp_s;
50 float xsecOri, xsecNew, exsec;
53 for(
int mstopNew = mstop+25; mstopNew <= 1500; mstopNew += 25){
55 TString factorXsec(
"*"); factorXsec += xsecNew/xsecOri;
56 cout<<
"mstop "<<mstop<<
", xsecOri "<<xsecOri<<
", new stop "<<mstopNew<<
", xsecNew "<<xsecNew<<
", factor "<<factorXsec<<endl;
57 TString newname = file;
58 TString stopNew_lsp =
"mGluino-"+to_string(mstopNew)+
"_mLSP-"+to_string(mlsp+mstopNew-mstop);
59 newname.ReplaceAll(stop_lsp, stopNew_lsp);
60 vector<TString> var_types({
"float",
"float"}), vars({
"weight",
"w_lumi"}), var_vals({factorXsec, factorXsec});
62 cout<<
"Saved "<<outfolder<<newname<<endl;
66 int seconds = difftime(endtime, begtime);
67 cout<<endl<<
"Took "<<seconds<<
" seconds ("<<
hoursMinSec(seconds)<<
") "<<endl<<endl;
TString hoursMinSec(long seconds)
void stopCrossSection(int stop_mass, float &xsec, float &xsec_unc)
int change_branch_one(TString indir, TString name, TString outdir, std::vector< TString > var_type, std::vector< TString > var, std::vector< std::vector< TString > > var_val, int totentries)
int main(int argc, char *argv[])