KaliVeda
Toolkit for HIC analysis
|
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. | |
GTDataParameters * | GetDataParameters () const |
Int_t | GetEventCount () const |
const TList * | GetListOfDataParameters () const |
Int_t | GetRunNumber (void) const |
Returns current run number. | |
TString | GetRunStartDate () const |
GTScalers * | GetScalers (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_t * | fDataArray |
Physical data array. | |
Int_t | fDataArraySize |
Data array size. | |
GTDataParameters * | fDataParameters |
Data parameters names class. | |
TString | fDateStart |
Date/time of start of run read from file. | |
Int_t | fDensity |
Tape density. | |
gan_tape_desc * | fDevice |
Device structure (ganil_tape interface) | |
Int_t | fEvbsize |
Size of the brut data buffer. | |
Int_t | fEvcsize |
Size of the ctrl data buffer. | |
UShort_t * | fEventBrut |
Brut data buffer. | |
Int_t | fEventCount |
Our event counter. | |
UShort_t * | fEventCtrl |
Control data buffer. | |
Int_t | fEventNumber |
Local event number in current buffer (should be renamed) | |
TString | fFileName |
Filename, can be a tape drive. | |
Bool_t * | fFired |
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 | |
GTScalers * | fScaler |
Scaler array. | |
TTree * | fScalerTree |
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. | |
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.
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::GTGanilData | ( | ) |
Default constructor.
Definition at line 64 of file GTGanilData.cpp.
|
virtual |
Definition at line 104 of file GTGanilData.cpp.
Connect a pointer to a data to the defined index in the Data Array.
Definition at line 320 of file GTGanilData.cpp.
Connect a pointer to a data to the defined index in the Data Array.
Definition at line 337 of file GTGanilData.cpp.
Dump parameter index, name and value for the current event.
Definition at line 657 of file GTGanilData.cpp.
Dump parameter index and name.
Definition at line 674 of file GTGanilData.cpp.
|
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.
|
inline |
Definition at line 109 of file GTGanilData.h.
|
inline |
Definition at line 117 of file GTGanilData.h.
|
inline |
Definition at line 113 of file GTGanilData.h.
Returns current run number.
Definition at line 739 of file GTGanilData.cpp.
|
inline |
Definition at line 123 of file GTGanilData.h.
Definition at line 95 of file GTGanilData.h.
Definition at line 100 of file GTGanilData.h.
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.
Definition at line 750 of file GTGanilData.cpp.
|
inline |
Definition at line 91 of file GTGanilData.h.
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.
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 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.
Not implemented. ...
Definition at line 219 of file GTGanilData.cpp.
Print every class parameters, for now a simple dump.
Definition at line 207 of file GTGanilData.cpp.
PRIVATE Read a single buffer from file
Definition at line 599 of file GTGanilData.cpp.
|
private |
PRIVATE Utility routine to read events from buffers.
Definition at line 519 of file GTGanilData.cpp.
|
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.
PRIVATE Read the data parameters from the current buffer, put it in the parameter list.
Definition at line 295 of file GTGanilData.cpp.
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.
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.
Not used.
Definition at line 761 of file GTGanilData.cpp.
|
private |
True if the Tape is allocated (useless?)
Definition at line 149 of file GTGanilData.h.
|
private |
Brut data buffer (ganil_tape interface)
Definition at line 141 of file GTGanilData.h.
|
private |
Buffer size.
Definition at line 143 of file GTGanilData.h.
|
private |
size (in 16-bit words) of CTRL_EVNT header
Definition at line 164 of file GTGanilData.h.
|
private |
Fix/variable length events.
Definition at line 144 of file GTGanilData.h.
|
private |
Physical data array.
Definition at line 152 of file GTGanilData.h.
|
private |
Data array size.
Definition at line 154 of file GTGanilData.h.
|
private |
Data parameters names class.
Definition at line 160 of file GTGanilData.h.
|
private |
Date/time of start of run read from file.
Definition at line 163 of file GTGanilData.h.
|
private |
Tape density.
Definition at line 140 of file GTGanilData.h.
|
private |
Device structure (ganil_tape interface)
Definition at line 139 of file GTGanilData.h.
|
private |
Size of the brut data buffer.
Definition at line 145 of file GTGanilData.h.
|
private |
Size of the ctrl data buffer.
Definition at line 146 of file GTGanilData.h.
|
private |
Brut data buffer.
Definition at line 147 of file GTGanilData.h.
|
private |
Our event counter.
Definition at line 156 of file GTGanilData.h.
|
private |
Control data buffer.
Definition at line 148 of file GTGanilData.h.
|
private |
Local event number in current buffer (should be renamed)
Definition at line 155 of file GTGanilData.h.
|
private |
Filename, can be a tape drive.
Definition at line 136 of file GTGanilData.h.
|
private |
fired parameters in each event
Definition at line 153 of file GTGanilData.h.
|
private |
Buffer header.
Definition at line 151 of file GTGanilData.h.
|
private |
We are currently in a CTRL buffer.
Definition at line 157 of file GTGanilData.h.
|
private |
The current buffer is a scaler buffer.
Definition at line 158 of file GTGanilData.h.
|
private |
Logical number of the device.
Definition at line 138 of file GTGanilData.h.
|
private |
current file run number
Definition at line 150 of file GTGanilData.h.
|
private |
Scaler array.
Definition at line 161 of file GTGanilData.h.
|
private |
Scaler tree for automatic filling.
Definition at line 162 of file GTGanilData.h.
|
private |
Status, 0 is OK, any other value suspect.
Definition at line 137 of file GTGanilData.h.
|
private |
??? (ganil_tape interface)
Definition at line 142 of file GTGanilData.h.
|
private |
What do we do with scalers buffers.
Definition at line 159 of file GTGanilData.h.