Belle II Software  release-06-00-14
SubTrigger Struct Reference

enum class SubTriggerType : unsigned char {Merger, TSF, T2D, T3D, Neuro, ETF}; More...

#include <CDCTriggerUnpackerModule.h>

Inheritance diagram for SubTrigger:
Collaboration diagram for SubTrigger:

Public Member Functions

 SubTrigger (const std::string &inName, unsigned inEventWidth, unsigned inOffset, int inHeaderSize, const std::vector< int > &inNodeID, int &inDelay, int &inCnttrg, int inDebugLevel=0)
 constructor
 
virtual void reserve (int, std::array< int, nFinesse >)
 Calculate the number of clocks in the data, reserve that much of clocks in the Bitstream(s) More...
 
virtual void unpack (int, std::array< int *, nFinesse >, std::array< int, nFinesse >)
 Unpack the Belle2Link data and fill the Bitstream. More...
 
virtual int getHeaders (int subDetectorId, std::array< int *, 4 > data32tab, std::array< int, 4 > nWords)
 Get the Belle2Link header information. More...
 
virtual ~SubTrigger ()
 destructor
 

Public Attributes

std::string name
 Name of the UT3.
 
unsigned eventWidth
 Size of an event in the Belle2Link data in 32-bit words.
 
unsigned offset
 The starting point of the data in an event.
 
int headerSize
 Size of the B2L header in words.
 
int iNode
 COPPER id of the board.
 
int iFinesse
 FINESSE (HSLB) id) of the board.
 
std::string firmwareType
 type of the FPGA firmware
 
std::string firmwareVersion
 version of the FPGA firmware
 
int & delay
 Reference to the variable of its Belle2Link delay.
 
int & cnttrg
 counter of trgger signal, total 32 bits, the 20 LSBs recorded in the event header
 
int debugLevel
 debug level in the steering file
 

Detailed Description

enum class SubTriggerType : unsigned char {Merger, TSF, T2D, T3D, Neuro, ETF};

Definition at line 56 of file CDCTriggerUnpackerModule.h.

Member Function Documentation

◆ getHeaders()

virtual int getHeaders ( int  subDetectorId,
std::array< int *, 4 >  data32tab,
std::array< int, 4 >  nWords 
)
inlinevirtual

Get the Belle2Link header information.

Parameters
subDetectorIdCOPPER id of the current data
data32tablist of pointers to the Belle2Link data buffers
nWordsNumber of words of each FINESSE in the COPPER
Returns
1 if there are data other than the header

Definition at line 128 of file CDCTriggerUnpackerModule.h.

131  {
132  if (subDetectorId != iNode) {
133  return 0;
134  }
135  // int nWordsize = 3075; // temporary solution to hard coded the correct event size (for 2D only?)
136  // empty data buffer
137  if (nWords[iFinesse] < headerSize) {
138  B2WARNING("The module " << name << " does not have enough data (" <<
139  nWords[iFinesse] << "). Nothing will be unpacked.");
140  return 0;
141  } else if (nWords[iFinesse] == headerSize) {
142  B2DEBUG(20, "The module " << name <<
143  " contains only the header. Nothing will be unpacked.");
144  return 0;
145  }
146 
147  // need one more check, give a warning if the event has wrong data size
148 
149  // event data block header:
150  // 0xdddd --> correct event data (for 2D only?)
151  // 0xbbbb --> dummy buffer supposed to be used for only suppressed events.
152  if (nWords[iFinesse] > headerSize) {
153  //dataHeader = CDCTriggerUnpacker::rawIntToAscii(data32tab.at(iFinesse)[headerSize]&0xFFFF0000 >> 16);
154  //bool dataHeader = ( (data32tab.at(iFinesse)[headerSize]&0xffff0000) == 0xdddd0000);
155  long dataHeader = (data32tab.at(iFinesse)[headerSize] & 0xffff0000);
156  if (dataHeader != 0xdddd0000) {
157  B2DEBUG(30, "The module " << name << " has an event data header " << std::hex << std::setfill('0') << std::setw(4) <<
158  (dataHeader >> 16) <<
159  " in this event. It will be ignore.");
160  return 0;
161  }
162  B2DEBUG(50, "subdet and head size " << std::setfill('0') << std::hex << std::setw(8) << iNode << ", " << std::dec << std::setw(
163  0) << nWords[iFinesse] <<
164  " : " << std::hex << std::setw(8) << data32tab.at(iFinesse)[0] << " " << data32tab.at(iFinesse)[1] << " " << data32tab.at(
165  iFinesse)[2] <<
166  " " << data32tab.at(iFinesse)[3] << " dataheader = " << dataHeader);
167  }
168 
169  /* get event header information
170  * Ideally, these parameters should not change in the same run,
171  * so it is more efficiency to do it in beginRun().
172  * However, since they are present in all events,
173  * let's check if they really remain unchanged.
174  */
175  if (headerSize >= 2) {
176  // supposedly these two Words will stay for all the versions
177  firmwareType = CDCTriggerUnpacker::rawIntToAscii(data32tab.at(iFinesse)[0]);
178  firmwareVersion = CDCTriggerUnpacker::rawIntToString(data32tab.at(iFinesse)[1]);
179  //int cnttrg = 0; // temporary solution, this should be one as a reference for comparison
180  int l1_revoclk = -1;
181 
182  if (headerSize >= 3) {
183  std::bitset<wordWidth> thirdWord(data32tab.at(iFinesse)[2]);
184  l1_revoclk = CDCTriggerUnpacker::subset<32, 0, 11>(thirdWord).to_ulong();
185 
186  if (firmwareType == "2D ") { // temporary solcuion, the following version number check is valid only for 2D
187 
188  if (firmwareVersion > "19041700") { // started since 19041705
189  // the third word is cnttrg and L1_revoclk
190  int newCnttrg = CDCTriggerUnpacker::subset<32, 12, 31>(thirdWord).to_ulong();
191  cnttrg = newCnttrg;
192  } else if (firmwareVersion > "17121900") { // upto that version, headerSize == 2?
193  // the third word is b2l delay and L1_revoclk
194  int newDelay = CDCTriggerUnpacker::subset<32, 12, 20>
195  (thirdWord).to_ulong(); // or should be <32,12,19>? bit 31-20 are for prescale?
196  if (delay > 0 && delay != newDelay) {
197  B2WARNING(" the Belle2Link delay for " << name <<
198  "has changed from " << delay << " to " << newDelay << "!");
199  }
200  delay = newDelay;
201  }
202  }
203  }
204 
205  B2DEBUG(20, name << ": " << firmwareType << ", version " <<
206  firmwareVersion << ", node " << std::hex << iNode <<
207  ", finesse " << iFinesse << ", delay: " << delay <<
208  ", cnttrg: " << cnttrg << std::dec << " == " << cnttrg << ", L1_revoclk " << l1_revoclk);
209 
210 
211  }
212  return 1;
213  };
int headerSize
Size of the B2L header in words.
std::string firmwareVersion
version of the FPGA firmware
std::string firmwareType
type of the FPGA firmware
int iFinesse
FINESSE (HSLB) id) of the board.
int & delay
Reference to the variable of its Belle2Link delay.
int & cnttrg
counter of trgger signal, total 32 bits, the 20 LSBs recorded in the event header
std::string name
Name of the UT3.
int iNode
COPPER id of the board.

◆ reserve()

virtual void reserve ( int  ,
std::array< int, nFinesse  
)
inlinevirtual

Calculate the number of clocks in the data, reserve that much of clocks in the Bitstream(s)

Parameters
subDetectorIdCOPPER id of the current data
nWordsNumber of words of each FINESSE in the COPPER

Reimplemented in Neuro, Tracker2D, and Merger.

Definition at line 102 of file CDCTriggerUnpackerModule.h.

◆ unpack()

virtual void unpack ( int  ,
std::array< int *, nFinesse ,
std::array< int, nFinesse  
)
inlinevirtual

Unpack the Belle2Link data and fill the Bitstream.

Parameters
subDetectorIdCOPPER id of the current data
data32tablist of pointers to the Belle2Link data buffers
nWordsNumber of words of each FINESSE in the COPPER

Reimplemented in Neuro.

Definition at line 113 of file CDCTriggerUnpackerModule.h.


The documentation for this struct was generated from the following file: