37 TIter iter(dir->GetListOfKeys());
39 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
43 dir->cd(key->GetName());
44 TDirectory *subdir = gDirectory;
49 const TString fullPath(dir->GetPath());
50 TObjArray* t = fullPath.Tokenize(
":");
51 v.push_back(TString(((TObjString *)(t->At(1)))->String() +
"/" + (TString)key->GetName()));
63 int main(
int argc,
char **argv)
71 string outputFileRoot;
79 JParser<> zap(
"Auxiliary application to plot PMT parameters.");
81 zap[
'f'] =
make_field(inputFile,
"JCompare output files");
82 zap[
's'] =
make_field(steeringFile,
"JCompare steering file");
83 zap[
'o'] =
make_field(outputFileRoot,
"output file.") =
"out.root";
84 zap[
't'] =
make_field(outputFileTxt,
"output file.") =
"out.txt";
85 zap[
'r'] =
make_field(regexp,
"regular expresion to extract bin labels for the x-axis") =
" ";
86 zap[
'L'] =
make_field(labelInterval,
"interval between x-axis bins for which labels are shown") = 1;
91 catch(
const exception &error) {
92 FATAL(error.what() << endl);
95 const int NUMBER_OF_FILES = inputFile.size();
102 const int n = (NUMBER_OF_FILES < labelInterval) ? 1 : labelInterval;
104 const TPRegexp buffer(regexp);
106 for (
int i = 0; i != NUMBER_OF_FILES; ++i){
109 manager->GetXaxis()->SetBinLabel(i+1 ,
parse(buffer , TString(inputFile[i].c_str())));
110 summaryManager->GetXaxis()->SetBinLabel(i+1 ,
parse(buffer , TString(inputFile[i].c_str())));
112 manager->GetXaxis()->SetBinLabel(i+1 ,
" ");
113 summaryManager->GetXaxis()->SetBinLabel(i+1 ,
" ");
124 if (TFile::Open((*file).c_str()) == NULL) {
125 ERROR(
"File: " << *file <<
" not opened." << endl);
129 TFile* f = TFile::Open((*file).c_str());
138 if(!(
dynamic_cast<TH1*
>(o) == NULL) || !(
dynamic_cast<TH2*
>(o) == NULL)){
140 istringstream iss(o->GetTitle());
155 TFile* out =
new TFile(outputFileRoot.c_str(),
"recreate");
161 ifstream infile(steeringFile);
167 while (
getline(infile, line)) {
168 while (line.length()==0)
170 tests.push_back(line);
171 istringstream iss(line);
173 map[d[id]->getTestName()]++;
177 summary.open (outputFileTxt);
182 i->second->Scale(1./
n);
183 summary <<
"File_ID\t" << i->first <<
"\t" << i->first +
"(ERROR)\t" << endl;
184 cout <<
"File_ID\t" << i->first <<
"\t" << i->first +
"(ERROR)\t" << endl;
186 for (
int bin=1 ; bin<i->second->GetNbinsX() ; ++bin){
187 i->second->SetBinError(bin,quantiles[name][bin].getSTDev()/sqrt(
n));
188 summary << i->second->GetXaxis()->GetBinLabel(bin) <<
"\t" << i->second->GetBinContent(bin) <<
"\t" << i->second->GetBinError(bin) << endl;
189 cout << i->second->GetXaxis()->GetBinLabel(bin) <<
"\t" << i->second->GetBinContent(bin) <<
"\t" << i->second->GetBinError(bin) << endl;
197 string fullpath =
MAKE_STRING(i->second->GetName());
198 string path =
MAKE_STRING(fullpath.substr (fullpath.find (
'/') + 1 , fullpath.rfind (
'/')));
200 if (out->GetDirectory(path.c_str()) == 0) out->mkdir(path.c_str());
201 out->cd(path.c_str());
203 i -> second -> SetName(
MAKE_CSTRING(fullpath.substr (fullpath.rfind (
'/') + 1)));
205 for (
int bin=0 ; bin<i->second->GetNbinsX()+1 ; ++bin){i->second->SetBinError(bin,0.0);}
206 i -> second -> Write();
KM3NeT DAQ constants, bit handling, etc.
Data structure for detector geometry and calibration.
Dynamic ROOT object management.
General purpose messaging.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int main(int argc, char **argv)
void readDir(TDirectory *dir, std::vector< TString > &v)
I/O formatting auxiliaries.
#define MAKE_CSTRING(A)
Make C-string.
#define MAKE_STRING(A)
Make string.
Class dedicated to standardize the title of the graphical objects produced by the JTest_t() derived c...
std::string parameterName
Dictionary to map different tests to unique integer indices.
Utility class to parse command line options.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
boost::property_tree::ptree parse(std::string str)