Cat
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | List of all members
StorageFifoAcquisition Class Reference

#include <inc/StorageFifoAcquisition.h>

Inheritance diagram for StorageFifoAcquisition:
Processus Object Attrib

Classes

class  StorageFifoAcquisition
 

Public Member Functions

 StorageFifoAcquisition ()
 Standard constructor. More...
 
virtual ~StorageFifoAcquisition ()
 Destructor. More...
 
virtual StatusCode initialize ()
 
virtual StatusCode execute ()
 
virtual StatusCode finalize ()
 
StatusCode setDepth (unsigned int)
 
unsigned int depth ()
 
StatusCode setChannels (unsigned int)
 
unsigned int channels ()
 
void setHistos (unsigned int nbins, float minRange, float maxRange)
 
- Public Member Functions inherited from Processus
 Processus ()
 Standard constructor. More...
 
virtual ~Processus ()
 Destructor. More...
 
StatusCode startProcessing ()
 
StatusCode endProcessing ()
 
void clean ()
 
void setStorage (std::string storage)
 
Datadata ()
 
std::vector< double > data (unsigned int row)
 
std::vector< double > data (std::string name)
 
Histo1Dhist1d (unsigned int row)
 
Histo2Dhist2d (unsigned int row)
 
void addDataStream (std::string name, std::string title)
 
void addHisto1d (TH1D *h)
 
void addHisto2d (TH2D *h)
 
StatusCode dataFill (int i, double val)
 
StatusCode dataFill (std::string name, double val)
 
std::string storage ()
 
void setElement (Element *element)
 
Elementelement ()
 
void incNErrors ()
 
void setNErrors (unsigned int)
 
unsigned int nErrors ()
 
TFile * rootFile ()
 
void openRootFile ()
 
void closeRootFile ()
 
void startChrono ()
 
void setLogMsg (std::string logMsg)
 
std::string logMsg ()
 
void setState (int state)
 
double elapsedTime ()
 
double elapsedTime (time_t start)
 
- 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 ()
 

Static Public Attributes

static const unsigned int m_depthmax = 40
 

Protected Member Functions

StorageFifoAcquisitionclone ()
 

Private Attributes

Proto40MHz_v1m_board
 
A3PEm_pga
 
RAMm_fifo
 
TH1D * m_h [8 *m_depthmax]
 
TH1D * m_sh [8]
 
TH1D * m_ah [8]
 
int m_channels
 
unsigned int m_nbins
 
float m_minRange
 
float m_maxRange
 
int m_depth
 

Additional Inherited Members

- Public Types inherited from Processus
enum  states { ERR =-1, NOT_OK, OK }
 
- Public Types inherited from Attrib
enum  Attribut {
  UNDEFINED, PASSIVE, ACTIVE, INTERFACE,
  IO, IODATA, ELEMENT, HARDWARE,
  PROCESSUS, SOFTWARE
}
 
- Protected Attributes inherited from Processus
Elementm_element
 
- Protected Attributes inherited from Attrib
std::string m_attribString [10]
 

Detailed Description

Author
Date
2006-10-23

Definition at line 18 of file StorageFifoAcquisition.h.

Constructor & Destructor Documentation

◆ StorageFifoAcquisition()

Standard constructor.

Definition at line 20 of file StorageFifoAcquisition.cpp.

References Object::setName(), Object::setTitle(), and Object::setType().

Referenced by clone().

20  :
21  m_channels(0xFF),
22  m_nbins(100),
23  m_minRange(0.),
24  m_maxRange(4095),
25  m_depth(5)
26 {
27  setName ( "StorageFifoAcquisition" );
28  setType ( "Proto40MHz_v1" );
29  setTitle( "Proto40MHz_v1 Storage Fifo" );
30 }
void setName(std::string name)
Definition: Object.h:51
void setType(std::string type)
Definition: Object.h:52
void setTitle(std::string title)
Definition: Object.h:54

◆ ~StorageFifoAcquisition()

StorageFifoAcquisition::~StorageFifoAcquisition ( )
virtual

Destructor.

Definition at line 34 of file StorageFifoAcquisition.cpp.

34 {}

Member Function Documentation

◆ channels()

unsigned int StorageFifoAcquisition::channels ( )
inline

Definition at line 32 of file StorageFifoAcquisition.h.

References m_channels.

Referenced by setChannels().

◆ clone()

StorageFifoAcquisition* StorageFifoAcquisition::clone ( )
inlineprotectedvirtual

processus termination virtual function

Implements Processus.

Definition at line 42 of file StorageFifoAcquisition.h.

References StorageFifoAcquisition().

42  {
43  return new StorageFifoAcquisition (*this);
44  }
StorageFifoAcquisition()
Standard constructor.

◆ depth()

unsigned int StorageFifoAcquisition::depth ( )
inline

Definition at line 29 of file StorageFifoAcquisition.h.

References m_depth, and setChannels().

Referenced by setDepth().

◆ execute()

StatusCode StorageFifoAcquisition::execute ( )
virtual

processus execution virtual function

Implements Processus.

Definition at line 98 of file StorageFifoAcquisition.cpp.

References A3PE::acquisition(), Processus::data(), IOdata::dataU8(), Object::debug(), IOobject::io(), m_channels, m_depth, m_fifo, m_h, m_pga, IOobject::read(), and StatusCode::SUCCESS.

98  {
99  debug("StorageFifoAcquisition" , "execute");
100 
101  m_pga->acquisition();
102  m_fifo->read();
103 
104  int channel=m_channels;
105 
106  int val[12], data[12];
107  for (unsigned int d=0; d<m_depth; ++d){
108  // d+=0.5;
109  val[0] =m_fifo->io()->dataU8( 0+12*d);
110  val[1] =m_fifo->io()->dataU8( 1+12*d);
111  val[2] =m_fifo->io()->dataU8( 2+12*d);
112  val[3] =m_fifo->io()->dataU8( 3+12*d);
113  val[4] =m_fifo->io()->dataU8( 4+12*d);
114  val[5] =m_fifo->io()->dataU8( 5+12*d);
115  val[6] =m_fifo->io()->dataU8( 6+12*d);
116  val[7] =m_fifo->io()->dataU8( 7+12*d);
117  val[8] =m_fifo->io()->dataU8( 8+12*d);
118  val[9] =m_fifo->io()->dataU8( 9+12*d);
119  val[10]=m_fifo->io()->dataU8(10+12*d);
120  val[11]=m_fifo->io()->dataU8(11+12*d);
121  data[0]=val[0]+((val[1]&0xf)<<8);
122  data[1]=(val[1]>>4)+(val[2]<<4);
123  data[2]=val[3]+((val[4]&0xf)<<8);
124  data[3]=(val[4]>>4)+(val[5]<<4);
125  data[4]=val[6]+((val[7]&0xf)<<8);
126  data[5]=(val[7]>>4)+(val[8]<<4);
127  data[6]=val[9]+((val[10]&0xf)<<8);
128  data[7]=(val[10]>>4)+(val[11]<<4);
129  for (int i=0; i<8; ++i){
130  if ((channel>>i)&1==1){
131  m_h[m_depth*i+d]->Fill(data[i]);
132  }
133  }
134  }
135  return StatusCode::SUCCESS;
136 }
virtual StatusCode read()
Definition: IOobject.h:73
TH1D * m_h[8 *m_depthmax]
void debug(std::string mymsg)
Definition: Object.h:37
U8 * dataU8()
Definition: IOdata.h:214
StatusCode acquisition()
Definition: A3PE.cpp:417
Data * data()
Definition: Processus.h:114
IOdata * io()
Definition: IOobject.h:66

◆ finalize()

StatusCode StorageFifoAcquisition::finalize ( )
virtual

processus termination virtual function

Implements Processus.

Definition at line 141 of file StorageFifoAcquisition.cpp.

References m_ah, m_channels, m_depth, m_h, m_sh, and StatusCode::SUCCESS.

141  {
142  int channel=m_channels;
143  for (int i=0; i<8; ++i){
144  if ((channel>>i)&1==1){
145  for (unsigned int d=0; d<m_depth; ++d){
146  m_ah[i]->Fill(i,m_h[m_depth*i+d]->GetMean());
147  m_sh[i]->Fill(i,m_h[m_depth*i+d]->GetRMS());
148  }
149  }
150  }
151  return StatusCode::SUCCESS;
152 }
TH1D * m_h[8 *m_depthmax]

◆ initialize()

StatusCode StorageFifoAcquisition::initialize ( )
virtual

processus initialisation virtual function

Implements Processus.

Definition at line 41 of file StorageFifoAcquisition.cpp.

References Proto40MHz_v1::a3pe(), Processus::addHisto1d(), Object::debug(), Processus::element(), Object::info(), m_ah, m_board, m_channels, m_depth, m_depthmax, m_fifo, m_h, m_maxRange, m_minRange, m_nbins, m_pga, m_sh, Object::name(), A3PE::setEnableADC(), A3PE::setFifoDepth(), A3PE::setSoftwareTrigger(), A3PE::setWriteStorageFifoUsb(), A3PE::storageRam(), StatusCode::SUCCESS, Object::title(), Object::type(), and Object::warning().

41  {
42  debug("StorageFifoAcquisition" , "initialize");
43 
44  info("" );
45  info("____________________________");
46  info("Proto 40 MHZ - Storage FIFO Acquisition");
47  info(" =>" + element()->path() + " " +
48  element()->name() + " " + element()->type() );
49 
50  m_board=dynamic_cast<Proto40MHz_v1*>( element() );
51 
52  if (!m_board){
53  warning("StorageFifoAcquisition","No Proto40MHz_v1 board found. Interrupt." );
54  return false;
55  }
56 
57  for (int i=0; i<8; ++i){
58  for (unsigned int d=0; d<m_depthmax; ++d){
59  m_h[m_depthmax*i+d]=0;
60  }
61  }
62 
63  m_pga=m_board->a3pe();
67  m_fifo = m_pga->storageRam();
68 
69  for (int i=0; i<8; ++i) m_pga->setEnableADC(i,true);
70 
71  int channel=m_channels;
72  char name[100], title[100];
73  for (int i=0; i<8; ++i){
74  if ((channel>>i)&1==1){
75  for (unsigned int d=0; d<m_depth; ++d){
76  sprintf(name,"Ch_%i_%i",i,d);
77  sprintf(title,"Ch %i - %i",i,d);
78  m_h[m_depth*i+d]=new TH1D(name, title , m_nbins , m_minRange, m_maxRange);
79  addHisto1d(m_h[m_depth*i+d]);
80  }
81  sprintf(name,"Ch_%i_sigma",i);
82  sprintf(title,"Ch %i Sigma",i);
83  m_sh[i]=new TH1D(name, title, m_depth , 0., m_depth);
84  addHisto1d(m_sh[i]);
85  sprintf(name,"Ch_%i_average",i);
86  sprintf(title,"Ch %i Average",i);
87  m_ah[i]=new TH1D(name, title, m_depth , 0., m_depth);
88  addHisto1d(m_ah[i]);
89  }
90  }
91  return StatusCode::SUCCESS;
92 }
void info(std::string mymsg)
Definition: Object.h:38
static const unsigned int m_depthmax
StatusCode setSoftwareTrigger(bool)
Definition: A3PE.cpp:368
std::string title()
Definition: Object.h:31
StatusCode setFifoDepth(unsigned int)
Definition: A3PE.cpp:612
A3PE * a3pe()
Definition: Proto40MHz_v1.h:74
RAM * storageRam()
Definition: A3PE.h:536
TH1D * m_h[8 *m_depthmax]
void debug(std::string mymsg)
Definition: Object.h:37
std::string name() const
Definition: Object.h:28
void addHisto1d(TH1D *h)
Definition: Processus.h:160
Element * element()
Definition: Processus.h:231
StatusCode setWriteStorageFifoUsb(bool)
Definition: A3PE.cpp:99
std::string type()
Definition: Object.h:29
void warning(std::string mymsg)
Definition: Object.h:39
StatusCode setEnableADC(unsigned int, bool)
Definition: A3PE.cpp:87

◆ setChannels()

StatusCode StorageFifoAcquisition::setChannels ( unsigned int  channels)

Definition at line 169 of file StorageFifoAcquisition.cpp.

References channels(), m_channels, StatusCode::SUCCESS, and Object::warning().

Referenced by depth().

169  {
170  if (channels>0xFF){
171  channels=(channels&0xFF);
172  warning("Channels coding not appropriate. Truncated at 0xFF.");
173  }
175  return StatusCode::SUCCESS;
176 }
void warning(std::string mymsg)
Definition: Object.h:39

◆ setDepth()

StatusCode StorageFifoAcquisition::setDepth ( unsigned int  depth)

Definition at line 157 of file StorageFifoAcquisition.cpp.

References depth(), StatusCode::FAILURE, m_depth, StatusCode::SUCCESS, and Object::warning().

157  {
158  if (depth>512){
159  warning("Cannot acquire more than 512 consecutive events. Interrupt.");
160  return StatusCode::FAILURE;
161  }
162  m_depth=depth;
163  return StatusCode::SUCCESS;
164 }
void warning(std::string mymsg)
Definition: Object.h:39

◆ setHistos()

void StorageFifoAcquisition::setHistos ( unsigned int  nbins,
float  minRange,
float  maxRange 
)
inline

Definition at line 34 of file StorageFifoAcquisition.h.

References m_maxRange, m_minRange, and m_nbins.

34  {
35  m_nbins=nbins;
36  m_minRange=minRange;
37  m_maxRange=maxRange;
38  };

Member Data Documentation

◆ m_ah

TH1D* StorageFifoAcquisition::m_ah[8]
private

Definition at line 52 of file StorageFifoAcquisition.h.

Referenced by finalize(), and initialize().

◆ m_board

Proto40MHz_v1* StorageFifoAcquisition::m_board
private

Definition at line 47 of file StorageFifoAcquisition.h.

Referenced by initialize().

◆ m_channels

int StorageFifoAcquisition::m_channels
private

Definition at line 53 of file StorageFifoAcquisition.h.

Referenced by channels(), execute(), finalize(), initialize(), and setChannels().

◆ m_depth

int StorageFifoAcquisition::m_depth
private

Definition at line 57 of file StorageFifoAcquisition.h.

Referenced by depth(), execute(), finalize(), initialize(), and setDepth().

◆ m_depthmax

const unsigned int StorageFifoAcquisition::m_depthmax = 40
static

Definition at line 39 of file StorageFifoAcquisition.h.

Referenced by initialize().

◆ m_fifo

RAM* StorageFifoAcquisition::m_fifo
private

Definition at line 49 of file StorageFifoAcquisition.h.

Referenced by execute(), and initialize().

◆ m_h

TH1D* StorageFifoAcquisition::m_h[8 *m_depthmax]
private

Definition at line 50 of file StorageFifoAcquisition.h.

Referenced by execute(), finalize(), and initialize().

◆ m_maxRange

float StorageFifoAcquisition::m_maxRange
private

Definition at line 56 of file StorageFifoAcquisition.h.

Referenced by initialize(), and setHistos().

◆ m_minRange

float StorageFifoAcquisition::m_minRange
private

Definition at line 55 of file StorageFifoAcquisition.h.

Referenced by initialize(), and setHistos().

◆ m_nbins

unsigned int StorageFifoAcquisition::m_nbins
private

Definition at line 54 of file StorageFifoAcquisition.h.

Referenced by initialize(), and setHistos().

◆ m_pga

A3PE* StorageFifoAcquisition::m_pga
private

Definition at line 48 of file StorageFifoAcquisition.h.

Referenced by execute(), and initialize().

◆ m_sh

TH1D* StorageFifoAcquisition::m_sh[8]
private

Definition at line 51 of file StorageFifoAcquisition.h.

Referenced by finalize(), and initialize().


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