1 |
kusanagi |
1.1 |
/** @file |
2 |
kusanagi |
2.0 |
* $Source: /home/cvsmanager/yoda/event/PamelaRun.h,v $ |
3 |
kusanagi |
5.0 |
* $Id: PamelaRun.h,v 4.4 2005/05/28 10:44:09 kusanagi Exp $ |
4 |
kusanagi |
2.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 |
|
|
//#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 |
kusanagi |
2.1 |
#include <sstream> |
46 |
|
|
|
47 |
kusanagi |
1.1 |
|
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 |
kusanagi |
2.1 |
std::stringstream oss; |
60 |
kusanagi |
1.1 |
/** |
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 |
kusanagi |
2.1 |
void RunExists(std::string) throw (std::exception); |
77 |
kusanagi |
1.1 |
std::string GetDirName(const pamela::PacketType*) const; |
78 |
kusanagi |
2.1 |
std::string GetFileName(const pamela::SubPacket*, std::string) ; |
79 |
|
|
std::string GetFileName(const pamela::SubPacket*) ; |
80 |
kusanagi |
1.1 |
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 |
kusanagi |
2.1 |
|
120 |
|
|
|
121 |
kusanagi |
1.1 |
|
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 |
kusanagi |
4.4 |
ClassDef(PamelaRun, 2) |
144 |
kusanagi |
1.1 |
}; |
145 |
|
|
} |
146 |
|
|
|
147 |
|
|
#endif /* PAMELA_RUN_H */ |