Belle II Software  release-05-01-25
Merger Struct Reference

unpacker for the merger reader (TSF which reads the merger output) More...

Inheritance diagram for Merger:
Collaboration diagram for Merger:

Public Member Functions

 Merger (StoreArray< MergerBits > *inArrayPtr, std::string inName, unsigned inEventWidth, unsigned inOffset, int inHeaderSize, std::vector< int > inNodeID, unsigned inNInnerMergers, int &inDelay, int &inCnttrg, int inDebugLevel)
 Constructor.
 
void reserve (int subDetectorId, std::array< int, nFinesse > nWords) override
 reserve enough number of clocks (entries) in the Bitstream StoreArray
 
void unpack (int subDetectorId, std::array< int *, 4 > data32tab, std::array< int, 4 > nWords)
 Unpack function.
 
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...
 

Public Attributes

StoreArray< MergerBits > * arrayPtr
 pointer to the merger output Bitstream
 
unsigned nInnerMergers
 number of merger units in the inner super layer than this one
 
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

unpacker for the merger reader (TSF which reads the merger output)

Definition at line 56 of file CDCTriggerUnpackerModule.cc.

Member Function Documentation

◆ getHeaders()

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

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 138 of file CDCTriggerUnpackerModule.h.

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

◆ unpack()

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

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 123 of file CDCTriggerUnpackerModule.h.


The documentation for this struct was generated from the following file:
Belle2::SubTrigger::delay
int & delay
Reference to the variable of its Belle2Link delay.
Definition: CDCTriggerUnpackerModule.h:97
Belle2::SubTrigger::~SubTrigger
virtual ~SubTrigger()
destructor
Definition: CDCTriggerUnpackerModule.h:225
Belle2::SubTrigger::firmwareType
std::string firmwareType
type of the FPGA firmware
Definition: CDCTriggerUnpackerModule.h:93
Belle2::SubTrigger::iFinesse
int iFinesse
FINESSE (HSLB) id) of the board.
Definition: CDCTriggerUnpackerModule.h:89
Belle2::SubTrigger::name
std::string name
Name of the UT3.
Definition: CDCTriggerUnpackerModule.h:76
Belle2::SubTrigger::cnttrg
int & cnttrg
counter of trgger signal, total 32 bits, the 20 LSBs recorded in the event header
Definition: CDCTriggerUnpackerModule.h:99
Belle2::SubTrigger::iNode
int iNode
COPPER id of the board.
Definition: CDCTriggerUnpackerModule.h:87
Belle2::SubTrigger::headerSize
int headerSize
Size of the B2L header in words.
Definition: CDCTriggerUnpackerModule.h:85
Belle2::SubTrigger::firmwareVersion
std::string firmwareVersion
version of the FPGA firmware
Definition: CDCTriggerUnpackerModule.h:95