45 std::unique_ptr<DTDigiCollection>& detectorProduct,
46 std::unique_ptr<DTLocalTriggerCollection>& triggerProduct,
52 dduID = hardcodedDDUID;
54 const int wordLength = 4;
55 int numberOfWords = datasize / wordLength;
59 controlDataFromAllROS.clear();
62 uint32_t
word = index[
swap(wordCounter)];
64 map<uint32_t, int> hitOrder;
74 while (wordCounter < numberOfWords) {
81 if (rosID <= 12 && !((rosList &
int(
pow(2., (rosID - 1)))) >> (rosID - 1)))
84 cout <<
"[DTROS25Unpacker]: ros list: " << rosList <<
" ROS ID " << rosID << endl;
91 int dum1, dum2, dum3, dum4;
93 if (writeSC && !mapping->readOutToGeometry(dduID, rosID, 1, 1, 1, SCwheel, dum1, SCsector, dum2, dum3, dum4)) {
95 cout <<
" found SCwheel: " << SCwheel <<
" and SCsector: " << SCsector << endl;
98 cout <<
" WARNING failed to find WHEEL and SECTOR for ROS " << rosID <<
" !" << endl;
115 word = index[
swap(wordCounter)];
122 cout <<
"[DTROS25Unpacker]: ROSError, Error type " << dtROSErrorWord.
errorType() <<
" robID "
123 << dtROSErrorWord.
robID() << endl;
131 cout <<
"[DTROS25Unpacker]: ROSDebug, type " << rosDebugWord.
debugType() <<
" message "
138 int eventID = robHeaderWord.
eventID();
139 int bunchID = robHeaderWord.
bunchID();
140 int robID = robHeaderWord.
robID();
146 cout <<
"[DTROS25Unpacker] ROB: ID " << robID <<
" Event ID " << eventID <<
" BXID " << bunchID << endl;
151 word = index[
swap(wordCounter)];
167 cout <<
"TDC Debugging" << endl;
173 DTTDCData tdcData(robID, tdcMeasurementWord);
176 int tdcID = tdcMeasurementWord.
tdcID();
177 int tdcChannel = tdcMeasurementWord.
tdcChannel();
180 cout <<
"[DTROS25Unpacker] TDC: ID " << tdcID <<
" Channel " << tdcChannel <<
" Time "
181 << tdcMeasurementWord.
tdcTime() << endl;
185 hitOrder[channelIndex.
getCode()]++;
188 cout <<
"[DTROS25Unpacker] ROAddress: DDU " << dduID <<
", ROS " << rosID <<
", ROB " << robID
189 <<
", TDC " << tdcID <<
", Channel " << tdcChannel << endl;
193 if (writeSC && (SCsector < 1 || SCwheel < -2)) {
195 cout <<
" second try to find SCwheel and SCsector " << endl;
196 if (!mapping->readOutToGeometry(
197 dduID, rosID, robID, tdcID, tdcChannel, SCwheel, dum1, SCsector, dum2, dum3, dum4)) {
199 cout <<
" ROS " << rosID <<
" SC wheel " << SCwheel <<
" SC sector " << SCsector << endl;
202 cout <<
" WARNING !! ROS " << rosID <<
" failed again to map for SC!! " << endl;
209 int wheelId, stationId, sectorId, slId, layerId, cellId;
210 if (!mapping->readOutToGeometry(
211 dduID, rosID, robID, tdcID, tdcChannel, wheelId, stationId, sectorId, slId, layerId, cellId)) {
213 if (sectorId == 0 || stationId == 0)
216 detId =
DTWireId(wheelId, stationId, sectorId, slId, layerId, cellId);
219 cout <<
"[DTROS25Unpacker] " << detId << endl;
220 int wire = detId.
wire();
226 detectorProduct->insertDigi(detId.
layerId(), digi);
229 <<
"Unable to map the RO channel: DDU " << dduID <<
" ROS " << rosID <<
" ROB " << robID <<
" TDC "
230 << tdcID <<
" TDC ch. " << tdcChannel;
232 cout <<
"[DTROS25Unpacker] ***ERROR*** Missing wire: DDU " << dduID <<
" ROS " << rosID <<
" ROB "
233 << robID <<
" TDC " << tdcID <<
" TDC ch. " << tdcChannel << endl;
246 cout <<
"[DTROS25Unpacker]: ROBTrailer, robID " << robTrailerWord.
robID() <<
" eventID "
247 << robTrailerWord.
eventID() <<
" wordCount " << robTrailerWord.
wordCount() << endl;
255 cout <<
"[DTROS25Unpacker]: SC header eventID " << scHeaderWord.
eventID() << endl;
259 word = index[
swap(wordCounter)];
269 int leftword = numofscword;
272 cout <<
" SC PrivateHeader (number of words + subheader = "
277 if (numofscword > 0) {
278 int bx_received = (numofscword - 1) / 2;
280 cout <<
" SC number of bx read-out: " << bx_received << endl;
283 word = index[
swap(wordCounter)];
292 cout <<
" SC trigger delay = " << scPrivateSubHeaderWord.
TriggerDelay() << endl
293 <<
" SC bunch counter = " << scEventBX << endl;
298 int stationGroup = 0;
301 word = index[
swap(wordCounter)];
308 int bx_counter = int(round((leftword + 1) / 2.));
311 if (bx_counter < 0 || leftword < 0)
312 cout <<
"[DTROS25Unpacker]: SC data more than expected; negative bx counter reached! " << endl;
325 cout <<
" at BX " << bx_counter
326 <<
" lower part has trigger! with track quality " << scDataWord.
trackQuality(0) << endl;
328 cout <<
" at BX " << bx_counter
329 <<
" upper part has trigger! with track quality " << scDataWord.
trackQuality(1) << endl;
332 if (writeSC && SCwheel >= -2 && SCsector >= 1) {
336 if (stationGroup % 2 == 0)
344 DTChamberId chamberId(SCwheel, SCstation, SCsector);
345 triggerProduct->insertDigi(chamberId, localtrigger);
347 cout <<
"Add SC digi to the collection, for chamber: " << chamberId << endl;
348 localtrigger.
print();
352 if (stationGroup % 2 == 0)
360 DTChamberId chamberId(SCwheel, SCstation, SCsector);
361 triggerProduct->insertDigi(chamberId, localtrigger);
363 cout <<
"Add SC digi to the collection, for chamber: " << chamberId << endl;
364 localtrigger.
print();
384 cout <<
" SC Trailer, # of words: " << scTrailerWord.
wordCount() << endl;
403 controlDataFromAllROS.push_back(controlData);
408 else if (index[
swap(wordCounter)] == 0) {
413 cout <<
"[DTROS25Unpacker]: odd number of ROS words" << endl;
418 cout <<
"[DTROS25Unpacker]: ERROR! First word is not a ROS Header" << endl;
423 word = index[
swap(wordCounter)];
int trackQuality(int first) const
int EventWordCount() const
T getUntrackedParameter(std::string const &, T const &) const
void interpretRawData(const unsigned int *index, int datasize, int dduID, edm::ESHandle< DTReadOutMapping > &mapping, std::unique_ptr< DTDigiCollection > &product, std::unique_ptr< DTLocalTriggerCollection > &product2, uint16_t rosList=0) override
void addSCData(const DTSectorCollectorData &scData)
int hasTrigger(int first) const
std::pair< int, DTROBHeaderWord > DTROBHeader
void addROBHeader(const DTROBHeader &robHeader)
int getBits(int first) const
void addSCPrivHeader(const DTLocalTriggerSectorCollectorHeaderWord &scPrivHeader)
void addSCTrailer(const DTLocalTriggerTrailerWord &scTrailer)
~DTROS25Unpacker() override
Destructor.
DTROS25Unpacker(const edm::ParameterSet &ps)
Constructor.
std::pair< int, DTTDCErrorWord > DTTDCError
uint32_t getCode() const
Getters ///////////////////////.
void print()
Print out the error information >>> FIXME: to be implemented.
void addTDCError(const DTTDCError &tdcError)
void addSCPrivSubHeader(const DTLocalTriggerSectorCollectorSubHeaderWord &scPrivSubHeader)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
tuple performDataIntegrityMonitor
std::pair< DTLocalTriggerDataWord, int > DTSectorCollectorData
void setROSId(const int &ID)
Setters ///////////////////////.
int tdcID() const
<== OBSOLETE!!
int wire() const
Return the wire number.
enum wordTypes type()
DDU word type getter.
void print() const
Print content of trigger.
void addROBTrailer(const DTROBTrailerWord &word)
void addROSHeader(const DTROSHeaderWord &word)
void addROSError(const DTROSErrorWord &word)
DTLayerId layerId() const
Return the corresponding LayerId.
void addROSTrailer(const DTROSTrailerWord &word)
std::pair< int, DTTDCMeasurementWord > DTTDCData
void addSCHeader(const DTLocalTriggerHeaderWord &scHeader)
Log< level::Warning, false > LogWarning
void addROSDebug(const DTROSDebugWord &word)
Power< A, B >::type pow(const A &a, const B &b)
void addTDCData(const DTTDCData &tdcData)