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