hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FlatTupleMaker.h
Go to the documentation of this file.
1/*
2 * @file FlatTupleMaker.h
3 * @author Omar Moreno
4 * @date January 18, 2016
5 * @author PF
6 * @date Jan, 2020
7 * @brief
8 *
9 */
10
11#ifndef __FLAT_TUPLE_MAKER_H__
12#define __FLAT_TUPLE_MAKER_H__
13
14//----------------//
15// C++ StdLib //
16//----------------//
17#include <string>
18#include <map>
19#include <iostream>
20
21//----------//
22// ROOT //
23//----------//
24#include <TFile.h>
25#include <TTree.h>
26
33
34 public:
41 FlatTupleMaker(std::string file_name, std::string tree_name);
42
48 FlatTupleMaker(std::string tree_name);
49
52
58 void addVariable(std::string variable_name);
59
65 void addString(std::string variable_name);
66
72 void addVector(std::string vector_name);
73
80 void setVariableValue(std::string variable_name, double value) { variables[variable_name] = value; };
81
88 void setVariableValue(std::string variable_name, std::string value) { string_variables[variable_name] = value; };
89
96 void addToVector(std::string variable_name, double value);
97
105 bool hasVariable(std::string variable_name);
106
111 void close();
112
119 std::vector<double> getVector(std::string variable_name);
120
125 void writeTree() {
126 tree->Write();
127 }
128
133 void fill();
134
135 private:
136
138 TFile* file{nullptr};
139
141 TTree* tree{nullptr};
142
144 std::map <std::string, double> variables;
145
147 std::map <std::string, std::string> string_variables;
148
150 std::map <std::string, std::vector<double>> vectors;
151
152
153};
154
155#endif // __FLAT_TUPLE_MAKER_H__
description
std::vector< double > getVector(std::string variable_name)
description
void addVector(std::string vector_name)
description
void writeTree()
Write root tree.
void addVariable(std::string variable_name)
description
std::map< std::string, std::vector< double > > vectors
void close()
description
void setVariableValue(std::string variable_name, std::string value)
description
std::map< std::string, double > variables
void addToVector(std::string variable_name, double value)
description
void setVariableValue(std::string variable_name, double value)
description
bool hasVariable(std::string variable_name)
description
void addString(std::string variable_name)
description
void fill()
description
std::map< std::string, std::string > string_variables