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