CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
MatacqDataFormatter Class Reference

#include <MatacqDataFormatter.h>

Public Member Functions

void interpretRawData (const FEDRawData &data, EcalMatacqDigiCollection &matacqDigiCollection)
 
void interpretRawData (const MatacqRawEvent &data, EcalMatacqDigiCollection &matacqDigiCollection)
 
 MatacqDataFormatter ()
 

Private Member Functions

void printData (std::ostream &out, const MatacqRawEvent &event) const
 

Detailed Description

Class to interpret ECAL MATACQ raw data and produce the MATACQ digis. This class is used by the MatacqProducer module.

Author
: Ph. Gras (CEA/Saclay)

Definition at line 16 of file MatacqDataFormatter.h.

Constructor & Destructor Documentation

◆ MatacqDataFormatter()

MatacqDataFormatter::MatacqDataFormatter ( )
inline

Definition at line 18 of file MatacqDataFormatter.h.

18 {};

Member Function Documentation

◆ interpretRawData() [1/2]

void MatacqDataFormatter::interpretRawData ( const FEDRawData data,
EcalMatacqDigiCollection matacqDigiCollection 
)

Callback method for decoding raw data

Parameters
dataraw data
matacqDigiCollection[out] digi collection object to fill with the decoded data

Definition at line 19 of file MatacqDataFormatter.cc.

19  {
20 #if MATACQ_DEBUG
21  cout << "****************************************************************\n";
22  cout << "********************** MATACQ decoder **************************\n";
23  cout << "****************************************************************\n";
24  cout << "FEDRawData: \n";
25  char oldPad = cout.fill('0');
26  for (int i = 0; i < max(100, (int)data.size()); ++i) {
27  cout << hex << setw(2) << (int)(data.data()[i]) << ((i + 1) % 8 ? " " : "\n");
28  }
29  cout.fill(oldPad);
30  cout << "======================================================================\n";
31 #endif //MATACQ_DEBUG defined
32  interpretRawData(MatacqRawEvent(data.data(), data.size()), matacqDigiCollection);
33 }

References gather_cfg::cout, std::data(), mps_fire::i, createfilelist::int, and SiStripPI::max.

Referenced by MatacqProducer::addMatacqData().

◆ interpretRawData() [2/2]

void MatacqDataFormatter::interpretRawData ( const MatacqRawEvent data,
EcalMatacqDigiCollection matacqDigiCollection 
)

Callback method for decoding raw data

Parameters
dataraw data
matacqDigiCollection[out] digi collection object to fill with the decoded data

Definition at line 35 of file MatacqDataFormatter.cc.

36  {
37 #if MATACQ_DEBUG
38  printData(cout, matacq);
39 #endif //MATACQ_DEBUG defined
40 
41  const double ns = 1.e-9; //ns->s
42  const double ps = 1.e-12; //ps->s
43  double ts = ns / matacq.getFreqGHz();
44  double tTrig = matacq.getTTrigPs() < .5 * numeric_limits<int>::max() ? ps * matacq.getTTrigPs() : 999.;
45  int version = matacq.getMatacqDataFormatVersion();
46 
47  vector<int16_t> samples;
48  //FIXME: the interpretRawData method should fill an EcalMatacqDigiCollection
49  //instead of an EcalMatacqDigi because Matacq channels are several.
50  //In the meamtime copy only the first channel appearing in data:
51  const vector<MatacqRawEvent::ChannelData>& chData = matacq.getChannelData();
52  for (unsigned iCh = 0; iCh < chData.size(); ++iCh) {
53  //copy time samples into a vector:
54  samples.resize(chData[iCh].nSamples);
55  copy(chData[iCh].samples, chData[iCh].samples + chData[iCh].nSamples, samples.begin());
56  int chId = chData[iCh].chId;
57  vector<int16_t> empty;
58  EcalMatacqDigi matacqDigi(empty, chId, ts, version, tTrig);
59 #if (defined(ECAL_MATACQ_DIGI_VERS) && (ECAL_MATACQ_DIGI_VERS >= 2))
60  matacqDigi.bxId(matacq.getBxId());
61  matacqDigi.l1a(matacq.getEventId());
62  matacqDigi.triggerType(matacq.getTriggerType());
63  matacqDigi.orbitId(matacq.getOrbitId());
64  matacqDigi.trigRec(matacq.getTrigRec());
65  matacqDigi.postTrig(matacq.getPostTrig());
66  matacqDigi.vernier(matacq.getVernier());
67  matacqDigi.delayA(matacq.getDelayA());
68  matacqDigi.emtcDelay(matacq.getEmtcDelay());
69  matacqDigi.emtcPhase(matacq.getEmtcPhase());
70  matacqDigi.attenuation_dB(matacq.getAttenuation_dB());
71  matacqDigi.laserPower(matacq.getLaserPower());
72  timeval t;
73  matacq.getTimeStamp(t);
74  matacqDigi.timeStamp(t);
75 #endif //matacq digi version >=2
76  matacqDigiCollection.push_back(matacqDigi);
77  matacqDigiCollection.back().swap(samples); //swap is more efficient than a copy
78  }
79 }

References EcalMatacqDigi::attenuation_dB(), edm::SortedCollection< T, SORT >::back(), EcalMatacqDigi::bxId(), filterCSVwithJSON::copy, gather_cfg::cout, EcalMatacqDigi::delayA(), std::empty(), EcalMatacqDigi::emtcDelay(), EcalMatacqDigi::emtcPhase(), MatacqRawEvent::getAttenuation_dB(), MatacqRawEvent::getBxId(), MatacqRawEvent::getChannelData(), MatacqRawEvent::getDelayA(), MatacqRawEvent::getEmtcDelay(), MatacqRawEvent::getEmtcPhase(), MatacqRawEvent::getEventId(), MatacqRawEvent::getFreqGHz(), MatacqRawEvent::getLaserPower(), MatacqRawEvent::getMatacqDataFormatVersion(), MatacqRawEvent::getOrbitId(), MatacqRawEvent::getPostTrig(), MatacqRawEvent::getTimeStamp(), MatacqRawEvent::getTriggerType(), MatacqRawEvent::getTrigRec(), MatacqRawEvent::getTTrigPs(), MatacqRawEvent::getVernier(), EcalMatacqDigi::l1a(), EcalMatacqDigi::laserPower(), SiStripPI::max, PresampleTask_cfi::nSamples, EcalMatacqDigi::orbitId(), EcalMatacqDigi::postTrig(), edm::SortedCollection< T, SORT >::push_back(), EgammaValidation_cff::samples, OrderedSet::t, EcalMatacqDigi::timeStamp(), EcalMatacqDigi::triggerType(), EcalMatacqDigi::trigRec(), dttriganalyzer_cfi::tTrig, EcalMatacqDigi::vernier(), and BeamSplash_cfg::version.

◆ printData()

void MatacqDataFormatter::printData ( std::ostream &  out,
const MatacqRawEvent event 
) const
private

Definition at line 81 of file MatacqDataFormatter.cc.

81  {
82  cout << "FED id: " << hex << "0x" << matacq.getFedId() << dec << "\n";
83  cout << "Event id (lv1): " << hex << "0x" << matacq.getEventId() << dec << "\n";
84  cout << "FOV: " << hex << "0x" << matacq.getFov() << dec << "\n";
85  cout << "BX id: " << hex << "0x" << matacq.getBxId() << dec << "\n";
86  cout << "Trigger type: " << hex << "0x" << matacq.getTriggerType() << dec << "\n";
87  cout << "DCC Length: " << matacq.getDccLen() << "\n";
88  cout << "Run number: " << matacq.getRunNum() << "\n";
89  cout << "Field 'DCC errors': " << hex << "0x" << matacq.getDccErrors() << dec << "\n";
90 
91  if (matacq.getStatus()) {
92  cout << "Error in matacq data. Errot code: " << hex << "0x" << matacq.getStatus() << dec << "\n";
93  }
94 
95  cout << "MATACQ data format version: " << matacq.getMatacqDataFormatVersion() << "\n";
96  cout << "Sampling frequency: " << matacq.getFreqGHz() << " GHz\n";
97  cout << "MATACQ channel count: " << matacq.getChannelCount() << "\n";
98  time_t timeStamp = matacq.getTimeStamp();
99  cout << "Data acquired on : " << ctime(&timeStamp);
100 
101  const vector<MatacqRawEvent::ChannelData>& channels = matacq.getChannelData();
102  for (unsigned i = 0; i < channels.size(); ++i) {
103  cout << "-------------------------------------- Channel " << channels[i].chId << ": " << setw(4)
104  << channels[i].nSamples << " samples --------------------------------------\n";
105 
106  for (int iSample = 0; iSample < channels[i].nSamples; ++iSample) {
107  MatacqRawEvent::int16le_t adc = (channels[i].samples)[iSample];
108  cout << setw(4) << adc << ((iSample % 20 == 19) ? "\n" : " ");
109  }
110  }
111  cout << "=================================================="
112  "==================================================\n\n";
113 }

References ecalMGPA::adc(), ewkTauDQM_cfi::channels, gather_cfg::cout, TauDecayModes::dec, MatacqRawEvent::getBxId(), MatacqRawEvent::getChannelCount(), MatacqRawEvent::getChannelData(), MatacqRawEvent::getDccErrors(), MatacqRawEvent::getDccLen(), MatacqRawEvent::getEventId(), MatacqRawEvent::getFedId(), MatacqRawEvent::getFov(), MatacqRawEvent::getFreqGHz(), MatacqRawEvent::getMatacqDataFormatVersion(), MatacqRawEvent::getRunNum(), MatacqRawEvent::getStatus(), MatacqRawEvent::getTimeStamp(), MatacqRawEvent::getTriggerType(), and mps_fire::i.

MatacqDataFormatter::interpretRawData
void interpretRawData(const FEDRawData &data, EcalMatacqDigiCollection &matacqDigiCollection)
Definition: MatacqDataFormatter.cc:19
ecalMGPA::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:11
mps_fire.i
i
Definition: mps_fire.py:355
EcalMatacqDigi
Definition: EcalMatacqDigi.h:16
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
dttriganalyzer_cfi.tTrig
tTrig
Definition: dttriganalyzer_cfi.py:11
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::SortedCollection::push_back
void push_back(T const &t)
Definition: SortedCollection.h:188
PresampleTask_cfi.nSamples
nSamples
Definition: PresampleTask_cfi.py:7
EgammaValidation_cff.samples
samples
Definition: EgammaValidation_cff.py:19
OrderedSet.t
t
Definition: OrderedSet.py:90
MatacqRawEvent
Definition: MatacqRawEvent.h:30
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
createfilelist.int
int
Definition: createfilelist.py:10
edm::SortedCollection::back
const_reference back() const
Definition: SortedCollection.h:292
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
ewkTauDQM_cfi.channels
channels
Definition: ewkTauDQM_cfi.py:14
MatacqDataFormatter::printData
void printData(std::ostream &out, const MatacqRawEvent &event) const
Definition: MatacqDataFormatter.cc:81
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
MatacqRawEvent::int16le_t
Definition: MatacqRawEvent.h:60
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143