1 |
kusanagi |
1.1 |
/** @file |
2 |
mocchiut |
6.2 |
* $Source: /afs/ba.infn.it/user/pamela/src/CVS/yoda/event/PamelaRun.h,v $ |
3 |
|
|
* $Id: PamelaRun.h,v 6.1 2006/03/08 13:51:45 kusanagi Exp $ |
4 |
kusanagi |
6.0 |
* $Author: kusanagi $ |
5 |
kusanagi |
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 |
kusanagi |
4.1 |
* <H2> <A HREF="yoda9.html">Bibliography</A></H2> |
23 |
kusanagi |
1.1 |
* |
24 |
|
|
*/ |
25 |
|
|
#ifndef PAMELA_RUN_H |
26 |
|
|
#define PAMELA_RUN_H |
27 |
|
|
|
28 |
kusanagi |
5.1 |
|
29 |
kusanagi |
1.1 |
#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 "RunInfo.h" |
36 |
kusanagi |
5.1 |
#include <list> |
37 |
kusanagi |
1.1 |
|
38 |
|
|
/** |
39 |
|
|
* pamela is the base namespace of this package. |
40 |
|
|
*/ |
41 |
|
|
namespace pamela { |
42 |
|
|
class Algorithm; |
43 |
|
|
/** |
44 |
|
|
* Base class for a "Run", that is used for reading and writing |
45 |
|
|
* data to the ROOT files in pamela. |
46 |
|
|
*/ |
47 |
|
|
class PamelaRun { |
48 |
|
|
private: |
49 |
kusanagi |
2.1 |
std::stringstream oss; |
50 |
kusanagi |
1.1 |
/** |
51 |
|
|
* The path to the bases of the ROOT repository. |
52 |
|
|
*/ |
53 |
kusanagi |
6.1 |
std::string Path; |
54 |
|
|
/** |
55 |
|
|
* The path to the bases for Unpacking. |
56 |
|
|
*/ |
57 |
|
|
std::string UnpackPath; |
58 |
kusanagi |
1.1 |
/** |
59 |
|
|
* The run name; |
60 |
|
|
*/ |
61 |
|
|
std::string Run; |
62 |
|
|
/** |
63 |
|
|
* The run number. |
64 |
|
|
*/ |
65 |
|
|
int RunNumber; |
66 |
|
|
/** |
67 |
kusanagi |
5.1 |
* compression Level. |
68 |
|
|
*/ |
69 |
|
|
short compression; |
70 |
|
|
/** |
71 |
|
|
* Multiple/Single unpack. |
72 |
|
|
*/ |
73 |
|
|
bool Multiple; |
74 |
|
|
/** |
75 |
|
|
* single File. |
76 |
|
|
*/ |
77 |
|
|
TFile *SingleFile; |
78 |
|
|
/** |
79 |
kusanagi |
1.1 |
* The information about the run to be stored in the ROOT files |
80 |
|
|
*/ |
81 |
|
|
pamela::RunInfo info; |
82 |
kusanagi |
2.1 |
void RunExists(std::string) throw (std::exception); |
83 |
kusanagi |
1.1 |
std::string GetDirName(const pamela::PacketType*) const; |
84 |
kusanagi |
2.1 |
std::string GetFileName(const pamela::SubPacket*, std::string) ; |
85 |
|
|
std::string GetFileName(const pamela::SubPacket*) ; |
86 |
kusanagi |
1.1 |
TChain* ReadHeaderTree(const pamela::PacketType*) throw (std::exception); |
87 |
|
|
TTree* CreateTTree(pamela::Algorithm*, const pamela::SubPacket*, std::string name) |
88 |
|
|
throw (std::exception); |
89 |
|
|
|
90 |
|
|
protected: |
91 |
|
|
/** |
92 |
|
|
* A map used to store ROOT trees distinguished by the packet type. |
93 |
|
|
*/ |
94 |
|
|
typedef std::map<const pamela::PacketType*, TTree*> RootTreeMap; |
95 |
|
|
/** |
96 |
|
|
* A map of all opened header ROOT trees, sorted by the |
97 |
|
|
* PacketType. The trees will have mounted all other trees of the |
98 |
|
|
* same package type as friends. |
99 |
|
|
*/ |
100 |
|
|
RootTreeMap TTreeMap; //! |
101 |
|
|
/** |
102 |
|
|
* A list of ROOT TFiles. |
103 |
|
|
*/ |
104 |
|
|
typedef std::list<TFile *> TFileList; |
105 |
|
|
/** |
106 |
|
|
* A list of ROOT TTrees. |
107 |
|
|
*/ |
108 |
|
|
typedef std::list<TTree *> TTreeList; |
109 |
|
|
/** |
110 |
|
|
* A map of Root Tree lists, with their packet type as key. |
111 |
|
|
*/ |
112 |
|
|
typedef std::map<const pamela::PacketType*, TTreeList> TTreeListMap; |
113 |
|
|
/** |
114 |
|
|
* The map of lists of all ROOT TTrees, sorted by the packet type. |
115 |
|
|
*/ |
116 |
|
|
TTreeListMap WritingRootTrees; //! |
117 |
|
|
/** |
118 |
|
|
* A map that contains subpacket objects sorted by their names. |
119 |
|
|
*/ |
120 |
|
|
typedef std::map<std::string, pamela::SubPacket*> SubPacketMap; |
121 |
|
|
/** |
122 |
|
|
* The map of all subpackets that are currently read from the trees. |
123 |
|
|
*/ |
124 |
|
|
SubPacketMap SubPacketAddresses; |
125 |
kusanagi |
2.1 |
|
126 |
|
|
|
127 |
kusanagi |
1.1 |
|
128 |
|
|
public: |
129 |
kusanagi |
5.1 |
PamelaRun(std::string, std::string, bool, short); |
130 |
mocchiut |
6.2 |
virtual ~PamelaRun(){}; |
131 |
kusanagi |
1.1 |
static std::string GetRunName(int run); |
132 |
|
|
//static int RunExists(int = 1) throw (std::exception); |
133 |
|
|
|
134 |
|
|
/** |
135 |
|
|
* Get the run number. |
136 |
|
|
*/ |
137 |
|
|
int GetRunNumber(void) const { return RunNumber; } |
138 |
|
|
TTree* ReadTTree(pamela::PacketType const *); |
139 |
|
|
void ReadSubPacket(void *); |
140 |
|
|
void ReadSubPacket(void *, std::string); |
141 |
|
|
void ReadSubPacket(const pamela::Algorithm*, void*); |
142 |
|
|
void ReadSubPacket(const pamela::Algorithm*, void*, std::string); |
143 |
|
|
void WriteSubPacket(pamela::Algorithm*, void*, const TClass*); |
144 |
|
|
void WriteSubPacket(pamela::Algorithm*, void*, const TClass*, std::string); |
145 |
|
|
void WriteHeaders(pamela::Algorithm*, pamela::EventHeader **); |
146 |
|
|
void WriteHeader(pamela::Algorithm*, pamela::EventHeader**, const pamela::PacketType*); // 23/11/2002 maurizio mede it from private to public |
147 |
|
|
void WriteFiles(void); |
148 |
|
|
void FillTrees(const pamela::PacketType*); |
149 |
|
|
std::string GetRun(){ return Run; } |
150 |
kusanagi |
6.1 |
std::string GetPath(){ return Path; } |
151 |
|
|
std::string GetUnpackPath(){ return UnpackPath; } |
152 |
|
|
ClassDef(PamelaRun, 3) |
153 |
kusanagi |
1.1 |
}; |
154 |
|
|
} |
155 |
|
|
|
156 |
|
|
#endif /* PAMELA_RUN_H */ |