13 cout <<
"[DTDigiToRaw]: constructor" << endl;
18 cout <<
"[DTDigiToRaw]: destructor" << endl;
25 vector<uint32_t> words;
38 detUnitIt = digis.begin();
40 bool b_ros[12] = {
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false};
41 vector<uint32_t> w_ROBROS[12][25];
43 for (detUnitIt = digis.begin(); detUnitIt != digis.end(); ++detUnitIt) {
44 const DTLayerId layerId = (*detUnitIt).first;
49 int dduId = -1, rosId = -1, robId = -1, tdcId = -1, channelId = -1;
59 int searchstatus =
map->geometryToReadOut(
wheel,
71 if (searchstatus == 1 &&
debug)
72 cout <<
"[DTDigiToRaw]: warning, geometryToReadOut status = 1" << endl;
80 int ntdc = (*digi).countsTDC();
81 dttdc_mw.
set(
word, 0, 0, 0, tdcId, channelId, ntdc * 4);
85 int tdcIDCheck = tdcMeasurementWord.
tdcID();
86 int tdcChannelCheck = tdcMeasurementWord.
tdcChannel();
87 int tdcCountsCheck = tdcMeasurementWord.
tdcTime();
88 if (tdcIDCheck == tdcId && channelId == tdcChannelCheck && ntdc == tdcCountsCheck) {
89 if (rosId <= NROS && rosId > 0)
90 b_ros[rosId - 1] =
true;
92 cout <<
"[DTDigiToRaw]: invalid value for rosId" << endl;
95 w_ROBROS[rosId - 1][robId].push_back(
word);
100 uint32_t therosList = 0;
101 for (
int i_ros = 0; i_ros < NROS; i_ros++) {
103 therosList += uint32_t(
pow(2.0, i_ros));
107 cout <<
"[DTDigiToRaw]: therosList = " << therosList << endl;
109 for (
int i_ros = 0; i_ros < NROS; i_ros++) {
111 words.push_back(fakeROSHeaderWord);
115 for (
int i_rob = 0; i_rob < NROB; i_rob++) {
116 vector<uint32_t>::const_iterator i_robros;
117 if (w_ROBROS[i_ros][i_rob].begin() != w_ROBROS[i_ros][i_rob].
end()) {
120 rob_header.
set(
word, i_rob, 0, 0);
122 words.push_back(
word);
126 for (i_robros = w_ROBROS[i_ros][i_rob].begin(); i_robros != w_ROBROS[i_ros][i_rob].end(); i_robros++) {
128 words.push_back((*i_robros));
134 rob_trailer.
set(
word, i_rob, 0, n_robros + 2);
136 words.push_back(
word);
141 words.push_back(fakeROSTrailerWord);
146 if (NWords % 2 == 1) {
154 uint32_t secondstatusword = therosList << 16;
155 words.push_back(secondstatusword);
162 int dataSize = words.size() *
sizeof(
Word32);
165 for (
unsigned int i = 0;
i < words.size();
i += 2) {
166 *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!!
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)