Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Typedefs | Functions
JROOT Namespace Reference

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

Classes

class  JAbstractStreamer
 Forward declaration of writer object. 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...
 
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 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  JRootLabel
 Replica of structure JLANG::JLabel for data types with ROOT I/O. More...
 
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...
 
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  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 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  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...
 

Typedefs

typedef Long64_t counter_type
 Type definition for counter. 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...
 
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::set< JROOTClassSelectorgetROOTClassSelection ()
 Get ROOT class selection. More...
 
template<class T >
void getObject (TFile *file, const char *key, T *&ps)
 Read object from ROOT file. More...
 
template<class T >
bool putObject (TDirectory *dir, const T &object)
 Write object to ROOT directory. 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 >
const char * getName ()
 Get ROOT name of given data type. More...
 
template<class T >
const char * getName (const JType< T > &type)
 Get ROOT name of given data type. More...
 
bool resetObject (TH1 *object, const bool reset=false)
 Reset TH1 object. More...
 
bool resetObject (TGraph *object, const bool reset=false)
 Reset TGraph object. More...
 
bool resetObject (TGraphErrors *object, const bool reset=false)
 Reset TGraphErrors object. More...
 
bool resetObject (TNtuple *object, const bool reset=false)
 Reset TNtuple object. More...
 
TFile & operator<< (TFile &file, const TObject &object)
 Write object to ROOT file. More...
 
const TStreamerInfo * getStreamerInfo (TFile *file, const char *name)
 Get ROOT streamer information of class with given name. More...
 
const TStreamerInfo * getStreamerInfo (const char *file_name, const char *name)
 Get ROOT streamer information of class with given name. More...
 
int getStreamerVersion (TFile *file, const char *name)
 Get ROOT streamer version of class with given name. More...
 
int getStreamerVersion (const char *file_name, const char *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 (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 &in)
 Converts a 1D histogram to a TGraph with: More...
 
TH1 * projectHistogram (const TH2 &in, const JTOOLS::JRange< int > R, const char coordinate= 'x')
 Helper method for ROOT Projection(X|Y) based on a JRange object and a coordinate. More...
 
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...
 

Detailed Description

Auxiliary classes and methods for ROOT I/O.

Author
mdejong
mdejong, mlincett

Typedef Documentation

typedef Long64_t JROOT::counter_type

Type definition for counter.

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

Function Documentation

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

Advance counter.

Parameters
countercounter (I/O)
valueoffset
limitlimit
Returns
increment

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

38  {
39  const counter_type previous = counter;
40 
41  if (counter + value < limit)
42  counter += value;
43  else
44  counter = limit;
45 
46  return counter - previous;
47  }
Long64_t counter_type
Type definition for counter.
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 634 of file JRootClass.hh.

636  {
637  if (parent.getClass() != NULL) {
638 
639  TIterator* i = NULL;
640 
641  i = parent.getClass()->GetListOfDataMembers()->MakeIterator();
642 
643  for (const TDataMember* p; (p = (const TDataMember*) i->Next()) != NULL; ) {
644 
645  const JRootClass abc = parent.get(*p);
646 
647  if (abc == member && abc.getOffset() == member.getOffset()) {
648  return p;
649  }
650  }
651 
652  i = parent.getClass()->GetListOfBases()->MakeIterator();
653 
654  for (const TBaseClass* p; (p = (const TBaseClass*) i->Next()) != NULL; ) {
655 
656  if (JRootClass::is_class(*p) && !JRootClass::is_STLcontainer(*p)) {
657 
658  const TDataMember* q = getDataMember(parent.get(*p), member);
659 
660  if (q != NULL) {
661  return q;
662  }
663  }
664  }
665  }
666 
667  return NULL;
668  }
int getOffset() const
Get offset of this class with respect to parent class.
Definition: JRootClass.hh:170
const TDataMember * getDataMember(const JRootClass &parent, const JRootClass &member)
Get ROOT data member for given parent and member class.
Definition: JRootClass.hh:634
JRootClass get(const TDataMember &data_member) const
Get ROOT class of given data member.
Definition: JRootClass.hh:278
TClass * getClass() const
Get class.
Definition: JRootClass.hh:181
Auxiliary class to manage access to base classes and data members of ROOT class.
Definition: JRootClass.hh:38
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 678 of file JRootClass.hh.

679  {
680  return getDataMember(JRootClass(getType<JClass_t>()), JRootClass(pd));
681  }
const TDataMember * getDataMember(const JRootClass &parent, const JRootClass &member)
Get ROOT data member for given parent and member class.
Definition: JRootClass.hh:634
Auxiliary class to manage access to base classes and data members of ROOT class.
Definition: JRootClass.hh:38
template<class T >
std::set<JROOTClassSelector> JROOT::getROOTClassSelection ( )
inline

Get ROOT class selection.

Returns
ROOT class selection

Definition at line 240 of file JROOTClassSelector.hh.

241  {
242  return JROOTClassSelection(JType<T>());
243  }
Auxiliary class for ROOT class selection.
template<class T >
void JROOT::getObject ( TFile *  file,
const char *  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  }
template<class T >
bool 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 38 of file JRootFileWriter.hh.

39  {
40  return (dir != NULL && dir->WriteTObject(&object) > 0);
41  }
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.
template<class T >
void JROOT::actionAtFileRead ( T object)
inline

General action method at file read.

The class T should provide the policy method:

   void actionAtFileRead();

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

Parameters
objectpointer to object (I/O)

Definition at line 169 of file JRootSupportkit.hh.

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

Get ROOT name of given data type.

Returns
name of object to be read

Definition at line 53 of file JRootToolkit.hh.

54  {
55  return getName(JType<T>());
56  }
const char * getName()
Get ROOT name of given data type.
Definition: JRootToolkit.hh:53
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 66 of file JRootToolkit.hh.

67  {
68  return T::Class_Name();
69  }
bool JROOT::resetObject ( TH1 *  object,
const bool  reset = false 
)
inline

Reset TH1 object.

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

Definition at line 79 of file JRootToolkit.hh.

80  {
81  if (object != NULL) {
82 
83  object->SetDirectory(0);
84 
85  if (reset) {
86  object->Reset();
87  }
88 
89  return true;
90  }
91 
92  return false;
93  }
void reset(T &value)
Reset value.
bool JROOT::resetObject ( TGraph *  object,
const bool  reset = false 
)
inline

Reset TGraph object.

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

Definition at line 103 of file JRootToolkit.hh.

104  {
105  if (object != NULL) {
106 
107  if (reset) {
108  for (int i = 0; i != object->GetN(); ++i) {
109  object->SetPoint(i, 0.0, 0.0);
110  }
111  }
112 
113  return true;
114  }
115 
116  return false;
117  }
void reset(T &value)
Reset value.
bool JROOT::resetObject ( TGraphErrors *  object,
const bool  reset = false 
)
inline

Reset TGraphErrors object.

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

Definition at line 127 of file JRootToolkit.hh.

128  {
129  if (object != NULL) {
130 
131  if (reset) {
132  for (int i = 0; i != object->GetN(); ++i) {
133  object->SetPoint (i, 0.0, 0.0);
134  object->SetPointError(i, 0.0, 0.0);
135  }
136  }
137 
138  return true;
139  }
140 
141  return false;
142  }
void reset(T &value)
Reset value.
bool JROOT::resetObject ( TNtuple *  object,
const bool  reset = false 
)
inline

Reset TNtuple object.

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

Definition at line 152 of file JRootToolkit.hh.

153  {
154  if (object != NULL) {
155 
156  object->SetDirectory(0);
157 
158  if (reset) {
159  object->Reset();
160  }
161 
162  return true;
163  }
164 
165  return false;
166  }
void reset(T &value)
Reset value.
TFile& JROOT::operator<< ( TFile &  file,
const TObject object 
)

Write object to ROOT file.

Parameters
fileROOT file
objectROOT object
Returns
ROOT file

Definition at line 176 of file JRootToolkit.hh.

177  {
178  file.WriteTObject(&object);
179 
180  return file;
181  }
const TStreamerInfo* JROOT::getStreamerInfo ( TFile *  file,
const char *  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 192 of file JRootToolkit.hh.

193  {
194  if (file != NULL && file->IsOpen()) {
195 
196  const TString buffer(name);
197 
198  TIter iter(file->GetStreamerInfoList());
199 
200  for (const TStreamerInfo* pStreamerInfo; (pStreamerInfo = (TStreamerInfo*) iter.Next()) != NULL; ) {
201  if (buffer == TString(pStreamerInfo->GetName())) {
202  return pStreamerInfo;
203  }
204  }
205  }
206 
207  return NULL;
208  }
then echo n User name
Definition: JCookie.sh:45
const TStreamerInfo* JROOT::getStreamerInfo ( const char *  file_name,
const char *  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 219 of file JRootToolkit.hh.

220  {
221  JRootInputFile file(file_name);
222 
223  return getStreamerInfo(file.getFile(), name);
224  }
const TStreamerInfo * getStreamerInfo(TFile *file, const char *name)
Get ROOT streamer information of class with given name.
ROOT input file.
Definition: JRootFile.hh:101
then echo n User name
Definition: JCookie.sh:45
int JROOT::getStreamerVersion ( TFile *  file,
const char *  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 235 of file JRootToolkit.hh.

236  {
237  const TStreamerInfo* pStreamerInfo = getStreamerInfo(file, name);
238 
239  if (pStreamerInfo != NULL)
240  return pStreamerInfo->GetClassVersion();
241  else
242  return -1;
243  }
const TStreamerInfo * getStreamerInfo(TFile *file, const char *name)
Get ROOT streamer information of class with given name.
then echo n User name
Definition: JCookie.sh:45
int JROOT::getStreamerVersion ( const char *  file_name,
const char *  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 254 of file JRootToolkit.hh.

255  {
256  JRootInputFile file(file_name);
257 
258  return getStreamerVersion(file.getFile(), name);
259  }
int getStreamerVersion(TFile *file, const char *name)
Get ROOT streamer version of class with given name.
ROOT input file.
Definition: JRootFile.hh:101
then echo n User name
Definition: JCookie.sh:45
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 272 of file JRootToolkit.hh.

273  {
274  TPRegexp buffer = regexp;
275  TObjArray* array = buffer.MatchS(string);
276 
277  if (index - 1 < array->GetLast())
278  return ((TObjString*) array->At(index))->GetName();
279  else
280  return string;
281  }
bool JROOT::setParameter ( TF1 &  f1,
const JFitParameter_t parameter 
)
inline

Set fit parameter.

Parameters
f1fit function
parameterparameter index and value

Definition at line 333 of file JRootToolkit.hh.

334  {
335  if (parameter.index >= 0 && parameter.index < f1.GetNpar()) {
336 
337  f1.SetParameter(parameter.index, parameter.value);
338 
339  return true;
340 
341  } else {
342 
343  return false;
344  }
345  }
bool JROOT::fixParameter ( TF1 &  f1,
const JFitParameter_t parameter 
)
inline

Fix fit parameter.

Parameters
f1fit function
parameterparameter index and value

Definition at line 354 of file JRootToolkit.hh.

355  {
356  if (parameter.index >= 0 && parameter.index < f1.GetNpar()) {
357 
358  f1.FixParameter(parameter.index, parameter.value);
359 
360  return true;
361 
362  } else {
363 
364  return false;
365  }
366  }
bool JROOT::releaseParameter ( TF1 &  f1,
const Int_t  index 
)
inline

Release fit parameter.

Parameters
f1fit function
indexparameter index

Definition at line 375 of file JRootToolkit.hh.

376  {
377  if (index >= 0 && index < f1.GetNpar()) {
378 
379  f1.ReleaseParameter(index);
380 
381  return true;
382 
383  } else {
384 
385  return false;
386  }
387  }
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 398 of file JRootToolkit.hh.

399  {
400  using namespace std;
401 
402  if (index >= 0 && index < f1.GetNpar()) {
403 
404  if (xmin == 0.0) { xmin = -numeric_limits<Double_t>::min(); }
405  if (xmax == 0.0) { xmax = +numeric_limits<Double_t>::min(); }
406 
407  f1.SetParLimits(index, xmin, xmax);
408 
409  return true;
410 
411  } else {
412 
413  return false;
414  }
415  }
bool JROOT::isParameterFixed ( TF1 &  f1,
const Int_t  index 
)
inline

Check if fit parameter is fixed.

Parameters
f1fit function
indexparameter index

Definition at line 424 of file JRootToolkit.hh.

425  {
426  if (index >= 0 && index < f1.GetNpar()) {
427 
428  Double_t xmin;
429  Double_t xmax;
430 
431  f1.GetParLimits(index, xmin, xmax);
432 
433  return (xmin != 0.0 && xmax != 0.0 && xmin >= xmax);
434 
435  } else {
436 
437  return false;
438  }
439  }
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. Example:

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

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

Parameters
texttext
objectobject
dictionarydictionary
Returns
value

Definition at line 457 of file JRootToolkit.hh.

460  {
461  using namespace std;
462  using namespace JPP;
463 
464  string buffer = (const char*) text;
465 
466  for (string::size_type pos = 0; pos != buffer.size(); ) {
467 
468  if (isalpha(buffer[pos]) || buffer[pos] == '_') {
469 
470  string::size_type len = 1;
471 
472  while (pos + len != buffer.size() && (isalnum(buffer[pos+len]) || buffer[pos+len] == '_' || buffer[pos+len] == '.')) {
473  ++len;
474  }
475 
476  ostringstream os;
477 
478  os.precision(10);
479 
480  JRootPrinter::print(os, object, buffer.substr(pos,len), dictionary);
481 
482  buffer.replace(pos, len, os.str());
483 
484  pos += os.str().size();
485 
486  } else {
487 
488  pos += 1;
489  }
490  }
491 
492  return TFormula("/tmp", buffer.c_str()).Eval(0.0);
493  }
char text[TEXT_SIZE]
Definition: elog.cc:72
print
Definition: JConvertDusj.sh:44
TGraph* JROOT::histogramToGraph ( const TH1 &  in)
inline

Converts a 1D histogram to a TGraph with:

  • bin centers as x values;
  • bin contents as y values. Underflow and overflow bins are ignored.
    Parameters
    ininput histogram

Definition at line 502 of file JRootToolkit.hh.

502  {
503 
504  const int N = in.GetNbinsX();
505 
506  std::vector<double> x(N), y(N);
507 
508  for (int i = 0; i < N; i++) {
509  x[i] = in.GetBinCenter (i + 1);
510  y[i] = in.GetBinContent(i + 1);
511  }
512 
513  TGraph* out = new TGraph(N, &x[0], &y[0]);
514 
515  return out;
516 
517  }
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition: JMuonPostfit.sh:37
TH1* JROOT::projectHistogram ( const TH2 &  in,
const JTOOLS::JRange< int >  R,
const char  coordinate = 'x' 
)
inline

Helper method for ROOT Projection(X|Y) based on a JRange object and a coordinate.

Parameters
in2D histogram
Rrange
coordinateprojection coordinate

Definition at line 526 of file JRootToolkit.hh.

526  {
527 
528  int inf, sup;
529 
530  switch(coordinate) {
531 
532  case 'x':
533  case 'X':
534  inf = in.GetYaxis()->FindBin(R.getLowerLimit());
535  sup = in.GetYaxis()->FindBin(R.getUpperLimit());
536  return in.ProjectionX("_px", inf, sup);
537 
538  case 'y':
539  case 'Y':
540  inf = in.GetXaxis()->FindBin(R.getLowerLimit());
541  sup = in.GetXaxis()->FindBin(R.getUpperLimit());
542  return in.ProjectionY("_py", inf, sup);
543 
544  default:
545  return NULL;
546 
547  }
548 
549  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:215
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:226
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 149 of file JTreeParameters.hh.

150  {
151  return getTreeParameters(JType<T>());
152  }
JROOT::JTreeParameters getTreeParameters(JLANG::JType< JRECONSTRUCTION::JEvt >)
Get TTree parameters for given data type.
Definition: JEvt.hh:406
template<class T >
JNullType JROOT::getTreeParameters ( const JType< T > &  type)
inline

Method with argument definition for obtaining TTree parameters.

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

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

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

Returns
TTree writer and copy for this type of object

Definition at line 168 of file JTreeWriter.hh.

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