13 cout <<
"[DTDigiToRaw]: constructor" << endl;
18 cout <<
"[DTDigiToRaw]: destructor" << endl;
25 vector<uint32_t> words;
43 detUnitIt = digis.begin();
45 bool b_ros[12] = {
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false};
46 vector<uint32_t> w_ROBROS[12][25];
48 for (detUnitIt = digis.begin(); detUnitIt != digis.end(); ++detUnitIt) {
51 const DTLayerId layerId = (*detUnitIt).first;
57 int dduId = -1, rosId = -1, robId = -1, tdcId = -1, channelId = -1;
67 int searchstatus =
map->geometryToReadOut(
wheel,
79 if (searchstatus == 1 &&
debug)
80 cout <<
"[DTDigiToRaw]: warning, geometryToReadOut status = 1" << endl;
88 int ntdc = (*digi).countsTDC();
89 dttdc_mw.
set(
word, 0, 0, 0, tdcId, channelId, ntdc * 4);
93 int tdcIDCheck = tdcMeasurementWord.
tdcID();
94 int tdcChannelCheck = tdcMeasurementWord.
tdcChannel();
95 int tdcCountsCheck = tdcMeasurementWord.
tdcTime();
96 if (tdcIDCheck == tdcId && channelId == tdcChannelCheck && ntdc == tdcCountsCheck) {
97 if (rosId <= NROS && rosId > 0)
98 b_ros[rosId - 1] =
true;
100 cout <<
"[DTDigiToRaw]: invalid value for rosId" << endl;
104 w_ROBROS[rosId - 1][robId].push_back(
word);
109 uint32_t therosList = 0;
110 for (
int i_ros = 0; i_ros < NROS; i_ros++) {
112 therosList += uint32_t(
pow(2.0, i_ros));
116 cout <<
"[DTDigiToRaw]: therosList = " << therosList << endl;
118 for (
int i_ros = 0; i_ros < NROS; i_ros++) {
120 words.push_back(fakeROSHeaderWord);
124 for (
int i_rob = 0; i_rob < NROB; i_rob++) {
125 vector<uint32_t>::const_iterator i_robros;
126 if (w_ROBROS[i_ros][i_rob].begin() != w_ROBROS[i_ros][i_rob].
end()) {
129 rob_header.
set(
word, i_rob, 0, 0);
131 words.push_back(
word);
135 for (i_robros = w_ROBROS[i_ros][i_rob].begin(); i_robros != w_ROBROS[i_ros][i_rob].end(); i_robros++) {
137 words.push_back((*i_robros));
143 rob_trailer.
set(
word, i_rob, 0, n_robros + 2);
145 words.push_back(
word);
150 words.push_back(fakeROSTrailerWord);
155 if (NWords % 2 == 1) {
163 uint32_t secondstatusword = therosList << 16;
164 words.push_back(secondstatusword);
171 int dataSize = words.size() *
sizeof(
Word32);
174 for (
unsigned int i = 0;
i < words.size();
i += 2) {
175 *word64 = (
Word64(words[
i]) << 32) | words[
i + 1];
DTDigiToRaw(const edm::ParameterSet &ps)
Constructor.
static const uint32_t trailerControlWord
static void set(uint32_t &word, int rob_id, int event_id, int word_count)
int tdcID() const
<== OBSOLETE!!
constexpr std::array< uint8_t, layerIndexSize > layer
T getUntrackedParameter(std::string const &, T const &) const
const edm::ParameterSet pset
DTChamberId chamberId() const
Return the corresponding ChamberId.
CSCDetId chamberID(const CSCDetId &cscDetId)
FEDRawData * createFedBuffers(const DTDigiCollection &digis, edm::ESHandle< DTReadOutMapping > &mapping)
Take a vector of digis and fill the FEDRawDataCollection.
int superlayer() const
Return the superlayer number (deprecated method name)
std::pair< const_iterator, const_iterator > Range
static const uint32_t rosTypeWord
Word Type bits definitions.
std::vector< DigiType >::const_iterator const_iterator
static void set(uint32_t &word, int pc, int paf, int hu, int tdc_id, int tdc_channel, int tdc_time)
int layer() const
Return the layer number.
virtual ~DTDigiToRaw()
Destructor.
static const uint32_t headerControlWord
Control bits definitions.
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Power< A, B >::type pow(const A &a, const B &b)