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" 
   41 namespace JPP { 
using namespace JROOT; }
 
   69     return T::Class_Name();
 
   84       object->SetDirectory(0);
 
  106     if (
object != NULL) {
 
  109         for (
int i = 0; i != 
object->GetN(); ++i) {
 
  110           object->SetPoint(i, 0.0, 0.0);
 
  130     if (
object != NULL) {
 
  134         for (
int i = 0; i != 
object->GetN(); ++i) {
 
  135           object->SetPoint     (i, 0.0, 0.0);
 
  136           object->SetPointError(i, 0.0, 0.0);
 
  156     if (
object != NULL) {
 
  159         for (
int i = 0; i != 
object->GetN(); ++i) {
 
  160           object->SetPoint(i, 0.0, 0.0, 0.0);
 
  180     if (
object != NULL) {
 
  183         for (
int i = 0; i != 
object->GetN(); ++i) {
 
  184           object->SetPoint     (i, 0.0, 0.0, 0.0);
 
  185           object->SetPointError(i, 0.0, 0.0, 0.0);
 
  205     if (
object != NULL) {
 
  211         TIter next(object->GetListOfGraphs());
 
  213         while (TGraph* graph = (TGraph*)next()) {
 
  215           if        (graph->InheritsFrom(TGraph2DErrors::Class())) {
 
  217             status = (
resetObject(dynamic_cast<TGraph2DErrors*>(graph), 
reset) ? status : 
false);
 
  219           } 
else if (graph->InheritsFrom(TGraph2D::Class()))       {
 
  221             status = (
resetObject(dynamic_cast<TGraph2D*>(graph), 
reset) ? status : 
false);
 
  223           } 
else if (graph->InheritsFrom(TGraphErrors::Class()))    {
 
  225             status = (
resetObject(dynamic_cast<TGraphErrors*>(graph), 
reset) ? status : 
false);
 
  250     if (
object != NULL) {
 
  252       object->SetDirectory(0);
 
  276     const Int_t 
n = g1->GetN();
 
  279     g1->SetPoint(n, x, y);
 
  296     const Int_t 
n = g1->GetN();
 
  299     g1->SetPoint(n, x, y, z);
 
  318     const Int_t 
n = g1->GetN();
 
  321     g1->SetPoint(n, x, y);
 
  322     g1->SetPointError(n, ex, ey);
 
  345     const Int_t 
n = g1->GetN();
 
  348     g1->SetPoint(n, x, y, z);
 
  349     g1->SetPointError(n, ex, ey, ez);
 
  362     file.WriteTObject(&
object);
 
  378     if (file != NULL && file->IsOpen()) {
 
  380       const TString buffer(name);
 
  382       TIter iter(file->GetStreamerInfoList());
 
  384       for (
const TStreamerInfo* pStreamerInfo; (pStreamerInfo = (TStreamerInfo*) iter.Next()) != NULL; ) {
 
  385         if (buffer == TString(pStreamerInfo->GetName())) {
 
  386           return pStreamerInfo;
 
  423     if (pStreamerInfo != NULL)
 
  424       return pStreamerInfo->GetClassVersion();
 
  456   inline TString 
parse(
const TPRegexp& regexp, 
const TString& 
string, 
const int index = 1) 
 
  458     TPRegexp   buffer = regexp;
 
  459     TObjArray* array  = buffer.MatchS(
string);
 
  461     if (index - 1 < array->GetLast())
 
  462       return ((TObjString*) array->At(index))->GetName();
 
  488                     const Double_t 
value) :
 
  500     inline operator Int_t()
 const 
  519     if (parameter.
index >= 0 && parameter.
index < f1.GetNpar()) {
 
  521       f1.SetParameter(parameter.
index, parameter.
value);
 
  540     if (parameter.
index >= 0 && parameter.
index < f1.GetNpar()) {
 
  542       f1.FixParameter(parameter.
index, parameter.
value);
 
  561     if (index >= 0 && index < f1.GetNpar()) {
 
  563       f1.ReleaseParameter(index);
 
  582   inline bool setParLimits(TF1& f1, 
const Int_t index, Double_t xmin, Double_t xmax)
 
  586     if (index >= 0 && index < f1.GetNpar()) {
 
  588       if (xmin == 0.0) { xmin = -numeric_limits<Double_t>::min(); }
 
  589       if (xmax == 0.0) { xmax = +numeric_limits<Double_t>::min(); }
 
  591       f1.SetParLimits(index, xmin, xmax);
 
  610     if (index >= 0 && index < f1.GetNpar()) {
 
  615       f1.GetParLimits(index, xmin, xmax);
 
  617       return (xmin != 0.0 && xmax != 0.0 && xmin >= xmax);
 
  648     string buffer = (
const char*) text;
 
  650     for (string::size_type pos = 0; pos != buffer.size(); ) {
 
  652       if (isalpha(buffer[pos]) || buffer[pos] == 
'_') {
 
  654         string::size_type len = 1;
 
  656         while (pos + len != buffer.size() && (isalnum(buffer[pos+len]) || buffer[pos+len] == 
'_' || buffer[pos+len] == 
'.')) {
 
  667         buffer.replace(pos, len, os.str());
 
  669         pos += os.str().size();
 
  677     return TFormula(
"/tmp", buffer.c_str()).Eval(0.0);
 
  689     const int N = in.GetNbinsX();
 
  693     for (
int i = 0; i < 
N; i++) {
 
  694       x[i] = in.GetBinCenter (i + 1);
 
  695       y[i] = in.GetBinContent(i + 1);
 
  698     TGraph* out = 
new TGraph(N, &x[0], &y[0]);
 
  712   inline TH1* 
projectHistogram(
const TH2& 
in, Double_t inf, Double_t sup, 
const char coordinate = 
'x') {
 
  714     int inf_bin, sup_bin;
 
  720       inf_bin = in.GetYaxis()->FindBin(inf);
 
  721       sup_bin = in.GetYaxis()->FindBin(sup);
 
  722       return in.ProjectionX(
"_px", inf_bin, sup_bin);
 
  726       inf_bin = in.GetXaxis()->FindBin(inf);
 
  727       sup_bin = in.GetXaxis()->FindBin(sup);
 
  728       return in.ProjectionY(
"_py", inf_bin, sup_bin);
 
  752     object = TRegexp(buffer.c_str());
 
  766 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. 
 
int getStreamerVersion(TFile *file, const char *name)
Get ROOT streamer version of class with given name. 
 
const TStreamerInfo * getStreamerInfo(TFile *file, const char *name)
Get ROOT streamer information of class with given name. 
 
bool releaseParameter(TF1 &f1, const Int_t index)
Release fit parameter. 
 
Print objects in ASCII format using ROOT dictionary. 
 
JFitParameter_t()
Default constructor. 
 
then usage $script< string identifier >< detectorfile > input file(toashort file)+" "\nNote that the input files and toashort files should be one-to-one related." fi if (( $
 
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)
 
Auxiliary data structure for a parameter index and its value. 
 
TFile * getFile() const 
Get file. 
 
TGraph * histogramToGraph(const TH1 &in)
Converts a 1D histogram to a TGraph with: 
 
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. 
 
TH1 * projectHistogram(const TH2 &in, Double_t inf, Double_t sup, const char coordinate= 'x')
Helper method for ROOT Projection(X|Y) based on a JRange object and a coordinate. ...
 
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. 
 
Type definition of ROOT based dictionary for ASCII I/O. 
 
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input. 
 
static data_type & getInstance()
Get unique instance of template class. 
 
alias put_queue eval echo n
 
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
 
then usage $script[input file[working directory[option]]] nWhere option can be N
 
Double_t g1(const Double_t x)
Function.