38   return object.ReadLine(in);
 
   50   return out << 
object.Data();
 
   63 inline TString 
replace(
const TString& target, 
const TRegexp& regexp, 
const T& replacement)
 
   68   TString buffer = target;
 
   70   if ((pos = buffer.Index(regexp, &len)) != -1) {
 
   72     TSubString substr = buffer(pos, len);
 
   74     TString    format(substr.Data(), substr.Length());
 
   76     format.ReplaceAll(
"T", 
"s");
 
   78     buffer.Replace(pos, len, TString::Format(format.Data(), replacement));
 
   95 int main(
int argc, 
char **argv)
 
  107     JParser<> zap(
"Auxiliary program to print result from ROOT objects."\
 
  108                   "\nNote that the formula may contain method names of the specified object.");
 
  110     zap[
'f'] = 
make_field(inputFile,  
"<input file>:<object name>");
 
  112     zap[
'O'] = 
make_field(option,     
"format, e.g. \"%s %T %f\","\
 
  113                           "\nwhere '%s', '%T' and '%f' will be replaced by name, title and value(s) from formula(s), respectively")  = 
"";
 
  118   catch(
const exception &error) {
 
  119     FATAL(error.what() << endl);
 
  123   const TRegexp 
STRING(
"%[+-]?[0-9]*s");
 
  124   const TRegexp TITLE (
"%[+-]?[0-9]*T");
 
  125   const TRegexp DOUBLE(
"%[+-]?[0-9]*\\.?[0-9]*f");
 
  130     DEBUG(
"Input: " << *input << endl);
 
  135       ERROR(
"File: " << input->getFullFilename() << 
" not opened." << endl);
 
  139     const TRegexp regexp(input->getObjectName());
 
  141     TIter iter(dir->GetListOfKeys());
 
  143     for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
 
  145       const TString tag(key->GetName());
 
  147       DEBUG(
"Key: " << tag << 
" match = " << tag.Contains(regexp) << endl);
 
  151       if (tag.Contains(regexp) && 
isTObject(key)) {
 
  153         TObject* 
object = key->ReadObj();
 
  159             TString buffer = option;
 
  161             buffer = 
replace(buffer, STRING, object->GetName());
 
  162             buffer = 
replace(buffer, TITLE,  object->GetTitle());
 
  168               if (buffer.Contains(DOUBLE)){
 
  170                 buffer = 
replace(buffer, DOUBLE, value);
 
  174                 if (
i != formula.begin()) {
 
  178                 buffer.Append(TString::Format(
"%20.10e", value));
 
  181             cout << buffer << endl;
 
Utility class to parse command line options. 
int main(int argc, char *argv[])
TString replace(const TString &target, const TRegexp ®exp, const T &replacement)
Replace regular expression in input by given replacement. 
clean eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY set_variable STRING
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
I/O formatting auxiliaries. 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
Double_t getResult(const TString &text, TObject *object=NULL)
Get result of given textual formula. 
do set_variable OUTPUT_DIRECTORY $WORKDIR T
General purpose messaging. 
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input. 
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Utility class to parse command line options. 
bool isTObject(const TKey *key)
Check if given key corresponds to a TObject. 
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer. 
Auxiliary data structure for floating point format specification. 
#define DEBUG(A)
Message macros.