3 |
|
#include <sys/stat.h> |
4 |
|
#include <fstream> |
5 |
|
#include <pthread.h> |
6 |
+ |
#include <assert.h> |
7 |
|
|
8 |
|
#include <TCut.h> |
9 |
|
#include <TROOT.h> |
78 |
|
|
79 |
|
bool initialized_t2=false; |
80 |
|
|
81 |
+ |
int srmcpretries=0; |
82 |
+ |
|
83 |
|
void load_scan_sample(int a, int b, int &scanfileindex,bool ismSUGRA) { |
84 |
|
dout << "Going to load file with Xzone=" << a << " and Yzone=" << b << endl; |
85 |
|
stringstream filetoload; |
125 |
|
delete_any_cached_scans(); |
126 |
|
dout << "Going to download the scan file with the following copy command: " << copyfile.str() << endl; |
127 |
|
gSystem->Exec(copyfile.str().c_str()); |
128 |
< |
scansample.AddSample(newfilename.str(),"scansample",1,1,false,true,scanfileindex,kRed); |
128 |
> |
if(doesROOTFileExist(newfilename.str())) { |
129 |
> |
scansample.AddSample(newfilename.str(),"scansample",1,1,false,true,scanfileindex,kRed); |
130 |
> |
} else { |
131 |
> |
srmcpretries++; |
132 |
> |
if(srmcpretries<5) { |
133 |
> |
dout << "The file could not be loaded correctly - retrying!" << endl; |
134 |
> |
load_scan_sample(a,b,scanfileindex,ismSUGRA); |
135 |
> |
} else { |
136 |
> |
dout << "Have tried 5 times to load this sample. Giving up now and failing the program execution" << endl; |
137 |
> |
assert(0); |
138 |
> |
dout << "The command " << copyfile.str() << " failed to copy the file to the local storage (saving it as " << newfilename.str() << ")" << endl; |
139 |
> |
} |
140 |
> |
} |
141 |
|
} |
142 |
|
} else { |
143 |
|
dout << "Last sample is the same as the current one. Recycling it." << endl; |