KaliVeda
Toolkit for HIC analysis
GTGanilData.h
1 /***************************************************************************
17  ***************************************************************************
18  * *
19  * This program is free software; you can redistribute it and/or modify *
20  * it under the terms of the GNU General Public License as published by *
21  * the Free Software Foundation; either version 2 of the License, or *
22  * (at your option) any later version. *
23  * *
24  ***************************************************************************/
25 
26 #ifndef GT_GTGanilData_H
27 #define GT_GTGanilData_H
28 
30 #include "Rtypes.h"
31 #include <TFile.h>
32 #include <TString.h>
33 #include <TTree.h>
34 #include <TNtuple.h>
35 
36 #include "GTDataParameters.h"
37 #include "GTScalers.h"
38 #include "GanTape/GEN_TYPE.H"
39 #include "GanTape/STR_EVT.H"
40 #include "GanTape/gan_acq_buf.h"
41 #ifndef __GAN_TAPE_GENERAL_H
42 typedef struct {
43  int bidon;
45 #endif
46 
64 class GTGanilData {
65 public:
67  typedef enum {
68  kSkipScaler, // Skip it.
69  kDumpScaler, // Print all values of scalers in buffer
70  kReportScaler, // Report the existance of a scaler buffer. WARNING! user
72  kAutoWriteScaler // Automatic scaler management: wrote on disk
74 
75 
76 public:
77  GTGanilData(const TString filename);
78  GTGanilData();
79  virtual ~GTGanilData(void);
80 
81  void SetFileName(const TString filename);
82  void Open(void);
83  void PrintRunParameters(void) const;
84  void PrintDataParameters(void) const;
85  void DumpEvent(void) const;
86  void DumpParameterName(void) const;
87  void Connect(const Int_t index, UShort_t** p) const;
88  void ConnectFired(const Int_t index, Bool_t** p) const;
89  bool Next(void);
90  void MakeTree(const TString filename = "", UInt_t nEvents = kMaxUInt);
91  inline bool IsScalerBuffer(void) const
92  {
93  return (fIsScalerBuffer);
94  };
96  {
98  return fScaler;
99  };
100  Int_t GetStatus(void) const
101  {
102  return (fStatus);
103  }
105  Int_t GetRunNumber(void) const;
106 
107  Bool_t IsOpen(void) const;
108 
110  {
111  return fDataParameters;
112  };
114  {
115  return fDataParameters->GetList();
116  };
118  {
119  return fEventCount;
120  }
121 
122  virtual void SetUserTree(TTree*);
124  {
125  return fDateStart;
126  }
127 
128 protected:
129  void InitDefault(const Int_t argc = 0, char** argv = NULL);
130  virtual void ReadParameters(void);
131  void ReadBuffer(void);
132  bool ReadNextEvent(void);
133  bool ReadNextEvent_EBYEDAT(void);
134  virtual bool EventUnravelling(CTRL_EVENT*);
135 
141  in2p3_buffer_struct* fBuffer;
151  char fHeader[9];
157  bool fIsCtrl;
165 public:
166  ClassDef(GTGanilData, 0) // Interface to a GANIL formated Tape or File
167 };
168 
169 #endif
int Int_t
unsigned int UInt_t
bool Bool_t
unsigned short UShort_t
constexpr Bool_t kFALSE
#define ClassDef(name, id)
const TList * GetList() const
Read GANIL formatted tapes or files.
Definition: GTGanilData.h:64
Int_t fLun
Logical number of the device.
Definition: GTGanilData.h:138
bool ReadNextEvent(void)
Int_t fRunNumber
current file run number
Definition: GTGanilData.h:150
void ReadBuffer(void)
char fHeader[9]
Buffer header.
Definition: GTGanilData.h:151
void ConnectFired(const Int_t index, Bool_t **p) const
Connect a pointer to a data to the defined index in the Data Array.
UShort_t * fEventBrut
Brut data buffer.
Definition: GTGanilData.h:147
void InitDefault(const Int_t argc=0, char **argv=NULL)
bool fAllocated
True if the Tape is allocated (useless?)
Definition: GTGanilData.h:149
Int_t fEventCount
Our event counter.
Definition: GTGanilData.h:156
Int_t fEventNumber
Local event number in current buffer (should be renamed)
Definition: GTGanilData.h:155
GTScalers * fScaler
Scaler array.
Definition: GTGanilData.h:161
TString GetRunStartDate() const
Definition: GTGanilData.h:123
Int_t fCtrlForm
Fix/variable length events.
Definition: GTGanilData.h:144
void DumpEvent(void) const
Dump parameter index, name and value for the current event.
gan_tape_desc * fDevice
Device structure (ganil_tape interface)
Definition: GTGanilData.h:139
void Connect(const Int_t index, UShort_t **p) const
Connect a pointer to a data to the defined index in the Data Array.
Int_t fDensity
Tape density.
Definition: GTGanilData.h:140
char * fStructEvent
??? (ganil_tape interface)
Definition: GTGanilData.h:142
Int_t GetRunNumber(void) const
Returns current run number.
const TList * GetListOfDataParameters() const
Definition: GTGanilData.h:113
Int_t fStatus
Status, 0 is OK, any other value suspect.
Definition: GTGanilData.h:137
void SetFileName(const TString filename)
Definition: GTGanilData.cpp:90
TString fDateStart
Date/time of start of run read from file.
Definition: GTGanilData.h:163
UShort_t * fEventCtrl
Control data buffer.
Definition: GTGanilData.h:148
bool ReadNextEvent_EBYEDAT(void)
void PrintRunParameters(void) const
Print every class parameters, for now a simple dump.
GTDataParameters * GetDataParameters() const
Definition: GTGanilData.h:109
virtual void SetUserTree(TTree *)
Not used.
bool fIsCtrl
We are currently in a CTRL buffer.
Definition: GTGanilData.h:157
bool fIsScalerBuffer
The current buffer is a scaler buffer.
Definition: GTGanilData.h:158
void DumpParameterName(void) const
Dump parameter index and name.
in2p3_buffer_struct * fBuffer
Brut data buffer (ganil_tape interface)
Definition: GTGanilData.h:141
Int_t GetStatus(void) const
Definition: GTGanilData.h:100
Bool_t IsOpen(void) const
bool IsScalerBuffer(void) const
Definition: GTGanilData.h:91
Bool_t * fFired
fired parameters in each event
Definition: GTGanilData.h:153
virtual void ReadParameters(void)
GTGanilData()
Default constructor.
Definition: GTGanilData.cpp:64
GTDataParameters * fDataParameters
Data parameters names class.
Definition: GTGanilData.h:160
Int_t GetEventCount() const
Definition: GTGanilData.h:117
TString fFileName
Filename, can be a tape drive.
Definition: GTGanilData.h:136
Int_t fBufSize
Buffer size.
Definition: GTGanilData.h:143
GTScalers * GetScalers(void)
Definition: GTGanilData.h:95
Int_t fDataArraySize
Data array size.
Definition: GTGanilData.h:154
void SetScalerBuffersManagement(const ScalerWhat_t sc)
UShort_t * fDataArray
Physical data array.
Definition: GTGanilData.h:152
bool Next(void)
Int_t fEvbsize
Size of the brut data buffer.
Definition: GTGanilData.h:145
ScalerWhat_t fWhatScaler
What do we do with scalers buffers.
Definition: GTGanilData.h:159
void MakeTree(const TString filename="", UInt_t nEvents=kMaxUInt)
virtual ~GTGanilData(void)
virtual bool EventUnravelling(CTRL_EVENT *)
Int_t fEvcsize
Size of the ctrl data buffer.
Definition: GTGanilData.h:146
Int_t fCTRLEVNT_HD
size (in 16-bit words) of CTRL_EVNT header
Definition: GTGanilData.h:164
void PrintDataParameters(void) const
TTree * fScalerTree
Scaler tree for automatic filling.
Definition: GTGanilData.h:162
void Open(void)
ScalerWhat_t
What to do with scaler buffer.
Definition: GTGanilData.h:67
@ kAutoWriteScaler
have to take care of it.
Definition: GTGanilData.h:72
Handle scaler buffers in GANIL DAQ data.
Definition: GTScalers.h:34
ROOT headers.
Definition: GTGanilData.h:42