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

#include <include/PhaserRampExec.h>

Inheritance diagram for PhaserRampExec:
Processus Object Attrib

Public Member Functions

 PhaserRampExec ()
 Standard constructor. More...
 
virtual ~PhaserRampExec ()
 Destructor. More...
 
virtual StatusCode initialize ()
 
virtual StatusCode execute ()
 
virtual StatusCode finalize ()
 
- 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 ()
 

Protected Member Functions

PhaserRampExecclone ()
 

Private Attributes

Phaserm_phaser
 
TH1D * h1
 
TH1D * h2
 
TH1D * h3
 
TH1D * h4
 
TH1D * hv1
 
TH1D * hv2
 
TH1D * hv3
 
TH1D * hv4
 
TFile * file
 
TH1F * histo
 
int m_initPhase [4]
 
unsigned long m_nProcessedEvents
 
unsigned long errorCount
 

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
Frédéric Machefert
Date
2004-07-23

Definition at line 26 of file PhaserRampExec.h.

Constructor & Destructor Documentation

◆ PhaserRampExec()

PhaserRampExec::PhaserRampExec ( )

Standard constructor.

Definition at line 36 of file PhaserRampExec.cpp.

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

Referenced by clone().

36  {
37  setName ( "PhaserRampExec" );
38  setType ( "Phaser" );
39  setTitle( "Phaser I2C Configuration Test" );
40 }
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

◆ ~PhaserRampExec()

PhaserRampExec::~PhaserRampExec ( )
virtual

Destructor.

Definition at line 44 of file PhaserRampExec.cpp.

44 {}

Member Function Documentation

◆ clone()

PhaserRampExec* PhaserRampExec::clone ( )
inlineprotectedvirtual

processus termination virtual function

Implements Processus.

Definition at line 41 of file PhaserRampExec.h.

References PhaserRampExec().

41  {
42  return new PhaserRampExec (*this);
43  }
PhaserRampExec()
Standard constructor.

◆ execute()

StatusCode PhaserRampExec::execute ( )
virtual

processus execution virtual function

Implements Processus.

Definition at line 90 of file PhaserRampExec.cpp.

References errorCount, h1, h2, h3, h4, hv1, hv2, hv3, hv4, Object::info(), itos(), m_nProcessedEvents, m_phaser, Phaser::phase(), Phaser::read(), Phaser::setPhase(), StatusCode::SUCCESS, and Phaser::write().

Referenced by BOOST_PYTHON_MODULE().

90  {
91 
93 
94  int v1 = (int) ( (float)rand()/RAND_MAX * 25. );
95  int v2 = (int) ( (float)rand()/RAND_MAX * 25. );
96  int v3 = (int) ( (float)rand()/RAND_MAX * 25. );
97  int v4 = (int) ( (float)rand()/RAND_MAX * 25. );
98 
99  m_phaser->setPhase(v1,v2,v3,v4);
100  m_phaser->write();
101  m_phaser->read();
102 
103  int d0=m_phaser->phase(0);
104  int d1=m_phaser->phase(1);
105  int d2=m_phaser->phase(2);
106  int d3=m_phaser->phase(3);
107 
108  hv1->Fill(v1);
109  hv2->Fill(v2);
110  hv3->Fill(v3);
111  hv4->Fill(v4);
112 
113 
114  if( v1!=d0 || v2!=d1 || v3!=d2 || v4!=d3 ){
115 
116  if ( d0 != v1 ) h1->Fill(int(d0));
117  if ( d1 != v2 ) h2->Fill(int(d1));
118  if ( d2 != v3 ) h3->Fill(int(d2));
119  if ( d3 != v4 ) h4->Fill(int(d3));
120 
121  errorCount++;
122  info("WRITE/READ INCOMPATIBILTY ["+
123  itos(errorCount)+"] " +
124  itos(v1)+"/"+itos(d0)+" "+
125  itos(v2)+"/"+itos(d1)+" "+
126  itos(v3)+"/"+itos(d2)+" "+
127  itos(v4)+"/"+itos(d3),
128  "Phaser::ramp");
129  // return false;
130  }
131 
132  return StatusCode::SUCCESS;
133 }
void info(std::string mymsg)
Definition: Object.h:38
std::string itos(int)
Definition: Tools.cpp:46
void setPhase(unsigned char channel, unsigned char value)
Definition: Phaser.h:42
unsigned long m_nProcessedEvents
unsigned int phase(unsigned int ch)
Definition: Phaser.h:63
unsigned long errorCount
void read()
Definition: Phaser.cpp:23
Phaser * m_phaser
void write()
Definition: Phaser.cpp:46

◆ finalize()

StatusCode PhaserRampExec::finalize ( )
virtual

processus termination virtual function

Implements Processus.

Definition at line 139 of file PhaserRampExec.cpp.

References Processus::closeRootFile(), Processus::elapsedTime(), errorCount, ftos(), h1, h2, h3, h4, hv1, hv2, hv3, hv4, Object::info(), itos(), m_initPhase, m_nProcessedEvents, m_phaser, Phaser::setPhase(), StatusCode::SUCCESS, and Phaser::write().

Referenced by BOOST_PYTHON_MODULE().

139  {
140  info("__" );
141  info("Errors "+itos(errorCount));
142  info("Processed Events "+itos(m_nProcessedEvents));
143  info("Elapsed Time "+ftos(elapsedTime())+" s.");
144  info("****************************" );
145 
147  m_initPhase[1],
148  m_initPhase[2],
149  m_initPhase[3]);
150 
151  m_phaser->write();
152 
153  closeRootFile();
154 
155  hv1->Delete();
156  hv2->Delete();
157  hv3->Delete();
158  hv4->Delete();
159  h1->Delete();
160  h2->Delete();
161  h3->Delete();
162  h4->Delete();
163 
164  return StatusCode::SUCCESS;
165 }
void info(std::string mymsg)
Definition: Object.h:38
std::string itos(int)
Definition: Tools.cpp:46
std::string ftos(float)
Definition: Tools.cpp:53
void setPhase(unsigned char channel, unsigned char value)
Definition: Phaser.h:42
void closeRootFile()
Definition: Processus.cpp:160
double elapsedTime()
Definition: Processus.h:340
unsigned long m_nProcessedEvents
unsigned long errorCount
Phaser * m_phaser
void write()
Definition: Phaser.cpp:46

◆ initialize()

StatusCode PhaserRampExec::initialize ( )
virtual

processus initialisation virtual function

Implements Processus.

Definition at line 49 of file PhaserRampExec.cpp.

References Processus::element(), errorCount, h1, h2, h3, h4, hv1, hv2, hv3, hv4, Object::info(), m_initPhase, m_nProcessedEvents, m_phaser, Object::name(), Processus::openRootFile(), Phaser::phase(), Phaser::read(), Processus::startChrono(), StatusCode::SUCCESS, and Object::type().

Referenced by BOOST_PYTHON_MODULE().

49  {
50 
51  info("" );
52  info("____________________________");
53  info("Phaser Configuration Control");
54  info(" =>" + element()->path() + " " +
55  element()->name() + " " + element()->type() );
56 
57  m_phaser=dynamic_cast<Phaser*>( element() );
58 
59  srand( (unsigned)time( NULL ) );
60 
61  m_phaser->read();
62 
63  m_initPhase[0]=m_phaser->phase(0);
64  m_initPhase[1]=m_phaser->phase(1);
65  m_initPhase[2]=m_phaser->phase(2);
66  m_initPhase[3]=m_phaser->phase(3);
67 
68  openRootFile ();
69 
70  hv1=new TH1D( "Delay1" , "Delay Channel 1" , 25 , 0. , 25. );
71  hv2=new TH1D( "Delay2" , "Delay Channel 2" , 25 , 0. , 25. );
72  hv3=new TH1D( "Delay3" , "Delay Channel 3" , 25 , 0. , 25. );
73  hv4=new TH1D( "Delay4" , "Delay Channel 4" , 25 , 0. , 25. );
74 
75  h1=new TH1D( "Error1" , "Error Channel 1" , 25 , 0. , 25. );
76  h2=new TH1D( "Error2" , "Error Channel 2" , 25 , 0. , 25. );
77  h3=new TH1D( "Error3" , "Error Channel 3" , 25 , 0. , 25. );
78  h4=new TH1D( "Error4" , "Error Channel 4" , 25 , 0. , 25. );
79 
81  errorCount=0;
82  startChrono();
83 
84  return StatusCode::SUCCESS;
85 }
void info(std::string mymsg)
Definition: Object.h:38
void openRootFile()
Definition: Processus.cpp:146
Definition: Phaser.h:19
unsigned long m_nProcessedEvents
void startChrono()
Definition: Processus.h:275
std::string name() const
Definition: Object.h:28
Element * element()
Definition: Processus.h:231
std::string type()
Definition: Object.h:29
unsigned int phase(unsigned int ch)
Definition: Phaser.h:63
unsigned long errorCount
void read()
Definition: Phaser.cpp:23
Phaser * m_phaser

Member Data Documentation

◆ errorCount

unsigned long PhaserRampExec::errorCount
private

Definition at line 56 of file PhaserRampExec.h.

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

◆ file

TFile* PhaserRampExec::file
private

Definition at line 50 of file PhaserRampExec.h.

Referenced by arguments.arguments::decode(), and arguments.arguments::printout().

◆ h1

TH1D* PhaserRampExec::h1
private

Definition at line 48 of file PhaserRampExec.h.

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

◆ h2

TH1D * PhaserRampExec::h2
private

Definition at line 48 of file PhaserRampExec.h.

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

◆ h3

TH1D * PhaserRampExec::h3
private

Definition at line 48 of file PhaserRampExec.h.

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

◆ h4

TH1D * PhaserRampExec::h4
private

Definition at line 48 of file PhaserRampExec.h.

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

◆ histo

TH1F* PhaserRampExec::histo
private

Definition at line 51 of file PhaserRampExec.h.

◆ hv1

TH1D* PhaserRampExec::hv1
private

Definition at line 49 of file PhaserRampExec.h.

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

◆ hv2

TH1D * PhaserRampExec::hv2
private

Definition at line 49 of file PhaserRampExec.h.

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

◆ hv3

TH1D * PhaserRampExec::hv3
private

Definition at line 49 of file PhaserRampExec.h.

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

◆ hv4

TH1D * PhaserRampExec::hv4
private

Definition at line 49 of file PhaserRampExec.h.

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

◆ m_initPhase

int PhaserRampExec::m_initPhase[4]
private

Definition at line 53 of file PhaserRampExec.h.

Referenced by finalize(), and initialize().

◆ m_nProcessedEvents

unsigned long PhaserRampExec::m_nProcessedEvents
private

Definition at line 55 of file PhaserRampExec.h.

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

◆ m_phaser

Phaser* PhaserRampExec::m_phaser
private

Definition at line 46 of file PhaserRampExec.h.

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


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