Belle II Software  release-08-01-10
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, const std::vector< int > &inNodeID_pcie40, int &inDelay, int &inCnttrg, int inDebugLevel=0)
 constructor
 
virtual void reserve (int, std::array< int, nFinesse >, bool)
 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 >, bool)
 Unpack the Belle2Link data and fill the Bitstream. More...
 
virtual int getHeaders (int subDetectorId, std::array< int *, 48 > data32tab, std::array< int, 48 > nWords, bool pciedata)
 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.
 
int iNode_pcie40
 PCIe40 id of the board.
 
int iFinesse_pcie40
 PCIe40 ch 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 58 of file CDCTriggerUnpackerModule.h.

Member Function Documentation

◆ getHeaders()

virtual int getHeaders ( int  subDetectorId,
std::array< int *, 48 >  data32tab,
std::array< int, 48 >  nWords,
bool  pciedata 
)
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 136 of file CDCTriggerUnpackerModule.h.

140  {
141 
142  int iNode_i = 0;
143  int iFinesse_i = 0;
144  if (pciedata) {
145  iNode_i = iNode_pcie40;
146  iFinesse_i = iFinesse_pcie40;
147  } else {
148  iNode_i = iNode;
149  iFinesse_i = iFinesse;
150  }
151 
152  if (subDetectorId != iNode_i) {
153  return 0;
154  }
155  // int nWordsize = 3075; // temporary solution to hard coded the correct event size (for 2D only?)
156  // empty data buffer
157  if (nWords[iFinesse_i] < headerSize) {
158  B2WARNING("The module " << name << " does not have enough data (" <<
159  nWords[iFinesse_i] << "). Nothing will be unpacked.");
160  return 0;
161  } else if (nWords[iFinesse_i] == headerSize) {
162  B2DEBUG(20, "The module " << name <<
163  " contains only the header. Nothing will be unpacked.");
164  return 0;
165  }
166 
167  // need one more check, give a warning if the event has wrong data size
168 
169  // event data block header:
170  // 0xdddd --> correct event data (for 2D only?)
171  // 0xbbbb --> dummy buffer supposed to be used for only suppressed events.
172  if (nWords[iFinesse_i] > headerSize) {
173  //dataHeader = CDCTriggerUnpacker::rawIntToAscii(data32tab.at(iFinesse)[headerSize]&0xFFFF0000 >> 16);
174  //bool dataHeader = ( (data32tab.at(iFinesse)[headerSize]&0xffff0000) == 0xdddd0000);
175  long dataHeader = (data32tab.at(iFinesse_i)[headerSize] & 0xffff0000);
176  if (dataHeader != 0xdddd0000) {
177  B2DEBUG(30, "The module " << name << " has an event data header " << std::hex << std::setfill('0') << std::setw(4) <<
178  (dataHeader >> 16) <<
179  " in this event. It will be ignore.");
180  return 0;
181  }
182  B2DEBUG(50, "subdet and head size " << std::setfill('0') << std::hex << std::setw(8) << iNode_i << ", " << std::dec << std::setw(
183  0) << nWords[iFinesse_i] <<
184  " : " << std::hex << std::setw(8) << data32tab.at(iFinesse_i)[0] << " " << data32tab.at(iFinesse_i)[1] << " " << data32tab.at(
185  iFinesse_i)[2] <<
186  " " << data32tab.at(iFinesse_i)[3] << " dataheader = " << dataHeader);
187  }
188 
189  /* get event header information
190  * Ideally, these parameters should not change in the same run,
191  * so it is more efficiency to do it in beginRun().
192  * However, since they are present in all events,
193  * let's check if they really remain unchanged.
194  */
195  if (headerSize >= 2) {
196  // supposedly these two Words will stay for all the versions
197  firmwareType = CDCTriggerUnpacker::rawIntToAscii(data32tab.at(iFinesse_i)[0]);
198  firmwareVersion = CDCTriggerUnpacker::rawIntToString(data32tab.at(iFinesse_i)[1]);
199  //int cnttrg = 0; // temporary solution, this should be one as a reference for comparison
200  int l1_revoclk = -1;
201 
202  if (headerSize >= 3) {
203  std::bitset<wordWidth> thirdWord(data32tab.at(iFinesse_i)[2]);
204  l1_revoclk = CDCTriggerUnpacker::subset<32, 0, 11>(thirdWord).to_ulong();
205 
206  if (firmwareType == "2D ") { // temporary solcuion, the following version number check is valid only for 2D
207 
208  if (firmwareVersion > "19041700") { // started since 19041705
209  // the third word is cnttrg and L1_revoclk
210  int newCnttrg = CDCTriggerUnpacker::subset<32, 12, 31>(thirdWord).to_ulong();
211  cnttrg = newCnttrg;
212  } else if (firmwareVersion > "17121900") { // upto that version, headerSize == 2?
213  // the third word is b2l delay and L1_revoclk
214  int newDelay = CDCTriggerUnpacker::subset<32, 12, 20>
215  (thirdWord).to_ulong(); // or should be <32,12,19>? bit 31-20 are for prescale?
216  if (delay > 0 && delay != newDelay) {
217  B2WARNING(" the Belle2Link delay for " << name <<
218  "has changed from " << delay << " to " << newDelay << "!");
219  }
220  delay = newDelay;
221  }
222  }
223  }
224 
225  B2DEBUG(20, name << ": " << firmwareType << ", version " <<
226  firmwareVersion << ", node " << std::hex << iNode_i <<
227  ", finesse " << iFinesse_i << ", delay: " << delay <<
228  ", cnttrg: " << cnttrg << std::dec << " == " << cnttrg << ", L1_revoclk " << l1_revoclk);
229 
230 
231  }
232  return 1;
233  };
int iNode_pcie40
PCIe40 id of the board.
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 iFinesse_pcie40
PCIe40 ch id of the board.
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 ,
bool   
)
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 109 of file CDCTriggerUnpackerModule.h.

◆ unpack()

virtual void unpack ( int  ,
std::array< int *, nFinesse ,
std::array< int, nFinesse ,
bool   
)
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 120 of file CDCTriggerUnpackerModule.h.


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