KaliVeda
Toolkit for HIC analysis
|
Reads GANIL acquisition files (EBYEDAT)
Open and initialise a GANIL data file in EBYEDAT format for reading. If file cannot be opened, this object will be made a zombie. Do not use. To test if file is open, use IsOpen(). The basename of the file (excluding any path) can be obtained using GetName() The full pathname of the file can be obtained using GetTitle()
If the dataset corresponding to the data to be read is known i.e. if gDataSet has been defined and points to the correct dataset, this will allow to build the necessary multidetector object if it has not already been done, and to set the calibration parameters etc. as a function of the run number.
If not (i.e. if no information is available on detectors, calibrations, geometry, etc.), then a list of KVACQParam objects will be generated and connected ready for reading the data.
To fill a TTree with all data in the file, do the following:
KVGANILDataReader* runfile = new KVGANILDataReader("run1.dat"); TFile* file = new TFile("run1.root","recreate"); TTree* T = new TTree("Run1", "Raw data for Run1"); runfile->ConnectRawDataParameters(); runfile->SetUserTree(T); while( runfile->GetNextEvent() ) ; file->Write(); file->Close();
<br<blockquote>
See method SetUserTree() for more details. See below if you want to include a TTree containing scaler data in the file.
By default, scaler buffers are ignored (GTGanilData::SetScalerBuffersManagement(GTGanilData::kSkipScaler)). This can be changed by changing the value of
KVGANILDataReader.ScalerBuffersManagement: kSkipScaler
For possible values, see GTGanilData::SetScalerBuffersManagement().
You can also add a second TTree to the user tree generated above containing the values of all scaler buffers written in the data file. The TTree will be called 'Scalers'. You need to add "SCALERS" to the option given to method SetUserTree() (see below).
Definition at line 59 of file KVGANILDataReader.h.
#include <KVGANILDataReader.h>
Public Member Functions | |
KVGANILDataReader () | |
KVGANILDataReader (const Char_t *, Option_t *) | |
virtual | ~KVGANILDataReader () |
Destructor. | |
void | ConnectRawDataParameters () |
TString | GetDataFormat () const |
Int_t | GetEventCount () const |
const KVSeqCollection & | GetFiredDataParameters () const |
virtual GTGanilData * | GetGanTapeInterface () |
virtual Bool_t | GetNextEvent () |
Int_t | GetNumberOfScalers () const |
const KVSeqCollection & | GetRawDataParameters () const |
Int_t | GetRunNumberReadFromFile () const |
UInt_t | GetScalerCount (Int_t index) const |
Int_t | GetScalerStatus (Int_t index) const |
Bool_t | HasScalerBuffer () const |
void | init () |
default initialisations | |
void | OpenFile (const Char_t *, Option_t *dataset) |
virtual void | SetUserTree (TTree *, Option_t *="arrays") |
Public Member Functions inherited from KVRawDataReader | |
KVRawDataReader () | |
Default constructor. | |
virtual | ~KVRawDataReader () |
Destructor. | |
const KVNameValueList & | GetRunInfos () const |
virtual Int_t | GetStatus () const |
Public Member Functions inherited from KVBase | |
KVBase () | |
Default constructor. | |
KVBase (const Char_t *name, const Char_t *title="") | |
Ctor for object with given name and type. | |
KVBase (const KVBase &) | |
copy ctor | |
virtual | ~KVBase () |
virtual void | Clear (Option_t *opt="") |
Clear object properties : name, type/title, number, label. | |
virtual void | Copy (TObject &) const |
Make a copy of this object. | |
const Char_t * | GetLabel () const |
UInt_t | GetNumber () const |
UInt_t | GetNumberOfObjects () const |
virtual TObject * | GetObject () const |
virtual const Char_t * | GetType () const |
Bool_t | HasLabel () const |
virtual Bool_t | IsCalled (const Char_t *name) const |
Bool_t | IsLabelled (const Char_t *l) const |
virtual Bool_t | IsType (const Char_t *typ) const |
virtual void | List () |
KVBase & | operator= (const KVBase &) |
copy assignment operator | |
virtual void | Print (Option_t *option="") const |
Double_t | ProtectedGetX (const TF1 *func, Double_t val, int &status, Double_t xmin=0.0, Double_t xmax=0.0) const |
void | SetLabel (const Char_t *lab) |
virtual void | SetNumber (UInt_t num) |
virtual void | SetType (const Char_t *str) |
Public Member Functions inherited from TNamed | |
TNamed () | |
TNamed (const char *name, const char *title) | |
TNamed (const TNamed &named) | |
TNamed (const TString &name, const TString &title) | |
virtual | ~TNamed () |
void | Clear (Option_t *option="") override |
TObject * | Clone (const char *newname="") const override |
Int_t | Compare (const TObject *obj) const override |
void | Copy (TObject &named) const override |
virtual void | FillBuffer (char *&buffer) |
const char * | GetName () const override |
const char * | GetTitle () const override |
ULong_t | Hash () const override |
TClass * | IsA () const override |
Bool_t | IsSortable () const override |
void | ls (Option_t *option="") const override |
TNamed & | operator= (const TNamed &rhs) |
void | Print (Option_t *option="") const override |
virtual void | SetName (const char *name) |
virtual void | SetNameTitle (const char *name, const char *title) |
virtual void | SetTitle (const char *title="") |
virtual Int_t | Sizeof () const |
void | Streamer (TBuffer &) override |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Public Member Functions inherited from TObject | |
TObject () | |
TObject (const TObject &object) | |
virtual | ~TObject () |
void | AbstractMethod (const char *method) const |
virtual void | AppendPad (Option_t *option="") |
virtual void | Browse (TBrowser *b) |
ULong_t | CheckedHash () |
virtual const char * | ClassName () const |
virtual void | Delete (Option_t *option="") |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
virtual void | Draw (Option_t *option="") |
virtual void | DrawClass () const |
virtual TObject * | DrawClone (Option_t *option="") const |
virtual void | Dump () const |
virtual void | Error (const char *method, const char *msgfmt,...) const |
virtual void | Execute (const char *method, const char *params, Int_t *error=nullptr) |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr) |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
virtual TObject * | FindObject (const char *name) const |
virtual TObject * | FindObject (const TObject *obj) const |
virtual Option_t * | GetDrawOption () const |
virtual const char * | GetIconName () const |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
virtual Option_t * | GetOption () const |
virtual UInt_t | GetUniqueID () const |
virtual Bool_t | HandleTimer (TTimer *timer) |
Bool_t | HasInconsistentHash () const |
virtual void | Info (const char *method, const char *msgfmt,...) const |
virtual Bool_t | InheritsFrom (const char *classname) const |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
virtual void | Inspect () const |
void | InvertBit (UInt_t f) |
Bool_t | IsDestructed () const |
virtual Bool_t | IsEqual (const TObject *obj) const |
virtual Bool_t | IsFolder () const |
R__ALWAYS_INLINE Bool_t | IsOnHeap () const |
R__ALWAYS_INLINE Bool_t | IsZombie () const |
void | MayNotUse (const char *method) const |
virtual Bool_t | Notify () |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *vp) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr, void *vp) |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, void *vp) |
TObject & | operator= (const TObject &rhs) |
virtual void | Paint (Option_t *option="") |
virtual void | Pop () |
virtual Int_t | Read (const char *name) |
virtual void | RecursiveRemove (TObject *obj) |
void | ResetBit (UInt_t f) |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
void | SetBit (UInt_t f) |
void | SetBit (UInt_t f, Bool_t set) |
virtual void | SetDrawOption (Option_t *option="") |
virtual void | SetUniqueID (UInt_t uid) |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
R__ALWAYS_INLINE Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
virtual void | UseCurrentStyle () |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const |
Static Public Member Functions | |
static KVGANILDataReader * | Open (const Char_t *filename, Option_t *opt="") |
Static Public Member Functions inherited from KVRawDataReader | |
static KVRawDataReader * | OpenFile (const TString &type, const TString &filename) |
Static Public Member Functions inherited from KVBase | |
static Bool_t | AreEqual (Double_t x, Double_t y, Long64_t maxdif=1) |
Comparison between two 64-bit floating-point values. | |
static void | BackupFileWithDate (const Char_t *path) |
static void | CombineFiles (const Char_t *file1, const Char_t *file2, const Char_t *newfilename, Bool_t keep=kTRUE) |
static void | Deprecated (const char *method, const char *advice) |
static Bool_t | FindClassSourceFiles (const Char_t *class_name, KVString &imp_file, KVString &dec_file, const Char_t *dir_name=".") |
static Bool_t | FindExecutable (TString &exec, const Char_t *path="$(PATH)") |
static const Char_t * | FindFile (const Char_t *search, TString &wfil) |
static const Char_t * | GetBINDIRFilePath (const Char_t *namefile="") |
static const Char_t * | GetDATABASEFilePath () |
static const Char_t * | GetDATADIRFilePath (const Char_t *namefile="") |
static Bool_t | GetDataSetEnv (const Char_t *dataset, const Char_t *type, Bool_t defval) |
static const Char_t * | GetDataSetEnv (const Char_t *dataset, const Char_t *type, const Char_t *defval) |
static Double_t | GetDataSetEnv (const Char_t *dataset, const Char_t *type, Double_t defval) |
static const Char_t * | GetETCDIRFilePath (const Char_t *namefile="") |
static const Char_t * | GetExampleFilePath (const Char_t *library, const Char_t *namefile) |
Return full path to example file for given library (="KVMultiDet", "BackTrack", etc.) | |
static const Char_t * | GetINCDIRFilePath (const Char_t *namefile="") |
static const Char_t * | GetKVBuildDate () |
Returns KaliVeda build date. | |
static const Char_t * | GetKVBuildDir () |
Returns top-level directory used for build. | |
static const Char_t * | GetKVBuildTime () |
Returns KaliVeda build time. | |
static const Char_t * | GetKVBuildType () |
Returns KaliVeda build type (cmake build: Release, Debug, RelWithDebInfo, ...) | |
static const Char_t * | GetKVBuildUser () |
Returns username of person who performed build. | |
static const Char_t * | GetKVSourceDir () |
Returns top-level directory of source tree used for build. | |
static const Char_t * | GetKVVersion () |
Returns KaliVeda version string. | |
static const Char_t * | GetLIBDIRFilePath (const Char_t *namefile="") |
static const Char_t * | GetListOfPlugins (const Char_t *base) |
static const Char_t * | GetListOfPluginURIs (const Char_t *base) |
static const Char_t * | GetPluginURI (const Char_t *base, const Char_t *plugin) |
static void | GetTempFileName (TString &base) |
static const Char_t * | GetTEMPLATEDIRFilePath (const Char_t *namefile="") |
static const Char_t * | GetWORKDIRFilePath (const Char_t *namefile="") |
static const Char_t * | gitBranch () |
Returns git branch of sources. | |
static const Char_t * | gitCommit () |
Returns last git commit of sources. | |
static void | InitEnvironment () |
static bool | is_gnuinstall () |
static Bool_t | IsThisAPlugin (const TString &uri, TString &base) |
static TPluginHandler * | LoadPlugin (const Char_t *base, const Char_t *uri="0") |
static Bool_t | OpenContextMenu (const char *method, TObject *obj, const char *alt_method_name="") |
static void | OpenTempFile (TString &base, std::ofstream &fp) |
static void | PrintSplashScreen () |
Prints welcome message and infos on version etc. | |
static Bool_t | SearchAndOpenKVFile (const Char_t *name, KVSQLite::database &dbfile, const Char_t *kvsubdir="") |
static Bool_t | SearchAndOpenKVFile (const Char_t *name, std::ifstream &file, const Char_t *kvsubdir="", KVLockfile *locks=0) |
static Bool_t | SearchAndOpenKVFile (const Char_t *name, std::ofstream &file, const Char_t *kvsubdir="", KVLockfile *locks=0) |
static Bool_t | SearchKVFile (const Char_t *name, TString &fullpath, const Char_t *kvsubdir="") |
static const Char_t * | WorkingDirectory () |
Static Public Member Functions inherited from TNamed | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Static Public Member Functions inherited from TObject | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static Longptr_t | GetDtorOnly () |
static Bool_t | GetObjectStat () |
static void | SetDtorOnly (void *obj) |
static void | SetObjectStat (Bool_t stat) |
Private Member Functions | |
void | FillFiredParameterList () |
clears and then fills list fFired with all fired acquisition parameters in event | |
GTGanilData * | NewGanTapeInterface (Option_t *dataset) |
Private Attributes | |
KVUniqueNameList | fFired |
list of fired parameters in one event | |
GTGanilData * | fGanilData |
object used to read GANIL acquisition file | |
KVUniqueNameList | fParameters |
list of all data parameters contained in file | |
TTree * | fUserTree |
user TTree to fill with data | |
Bool_t | make_arrays |
Bool_t | make_leaves |
Int_t | NbParFired |
UInt_t * | ParNum |
UShort_t * | ParVal |
Additional Inherited Members | |
Public Types inherited from KVBase | |
enum | EKaliVedaBits { kIsKaliVedaObject = BIT(23) } |
Public Types inherited from TObject | |
enum | EDeprecatedStatusBits |
enum | EStatusBits |
Public Attributes inherited from TObject | |
kBitMask | |
kCanDelete | |
kCannotPick | |
kHasUUID | |
kInconsistent | |
kInvalidObject | |
kIsOnHeap | |
kIsReferenced | |
kMustCleanup | |
kNoContextMenu | |
kNotDeleted | |
kObjInCanvas | |
kOverwrite | |
kSingleKey | |
kWriteDelete | |
kZombie | |
Protected Member Functions inherited from TObject | |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
void | MakeZombie () |
Protected Attributes inherited from TNamed | |
TString | fName |
TString | fTitle |
Protected Attributes inherited from TObject | |
kOnlyPrepStep | |
|
inline |
Definition at line 77 of file KVGANILDataReader.h.
Open and initialise a GANIL data file for reading. By default, Scaler buffers are ignored. If file cannot be opened, this object will be made a zombie. Do not use. To test if file is open, use IsOpen(). The basename of the file (excluding any path) can be obtained using GetName() The full pathname of the file can be obtained using GetTitle()
Definition at line 26 of file KVGANILDataReader.cpp.
|
virtual |
Destructor.
Definition at line 44 of file KVGANILDataReader.cpp.
void KVGANILDataReader::ConnectRawDataParameters | ( | ) |
Generate all required KVEBYEDAT_ACQParam objects corresponding to parameters in file
fParameters is filled with a KVEBYEDAT_ACQParam for every acquisition parameter in the file.
To access the full list of data parameters in the file after this method has been called (i.e. after the file is opened), use GetRawDataParameters().
Definition at line 350 of file KVGANILDataReader.cpp.
|
private |
clears and then fills list fFired with all fired acquisition parameters in event
Definition at line 465 of file KVGANILDataReader.cpp.
|
inlinevirtual |
Implements KVRawDataReader.
Definition at line 112 of file KVGANILDataReader.h.
Int_t KVGANILDataReader::GetEventCount | ( | ) | const |
Definition at line 517 of file KVGANILDataReader.cpp.
|
inline |
returns list of fired acquisition parameters of current event. this list is filled automatically when GetNextEvent() is called.
Definition at line 97 of file KVGANILDataReader.h.
|
virtual |
Definition at line 440 of file KVGANILDataReader.cpp.
|
virtual |
Read next event in raw data file. Returns false if no event found (end of file). The list of all fired acquisition parameters is filled, and can be retrieved with GetFiredDataParameters(). If SetUserTree(TTree*) has been called, the TTree is filled with the values of all parameters in this event.
Implements KVRawDataReader.
Definition at line 383 of file KVGANILDataReader.cpp.
Int_t KVGANILDataReader::GetNumberOfScalers | ( | ) | const |
Definition at line 487 of file KVGANILDataReader.cpp.
|
inline |
Definition at line 92 of file KVGANILDataReader.h.
|
virtual |
Return run number of file being read. Only call when file has been successfully opened.
Implements KVRawDataReader.
Definition at line 528 of file KVGANILDataReader.cpp.
Definition at line 497 of file KVGANILDataReader.cpp.
Definition at line 507 of file KVGANILDataReader.cpp.
Bool_t KVGANILDataReader::HasScalerBuffer | ( | ) | const |
Definition at line 478 of file KVGANILDataReader.cpp.
default initialisations
Definition at line 57 of file KVGANILDataReader.cpp.
|
private |
Creates and returns new instance of class derived from GTGanilData used to read GANIL acquisition data Actual class is determined by Plugin.GTGanilData in environment files and name of dataset. check and load plugin library
Definition at line 419 of file KVGANILDataReader.cpp.
|
static |
Static method, used by KVDataSet::Open The name of the dataset is passed in the option string
Definition at line 452 of file KVGANILDataReader.cpp.
Open and initialise a GANIL data file for reading. By default, scaler buffers are ignored. This can be changed by changing the value of
KVGANILDataReader.ScalerBuffersManagement: kSkipScaler
If file cannot be opened, this object will be made a zombie. Do not use. To test if file is open, use IsOpen(). The basename of the file (excluding any path) can be obtained using GetName() The full pathname of the file can be obtained using GetTitle()
Definition at line 283 of file KVGANILDataReader.cpp.
To fill a TTree with the data in the current file, create a TTree: TFile* file = new TFile("run1.root","recreate"); TTree* T = new TTree("Run1", "Raw data for Run1"); and then call this method: SetUserTree(T) If you read all events of the file, the TTree will be automatically filled with data : while( runfile->GetNextEvent() ) ;
Two different TTree structures are available, depending on the option string:
opt = "arrays": [default]
The TTree will have the following structure:
Br 0 :NbParFired : NbParFired/I = number of fired parameters in event *............................................................................ Br 1 :ParNum : ParNum[NbParFired]/i = array of indices of fired parameters *............................................................................ *Br 2 :ParVal : ParVal[NbParFired]/s = array of values of fired parameters
This structure is the fastest to fill and produces the smallest file sizes. In order to be able to directly access the parameters as if option "leaves" were used (i.e. one branch/leaf for each parameter), we add two aliases for each parameter to the tree: PARNAME = value of parameter if present in event PARNAME_M = number of times parameter appears in event Assuming that each parameter only appears at most once in each event, i.e. PARNAME_M=0 or 1, then root[0] T->Draw("PARNAME", "PARNAME_M") will histogram the value of PARNAME for each event in which it is present. (if the selection condition "PARNAME_M" is not used, the histogram will also be filled with a 0 for each event in which PARNAME does not appear). N.B. the PARNAME alias is in fact the sum of the values of PARNAME in each event. If PARNAME_M>1 in some events, it is not the individual values but their sum which will be histogrammed in this case.
Thus, if the data file has parameters called "PAR_1" and "PAR_2", the following command will work
root[0] T->Draw("PAR_1:PAR_2", "PAR_1_M&&PAR_2_M", "col")
even though no branches "PAR_1" or "PAR_2" exist.
opt = "leaves":
The TTree will have a branch/leaf for each parameter. This option is slower and produces larger files.
If the option string contains both "arrays" and "leaves", then both structures will be used (in this case there is a high redundancy, as each parameter is stored twice).
The full list of parameters is stored in a TObjArray in the list returned by TTree::GetUserInfo(). Each parameter is represented by a TNamed object. In order to retrieve the name of the parameter with index 674 (e.g. taken from branch ParNum), do: TObjArray* parlist = (TObjArray*) T->GetUserInfo()->FindObject("ParameterList"); cout << "Par 674 name = " << (*parlist)[674]->GetName() << endl;
Automatic creation & filling of Scalers TTree
give an option string containing "scalers", i.e. "leaves,scalers", or "ARRAYS+SCALERS", etc. a TTree with name 'Scalers' will be created, all scaler buffers will be written in it.
Definition at line 138 of file KVGANILDataReader.cpp.
|
private |
list of fired parameters in one event
Definition at line 70 of file KVGANILDataReader.h.
|
private |
object used to read GANIL acquisition file
Definition at line 61 of file KVGANILDataReader.h.
|
private |
list of all data parameters contained in file
Definition at line 69 of file KVGANILDataReader.h.
|
private |
user TTree to fill with data
Definition at line 62 of file KVGANILDataReader.h.
|
private |
Definition at line 66 of file KVGANILDataReader.h.
|
private |
Definition at line 67 of file KVGANILDataReader.h.
|
private |
Definition at line 63 of file KVGANILDataReader.h.
|
private |
Definition at line 65 of file KVGANILDataReader.h.
|
private |
Definition at line 64 of file KVGANILDataReader.h.