HIPO  4.3.0
High Performance Output data format for experimental physics
tuple.h
Go to the documentation of this file.
1 //******************************************************************************
2 //* ██╗ ██╗██╗██████╗ ██████╗ ██╗ ██╗ ██████╗ *
3 //* ██║ ██║██║██╔══██╗██╔═══██╗ ██║ ██║ ██╔═████╗ *
4 //* ███████║██║██████╔╝██║ ██║ ███████║ ██║██╔██║ *
5 //* ██╔══██║██║██╔═══╝ ██║ ██║ ╚════██║ ████╔╝██║ *
6 //* ██║ ██║██║██║ ╚██████╔╝ ██║██╗╚██████╔╝ *
7 //* ╚═╝ ╚═╝╚═╝╚═╝ ╚═════╝ ╚═╝╚═╝ ╚═════╝ *
8 //************************ Jefferson National Lab (2017) ***********************
9 /*
10  * Copyright (c) 2017. Jefferson Lab (JLab). All rights reserved. Permission
11  * to use, copy, modify, and distribute this software and its documentation
12  * for educational, research, and not-for-profit purposes, without fee and
13  * without a signed licensing agreement.
14  *
15  * IN NO EVENT SHALL JLAB BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL
16  * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
17  * OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF JLAB HAS
18  * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19  *
20  * JLAB SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE. THE HIPO DATA FORMAT SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF
23  * ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". JLAB HAS NO OBLIGATION TO
24  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25  *
26  * This software was developed under the United States Government license.
27  * For more information contact author at gavalian@jlab.org
28  * Department of Experimental Nuclear Physics, Jefferson Lab.
29  */
32 
33 /*
34  * File: event.h
35  * Author: gavalian
36  *
37  * Created on August 15, 2022, 17:04 PM
38  */
39 
40 #ifndef HIPO_TUPLE_H
41 #define HIPO_TUPLE_H
42 
43 #include <iostream>
44 #include <vector>
45 #include <cstring>
46 #include <cstdint>
47 #include <cstdio>
48 #include <cstdlib>
49 #include <map>
50 #include "writer.h"
51 
52 // if the library is compiled with C++11
53 // support we will use unordered map which
54 // is faster than standard map
55 #if __cplusplus > 199711L
56 #include <unordered_map>
57 #endif
58 
59 
60 namespace hipo {
61 
62  //typedef std::auto_ptr<hipo::generic_node> node_pointer;
63 
65 
71  class tuple {
72 
73  private:
74  std::vector<hipo::structure *> branches;
75  int currentPosition = 0;
78 
79  protected:
80 
82  void writeAndUpdate();
83 
84  public:
85 
87  tuple();
90  tuple(const char *format);
91  virtual ~tuple();
92 
95  void open(const char *file);
98  void initBranches(int size);
100  void setVerbose(int level){ writer.setVerbose(level);}
103  void fill(const float *array);
105  void close();
106  };
107 }
108 
109 #endif /* TUPLE_H */
Represents a HIPO event, a container for multiple structures/banks.
Definition: event.h:77
N-tuple writer for storing columnar float data in HIPO files.
Definition: tuple.h:71
virtual ~tuple()
Definition: tuple.cpp:53
void fill(const float *array)
Fill a row of values into the tuple.
Definition: tuple.cpp:66
void setVerbose(int level)
Set the writer verbosity level.
Definition: tuple.h:100
void close()
Close the output file.
Definition: tuple.cpp:78
void open(const char *file)
Open an output HIPO file.
Definition: tuple.cpp:74
void initBranches(int size)
Initialize internal branch structures.
Definition: tuple.cpp:60
tuple()
Default constructor.
Definition: tuple.cpp:46
void writeAndUpdate()
Write the current event and prepare for the next one.
Definition: tuple.cpp:82
Writer for creating HIPO files.
Definition: writer.h:156
void setVerbose(int level)
Set the verbosity level for output messages.
Definition: writer.h:209
Definition: bank.cpp:47
HIPO file writer for creating HIPO output files.