Public Member Functions | Private Attributes | List of all members
daqdataformats::FEBSimulator Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-01/DAQDataFormats/cxx/include/FEBSimulator.h"

Public Member Functions

 FEBSimulator (version_t versionNanoSlice=nanosliceheader::RAWNANOSLICE_LATEST_VERSION)
 
 FEBSimulator (link_id_t linkID, version_t versionNanoSlice=nanosliceheader::RAWNANOSLICE_LATEST_VERSION)
 
 FEBSimulator (link_id_t linkID, float probability, version_t versionNanoSlice=nanosliceheader::RAWNANOSLICE_LATEST_VERSION)
 
 ~FEBSimulator ()
 
void advanceSEQ ()
 
void resetSEQ ()
 
void setLinkID (link_id_t linkID)
 
void setHitProbability (float probability)
 
void generateNanoSlice ()
 Generator methods produce a NanoSlice. More...
 
void generateNanoSlice (uint32_t PixelID)
 
void generateNanoSlice (uint32_t PixelID, bool ForceGeneration)
 
void generateNanoSlice (uint32_t PixelID, uint32_t TimeStamp, uint32_t PulseHeight, bool ForceGeneration)
 
void generateNanoSlice (uint32_t PixelID, uint32_t TimeStamp, const std::vector< uint32_t > &data)
 
bool nonEmptyNanoSlice ()
 
RawNanoSlicegetLastNanoSlice ()
 

Private Attributes

uint32_t fSEQ
 
link_id_t fFEBLinkID
 
float fHitProbability
 
uint32_t fVersionNanoSlice
 
RawNanoSlicefLastNanoSlice
 

Detailed Description

Definition at line 12 of file FEBSimulator.h.

Constructor & Destructor Documentation

FEBSimulator::FEBSimulator ( version_t  versionNanoSlice = nanosliceheader::RAWNANOSLICE_LATEST_VERSION)

Definition at line 14 of file FEBSimulator.cpp.

References daqdataformats::DEFAULT_HIT_PROBABILITY, fLastNanoSlice, fVersionNanoSlice, resetSEQ(), and setHitProbability().

14  {
15  resetSEQ();
16  setHitProbability(DEFAULT_HIT_PROBABILITY); // Default hit probability
17  fLastNanoSlice = new RawNanoSlice(versionNanoSlice);
18  fVersionNanoSlice = versionNanoSlice;
19 }
void setHitProbability(float probability)
const float DEFAULT_HIT_PROBABILITY
Definition: FEBSimulator.h:10
RawNanoSlice * fLastNanoSlice
Definition: FEBSimulator.h:47
FEBSimulator::FEBSimulator ( link_id_t  linkID,
version_t  versionNanoSlice = nanosliceheader::RAWNANOSLICE_LATEST_VERSION 
)

Definition at line 23 of file FEBSimulator.cpp.

References daqdataformats::DEFAULT_HIT_PROBABILITY, fLastNanoSlice, fVersionNanoSlice, resetSEQ(), setHitProbability(), and setLinkID().

23  {
24  resetSEQ();
25  setLinkID(linkID);
26  setHitProbability(DEFAULT_HIT_PROBABILITY); // Default hit probability
27  fLastNanoSlice = new RawNanoSlice(versionNanoSlice);
28  fVersionNanoSlice = versionNanoSlice;
29 }
void setHitProbability(float probability)
const float DEFAULT_HIT_PROBABILITY
Definition: FEBSimulator.h:10
void setLinkID(link_id_t linkID)
RawNanoSlice * fLastNanoSlice
Definition: FEBSimulator.h:47
FEBSimulator::FEBSimulator ( link_id_t  linkID,
float  probability,
version_t  versionNanoSlice = nanosliceheader::RAWNANOSLICE_LATEST_VERSION 
)

Definition at line 33 of file FEBSimulator.cpp.

References fLastNanoSlice, fVersionNanoSlice, resetSEQ(), setHitProbability(), and setLinkID().

33  {
34  resetSEQ();
35  setLinkID(linkID);
36  setHitProbability(probability); // Default hit probability
37  fLastNanoSlice = new RawNanoSlice(versionNanoSlice);
38  fVersionNanoSlice = versionNanoSlice;
39 }
void setHitProbability(float probability)
void setLinkID(link_id_t linkID)
RawNanoSlice * fLastNanoSlice
Definition: FEBSimulator.h:47
FEBSimulator::~FEBSimulator ( )

Definition at line 42 of file FEBSimulator.cpp.

References fLastNanoSlice.

42 { if(fLastNanoSlice) delete fLastNanoSlice;}
RawNanoSlice * fLastNanoSlice
Definition: FEBSimulator.h:47

Member Function Documentation

void FEBSimulator::advanceSEQ ( )

There is no need in masking out. setParameters will take care of that

Definition at line 46 of file FEBSimulator.cpp.

References fSEQ.

Referenced by generateNanoSlice().

46  {
47  /// There is no need in masking out. setParameters will take care of that
48  fSEQ++;
49 }
void FEBSimulator::generateNanoSlice ( )

Generator methods produce a NanoSlice.

Fill the header information for the nano slice Pixel can be from 0 to 32

Definition at line 66 of file FEBSimulator.cpp.

References central_limit::rand.

Referenced by daqdataformats::RawMicroSlice::generate(), and generateNanoSlice().

66  {
67 
68  /// Fill the header information for the nano slice
69  /// Pixel can be from 0 to 32
70  const uint32_t pixel_address = (uint32_t)rand() & 0x20;
71 
72  generateNanoSlice(pixel_address);
73 }
void generateNanoSlice()
Generator methods produce a NanoSlice.
void FEBSimulator::generateNanoSlice ( uint32_t  PixelID)

Check to see if we should generate a hit for this block

So, there is no hit

Now Set them parameters

Definition at line 76 of file FEBSimulator.cpp.

References daqdataformats::NanoSliceHeader::DataPresent, daqdataformats::NanoSliceHeader::DebugMode, FEB_STATUS_SIM, daqdataformats::NanoSliceHeader::FEBLinkID, daqdataformats::NanoSliceHeader::FEBStatus, fFEBLinkID, fHitProbability, fLastNanoSlice, daqdataformats::NanoSliceHeader::FrameSequenceNumber, fSEQ, fVersionNanoSlice, generateNanoSlice(), daqdataformats::NanoSlice::Header, daqdataformats::NanoSliceHeader::LinkStatus, daqdataformats::NanoSliceHeader::PixelAddress, daqdataformats::NanoSlice::PulseHeight, randReal, daqdataformats::NanoSlice::TimeStamp, and daqdataformats::NanoSliceHeader::Version.

76  {
77 
78  /// Check to see if we should generate a hit for this block
79  if( randReal() < fHitProbability){
80  generateNanoSlice(PixelID, true);
81  return;
82  }
83 
84  /// So, there is no hit
85 
86  NanoSlice FullNanoSlice;
87  // Fill the header information for the nano slice
88  FullNanoSlice.Header.DataPresent = false;
89  FullNanoSlice.TimeStamp = 0x0;
90  FullNanoSlice.PulseHeight = 0x0;
91  FullNanoSlice.Header.FrameSequenceNumber = fSEQ;
92  FullNanoSlice.Header.PixelAddress = PixelID; // Pixel not random
93  FullNanoSlice.Header.FEBStatus = FEB_STATUS_SIM;
94  FullNanoSlice.Header.FEBLinkID = fFEBLinkID;
95  FullNanoSlice.Header.DebugMode = false;
96  FullNanoSlice.Header.LinkStatus = true;
97  FullNanoSlice.Header.Version = (uint32_t)fVersionNanoSlice;
98 
99  /// Now Set them parameters
100  fLastNanoSlice->setParameters(FullNanoSlice);
101 }
#define FEB_STATUS_SIM
Definition: FEBSimulator.cpp:8
Data structure for holding all the nanoslice data of interest.
void generateNanoSlice()
Generator methods produce a NanoSlice.
#define randReal()
Definition: FEBSimulator.cpp:9
RawNanoSlice * fLastNanoSlice
Definition: FEBSimulator.h:47
void FEBSimulator::generateNanoSlice ( uint32_t  PixelID,
bool  ForceGeneration 
)

Generate the time stamp off the internal clock

Definition at line 105 of file FEBSimulator.cpp.

References generateNanoSlice(), and central_limit::rand.

105  {
106 
107 
108  /// Generate the time stamp off the internal clock
109  cycle_t full_timestamp;
110 
111  full_timestamp.full_time = tsc();
112  const uint32_t timeStamp = full_timestamp.time[0];
113  const uint32_t pulse_height = (uint32_t)rand();
114 
115  generateNanoSlice(PixelID, timeStamp, pulse_height, true);
116 }
void generateNanoSlice()
Generator methods produce a NanoSlice.
void FEBSimulator::generateNanoSlice ( uint32_t  PixelID,
uint32_t  TimeStamp,
uint32_t  PulseHeight,
bool  ForceGeneration 
)

Definition at line 120 of file FEBSimulator.cpp.

References advanceSEQ(), daqdataformats::NanoSliceHeader::DataPresent, daqdataformats::NanoSliceHeader::DebugMode, FEB_STATUS_SIM, daqdataformats::NanoSliceHeader::FEBLinkID, daqdataformats::NanoSliceHeader::FEBStatus, fFEBLinkID, fLastNanoSlice, daqdataformats::NanoSliceHeader::FrameSequenceNumber, fSEQ, fVersionNanoSlice, daqdataformats::NanoSlice::Header, daqdataformats::NanoSliceHeader::LinkStatus, daqdataformats::NanoSliceHeader::PixelAddress, daqdataformats::NanoSlice::PulseHeight, daqdataformats::NanoSlice::TimeStamp, and daqdataformats::NanoSliceHeader::Version.

120  {
121 
122  NanoSlice FullNanoSlice;
123 
124  // Fill the header information for the nano slice
125  FullNanoSlice.Header.FrameSequenceNumber = fSEQ;
126  FullNanoSlice.Header.PixelAddress = PixelID;
127  FullNanoSlice.Header.FEBStatus = FEB_STATUS_SIM;
128  FullNanoSlice.Header.FEBLinkID = fFEBLinkID;
129  FullNanoSlice.Header.DebugMode = false;
130  FullNanoSlice.Header.DataPresent = true;
131  FullNanoSlice.Header.LinkStatus = true;
132  FullNanoSlice.Header.Version = (uint32_t)fVersionNanoSlice;
133 
134  FullNanoSlice.TimeStamp = iTimeStamp;
135  FullNanoSlice.PulseHeight = iPulseHeight & 0x00000FFF;
136 
137  // Now Advance the Sequence Number
138  advanceSEQ();
139  // Now Set them parameters
140  fLastNanoSlice->setParameters(FullNanoSlice);
141 }
#define FEB_STATUS_SIM
Definition: FEBSimulator.cpp:8
Data structure for holding all the nanoslice data of interest.
RawNanoSlice * fLastNanoSlice
Definition: FEBSimulator.h:47
void FEBSimulator::generateNanoSlice ( uint32_t  PixelID,
uint32_t  TimeStamp,
const std::vector< uint32_t > &  data 
)

Check size of data vector

Pulseheight is valid for both version0 and version1 NanoSlice

Filling other NanoSlice fields

Filling other NanoSlice fields

Definition at line 144 of file FEBSimulator.cpp.

References fLastNanoSlice, fVersionNanoSlice, and generateNanoSlice().

144  {
145 
146  /// Check size of data vector
147  if(data.size() == 0) return;
148  if(fVersionNanoSlice == 1 && data.size() < 3) return;
149 
150  /// Pulseheight is valid for both version0 and version1 NanoSlice
151  const uint32_t pulse_height = data[0];
152 
153  generateNanoSlice(PixelID, TimeStamp, pulse_height, true);
154 
155  /// Filling other NanoSlice fields
156  if(fVersionNanoSlice == 1){
157  const uint32_t Value1 = data[1];
158  fLastNanoSlice->setValue1(Value1);
159  }// end of filling other nanoslice fields
160 
161  /// Filling other NanoSlice fields
162  if(fVersionNanoSlice == 2){
163  const uint32_t Value1 = data[1];
164  const uint32_t Value2 = data[2];
165 
166  //fLastNanoSlice->setValue1(Value1);
167  //fLastNanoSlice->setValue2(Value2);
168  fLastNanoSlice->setValue(0, Value1);
169  fLastNanoSlice->setValue(1, Value2);
170  }// end of filling other nanoslice fields
171 
172 }
const XML_Char const XML_Char * data
Definition: expat.h:268
void generateNanoSlice()
Generator methods produce a NanoSlice.
RawNanoSlice * fLastNanoSlice
Definition: FEBSimulator.h:47
RawNanoSlice * FEBSimulator::getLastNanoSlice ( )

Definition at line 182 of file FEBSimulator.cpp.

References fLastNanoSlice.

Referenced by daqdataformats::RawMicroSlice::generate().

182 {return fLastNanoSlice;}
RawNanoSlice * fLastNanoSlice
Definition: FEBSimulator.h:47
bool FEBSimulator::nonEmptyNanoSlice ( )

Definition at line 176 of file FEBSimulator.cpp.

References fLastNanoSlice, and daqdataformats::RawNanoSlice::getHeader().

Referenced by daqdataformats::RawMicroSlice::generate().

176  {
177  if(fLastNanoSlice->getHeader()->getDataPresent()){return true;}
178  return false;
179 }
IMPLEMENT_MAIN_STANDARD IMPLEMENT_MAIN_setBufferSource daqdataformats::RawNanoSliceHeader * getHeader() const
Get the NanoSlice header pointer.
Definition: RawNanoSlice.h:57
RawNanoSlice * fLastNanoSlice
Definition: FEBSimulator.h:47
void FEBSimulator::resetSEQ ( )

Definition at line 53 of file FEBSimulator.cpp.

References fSEQ.

Referenced by FEBSimulator().

53 { fSEQ = 0x0;}
void FEBSimulator::setHitProbability ( float  probability)

Definition at line 60 of file FEBSimulator.cpp.

References fHitProbability.

Referenced by FEBSimulator().

60 { fHitProbability = probability; }
void FEBSimulator::setLinkID ( link_id_t  linkID)

Definition at line 56 of file FEBSimulator.cpp.

References fFEBLinkID.

Referenced by FEBSimulator().

56 { fFEBLinkID = linkID; }

Member Data Documentation

link_id_t daqdataformats::FEBSimulator::fFEBLinkID
private

Definition at line 42 of file FEBSimulator.h.

Referenced by generateNanoSlice(), and setLinkID().

float daqdataformats::FEBSimulator::fHitProbability
private

Definition at line 43 of file FEBSimulator.h.

Referenced by generateNanoSlice(), and setHitProbability().

RawNanoSlice* daqdataformats::FEBSimulator::fLastNanoSlice
private
uint32_t daqdataformats::FEBSimulator::fSEQ
private

Definition at line 41 of file FEBSimulator.h.

Referenced by advanceSEQ(), generateNanoSlice(), and resetSEQ().

uint32_t daqdataformats::FEBSimulator::fVersionNanoSlice
private

Definition at line 45 of file FEBSimulator.h.

Referenced by FEBSimulator(), and generateNanoSlice().


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