Public Member Functions | Protected Attributes | List of all members
flat::Flat< T > Class Template Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-01-24/FlatMaker/FwdDeclare.h"

Public Member Functions

 Flat (TTree *tr, const std::string &name, const std::string &totsize, const IBranchPolicy *policy)
 
void Clear ()
 
void Fill (const T &x)
 

Protected Attributes

TBranch * fBranch
 
std::vector< typename FlatType< T >::typefData
 

Detailed Description

template<class T>
class flat::Flat< T >

Definition at line 8 of file FwdDeclare.h.

Constructor & Destructor Documentation

template<class T>
flat::Flat< T >::Flat ( TTree *  tr,
const std::string name,
const std::string totsize,
const IBranchPolicy policy 
)
inline

Definition at line 38 of file FlatBasicTypes.h.

39  : fBranch(0)
40  {
41  if(policy && !policy->Include(name)) return;
42 
43  fData.emplace_back(); // needed to get an address
44  T* target = (T*)&fData.front();
45  fData.clear();
46 
48 
49  if(totsize.empty()){ // this branch is not an array
50  fBranch = tr->Branch(name.c_str(), target, (name+"/"+code).c_str());
51  }
52  else{ // needs to be an array - the size is given by 'totsize'
53  fBranch = tr->Branch(name.c_str(), target, (name+"["+totsize+"]/"+code).c_str());
54  }
55  }
const XML_Char * name
Definition: expat.h:151
const XML_Char * target
Definition: expat.h:268
Definition: inftrees.h:24
TBranch * fBranch
double T
Definition: Xdiff_gwt.C:5
std::vector< typename FlatType< T >::type > fData

Member Function Documentation

template<class T>
void flat::Flat< T >::Clear ( void  )
inline

Definition at line 57 of file FlatBasicTypes.h.

Referenced by flat::Flat< caf::SRShowerLID >::Clear(), flat::Flat< caf::SRKalmanTrack >::Clear(), flat::Flat< caf::SRBpfTrack >::Clear(), and flat::Flat< caf::SRFuzzyKProng >::Clear().

58  {
59  fData.clear();
60  }
std::vector< typename FlatType< T >::type > fData
template<class T>
void flat::Flat< T >::Fill ( const T x)
inline

Definition at line 62 of file FlatBasicTypes.h.

Referenced by flat::Flat< caf::SRShowerLID >::Fill(), flat::Flat< caf::SRKalmanTrack >::Fill(), flat::Flat< caf::SRBpfTrack >::Fill(), and flat::Flat< caf::SRFuzzyKProng >::Fill().

63  {
64  const size_t oldcap = fData.capacity();
65 
66  fData.push_back(x);
67 
68  if(fBranch && fData.capacity() != oldcap){
69  // The vector re-allocated, so we need to point the branch to the new
70  // location.
71  T* target = (T*)&fData.front();
72  fBranch->SetAddress(target);
73  }
74  }
const XML_Char * target
Definition: expat.h:268
TBranch * fBranch
double T
Definition: Xdiff_gwt.C:5
std::vector< typename FlatType< T >::type > fData

Member Data Documentation

template<class T>
TBranch* flat::Flat< T >::fBranch
protected

Definition at line 77 of file FlatBasicTypes.h.

template<class T>
std::vector<typename FlatType<T>::type> flat::Flat< T >::fData
protected

Definition at line 78 of file FlatBasicTypes.h.


The documentation for this class was generated from the following files: