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 
136  TString fFileName; // Filename, can be a tape drive
137  Int_t fStatus; // Status, 0 is OK, any other value suspect
138  Int_t fLun; // Logical number of the device
140  Int_t fDensity; // Tape density
141  in2p3_buffer_struct* fBuffer;
142  char* fStructEvent;
143  Int_t fBufSize; // Buffer size
144  Int_t fCtrlForm; // Fix/variable length events
145  Int_t fEvbsize; // Size of the brut data buffer
146  Int_t fEvcsize; // Size of the ctrl data buffer
149  bool fAllocated; // True if the Tape is allocated (useless?)
150  Int_t fRunNumber; // current file run number
151  char fHeader[9]; // Buffer header
154  Int_t fDataArraySize; // Data array size
155  Int_t fEventNumber; // Local event number in current buffer (should be renamed)
156  Int_t fEventCount; // Our event counter
157  bool fIsCtrl; // We are currently in a CTRL buffer
158  bool fIsScalerBuffer;// The current buffer is a scaler buffer
159  ScalerWhat_t fWhatScaler; // What do we do with scalers buffers
162  TTree* fScalerTree; // Scaler tree for automatic filling
163  TString fDateStart; // Date/time of start of run read from file
164  Int_t fCTRLEVNT_HD; // size (in 16-bit words) of CTRL_EVNT header
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
bool ReadNextEvent(void)
Int_t fRunNumber
Definition: GTGanilData.h:150
void ReadBuffer(void)
char fHeader[9]
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
Definition: GTGanilData.h:147
void InitDefault(const Int_t argc=0, char **argv=NULL)
bool fAllocated
Control data buffer.
Definition: GTGanilData.h:149
Int_t fEventCount
Definition: GTGanilData.h:156
Int_t fEventNumber
Definition: GTGanilData.h:155
GTScalers * fScaler
Data parameters names class.
Definition: GTGanilData.h:161
TString GetRunStartDate() const
Definition: GTGanilData.h:123
Int_t fCtrlForm
Definition: GTGanilData.h:144
void DumpEvent(void) const
Dump parameter index, name and value for the current event.
gan_tape_desc * fDevice
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
Device structure (ganil_tape interface)
Definition: GTGanilData.h:140
char * fStructEvent
Brut data buffer (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
Definition: GTGanilData.h:137
void SetFileName(const TString filename)
Definition: GTGanilData.cpp:90
TString fDateStart
Definition: GTGanilData.h:163
UShort_t * fEventCtrl
Brut 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 fIsScalerBuffer
Definition: GTGanilData.h:158
void DumpParameterName(void) const
Dump parameter index and name.
in2p3_buffer_struct * fBuffer
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
Physical data array.
Definition: GTGanilData.h:153
virtual void ReadParameters(void)
GTGanilData()
Default constructor.
Definition: GTGanilData.cpp:64
GTDataParameters * fDataParameters
Definition: GTGanilData.h:160
Int_t GetEventCount() const
Definition: GTGanilData.h:117
TString fFileName
Definition: GTGanilData.h:136
Int_t fBufSize
??? (ganil_tape interface)
Definition: GTGanilData.h:143
GTScalers * GetScalers(void)
Definition: GTGanilData.h:95
Int_t fDataArraySize
fired parameters in each event
Definition: GTGanilData.h:154
void SetScalerBuffersManagement(const ScalerWhat_t sc)
UShort_t * fDataArray
Definition: GTGanilData.h:152
bool Next(void)
Int_t fEvbsize
Definition: GTGanilData.h:145
ScalerWhat_t fWhatScaler
Definition: GTGanilData.h:159
void MakeTree(const TString filename="", UInt_t nEvents=kMaxUInt)
virtual ~GTGanilData(void)
virtual bool EventUnravelling(CTRL_EVENT *)
Int_t fEvcsize
Definition: GTGanilData.h:146
Int_t fCTRLEVNT_HD
Definition: GTGanilData.h:164
void PrintDataParameters(void) const
TTree * fScalerTree
Scaler array.
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