Skip to content

Commit

Permalink
Add SC data integrity and cleanup SC debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
Gianluca Cerminara committed Apr 6, 2009
1 parent 7f54a8a commit 85d355f
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions EventFilter/DTRawToDigi/plugins/DTROS25Unpacker.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** \file
*
* $Date: 2008/12/19 13:39:45 $
* $Revision: 1.10 $
* $Date: 2009/04/03 13:53:46 $
* $Revision: 1.11 $
* \author M. Zanetti - INFN Padova
* \revision FRC 060906
*/
Expand Down Expand Up @@ -261,26 +261,30 @@ void DTROS25Unpacker::interpretRawData(const unsigned int* index, int datasize,
// Check the eventual Sector Collector Header
else if (DTROSWordType(word).type() == DTROSWordType::SCHeader) {
DTLocalTriggerHeaderWord scHeaderWord(word);
if (debug) cout<<"[DTROS25Unpacker]: SCHeader eventID "<<scHeaderWord.eventID()<<endl;
if (debug) cout<<"[DTROS25Unpacker]: SC header eventID " << scHeaderWord.eventID()<<endl;

// RT added : first word following SCHeader is a SC private header
wordCounter++; word = index[swap(wordCounter)];

if(DTROSWordType(word).type() == DTROSWordType::SCData){
if(DTROSWordType(word).type() == DTROSWordType::SCData) {
DTLocalTriggerSectorCollectorHeaderWord scPrivateHeaderWord(word);

if(performDataIntegrityMonitor) {
controlData.addSCPrivHeader(scPrivateHeaderWord);
}

int numofscword = scPrivateHeaderWord.NumberOf16bitWords();
int leftword = numofscword;

if(debug) cout<<"[DTROS25Unpacker]: SCPrivateHeader (number of data + subheader = "
if(debug) cout<<" SC PrivateHeader (number of words + subheader = "
<< scPrivateHeaderWord.NumberOf16bitWords() << ")" <<endl;

// if no SC data -> no loop ;
// otherwise subtract 1 word (subheader) and countdown for bx assignment
if(numofscword > 0){

int bx_received = (numofscword - 1) / 2;
if(debug) cout<<"[DTROS25Unpacker]: number of bx " << bx_received << endl;
if(debug) cout<<" SC number of bx read-out: " << bx_received << endl;

wordCounter++; word = index[swap(wordCounter)];
if (DTROSWordType(word).type() == DTROSWordType::SCData) {
Expand All @@ -290,12 +294,12 @@ void DTROS25Unpacker::interpretRawData(const unsigned int* index, int datasize,
DTLocalTriggerSectorCollectorSubHeaderWord scPrivateSubHeaderWord(word);
// read the event BX in the SC header (will be stored in SC digis)
int scEventBX = scPrivateSubHeaderWord.LocalBunchCounter();
if(debug) cout <<"[DTROS25Unpacker]: SC trigger delay = "
if(debug) cout <<" SC trigger delay = "
<< scPrivateSubHeaderWord.TriggerDelay() << endl
<<"[DTROS25Unpacker]: SC bunch counter = "
<<" SC bunch counter = "
<< scEventBX << endl;


controlData.addSCPrivSubHeader(scPrivateSubHeaderWord);

// actual loop on SC time slots
int stationGroup=0;
Expand Down Expand Up @@ -347,9 +351,8 @@ void DTROS25Unpacker::interpretRawData(const unsigned int* index, int datasize,
DTChamberId chamberId (SCwheel,SCstation,SCsector);
triggerProduct->insertDigi(chamberId,localtrigger);
if (debug) {
cout<<"FRC: just put in triggerProduct: "<<chamberId.wheel()
<<" "<<chamberId.station()<<" "<<chamberId.sector()
<<endl;;
cout<<"Add SC digi to the collection, for chamber: " << chamberId
<<endl;
localtrigger.print(); }
}
if ( scDataWord.hasTrigger(1) || (scDataWord.getBits(1) & 0x30) ) {
Expand All @@ -362,10 +365,8 @@ void DTROS25Unpacker::interpretRawData(const unsigned int* index, int datasize,
DTChamberId chamberId (SCwheel,SCstation,SCsector);
triggerProduct->insertDigi(chamberId,localtrigger);
if(debug) {
cout <<"FRC: just put in triggerProduct: "
<<chamberId.wheel()<<" "<<chamberId.station()
<<" "<<chamberId.sector()
<<endl;;
cout<<"Add SC digi to the collection, for chamber: " << chamberId
<<endl;
localtrigger.print();
}
}
Expand All @@ -381,8 +382,12 @@ void DTROS25Unpacker::interpretRawData(const unsigned int* index, int datasize,

if (DTROSWordType(word).type() == DTROSWordType::SCTrailer) {
DTLocalTriggerTrailerWord scTrailerWord(word);
if (debug) cout<<"[DTROS25Unpacker]: SCTrailer, number of words "
<<scTrailerWord.wordCount()<<endl;
// add infos for data integrity monitoring
controlData.addSCHeader(scHeaderWord);
controlData.addSCTrailer(scTrailerWord);

if (debug) cout<<" SC Trailer, # of words: "
<< scTrailerWord.wordCount() <<endl;
}
}

Expand Down

0 comments on commit 85d355f

Please sign in to comment.