Belle II Software development
CDCUnpackerModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <cdc/modules/cdcUnpacker/CDCUnpackerModule.h>
10// DB objects
11#include <cdc/dbobjects/CDCChannelMap.h>
12
13#include <framework/datastore/DataStore.h>
14#include <framework/datastore/RelationArray.h>
15#include <framework/logging/Logger.h>
16#include <framework/utilities/FileSystem.h>
17// framework - Database
18#include <framework/database/DBArray.h>
19#include <cdc/topology/CDCWireTopology.h>
20
21#include <iostream>
22
23using namespace std;
24using namespace Belle2;
25using namespace CDC;
26
27//-----------------------------------------------------------------
28// Register the Module
29//-----------------------------------------------------------------
30REG_MODULE(CDCUnpacker);
31
32//-----------------------------------------------------------------
33// Implementation
34//-----------------------------------------------------------------
35
37{
38 //Set module properties
39 setDescription("CDCUnpacker generates CDCHit from Raw data.");
41
42 addParam("rawCDCName", m_rawCDCName, "Name of the RawCDC List name..", string(""));
43 addParam("cdcRawHitWaveFormName", m_cdcRawHitWaveFormName, "Name of the CDCRawHit (Raw data mode).", string(""));
44 addParam("cdcRawHitName", m_cdcRawHitName, "Name of the CDCRawHit (Suppressed mode).", string(""));
45 addParam("cdcHitName", m_cdcHitName, "Name of the CDCHit List name..", string(""));
46 addParam("fadcThreshold", m_fadcThreshold, "Threshold count.", 1);
47
48 addParam("xmlMapFileName", m_xmlMapFileName, "path+name of the xml file", string(""));
49 addParam("enableStoreCDCRawHit", m_enableStoreCDCRawHit, "Enable to store to the CDCRawHit object", false);
50 addParam("enablePrintOut", m_enablePrintOut, "Enable to print out the data to the terminal", false);
51 addParam("boardIDTrig", m_boardIDTrig, "Board ID for the trigger.", 7);
52 addParam("channelTrig", m_channelTrig, "Channel for the trigger.", 1);
53 addParam("subtractTrigTiming", m_subtractTrigTiming, "Enable to subtract the trigger timing from TDCs.", false);
54 addParam("tdcOffset", m_tdcOffset, "TDC offset (in TDC count).", 0);
55 addParam("enableDatabase", m_enableDatabase, "Enable database to read the channel map.", true);
56 addParam("enable2ndHit", m_enable2ndHit, "Enable 2nd hit timing as a individual CDCHit object.", false);
57 addParam("tdcAuxOffset", m_tdcAuxOffset, "TDC auxiliary offset (in TDC count).", 0);
58 addParam("pedestalSubtraction", m_pedestalSubtraction, "Enable ADC pedestal subtraction.", m_pedestalSubtraction);
59 addParam("relationRawHits", m_relationRawHits, "Enable relation of CDCHits, CDCRawHits, and CDCRawHitWaveForms.", false);
60 addParam("recoverBoardIdError", m_recoverBoardIdError, "Recover boardID errors", true);
61}
62
66
68{
69 m_dataLengthError = false;
70 m_dataSizeError = false;
72 if ((*m_channelMapFromDB).isValid()) {
73 // B2INFO("Channel map is valid");
74 } else {
75 B2FATAL("Channel map is not valid");
76 }
77
78 if (m_enablePrintOut == true) {
79 B2INFO("CDCUnpacker: initialize() Called.");
80 }
81
82 m_rawCDCs.isRequired(m_rawCDCName);
84 m_CDCRawHits.registerInDataStore(m_cdcRawHitName);
85 m_CDCHits.registerInDataStore(m_cdcHitName);
86
87 if (m_relationRawHits == true) {
88 m_CDCHits.registerRelationTo(m_CDCRawHitWaveForms);
89 m_CDCHits.registerRelationTo(m_CDCRawHits);
90
91 // Set default names for the relations.
95
99 }
100
101 if (m_enablePrintOut == true) {
102 B2INFO("CDCUnpacker: " << LogVar("FADC threshold", m_fadcThreshold));
103 }
104
106}
107
109{
110 if (m_enablePrintOut == true) {
111 B2INFO("CDCUnpacker: beginRun() called.");
112 }
113
114
115 loadMap();
117}
118
120{
121 if (m_enablePrintOut == true) {
122 B2INFO("CDCUnpacker: event() started.");
123 }
124
125 // TDC count for the trigger scinti.
126 int tdcCountTrig = m_tdcOffset;
127
128 const CDCWireTopology& wireTopology = CDCWireTopology::getInstance();
129
130 // Create Data objects.
131 m_CDCHits.clear();
132
133 if (m_relationRawHits == true) {
134 RelationArray rawCDCsToCDCHits(m_CDCRawHits, m_CDCHits, m_relCDCRawHitToCDCHitName); // CDCRawHit <-> CDCHit
135 RelationArray rawCDCWFsToCDCHits(m_CDCRawHitWaveForms, m_CDCHits, m_relCDCRawHitWFToCDCHitName); // CDCRawHitWaveForm <-> CDCHit
136 }
137
138 if (m_enableStoreCDCRawHit == true) {
139 m_CDCRawHits.clear();
140 m_CDCRawHitWaveForms.clear();
141 }
142
143 //
144 // Process RawCDC data block.
145 //
146
147 const int nEntries = m_rawCDCs.getEntries();
148
149 B2DEBUG(99, "nEntries of RawCDCs : " << nEntries);
150
151 for (int i = 0; i < nEntries; ++i) {
152 const int subDetectorId = m_rawCDCs[i]->GetNodeID(0);
153 const int iNode = (subDetectorId & 0xFFFFFF);
154 const int nEntriesRawCDC = m_rawCDCs[i]->GetNumEntries();
155
156 B2DEBUG(99, LogVar("nEntries of rawCDC[i]", nEntriesRawCDC));
157
158 for (int j = 0; j < nEntriesRawCDC; ++j) {
159 int trigType = m_rawCDCs[i]->GetTRGType(j); // Get event type of L1 trigger.
160 int nWords[48];
161 int* data32tab[48];
162 int MaxNumOfCh = m_rawCDCs[i]->GetMaxNumOfCh(j);
163 string readoutName;
164 if (MaxNumOfCh == 4) readoutName = "COPPER";
165 else if (MaxNumOfCh == 48) readoutName = "PCIe40";
166 else
167 B2FATAL("CDC UnpackerModule: Invalid value of GetMaxNumOfCh from raw data: " << LogVar("Number of ch: ",
168 m_rawCDCs[i]->GetMaxNumOfCh(j)));
169
170 for (int k = 0; k < MaxNumOfCh; ++k) {
171 nWords[k] = m_rawCDCs[i]->GetDetectorNwords(j, k);
172 if (MaxNumOfCh == 48 && m_rawCDCs[i]->CheckOnlineRemovedDataBit(j, k) == true) { //for error flag in ff55 trailer
173 if (nWords[k] != 0)
174 B2FATAL("The data is not removed for the bad channel (" << j << "," << k << ") with error flag in ff55 trailer! ");
175 }
176 data32tab[k] = (int*)m_rawCDCs[i]->GetDetectorBuffer(j, k);
177 }
178
179 //
180 // Search Data from Finess 0->MaxNumOfCh (4/48 for COPPER/PCIe40).
181 //
182
183 for (int iFiness = 0; iFiness < MaxNumOfCh; ++iFiness) {
184 int* ibuf = data32tab[iFiness];
185 const int nWord = nWords[iFiness];
186 B2DEBUG(99, LogVar("nWords (from " + readoutName + " header)", nWord));
187
188 if (m_enablePrintOut == true) {
189 B2INFO("CDCUnpacker : Print out CDC data block.");
190 printBuffer(ibuf, nWord);
191 }
192
193 const int c_headearWords = 3;
194 if (nWord < c_headearWords) {
195 if (m_enablePrintOut == true) {
196 B2WARNING("CDCUnpacker : No CDC block header.");
197 }
198 continue;
199 }
200
201 if (m_enablePrintOut == true) {
202 B2INFO("CDCUnpacker : RawDataBlock(CDC) : Block # "
203 << LogVar("Block", i)
204 << LogVar("Node", iNode)
205 << LogVar("Finness", iFiness));
206 }
207
208 setCDCPacketHeader(ibuf);
209
210 // Skip invalid boardsIDs
212 B2WARNING("Unrecoverable board " << std::hex << m_boardId);
213 continue;
214 }
215
216 const int dataType = getDataType();
217 const int dataLength = getDataLength() / 4; // Data length in int word (4bytes).
218 const int swDataLength = dataLength * 2; // Data length in short word (2bytes).
219
220
221 if (dataLength != (nWord - c_headearWords)) {
222 if (m_dataSizeError == false) {
223 B2ERROR("Inconsistent data size between " + readoutName + " and CDC FEE."
224 << LogVar("data length", dataLength) << LogVar("nWord", nWord)
225 << LogVar("Node ID", iNode) << LogVar("Finness ID", iFiness));
226 m_dataSizeError = true;
227 } else {
228 B2WARNING("Inconsistent data size between " + readoutName + " and CDC FEE."
229 << LogVar("data length", dataLength) << LogVar("nWord", nWord)
230 << LogVar("Node ID", iNode) << LogVar("Finness ID", iFiness));
231 }
232 continue;
233 }
234 if (m_enablePrintOut == true) {
235 B2INFO("CDCUnpacker : " << LogVar("Data size", dataLength));
236 }
237
238 const int board = getBoardId();
239 const int trgNumber = getTriggerNumber();
240 const int trgTime = getTriggerTime();
241
242 if (m_enablePrintOut == true) {
243 B2INFO("CDCUnpacker : " << LogVar("Board", board) << LogVar("Trigger number", trgNumber)
244 << LogVar("Trigger time ", trgTime));
245 }
246
247 //
248 // Check the data type (raw or suppressed mode?).
249 //
250
251 if (dataType == 1) { // Raw data mode.
252 if (m_enablePrintOut == true) {
253 B2INFO("CDCUnpacker : Raw data mode.");
254 }
255
256 m_buffer.clear();
257
258 for (int it = 0; it < dataLength; ++it) {
259 int index = it + c_headearWords;
260
261 m_buffer.push_back(static_cast<unsigned short>((ibuf[index] & 0xffff0000) >> 16));
262 m_buffer.push_back(static_cast<unsigned short>(ibuf[index] & 0xffff));
263 }
264
265 const int fadcTdcChannels = 48; // Total channels of FADC or TDC.
266 const int nSamples = swDataLength / (2 * fadcTdcChannels); // Number of samplings.
267
268 std::vector<unsigned short> fadcs;
269 std::vector<unsigned short> tdcs;
270
271 if (m_buffer.size() < fadcTdcChannels + 2 * fadcTdcChannels * nSamples) continue; // otherwise crash below
272
273 for (int iCh = 0; iCh < fadcTdcChannels; ++iCh) {
274 const int offset = fadcTdcChannels;
275 unsigned short fadcSum = 0; // FADC sum below threshold.
276 unsigned short tdc1 = 0x7fff; // Fastest TDC.
277 unsigned short tdc2 = 0x7fff; // 2nd fastest TDC.
278
279 for (int iSample = 0; iSample < nSamples; ++iSample) {
280 // FADC value for each sample and channel.
281
282 unsigned short fadc = m_buffer.at(iCh + 2 * fadcTdcChannels * iSample);
283
284 if (fadc > m_fadcThreshold) {
285 fadcSum += fadc;
286 }
287 // TDC count for each sample and channel.
288
289 unsigned short tdc = m_buffer.at(iCh + 2 * fadcTdcChannels * iSample + offset) & 0x7fff;
290 unsigned short tdcIsValid = (m_buffer.at(iCh + 2 * fadcTdcChannels * iSample + offset) & 0x8000) >> 15;
291 if (tdcIsValid == 1) { // good tdc data.
292 if (tdc > 0) { // if hit timng is 0, skip.
293 if (tdc < tdc1) {
294 tdc2 = tdc1; // 2nd fastest hit
295 tdc1 = tdc; // fastest hit.
296 }
297 }
298 }
299
300 fadcs.push_back(fadc);
301 tdcs.push_back(tdc);
302 if (m_enableStoreCDCRawHit == true) {
303 // Store to the CDCRawHitWaveForm object.
304 const unsigned short status = 0;
305 m_CDCRawHitWaveForms.appendNew(status, trgNumber, iNode, iFiness, board, iCh, iSample, trgTime, fadc, tdc);
306 }
307
308 }
309
310 if (tdc1 != 0x7fff) {
311 // Store to the CDCHit object.
312 const WireID wireId = getWireID(board, iCh);
313 if (wireTopology.isValidWireID(wireId)) {
314 if (trgTime < tdc1) {
315 tdc1 = (trgTime | 0x8000) - tdc1;
316 } else {
317 tdc1 = trgTime - tdc1;
318 }
319 CDCHit* firstHit = m_CDCHits.appendNew(tdc1, fadcSum, wireId);
320 if (m_enable2ndHit == true) {
321 CDCHit* secondHit = m_CDCHits.appendNew(tdc2, fadcSum, wireId);
322 secondHit->setOtherHitIndices(firstHit);
323 secondHit->set2ndHitFlag();
324 }
325 if (m_enableStoreCDCRawHit == true) {
326 if (m_relationRawHits == true) {
327 for (int iSample = 0; iSample < nSamples; ++iSample) {
328 m_CDCHits[m_CDCHits.getEntries() - 1]->addRelationTo(m_CDCRawHitWaveForms[m_CDCRawHitWaveForms.getEntries() - 1 + iSample -
329 (nSamples - 1) ]);
330 }
331 }
332 }
333 } else {
334 B2WARNING("Skip invalid wire board, channel: " << board << ", " << iCh);
335 }
336 }
337
338
339
340
341 if (m_enablePrintOut == true) {
342 //
343 // Print out (for debug).
344 //
345
346 printf("FADC ch %2d : ", iCh);
347 for (int iSample = 0; iSample < nSamples; ++iSample) {
348 printf("%4x ", fadcs.at(iSample));
349 }
350 printf("\n");
351
352 printf("TDC ch %2d : ", iCh);
353 for (int iSample = 0; iSample < nSamples; ++iSample) {
354 printf("%4x ", tdcs.at(iSample));
355 }
356 printf("\n");
357 }
358
359 }
360
361 } else if (dataType == 2) { // Suppressed mode.
362 if (m_enablePrintOut == true) {
363 B2INFO("CDCUnpacker : Suppressed mode.");
364 }
365
366 // convert int array -> short array.
367 m_buffer.clear();
368 for (int it = 0; it < dataLength; ++it) {
369 int index = it + c_headearWords;
370 m_buffer.push_back(static_cast<unsigned short>((ibuf[index] & 0xffff0000) >> 16));
371 m_buffer.push_back(static_cast<unsigned short>(ibuf[index] & 0xffff));
372 }
373
374 const size_t bufSize = m_buffer.size();
375 for (size_t it = 0; it < bufSize;) {
376 unsigned short header = m_buffer.at(it); // Header.
377 unsigned short ch = (header & 0xff00) >> 8; // Channel ID in FE.
378 unsigned short length = (header & 0xff) / 2; // Data length in short word.
379
380 if (header == 0xff02) {
381 it++;
382 continue;
383 }
384
385 if (!((length == 4) || (length == 5))) {
386 if (m_dataLengthError == false) {
387 B2ERROR("CDCUnpacker : data length should be 4 or 5 words."
388 << LogVar("data length", length)
389 << LogVar("board id", board)
390 << LogVar("channel", ch));
391 m_dataLengthError = true;
392 } else {
393 B2WARNING("CDCUnpacker : data length should be 4 or 5 words."
394 << LogVar("data length", length)
395 << LogVar("board id", board)
396 << LogVar("channel", ch));
397 }
398 break;
399 }
400
401 if (it + 2 >= bufSize) {
402 B2ERROR("CDCUnpacker : buffer overrun it + 2"
403 << LogVar("data length from header", length)
404 << LogVar("actual data length", bufSize)
405 << LogVar("board id", board)
406 << LogVar("channel", ch));
407 break; // exception below otherwise below
408 }
409 unsigned short tot = m_buffer.at(it + 1); // Time over threshold.
410 unsigned short fadcSum = m_buffer.at(it + 2); // FADC sum.
411
412 if (m_pedestalSubtraction == true) {
413 int diff = fadcSum - (*m_adcPedestalFromDB)->getPedestal(board, ch);
414 if (diff <= m_fadcThreshold) {
415 fadcSum = 0;
416 } else {
417 fadcSum = static_cast<unsigned short>(diff);
418 }
419 }
420 unsigned short tdc1 = 0; // TDC count.
421 unsigned short tdc2 = 0; // 2nd TDC count.
422 unsigned short tdcFlag = 0; // Multiple hit or not (1 for multi hits, 0 for single hit).
423
424 if (length == 4) {
425 if (it + 3 >= bufSize) {
426 B2ERROR("CDCUnpacker : buffer overrun it + 3"
427 << LogVar("data length from header", length)
428 << LogVar("actual data length", bufSize)
429 << LogVar("board id", board)
430 << LogVar("channel", ch));
431 break; // exception below otherwise below
432 }
433 tdc1 = m_buffer.at(it + 3);
434 } else if (length == 5) {
435 if (it + 4 >= bufSize) {
436 B2ERROR("CDCUnpacker : buffer overrun it + 4"
437 << LogVar("data length from header", length)
438 << LogVar("actual data length", bufSize)
439 << LogVar("board id", board)
440 << LogVar("channel", ch));
441 break; // exception below otherwise below
442 }
443 tdc1 = m_buffer.at(it + 3);
444 tdc2 = m_buffer.at(it + 4) & 0x7fff;
445 tdcFlag = (m_buffer.at(it + 4) & 0x8000) >> 15;
446 } else {
447 B2ERROR("CDCUnpacker : Undefined data length (should be 4 or 5 short words) ");
448 }
449
450 if (ch >= 48) {
451 B2WARNING("Invalid channel "
452 << LogVar("channel", ch)
453 << LogVar("board", board)
454 << LogVar("buffer total size", m_buffer.size())
455 << LogVar("length", length)
456 << LogVar("tdc", tdc1)
457 << LogVar("adc", fadcSum)
458 << LogVar("tot", tot)
459 );
460 it += length;
461 continue;
462 }
463
464 if (m_enablePrintOut == true) {
465 printf("%4x %4x %4x %4x %4x %4x %4x \n", ch, length, tot, fadcSum, tdc1, tdc2, tdcFlag);
466 }
467 if (length == 4 || length == 5) {
468
469 // const unsigned short status = 0;
470 const unsigned short status = trigType; // temporally trigger type is stored, here.
471 // Store to the CDCHit.
472 const WireID wireId = getWireID(board, ch);
473
474 if (isValidBoardChannel(wireId)) {
475 if (wireTopology.isValidWireID(wireId)) {
476
477 if (board == m_boardIDTrig && ch == m_channelTrig) {
478 tdcCountTrig = tdc1;
479 } else {
480 CDCHit* firstHit = m_CDCHits.appendNew(tdc1, fadcSum, wireId,
481 0, tot);
482 if (length == 5) {
483 if (m_enable2ndHit == true) {
484 CDCHit* secondHit = m_CDCHits.appendNew(tdc2, fadcSum, wireId,
485 0, tot);
486 secondHit->setOtherHitIndices(firstHit);
487 secondHit->set2ndHitFlag();
488 }
489 }
490 }
491
492 if (m_enableStoreCDCRawHit == true) {
493 // Store to the CDCRawHit object.
494 if (m_relationRawHits == true) {
495 CDCRawHit* rawHit = m_CDCRawHits.appendNew(status, trgNumber, iNode, iFiness, board, ch,
496 trgTime, fadcSum, tdc1, tdc2, tot);
497 m_CDCHits[m_CDCHits.getEntries() - 1]->addRelationTo(rawHit);
498 if (m_enable2ndHit == true) {
499 m_CDCHits[m_CDCHits.getEntries() - 2]->addRelationTo(rawHit);
500 }
501 } else {
502 m_CDCRawHits.appendNew(status, trgNumber, iNode, iFiness, board, ch,
503 trgTime, fadcSum, tdc1, tdc2, tot);
504 }
505 }
506 } else {
507 B2WARNING("Skip invalid wire board, channel: " << board << ", " << ch);
508 }
509 } else {
510 B2WARNING("Undefined board id is fired: " << LogVar("board id", board) << " " << LogVar("channel", ch));
511 }
512 }
513 it += length;
514 }
515
516 } else {
517 B2WARNING("CDCUnpacker : Undefined CDC Data Block : Block # " << LogVar("block id", i));
518 }
519 }
520 }
521 }
522
523 //
524 // t0 correction w.r.t. the timing of the trigger counter.
525 //
526 if (m_subtractTrigTiming == true) {
527 for (auto& hit : m_CDCHits) {
528 int tdc = hit.getTDCCount();
529 if (hit.is2ndHit()) {
530 if (tdc != 0) {
531 tdc = tdc - (tdcCountTrig - m_tdcOffset);
532 }
533 } else {
534 tdc = tdc - (tdcCountTrig - m_tdcOffset);
535 }
536
537 tdc -= m_tdcAuxOffset;
538 hit.setTDCCount(static_cast<unsigned short>(tdc));
539 }
540 }
541}
542
544{
545 if (m_enablePrintOut == true) {
546 B2INFO("CDCUnpacker : End run.");
547 }
548}
549
551{
552 if (m_enablePrintOut == true) {
553 B2INFO("CDCUnpacker : Terminated.");
554 }
555
558}
559
560
561WireID CDCUnpackerModule::getWireID(int iBoard, int iCh) const
562{
563 return m_map[iBoard][iCh];
564}
565
567{
568
569 if (m_enableDatabase == false) {
570
571 // Read the channel map from the local text.
572 std::string fileName = FileSystem::findFile(m_xmlMapFileName);
573 std::cout << fileName << std::endl;
574 if (fileName == "") {
575 B2ERROR("CDC unpacker can't find a filename: " << LogVar("file name", fileName));
576 exit(1);
577 }
578
579
580 ifstream ifs;
581 ifs.open(fileName.c_str());
582 int isl;
583 int icl;
584 int iw;
585 int iBoard;
586 int iCh;
587
588 while (!ifs.eof()) {
589 ifs >> isl >> icl >> iw >> iBoard >> iCh;
590 const WireID wireId(isl, icl, iw);
591 m_map[iBoard][iCh] = wireId;
592 }
593 } else {
594 for (const auto& cm : (*m_channelMapFromDB)) {
595 const int isl = cm.getISuperLayer();
596 const int il = cm.getILayer();
597 const int iw = cm.getIWire();
598 const int iBoard = cm.getBoardID();
599 const int iCh = cm.getBoardChannel();
600 const WireID wireId(isl, il, iw);
601 m_map[iBoard][iCh] = wireId;
602 }
603 }
604}
605
607{
608 if (m_pedestalSubtraction == true) {
610 if (!(*m_adcPedestalFromDB).isValid()) {
611 m_pedestalSubtraction = false;
612 }
613 }
614
615}
616
617void CDCUnpackerModule::printBuffer(int* buf, int nwords)
618{
619
620 for (int j = 0; j < nwords; ++j) {
621 printf(" %.8x", buf[j]);
622 if ((j + 1) % 10 == 0) {
623 printf("\n");
624 }
625 }
626 printf("\n");
627
628 return;
629}
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition CDCHit.h:40
void set2ndHitFlag()
Setter for 2nd hit flag.
Definition CDCHit.h:113
void setOtherHitIndices(CDCHit *otherHit)
Setter for the other hit indices.
Definition CDCHit.h:147
The CDCRawHit (suppressed mode) class.
Definition CDCRawHit.h:25
StoreArray< RawCDC > m_rawCDCs
Input array for CDC Raw.
bool m_enableDatabase
Enable/Disable to read the channel map from the database.
int m_boardId
Front end board ID.
std::vector< unsigned short > m_buffer
Short ward buffer of CDC event block.
int m_channelTrig
Channel for the trigger.
bool m_dataSizeError
True if data size error between CDCFE and COPPER has been already reported.
std::string m_relCDCRawHitWFToCDCHitName
Relation name between CDCRawHitWaveForm and CDCHit.
std::string m_rawCDCName
Name of the RawCDC dataobject (suppressed mode).
void initialize() override
Initializes the Module.
DBArray< CDCChannelMap > * m_channelMapFromDB
Channel map retrieved from DB.
StoreArray< CDCRawHitWaveForm > m_CDCRawHitWaveForms
Raw hit waveforms.
std::string m_relCDCRawHitToCDCHitName
Relation name between CDCRawHit and CDCHit.
void printBuffer(int *buf, int nwords)
Print out the CDC data block in hex.
int getTriggerNumber()
Getter for trigger number.
void event() override
Event action (main routine).
StoreArray< CDCRawHit > m_CDCRawHits
Raw hits.
bool m_subtractTrigTiming
Enable/Disable to subtract the trigger timing from TDCs.
bool m_dataLengthError
True if data length error has been already reported.
void endRun() override
End run action.
void terminate() override
Termination action.
int getTriggerTime()
Getter for trigger time in nsec.
int m_tdcOffset
TDC offset (nsec).
std::string m_xmlMapFileName
Name of the assignment map of FE board channel to the cell.
WireID m_map[300][48]
Assignment map of FE board channel to the cell.
int getDataType()
Getter for CDC data mode.
std::string m_cdcRawHitName
Name of the CDCRawHit dataobject (suppressed mode).
bool m_pedestalSubtraction
Whether pedestal is subtracted (true) or not (false).
void beginRun() override
Begin run action.
bool m_relationRawHits
True if add relation of CDCHits, CDCRawHits, and CDCRawHitWaveForms.
bool m_recoverBoardIdError
Recover boardID error if true, skip information otherwise.
DBObjPtr< CDCADCDeltaPedestals > * m_adcPedestalFromDB
ADC delta pedestal.
int m_boardIDTrig
Board ID for the trigger.
bool m_enableStoreCDCRawHit
Enable/Disable to store CDCRawHit.
int m_tdcAuxOffset
TDC auxiliary offset (nsec).
int getDataLength()
Getter for data length in byte.
void loadMap()
Load FE channel to cell ID map.
WireID getWireID(int iBoard, int iCh) const
Getter of Wire ID.
CDCUnpackerModule()
Constructor of the module.
bool m_enablePrintOut
Enable/Disable to print out the data to the terminal.
bool isValidBoardChannel(WireID wireId)
Check if the hit wire is valid or not.
std::string m_cdcRawHitWaveFormName
Name of the CDCRawHit dataobject (raw data mode).
void setCDCPacketHeader(const int *buf)
Set CDC Packet header.
virtual ~CDCUnpackerModule()
Destructor of the module.
bool m_enable2ndHit
Enable/Disable to 2nd hit output.
int getBoardId()
Getter for FE board ID.
std::string m_cdcHitName
Tree name of the CDCHit object.
void setADCPedestal()
Set DBobject of ADC delta pedestal.
StoreArray< CDCHit > m_CDCHits
CDC hits.
Class representing the sense wire arrangement in the whole of the central drift chamber.
static CDCWireTopology & getInstance()
Getter for the singleton instance of the wire topology.
bool isValidWireID(const WireID &wireID) const
Checks the validity of a wireID convenience object.
Class for accessing arrays of objects in the database.
Definition DBArray.h:26
Class for accessing objects in the database.
Definition DBObjPtr.h:21
static std::string relationName(const std::string &fromName, const std::string &toName, std::string const &namedRelation="")
Return storage name for a relation between two arrays of the given names.
Definition DataStore.h:180
static std::string arrayName(const TClass *t, const std::string &name)
Return the storage name for an object of the given TClass and name.
Definition DataStore.cc:163
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition Module.cc:208
Module()
Constructor.
Definition Module.cc:30
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition Module.h:80
Low-level class to create/modify relations between StoreArrays.
Class to identify a wire inside the CDC.
Definition WireID.h:34
Class to store variables with their name which were sent to the logging service.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition Module.h:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition Module.h:649
Abstract base class for different kinds of events.
STL namespace.