67 using namespace KM3NETDAQ;
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();
97 JManager<string, TH1D> manager (
new TH1D(
"%", NULL, NUMBER_OF_FILES, -0.5, NUMBER_OF_FILES - 0.5));
98 JManager<string, TH1D> summaryManager(
new TH1D(
"%", NULL, NUMBER_OF_FILES, -0.5, NUMBER_OF_FILES - 0.5));
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());
145 summaryManager[
MAKE_STRING(t.parameter)]->Fill(
c , t.value);
147 manager[
MAKE_STRING((*key).Data())]->GetYaxis()->SetTitle(t.parameter.c_str());
154 TFile* out =
new TFile(outputFileRoot.c_str(),
"recreate");
160 ifstream infile(steeringFile);
166 while (
getline(infile, line)) {
167 while (line.length()==0)
169 tests.push_back(line);
170 istringstream iss(line);
172 map[
d[id]->getTestName()]++;
176 summary.open (outputFileTxt);
178 for (
typename JManager < string , TH1D >::const_iterator i = summaryManager.begin() ; i != summaryManager.end() ; ++i){
181 i->second->Scale(1./n);
182 summary <<
"File_ID\t" << i->first <<
"\t" << i->first +
"(ERROR)\t" << endl;
183 cout <<
"File_ID\t" << i->first <<
"\t" << i->first +
"(ERROR)\t" << endl;
185 for (
int bin=1 ; bin<i->second->GetNbinsX() ; ++bin){
186 i->second->SetBinError(bin,quantiles[name][bin].getSTDev()/sqrt(n));
187 summary << i->second->GetXaxis()->GetBinLabel(bin) <<
"\t" << i->second->GetBinContent(bin) <<
"\t" << i->second->GetBinError(bin) << endl;
188 cout << i->second->GetXaxis()->GetBinLabel(bin) <<
"\t" << i->second->GetBinContent(bin) <<
"\t" << i->second->GetBinError(bin) << endl;
194 for (
typename JManager < string , TH1D >::const_iterator i = manager.begin() ; i != manager.end() ; ++i){
196 string fullpath =
MAKE_STRING(i->second->GetName());
197 string path =
MAKE_STRING(fullpath.substr (fullpath.find (
'/') + 1 , fullpath.rfind (
'/')));
199 if (out->GetDirectory(path.c_str()) == 0) out->mkdir(path.c_str());
200 out->cd(path.c_str());
202 i -> second -> SetName(
MAKE_CSTRING(fullpath.substr (fullpath.rfind (
'/') + 1)));
204 for (
int bin=0 ; bin<i->second->GetNbinsX()+1 ; ++bin){i->second->SetBinError(bin,0.0);}
205 i -> second -> Write();
Utility class to parse command line options.
then usage $script[< detector identifier >< run range >]< QA/QCfile > nExample script to produce data quality plots nWhen a detector identifier and run range are data are downloaded from the database nand subsequently stored in the given QA QC file
then echo Enter input within $TIMEOUT_S seconds echo n User name
o $QUALITY_ROOT d $DEBUG!CHECK_EXIT_CODE JPlot1D f
#define MAKE_CSTRING(A)
Make C-string.
then fatal Wrong number of arguments fi JConvertDetectorFormat a o
#define MAKE_STRING(A)
Make string.
boost::property_tree::ptree parse(std::string str)
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
$WORKDIR driver txt done cat $WORKDIR driver txt<< EOFprocess ${DATAFILTER}$FILTER_HOST csh-c '(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&(JDataFilter-H\$SERVER\$-M\$LOGGER\$-d $DEBUG-u ${DATAFILTER}-P $PORT</dev/null > &/dev/null &))';process ${DATAWRITER}$WRITER_HOST csh-c '(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&(JDataWriter-H\$SERVER\$-M\$LOGGER\$-d $DEBUG-u ${DATAWRITER}</dev/null > &/dev/null &))';print enterevent ev_init{RC_CMD}event ev_reset{RC_CMD}event ev_init{RC_CMD}event ev_configure{RC_DFLTR%<$WORKDIR/ev_configure_datafilter.txt > RC_DQSIM<$WORKDIR/ev_configure_dqsimulator.txt > RC_DWRT path
$WORKDIR ev_configure_dqsimulator txt echo process $DQ_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DQ_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
void readDir(TDirectory *dir, std::vector< TString > &v)