Jpp  debug
the software that should make you happy
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 >
void 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...
 
void resetObject (TH3 *h3, const bool reset=false)
 Reset TH3 object. More...
 
void resetObject (TH2 *h2, const bool reset=false)
 Reset TH2 object. More...
 
void resetObject (TH1 *h1, const bool reset=false)
 Reset TH1 object. More...
 
void resetObject (TGraph *g1, const bool reset=false)
 Reset TGraph object. More...
 
void resetObject (TGraphErrors *g1, const bool reset=false)
 Reset TGraphErrors object. More...
 
void resetObject (TGraphAsymmErrors *g1, const bool reset=false)
 Reset TGraphAsymmErrors object. More...
 
void resetObject (TGraph2D *g2, const bool reset=false)
 Reset TGraph2D object. More...
 
void resetObject (TGraph2DErrors *g2, const bool reset=false)
 Reset TGraph2DErrors object. More...
 
void resetObject (TMultiGraph *gs, const bool reset=false)
 Reset TMultiGraph object. More...
 
void AddPoint (TGraph *g1, const Double_t x, const Double_t y)
 Add point to TGraph. 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 (TGraphAsymmErrors *g1, const Double_t x, const Double_t y, const Double_t exl, const Double_t exh, const Double_t eyl, const Double_t eyh)
 Add point to TGraphAsymmErrors. More...
 
void AddPoint (TGraph2D *g1, const Double_t x, const Double_t y, const Double_t z)
 Add point to TGraph2D. 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

◆ counter_type

typedef Long64_t JROOT::counter_type

Type definition for counter.

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

◆ range_type

Type definiton of abscissa range.

Definition at line 43 of file JRootfit.hh.

Function Documentation

◆ advance()

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.

◆ getLegend()

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  }
static const double H
Planck constant [eV s].
data_type w[N+1][M+1]
Definition: JPolint.hh:867
Definition: JSTDTypes.hh:14

◆ resetObject() [1/10]

template<class JKey_t , class JValue_t >
void JROOT::resetObject ( JManager< JKey_t, JValue_t > *  object,
const bool  reset = false 
)
inline

Reset JManager object.

Parameters
objectmanager
resetreset contents if true

Definition at line 394 of file JManager.hh.

395  {
396  if (object->is_valid()) {
397 
398  resetObject(object->get(), reset);
399 
400  for (typename JManager<JKey_t, JValue_t>::iterator i = object->begin(); i != object->end(); ++i) {
401  resetObject(i->second.get(), reset);
402  }
403  }
404  }
bool is_valid() const
Check validity of pointer.
virtual JClass_t * get() const override
Get pointer.
Definition: JPointer.hh:64
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
Definition: JManager.hh:47
void resetObject(JManager< JKey_t, JValue_t > *object, const bool reset=false)
Reset JManager object.
Definition: JManager.hh:394
void reset(T &value)
Reset value.

◆ getDataMember() [1/2]

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  }
const TDataMember * getDataMember(JType_t JClass_t::*pd)
Get ROOT data member for given C++ data member.
Definition: JRootClass.hh:688
Auxiliary class to manage access to base classes and data members of ROOT class.
Definition: JRootClass.hh:43
JRootClass get(const TDataMember &data_member) const
Get ROOT class of given data member.
Definition: JRootClass.hh:293
int getOffset() const
Get offset of this class with respect to parent class.
Definition: JRootClass.hh:183
TClass * getClass() const
Get class.
Definition: JRootClass.hh:194

◆ getDataMember() [2/2]

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  }

◆ getListOfDataMembers()

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  }

◆ getROOTClassSelection()

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.

◆ getObject()

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  }

◆ putObject() [1/4]

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  }

◆ putObject() [2/4]

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  }

◆ putObject() [3/4]

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  }
JAssert<!JConversion< T, TObject >::is_derived, bool >::type putObject(TDirectory *dir, const T &object)
Write object to ROOT directory.

◆ putObject() [4/4]

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  }

◆ getRange()

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  }
JTOOLS::JRange< double > range_type
Type definiton of abscissa range.
Definition: JRootfit.hh:43

◆ Fit() [1/6]

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.
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.
Definition: JRootfit.hh:1365

◆ Fit() [2/6]

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  }

◆ Fit() [3/6]

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  }

◆ Fit() [4/6]

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  }

◆ Fit() [5/6]

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  }
double f3(const double x, const double y, const double z)
3D function.
Definition: JPolynome3D.cc:23

◆ Fit() [6/6]

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  }

◆ actionAtFileOpen()

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  }
Auxiliary class to handle version management of given class at opening of a ROOT file.

◆ actionAtFileRead()

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.

◆ FillRandom() [1/6]

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  }

◆ FillRandom() [2/6]

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  }

◆ FillRandom() [3/6]

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  }

◆ FillRandom() [4/6]

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

◆ FillRandom() [5/6]

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  }

◆ FillRandom() [6/6]

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  }

◆ getName() [1/2]

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 62 of file JRootToolkit.hh.

63  {
64  return getName(JType<T>());
65  }
const char * getName(const JType< T > &type)
Get ROOT name of given data type.
Definition: JRootToolkit.hh:75
Auxiliary class for a type holder.
Definition: JType.hh:19

◆ getName() [2/2]

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 75 of file JRootToolkit.hh.

76  {
77  return T::Class_Name();
78  }

◆ resetObject() [2/10]

void JROOT::resetObject ( TH3 *  h3,
const bool  reset = false 
)
inline

Reset TH3 object.

Parameters
h3pointer to TH3 object
resetreset contents if true

Definition at line 87 of file JRootToolkit.hh.

88  {
89  if (h3 != NULL) {
90 
91  for (int ix = 1; ix <= h3->GetXaxis()->GetNbins(); ++ix) {
92  for (int iy = 1; iy <= h3->GetYaxis()->GetNbins(); ++iy) {
93  for (int iz = 1; iz <= h3->GetZaxis()->GetNbins(); ++iz) {
94 
95  h3->SetBinError(ix, iy, iz, 0.0);
96 
97  if (reset) {
98  h3->SetBinContent(ix, iy, iz, 0.0);
99  }
100  }
101  }
102  }
103  }
104  }

◆ resetObject() [3/10]

void JROOT::resetObject ( TH2 *  h2,
const bool  reset = false 
)
inline

Reset TH2 object.

Parameters
h2pointer to TH2 object
resetreset contents if true

Definition at line 113 of file JRootToolkit.hh.

114  {
115  if (h2 != NULL) {
116 
117  for (int ix = 1; ix <= h2->GetXaxis()->GetNbins(); ++ix) {
118  for (int iy = 1; iy <= h2->GetYaxis()->GetNbins(); ++iy) {
119 
120  h2->SetBinError(ix, iy, 0.0);
121 
122  if (reset) {
123  h2->SetBinContent(ix, iy, 0.0);
124  }
125  }
126  }
127  }
128  }

◆ resetObject() [4/10]

void JROOT::resetObject ( TH1 *  h1,
const bool  reset = false 
)
inline

Reset TH1 object.

Parameters
h1pointer to TH1 object
resetreset contents if true

Definition at line 137 of file JRootToolkit.hh.

138  {
139 #define RESET_OBJECT(T, P, O) if (dynamic_cast<T*>(P) != NULL) { resetObject(dynamic_cast<T*>(P), O); return; }
140 
141  if (h1 != NULL) {
142 
143  if (reset) {
144 
145  h1->Reset();
146 
147  } else {
148 
149  RESET_OBJECT(TH3, h1, reset);
150  RESET_OBJECT(TH2, h1, reset);
151 
152  for (int ix = 1; ix <= h1->GetXaxis()->GetNbins(); ++ix) {
153 
154  h1->SetBinError(ix, 0.0);
155 
156  if (reset) {
157  h1->SetBinContent(ix, 0.0);
158  }
159  }
160  }
161  }
162 
163 #undef RESET_OBJECT
164  }
#define RESET_OBJECT(T, P, O)

◆ resetObject() [5/10]

void JROOT::resetObject ( TGraph *  g1,
const bool  reset = false 
)
inline

Reset TGraph object.

Parameters
g1pointer to TGraph object
resetreset contents if true

Definition at line 173 of file JRootToolkit.hh.

174  {
175  if (g1 != NULL) {
176 
177  for (int i = 0; i != g1->GetN(); ++i) {
178 
179  if (reset) {
180  g1->SetPoint(i, g1->GetX()[i], 0.0);
181  }
182  }
183  }
184  }
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25

◆ resetObject() [6/10]

void JROOT::resetObject ( TGraphErrors *  g1,
const bool  reset = false 
)
inline

Reset TGraphErrors object.

Parameters
g1pointer to TGraphErrors object
resetreset contents if true

Definition at line 193 of file JRootToolkit.hh.

194  {
195  if (g1 != NULL) {
196 
197  for (int i = 0; i != g1->GetN(); ++i) {
198 
199  g1->SetPointError(i, 0.0, 0.0);
200 
201  if (reset) {
202  g1->SetPoint(i, g1->GetX()[i], 0.0);
203  }
204  }
205  }
206  }

◆ resetObject() [7/10]

void JROOT::resetObject ( TGraphAsymmErrors *  g1,
const bool  reset = false 
)
inline

Reset TGraphAsymmErrors object.

Parameters
g1pointer to TGraphErrors object
resetreset contents if true

Definition at line 215 of file JRootToolkit.hh.

216  {
217  if (g1 != NULL) {
218 
219  for (int i = 0; i != g1->GetN(); ++i) {
220 
221  g1->SetPointError(i, 0.0, 0.0, 0.0, 0.0);
222 
223  if (reset) {
224  g1->SetPoint(i, g1->GetX()[i], 0.0);
225  }
226  }
227  }
228  }

◆ resetObject() [8/10]

void JROOT::resetObject ( TGraph2D *  g2,
const bool  reset = false 
)
inline

Reset TGraph2D object.

Parameters
g2pointer to TGraph2D object
resetreset contents if true

Definition at line 237 of file JRootToolkit.hh.

238  {
239  if (g2 != NULL) {
240 
241  for (int i = 0; i != g2->GetN(); ++i) {
242 
243  if (reset) {
244  g2->SetPoint(i, g2->GetX()[i], g2->GetY()[i], 0.0);
245  }
246  }
247  }
248  }

◆ resetObject() [9/10]

void JROOT::resetObject ( TGraph2DErrors *  g2,
const bool  reset = false 
)
inline

Reset TGraph2DErrors object.

Parameters
g2pointer to TGraph2DErrors object
resetreset contents if true

Definition at line 257 of file JRootToolkit.hh.

258  {
259  if (g2 != NULL) {
260 
261  for (int i = 0; i != g2->GetN(); ++i) {
262 
263  g2->SetPointError(i, 0.0, 0.0, 0.0);
264 
265  if (reset) {
266  g2->SetPoint(i, g2->GetX()[i], g2->GetY()[i], 0.0);
267  }
268  }
269  }
270  }

◆ resetObject() [10/10]

void JROOT::resetObject ( TMultiGraph *  gs,
const bool  reset = false 
)
inline

Reset TMultiGraph object.

Parameters
gspointer to TMultiGraph object
resetreset contents if true

Definition at line 279 of file JRootToolkit.hh.

280  {
281 #define RESET_OBJECT(T, P, O) if (dynamic_cast<T*>(P) != NULL) { resetObject(dynamic_cast<T*>(P), O); continue; }
282 
283  if (gs != NULL) {
284 
285  for (TIter next(gs->GetListOfGraphs()); TGraph* graph = (TGraph*) next(); ) {
286  RESET_OBJECT(TGraphAsymmErrors, graph, reset);
287  RESET_OBJECT(TGraphErrors, graph, reset);
288  RESET_OBJECT(TGraph, graph, reset);
289  }
290  }
291 
292 #undef RESET_OBJECT
293  }

◆ AddPoint() [1/5]

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 303 of file JRootToolkit.hh.

306  {
307  const Int_t n = g1->GetN();
308 
309  g1->Set(n + 1);
310  g1->SetPoint(n, x, y);
311  }
const int n
Definition: JPolint.hh:786

◆ AddPoint() [2/5]

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 323 of file JRootToolkit.hh.

328  {
329  const Int_t n = g1->GetN();
330 
331  g1->Set(n + 1);
332  g1->SetPoint(n, x, y);
333  g1->SetPointError(n, ex, ey);
334  }

◆ AddPoint() [3/5]

void JROOT::AddPoint ( TGraphAsymmErrors *  g1,
const Double_t  x,
const Double_t  y,
const Double_t  exl,
const Double_t  exh,
const Double_t  eyl,
const Double_t  eyh 
)
inline

Add point to TGraphAsymmErrors.

Parameters
g1pointer to valid ROOT TGraph object
xx value
yy value
exlx error low
exhx error high
eyly error low
eyhy error high

Definition at line 348 of file JRootToolkit.hh.

355  {
356  const Int_t n = g1->GetN();
357 
358  g1->Set(n + 1);
359  g1->SetPoint(n, x, y);
360  g1->SetPointError(n, exl, exh, eyl, eyh);
361  }

◆ AddPoint() [4/5]

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 372 of file JRootToolkit.hh.

376  {
377  const Int_t n = g1->GetN();
378 
379  g1->Set(n + 1);
380  g1->SetPoint(n, x, y, z);
381  }

◆ AddPoint() [5/5]

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 395 of file JRootToolkit.hh.

402  {
403  const Int_t n = g1->GetN();
404 
405  g1->Set(n + 1);
406  g1->SetPoint(n, x, y, z);
407  g1->SetPointError(n, ex, ey, ez);
408  }

◆ operator<<()

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 418 of file JRootToolkit.hh.

419  {
420  file.WriteTObject(&object);
421 
422  return file;
423  }

◆ getStreamerInfo() [1/2]

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 434 of file JRootToolkit.hh.

435  {
436  if (file != NULL && file->IsOpen()) {
437 
438  const TString buffer(name);
439 
440  TIter iter(file->GetStreamerInfoList());
441 
442  for (const TStreamerInfo* pStreamerInfo; (pStreamerInfo = (TStreamerInfo*) iter.Next()) != NULL; ) {
443  if (buffer == TString(pStreamerInfo->GetName())) {
444  return pStreamerInfo;
445  }
446  }
447  }
448 
449  return NULL;
450  }

◆ getStreamerInfo() [2/2]

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 461 of file JRootToolkit.hh.

462  {
463  JRootInputFile file(file_name);
464 
465  return getStreamerInfo(file.getFile(), name);
466  }
ROOT input file.
Definition: JRootFile.hh:97
const TStreamerInfo * getStreamerInfo(const char *const file_name, const char *const name)
Get ROOT streamer information of class with given name.

◆ getStreamerVersion() [1/2]

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 477 of file JRootToolkit.hh.

478  {
479  const TStreamerInfo* pStreamerInfo = getStreamerInfo(file, name);
480 
481  if (pStreamerInfo != NULL)
482  return pStreamerInfo->GetClassVersion();
483  else
484  return -1;
485  }

◆ getStreamerVersion() [2/2]

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 496 of file JRootToolkit.hh.

497  {
498  JRootInputFile file(file_name);
499 
500  return getStreamerVersion(file.getFile(), name);
501  }
int getStreamerVersion(const char *const file_name, const char *const name)
Get ROOT streamer version of class with given name.

◆ parse()

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 514 of file JRootToolkit.hh.

515  {
516  TPRegexp buffer = regexp;
517  TObjArray* array = buffer.MatchS(string);
518  TString result = string;
519 
520  if (index - 1 < array->GetLast()) {
521  result = ((TObjString*) array->At(index))->GetName();
522  }
523 
524  delete array;
525 
526  return result;
527  }

◆ setParameter()

bool JROOT::setParameter ( TF1 &  f1,
const JFitParameter_t parameter 
)
inline

Set fit parameter.

Parameters
f1fit function
parameterparameter index and value

Definition at line 579 of file JRootToolkit.hh.

580  {
581  if (parameter.index >= 0 && parameter.index < f1.GetNpar()) {
582 
583  f1.SetParameter(parameter.index, parameter.value);
584 
585  return true;
586 
587  } else {
588 
589  return false;
590  }
591  }

◆ fixParameter()

bool JROOT::fixParameter ( TF1 &  f1,
const JFitParameter_t parameter 
)
inline

Fix fit parameter.

Parameters
f1fit function
parameterparameter index and value

Definition at line 600 of file JRootToolkit.hh.

601  {
602  if (parameter.index >= 0 && parameter.index < f1.GetNpar()) {
603 
604  f1.FixParameter(parameter.index, parameter.value);
605 
606  return true;
607 
608  } else {
609 
610  return false;
611  }
612  }

◆ releaseParameter()

bool JROOT::releaseParameter ( TF1 &  f1,
const Int_t  index 
)
inline

Release fit parameter.

Parameters
f1fit function
indexparameter index

Definition at line 621 of file JRootToolkit.hh.

622  {
623  if (index >= 0 && index < f1.GetNpar()) {
624 
625  f1.ReleaseParameter(index);
626 
627  return true;
628 
629  } else {
630 
631  return false;
632  }
633  }

◆ setParLimits()

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 644 of file JRootToolkit.hh.

645  {
646  using namespace std;
647 
648  if (index >= 0 && index < f1.GetNpar()) {
649 
650  if (xmin == 0.0) { xmin = -numeric_limits<Double_t>::min(); }
651  if (xmax == 0.0) { xmax = +numeric_limits<Double_t>::min(); }
652 
653  f1.SetParLimits(index, xmin, xmax);
654 
655  return true;
656 
657  } else {
658 
659  return false;
660  }
661  }
const double xmax
Definition: JQuadrature.cc:24
const double xmin
Definition: JQuadrature.cc:23

◆ isParameterFixed()

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 670 of file JRootToolkit.hh.

671  {
672  if (index >= 0 && index < f1.GetNpar()) {
673 
674  Double_t xmin;
675  Double_t xmax;
676 
677  f1.GetParLimits(index, xmin, xmax);
678 
679  return (xmin != 0.0 && xmax != 0.0 && xmin >= xmax);
680 
681  } else {
682 
683  return false;
684  }
685  }

◆ getResult()

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 705 of file JRootToolkit.hh.

708  {
709  using namespace std;
710  using namespace JPP;
711 
712  const TRegexp DOUBLE("[0-9.][eE][+-0-9]");
713 
714  string buffer = (const char*) text;
715 
716  for (string::size_type pos = 0; pos != buffer.size(); ) {
717 
718  if (isalpha(buffer[pos]) || buffer[pos] == '_') {
719 
720  string::size_type len = 1;
721 
722  while (pos + len != buffer.size() && (isalnum(buffer[pos+len]) || buffer[pos+len] == '_' || buffer[pos+len] == '.')) {
723  ++len;
724  }
725 
726  if (len != 1 || pos == 0 || TString(buffer.substr(pos-1).c_str()).Index(DOUBLE) != 0) {
727 
728  ostringstream os;
729 
730  os.setf(ios::fixed);
731  os.precision(10);
732 
733  JRootPrinter::print(os, object, buffer.substr(pos,len), dictionary);
734 
735  buffer.replace(pos, len, os.str());
736 
737  pos += os.str().size();
738 
739  continue;
740  }
741  }
742 
743  pos += 1;
744  }
745 
746  return TFormula("/tmp", buffer.c_str()).Eval(0.0);
747  }
char text[TEXT_SIZE]
Definition: elog.cc:72
std::ostream & print(std::ostream &out, const JTestSummary &summary, const char delimiter=' ', const bool useColors=true)
Print test summary.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).

◆ histogramToGraph()

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 762 of file JRootToolkit.hh.

763  {
764  const int N = h1.GetNbinsX();
765 
766  std::vector<double> x(N), y(N);
767 
768  for (int i = 0; i < N; i++) {
769  x[i] = h1.GetBinCenter (i + 1);
770  y[i] = h1.GetBinContent(i + 1);
771  }
772 
773  return new TGraph(N, &x[0], &y[0]);
774  }

◆ projectHistogram()

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 786 of file JRootToolkit.hh.

787  {
788  switch (projection) {
789 
790  case 'x':
791  case 'X':
792  return h2.ProjectionX("_px", h2.GetYaxis()->FindBin(xmin), h2.GetYaxis()->FindBin(xmax));
793 
794  case 'y':
795  case 'Y':
796  return h2.ProjectionY("_py", h2.GetXaxis()->FindBin(xmin), h2.GetXaxis()->FindBin(xmax));
797 
798  default:
799  return NULL;
800  }
801  }

◆ to_vector()

std::vector<std::string> JROOT::to_vector ( TCollection *  col)
inline

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

◆ getTreeParameters() [1/2]

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  }
JNullType getTreeParameters(const JType< T > &type)
Method with argument definition for obtaining TTree parameters.

◆ getTreeParameters() [2/2]

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

◆ getTreeCopyWriter()

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

◆ ROOT_FILE_RECOVERY_DISABLE

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.