Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
54 return s.find(
regex )!=std::string::npos;
60 TList*
list = tnd->GetListOfKeys();
63 for (
int i=0 ;
i<
list->GetSize() ;
i++ ) {
65 std::string
name(
list->At(
i)->GetName() );
67 TKey* tobj = (TKey*)
list->At(
i);
71 if (
contains( tobj->GetClassName(),
"TH1" ) ) {
79 std::string nname =
name+
"_n";
84 for (
int j=0 ; j<
list->GetSize() ; j++ ) {
86 const std::string
name(
list->At(j)->GetName() );
93 std::cout <<
"Efficiency " <<
eff->GetName() << std::endl;
104 eff->Write(
"",TObject::kOverwrite);
124 if ( tnd==0 )
return false;
126 static const std::string token[6] = {
"1d",
"2d",
"mean",
"sigma",
"chi2",
"fractional uncertainty" };
127 bool found[6] = {
false,
false,
false,
false,
false,
false };
133 TList*
list = tnd->GetListOfKeys();
136 for (
int i=0 ;
i<
list->GetSize() ;
i++ ) {
138 std::string
name(
list->At(
i )->GetName() );
142 for (
int j=0 ; j<6 ; j++ ) {
144 if (
name == token[j] ) {
154 std::cout <<
"Resplot count " <<
count <<
" " << tnd->GetName() << std::endl;
156 if (
count == 6 )
return true;
166 void search(TDirectory* td=0,
const std::string&
s=
"") {
182 if (
ns!=
"" )
ns +=
"/";
189 std::cout <<
"\n" <<
depth <<
"Directory " <<
ns;
192 std::string savedepth =
depth;
205 for (
int i=
tl->GetSize() ;
i-- ; ) {
207 TKey* tobj = (TKey*)
tl->At(
i);
209 if ( tobj==0 )
continue;
215 if ( std::string(tobj->GetClassName()).find(
"TDirectory")!=std::string::npos ) {
218 TDirectory* tnd = (TDirectory*)tobj->ReadObj();
228 std::cout <<
"Resplot refitting " << tnd->GetName() << std::endl;
231 std::cout <<
"deleting ..." << std::endl;
232 gDirectory->Delete( (std::string(tnd->GetName())+
";1").c_str() );
234 std::cout <<
"refitting ..." << std::endl;
238 std::cout <<
"writing ..." << std::endl;
264 std::cout <<
"\tprocessed directory in " <<
t*0.001 <<
" s from " << global_time*0.001 <<
" s";
283 if ( FILE* testfile=fopen(
s.c_str(),
"r") ) {
298 std::cout <<
"processing" << std::endl;
302 std::cerr <<
"output file " <<
outputfile <<
" already exists" << std::endl;
306 std::cout <<
"copying file to " <<
outputfile << std::endl;
315 std::cout <<
"opening root files" << std::endl;
318 std::cout <<
"opening " <<
inputfile << std::endl;
326 std::cerr <<
"cannot open " <<
outputfile.c_str() << std::endl;
342 std::cout <<
"closing the files" << std::endl;
355 s <<
"Usage: " <<
argv[0] <<
" [OPTIONS] -o output.root input.root \n\n";
356 s <<
" -o filename \toutput filename (required)\n";
357 s <<
" -h, --help \tdisplay this help\n";
360 s <<
"refit:usage() no arguments!\n";
374 for (
int i=1 ;
i<
argc ;
i++ ) {
383 for (
int i=1 ;
i<
argc ;
i++ ) {
384 if ( std::string(
argv[
i])==
"--verbose" )
verbose =
true;
385 else if ( std::string(
argv[
i])==
"-o" ) {
409 if (
verbose ) std::cout <<
"timing" << std::endl;
417 std::cout <<
"\ntotal time " <<
t*0.001 <<
" s (" << (
t*0.001/60) <<
" min)" << std::endl;
struct timeval simpletimer_start(void)
void cost(const std::string &inputfile, const std::string &outputfile)
bool contains(const std::string &s, const std::string ®ex)
does a string contain the substring
std::string depth
tag string for intendation
struct timeval global_timer
glabal timer - how long have I taken so far?
void search(TDirectory *td=0, const std::string &s="")
recursive directory search for TH1 and TH2
bool file_exists(const std::string &s)
static TF1 * FitNull95(TH1D *s, double a=0, double b=0)
std::pair< std::vector< unsigned int >, bool > res
bool handleEfficiency(TDirectory *tnd)
int usage(std::ostream &s, int argc, char **argv)
std::vector< TFile * > fptr
file names and file pointers
int main(int argc, char **argv)
double simpletimer_stop(const struct timeval &start_time)
bool isResplot(TDirectory *tnd)
int ir
counter of the current depth
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)