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

Annotation of /chewbacca/event/PamelaRun.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Fri Jul 24 13:53:51 2009 UTC (15 years, 4 months ago) by mocchiut
Branch: MAIN
Changes since 1.1: +7 -7 lines
File MIME type: text/plain
Runtime error with ROOT 5.24 fixed, many small changes and warnings fixing

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

  ViewVC Help
Powered by ViewVC 1.1.23