14 if (
debug)
cout <<
"[DTDigiToRaw]: constructor" << endl;
19 if (
debug)
cout <<
"[DTDigiToRaw]: destructor" << endl;
29 vector<uint32_t> words;
31 uint32_t fakeROSHeaderWord =
35 uint32_t fakeROSTrailerWord =
55 bool b_ros[12] = {
false,
false,
false,
false,
false,
false,
56 false,
false,
false,
false,
false,
false};
57 vector <uint32_t> w_ROBROS[12][25];
60 for (detUnitIt = digis.begin(); detUnitIt != digis.end(); ++detUnitIt) {
64 const DTLayerId layerId = (*detUnitIt).first;
70 digi != digiRange.second;
73 int dduId = -1, rosId = -1, robId = -1, tdcId = -1, channelId = -1;
75 int layer = layerId.
layer();
80 int wheel = chamberID.
wheel();
81 int sector = chamberID.
sector();
83 int searchstatus = map->
84 geometryToReadOut(wheel, station, sector, superlayer, layer, (*digi).wire(),
85 dduId, rosId, robId, tdcId, channelId);
87 if (searchstatus == 1 &&
debug)
88 cout <<
"[DTDigiToRaw]: warning, geometryToReadOut status = 1" << endl;
91 if (
dduID_ != dduId)
continue;
96 int ntdc = (*digi).countsTDC();
97 dttdc_mw.
set(word, 0, 0, 0, tdcId, channelId, ntdc*4);
101 int tdcIDCheck = tdcMeasurementWord.
tdcID();
102 int tdcChannelCheck = tdcMeasurementWord.
tdcChannel();
103 int tdcCountsCheck = tdcMeasurementWord.
tdcTime();
104 if (tdcIDCheck == tdcId && channelId ==tdcChannelCheck && ntdc == tdcCountsCheck) {
106 if (rosId <= NROS && rosId > 0) b_ros[rosId - 1] =
true;
108 cout <<
"[DTDigiToRaw]: invalid value for rosId" << endl;
112 w_ROBROS[rosId - 1][robId].push_back(word);
118 uint32_t therosList = 0;
119 for (
int i_ros = 0; i_ros < NROS; i_ros++) {
120 if (b_ros[i_ros]) therosList += uint32_t(
pow(2.0, i_ros));
123 if (
debug)
cout <<
"[DTDigiToRaw]: therosList = " << therosList << endl;
128 for (
int i_ros = 0; i_ros < NROS; i_ros++) {
131 words.push_back(fakeROSHeaderWord);
135 for (
int i_rob = 0; i_rob < NROB; i_rob++) {
137 vector <uint32_t>::const_iterator i_robros;
138 if (w_ROBROS[i_ros][i_rob].
begin() != w_ROBROS[i_ros][i_rob].
end()) {
141 rob_header.
set(word, i_rob, 0, 0);
143 words.push_back(word);
147 for (i_robros = w_ROBROS[i_ros][i_rob].
begin(); i_robros != w_ROBROS[i_ros][i_rob].end(); i_robros++) {
149 words.push_back((*i_robros));
155 rob_trailer.
set(word, i_rob, 0, n_robros + 2);
157 words.push_back(word);
163 words.push_back(fakeROSTrailerWord);
181 uint32_t secondstatusword = therosList << 16;
182 words.push_back(secondstatusword);
190 int dataSize = words.size()*
sizeof(
Word32);
193 for (
unsigned int i = 0;
i < words.size();
i += 2) {
194 *word64 = (
Word64(words[
i]) << 32) | words[i + 1];
T getUntrackedParameter(std::string const &, T const &) const
DTDigiToRaw(const edm::ParameterSet &ps)
Constructor.
DTChamberId chamberId() const
Return the corresponding ChamberId.
static const uint32_t trailerControlWord
int layer() const
Return the layer number.
static void set(uint32_t &word, int rob_id, int event_id, int word_count)
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
const edm::ParameterSet pset
FEDRawData * createFedBuffers(const DTDigiCollection &digis, edm::ESHandle< DTReadOutMapping > &mapping)
Take a vector of digis and fill the FEDRawDataCollection.
int tdcID() const
<== OBSOLETE!!
int superlayer() const
Return the superlayer number (deprecated method name)
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)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
virtual ~DTDigiToRaw()
Destructor.
static const uint32_t headerControlWord
Control bits definitions.
std::pair< const_iterator, const_iterator > Range
int station() const
Return the station number.
int wheel() const
Return the wheel number.
Power< A, B >::type pow(const A &a, const B &b)