1 #ifndef __JROOT__JROOTTOOLKIT__ 
    2 #define __JROOT__JROOTTOOLKIT__ 
   12 #include "TObjString.h" 
   17 #include "TStreamerInfo.h" 
   19 #include "TIterator.h" 
   24 #include "TGraphErrors.h" 
   26 #include "TGraph2DErrors.h" 
   27 #include "TMultiGraph.h" 
   44 namespace JPP { 
using namespace JROOT; }
 
   72     return T::Class_Name();
 
   87       object->SetDirectory(0);
 
  109     if (
object != NULL) {
 
  112         for (
int i = 0; 
i != 
object->GetN(); ++
i) {
 
  113           object->SetPoint(
i, 0.0, 0.0);
 
  133     if (
object != NULL) {
 
  137         for (
int i = 0; 
i != 
object->GetN(); ++
i) {
 
  138           object->SetPoint     (
i, 0.0, 0.0);
 
  139           object->SetPointError(
i, 0.0, 0.0);
 
  159     if (
object != NULL) {
 
  162         for (
int i = 0; 
i != 
object->GetN(); ++
i) {
 
  163           object->SetPoint(
i, 0.0, 0.0, 0.0);
 
  183     if (
object != NULL) {
 
  186         for (
int i = 0; 
i != 
object->GetN(); ++
i) {
 
  187           object->SetPoint     (
i, 0.0, 0.0, 0.0);
 
  188           object->SetPointError(
i, 0.0, 0.0, 0.0);
 
  208     if (
object != NULL) {
 
  214         TIter next(object->GetListOfGraphs());
 
  216         while (TGraph* graph = (TGraph*)next()) {
 
  244     if (
object != NULL) {
 
  246       object->SetDirectory(0);
 
  270     const Int_t 
n = g1->GetN();
 
  273     g1->SetPoint(n, x, y);
 
  290     const Int_t 
n = g1->GetN();
 
  293     g1->SetPoint(n, x, y, z);
 
  312     const Int_t 
n = g1->GetN();
 
  315     g1->SetPoint(n, x, y);
 
  316     g1->SetPointError(n, ex, ey);
 
  339     const Int_t 
n = g1->GetN();
 
  342     g1->SetPoint(n, x, y, z);
 
  343     g1->SetPointError(n, ex, ey, ez);
 
  356     file.WriteTObject(&
object);
 
  372     if (file != NULL && file->IsOpen()) {
 
  374       const TString buffer(name);
 
  376       TIter iter(file->GetStreamerInfoList());
 
  378       for (
const TStreamerInfo* pStreamerInfo; (pStreamerInfo = (TStreamerInfo*) iter.Next()) != NULL; ) {
 
  379         if (buffer == TString(pStreamerInfo->GetName())) {
 
  380           return pStreamerInfo;
 
  417     if (pStreamerInfo != NULL)
 
  418       return pStreamerInfo->GetClassVersion();
 
  450   inline TString 
parse(
const TPRegexp& regexp, 
const TString& 
string, 
const int index = 1) 
 
  452     TPRegexp   buffer = regexp;
 
  453     TObjArray* array  = buffer.MatchS(
string);
 
  456     if (index - 1 < array->GetLast()) {
 
  457       result = ((TObjString*) array->At(index))->GetName();
 
  486                     const Double_t 
value) :
 
  498     inline operator Int_t()
 const 
  517     if (parameter.
index >= 0 && parameter.
index < f1.GetNpar()) {
 
  519       f1.SetParameter(parameter.
index, parameter.
value);
 
  538     if (parameter.
index >= 0 && parameter.
index < f1.GetNpar()) {
 
  540       f1.FixParameter(parameter.
index, parameter.
value);
 
  559     if (index >= 0 && index < f1.GetNpar()) {
 
  561       f1.ReleaseParameter(index);
 
  584     if (index >= 0 && index < f1.GetNpar()) {
 
  586       if (xmin == 0.0) { xmin = -numeric_limits<Double_t>::min(); }
 
  587       if (xmax == 0.0) { xmax = +numeric_limits<Double_t>::min(); }
 
  589       f1.SetParLimits(index, xmin, xmax);
 
  608     if (index >= 0 && index < f1.GetNpar()) {
 
  613       f1.GetParLimits(index, xmin, xmax);
 
  615       return (xmin != 0.0 && xmax != 0.0 && xmin >= xmax);
 
  648     const TRegexp DOUBLE(
"[0-9.][eE][+-0-9]");
 
  650     string buffer = (
const char*) text;
 
  652     for (string::size_type pos = 0; pos != buffer.size(); ) {
 
  654       if (isalpha(buffer[pos]) || buffer[pos] == 
'_') {
 
  656         string::size_type len = 1;
 
  658         while (pos + len != buffer.size() && (isalnum(buffer[pos+len]) || buffer[pos+len] == 
'_' || buffer[pos+len] == 
'.')) {
 
  662         if (len != 1 || pos == 0 || TString(buffer.substr(pos-1).c_str()).Index(DOUBLE) != 0) {
 
  671           buffer.replace(pos, len, os.str());
 
  673           pos += os.str().size();
 
  682     return TFormula(
"/tmp", buffer.c_str()).Eval(0.0);
 
  700     const int N = h1.GetNbinsX();
 
  704     for (
int i = 0; 
i < 
N; 
i++) {
 
  705       x[
i] = h1.GetBinCenter (
i + 1);
 
  706       y[
i] = h1.GetBinContent(
i + 1);
 
  709     return new TGraph(N, &
x[0], &y[0]);
 
  724     switch (projection) {
 
  728       return h2.ProjectionX(
"_px", h2.GetYaxis()->FindBin(xmin), h2.GetYaxis()->FindBin(xmax));
 
  732       return h2.ProjectionY(
"_py", h2.GetXaxis()->FindBin(xmin), h2.GetXaxis()->FindBin(xmax));
 
  753     object = TRegexp(buffer.c_str());
 
  767 inline std::ostream& 
operator<<(std::ostream& out, 
const TRegexp& 
object)
 
JFitParameter_t(const Int_t index, const Double_t value)
Constructor. 
 
void AddPoint(TGraph *g1, const Double_t x, const Double_t y)
Add point to TGraph. 
 
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
 
bool releaseParameter(TF1 &f1, const Int_t index)
Release fit parameter. 
 
Print objects in ASCII format using ROOT dictionary. 
 
JFitParameter_t()
Default constructor. 
 
then echo Enter input within $TIMEOUT_S seconds echo n User name
 
int getStreamerVersion(TFile *file, const char *const name)
Get ROOT streamer version of class with given name. 
 
const TStreamerInfo * getStreamerInfo(TFile *file, const char *const name)
Get ROOT streamer information of class with given name. 
 
Auxiliary class for a type holder. 
 
bool resetObject(JManager< JKey_t, JValue_t > *object, const bool reset=false)
Reset JManager object. 
 
bool isParameterFixed(const TF1 &f1, const Int_t index)
Check if fit parameter is fixed. 
 
boost::property_tree::ptree parse(std::string str)
 
const JPolynome f1(1.0, 2.0, 3.0)
Function. 
 
Auxiliary data structure for a parameter index and its value. 
 
TFile * getFile() const 
Get file. 
 
I/O formatting auxiliaries. 
 
Double_t getResult(const TString &text, TObject *object=NULL)
Get result of given textual formula. 
 
bool setParameter(TF1 &f1, const JFitParameter_t ¶meter)
Set fit parameter. 
 
do set_variable OUTPUT_DIRECTORY $WORKDIR T
 
static void print(JRootWriter &writer, const JRootWritableClass &cls)
Write class contents to output. 
 
bool setParLimits(TF1 &f1, const Int_t index, Double_t xmin, Double_t xmax)
Set fit parameter limits. 
 
TGraph * histogramToGraph(const TH1 &h1)
Helper method to convert a 1D histogram to a graph. 
 
Type definition of ROOT based dictionary for ASCII I/O. 
 
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input. 
 
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
 
static data_type & getInstance()
Get unique instance of template class. 
 
bool fixParameter(TF1 &f1, const JFitParameter_t ¶meter)
Fix fit parameter. 
 
const char * getName()
Get ROOT name of given data type. 
 
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
 
TH1 * projectHistogram(const TH2 &h2, const Double_t xmin, const Double_t xmax, const char projection)
Helper method for ROOT histogram projections. 
 
Double_t g1(const Double_t x)
Function.