Cat
StorageFifo.cpp
Go to the documentation of this file.
1 // $Id: $
2 
3 // include files
4 
5 // local
6 #include "Proto40MHz_v1.h"
7 #include "A3PE.h"
8 #include "RAM.h"
9 #include "StorageFifo.h"
10 
11 //-----------------------------------------------------------------------------
12 // Implementation file for class : StorageFifo
13 //
14 // 2006-10-23 :²
15 //-----------------------------------------------------------------------------
16 
17 //=============================================================================
18 // Standard constructor, initializes variables
19 //=============================================================================
21  m_h1(0),
22  m_h2(0),
23  m_h3(0),
24  m_h4(0),
25  m_h5(0),
26  m_h6(0),
27  m_h7(0),
28  m_h8(0)
29 {
30  setName ( "StorageFifo" );
31  setType ( "Proto40MHz_v1" );
32  setTitle( "Proto40MHz_v1 Storage Fifo" );
33 }
34 //=============================================================================
35 // Destructor
36 //=============================================================================
38 
39 //=============================================================================
40 
41 //=========================================================================
42 //
43 //=========================================================================
45  debug("StorageFifo" , "initialize");
46 
47  info("" );
48  info("____________________________");
49  info("Proto 40 MHZ - Fifo dump");
50  info(" =>" + element()->path() + " " +
51  element()->name() + " " + element()->type() );
52 
53  m_board=dynamic_cast<Proto40MHz_v1*>( element() );
54 
55  if (!m_board){
56  warning("StorageFifo","No Proto40MHz_v1 board found. Interrupt." );
57  return false;
58  }
59 
60  m_pga=m_board->a3pe();
63 
64  m_fifo = m_pga->storageRam();
65 
66  for (int i=0; i<8; ++i) m_pga->setEnableADC(i,true);
67 
69 
70  m_h1=new TH1D( "Channel1" , "Data values channel 1" , m_depth , 0. , float(m_depth) );
71  m_h2=new TH1D( "Channel2" , "Data values channel 2" , m_depth , 0. , float(m_depth) );
72  m_h3=new TH1D( "Channel3" , "Data values channel 3" , m_depth , 0. , float(m_depth) );
73  m_h4=new TH1D( "Channel4" , "Data values channel 4" , m_depth , 0. , float(m_depth) );
74  m_h5=new TH1D( "Channel5", "Data values channel 5" , m_depth , 0. , float(m_depth) );
75  m_h6=new TH1D( "Channel6" , "Data values channel 6" , m_depth , 0. , float(m_depth) );
76  m_h7=new TH1D( "Channel7" , "Data values channel 7" , m_depth , 0. , float(m_depth) );
77  m_h8=new TH1D( "Channel8" , "Data values channel 8" , m_depth , 0. , float(m_depth) );
78  addHisto1d( m_h1 );
79  addHisto1d( m_h2 );
80  addHisto1d( m_h3 );
81  addHisto1d( m_h4 );
82  addHisto1d( m_h5 );
83  addHisto1d( m_h6 );
84  addHisto1d( m_h7 );
85  addHisto1d( m_h8 );
86 
87  return StatusCode::SUCCESS;
88 }
89 
90 
91 //=========================================================================
92 //
93 //=========================================================================
95  debug("StorageFifo" , "execute");
96 
97  m_pga->acquisition();
98  m_fifo->read();
99 
100  int val[12];
101 
102  for (int d=0; d<m_depth; ++d){
103  val[0] =m_fifo->io()->dataU8( 0+12*d);
104  val[1] =m_fifo->io()->dataU8( 1+12*d);
105  val[2] =m_fifo->io()->dataU8( 2+12*d);
106  val[3] =m_fifo->io()->dataU8( 3+12*d);
107  val[4] =m_fifo->io()->dataU8( 4+12*d);
108  val[5] =m_fifo->io()->dataU8( 5+12*d);
109  val[6] =m_fifo->io()->dataU8( 6+12*d);
110  val[7] =m_fifo->io()->dataU8( 7+12*d);
111  val[8] =m_fifo->io()->dataU8( 8+12*d);
112  val[9] =m_fifo->io()->dataU8( 9+12*d);
113  val[10]=m_fifo->io()->dataU8(10+12*d);
114  val[11]=m_fifo->io()->dataU8(11+12*d);
115 
116  m_h1->Fill(d+0.5,val[0]+((val[1]&0xf)<<8));
117  m_h2->Fill(d+0.5,(val[1]>>4)+(val[2]<<4));
118  m_h3->Fill(d+0.5,val[3]+((val[4]&0xf)<<8));
119  m_h4->Fill(d+0.5,(val[4]>>4)+(val[5]<<4));
120  m_h5->Fill(d+0.5,val[6]+((val[7]&0xf)<<8));
121  m_h6->Fill(d+0.5,(val[7]>>4)+(val[8]<<4));
122  m_h7->Fill(d+0.5,val[9]+((val[10]&0xf)<<8));
123  m_h8->Fill(d+0.5,(val[10]>>4)+(val[11]<<4));
124  }
125 
126  return StatusCode::SUCCESS;
127 }
128 
129 //=========================================================================
130 //
131 //=========================================================================
133  return StatusCode::SUCCESS;
134 }
void info(std::string mymsg)
Definition: Object.h:38
TH1D * m_h1
Definition: StorageFifo.h:37
TH1D * m_h2
Definition: StorageFifo.h:37
StatusCode setSoftwareTrigger(bool)
Definition: A3PE.cpp:368
TH1D * m_h5
Definition: StorageFifo.h:37
void setName(std::string name)
Definition: Object.h:51
virtual StatusCode finalize()
A3PE * a3pe()
Definition: Proto40MHz_v1.h:74
TH1D * m_h4
Definition: StorageFifo.h:37
RAM * storageRam()
Definition: A3PE.h:536
A3PE * m_pga
Definition: StorageFifo.h:35
virtual StatusCode read()
Definition: IOobject.h:73
void setType(std::string type)
Definition: Object.h:52
void debug(std::string mymsg)
Definition: Object.h:37
StorageFifo()
Standard constructor.
Definition: StorageFifo.cpp:20
virtual StatusCode execute()
Definition: StorageFifo.cpp:94
TH1D * m_h7
Definition: StorageFifo.h:37
void setTitle(std::string title)
Definition: Object.h:54
TH1D * m_h3
Definition: StorageFifo.h:37
U8 * dataU8()
Definition: IOdata.h:214
TH1D * m_h8
Definition: StorageFifo.h:37
std::string name() const
Definition: Object.h:28
void addHisto1d(TH1D *h)
Definition: Processus.h:160
Proto40MHz_v1 * m_board
Definition: StorageFifo.h:34
RAM * m_fifo
Definition: StorageFifo.h:36
virtual StatusCode initialize()
Definition: StorageFifo.cpp:44
Element * element()
Definition: Processus.h:231
StatusCode setWriteStorageFifoUsb(bool)
Definition: A3PE.cpp:99
StatusCode acquisition()
Definition: A3PE.cpp:417
std::string type()
Definition: Object.h:29
unsigned int fifoDepth()
Definition: A3PE.cpp:631
void warning(std::string mymsg)
Definition: Object.h:39
StatusCode setEnableADC(unsigned int, bool)
Definition: A3PE.cpp:87
TH1D * m_h6
Definition: StorageFifo.h:37
IOdata * io()
Definition: IOobject.h:66
virtual ~StorageFifo()
Destructor.
Definition: StorageFifo.cpp:37