/[PAMELA software]/yoda/event/PamelaRun.h
ViewVC logotype

Annotation of /yoda/event/PamelaRun.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4.0 - (hide annotations) (download)
Sun Mar 6 04:33:01 2005 UTC (19 years, 9 months ago) by kusanagi
Branch: MAIN
CVS Tags: YODA4_1/00, YODA4_0/04, YODA4_0/03, YODA4_0/02, YODA4_0/01, YODA4_2/01, YODA4_2/00
Changes since 3.0: +1 -1 lines
File MIME type: text/plain
Stable version 4.0 - 6 March 2005 - Maurizio Nagni

1 kusanagi 1.1 /** @file
2 kusanagi 2.0 * $Source: /home/cvsmanager/yoda/event/PamelaRun.h,v $
3 kusanagi 4.0 * $Id: PamelaRun.h,v 3.0 2005/03/04 15:54:11 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     *
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 kusanagi 2.1 #include <sstream>
45    
46 kusanagi 1.1
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 kusanagi 2.1 std::stringstream oss;
59 kusanagi 1.1 /**
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 kusanagi 2.1 void RunExists(std::string) throw (std::exception);
76 kusanagi 1.1 std::string GetDirName(const pamela::PacketType*) const;
77 kusanagi 2.1 std::string GetFileName(const pamela::SubPacket*, std::string) ;
78     std::string GetFileName(const pamela::SubPacket*) ;
79 kusanagi 1.1 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 kusanagi 2.1
119    
120 kusanagi 1.1
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 */

  ViewVC Help
Powered by ViewVC 1.1.23