KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
GTGanilData Class Reference

Detailed Description

Read GANIL formatted tapes or files.

Usage can be as simple as: GTGanilData myData("filename.dat");

It allow connection of data parameters values by Connect() routines that can operate with the index or the parameter name.

Values of parameters are stored in an array of UShort_t (0 - 65535) Before reading a new event, every parameter is set to 65535 Casting back this value to a Short_t (-32768 to 32768) gives "-1" which is the signal that the parameter's coder did not fire in the event that was read.

Definition at line 64 of file GTGanilData.h.

#include <GTGanilData.h>

Public Types

enum  ScalerWhat_t { kSkipScaler , kDumpScaler , kReportScaler , kAutoWriteScaler }
 What to do with scaler buffer. More...
 

Public Member Functions

 GTGanilData ()
 Default constructor.
 
 GTGanilData (const TString filename)
 Create the reading class over the given file with all defaults values.
 
virtual ~GTGanilData (void)
 
void Connect (const Int_t index, UShort_t **p) const
 Connect a pointer to a data to the defined index in the Data Array.
 
void ConnectFired (const Int_t index, Bool_t **p) const
 Connect a pointer to a data to the defined index in the Data Array.
 
void DumpEvent (void) const
 Dump parameter index, name and value for the current event.
 
void DumpParameterName (void) const
 Dump parameter index and name.
 
GTDataParametersGetDataParameters () const
 
Int_t GetEventCount () const
 
const TListGetListOfDataParameters () const
 
Int_t GetRunNumber (void) const
 Returns current run number.
 
TString GetRunStartDate () const
 
GTScalersGetScalers (void)
 
Int_t GetStatus (void) const
 
Bool_t IsOpen (void) const
 
bool IsScalerBuffer (void) const
 
void MakeTree (const TString filename="", UInt_t nEvents=kMaxUInt)
 
bool Next (void)
 
void Open (void)
 
void PrintDataParameters (void) const
 
void PrintRunParameters (void) const
 Print every class parameters, for now a simple dump.
 
void SetFileName (const TString filename)
 
void SetScalerBuffersManagement (const ScalerWhat_t sc)
 
virtual void SetUserTree (TTree *)
 Not used.
 

Private Member Functions

virtual bool EventUnravelling (CTRL_EVENT *)
 
void InitDefault (const Int_t argc=0, char **argv=NULL)
 
void ReadBuffer (void)
 
bool ReadNextEvent (void)
 
bool ReadNextEvent_EBYEDAT (void)
 
virtual void ReadParameters (void)
 

Private Attributes

bool fAllocated
 True if the Tape is allocated (useless?)
 
in2p3_buffer_struct * fBuffer
 Brut data buffer (ganil_tape interface)
 
Int_t fBufSize
 Buffer size.
 
Int_t fCTRLEVNT_HD
 size (in 16-bit words) of CTRL_EVNT header
 
Int_t fCtrlForm
 Fix/variable length events.
 
UShort_tfDataArray
 Physical data array.
 
Int_t fDataArraySize
 Data array size.
 
GTDataParametersfDataParameters
 Data parameters names class.
 
TString fDateStart
 Date/time of start of run read from file.
 
Int_t fDensity
 Tape density.
 
gan_tape_descfDevice
 Device structure (ganil_tape interface)
 
Int_t fEvbsize
 Size of the brut data buffer.
 
Int_t fEvcsize
 Size of the ctrl data buffer.
 
UShort_tfEventBrut
 Brut data buffer.
 
Int_t fEventCount
 Our event counter.
 
UShort_tfEventCtrl
 Control data buffer.
 
Int_t fEventNumber
 Local event number in current buffer (should be renamed)
 
TString fFileName
 Filename, can be a tape drive.
 
Bool_tfFired
 fired parameters in each event
 
char fHeader [9]
 Buffer header.
 
bool fIsCtrl
 We are currently in a CTRL buffer.
 
bool fIsScalerBuffer
 The current buffer is a scaler buffer.
 
Int_t fLun
 Logical number of the device.
 
Int_t fRunNumber
 current file run number
 
GTScalersfScaler
 Scaler array.
 
TTreefScalerTree
 Scaler tree for automatic filling.
 
Int_t fStatus
 Status, 0 is OK, any other value suspect.
 
char * fStructEvent
 ??? (ganil_tape interface)
 
ScalerWhat_t fWhatScaler
 What do we do with scalers buffers.
 

Member Enumeration Documentation

◆ ScalerWhat_t

What to do with scaler buffer.

Enumerator
kSkipScaler 
kDumpScaler 
kReportScaler 
kAutoWriteScaler 

have to take care of it.

Definition at line 67 of file GTGanilData.h.

Constructor & Destructor Documentation

◆ GTGanilData() [1/2]

GTGanilData::GTGanilData ( const TString  filename)

Create the reading class over the given file with all defaults values.

Definition at line 76 of file GTGanilData.cpp.

◆ GTGanilData() [2/2]

GTGanilData::GTGanilData ( )

Default constructor.

Definition at line 64 of file GTGanilData.cpp.

◆ ~GTGanilData()

GTGanilData::~GTGanilData ( void  )
virtual

Definition at line 104 of file GTGanilData.cpp.

Member Function Documentation

◆ Connect()

void GTGanilData::Connect ( const Int_t  index,
UShort_t **  p 
) const

Connect a pointer to a data to the defined index in the Data Array.

Definition at line 320 of file GTGanilData.cpp.

◆ ConnectFired()

void GTGanilData::ConnectFired ( const Int_t  index,
Bool_t **  p 
) const

Connect a pointer to a data to the defined index in the Data Array.

Definition at line 337 of file GTGanilData.cpp.

◆ DumpEvent()

void GTGanilData::DumpEvent ( void  ) const

Dump parameter index, name and value for the current event.

Definition at line 657 of file GTGanilData.cpp.

◆ DumpParameterName()

void GTGanilData::DumpParameterName ( void  ) const

Dump parameter index and name.

Definition at line 674 of file GTGanilData.cpp.

◆ EventUnravelling()

bool GTGanilData::EventUnravelling ( CTRL_EVENT *  pCtrlEvent)
privatevirtual

PRIVATE If mode is variable length event, we have to reconstruct the Data buffer from the given event. WARNING: temporary the default: we dont check that it's really the case Before reading event, all parameters have their value set to -1 (65535 - fDataArray is UShort_t) Parameters which are not fired in the event will have value -1 (65535 - cast back to Short_t for real value)

Definition at line 622 of file GTGanilData.cpp.

◆ GetDataParameters()

GTDataParameters * GTGanilData::GetDataParameters ( ) const
inline

Definition at line 109 of file GTGanilData.h.

◆ GetEventCount()

Int_t GTGanilData::GetEventCount ( ) const
inline

Definition at line 117 of file GTGanilData.h.

◆ GetListOfDataParameters()

const TList * GTGanilData::GetListOfDataParameters ( ) const
inline

Definition at line 113 of file GTGanilData.h.

◆ GetRunNumber()

Int_t GTGanilData::GetRunNumber ( void  ) const

Returns current run number.

Definition at line 739 of file GTGanilData.cpp.

◆ GetRunStartDate()

TString GTGanilData::GetRunStartDate ( ) const
inline

Definition at line 123 of file GTGanilData.h.

◆ GetScalers()

GTScalers * GTGanilData::GetScalers ( void  )
inline

Definition at line 95 of file GTGanilData.h.

◆ GetStatus()

Int_t GTGanilData::GetStatus ( void  ) const
inline

Definition at line 100 of file GTGanilData.h.

◆ InitDefault()

void GTGanilData::InitDefault ( const Int_t  argc = 0,
char **  argv = NULL 
)
private

PRIVATE Called by every constructors. Init parameters to default values Data are taken first from command line, Second from environment variables if none works, takes defaults values.

Definition at line 128 of file GTGanilData.cpp.

◆ IsOpen()

Bool_t GTGanilData::IsOpen ( void  ) const

Definition at line 750 of file GTGanilData.cpp.

◆ IsScalerBuffer()

bool GTGanilData::IsScalerBuffer ( void  ) const
inline

Definition at line 91 of file GTGanilData.h.

◆ MakeTree()

void GTGanilData::MakeTree ( const TString  filename = "",
UInt_t  nEvents = kMaxUInt 
)

Automatically create and fill a tree created from ganil data. Can be use to convert a ganil tape or file to a ROOT file. The number of actual converted events is set with the nEvents parameter.

Definition at line 486 of file GTGanilData.cpp.

◆ Next()

bool GTGanilData::Next ( void  )

Read an event on tape/file and put in into the event array return true until read fails

If scaler buffer management (fWhatScaler) has been set to kSkipScaler, kDumpScaler or kAutoWriteScaler, then every time this method returns kTRUE a new event has been read (and perhaps 1 or more scaler buffers were read and dealt with internally). In this case, a loop over all events will look like this:

while( my_gtganildata->Next() ){ // new event read from file my_gtganilData->GetFiredDataParameters()->ls(); // or whatever }

If fWhatScaler = kReportScaler then this method also returns kTRUE after reading a scaler buffer (no new event read), so that the user can do something with the scalers. In this case, a loop over all events including treatment of scaler buffers will look like this:

while( my_gtganildata->Next() ){ if( my_gtganildata->IsScalerBuffer() ){ // scaler buffer read from file GTScalers* scalers = my_gtganildata->GetScalers(); // N.B. GTGanilData::GetScalers() also resets the IsScalerBuffer() // flag ready for next event/buffer, so even if you don't // do anything with the scalers, you should call it } else { // new event read from file my_gtganilData->GetFiredDataParameters()->ls(); // or whatever } }

Definition at line 387 of file GTGanilData.cpp.

◆ Open()

void GTGanilData::Open ( void  )

Open the data file (could be on a tape) with a few checks. Use IsOpen() to check whether the file is opened successfully. After successfully opening the file, we call ReadParameters() to fill the parameter list from the first data buffer which has to be a parameter buffer.

Definition at line 234 of file GTGanilData.cpp.

◆ PrintDataParameters()

void GTGanilData::PrintDataParameters ( void  ) const

Not implemented. ...

Definition at line 219 of file GTGanilData.cpp.

◆ PrintRunParameters()

void GTGanilData::PrintRunParameters ( void  ) const

Print every class parameters, for now a simple dump.

Definition at line 207 of file GTGanilData.cpp.

◆ ReadBuffer()

void GTGanilData::ReadBuffer ( void  )
private

PRIVATE Read a single buffer from file

Definition at line 599 of file GTGanilData.cpp.

◆ ReadNextEvent()

bool GTGanilData::ReadNextEvent ( void  )
private

PRIVATE Utility routine to read events from buffers.

Definition at line 519 of file GTGanilData.cpp.

◆ ReadNextEvent_EBYEDAT()

bool GTGanilData::ReadNextEvent_EBYEDAT ( void  )
private

PRIVATE Utility routine to read EBYEDAT events from buffers. Shamelessly copied from Luc Legeard's GEvent

Definition at line 570 of file GTGanilData.cpp.

◆ ReadParameters()

void GTGanilData::ReadParameters ( void  )
privatevirtual

PRIVATE Read the data parameters from the current buffer, put it in the parameter list.

Definition at line 295 of file GTGanilData.cpp.

◆ SetFileName()

void GTGanilData::SetFileName ( const TString  filename)

Set the name of the file to read (use if default ctor is used to create object). We check if 'filename' begins with "rfio:"; if so, we remove it

Definition at line 90 of file GTGanilData.cpp.

◆ SetScalerBuffersManagement()

void GTGanilData::SetScalerBuffersManagement ( const ScalerWhat_t  sc)

Set scaler buffers management. It can be: GTGanilData::kSkipScaler : Skip scaler buffers GTGanilData::kDumpScaler : Dump all scaler buffers on stdout GTGanilData::kAutoWriteScaler : Automatic scaler buffer management, all scalers written in a TTree To use this, the current TFile (i.e. gFile) must be writable. i.e. you should do TFile file("somefile.root", "create") and then toto.SetScalerBuffersManagement(GTGanilData::kReportScaler) GTGanilData::kReportScaler : when Next() encounters a scaler buffer, the IsScalerBuffer() flag is set to kTRUE and the data can be retrieved by calling GetScalers() (returns a pointer to a GScalers object). WARNING: this option changes the logic of a loop over all events in the file (see GTGanilData::Next()).

Definition at line 703 of file GTGanilData.cpp.

◆ SetUserTree()

void GTGanilData::SetUserTree ( TTree )
virtual

Not used.

Definition at line 761 of file GTGanilData.cpp.

Member Data Documentation

◆ fAllocated

bool GTGanilData::fAllocated
private

True if the Tape is allocated (useless?)

Definition at line 149 of file GTGanilData.h.

◆ fBuffer

in2p3_buffer_struct* GTGanilData::fBuffer
private

Brut data buffer (ganil_tape interface)

Definition at line 141 of file GTGanilData.h.

◆ fBufSize

Int_t GTGanilData::fBufSize
private

Buffer size.

Definition at line 143 of file GTGanilData.h.

◆ fCTRLEVNT_HD

Int_t GTGanilData::fCTRLEVNT_HD
private

size (in 16-bit words) of CTRL_EVNT header

Definition at line 164 of file GTGanilData.h.

◆ fCtrlForm

Int_t GTGanilData::fCtrlForm
private

Fix/variable length events.

Definition at line 144 of file GTGanilData.h.

◆ fDataArray

UShort_t* GTGanilData::fDataArray
private

Physical data array.

Definition at line 152 of file GTGanilData.h.

◆ fDataArraySize

Int_t GTGanilData::fDataArraySize
private

Data array size.

Definition at line 154 of file GTGanilData.h.

◆ fDataParameters

GTDataParameters* GTGanilData::fDataParameters
private

Data parameters names class.

Definition at line 160 of file GTGanilData.h.

◆ fDateStart

TString GTGanilData::fDateStart
private

Date/time of start of run read from file.

Definition at line 163 of file GTGanilData.h.

◆ fDensity

Int_t GTGanilData::fDensity
private

Tape density.

Definition at line 140 of file GTGanilData.h.

◆ fDevice

gan_tape_desc* GTGanilData::fDevice
private

Device structure (ganil_tape interface)

Definition at line 139 of file GTGanilData.h.

◆ fEvbsize

Int_t GTGanilData::fEvbsize
private

Size of the brut data buffer.

Definition at line 145 of file GTGanilData.h.

◆ fEvcsize

Int_t GTGanilData::fEvcsize
private

Size of the ctrl data buffer.

Definition at line 146 of file GTGanilData.h.

◆ fEventBrut

UShort_t* GTGanilData::fEventBrut
private

Brut data buffer.

Definition at line 147 of file GTGanilData.h.

◆ fEventCount

Int_t GTGanilData::fEventCount
private

Our event counter.

Definition at line 156 of file GTGanilData.h.

◆ fEventCtrl

UShort_t* GTGanilData::fEventCtrl
private

Control data buffer.

Definition at line 148 of file GTGanilData.h.

◆ fEventNumber

Int_t GTGanilData::fEventNumber
private

Local event number in current buffer (should be renamed)

Definition at line 155 of file GTGanilData.h.

◆ fFileName

TString GTGanilData::fFileName
private

Filename, can be a tape drive.

Definition at line 136 of file GTGanilData.h.

◆ fFired

Bool_t* GTGanilData::fFired
private

fired parameters in each event

Definition at line 153 of file GTGanilData.h.

◆ fHeader

char GTGanilData::fHeader[9]
private

Buffer header.

Definition at line 151 of file GTGanilData.h.

◆ fIsCtrl

bool GTGanilData::fIsCtrl
private

We are currently in a CTRL buffer.

Definition at line 157 of file GTGanilData.h.

◆ fIsScalerBuffer

bool GTGanilData::fIsScalerBuffer
private

The current buffer is a scaler buffer.

Definition at line 158 of file GTGanilData.h.

◆ fLun

Int_t GTGanilData::fLun
private

Logical number of the device.

Definition at line 138 of file GTGanilData.h.

◆ fRunNumber

Int_t GTGanilData::fRunNumber
private

current file run number

Definition at line 150 of file GTGanilData.h.

◆ fScaler

GTScalers* GTGanilData::fScaler
private

Scaler array.

Definition at line 161 of file GTGanilData.h.

◆ fScalerTree

TTree* GTGanilData::fScalerTree
private

Scaler tree for automatic filling.

Definition at line 162 of file GTGanilData.h.

◆ fStatus

Int_t GTGanilData::fStatus
private

Status, 0 is OK, any other value suspect.

Definition at line 137 of file GTGanilData.h.

◆ fStructEvent

char* GTGanilData::fStructEvent
private

??? (ganil_tape interface)

Definition at line 142 of file GTGanilData.h.

◆ fWhatScaler

ScalerWhat_t GTGanilData::fWhatScaler
private

What do we do with scalers buffers.

Definition at line 159 of file GTGanilData.h.