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