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

Annotation of /yoda/event/PamelaRun.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5.1 - (hide annotations) (download)
Sat Feb 4 12:37:43 2006 UTC (18 years, 9 months ago) by kusanagi
Branch: MAIN
Changes since 5.0: +17 -15 lines
File MIME type: text/plain
Several new features in this release:
a) all the packets are conform to the Mass Memory Format specifications (http://people.roma2.infn.it/~cpu/Mass_Memory_Format.html)
b) unpacking either using the old files structure OR the new one file unpacking.
c) parametrized root files compression factor
d) deleting of the following packet: TofTest, TrkTest, TrkEvent.
e) the Tracker routines now work without the use of temp files.

The point a) allow Yoda to unpack in the root file all the packets generated by the CPU. According to the MassMemoryFormat; that is three possible data are available:

1) almost explicit structure of the packet (like for Log, Tracker, Mcmd, etc....);
2) dummy data collection structure (InitHeader, InitTrailer, CalibHeader, CalibTrailer);
3) just the data of the packet (almost all Alarm and Init procedures). The class regarding this packets have only one parameters, a TArrayC class, which contain the data-block included in the packet (tat is the data below the packet Header).

The point b) has been implemented as a consequence of an agreement about a more compact structure of the unpacked data. Up to now the structure of each unpacked data consisted of a folder, named after the packet type, and three files: xxx.Header.root, xxx.NamePacket.root, xxx.Registry.root.
Starting from this release YODA, by default will unpack the data in a unique root file. The structure of this file will consist of:
- several TTree(s) named after the packet type;
- into each TTree are foreseen three TBranche(s):
    - 'Header'  (the old xxx.Header.root file)
    - 'NameOfThePacket' (the old xxx.Event.root file or the xxx.Event.DETECTOR.root)
    - 'Registry' (the old xxx.Registry.root file)

Anyway is still possible, but deprecated, to unpack using the old structure, passing to the "yoda" command the optional parameter "-multifile"

The point c) has been implemented because is well know that writing time in a TTree is as much fast as much lower is the compression factor for the root file; anyway for a PAMELA dat file, a compression equal to 0 will generate a root file which will be more than two times the original size. To modify the compression parameter just add the optional parameter "-c [0-9]" to the yoda command line.

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

  ViewVC Help
Powered by ViewVC 1.1.23