Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JROOT Namespace Reference

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

Classes

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  index_list
 Auxiliary data structure for list of fixed parameters. More...
 
class  JAbstractComparator
 Interface for comparison of a template class. More...
 
class  JAbstractStreamer
 Forward declaration of writer object. More...
 
struct  JAbstractTreeReader
 Interface for TTree reading. More...
 
class  JAbstractType
 Interface for handling of a template class. More...
 
class  JAbstractTypewriter
 Interface for printing of a template 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  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...
 
struct  JBranchClass
 ROOT readable class for TBranch. 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  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  JFitParameter_t
 Auxiliary data structure for a parameter index and its value. More...
 
struct  JGraph
 Auxiliary data structure to build TGraph. More...
 
struct  JGraph2D
 Auxiliary data structure to build TGraph2D. More...
 
struct  JGraph2D_t
 Data structure for graph data. More...
 
struct  JGraph2DErrors
 Auxiliary data structure to build TGraph2DErrors. More...
 
struct  JGraph2DErrors_t
 Data structure for graph data. More...
 
struct  JGraph_t
 Data structure for graph data. More...
 
struct  JGraphErrors
 Auxiliary data structure to build TGraphErrors. More...
 
struct  JGraphErrors_t
 Data structure for graph data. 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...
 
class  JObjectComparator
 Implementation for comparison of a template class. More...
 
class  JObjectStreamer
 JObjectStreamer class. More...
 
class  JObjectType
 Implementation for handling of a template class. More...
 
class  JObjectTypewriter
 Implementation for printing of a template class. More...
 
struct  JRandom
 Auxiliary data structure to configure random number generator. More...
 
struct  JRoot
 
struct  JRootAddress
 Auxiliary classd for address handling within TTree or TChain. More...
 
struct  JRootAddressableClass
 Auxiliary class to manage access to base classes and data members of ROOT class objects. More...
 
struct  JRootClass
 Auxiliary class to manage access to base classes and data members of ROOT class. More...
 
struct  JROOTClassSelection
 Auxiliary class for ROOT class selection. More...
 
struct  JROOTClassSelector
 Auxiliary class to select ROOT class based on class name. More...
 
class  JRootComparator
 ROOT comparator. More...
 
class  JRootCreateFlatTree
 
class  JRootCreateFlatTree< JACOUSTICS::JToA >
 
class  JRootDictionary
 Default implementation of ROOT based dictionary for ASCII I/O. More...
 
struct  JRootDictionary_t
 Type definition of ROOT based dictionary for ASCII I/O. More...
 
class  JRootFile
 ROOT file. More...
 
class  JRootFileObjectOutput
 Implementation of object output to ROOT file for single data type. More...
 
class  JRootFileObjectOutput< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JRootObjectOutput class. More...
 
class  JRootFileObjectOutput< JTypeList< JHead_t, JTail_t > >
 Implementation of object output to ROOT file for multiple data types. 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  JRootFileWriter
 ROOT file object output. More...
 
class  JRootfit
 ROOT Fit. More...
 
class  JRootfit_t
 Base class for result of ROOT Fit. More...
 
class  JRootInputFile
 ROOT input file. More...
 
struct  JRootLabel
 Replica of structure JLANG::JLabel for data types with ROOT I/O. 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  JRootOutputFile
 ROOT output file. More...
 
struct  JRootPrimitiveTypes
 
struct  JRootPrinter
 Auxiliary class for printing objects in ASCII format using JRootWriter. More...
 
struct  JRootReadableClass
 ROOT class for reading into object. More...
 
class  JRootReader
 Implementation for ASCII input of objects with ROOT dictionary. More...
 
struct  JRootStreamer
 Auxiliary template class to define default implementation of the ROOT streamer. More...
 
class  JRootStreamObjectOutput
 Template implementation of stream output for single data type based on ROOT dictionary. More...
 
class  JRootStreamObjectOutput< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JRootStreamObjectOutput class. More...
 
class  JRootStreamObjectOutput< JTypeList< JHead_t, JTail_t > >
 Template specialisationimplementation of stream object output for multiple data types. More...
 
class  JRootTypesHandler
 Auxiliary class for handling ROOT types. More...
 
class  JRootTypewriter
 ROOT type writer. More...
 
struct  JRootWritableClass
 ROOT class for writing from object. More...
 
class  JRootWriter
 Implementation for ASCII output of objects with ROOT dictionary. More...
 
class  JSonObjectOutput
 Template implementation of stream output for single data type. More...
 
class  JSonObjectOutput< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JSonObjectOutput class. More...
 
class  JSonObjectOutput< JTypeList< JHead_t, JTail_t > >
 Template specialisationimplementation of stream object output for multiple data types. 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  JTreeCopyWriter
 Implementation for template TTree writing and copying. More...
 
struct  JTreeCopyWriterInterface
 Interface for template TTree writing and copying. More...
 
class  JTreeParameters
 Data structure for TTree parameters. More...
 
class  JTreeParametersAvailable
 Test availability of TTree parameters for given class. More...
 
class  JTreeReader
 Auxiliary class for template TTree reading. More...
 
class  JTreeReaderAccessibleObjectIterator
 JTemplateTreeReader object iterator. More...
 
class  JTreeReaderObjectIterator
 JTreeReader 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...
 
class  JTreeWriterObjectOutput
 JTreeWriter object output. More...
 
class  JTreeWriterObjectOutput< JTypeList< JHead_t, JNullType > >
 Terminator class of recursive JTreeWriterObjectOutput class. More...
 
class  JTreeWriterObjectOutput< JTypeList< JHead_t, JTail_t > >
 Implementation of JTreeWriterObjectOutput for multiple data types. More...
 
struct  m_1d
 1D data point. More...
 
struct  m_2d
 2D data point. More...
 
struct  m_3d
 3D data point. More...
 
struct  m_count
 Data point for counting measurement. More...
 
struct  m_value
 Data point for value with error. More...
 

Typedefs

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

Functions

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

Variables

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

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 }

◆ 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 }
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

◆ 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 parent class
memberROOT member class
Returns
pointer to ROOT data member

Definition at line 309 of file JRootClass.hh.

311 {
312 if (parent.getClass() != NULL) {
313
314 for (TIter next(parent.getClass()->GetListOfDataMembers(kFALSE)); const TDataMember *p = (const TDataMember*) next(); ) {
315
316 const JRootClass abc = parent.get(*p);
317
318 if (abc == member && abc.getOffset() == member.getOffset()) {
319 return p;
320 }
321 }
322
323 for (TIter next(parent.getClass()->GetListOfBases()); const TBaseClass *p = (const TBaseClass*) next(); ) {
324
325 if (JRoot::is_class(*p) && !JRoot::is_STLcontainer(*p)) {
326
327 const TDataMember* q = getDataMember(parent.get(*p), member);
328
329 if (q != NULL) {
330 return q;
331 }
332 }
333 }
334 }
335
336 return NULL;
337 }
const TDataMember * getDataMember(const JRootClass &parent, const JRootClass &member)
Get ROOT data member for given parent and member class.
Auxiliary class to manage access to base classes and data members of ROOT class.
Definition JRootClass.hh:44
TClass * getClass() const
Get class.
int getOffset() const
Get offset of this class with respect to parent class.
Definition JRootClass.hh:98
JRootClass get(const TDataMember &object) const
Get ROOT class of given data member.

◆ 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 347 of file JRootClass.hh.

348 {
350 }
Auxiliary class for a type holder.
Definition JType.hh:19

◆ getListOfDataMembers()

template<class T >
std::vector< TDataMember * > JROOT::getListOfDataMembers ( )
inline

Get list of ROOT data members for given class.

Definition at line 357 of file JRootClass.hh.

358 {
359 static std::vector<TDataMember*> buffer;
360
361 if (buffer.empty()) {
362
363 TClass* rc = dynamic_cast<TClass*>(TDictionary::GetDictionary(typeid(T)));
364
365 if (rc != NULL) {
366 for (TIter next(rc->GetListOfDataMembers(kFALSE)); TDataMember *p = (TDataMember*) next(); ) {
367 if (JRoot::is_class(p->GetName())) {
368 buffer.push_back(p);
369 }
370 }
371 }
372 }
373
374 return buffer;
375 }

◆ 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 }
bool putObject(TDirectory &dir, const TObject &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 }

◆ 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 }
ROOT Fit.
Definition JRootfit.hh:940

◆ 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.

◆ 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 }

◆ 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 192 of file JRootPrinter.hh.

195 {
196 using namespace std;
197 using namespace JPP;
198
199 const TRegexp DOUBLE("[0-9.][eE][+-0-9]");
200
201 string buffer = (const char*) text;
202
203 for (string::size_type pos = 0; pos != buffer.size(); ) {
204
205 if (isalpha(buffer[pos]) || buffer[pos] == '_') {
206
207 string::size_type len = 1;
208
209 while (pos + len != buffer.size() && (isalnum(buffer[pos+len]) || buffer[pos+len] == '_' || buffer[pos+len] == '.')) {
210 ++len;
211 }
212
213 if (len != 1 || pos == 0 || TString(buffer.substr(pos-1).c_str()).Index(DOUBLE) != 0) {
214
215 ostringstream os;
216
217 os.setf(ios::fixed);
218 os.precision(10);
219
220 JRootPrinter::print(os, object, buffer.substr(pos,len), dictionary);
221
222 buffer.replace(pos, len, os.str());
223
224 pos += os.str().size();
225
226 continue;
227 }
228 }
229
230 pos += 1;
231 }
232
233 return TFormula("/tmp", buffer.c_str()).Eval(0.0);
234 }
char text[TEXT_SIZE]
Definition elog.cc:72
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).

◆ 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_t {
114
115 Double_t x;
116 double W;
117
118 inline bool operator<(const double W) const { return this->W < W; }
119 };
120
121 vector<tuple_t> 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_t>::const_iterator p = lower_bound(buffer.begin(), buffer.end(), W * gRandom->Rndm());
137
138 h1->Fill(p->x);
139 }
140 }
bool operator<(const Status_Item &first, const Status_Item &second)
comparator for Status item; earliest hit first
Definition Ars.hh:413
const JPolynome f1(1.0, 2.0, 3.0)
Function.

◆ 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_t {
156
157 Double_t x;
158 Double_t y;
159 double W;
160
161 inline bool operator<(const double W) const { return this->W < W; }
162 };
163
164 vector<tuple_t> 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_t>::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_t {
202
203 Double_t x;
204 Double_t y;
205 Double_t z;
206 double W;
207
208 inline bool operator<(const double W) const { return this->W < W; }
209 };
210
211 vector<tuple_t> 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_t>::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 57 of file JRootToolkit.hh.

58 {
59 return getName(JType<T>());
60 }
const char * getName()
Get ROOT name of given data type.

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

71 {
72 return T::Class_Name();
73 }

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

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

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

109 {
110 if (h2 != NULL) {
111
112 for (int ix = 1; ix <= h2->GetXaxis()->GetNbins(); ++ix) {
113 for (int iy = 1; iy <= h2->GetYaxis()->GetNbins(); ++iy) {
114
115 h2->SetBinError(ix, iy, 0.0);
116
117 if (reset) {
118 h2->SetBinContent(ix, iy, 0.0);
119 }
120 }
121 }
122 }
123 }

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

133 {
134#define RESET_OBJECT(T, P, O) if (dynamic_cast<T*>(P) != NULL) { resetObject(dynamic_cast<T*>(P), O); return; }
135
136 if (h1 != NULL) {
137
138 if (reset) {
139
140 h1->Reset();
141
142 } else {
143
144 RESET_OBJECT(TH3, h1, reset);
145 RESET_OBJECT(TH2, h1, reset);
146
147 for (int ix = 1; ix <= h1->GetXaxis()->GetNbins(); ++ix) {
148
149 h1->SetBinError(ix, 0.0);
150
151 if (reset) {
152 h1->SetBinContent(ix, 0.0);
153 }
154 }
155 }
156 }
157
158#undef RESET_OBJECT
159 }
#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 168 of file JRootToolkit.hh.

169 {
170 if (g1 != NULL) {
171
172 for (int i = 0; i != g1->GetN(); ++i) {
173
174 if (reset) {
175 g1->SetPoint(i, g1->GetX()[i], 0.0);
176 }
177 }
178 }
179 }
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 188 of file JRootToolkit.hh.

189 {
190 if (g1 != NULL) {
191
192 for (int i = 0; i != g1->GetN(); ++i) {
193
194 g1->SetPointError(i, 0.0, 0.0);
195
196 if (reset) {
197 g1->SetPoint(i, g1->GetX()[i], 0.0);
198 }
199 }
200 }
201 }

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

211 {
212 if (g1 != NULL) {
213
214 for (int i = 0; i != g1->GetN(); ++i) {
215
216 g1->SetPointError(i, 0.0, 0.0, 0.0, 0.0);
217
218 if (reset) {
219 g1->SetPoint(i, g1->GetX()[i], 0.0);
220 }
221 }
222 }
223 }

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

233 {
234 if (g2 != NULL) {
235
236 for (int i = 0; i != g2->GetN(); ++i) {
237
238 if (reset) {
239 g2->SetPoint(i, g2->GetX()[i], g2->GetY()[i], 0.0);
240 }
241 }
242 }
243 }

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

253 {
254 if (g2 != NULL) {
255
256 for (int i = 0; i != g2->GetN(); ++i) {
257
258 g2->SetPointError(i, 0.0, 0.0, 0.0);
259
260 if (reset) {
261 g2->SetPoint(i, g2->GetX()[i], g2->GetY()[i], 0.0);
262 }
263 }
264 }
265 }

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

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

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

301 {
302 const Int_t n = g1->GetN();
303
304 g1->Set(n + 1);
305 g1->SetPoint(n, x, y);
306 }

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

323 {
324 const Int_t n = g1->GetN();
325
326 g1->Set(n + 1);
327 g1->SetPoint(n, x, y);
328 g1->SetPointError(n, ex, ey);
329 }

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

350 {
351 const Int_t n = g1->GetN();
352
353 g1->Set(n + 1);
354 g1->SetPoint(n, x, y);
355 g1->SetPointError(n, exl, exh, eyl, eyh);
356 }

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

371 {
372 const Int_t n = g1->GetN();
373
374 g1->Set(n + 1);
375 g1->SetPoint(n, x, y, z);
376 }

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

397 {
398 const Int_t n = g1->GetN();
399
400 g1->Set(n + 1);
401 g1->SetPoint(n, x, y, z);
402 g1->SetPointError(n, ex, ey, ez);
403 }

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

414 {
415 file.WriteTObject(&object);
416
417 return file;
418 }

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

430 {
431 if (file != NULL && file->IsOpen()) {
432 return dynamic_cast<const TStreamerInfo*>(file->GetStreamerInfoList()->FindObject(name));
433 }
434
435 return NULL;
436 }

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

448 {
449 JRootInputFile file(file_name);
450
451 return getStreamerInfo(file.getFile(), name);
452 }
ROOT input file.
Definition JRootFile.hh:97
const TStreamerInfo * getStreamerInfo(TFile *file, 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 463 of file JRootToolkit.hh.

464 {
465 const TStreamerInfo* pStreamerInfo = getStreamerInfo(file, name);
466
467 if (pStreamerInfo != NULL)
468 return pStreamerInfo->GetClassVersion();
469 else
470 return -1;
471 }

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

483 {
484 JRootInputFile file(file_name);
485
486 return getStreamerVersion(file.getFile(), name);
487 }
int getStreamerVersion(TFile *file, 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 500 of file JRootToolkit.hh.

501 {
502 TPRegexp buffer = regexp;
503 TObjArray* array = buffer.MatchS(string);
504 TString result = string;
505
506 if (index - 1 < array->GetLast()) {
507 result = ((TObjString*) array->At(index))->GetName();
508 }
509
510 delete array;
511
512 return result;
513 }

◆ setParameter()

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

Set fit parameter.

Parameters
f1fit function
parameterparameter index and value

Definition at line 565 of file JRootToolkit.hh.

566 {
567 if (parameter.index >= 0 && parameter.index < f1.GetNpar()) {
568
569 f1.SetParameter(parameter.index, parameter.value);
570
571 return true;
572
573 } else {
574
575 return false;
576 }
577 }

◆ fixParameter()

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

Fix fit parameter.

Parameters
f1fit function
parameterparameter index and value

Definition at line 586 of file JRootToolkit.hh.

587 {
588 if (parameter.index >= 0 && parameter.index < f1.GetNpar()) {
589
590 f1.FixParameter(parameter.index, parameter.value);
591
592 return true;
593
594 } else {
595
596 return false;
597 }
598 }

◆ releaseParameter()

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

Release fit parameter.

Parameters
f1fit function
indexparameter index

Definition at line 607 of file JRootToolkit.hh.

608 {
609 if (index >= 0 && index < f1.GetNpar()) {
610
611 f1.ReleaseParameter(index);
612
613 return true;
614
615 } else {
616
617 return false;
618 }
619 }

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

631 {
632 using namespace std;
633
634 if (index >= 0 && index < f1.GetNpar()) {
635
636 if (xmin == 0.0) { xmin = -numeric_limits<Double_t>::min(); }
637 if (xmax == 0.0) { xmax = +numeric_limits<Double_t>::min(); }
638
639 f1.SetParLimits(index, xmin, xmax);
640
641 return true;
642
643 } else {
644
645 return false;
646 }
647 }

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

657 {
658 if (index >= 0 && index < f1.GetNpar()) {
659
660 Double_t xmin;
661 Double_t xmax;
662
663 f1.GetParLimits(index, xmin, xmax);
664
665 return (xmin != 0.0 && xmax != 0.0 && xmin >= xmax);
666
667 } else {
668
669 return false;
670 }
671 }

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

685 {
686 const int N = h1.GetNbinsX();
687
688 std::vector<double> x(N), y(N);
689
690 for (int i = 0; i < N; i++) {
691 x[i] = h1.GetBinCenter (i + 1);
692 y[i] = h1.GetBinContent(i + 1);
693 }
694
695 return new TGraph(N, &x[0], &y[0]);
696 }

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

709 {
710 switch (projection) {
711
712 case 'x':
713 case 'X':
714 return h2.ProjectionX("_px", h2.GetYaxis()->FindBin(xmin), h2.GetYaxis()->FindBin(xmax));
715
716 case 'y':
717 case 'Y':
718 return h2.ProjectionY("_py", h2.GetXaxis()->FindBin(xmin), h2.GetXaxis()->FindBin(xmax));
719
720 default:
721 return NULL;
722 }
723 }

◆ handler()

template<class JType_t >
void JROOT::handler ( JType_t & object)
inline

Apply ROOT types handler to given object.

Note that the underlying TDictionary is dynamically built in ROOT.

Parameters
objectobject

Definition at line 208 of file JRootTypesHandler.hh.

209 {
211
212 handler.apply(object);
213 }
Auxiliary class for handling ROOT types.
void handler(JType_t &object)
Apply ROOT types handler to given object.

◆ to_vector()

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

Definition at line 19 of file JTreeBranchAddresses.hh.

20{
22
23 TIter next(col);
24 TObject* object{nullptr};
25 while ((object = next()) != nullptr) {
26 names.emplace_back(object->GetName());
27 }
28 return names;
29}

◆ 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 232 of file JTreeParameters.hh.

233 {
234 static JTreeParameters parameters = getTreeParameters(JType<T>());
235
236 return parameters;
237 }
JROOT::JTreeParameters getTreeParameters(JLANG::JType< JRECONSTRUCTION::JEvt >)
Get TTree parameters for given data type.
Data structure for 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 268 of file JTreeWriter.hh.

269 {
271 }
Implementation for template TTree writing and copying.

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.