#ifndef __JROOT__JCHAINREADER__ #define __JROOT__JCHAINREADER__ #include "TChain.h" #include "JROOT/JRootAddress.hh" #include "JROOT/JTreeParameters.hh" /** * \file * TChain reading for template data type. * \author mdejong */ namespace JROOT {} namespace JPP { using namespace JROOT; } namespace JROOT { /** * Auxiliary class for template TChain reading. */ template class JChainReader : public TChain, public JRootAddress, public JTreeParameters { public: /** * Default constructor. * * Note that the default TTree parameters are obtained using template method JROOT::getTreeParameters. */ JChainReader() : JTreeParameters(JROOT::getTreeParameters()) { configure(); } /** * Constructor. * * \param parameters parameters of TTree */ JChainReader(const JTreeParameters& parameters) : JTreeParameters(parameters) { configure(); } /** * Copy constructor. * * Note that the TTree parameters are copied but not the contents. * * \param reader TChain reader */ JChainReader(const JChainReader& reader) : JTreeParameters(reader.getTreeParameters()) { configure(); } /** * Reset this TChain. * * This method executes the following steps: * -# TChain::Reset(); * -# releases the allocated memory and resets the internal pointer; * -# SetBranchAddress(); * * \param option option */ void Reset(Option_t* option = NULL) { TChain::Reset(option); this->release(); this->SetBranchAddress(this->getBranchName(), &this->address); } protected: /** * Configure this TChain. */ void configure() { this->SetNameTitle(this->getTreeName(), this->getTreeTitle()); this->SetBranchAddress(this->getBranchName(), &this->address); } }; } #endif