| 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 */ |