ATLAS Offline Software
Public Member Functions | Public Attributes | Private Attributes | List of all members
VKalVrtAthena::NtupleVars Class Reference

#include <NtupleVars.h>

Collaboration diagram for VKalVrtAthena::NtupleVars:

Public Member Functions

 NtupleVars ()
 
 ~NtupleVars ()
 
void setupNtupleVariables ()
 
void branchNtuple (TTree *tree)
 
void deleteNtupleVariables ()
 
template<class T >
void addNewVar (const std::string &varname)
 
template<class T >
bool isAvailable (const std::string &varname)
 
template<class T >
T & get (const std::string &varname)
 
void clear ()
 

Public Attributes

std::vector< IntersectionPos * > m_RecoTrk_Int
 
std::vector< IntersectionPos * > m_SVTrk_Int
 

Private Attributes

std::map< std::string, BaseHolder * > m_varHolder
 

Detailed Description

Definition at line 117 of file NtupleVars.h.

Constructor & Destructor Documentation

◆ NtupleVars()

VKalVrtAthena::NtupleVars::NtupleVars ( )
default

◆ ~NtupleVars()

VKalVrtAthena::NtupleVars::~NtupleVars ( )
default

Member Function Documentation

◆ addNewVar()

template<class T >
void VKalVrtAthena::NtupleVars::addNewVar ( const std::string &  varname)
inline

Definition at line 134 of file NtupleVars.h.

134  {
135  m_varHolder.insert( make_pair(std::string(varname), new varHolder<T>) );
136  }

◆ branchNtuple()

void VKalVrtAthena::NtupleVars::branchNtuple ( TTree *  tree)

Definition at line 28 of file NtupleVars.cxx.

28  {
29 
30  for( auto pair : m_varHolder ) {
31  pair.second->branch_tree( pair.first, tree );
32  }
33 
34  /*
35  for( auto *layer : m_RecoTrk_Int ) {
36  layer->setBranchAddress( tree, "RecoTrk_Int" );
37  }
38  */
39 
40  /*
41  for( auto *layer : m_SVTrk_Int ) {
42  layer->setBranchAddress( tree, "SVTrk" );
43  }
44  */
45 
46 
47  }

◆ clear()

void VKalVrtAthena::NtupleVars::clear ( )

Definition at line 50 of file NtupleVars.cxx.

50  {
51  for( auto& pair : m_varHolder ) {
52  pair.second->clear();
53  }
54 
55  // for( auto *layer : m_RecoTrk_Int ) {
56  // layer->clear();
57  // }
58 
59  // for( auto *layer : m_SVTrk_Int ) {
60  // layer->clear();
61  // }
62 
63  }

◆ deleteNtupleVariables()

void VKalVrtAthena::NtupleVars::deleteNtupleVariables ( )

Definition at line 24 of file NtupleVars.cxx.

24 {}

◆ get()

template<class T >
T& VKalVrtAthena::NtupleVars::get ( const std::string &  varname)
inline

Definition at line 165 of file NtupleVars.h.

165  {
166  try{
167  if( !isAvailable<T>(varname) ) {
168  throw( varname );
169  }
170 
171  varHolder<T>* holder = static_cast< varHolder<T>* >( m_varHolder.at( varname ) );
172  return holder->get();
173 
174  } catch( std::string& varname ) {
175  std::cerr << "Variable " << varname << " is not found in the list!" << std::endl;
176  std::cerr << "Candidates are..." << std::endl;
177  int stat(0);
178  for( auto pair : m_varHolder ) {
179  char* name = abi::__cxa_demangle(typeid( T ).name(), 0, 0, &stat);
180  if( pair.second->get_typename() == name ) {
181  std::cerr << " " << pair.second->get_typename() << " : " << pair.first << std::endl;
182  }
183  delete name;
184  }
185 
186  }
187 
188  std::abort();
189  }

◆ isAvailable()

template<class T >
bool VKalVrtAthena::NtupleVars::isAvailable ( const std::string &  varname)
inline

Definition at line 138 of file NtupleVars.h.

138  {
139  if( m_varHolder.find(varname) == m_varHolder.end() ) {
140  std::cerr << "Warning<TImprovedTree::isAvailable>: "
141  << "couldn't find the variable name " << varname
142  << std::endl;
143  return false;
144  } else {
145  BaseHolder* var = m_varHolder.at( varname );
146  int stat;
147  char* name = abi::__cxa_demangle(typeid( T ).name(), 0, 0, &stat);
148 
149  if( var->get_typename() == name ) {
150  delete name;
151  return true;
152  } else {
153  delete name;
154  std::cerr << "Info<TImprovedTree::isAvailable>: " << "typeid didn't match." << std::endl;
155  std::cerr << "Possible candidates are..." << std::endl;
156  std::cerr << "========" << std::endl;
157  std::cerr << varname << " (" << var->get_typename() << ")" << std::endl;
158  std::cerr << "========" << std::endl;
159  return false;
160  }
161 
162  }
163  }

◆ setupNtupleVariables()

void VKalVrtAthena::NtupleVars::setupNtupleVariables ( )

Definition at line 20 of file NtupleVars.cxx.

20 {}

Member Data Documentation

◆ m_RecoTrk_Int

std::vector<IntersectionPos*> VKalVrtAthena::NtupleVars::m_RecoTrk_Int

Definition at line 123 of file NtupleVars.h.

◆ m_SVTrk_Int

std::vector<IntersectionPos*> VKalVrtAthena::NtupleVars::m_SVTrk_Int

Definition at line 124 of file NtupleVars.h.

◆ m_varHolder

std::map<std::string, BaseHolder*> VKalVrtAthena::NtupleVars::m_varHolder
private

Definition at line 119 of file NtupleVars.h.


The documentation for this class was generated from the following files:
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
tree
TChain * tree
Definition: tile_monitor.h:30
beamspotman.stat
stat
Definition: beamspotman.py:266
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
VKalVrtAthena::NtupleVars::m_varHolder
std::map< std::string, BaseHolder * > m_varHolder
Definition: NtupleVars.h:119
LArG4AODNtuplePlotter.varname
def varname(hname)
Definition: LArG4AODNtuplePlotter.py:37