KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
GTDataParameters.cpp
1// $Id: GTDataParameters.cpp,v 1.6 2007/06/08 15:49:10 franklan Exp $
2// Author: $Author: franklan $
3
4// GTDataParameters.cpp - Parameters name handling
5// -------------------
6// begin : Thu Jun 14 2001
7// copyright : (C) 2001 by Garp
8// email : patois@ganil.fr
9// ---------------------------------------------------------------------------
10/*
11 ***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 **************************************************************************
19*/
20
21#include "Riostream.h"
22
23#include "TNamed.h"
24
25// ganil_tape lib headers
26#include "GanTape/GEN_TYPE.H"
27#include "GanTape/gan_acq_buf.h"
28#include "GTDataParameters.h"
29#include "TList.h"
30
31using namespace std;
32
34
35//______________________________________________________________________________
36
39
41{
42 //Default constructor. Don't create anything yet.
43 fList = new TList;
44 fList->SetOwner(); // As owners of the data in tree, they will be deleted
45 // when we'll delete the tree itself
46}
47
48
49
51
56
57
58
59
62
63char* GTDataParameters::CopyParam(char* Dest, char* Source) const
64{
65 // Small utility routine to copy a char string.
66 char c;
67 do {
68 c = *Source++;
69 if ((c == ',') || (c == 0x0d))
70 c = '\0';
71 *Dest++ = c;
72 }
73 while (c != '\0');
74 return (Source);
75}
76
77
78
79
85
86int GTDataParameters::Fill(const char* buffParam)
87{
88 // Data from the parameter buffet (buffParam) have been read from disk and is
89 // parsed by this routine who create the list of labels and corresponding
90 // index.
91 //Returns largest parameter number (not necessarily same as total number of parameters)
92
93 char* CurrPointer;
94 char NomParam[20], chaine[20];
95 int NumPar, NbBits;
96
97 CurrPointer = (char*)buffParam;
98
99 fMaxIndex = 0;
100
101 while (strncmp(CurrPointer, " ", 4) != 0 &&
102 strncmp(CurrPointer, "!!!!", 4) != 0) {
103 CurrPointer = CopyParam(NomParam, CurrPointer);
104 CurrPointer = CopyParam(chaine, CurrPointer);
105 sscanf(chaine, "%d", &NumPar);
106 CurrPointer = CopyParam(chaine, CurrPointer);
107 sscanf(chaine, "%d", &NbBits);
108 GTDataPar* par = new GTDataPar(NomParam, NumPar, NbBits);
109 fList->Add(par);
111 }
112 return (fMaxIndex);
113}
114
115
116
119
120int GTDataParameters::GetIndex(const TString parName) const
121{
122 // Return the index number corresponding to a text label.
123 GTDataPar* par = (GTDataPar*)fList->FindObject(parName);
124 if (!par) {
125 cout << "Parameter " << parName << " not found!" << endl;
126 return (-1);
127 }
128 return (par->Index());
129}
130
131
132
135
136const char* GTDataParameters::GetParName(const int index) const
137{
138 // Return the text label name corresponding to a parameter number
139 TIter next(fList);
140 GTDataPar* par;
141 while ((par = (GTDataPar*)next())) {
142 if (par->Index() == index) return par->GetName();
143 }
144 return ("");
145}
146
147
148
151
152GTDataPar* GTDataParameters::GetPar(const int index) const
153{
154 // Return the parameter corresponding to the parameter number
155 TIter next(fList);
156 GTDataPar* par;
157 while ((par = (GTDataPar*)next())) {
158 if (par->Index() == index) return par;
159 }
160 return 0;
161}
162
163
164
165
168
170{
171 // Return the parameter corresponding to the parameter name
172 return (GTDataPar*)fList->FindObject(parName);
173}
174
175
176
#define c(i)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Classes handling VME/VXI parameters in GANIL DAQ data.
int Index(void) const
char * CopyParam(char *Dest, char *Source) const
Small utility routine to copy a char string.
GTDataPar * GetPar(const int index) const
Return the parameter corresponding to the parameter number.
Int_t fMaxIndex
but OK for now.
const char * GetParName(const int index) const
Return the text label name corresponding to a parameter number.
int GetIndex(const TString parName) const
Return the index number corresponding to a text label.
GTDataParameters(void)
Default constructor. Don't create anything yet.
int Fill(const char *buffParam)
virtual void SetOwner(Bool_t enable=kTRUE)
TObject * FindObject(const char *name) const override
void Add(TObject *obj) override
const char * GetName() const override
Double_t Max(Double_t a, Double_t b)
ClassImp(TPyArg)