120 |
|
return tempdirectory.substr(0,ichar); |
121 |
|
} |
122 |
|
} |
123 |
+ |
return "TOPDIRFAILURE"; |
124 |
|
} |
125 |
|
|
126 |
|
template < typename CHAR_TYPE, |
280 |
|
dout << " PUBLIC MODE " << endl; |
281 |
|
} |
282 |
|
time_t rawtime; |
282 |
– |
struct tm * timeinfo; |
283 |
|
time ( &rawtime ); |
284 |
|
dout << " Analysis run on " << asctime (localtime ( &rawtime )); |
285 |
|
dout << "____________________________________________________________" << endl; |
298 |
|
if(basedir.substr(0,1)=="/") basedir=basedir.substr(1,basedir.length()-1); |
299 |
|
if(basedir.substr(basedir.length()-1,1)!="/") basedir+="/"; |
300 |
|
char currentpath[1024]; |
301 |
< |
char *path = getcwd(currentpath,1024); |
301 |
> |
getcwd(currentpath,1024); |
302 |
|
PlottingSetup::basedirectory=(string)currentpath+"/Plots/"+basedir; |
303 |
|
ensure_directory_exists(PlottingSetup::basedirectory); |
304 |
|
initialize_log(); |
323 |
|
string extract_root_dir(string name) { |
324 |
|
int position = -1; |
325 |
|
if(name.substr(0,1)=="/") name=name.substr(1,name.length()-1); |
326 |
< |
for(int ipos=0;ipos<name.length();ipos++) { |
326 |
> |
for(int ipos=0;ipos<(int)name.length();ipos++) { |
327 |
|
if(name.substr(ipos,1)=="/") position=ipos; |
328 |
|
} |
329 |
|
if(position==-1) return ""; |
333 |
|
string extract_root_filename(string name) { |
334 |
|
int position = -1; |
335 |
|
if(name.substr(0,1)=="/") name=name.substr(1,name.length()-1); |
336 |
< |
for(int ipos=0;ipos<name.length();ipos++) { |
336 |
> |
for(int ipos=0;ipos<(int)name.length();ipos++) { |
337 |
|
if(name.substr(ipos,1)=="/") position=ipos; |
338 |
|
} |
339 |
|
return name.substr(position+1,name.length()-position-1); |
416 |
|
int currwidth=entry.size(); |
417 |
|
while(currwidth<width) { |
418 |
|
entry=" "+entry; |
419 |
< |
if(entry.size()<width) entry=entry+" "; |
419 |
> |
if((int)entry.size()<width) entry=entry+" "; |
420 |
|
currwidth=entry.size(); |
421 |
|
} |
422 |
|
bool do_special=false; |
430 |
|
void make_nice_table(vector<vector <string> > &entries) { |
431 |
|
int ncolumns=write_first_line(entries); |
432 |
|
int cellwidth=(int)(((float)(60-(ncolumns+1)))/(ncolumns)); |
433 |
< |
for(int iline=0;iline<entries.size();iline++) { |
433 |
> |
for(int iline=0;iline<(int)entries.size();iline++) { |
434 |
|
vector<string> currline = entries[iline]; |
435 |
|
dout << " |"; |
436 |
< |
for(int ientry=0;ientry<currline.size();ientry++) { |
436 |
> |
for(int ientry=0;ientry<(int)currline.size();ientry++) { |
437 |
|
write_entry(currline[ientry],cellwidth); |
438 |
|
} |
439 |
|
dout << endl; |
445 |
|
void make_nice_jzb_table(vector<vector <string> > &entries) { |
446 |
|
int ncolumns=write_first_line(entries); |
447 |
|
int cellwidth=(int)(((float)(60-(ncolumns+1)))/(ncolumns)); |
448 |
< |
for(int iline=0;iline<entries.size();iline++) { |
448 |
> |
for(int iline=0;iline<(int)entries.size();iline++) { |
449 |
|
vector<string> currline = entries[iline]; |
450 |
|
dout << " |"; |
451 |
< |
for(int ientry=0;ientry<currline.size();ientry++) { |
451 |
> |
for(int ientry=0;ientry<(int)currline.size();ientry++) { |
452 |
|
write_entry(currline[ientry],cellwidth,iline,ientry); |
453 |
|
} |
454 |
|
dout << endl; |
599 |
|
bincontent[i]=0; |
600 |
|
errors[i]=0; |
601 |
|
} |
602 |
< |
float currlimit=binning[0]; |
602 |
> |
// float currlimit=binning[0]; |
603 |
|
int currtoplim=1; |
604 |
|
for(int ibin=1;ibin<=histo->GetNbinsX();ibin++) |
605 |
|
{ |
637 |
|
int absJZBbinsNumber = binning.size()-1; |
638 |
|
TGraphAsymmErrors* graph = new TGraphAsymmErrors(absJZBbinsNumber); |
639 |
|
|
640 |
< |
for(unsigned int i=0;i<absJZBbinsNumber;i++) |
640 |
> |
for(int i=0;i<absJZBbinsNumber;i++) |
641 |
|
{ |
642 |
|
float xCenter=h1->GetBinCenter(i+1); |
643 |
|
float xWidth=(h1->GetBinWidth(i+1))*0.5; |
749 |
|
int paranthesis_open=0; |
750 |
|
int substr_start=0; |
751 |
|
string currchar=""; |
752 |
< |
for (int ichar=0;ichar<incut.length();ichar++) |
752 |
> |
for (int ichar=0;ichar<(int)incut.length();ichar++) |
753 |
|
{ |
754 |
|
currchar=incut.substr(ichar,1); |
755 |
|
// if(currchar=="(") paranthesis_open++; |
762 |
|
partvector.push_back(incut.substr(substr_start,incut.length()-substr_start)); |
763 |
|
if(Verbosity>1) { |
764 |
|
dout << "[ splitupcut() ] : The cut vector now contains the following elements: "<< endl; |
765 |
< |
for (int ipart=0;ipart<partvector.size();ipart++) |
765 |
> |
for (int ipart=0;ipart<(int)partvector.size();ipart++) |
766 |
|
{ |
767 |
|
dout << " - " << partvector[ipart] << endl; |
768 |
|
} |
771 |
|
|
772 |
|
int atleastvalue(string expression, int &morethanlessthan) // takes in an expression such as ">2" or ">=3" and returns e.g. 3 (in both examples) |
773 |
|
{ |
774 |
< |
int retval=0; |
774 |
> |
// int retval=0; |
775 |
|
if(expression.substr(0,1)==">"&&expression.substr(1,1)=="=") { |
776 |
|
// dout << "The expression " << expression << " is saying that we have at least " << atoi(expression.substr(2,1).c_str()) << " jets" << endl; |
777 |
|
morethanlessthan=1; |
797 |
|
morethanlessthan=-1; |
798 |
|
return 1+atoi(expression.substr(2,1).c_str()); |
799 |
|
} |
800 |
+ |
|
801 |
+ |
return -1234567; |
802 |
|
} |
803 |
|
|
804 |
|
int do_jet_cut(string incut, int *nJets) { |
834 |
|
dout << "Is of type >" << endl; |
835 |
|
return 0; |
836 |
|
} |
837 |
+ |
return -12345; |
838 |
|
} |
839 |
|
|
840 |
|
string interpret_cut(string incut, bool &isJetCut, int *permittednJets) |
900 |
|
int finalJetCut=-1; |
901 |
|
int permittednJets[20]; |
902 |
|
for(int ijet=0;ijet<20;ijet++) permittednJets[ijet]=1; |
903 |
< |
int morethanlessthan=0;//-1: less than, 0: exactly, 1: more than |
904 |
< |
for(int icut=0;icut<cutparts.size();icut++) |
903 |
> |
// int morethanlessthan=0;//-1: less than, 0: exactly, 1: more than |
904 |
> |
for(int icut=0;icut<(int)cutparts.size();icut++) |
905 |
|
{ |
906 |
|
if(icut==0) nicecut<<interpret_cut(cutparts[icut],isJetCut,permittednJets); |
907 |
|
else { |
966 |
|
histo->SetTitle(histoname.str().c_str()); |
967 |
|
histo->SetName(histoname.str().c_str()); |
968 |
|
int nbins=histo->GetNbinsX(); |
969 |
< |
float low=histo->GetBinLowEdge(1); |
970 |
< |
float hi=histo->GetBinLowEdge(histo->GetNbinsX())+histo->GetBinWidth(histo->GetNbinsX()); |
969 |
> |
// float low=histo->GetBinLowEdge(1); |
970 |
> |
// float hi=histo->GetBinLowEdge(histo->GetNbinsX())+histo->GetBinWidth(histo->GetNbinsX()); |
971 |
|
|
972 |
|
for(int i=0;i<=nbins;i++) { |
973 |
|
histo->SetBinContent(i,(f1->Integral(histo->GetBinLowEdge(i),histo->GetBinLowEdge(i)+histo->GetBinWidth(i)))/histo->GetBinWidth(i)); |
1336 |
|
|
1337 |
|
Double_t chi2; |
1338 |
|
Int_t ndf,igood; |
1339 |
< |
Double_t res=0.0; |
1339 |
> |
// Double_t res=0.0; |
1340 |
|
Double_t chi2prob = MarcosChi2TestX(nominator,denominator,chi2,ndf,igood,"UW"); |
1341 |
|
|
1342 |
|
stringstream Chi2text; |
1432 |
|
vector<string> results; |
1433 |
|
|
1434 |
|
int cutAt; |
1435 |
< |
while( (cutAt = str.find_first_of(delim)) != str.npos ) |
1435 |
> |
while( (cutAt = str.find_first_of(delim)) != (int)str.npos ) |
1436 |
|
{ |
1437 |
|
if(cutAt > 0) |
1438 |
|
{ |
1449 |
|
|
1450 |
|
void manually_set_jzb_cuts(vector<float> &jzb_cut,string jzbcut_string) { |
1451 |
|
vector<string> jzbcutvector = StringSplit(jzbcut_string,","); |
1452 |
< |
for(int i=0;i<jzbcutvector.size();i++) { |
1452 |
> |
for(int i=0;i<(int)jzbcutvector.size();i++) { |
1453 |
|
jzb_cut.push_back(atoi(jzbcutvector[i].c_str())); |
1454 |
|
dout << "Added a JZB cut manually at " << atoi(jzbcutvector[i].c_str()) << endl; |
1455 |
|
} |
1463 |
|
dp = opendir (directory); |
1464 |
|
if (dp != NULL) |
1465 |
|
{ |
1466 |
< |
while (ep = readdir (dp)) |
1466 |
> |
while ((ep = readdir (dp))) |
1467 |
|
{ |
1468 |
|
string filename=(string)ep->d_name; |
1469 |
< |
if(filename.find(".root")!=-1) |
1469 |
> |
if((int)filename.find(".root")!=-1) |
1470 |
|
{ |
1471 |
|
files.push_back(string(directory)+filename); |
1472 |
|
} |
1553 |
|
} |
1554 |
|
|
1555 |
|
float generalizedpSTAR(float massmother, float massdaughter1, float massdaughter2) { |
1553 |
– |
float mz=91.2; |
1556 |
|
float res=((massmother*massmother)-(massdaughter1+massdaughter2)*(massdaughter1+massdaughter2)); |
1557 |
|
res*=((massmother*massmother)-(massdaughter1-massdaughter2)*(massdaughter1-massdaughter2)); |
1558 |
|
res=TMath::Sqrt(res)/(2*massmother); |