KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GTGanilData Class Reference

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 63 of file GTGanilData.h.

Public Types

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

Public Member Functions

 GTGanilData ()
 Default constructor. More...
 
 GTGanilData (const TString filename)
 Create the reading class over the given file with all defaults values. More...
 
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. More...
 
Bool_t Connect (const TString parName, UShort_t **p) const
 Connect a pointer to a data to a given parameter name in the Data Array. More...
 
void DumpEvent (void) const
 Dump parameter index, name and value for the current event. More...
 
void DumpParameterName (void) const
 Dump parameter index and name. More...
 
GTDataParametersGetDataParameters () const
 
Int_t GetEventCount () const
 
const TListGetListOfDataParameters () const
 
Int_t GetRunNumber (void) const
 Returns current run number. More...
 
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. More...
 
void SetFileName (const TString filename)
 
void SetScalerBuffersManagement (const ScalerWhat_t sc)
 
virtual void SetUserTree (TTree *)
 Not used. More...
 

Protected 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)
 

Protected Attributes

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

#include <GTGanilData.h>

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 66 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() [1/2]

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 317 of file GTGanilData.cpp.

◆ Connect() [2/2]

Bool_t GTGanilData::Connect ( const TString  parName,
UShort_t **  p 
) const

Connect a pointer to a data to a given parameter name in the Data Array.

Definition at line 334 of file GTGanilData.cpp.

◆ DumpEvent()

void GTGanilData::DumpEvent ( void  ) const

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

Definition at line 661 of file GTGanilData.cpp.

◆ DumpParameterName()

void GTGanilData::DumpParameterName ( void  ) const

Dump parameter index and name.

Definition at line 678 of file GTGanilData.cpp.

◆ EventUnravelling()

bool GTGanilData::EventUnravelling ( CTRL_EVENT *  pCtrlEvent)
protectedvirtual

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 620 of file GTGanilData.cpp.

◆ GetDataParameters()

GTDataParameters* GTGanilData::GetDataParameters ( ) const
inline

Definition at line 108 of file GTGanilData.h.

◆ GetEventCount()

Int_t GTGanilData::GetEventCount ( ) const
inline

Definition at line 116 of file GTGanilData.h.

◆ GetListOfDataParameters()

const TList* GTGanilData::GetListOfDataParameters ( ) const
inline

Definition at line 112 of file GTGanilData.h.

◆ GetRunNumber()

Int_t GTGanilData::GetRunNumber ( void  ) const

Returns current run number.

Definition at line 743 of file GTGanilData.cpp.

◆ GetRunStartDate()

TString GTGanilData::GetRunStartDate ( ) const
inline

Definition at line 122 of file GTGanilData.h.

◆ GetScalers()

GTScalers* GTGanilData::GetScalers ( void  )
inline

Definition at line 94 of file GTGanilData.h.

◆ GetStatus()

Int_t GTGanilData::GetStatus ( void  ) const
inline

Definition at line 99 of file GTGanilData.h.

◆ InitDefault()

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

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 127 of file GTGanilData.cpp.

◆ IsOpen()

Bool_t GTGanilData::IsOpen ( void  ) const

Definition at line 754 of file GTGanilData.cpp.

◆ IsScalerBuffer()

bool GTGanilData::IsScalerBuffer ( void  ) const
inline

Definition at line 90 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 484 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 385 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 232 of file GTGanilData.cpp.

◆ PrintDataParameters()

void GTGanilData::PrintDataParameters ( void  ) const

Not implemented. ...

Definition at line 217 of file GTGanilData.cpp.

◆ PrintRunParameters()

void GTGanilData::PrintRunParameters ( void  ) const

Print every class parameters, for now a simple dump.

Definition at line 205 of file GTGanilData.cpp.

◆ ReadBuffer()

void GTGanilData::ReadBuffer ( void  )
protected

PRIVATE Read a single buffer from file

Definition at line 597 of file GTGanilData.cpp.

◆ ReadNextEvent()

bool GTGanilData::ReadNextEvent ( void  )
protected

PRIVATE Utility routine to read events from buffers.

Definition at line 517 of file GTGanilData.cpp.

◆ ReadNextEvent_EBYEDAT()

bool GTGanilData::ReadNextEvent_EBYEDAT ( void  )
protected

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

Definition at line 568 of file GTGanilData.cpp.

◆ ReadParameters()

void GTGanilData::ReadParameters ( void  )
protectedvirtual

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

Definition at line 293 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 707 of file GTGanilData.cpp.

◆ SetUserTree()

void GTGanilData::SetUserTree ( TTree )
virtual

Not used.

Definition at line 765 of file GTGanilData.cpp.

Member Data Documentation

◆ fAllocated

bool GTGanilData::fAllocated
protected

True if the Tape is allocated (useless?)

Definition at line 148 of file GTGanilData.h.

◆ fBuffer

in2p3_buffer_struct* GTGanilData::fBuffer
protected

Brut data buffer (ganil_tape interface)

Definition at line 140 of file GTGanilData.h.

◆ fBufSize

Int_t GTGanilData::fBufSize
protected

Buffer size.

Definition at line 142 of file GTGanilData.h.

◆ fCTRLEVNT_HD

Int_t GTGanilData::fCTRLEVNT_HD
protected

size (in 16-bit words) of CTRL_EVNT header

Definition at line 162 of file GTGanilData.h.

◆ fCtrlForm

Int_t GTGanilData::fCtrlForm
protected

Fix/variable length events.

Definition at line 143 of file GTGanilData.h.

◆ fDataArray

UShort_t* GTGanilData::fDataArray
protected

Physical data array.

Definition at line 151 of file GTGanilData.h.

◆ fDataArraySize

Int_t GTGanilData::fDataArraySize
protected

Data array size.

Definition at line 152 of file GTGanilData.h.

◆ fDataParameters

GTDataParameters* GTGanilData::fDataParameters
protected

Data parameters names class.

Definition at line 158 of file GTGanilData.h.

◆ fDateStart

TString GTGanilData::fDateStart
protected

Date/time of start of run read from file.

Definition at line 161 of file GTGanilData.h.

◆ fDensity

Int_t GTGanilData::fDensity
protected

Tape density.

Definition at line 139 of file GTGanilData.h.

◆ fDevice

gan_tape_desc* GTGanilData::fDevice
protected

Device structure (ganil_tape interface)

Definition at line 138 of file GTGanilData.h.

◆ fEvbsize

Int_t GTGanilData::fEvbsize
protected

Size of the brut data buffer.

Definition at line 144 of file GTGanilData.h.

◆ fEvcsize

Int_t GTGanilData::fEvcsize
protected

Size of the ctrl data buffer.

Definition at line 145 of file GTGanilData.h.

◆ fEventBrut

UShort_t* GTGanilData::fEventBrut
protected

Brut data buffer.

Definition at line 146 of file GTGanilData.h.

◆ fEventCount

Int_t GTGanilData::fEventCount
protected

Our event counter.

Definition at line 154 of file GTGanilData.h.

◆ fEventCtrl

UShort_t* GTGanilData::fEventCtrl
protected

Control data buffer.

Definition at line 147 of file GTGanilData.h.

◆ fEventNumber

Int_t GTGanilData::fEventNumber
protected

Local event number in current buffer (should be renamed)

Definition at line 153 of file GTGanilData.h.

◆ fFileName

TString GTGanilData::fFileName
protected

Filename, can be a tape drive.

Definition at line 135 of file GTGanilData.h.

◆ fHeader

char GTGanilData::fHeader[9]
protected

Buffer header.

Definition at line 150 of file GTGanilData.h.

◆ fIsCtrl

bool GTGanilData::fIsCtrl
protected

We are currently in a CTRL buffer.

Definition at line 155 of file GTGanilData.h.

◆ fIsScalerBuffer

bool GTGanilData::fIsScalerBuffer
protected

The current buffer is a scaler buffer.

Definition at line 156 of file GTGanilData.h.

◆ fLun

Int_t GTGanilData::fLun
protected

Logical number of the device.

Definition at line 137 of file GTGanilData.h.

◆ fRunNumber

Int_t GTGanilData::fRunNumber
protected

current file run number

Definition at line 149 of file GTGanilData.h.

◆ fScaler

GTScalers* GTGanilData::fScaler
protected

Scaler array.

Definition at line 159 of file GTGanilData.h.

◆ fScalerTree

TTree* GTGanilData::fScalerTree
protected

Scaler tree for automatic filling.

Definition at line 160 of file GTGanilData.h.

◆ fStatus

Int_t GTGanilData::fStatus
protected

Status, 0 is OK, any other value suspect.

Definition at line 136 of file GTGanilData.h.

◆ fStructEvent

char* GTGanilData::fStructEvent
protected

??? (ganil_tape interface)

Definition at line 141 of file GTGanilData.h.

◆ fWhatScaler

ScalerWhat_t GTGanilData::fWhatScaler
protected

What do we do with scalers buffers.

Definition at line 157 of file GTGanilData.h.


The documentation for this class was generated from the following files: