Cat
Public Member Functions | Public Attributes | Private Attributes | List of all members
Data Class Reference

#include <inc/Data.h>

Inheritance diagram for Data:
Object Attrib

Public Member Functions

 Data ()
 Standard constructor. More...
 
 Data (int, int, int)
 
virtual ~Data ()
 
void setEvt (int evt)
 Destructor. More...
 
void setChannel (int ch)
 
void setData (int data)
 
void Clear (Option_t *option="")
 
 Data ()
 Standard constructor. More...
 
virtual ~Data ()
 Destructor. More...
 
void print ()
 
void addDataStream (std::string, std::string)
 
void addHisto1d (TH1D *)
 
void addHisto2d (TH2D *)
 
void buildHistos ()
 
Histo1Dhist1d (unsigned int row)
 
Histo1Dhist1d (std::string name)
 
Histo2Dhist2d (unsigned int row)
 
Histo2Dhist2d (std::string name)
 
void purge ()
 
StatusCode clear (int)
 
StatusCode dataFill (int, double)
 
std::string name (unsigned int)
 
std::string title (unsigned int)
 
std::vector< double > * vectorPtr (unsigned int)
 
std::vector< double > vector (unsigned int)
 
std::vector< double > vector (std::string)
 
int rowFromName (std::string)
 
bool empty ()
 
- Public Member Functions inherited from Object
 Object ()
 Standard constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
std::string name () const
 
std::string type ()
 
unsigned char id ()
 
std::string title ()
 
void msgSvc (int level, std::string msg, std::string name)
 
void msg (std::string mymsg)
 
void verbose (std::string mymsg)
 
void debug (std::string mymsg)
 
void info (std::string mymsg)
 
void warning (std::string mymsg)
 
void error (std::string mymsg)
 
void fatal (std::string mymsg)
 
void msg (std::string mymsg, std::string name)
 
void verbose (std::string mymsg, std::string name)
 
void debug (std::string mymsg, std::string name)
 
void info (std::string mymsg, std::string name)
 
void warning (std::string mymsg, std::string name)
 
void error (std::string mymsg, std::string name)
 
void fatal (std::string mymsg, std::string name)
 
void setName (std::string name)
 
void setType (std::string type)
 
void setId (unsigned char id)
 
void setTitle (std::string title)
 
void setDllName (std::string dllName)
 
std::string dllName ()
 
- Public Member Functions inherited from Attrib
 Attrib ()
 Standard constructor. More...
 
virtual ~Attrib ()
 Destructor. More...
 
bool is (int attribut)
 
void add (int attribut)
 
void remove (int attribut)
 
std::string attributs ()
 

Public Attributes

ClassDef(Data, 1) protected int Evt
 
int Raw
 

Private Attributes

std::vector< std::vector< double > *> m_values
 
std::vector< TH1D *> m_h1d
 
std::vector< TH2D *> m_h2d
 
std::vector< Histo1Dm_hist1d
 
std::vector< Histo2Dm_hist2d
 
std::vector< std::string > m_titles
 
std::vector< std::string > m_names
 

Additional Inherited Members

- Public Types inherited from Attrib
enum  Attribut {
  UNDEFINED, PASSIVE, ACTIVE, INTERFACE,
  IO, IODATA, ELEMENT, HARDWARE,
  PROCESSUS, SOFTWARE
}
 
- Protected Attributes inherited from Attrib
std::string m_attribString [10]
 

Detailed Description

Author
Frédéric Machefert
Date
2004-10-04
Author
Frederic Machefert
Date
2010-01-06

Definition at line 16 of file Data.h.

Constructor & Destructor Documentation

◆ Data() [1/3]

Data::Data ( )

Standard constructor.

Definition at line 18 of file Data.cpp.

References ~Data().

18  {
19 }

◆ Data() [2/3]

Data::Data ( int  evt,
int  channel,
int  data 
)

Definition at line 23 of file Data.cpp.

References shell::data(), Evt, and Raw.

23  {
24  Evt = evt;
25  Raw = data;
26  Ch = channel ;
27 }
int Raw
Definition: Data.h:42
def data(object, stream=None)
Definition: shell.py:150
ClassDef(Data, 1) protected int Evt
Definition: Data.h:37

◆ ~Data() [1/2]

Data::~Data ( )
inlinevirtual

Definition at line 21 of file Data.h.

References Clear().

Referenced by Data().

21 { Clear(); };
void Clear(Option_t *option="")
Definition: Data.cpp:32

◆ Data() [3/3]

Data::Data ( )

Standard constructor.

◆ ~Data() [2/2]

virtual Data::~Data ( )
virtual

Destructor.

Member Function Documentation

◆ addDataStream()

void Data::addDataStream ( std::string  n,
std::string  t 
)

Definition at line 31 of file Data.cpp.

References m_names, m_titles, and m_values.

Referenced by FEB_v1::FEB_v1().

31  {
32  m_names .push_back(n);
33  m_titles.push_back(t);
34  m_values.push_back(new std::vector<double>);
35 }
std::vector< std::vector< double > *> m_values
Definition: Data.h:57
std::vector< std::string > m_titles
Definition: Data.h:62
std::vector< std::string > m_names
Definition: Data.h:63

◆ addHisto1d()

void Data::addHisto1d ( TH1D *  h)

Definition at line 40 of file Data.cpp.

References m_h1d.

40  {
41  m_h1d.push_back( h );
42 }
std::vector< TH1D *> m_h1d
Definition: Data.h:58

◆ addHisto2d()

void Data::addHisto2d ( TH2D *  h)

Definition at line 47 of file Data.cpp.

References m_h2d.

47  {
48  m_h2d.push_back( h );
49 }
std::vector< TH2D *> m_h2d
Definition: Data.h:59

◆ buildHistos()

void Data::buildHistos ( )

Definition at line 98 of file Data.cpp.

References m_h1d, m_h2d, m_hist1d, and m_hist2d.

Referenced by Processus::endProcessing().

98  {
99  std::vector<TH1D*>::iterator iter1d;
100  for (iter1d=m_h1d.begin(); iter1d!=m_h1d.end(); ++iter1d){
101  m_hist1d.push_back(Histo1D(*iter1d));
102  }
103  std::vector<TH2D*>::iterator iter2d;
104  for (iter2d=m_h2d.begin(); iter2d!=m_h2d.end(); ++iter2d){
105  m_hist2d.push_back(Histo2D(*iter2d));
106  }
107 }
std::vector< Histo1D > m_hist1d
Definition: Data.h:60
std::vector< TH2D *> m_h2d
Definition: Data.h:59
std::vector< TH1D *> m_h1d
Definition: Data.h:58
std::vector< Histo2D > m_hist2d
Definition: Data.h:61

◆ Clear()

void Data::Clear ( Option_t *  option = "")

Definition at line 32 of file Data.cpp.

Referenced by setData(), and ~Data().

32  {
33 }

◆ clear()

StatusCode Data::clear ( int  i)

Definition at line 71 of file Data.cpp.

References StatusCode::FAILURE, StatusCode::SUCCESS, and vectorPtr().

Referenced by hist2d(), FEB_v1::readFifoLLT(), FEB_v1::readFifoLLTFE(), and FEB_v1::readFifoSpyFE().

71  {
72  if (vectorPtr(i)!=0){
73  vectorPtr(i)->clear();
74  return StatusCode::SUCCESS;
75  }
76  else {
77  return StatusCode::FAILURE;
78  }
79 }
std::vector< double > * vectorPtr(unsigned int)
Definition: Data.cpp:134

◆ dataFill()

StatusCode Data::dataFill ( int  i,
double  val 
)

Set data stream with value

Returns
the StatusCode

Definition at line 85 of file Data.cpp.

References StatusCode::FAILURE, StatusCode::SUCCESS, and vectorPtr().

Referenced by hist2d(), FEB_v1::readFifoLLT(), FEB_v1::readFifoLLTFE(), and FEB_v1::readFifoSpyFE().

85  {
86  if (vectorPtr(i)!=0){
87  vectorPtr(i)->push_back(val);
88  return StatusCode::SUCCESS;
89  }
90  else {
91  return StatusCode::FAILURE;
92  }
93 }
std::vector< double > * vectorPtr(unsigned int)
Definition: Data.cpp:134

◆ empty()

bool Data::empty ( )
inline

Definition at line 49 of file Data.h.

References m_h1d, m_h2d, and m_names.

Referenced by Processus::endProcessing().

49  {
50  if (0==m_names.size()&&0==m_h1d.size()&&0==m_h2d.size()) return true;
51  return false;
52  }
std::vector< TH2D *> m_h2d
Definition: Data.h:59
std::vector< TH1D *> m_h1d
Definition: Data.h:58
std::vector< std::string > m_names
Definition: Data.h:63

◆ hist1d() [1/2]

Histo1D* Data::hist1d ( unsigned int  row)
inline

Definition at line 30 of file Data.h.

References m_hist1d.

Referenced by export_proc().

30 {return &m_hist1d[row];};
std::vector< Histo1D > m_hist1d
Definition: Data.h:60

◆ hist1d() [2/2]

Histo1D* Data::hist1d ( std::string  name)
inline

Definition at line 31 of file Data.h.

References m_hist1d.

31  {
32 // name;
33  return &m_hist1d[0];
34  };
std::vector< Histo1D > m_hist1d
Definition: Data.h:60

◆ hist2d() [1/2]

Histo2D* Data::hist2d ( unsigned int  row)
inline

Definition at line 35 of file Data.h.

References m_hist2d.

Referenced by export_proc().

35 {return &m_hist2d[row];};
std::vector< Histo2D > m_hist2d
Definition: Data.h:61

◆ hist2d() [2/2]

Histo2D* Data::hist2d ( std::string  name)
inline

Definition at line 36 of file Data.h.

References clear(), dataFill(), m_hist2d, Object::name(), purge(), rowFromName(), Object::title(), vector(), and vectorPtr().

36  {
37 // name;
38  return &m_hist2d[0];
39  };
std::vector< Histo2D > m_hist2d
Definition: Data.h:61

◆ name()

std::string Data::name ( unsigned int  row)

Definition at line 112 of file Data.cpp.

References itos(), m_names, and Object::warning().

112  {
113  if (row>m_names.size()){
114  warning("Try to access a data stream value not defined ("+itos(row)+")","Data::name");
115  return 0;
116  }
117  return m_names[row];
118 }
std::string itos(int)
Definition: Tools.cpp:46
std::vector< std::string > m_names
Definition: Data.h:63
void warning(std::string mymsg)
Definition: Object.h:39

◆ print()

void Data::print ( )

Definition at line 186 of file Data.cpp.

References images::index, Object::info(), m_h1d, m_h2d, m_names, m_titles, and vectorPtr().

Referenced by Processus::endProcessing(), and export_proc().

186  {
187  char line[100];
188  sprintf(line,"Number of data streams : %i", m_names.size());
189  info(line,"Data::print");
190  std::vector<std::string>::const_iterator iter;
191  for (iter=m_names.begin(); iter!=m_names.end(); ++iter){
192  unsigned int index = (unsigned int)(iter-m_names.begin());
193  sprintf(line," (%3i) %10s - %40s (%8i)", index,
194  (*iter).c_str(),m_titles[index].c_str(),
195  vectorPtr(index)->size());
196  info(line,"Data::print");
197  }
198  sprintf(line,"Number of 1D histograms : %i", m_h1d.size());
199  info(line,"Data::print");
200  std::vector<TH1D*>::const_iterator h1diter;
201  for (h1diter=m_h1d.begin(); h1diter!=m_h1d.end(); ++h1diter){
202  unsigned int index = (unsigned int)(h1diter-m_h1d.begin());
203  sprintf(line," (%3i) %10s - %50s", index,
204  (*h1diter)->GetName(),(*h1diter)->GetTitle());
205  info(line,"Data::print");
206  }
207  sprintf(line,"Number of 2D histograms : %i", m_h2d.size());
208  info(line,"Data::print");
209  std::vector<TH2D*>::const_iterator h2diter;
210  for (h2diter=m_h2d.begin(); h2diter!=m_h2d.end(); ++h2diter){
211  unsigned int index = (unsigned int)(h2diter-m_h2d.begin());
212  sprintf(line," (%3i) %10s - %50s", index,
213  (*h2diter)->GetName(),(*h2diter)->GetTitle());
214  info(line,"Data::print");
215  }
216 }
void info(std::string mymsg)
Definition: Object.h:38
std::vector< TH2D *> m_h2d
Definition: Data.h:59
std::vector< TH1D *> m_h1d
Definition: Data.h:58
list index
Definition: images.py:1021
std::vector< std::string > m_titles
Definition: Data.h:62
std::vector< std::string > m_names
Definition: Data.h:63
std::vector< double > * vectorPtr(unsigned int)
Definition: Data.cpp:134

◆ purge()

void Data::purge ( )

Definition at line 54 of file Data.cpp.

References Object::debug(), m_h1d, m_h2d, m_hist1d, m_names, m_titles, and m_values.

Referenced by hist2d(), and Processus::startProcessing().

54  {
55  m_names .clear();
56  m_titles.clear();
57  std::vector< std::vector<double>* >::iterator iter;
58  for (iter=m_values.begin(); iter!=m_values.end(); ++iter){
59  delete (*iter);
60  }
61  m_values.clear();
62  m_h1d.clear();
63  m_h2d.clear();
64  m_hist1d.clear();
65  debug("Data have been purged.","Data.purge");
66 }
std::vector< Histo1D > m_hist1d
Definition: Data.h:60
std::vector< std::vector< double > *> m_values
Definition: Data.h:57
std::vector< TH2D *> m_h2d
Definition: Data.h:59
std::vector< TH1D *> m_h1d
Definition: Data.h:58
void debug(std::string mymsg)
Definition: Object.h:37
std::vector< std::string > m_titles
Definition: Data.h:62
std::vector< std::string > m_names
Definition: Data.h:63

◆ rowFromName()

int Data::rowFromName ( std::string  name)

Definition at line 158 of file Data.cpp.

References m_names.

Referenced by hist2d(), and vector().

158  {
159  std::vector<std::string>::const_iterator iter;
160  for (iter=m_names.begin(); iter!=m_names.end(); ++iter){
161  if ((*iter).compare(name)==0){
162  return ((int)(iter-m_names.begin()));
163  }
164  }
165  return -1;
166 }
std::vector< std::string > m_names
Definition: Data.h:63
std::string name() const
Definition: Object.h:28

◆ setChannel()

void Data::setChannel ( int  ch)
inline

Definition at line 27 of file Data.h.

27  {
28  Ch = ch ;
29  }

◆ setData()

void Data::setData ( int  data)
inline

Definition at line 31 of file Data.h.

References Clear(), shell::data(), and Raw.

31  {
32  Raw = data;
33  }
int Raw
Definition: Data.h:42
def data(object, stream=None)
Definition: shell.py:150

◆ setEvt()

void Data::setEvt ( int  evt)
inline

Destructor.

Definition at line 23 of file Data.h.

References Evt.

23  {
24  Evt = evt;
25  }
ClassDef(Data, 1) protected int Evt
Definition: Data.h:37

◆ title()

std::string Data::title ( unsigned int  row)

Definition at line 123 of file Data.cpp.

References itos(), m_titles, and Object::warning().

123  {
124  if (row>m_titles.size()){
125  warning("Try to access a data stream value not defined ("+itos(row)+")","Data::title");
126  return 0;
127  }
128  return m_titles[row];
129 }
std::string itos(int)
Definition: Tools.cpp:46
std::vector< std::string > m_titles
Definition: Data.h:62
void warning(std::string mymsg)
Definition: Object.h:39

◆ vector() [1/2]

std::vector< double > Data::vector ( unsigned int  row)

Definition at line 146 of file Data.cpp.

References vectorPtr().

Referenced by export_proc(), and hist2d().

146  {
147  std::vector<double>* ptr=vectorPtr(row);
148  if ((ptr)!=0){
149  return *ptr;
150  }
151  std::vector<double> a;
152  return (a);
153 }
std::vector< double > * vectorPtr(unsigned int)
Definition: Data.cpp:134

◆ vector() [2/2]

std::vector< double > Data::vector ( std::string  name)

Definition at line 171 of file Data.cpp.

References rowFromName(), and vectorPtr().

171  {
172  int row=rowFromName(name);
173  if (row>-1){
174  std::vector<double>* ptr=vectorPtr(row);
175  if ((ptr)!=0){
176  return *ptr;
177  }
178  }
179  std::vector<double> a;
180  return (a);
181 }
int rowFromName(std::string)
Definition: Data.cpp:158
std::string name() const
Definition: Object.h:28
std::vector< double > * vectorPtr(unsigned int)
Definition: Data.cpp:134

◆ vectorPtr()

std::vector< double > * Data::vectorPtr ( unsigned int  row)

Definition at line 134 of file Data.cpp.

References itos(), m_values, and Object::warning().

Referenced by clear(), dataFill(), hist2d(), print(), and vector().

134  {
135  if (row>m_values.size()){
136  warning("Try to access a data stream value not defined ("+itos(row)+")",
137  "Data::vecData");
138  return 0;
139  }
140  return m_values[row];
141 }
std::string itos(int)
Definition: Tools.cpp:46
std::vector< std::vector< double > *> m_values
Definition: Data.h:57
void warning(std::string mymsg)
Definition: Object.h:39

Member Data Documentation

◆ Evt

ClassDef (Data,1) protected int Data::Evt

Definition at line 37 of file Data.h.

Referenced by Data(), and setEvt().

◆ m_h1d

std::vector< TH1D* > Data::m_h1d
private

Definition at line 58 of file Data.h.

Referenced by addHisto1d(), buildHistos(), empty(), print(), and purge().

◆ m_h2d

std::vector< TH2D* > Data::m_h2d
private

Definition at line 59 of file Data.h.

Referenced by addHisto2d(), buildHistos(), empty(), print(), and purge().

◆ m_hist1d

std::vector< Histo1D > Data::m_hist1d
private

Definition at line 60 of file Data.h.

Referenced by buildHistos(), hist1d(), and purge().

◆ m_hist2d

std::vector< Histo2D > Data::m_hist2d
private

Definition at line 61 of file Data.h.

Referenced by buildHistos(), and hist2d().

◆ m_names

std::vector< std::string > Data::m_names
private

Definition at line 63 of file Data.h.

Referenced by addDataStream(), empty(), name(), print(), purge(), and rowFromName().

◆ m_titles

std::vector< std::string > Data::m_titles
private

Definition at line 62 of file Data.h.

Referenced by addDataStream(), print(), purge(), and title().

◆ m_values

std::vector< std::vector<double>* > Data::m_values
private

Definition at line 57 of file Data.h.

Referenced by addDataStream(), purge(), and vectorPtr().

◆ Raw

int Data::Raw

Definition at line 42 of file Data.h.

Referenced by Data(), and setData().


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