Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Typedefs | Functions | Variables
JROOT Namespace Reference

Auxiliary classes and methods for ROOT I/O. More...

Classes

class  JAbstractStreamer
 Forward declaration of writer object. More...
 
struct  JASCIIFileReader
 Auxiliary class to read objects with ROOT dictionary from ASCII formatted file. More...
 
struct  JASCIIFileWriter
 Auxiliary class to write object with ROOT dictionary from ASCII formatted file. More...
 
class  JCanvas
 Data structure for size of TCanvas. More...
 
class  JChainReader
 Auxiliary class for template TChain reading. More...
 
class  JClassDef
 Test ROOT ClassDef. More...
 
struct  JClassStreamer
 Auxiliary class to add the I/O capabilities of the given template class to the general JRootDictionary class. More...
 
class  JDataFrame
 Auxiliary class for parsing data from ROOT data frame. More...
 
struct  JGraph_t
 Data structure for graph data. More...
 
struct  JGraph
 Auxiliary data structure to build TGraph. More...
 
struct  JGraph2D_t
 Data structure for graph data. More...
 
struct  JGraph2D
 Auxiliary data structure to build TGraph2D. More...
 
struct  JGraph2DErrors_t
 Data structure for graph data. More...
 
struct  JGraph2DErrors
 Auxiliary data structure to build TGraph2DErrors. More...
 
struct  JGraphErrors_t
 Data structure for graph data. More...
 
struct  JGraphErrors
 Auxiliary data structure to build TGraphErrors. More...
 
class  JLineAttributes
 Auxiliary class to set line attributes. More...
 
class  JManager
 Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys. More...
 
class  JMarkerAttributes
 Auxiliary class to set marker attributes. More...
 
struct  JRootAddress
 Auxiliary classd for address handling within TTree or TChain. More...
 
struct  JRootClass
 Auxiliary class to manage access to base classes and data members of ROOT class. More...
 
struct  JAddress
 Simple address wrapper. More...
 
struct  JRootAddressableClass
 Auxiliary class to manage access to base classes and data members of ROOT class objects. More...
 
struct  JRootReadableClass
 ROOT class for reading object. More...
 
struct  JRootWritableClass
 ROOT class for writing object. More...
 
struct  JROOTClassSelector
 Auxiliary class to select ROOT class based on class name. More...
 
struct  JROOTClassSelection
 Auxiliary class for ROOT class selection. More...
 
struct  JRootDictionary_t
 Type definition of ROOT based dictionary for ASCII I/O. More...
 
class  JRootFile
 ROOT file. More...
 
class  JRootInputFile
 ROOT input file. More...
 
class  JRootOutputFile
 ROOT output file. More...
 
class  JRootFileReader
 ROOT file reader. More...
 
class  JRootFileReader< T, false >
 Tempate specialisation of JRootFileReader for TTree incompatible iteration. More...
 
class  JRootFileReader< T, true >
 Tempate specialisation of JRootFileReader for TTree compatible iteration. More...
 
class  JRootObjectOutput
 Template definition of ROOT object output. More...
 
class  JRootObjectOutput< T, false >
 Implementation of object output using TDirectory::WriteTObject method. More...
 
class  JRootObjectOutput< T, true >
 Implementation of object output using TTree. More...
 
class  JRootFileObjectOutput
 Implementation of object output to ROOT file for single data type. More...
 
class  JRootFileObjectOutput< JTypeList< JHead_t, JTail_t > >
 Implementation of object output to ROOT file for multiple data types. More...
 
class  JRootFileObjectOutput< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JRootObjectOutput class. More...
 
class  JRootFileWriter
 ROOT file object output. More...
 
struct  m_count
 Data point for counting measurement. More...
 
struct  m_value
 Data point for value with error. More...
 
struct  m_1d
 1D data point. More...
 
struct  m_2d
 2D data point. More...
 
struct  m_3d
 3D data point. More...
 
struct  data_type
 Template definition of data structure for set of data points. More...
 
struct  data_type< m_1d< T > >
 Template specialisation of data structure for set of 1D data points. More...
 
struct  data_type< m_2d< T > >
 Template specialisation of data structure for set of 2D data points. More...
 
struct  data_type< m_3d< T > >
 Template specialisation of data structure for set of 3D data points. More...
 
struct  JF1
 Wrapper data structure to build ROOT 1D function. More...
 
struct  JF2
 Wrapper data structure to build ROOT 2D function. More...
 
struct  JF3
 Wrapper data structure to build ROOT 3D function. More...
 
struct  index_list
 Auxiliary data structure for list of fixed parameters. More...
 
class  JRootfit_t
 Base class for result of ROOT Fit. More...
 
class  JRootfit
 ROOT Fit. More...
 
struct  JRootLabel
 Replica of structure JLANG::JLabel for data types with ROOT I/O. More...
 
struct  JRootPrimitiveTypes
 
struct  JRootPrinter
 Auxiliary class for printing objects in ASCII format using JRootWriter. More...
 
class  JRootReader
 Implementation for ASCII input of objects with ROOT dictionary. More...
 
class  JRootWriter
 Implementation for ASCII output of objects with ROOT dictionary. More...
 
struct  JRootStreamer
 Auxiliary template class to define default implementation of the ROOT streamer. More...
 
class  JObjectStreamer
 JObjectStreamer class. More...
 
class  JRootStreamObjectOutput
 Template implementation of stream output for single data type based on ROOT dictionary. More...
 
class  JRootStreamObjectOutput< JTypeList< JHead_t, JTail_t > >
 Template specialisationimplementation of stream object output for multiple data types. More...
 
class  JRootStreamObjectOutput< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JRootStreamObjectOutput class. More...
 
class  JActionAtFileOpen
 Auxiliary class to handle version management of given class at opening of a ROOT file. More...
 
class  JActionAtFileRead
 Auxiliary class to handle version management of given class at reading from a ROOT file. More...
 
struct  JFitParameter_t
 Auxiliary data structure for a parameter index and its value. More...
 
class  JSonObjectOutput
 Template implementation of stream output for single data type. More...
 
class  JSonObjectOutput< JTypeList< JHead_t, JTail_t > >
 Template specialisationimplementation of stream object output for multiple data types. More...
 
class  JSonObjectOutput< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JSonObjectOutput class. More...
 
class  JStyle
 Wrapper class around ROOT TStyle. More...
 
class  JTreeBranchAddresses
 Class responsible to setup TTree branch addresses for reading objects of type T. More...
 
class  JTreeParameters
 Data structure for TTree parameters. More...
 
class  JTreeParametersAvailable
 Test availability of TTree parameters for given class. More...
 
struct  JAbstractTreeReader
 Interface for TTree reading. More...
 
class  JTreeReader
 Auxiliary class for template TTree reading. More...
 
class  JTreeReaderObjectIterator
 JTreeReader object iterator. More...
 
class  JTreeReaderAccessibleObjectIterator
 JTemplateTreeReader object iterator. More...
 
class  JTreeWriter
 Auxiliary class for default template TTree writing. More...
 
class  JTreeWriter< T, true >
 Template specialisation for flat template TTree writing. More...
 
struct  JTreeCopyWriterInterface
 Interface for template TTree writing and copying. More...
 
class  JTreeCopyWriter
 Implementation for template TTree writing and copying. More...
 
class  JRootCreateFlatTree
 
class  JTreeWriterObjectOutput
 JTreeWriter object output. More...
 
class  JTreeWriterObjectOutput< JTypeList< JHead_t, JTail_t > >
 Implementation of JTreeWriterObjectOutput for multiple data types. More...
 
class  JTreeWriterObjectOutput< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JTreeWriterObjectOutput class. More...
 
class  JRootDictionary
 Default implementation of ROOT based dictionary for ASCII I/O. More...
 
class  JRootCreateFlatTree< JACOUSTICS::JToA >
 

Typedefs

typedef Long64_t counter_type
 Type definition for counter. More...
 
typedef JTOOLS::JRange< double > range_type
 Type definiton of abscissa range. More...
 

Functions

counter_type advance (counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
 Advance counter. More...
 
TLegend * getLegend (const Int_t width, const Int_t height, const std::string option, const Double_t factor=1.0)
 Get legend. More...
 
template<class JKey_t , class JValue_t >
bool resetObject (JManager< JKey_t, JValue_t > *object, const bool reset=false)
 Reset JManager object. More...
 
const TDataMember * getDataMember (const JRootClass &parent, const JRootClass &member)
 Get ROOT data member for given parent and member class. More...
 
template<class JType_t , class JClass_t >
const TDataMember * getDataMember (JType_t JClass_t::*pd)
 Get ROOT data member for given C++ data member. More...
 
template<class T >
std::vector< TDataMember * > getListOfDataMembers ()
 Get list of ROOT data members for given class. More...
 
template<class T >
std::set< JROOTClassSelectorgetROOTClassSelection (const bool option=false)
 Get ROOT class selection. More...
 
template<class T >
void getObject (TFile *file, const TString &key, T *&ps)
 Read object from ROOT file. More...
 
bool putObject (TDirectory &dir, const TObject &object)
 Write object to ROOT directory. More...
 
template<class T >
JAssert<!JConversion< T,
TObject >::is_derived, bool >
::type 
putObject (TDirectory &dir, const T &object)
 Write object to ROOT directory. More...
 
bool putObject (TDirectory *dir, const TObject &object)
 Write object to ROOT directory. More...
 
template<class T >
JAssert<!JConversion< T,
TObject >::is_derived, bool >
::type 
putObject (TDirectory *dir, const T &object)
 Write object to ROOT directory. More...
 
range_type getRange (TAxis *pAxis)
 Get range of given axis. More...
 
template<class T , class JF1_t >
JRootfit_t< JF1_t > Fit (const TH1 &h1, const JF1_t &f1, const index_list &ls=index_list(), const range_type &X=range_type())
 Global fit fuction. More...
 
template<class T , class JF1_t >
JRootfit_t< JF1_t > Fit (TH1 *h1, const JF1_t &f1, const index_list &ls=index_list(), const range_type &X=range_type())
 Global fit fuction. More...
 
template<class T , class JF2_t >
JRootfit_t< JF2_t > Fit (const TH2 &h2, const JF2_t &f2, const index_list &ls=index_list(), const range_type &X=range_type(), const range_type &Y=range_type())
 Global fit fuction. More...
 
template<class T , class JF2_t >
JRootfit_t< JF2_t > Fit (TH2 *h2, const JF2_t &f2, const index_list &ls=index_list(), const range_type &X=range_type(), const range_type &Y=range_type())
 Global fit fuction. More...
 
template<class T , class JF3_t >
JRootfit_t< JF3_t > Fit (const TH3 &h3, const JF3_t &f3, const index_list &ls=index_list(), const range_type &X=range_type(), const range_type &Y=range_type(), const range_type &Z=range_type())
 Global fit fuction. More...
 
template<class T , class JF3_t >
JRootfit_t< JF3_t > Fit (TH3 *h3, const JF3_t &f3, const index_list &ls=index_list(), const range_type &X=range_type(), const range_type &Y=range_type(), const range_type &Z=range_type())
 Global fit fuction. More...
 
template<class T >
void actionAtFileOpen (TFile *file)
 General action method at file open. More...
 
template<class T >
void actionAtFileRead (T *object)
 General action method at file read. More...
 
template<class T >
void FillRandom (TH1 *h1, const T &f1)
 Fill 1D histogram according Poisson statistics with expectation values from given 1D function. More...
 
template<class T >
void FillRandom (TH2 *h2, const T &f2)
 Fill 2D histogram according Poisson statistics with expectation values from given 2D function. More...
 
template<class T >
void FillRandom (TH3 *h3, const T &f3)
 Fill 3D histogram according Poisson statistics with expectation values from given 3D function. More...
 
template<class T >
void FillRandom (TH1 *h1, const T &f1, const size_t ns)
 Fill 1D histogram according PDF as given 1D function. More...
 
template<class T >
void FillRandom (TH2 *h2, const T &f2, const size_t ns)
 Fill 2D histogram according PDF as given 2D function. More...
 
template<class T >
void FillRandom (TH3 *h3, const T &f3, const size_t ns)
 Fill 3D histogram according PDF as given 3D function. More...
 
template<class T >
const char * getName ()
 Get ROOT name of given data type. More...
 
template<class T >
const char * getName (const JType< T > &type)
 Get ROOT name of given data type. More...
 
bool resetObject (TH1 *object, const bool reset=false)
 Detach TH1 object and optionally reset contents. More...
 
bool resetObject (TGraph *object, const bool reset=false)
 Detach TGraph object and optionally reset contents. More...
 
bool resetObject (TGraphErrors *object, const bool reset=false)
 Detach TGraphErrors object and optionally reset contents. More...
 
bool resetObject (TGraph2D *object, const bool reset=false)
 Detach TGraph2D object and optionally reset contents. More...
 
bool resetObject (TGraph2DErrors *object, const bool reset=false)
 Detach TGraph2DErrors object and optionally reset contents. More...
 
bool resetObject (TMultiGraph *object, const bool reset=false)
 Detach TMultiGraph object and optionally reset contents. More...
 
bool resetObject (TTree *object, const bool reset=false)
 Detach TTree object and optionally reset contents. More...
 
void AddPoint (TGraph *g1, const Double_t x, const Double_t y)
 Add point to TGraph. More...
 
void AddPoint (TGraph2D *g1, const Double_t x, const Double_t y, const Double_t z)
 Add point to TGraph2D. More...
 
void AddPoint (TGraphErrors *g1, const Double_t x, const Double_t y, const Double_t ex, const Double_t ey)
 Add point to TGraphErrors. More...
 
void AddPoint (TGraph2DErrors *g1, const Double_t x, const Double_t y, const Double_t z, const Double_t ex, const Double_t ey, const Double_t ez)
 Add point to TGraph2DErrors. More...
 
TFile & operator<< (TFile &file, const TObject &object)
 Write object to ROOT file. More...
 
const TStreamerInfo * getStreamerInfo (TFile *file, const char *const name)
 Get ROOT streamer information of class with given name. More...
 
const TStreamerInfo * getStreamerInfo (const char *const file_name, const char *const name)
 Get ROOT streamer information of class with given name. More...
 
int getStreamerVersion (TFile *file, const char *const name)
 Get ROOT streamer version of class with given name. More...
 
int getStreamerVersion (const char *const file_name, const char *const name)
 Get ROOT streamer version of class with given name. More...
 
TString parse (const TPRegexp &regexp, const TString &string, const int index=1)
 Match a regular expression with given string and return the specified matched parts. More...
 
bool setParameter (TF1 &f1, const JFitParameter_t &parameter)
 Set fit parameter. More...
 
bool fixParameter (TF1 &f1, const JFitParameter_t &parameter)
 Fix fit parameter. More...
 
bool releaseParameter (TF1 &f1, const Int_t index)
 Release fit parameter. More...
 
bool setParLimits (TF1 &f1, const Int_t index, Double_t xmin, Double_t xmax)
 Set fit parameter limits. More...
 
bool isParameterFixed (const TF1 &f1, const Int_t index)
 Check if fit parameter is fixed. More...
 
template<class T >
Double_t getResult (const TString &text, const T &object, const JRootDictionary_t &dictionary=JRootDictionary::getInstance())
 Get result of given textual formula. More...
 
TGraph * histogramToGraph (const TH1 &h1)
 Helper method to convert a 1D histogram to a graph. More...
 
TH1 * projectHistogram (const TH2 &h2, const Double_t xmin, const Double_t xmax, const char projection)
 Helper method for ROOT histogram projections. More...
 
std::vector< std::string > to_vector (TCollection *col)
 
template<class T >
JTreeParameters getTreeParameters ()
 Template definition for method returning TTree parameters. More...
 
template<class T >
JNullType getTreeParameters (const JType< T > &type)
 Method with argument definition for obtaining TTree parameters. More...
 
template<class T >
JTreeCopyWriter< T > & getTreeCopyWriter ()
 Get the TTree writer and copy for this type of object. More...
 

Variables

static const char *const ROOT_FILE_RECOVERY_DISABLE = "ROOT_FILE_RECOVERY_DISABLE"
 Environment variable to disable ROOT file recovery. More...
 

Detailed Description

Auxiliary classes and methods for ROOT I/O.

Author
mdejong
mdejong, mlincett

Typedef Documentation

typedef Long64_t JROOT::counter_type

Type definition for counter.

Definition at line 24 of file JROOT/JCounter.hh.

Type definiton of abscissa range.

Definition at line 43 of file JRootfit.hh.

Function Documentation

counter_type JROOT::advance ( counter_type counter,
const counter_type  value,
const counter_type  limit = std::numeric_limits<counter_type>::max() 
)
inline

Advance counter.

Parameters
countercounter (I/O)
valueoffset
limitlimit
Returns
increment

Definition at line 35 of file JROOT/JCounter.hh.

38  {
39  const counter_type previous = counter;
40 
41  if (counter + value < limit)
42  counter += value;
43  else
44  counter = limit;
45 
46  return counter - previous;
47  }
Long64_t counter_type
Type definition for counter.
TLegend* JROOT::getLegend ( const Int_t  width,
const Int_t  height,
const std::string  option,
const Double_t  factor = 1.0 
)
inline

Get legend.

Parameters
widthwidth [characters]
heightheight [lines]
optionposition [TR TL BL BR]
factorfactor font size
Returns
legend

Definition at line 29 of file JLegend.hh.

33  {
34  using namespace std;
35 
36  gPad->Update();
37 
38  const Double_t X1 = 0.0 + gPad->GetLeftMargin();
39  const Double_t X2 = 1.0 - gPad->GetRightMargin();
40  const Double_t Y1 = 0.0 + gPad->GetBottomMargin();
41  const Double_t Y2 = 1.0 - gPad->GetTopMargin();
42 
43  const Double_t w = gPad->XtoPixel(gPad->GetX2());
44  const Double_t h = gPad->YtoPixel(gPad->GetY1());
45 
46  const Double_t w1 = fabs(gPad->XtoPixel(gPad->GetX2()) - gPad->XtoPixel(gPad->GetX1()));
47  const Double_t h1 = fabs(gPad->YtoPixel(gPad->GetY2()) - gPad->YtoPixel(gPad->GetY1()));
48 
49  const Double_t mw = 2.0; // extra width
50  const Double_t mh = 0.5; // extra height
51  const Double_t eps = 0.005; // extra space [NDC]
52  const Double_t ts = gStyle->GetStatFontSize() * factor; // text size [NDC]
53  const Double_t ch = ts * (w < h ? w : h); // text size [pixel]
54 
55  Double_t W = (width + mw) * (ch/w1) * factor; // width [NDC]
56  Double_t H = (height + mh) * (ch/h1) * factor; // height [NDC]
57 
58  Double_t fc = 1.0; // extra scaling factor
59 
60  if (fc * W > X2 - X1 - 2*eps) { fc *= (X2 - X1 - 2*eps) / W; }
61  if (fc * H > Y2 - Y1 - 2*eps) { fc *= (Y2 - Y1 - 2*eps) / H; }
62 
63  W *= fc;
64  H *= fc;
65 
66  // default position is top-right
67 
68  Double_t x1 = X2 - W - eps;
69  Double_t y1 = Y2 - H - eps;
70  Double_t x2 = X2 - eps;
71  Double_t y2 = Y2 - eps;
72 
73  if (option.find('T') != string::npos && option.find('B') == string::npos) { // top
74  y1 = Y2 - H - eps;
75  y2 = Y2 - eps;
76  }
77 
78  if (option.find('B') != string::npos && option.find('T') == string::npos) { // bottom
79  y1 = Y1 + eps;
80  y2 = Y1 + H + eps;
81  }
82 
83  if (option.find('R') != string::npos && option.find('L') == string::npos) { // right
84  x1 = X2 - W - eps;
85  x2 = X2 - eps;
86  }
87 
88  if (option.find('L') != string::npos && option.find('R') == string::npos) { // left
89  x1 = X1 + eps;
90  x2 = X1 + W + eps;
91  }
92 
93  TLegend* lg = new TLegend(x1, y1, x2, y2);
94 
95  //lg->SetFillStyle(4000);
96  lg->SetFillColor(kWhite);
97  lg->SetBorderSize(0);
98  lg->SetTextAlign(12);
99  lg->SetTextFont(gStyle->GetStatFont());
100  lg->SetTextSize(ts);
101 
102  return lg;
103  }
data_type w[N+1][M+1]
Definition: JPolint.hh:867
static const double H
Planck constant [eV s].
template<class JKey_t , class JValue_t >
bool JROOT::resetObject ( JManager< JKey_t, JValue_t > *  object,
const bool  reset = false 
)
inline

Reset JManager object.

Parameters
objectmanager
resetreset contents if true
Returns
true if successful; else false

Definition at line 366 of file JManager.hh.

367  {
368  if (object->is_valid()) {
369  JROOT::resetObject(object->get(), reset);
370  }
371 
372  for (typename JManager<JKey_t, JValue_t>::iterator i = object->begin(); i != object->end(); ++i) {
373  JROOT::resetObject(i->second.get(), reset);
374  }
375 
376  return true;
377  }
bool is_valid() const
Check validity of pointer.
bool resetObject(JManager< JKey_t, JValue_t > *object, const bool reset=false)
Reset JManager object.
Definition: JManager.hh:366
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
Definition: JManager.hh:43
void reset(T &value)
Reset value.
virtual JClass_t * get() const override
Get pointer.
Definition: JPointer.hh:64
const TDataMember* JROOT::getDataMember ( const JRootClass parent,
const JRootClass member 
)
inline

Get ROOT data member for given parent and member class.

Parameters
parentROOT class
memberROOT class
Returns
pointer to ROOT data member

Definition at line 650 of file JRootClass.hh.

652  {
653  if (parent.getClass() != NULL) {
654 
655  for (std::unique_ptr<TIterator> i(parent.getClass()->GetListOfDataMembers(kFALSE)->MakeIterator()); const TDataMember* p = (const TDataMember*) i->Next(); ) {
656 
657  const JRootClass abc = parent.get(*p);
658 
659  if (abc == member && abc.getOffset() == member.getOffset()) {
660  return p;
661  }
662  }
663 
664  for (std::unique_ptr<TIterator> i(parent.getClass()->GetListOfBases()->MakeIterator()); const TBaseClass* p = (const TBaseClass*) i->Next(); ) {
665 
666  if (JRootClass::is_class(*p) && !JRootClass::is_STLcontainer(*p)) {
667 
668  const TDataMember* q = getDataMember(parent.get(*p), member);
669 
670  if (q != NULL) {
671  return q;
672  }
673  }
674  }
675  }
676 
677  return NULL;
678  }
int getOffset() const
Get offset of this class with respect to parent class.
Definition: JRootClass.hh:183
const TDataMember * getDataMember(const JRootClass &parent, const JRootClass &member)
Get ROOT data member for given parent and member class.
Definition: JRootClass.hh:650
JRootClass get(const TDataMember &data_member) const
Get ROOT class of given data member.
Definition: JRootClass.hh:293
TClass * getClass() const
Get class.
Definition: JRootClass.hh:194
Auxiliary class to manage access to base classes and data members of ROOT class.
Definition: JRootClass.hh:41
template<class JType_t , class JClass_t >
const TDataMember* JROOT::getDataMember ( JType_t JClass_t::*  pd)
inline

Get ROOT data member for given C++ data member.

Parameters
pdpointer to C++ data member
Returns
pointer to ROOT data member

Definition at line 688 of file JRootClass.hh.

689  {
690  return getDataMember(JRootClass(getType<JClass_t>()), JRootClass(pd));
691  }
const TDataMember * getDataMember(const JRootClass &parent, const JRootClass &member)
Get ROOT data member for given parent and member class.
Definition: JRootClass.hh:650
Auxiliary class to manage access to base classes and data members of ROOT class.
Definition: JRootClass.hh:41
template<class T >
std::vector<TDataMember*> JROOT::getListOfDataMembers ( )

Get list of ROOT data members for given class.

Definition at line 698 of file JRootClass.hh.

699  {
701 
702  TClass* rc = (TClass*) TDictionary::GetDictionary(typeid(T));
703 
704  for (std::unique_ptr<TIterator> i(rc->GetListOfDataMembers(kFALSE)->MakeIterator()); TDataMember* p = (TDataMember*) i->Next(); ) {
705  if (JRootClass::is_class(p->GetName())) {
706  buffer.push_back(p);
707  }
708  }
709 
710  return buffer;
711  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
template<class T >
std::set<JROOTClassSelector> JROOT::getROOTClassSelection ( const bool  option = false)
inline

Get ROOT class selection.

Parameters
optioninclude namespace
Returns
ROOT class selection

Definition at line 318 of file JROOTClassSelector.hh.

319  {
320  return JROOTClassSelection(JType<T>(), option);
321  }
Auxiliary class for ROOT class selection.
template<class T >
void JROOT::getObject ( TFile *  file,
const TString &  key,
T *&  ps 
)
inline

Read object from ROOT file.

Parameters
filepointer to file
keykey of object to be read
pspointer to object

Definition at line 42 of file JRootFileReader.hh.

43  {
44  if (file != NULL) {
45  file->GetObject(key, ps);
46  }
47  }
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
Definition: JDataQuality.sh:19
bool JROOT::putObject ( TDirectory &  dir,
const TObject object 
)
inline

Write object to ROOT directory.

Parameters
dirdirectory
objectobject
Returns
true if OK; else false

Definition at line 41 of file JRootFileWriter.hh.

42  {
43  return dir.WriteTObject(&object) > 0;
44  }
template<class T >
JAssert<!JConversion<T, TObject>::is_derived, bool>::type JROOT::putObject ( TDirectory &  dir,
const T object 
)
inline

Write object to ROOT directory.

Parameters
dirdirectory
objectobject
Returns
true if OK; else false

Definition at line 55 of file JRootFileWriter.hh.

56  {
57  return dir.WriteObject(&object, T::Class_Name()) > 0;
58  }
bool JROOT::putObject ( TDirectory *  dir,
const TObject object 
)
inline

Write object to ROOT directory.

Parameters
dirpointer to directory
objectobject
Returns
true if OK; else false

Definition at line 68 of file JRootFileWriter.hh.

69  {
70  return (dir != NULL && putObject(*dir, object));
71  }
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
template<class T >
JAssert<!JConversion<T, TObject>::is_derived, bool>::type JROOT::putObject ( TDirectory *  dir,
const T object 
)
inline

Write object to ROOT directory.

Parameters
dirpointer to directory
objectobject
Returns
true if OK; else false

Definition at line 82 of file JRootFileWriter.hh.

83  {
84  return (dir != NULL && putObject(*dir, object));
85  }
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
range_type JROOT::getRange ( TAxis *  pAxis)
inline

Get range of given axis.

Parameters
pAxispointer to axis
Returns
range

Definition at line 52 of file JRootfit.hh.

53  {
54  if (pAxis != NULL)
55  return range_type(pAxis->GetXmin(), pAxis->GetXmax());
56  else
57  return range_type();
58  }
JRange< int > range_type
template<class T , class JF1_t >
JRootfit_t<JF1_t> JROOT::Fit ( const TH1 &  h1,
const JF1_t &  f1,
const index_list ls = index_list(),
const range_type X = range_type() 
)
inline

Global fit fuction.

The template parameter T refers to the measurement and can be m_count or m_value.

Parameters
h1histogram
f1start value
lslist of fixed parameters
Xfit range
Returns
result

Definition at line 1247 of file JRootfit.hh.

1251  {
1252  return JRootfit<JF1_t>::Fit(h1, f1, T(), ls, X);
1253  }
const JPolynome f1(1.0, 2.0, 3.0)
Function.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
JRootfit_t< JF1_t > Fit(const TH1 &h1, const JF1_t &f1, const index_list &ls=index_list(), const range_type &X=range_type())
Global fit fuction.
Definition: JRootfit.hh:1247
template<class T , class JF1_t >
JRootfit_t<JF1_t> JROOT::Fit ( TH1 *  h1,
const JF1_t &  f1,
const index_list ls = index_list(),
const range_type X = range_type() 
)
inline

Global fit fuction.

The template parameter T refers to the measurement and can be m_count or m_value.
The fitted function is added to the input histogram.

Parameters
h1pointer to histogram
f1start value
lslist of fixed parameters
Xfit range
Returns
result

Definition at line 1269 of file JRootfit.hh.

1273  {
1274  return JRootfit<JF1_t>::Fit(h1, f1, T(), ls, X);
1275  }
const JPolynome f1(1.0, 2.0, 3.0)
Function.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
JRootfit_t< JF1_t > Fit(const TH1 &h1, const JF1_t &f1, const index_list &ls=index_list(), const range_type &X=range_type())
Global fit fuction.
Definition: JRootfit.hh:1247
template<class T , class JF2_t >
JRootfit_t<JF2_t> JROOT::Fit ( const TH2 &  h2,
const JF2_t &  f2,
const index_list ls = index_list(),
const range_type X = range_type(),
const range_type Y = range_type() 
)
inline

Global fit fuction.

The template parameter T refers to the measurement and can be m_count or m_value.

Parameters
h2histogram
f2start value
lslist of fixed parameters
Xfit range
Yfit range
Returns
result

Definition at line 1291 of file JRootfit.hh.

1296  {
1297  return JRootfit<JF2_t>::Fit(h2, f2, T(), ls, X, Y);
1298  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
JRootfit_t< JF1_t > Fit(const TH1 &h1, const JF1_t &f1, const index_list &ls=index_list(), const range_type &X=range_type())
Global fit fuction.
Definition: JRootfit.hh:1247
template<class T , class JF2_t >
JRootfit_t<JF2_t> JROOT::Fit ( TH2 *  h2,
const JF2_t &  f2,
const index_list ls = index_list(),
const range_type X = range_type(),
const range_type Y = range_type() 
)
inline

Global fit fuction.

The template parameter T refers to the measurement and can be m_count or m_value.
The fitted function is added to the input histogram.

Parameters
h2pointer to histogram
f2start value
lslist of fixed parameters
Xfit range
Yfit range
Returns
result

Definition at line 1315 of file JRootfit.hh.

1320  {
1321  return JRootfit<JF2_t>::Fit(h2, f2, T(), ls, X, Y);
1322  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
JRootfit_t< JF1_t > Fit(const TH1 &h1, const JF1_t &f1, const index_list &ls=index_list(), const range_type &X=range_type())
Global fit fuction.
Definition: JRootfit.hh:1247
template<class T , class JF3_t >
JRootfit_t<JF3_t> JROOT::Fit ( const TH3 &  h3,
const JF3_t &  f3,
const index_list ls = index_list(),
const range_type X = range_type(),
const range_type Y = range_type(),
const range_type Z = range_type() 
)
inline

Global fit fuction.

The template parameter T refers to the measurement and can be m_count or m_value.

Parameters
h3histogram
f3start value
lslist of fixed parameters
Xfit range
Yfit range
Zfit range
Returns
result

Definition at line 1339 of file JRootfit.hh.

1345  {
1346  return JRootfit<JF3_t>::Fit(h3, f3, T(), ls, X, Y, Z);
1347  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
JRootfit_t< JF1_t > Fit(const TH1 &h1, const JF1_t &f1, const index_list &ls=index_list(), const range_type &X=range_type())
Global fit fuction.
Definition: JRootfit.hh:1247
double f3(const double x, const double y, const double z)
3D function.
Definition: JPolynome3D.cc:23
template<class T , class JF3_t >
JRootfit_t<JF3_t> JROOT::Fit ( TH3 *  h3,
const JF3_t &  f3,
const index_list ls = index_list(),
const range_type X = range_type(),
const range_type Y = range_type(),
const range_type Z = range_type() 
)
inline

Global fit fuction.

The template parameter T refers to the measurement and can be m_count or m_value.
The fitted function is added to the input histogram.

Parameters
h3pointer to histogram
f3start value
lslist of fixed parameters
Xfit range
Yfit range
Zfit range
Returns
result

Definition at line 1365 of file JRootfit.hh.

1371  {
1372  return JRootfit<JF3_t>::Fit(h3, f3, T(), ls, X, Y, Z);
1373  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
JRootfit_t< JF1_t > Fit(const TH1 &h1, const JF1_t &f1, const index_list &ls=index_list(), const range_type &X=range_type())
Global fit fuction.
Definition: JRootfit.hh:1247
double f3(const double x, const double y, const double z)
3D function.
Definition: JPolynome3D.cc:23
template<class T >
void JROOT::actionAtFileOpen ( TFile *  file)
inline

General action method at file open.

The class T should provide the policy method:

   static void actionAtFileOpen(int version);

whenever an action specific to this data type has to be executed after opening a file.
This method will then be called following each file open operation.

Parameters
filepointer to file

Definition at line 148 of file JRootSupportkit.hh.

149  {
150  if (file != NULL) {
152  }
153  }
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
Definition: JDataQuality.sh:19
Auxiliary class to handle version management of given class at opening of a ROOT file.
template<class T >
void JROOT::actionAtFileRead ( T object)
inline

General action method at file read.

The class T should provide the policy method:

   void actionAtFileRead();

whenever an action specific to this data type has to be executed after reading from a file.
This method will then be called following each file read operation.

Parameters
objectpointer to object (I/O)

Definition at line 169 of file JRootSupportkit.hh.

170  {
171  if (object != NULL) {
173  }
174  }
Auxiliary class to handle version management of given class at reading from a ROOT file...
template<class T >
void JROOT::FillRandom ( TH1 *  h1,
const T f1 
)
inline

Fill 1D histogram according Poisson statistics with expectation values from given 1D function.

Parameters
h1histogram
f1function

Definition at line 33 of file JRootTestkit.hh.

34  {
35  for (Int_t ix = 1; ix <= h1->GetXaxis()->GetNbins(); ++ix){
36 
37  const double x = h1->GetXaxis()->GetBinCenter(ix);
38 
39  h1->SetBinContent(ix, gRandom->Poisson(f1(x)));
40 
41  if (h1->GetSumw2N() != 0) {
42  h1->SetBinError(ix, sqrt(h1->GetBinContent(ix)));
43  }
44  }
45  }
const JPolynome f1(1.0, 2.0, 3.0)
Function.
template<class T >
void JROOT::FillRandom ( TH2 *  h2,
const T f2 
)
inline

Fill 2D histogram according Poisson statistics with expectation values from given 2D function.

Parameters
h2histogram
f2function

Definition at line 55 of file JRootTestkit.hh.

56  {
57  for (Int_t ix = 1; ix <= h2->GetXaxis()->GetNbins(); ++ix){
58  for (Int_t iy = 1; iy <= h2->GetYaxis()->GetNbins(); ++iy){
59 
60  const double x = h2->GetXaxis()->GetBinCenter(ix);
61  const double y = h2->GetYaxis()->GetBinCenter(iy);
62 
63  h2->SetBinContent(ix, iy, gRandom->Poisson(f2(x,y)));
64 
65  if (h2->GetSumw2N() != 0) {
66  h2->SetBinError(ix, iy, sqrt(h2->GetBinContent(ix,iy)));
67  }
68  }
69  }
70  }
template<class T >
void JROOT::FillRandom ( TH3 *  h3,
const T f3 
)
inline

Fill 3D histogram according Poisson statistics with expectation values from given 3D function.

Parameters
h3histogram
f3function

Definition at line 80 of file JRootTestkit.hh.

81  {
82  for (Int_t ix = 1; ix <= h3->GetXaxis()->GetNbins(); ++ix){
83  for (Int_t iy = 1; iy <= h3->GetYaxis()->GetNbins(); ++iy){
84  for (Int_t iz = 1; iz <= h3->GetZaxis()->GetNbins(); ++iz){
85 
86  const double x = h3->GetXaxis()->GetBinCenter(ix);
87  const double y = h3->GetYaxis()->GetBinCenter(iy);
88  const double z = h3->GetZaxis()->GetBinCenter(iz);
89 
90  h3->SetBinContent(ix, iy, iz, gRandom->Poisson(f3(x,y,z)));
91 
92  if (h3->GetSumw2N() != 0) {
93  h3->SetBinError(ix, iy, iy, sqrt(h3->GetBinContent(ix,iy,iz)));
94  }
95  }
96  }
97  }
98  }
then usage $script[energy[distance[z of PMT]]] fi case set_variable z
Definition: JDrawPDF.sh:45
double f3(const double x, const double y, const double z)
3D function.
Definition: JPolynome3D.cc:23
template<class T >
void JROOT::FillRandom ( TH1 *  h1,
const T f1,
const size_t  ns 
)
inline

Fill 1D histogram according PDF as given 1D function.

Parameters
h1histogram
f1function
nsnumber of entries

Definition at line 109 of file JRootTestkit.hh.

110  {
111  using namespace std;
112 
113  struct tuple {
114 
115  Double_t x;
116  double W;
117 
118  inline bool operator<(const double W) { return this->W < W; }
119  };
120 
121  vector<tuple> buffer;
122 
123  double W = 0.0;
124 
125  for (Int_t ix = 1; ix <= h1->GetXaxis()->GetNbins(); ++ix){
126 
127  const Double_t x = h1->GetXaxis()->GetBinCenter(ix);
128 
129  W += f1(x);
130 
131  buffer.push_back({x, W});
132  }
133 
134  for (size_t i = 0; i != ns; ++i) {
135 
136  typename vector<tuple>::const_iterator p = lower_bound(buffer.begin(), buffer.end(), W * gRandom->Rndm());
137 
138  h1->Fill(p->x);
139  }
140  }
bool operator<(const Head &first, const Head &second)
Less than operator.
Definition: JHead.hh:1817
std::vector< size_t > ns
const JPolynome f1(1.0, 2.0, 3.0)
Function.
template<class T >
void JROOT::FillRandom ( TH2 *  h2,
const T f2,
const size_t  ns 
)
inline

Fill 2D histogram according PDF as given 2D function.

Parameters
h2histogram
f2function
nsnumber of entries

Definition at line 151 of file JRootTestkit.hh.

152  {
153  using namespace std;
154 
155  struct tuple {
156 
157  Double_t x;
158  Double_t y;
159  double W;
160 
161  inline bool operator<(const double W) { return this->W < W; }
162  };
163 
164  vector<tuple> buffer;
165 
166  double W = 0.0;
167 
168  for (Int_t ix = 1; ix <= h2->GetXaxis()->GetNbins(); ++ix){
169  for (Int_t iy = 1; iy <= h2->GetYaxis()->GetNbins(); ++iy){
170 
171  const Double_t x = h2->GetXaxis()->GetBinCenter(ix);
172  const Double_t y = h2->GetYaxis()->GetBinCenter(iy);
173 
174  W += f2(x,y);
175 
176  buffer.push_back({x, y, W});
177  }
178  }
179 
180  for (size_t i = 0; i != ns; ++i) {
181 
182  typename vector<tuple>::const_iterator p = lower_bound(buffer.begin(), buffer.end(), W * gRandom->Rndm());
183 
184  h2->Fill(p->x, p->y);
185  }
186  }
bool operator<(const Head &first, const Head &second)
Less than operator.
Definition: JHead.hh:1817
std::vector< size_t > ns
template<class T >
void JROOT::FillRandom ( TH3 *  h3,
const T f3,
const size_t  ns 
)
inline

Fill 3D histogram according PDF as given 3D function.

Parameters
h3histogram
f3function
nsnumber of entries

Definition at line 197 of file JRootTestkit.hh.

198  {
199  using namespace std;
200 
201  struct tuple {
202 
203  Double_t x;
204  Double_t y;
205  Double_t z;
206  double W;
207 
208  inline bool operator<(const double W) { return this->W < W; }
209  };
210 
211  vector<tuple> buffer;
212 
213  double W = 0.0;
214 
215  for (Int_t ix = 1; ix <= h3->GetXaxis()->GetNbins(); ++ix){
216  for (Int_t iy = 1; iy <= h3->GetYaxis()->GetNbins(); ++iy){
217  for (Int_t iz = 1; iz <= h3->GetYaxis()->GetNbins(); ++iz){
218 
219  const Double_t x = h3->GetXaxis()->GetBinCenter(ix);
220  const Double_t y = h3->GetYaxis()->GetBinCenter(iy);
221  const Double_t z = h3->GetZaxis()->GetBinCenter(iz);
222 
223  W += f3(x,y,z);
224 
225  buffer.push_back({x, y, z, W});
226  }
227  }
228  }
229 
230  for (size_t i = 0; i != ns; ++i) {
231 
232  typename vector<tuple>::const_iterator p = lower_bound(buffer.begin(), buffer.end(), W * gRandom->Rndm());
233 
234  h3->Fill(p->x, p->y, p->z);
235  }
236  }
bool operator<(const Head &first, const Head &second)
Less than operator.
Definition: JHead.hh:1817
std::vector< size_t > ns
then usage $script[energy[distance[z of PMT]]] fi case set_variable z
Definition: JDrawPDF.sh:45
double f3(const double x, const double y, const double z)
3D function.
Definition: JPolynome3D.cc:23
template<class T >
const char* JROOT::getName ( )
inline

Get ROOT name of given data type.

Returns
name of object to be read

Definition at line 60 of file JRootToolkit.hh.

61  {
62  return getName(JType<T>());
63  }
const char * getName()
Get ROOT name of given data type.
Definition: JRootToolkit.hh:60
template<class T >
const char* JROOT::getName ( const JType< T > &  type)
inline

Get ROOT name of given data type.

Parameters
typedata type
Returns
name of object to be read

Definition at line 73 of file JRootToolkit.hh.

74  {
75  return T::Class_Name();
76  }
bool JROOT::resetObject ( TH1 *  object,
const bool  reset = false 
)
inline

Detach TH1 object and optionally reset contents.

Parameters
objectROOT TH1 object
resetreset contents if true
Returns
true if successful; else false

Definition at line 86 of file JRootToolkit.hh.

87  {
88  if (object != NULL) {
89 
90  object->SetDirectory(0);
91 
92  if (reset) {
93  object->Reset();
94  }
95 
96  return true;
97  }
98 
99  return false;
100  }
void reset(T &value)
Reset value.
bool JROOT::resetObject ( TGraph *  object,
const bool  reset = false 
)
inline

Detach TGraph object and optionally reset contents.

Parameters
objectROOT TGraph object
resetreset contents if true
Returns
true if successful; else false

Definition at line 110 of file JRootToolkit.hh.

111  {
112  if (object != NULL) {
113 
114  if (reset) {
115  for (int i = 0; i != object->GetN(); ++i) {
116  object->SetPoint(i, 0.0, 0.0);
117  }
118  }
119 
120  return true;
121  }
122 
123  return false;
124  }
void reset(T &value)
Reset value.
bool JROOT::resetObject ( TGraphErrors *  object,
const bool  reset = false 
)
inline

Detach TGraphErrors object and optionally reset contents.

Parameters
objectROOT TGraphErrors object
resetreset contents if true
Returns
true if successful; else false

Definition at line 134 of file JRootToolkit.hh.

135  {
136  if (object != NULL) {
137 
138  if (reset) {
139 
140  for (int i = 0; i != object->GetN(); ++i) {
141  object->SetPoint (i, 0.0, 0.0);
142  object->SetPointError(i, 0.0, 0.0);
143  }
144  }
145 
146  return true;
147  }
148 
149  return false;
150  }
void reset(T &value)
Reset value.
bool JROOT::resetObject ( TGraph2D *  object,
const bool  reset = false 
)
inline

Detach TGraph2D object and optionally reset contents.

Parameters
objectROOT TGraph2D object
resetreset contents if true
Returns
true if successful; else false

Definition at line 160 of file JRootToolkit.hh.

161  {
162  if (object != NULL) {
163 
164  if (reset) {
165  for (int i = 0; i != object->GetN(); ++i) {
166  object->SetPoint(i, 0.0, 0.0, 0.0);
167  }
168  }
169 
170  return true;
171  }
172 
173  return false;
174  }
void reset(T &value)
Reset value.
bool JROOT::resetObject ( TGraph2DErrors *  object,
const bool  reset = false 
)
inline

Detach TGraph2DErrors object and optionally reset contents.

Parameters
objectROOT TGraph2DErrors object
resetreset contents if true
Returns
true if successful; else false

Definition at line 184 of file JRootToolkit.hh.

185  {
186  if (object != NULL) {
187 
188  if (reset) {
189  for (int i = 0; i != object->GetN(); ++i) {
190  object->SetPoint (i, 0.0, 0.0, 0.0);
191  object->SetPointError(i, 0.0, 0.0, 0.0);
192  }
193  }
194 
195  return true;
196  }
197 
198  return false;
199  }
void reset(T &value)
Reset value.
bool JROOT::resetObject ( TMultiGraph *  object,
const bool  reset = false 
)
inline

Detach TMultiGraph object and optionally reset contents.

Parameters
objectROOT TMultiGraph object
resetreset contents if true
Returns
true if successful; else false

Definition at line 209 of file JRootToolkit.hh.

210  {
211  if (object != NULL) {
212 
213  bool status = true;
214 
215  if (reset) {
216 
217  TIter next(object->GetListOfGraphs());
218 
219  while (TGraph* graph = (TGraph*)next()) {
220 
221  if (!(resetObject(dynamic_cast<TGraph2DErrors*>(graph), reset) ||
222  resetObject(dynamic_cast<TGraph2D*> (graph), reset)) &&
223  !(resetObject(dynamic_cast<TGraphErrors*> (graph), reset) ||
224  resetObject (graph, reset)) ) {
225 
226  status = false;
227  }
228  }
229  }
230 
231  return status;
232  }
233 
234  return false;
235  }
bool resetObject(JManager< JKey_t, JValue_t > *object, const bool reset=false)
Reset JManager object.
Definition: JManager.hh:366
void reset(T &value)
Reset value.
bool JROOT::resetObject ( TTree *  object,
const bool  reset = false 
)
inline

Detach TTree object and optionally reset contents.

Parameters
objectROOT TTree object
resetreset contents if true
Returns
true if successful; else false

Definition at line 245 of file JRootToolkit.hh.

246  {
247  if (object != NULL) {
248 
249  object->SetDirectory(0);
250 
251  if (reset) {
252  object->Reset();
253  }
254 
255  return true;
256  }
257 
258  return false;
259  }
void reset(T &value)
Reset value.
void JROOT::AddPoint ( TGraph *  g1,
const Double_t  x,
const Double_t  y 
)
inline

Add point to TGraph.

Parameters
g1pointer to valid ROOT TGraph object
xx value
yy value

Definition at line 269 of file JRootToolkit.hh.

272  {
273  const Int_t n = g1->GetN();
274 
275  g1->Set(n + 1);
276  g1->SetPoint(n, x, y);
277  }
const int n
Definition: JPolint.hh:786
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25
void JROOT::AddPoint ( TGraph2D *  g1,
const Double_t  x,
const Double_t  y,
const Double_t  z 
)
inline

Add point to TGraph2D.

Parameters
g1pointer to valid ROOT TGraph object
xx value
yy value
zz value

Definition at line 288 of file JRootToolkit.hh.

292  {
293  const Int_t n = g1->GetN();
294 
295  g1->Set(n + 1);
296  g1->SetPoint(n, x, y, z);
297  }
const int n
Definition: JPolint.hh:786
then usage $script[energy[distance[z of PMT]]] fi case set_variable z
Definition: JDrawPDF.sh:45
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25
void JROOT::AddPoint ( TGraphErrors *  g1,
const Double_t  x,
const Double_t  y,
const Double_t  ex,
const Double_t  ey 
)
inline

Add point to TGraphErrors.

Parameters
g1pointer to valid ROOT TGraph object
xx value
yy value
exx error
eyy error

Definition at line 309 of file JRootToolkit.hh.

314  {
315  const Int_t n = g1->GetN();
316 
317  g1->Set(n + 1);
318  g1->SetPoint(n, x, y);
319  g1->SetPointError(n, ex, ey);
320  }
const int n
Definition: JPolint.hh:786
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25
void JROOT::AddPoint ( TGraph2DErrors *  g1,
const Double_t  x,
const Double_t  y,
const Double_t  z,
const Double_t  ex,
const Double_t  ey,
const Double_t  ez 
)
inline

Add point to TGraph2DErrors.

Parameters
g1pointer to valid ROOT TGraph object
xx value
yy value
zz value
exx error
eyy error
ezz error

Definition at line 334 of file JRootToolkit.hh.

341  {
342  const Int_t n = g1->GetN();
343 
344  g1->Set(n + 1);
345  g1->SetPoint(n, x, y, z);
346  g1->SetPointError(n, ex, ey, ez);
347  }
const int n
Definition: JPolint.hh:786
then usage $script[energy[distance[z of PMT]]] fi case set_variable z
Definition: JDrawPDF.sh:45
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25
TFile& JROOT::operator<< ( TFile &  file,
const TObject object 
)
inline

Write object to ROOT file.

Parameters
fileROOT file
objectROOT object
Returns
ROOT file

Definition at line 357 of file JRootToolkit.hh.

358  {
359  file.WriteTObject(&object);
360 
361  return file;
362  }
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
Definition: JDataQuality.sh:19
const TStreamerInfo* JROOT::getStreamerInfo ( TFile *  file,
const char *const  name 
)
inline

Get ROOT streamer information of class with given name.

Note that the class name should include the name space, if any.

Parameters
filepointer to ROOT file
nameclass name
Returns
pointer to TStreamerInfo (NULL in case of error)

Definition at line 373 of file JRootToolkit.hh.

374  {
375  if (file != NULL && file->IsOpen()) {
376 
377  const TString buffer(name);
378 
379  TIter iter(file->GetStreamerInfoList());
380 
381  for (const TStreamerInfo* pStreamerInfo; (pStreamerInfo = (TStreamerInfo*) iter.Next()) != NULL; ) {
382  if (buffer == TString(pStreamerInfo->GetName())) {
383  return pStreamerInfo;
384  }
385  }
386  }
387 
388  return NULL;
389  }
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
Definition: JDataQuality.sh:19
then fatal The output file must have the wildcard in the name
Definition: JCanberra.sh:31
const TStreamerInfo* JROOT::getStreamerInfo ( const char *const  file_name,
const char *const  name 
)
inline

Get ROOT streamer information of class with given name.

Note that the class name should include the name space, if any.

Parameters
file_namefile name
nameclass name
Returns
pointer to TStreamerInfo (NULL in case of error)

Definition at line 400 of file JRootToolkit.hh.

401  {
402  JRootInputFile file(file_name);
403 
404  return getStreamerInfo(file.getFile(), name);
405  }
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
Definition: JDataQuality.sh:19
const TStreamerInfo * getStreamerInfo(TFile *file, const char *const name)
Get ROOT streamer information of class with given name.
ROOT input file.
Definition: JRootFile.hh:95
then fatal The output file must have the wildcard in the name
Definition: JCanberra.sh:31
int JROOT::getStreamerVersion ( TFile *  file,
const char *const  name 
)
inline

Get ROOT streamer version of class with given name.

Note that the class name should include the name space, if any.

Parameters
filepointer to ROOT file
nameclass name
Returns
streamer version; (-1 in case of error)

Definition at line 416 of file JRootToolkit.hh.

417  {
418  const TStreamerInfo* pStreamerInfo = getStreamerInfo(file, name);
419 
420  if (pStreamerInfo != NULL)
421  return pStreamerInfo->GetClassVersion();
422  else
423  return -1;
424  }
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
Definition: JDataQuality.sh:19
const TStreamerInfo * getStreamerInfo(TFile *file, const char *const name)
Get ROOT streamer information of class with given name.
then fatal The output file must have the wildcard in the name
Definition: JCanberra.sh:31
int JROOT::getStreamerVersion ( const char *const  file_name,
const char *const  name 
)
inline

Get ROOT streamer version of class with given name.

Note that the class name should include the name space, if any.

Parameters
file_namefile name
nameclass name
Returns
streamer version; (-1 in case of error)

Definition at line 435 of file JRootToolkit.hh.

436  {
437  JRootInputFile file(file_name);
438 
439  return getStreamerVersion(file.getFile(), name);
440  }
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
Definition: JDataQuality.sh:19
int getStreamerVersion(TFile *file, const char *const name)
Get ROOT streamer version of class with given name.
ROOT input file.
Definition: JRootFile.hh:95
then fatal The output file must have the wildcard in the name
Definition: JCanberra.sh:31
TString JROOT::parse ( const TPRegexp &  regexp,
const TString &  string,
const int  index = 1 
)
inline

Match a regular expression with given string and return the specified matched parts.

If no matches are found corresponding to the specified index, the original string is returned.

Parameters
regexpregular expression
stringinput string
indexindex of matched parts (starting at 1)
Returns
matched part of string

Definition at line 453 of file JRootToolkit.hh.

454  {
455  TPRegexp buffer = regexp;
456  TObjArray* array = buffer.MatchS(string);
457  TString result = string;
458 
459  if (index - 1 < array->GetLast()) {
460  result = ((TObjString*) array->At(index))->GetName();
461  }
462 
463  delete array;
464 
465  return result;
466  }
bool JROOT::setParameter ( TF1 &  f1,
const JFitParameter_t parameter 
)
inline

Set fit parameter.

Parameters
f1fit function
parameterparameter index and value

Definition at line 518 of file JRootToolkit.hh.

519  {
520  if (parameter.index >= 0 && parameter.index < f1.GetNpar()) {
521 
522  f1.SetParameter(parameter.index, parameter.value);
523 
524  return true;
525 
526  } else {
527 
528  return false;
529  }
530  }
const JPolynome f1(1.0, 2.0, 3.0)
Function.
bool JROOT::fixParameter ( TF1 &  f1,
const JFitParameter_t parameter 
)
inline

Fix fit parameter.

Parameters
f1fit function
parameterparameter index and value

Definition at line 539 of file JRootToolkit.hh.

540  {
541  if (parameter.index >= 0 && parameter.index < f1.GetNpar()) {
542 
543  f1.FixParameter(parameter.index, parameter.value);
544 
545  return true;
546 
547  } else {
548 
549  return false;
550  }
551  }
const JPolynome f1(1.0, 2.0, 3.0)
Function.
bool JROOT::releaseParameter ( TF1 &  f1,
const Int_t  index 
)
inline

Release fit parameter.

Parameters
f1fit function
indexparameter index

Definition at line 560 of file JRootToolkit.hh.

561  {
562  if (index >= 0 && index < f1.GetNpar()) {
563 
564  f1.ReleaseParameter(index);
565 
566  return true;
567 
568  } else {
569 
570  return false;
571  }
572  }
const JPolynome f1(1.0, 2.0, 3.0)
Function.
bool JROOT::setParLimits ( TF1 &  f1,
const Int_t  index,
Double_t  xmin,
Double_t  xmax 
)
inline

Set fit parameter limits.

Parameters
f1fit function
indexparameter index
xminlower limit
xmaxupper limit

Definition at line 583 of file JRootToolkit.hh.

584  {
585  using namespace std;
586 
587  if (index >= 0 && index < f1.GetNpar()) {
588 
589  if (xmin == 0.0) { xmin = -numeric_limits<Double_t>::min(); }
590  if (xmax == 0.0) { xmax = +numeric_limits<Double_t>::min(); }
591 
592  f1.SetParLimits(index, xmin, xmax);
593 
594  return true;
595 
596  } else {
597 
598  return false;
599  }
600  }
const double xmax
Definition: JQuadrature.cc:24
const JPolynome f1(1.0, 2.0, 3.0)
Function.
const double xmin
Definition: JQuadrature.cc:23
bool JROOT::isParameterFixed ( const TF1 &  f1,
const Int_t  index 
)
inline

Check if fit parameter is fixed.

Parameters
f1fit function
indexparameter index

Definition at line 609 of file JRootToolkit.hh.

610  {
611  if (index >= 0 && index < f1.GetNpar()) {
612 
613  Double_t xmin;
614  Double_t xmax;
615 
616  f1.GetParLimits(index, xmin, xmax);
617 
618  return (xmin != 0.0 && xmax != 0.0 && xmin >= xmax);
619 
620  } else {
621 
622  return false;
623  }
624  }
const double xmax
Definition: JQuadrature.cc:24
const JPolynome f1(1.0, 2.0, 3.0)
Function.
const double xmin
Definition: JQuadrature.cc:23
template<class T >
Double_t JROOT::getResult ( const TString &  text,
const T object,
const JRootDictionary_t dictionary = JRootDictionary::getInstance() 
)
inline

Get result of given textual formula.

The formula may contain names of data members of the given object. For example:

        getResult("a / b.value", object, ..);

In this, the corresponding data type should have (at least) data members a and b and b should have (at least) data member value.

Parameters
texttext
objectobject
dictionarydictionary
Returns
value

Definition at line 644 of file JRootToolkit.hh.

647  {
648  using namespace std;
649  using namespace JPP;
650 
651  const TRegexp DOUBLE("[0-9.][eE][+-0-9]");
652 
653  string buffer = (const char*) text;
654 
655  for (string::size_type pos = 0; pos != buffer.size(); ) {
656 
657  if (isalpha(buffer[pos]) || buffer[pos] == '_') {
658 
659  string::size_type len = 1;
660 
661  while (pos + len != buffer.size() && (isalnum(buffer[pos+len]) || buffer[pos+len] == '_' || buffer[pos+len] == '.')) {
662  ++len;
663  }
664 
665  if (len != 1 || pos == 0 || TString(buffer.substr(pos-1).c_str()).Index(DOUBLE) != 0) {
666 
667  ostringstream os;
668 
669  os.setf(ios::fixed);
670  os.precision(10);
671 
672  JRootPrinter::print(os, object, buffer.substr(pos,len), dictionary);
673 
674  buffer.replace(pos, len, os.str());
675 
676  pos += os.str().size();
677 
678  continue;
679  }
680  }
681 
682  pos += 1;
683  }
684 
685  return TFormula("/tmp", buffer.c_str()).Eval(0.0);
686  }
char text[TEXT_SIZE]
Definition: elog.cc:72
print
Definition: JConvertDusj.sh:44
TGraph* JROOT::histogramToGraph ( const TH1 &  h1)
inline

Helper method to convert a 1D histogram to a graph.

The graph consists of:

  • bin centers as x values;
  • bin contents as y values.

Note that underflow and overflow bins are ignored.

Parameters
h11D histogram
Returns
pointer to newly create graph

Definition at line 701 of file JRootToolkit.hh.

702  {
703  const int N = h1.GetNbinsX();
704 
705  std::vector<double> x(N), y(N);
706 
707  for (int i = 0; i < N; i++) {
708  x[i] = h1.GetBinCenter (i + 1);
709  y[i] = h1.GetBinContent(i + 1);
710  }
711 
712  return new TGraph(N, &x[0], &y[0]);
713  }
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition: JMuonPostfit.sh:40
TH1* JROOT::projectHistogram ( const TH2 &  h2,
const Double_t  xmin,
const Double_t  xmax,
const char  projection 
)
inline

Helper method for ROOT histogram projections.

Parameters
h22D histogram
xminlower limit
xmaxupper limit
projectionprojection (x|X|y|Y)
Returns
pointer to newly created 1D histogram

Definition at line 725 of file JRootToolkit.hh.

726  {
727  switch (projection) {
728 
729  case 'x':
730  case 'X':
731  return h2.ProjectionX("_px", h2.GetYaxis()->FindBin(xmin), h2.GetYaxis()->FindBin(xmax));
732 
733  case 'y':
734  case 'Y':
735  return h2.ProjectionY("_py", h2.GetXaxis()->FindBin(xmin), h2.GetXaxis()->FindBin(xmax));
736 
737  default:
738  return NULL;
739  }
740  }
const double xmax
Definition: JQuadrature.cc:24
const double xmin
Definition: JQuadrature.cc:23
std::vector<std::string> JROOT::to_vector ( TCollection *  col)

Definition at line 18 of file JTreeBranchAddresses.hh.

19 {
21 
22  TIter next(col);
23  TObject* object{nullptr};
24  while ((object = next()) != nullptr) {
25  names.emplace_back(object->GetName());
26  }
27  return names;
28 }
Definition: JRoot.hh:19
template<class T >
JTreeParameters JROOT::getTreeParameters ( )
inline

Template definition for method returning TTree parameters.

The template argument refers to the class for which ROOT TTree I/O is desired.

Returns
TTree parameters

Definition at line 171 of file JTreeParameters.hh.

172  {
173  return getTreeParameters(JType<T>());
174  }
JROOT::JTreeParameters getTreeParameters(JLANG::JType< JRECONSTRUCTION::JEvt >)
Get TTree parameters for given data type.
template<class T >
JNullType JROOT::getTreeParameters ( const JType< T > &  type)
inline

Method with argument definition for obtaining TTree parameters.

The method argument refers to the class for which ROOT TTree I/O is desired. This method should then be overloaded and the overloaded method should return a JTreeParameters object with the corresponding TTree parameters.

Parameters
typedata type
Returns
TTree parameters
template<class T >
JTreeCopyWriter<T>& JROOT::getTreeCopyWriter ( )
inline

Get the TTree writer and copy for this type of object.

Returns
TTree writer and copy for this type of object

Definition at line 265 of file JTreeWriter.hh.

266  {
268  }
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:75

Variable Documentation

const char* const JROOT::ROOT_FILE_RECOVERY_DISABLE = "ROOT_FILE_RECOVERY_DISABLE"
static

Environment variable to disable ROOT file recovery.

If not set or set to 0, allow recovery of ROOT file, else do not.

Definition at line 37 of file JRootFile.hh.