1 |
mocchiut |
1.1 |
/** @file |
2 |
mocchiut |
1.2 |
* $Source: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/event/PamelaRun.h,v $ |
3 |
mocchiut |
1.5 |
* $Id: PamelaRun.h,v 1.4 2009/08/05 18:48:41 pam-fi Exp $ |
4 |
|
|
* $Author: pam-fi $ |
5 |
mocchiut |
1.1 |
* |
6 |
|
|
* Header file for the PamelaRun class. |
7 |
|
|
*/ |
8 |
|
|
/*! \mainpage Yoda |
9 |
|
|
* <H1> Yet anOther Data Analysis package</H1> |
10 |
|
|
* YODA is the proposed data processing and analysis package for |
11 |
|
|
* <A HREF="http://wizard.roma2.infn.it/pamela/fram_des.htm">Pamela</A>. |
12 |
|
|
* Aditionally to the automatically generated information, there is a short |
13 |
|
|
* tutorial available: |
14 |
|
|
* <H2> <A HREF="yoda1.html">Installation</A></H2> |
15 |
|
|
* <H2> <A HREF="yoda2.html">General terminology</A></H2> |
16 |
|
|
* <H2> <A HREF="yoda3.html">Directory and file structure</A></H2> |
17 |
|
|
* <H2> <A HREF="yoda4.html">Code organization</A></H2> |
18 |
|
|
* <H2> <A HREF="yoda5.html">Interactive analysis</A></H2> |
19 |
|
|
* <H2> <A HREF="yoda6.html">Existing subpackets</A></H2> |
20 |
|
|
* <H2> <A HREF="yoda7.html">Writing new subpackets</A></H2> |
21 |
|
|
* <H2> <A HREF="yoda8.html">Writing Algorithms</A></H2> |
22 |
|
|
* <H2> <A HREF="yoda9.html">Bibliography</A></H2> |
23 |
|
|
* |
24 |
|
|
*/ |
25 |
|
|
#ifndef PAMELA_RUN_H |
26 |
|
|
#define PAMELA_RUN_H |
27 |
|
|
|
28 |
|
|
|
29 |
|
|
#include <TFile.h> //Substituted by Maurizio 05 Feb 2004 |
30 |
|
|
#include <TTree.h> //Substituted by Maurizio 05 Feb 2004 |
31 |
|
|
#include <TChain.h> //Substituted by Maurizio 05 Feb 2004 |
32 |
|
|
|
33 |
|
|
#include "Algorithm.h" |
34 |
|
|
#include "EventHeader.h" |
35 |
|
|
#include "RunInfoYoda.h" |
36 |
|
|
#include <list> |
37 |
pam-fi |
1.4 |
#include <map> |
38 |
mocchiut |
1.1 |
|
39 |
|
|
/** |
40 |
|
|
* pamela is the base namespace of this package. |
41 |
|
|
*/ |
42 |
|
|
namespace pamela { |
43 |
|
|
class Algorithm; |
44 |
|
|
/** |
45 |
|
|
* Base class for a "Run", that is used for reading and writing |
46 |
|
|
* data to the ROOT files in pamela. |
47 |
|
|
*/ |
48 |
|
|
class PamelaRun { |
49 |
|
|
private: |
50 |
|
|
std::stringstream oss; |
51 |
|
|
/** |
52 |
|
|
* The path to the bases of the ROOT repository. |
53 |
|
|
*/ |
54 |
|
|
std::string Path; |
55 |
|
|
/** |
56 |
|
|
* The path to the bases for Unpacking. |
57 |
|
|
*/ |
58 |
|
|
std::string UnpackPath; |
59 |
|
|
/** |
60 |
|
|
* The run name; |
61 |
|
|
*/ |
62 |
|
|
std::string Run; |
63 |
|
|
/** |
64 |
|
|
* The run number. |
65 |
|
|
*/ |
66 |
|
|
int RunNumber; |
67 |
|
|
/** |
68 |
mocchiut |
1.3 |
* compression Level. |
69 |
|
|
*/ |
70 |
|
|
short compression; |
71 |
|
|
/** |
72 |
mocchiut |
1.1 |
* Multiple/Single unpack. |
73 |
|
|
*/ |
74 |
|
|
bool Multiple; |
75 |
|
|
/** |
76 |
|
|
* single File. |
77 |
|
|
*/ |
78 |
|
|
TFile *SingleFile; |
79 |
|
|
/** |
80 |
|
|
* The information about the run to be stored in the ROOT files |
81 |
|
|
*/ |
82 |
|
|
pamela::RunInfoYoda info; |
83 |
|
|
void RunExists(std::string) throw (std::exception); |
84 |
|
|
std::string GetDirName(const pamela::PacketType*) const; |
85 |
|
|
std::string GetFileName(const pamela::SubPacket*, std::string) ; |
86 |
|
|
std::string GetFileName(const pamela::SubPacket*) ; |
87 |
|
|
TChain* ReadHeaderTree(const pamela::PacketType*) throw (std::exception); |
88 |
|
|
TTree* CreateTTree(pamela::Algorithm*, const pamela::SubPacket*, std::string name) |
89 |
|
|
throw (std::exception); |
90 |
|
|
|
91 |
|
|
protected: |
92 |
|
|
/** |
93 |
|
|
* A map used to store ROOT trees distinguished by the packet type. |
94 |
|
|
*/ |
95 |
|
|
typedef std::map<const pamela::PacketType*, TTree*> RootTreeMap; |
96 |
|
|
/** |
97 |
|
|
* A map of all opened header ROOT trees, sorted by the |
98 |
|
|
* PacketType. The trees will have mounted all other trees of the |
99 |
|
|
* same package type as friends. |
100 |
|
|
*/ |
101 |
|
|
RootTreeMap TTreeMap; //! |
102 |
|
|
/** |
103 |
|
|
* A list of ROOT TFiles. |
104 |
|
|
*/ |
105 |
|
|
typedef std::list<TFile *> TFileList; |
106 |
|
|
/** |
107 |
|
|
* A list of ROOT TTrees. |
108 |
|
|
*/ |
109 |
|
|
typedef std::list<TTree *> TTreeList; |
110 |
|
|
/** |
111 |
|
|
* A map of Root Tree lists, with their packet type as key. |
112 |
|
|
*/ |
113 |
|
|
typedef std::map<const pamela::PacketType*, TTreeList> TTreeListMap; |
114 |
|
|
/** |
115 |
|
|
* The map of lists of all ROOT TTrees, sorted by the packet type. |
116 |
|
|
*/ |
117 |
|
|
TTreeListMap WritingRootTrees; //! |
118 |
|
|
/** |
119 |
|
|
* A map that contains subpacket objects sorted by their names. |
120 |
|
|
*/ |
121 |
|
|
typedef std::map<std::string, pamela::SubPacket*> SubPacketMap; |
122 |
|
|
/** |
123 |
|
|
* The map of all subpackets that are currently read from the trees. |
124 |
|
|
*/ |
125 |
|
|
SubPacketMap SubPacketAddresses; |
126 |
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
public: |
130 |
|
|
PamelaRun(std::string, std::string, bool, short); |
131 |
|
|
|
132 |
|
|
//virtual ~PamelaRun(){}; |
133 |
|
|
virtual ~PamelaRun(); |
134 |
|
|
//Marco: I need to delete and set to NULL SingleFile |
135 |
|
|
|
136 |
|
|
static std::string GetRunName(int run); |
137 |
|
|
//static int RunExists(int = 1) throw (std::exception); |
138 |
|
|
|
139 |
|
|
/** |
140 |
|
|
* Get the run number. |
141 |
|
|
*/ |
142 |
|
|
int GetRunNumber(void) const { return RunNumber; } |
143 |
|
|
TTree* ReadTTree(pamela::PacketType const *); |
144 |
|
|
void ReadSubPacket(void *); |
145 |
|
|
void ReadSubPacket(void *, std::string); |
146 |
|
|
void ReadSubPacket(const pamela::Algorithm*, void*); |
147 |
|
|
void ReadSubPacket(const pamela::Algorithm*, void*, std::string); |
148 |
|
|
void WriteSubPacket(pamela::Algorithm*, void*, const TClass*); |
149 |
|
|
void WriteSubPacket(pamela::Algorithm*, void*, const TClass*, std::string); |
150 |
|
|
void WriteHeaders(pamela::Algorithm*, pamela::EventHeader **); |
151 |
|
|
void WriteHeader(pamela::Algorithm*, pamela::EventHeader**, const pamela::PacketType*); // 23/11/2002 maurizio mede it from private to public |
152 |
|
|
void WriteFiles(void); |
153 |
mocchiut |
1.5 |
void WriteFilesEasy(); |
154 |
mocchiut |
1.1 |
void FillTrees(const pamela::PacketType*); |
155 |
|
|
std::string GetRun(){ return Run; } |
156 |
|
|
std::string GetPath(){ return Path; } |
157 |
|
|
std::string GetUnpackPath(){ return UnpackPath; } |
158 |
mocchiut |
1.3 |
ClassDef(PamelaRun, 4) |
159 |
mocchiut |
1.1 |
}; |
160 |
|
|
} |
161 |
|
|
|
162 |
|
|
#endif /* PAMELA_RUN_H */ |