Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JChainReader.hh
Go to the documentation of this file.
1#ifndef __JROOT__JCHAINREADER__
2#define __JROOT__JCHAINREADER__
3
4#include "TChain.h"
5
8
9
10/**
11 * \file
12 * TChain reading for template data type.
13 * \author mdejong
14 */
15namespace JROOT {}
16namespace JPP { using namespace JROOT; }
17
18namespace JROOT {
19
20 /**
21 * Auxiliary class for template TChain reading.
22 */
23 template<class T>
24 class JChainReader :
25 public TChain,
26 public JRootAddress<T>,
27 public JTreeParameters
28 {
29 public:
30 /**
31 * Default constructor.
32 *
33 * Note that the default TTree parameters are obtained using template method JROOT::getTreeParameters.
34 */
40
41
42 /**
43 * Constructor.
44 *
45 * \param parameters parameters of TTree
46 */
47 JChainReader(const JTreeParameters& parameters) :
48 JTreeParameters(parameters)
49 {
50 configure();
51 }
52
53
54 /**
55 * Copy constructor.
56 *
57 * Note that the TTree parameters are copied but not the contents.
58 *
59 * \param reader TChain reader
60 */
63 {
64 configure();
65 }
66
67
68 /**
69 * Reset this TChain.
70 *
71 * This method executes the following steps:
72 * -# TChain::Reset();
73 * -# releases the allocated memory and resets the internal pointer;
74 * -# SetBranchAddress();
75 *
76 * \param option option
77 */
78 void Reset(Option_t* option = NULL)
79 {
80 TChain::Reset(option);
81
82 this->release();
83
84 this->SetBranchAddress(this->getBranchName(), &this->address);
85 }
86
87
88 protected:
89 /**
90 * Configure this TChain.
91 */
92 void configure()
93 {
94 this->SetNameTitle(this->getTreeName(), this->getTreeTitle());
95
96 this->SetBranchAddress(this->getBranchName(), &this->address);
97 }
98 };
99}
100
101#endif
Auxiliary class for template TChain reading.
JChainReader(const JTreeParameters &parameters)
Constructor.
JChainReader()
Default constructor.
void Reset(Option_t *option=NULL)
Reset this TChain.
JChainReader(const JChainReader< T > &reader)
Copy constructor.
void configure()
Configure this TChain.
Data structure for TTree parameters.
const JTreeParameters & getTreeParameters() const
Get TTree parameters.
const TString & getBranchName() const
Get TBranch name.
const TString & getTreeTitle() const
Get TTree title.
const TString & getTreeName() const
Get TTree name.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for ROOT I/O.
Auxiliary classd for address handling within TTree or TChain.
void release()
Release memory.