00001 #include "EventFilter/CSCRawToDigi/interface/CSCDCCUnpacker.h"
00002
00003
00004 #include "DataFormats/Common/interface/Handle.h"
00005 #include "FWCore/Framework/interface/Event.h"
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007 #include "FWCore/Framework/interface/ESHandle.h"
00008 #include "FWCore/Framework/interface/EventSetup.h"
00009
00010 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
00011 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00012 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00013
00014
00015 #include "DataFormats/CSCDigi/interface/CSCStripDigi.h"
00016 #include "DataFormats/CSCDigi/interface/CSCCFEBStatusDigi.h"
00017 #include "DataFormats/CSCDigi/interface/CSCWireDigi.h"
00018 #include "DataFormats/CSCDigi/interface/CSCComparatorDigi.h"
00019 #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h"
00020 #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h"
00021 #include "DataFormats/CSCDigi/interface/CSCRPCDigi.h"
00022 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h"
00023
00024 #include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h"
00025 #include "DataFormats/CSCDigi/interface/CSCCFEBStatusDigiCollection.h"
00026 #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h"
00027 #include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h"
00028 #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h"
00029 #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h"
00030 #include "DataFormats/CSCDigi/interface/CSCRPCDigiCollection.h"
00031 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
00032 #include "DataFormats/CSCDigi/interface/CSCDMBStatusDigi.h"
00033 #include "DataFormats/CSCDigi/interface/CSCDMBStatusDigiCollection.h"
00034 #include "DataFormats/CSCDigi/interface/CSCTMBStatusDigi.h"
00035 #include "DataFormats/CSCDigi/interface/CSCTMBStatusDigiCollection.h"
00036 #include "DataFormats/CSCDigi/interface/CSCDDUStatusDigi.h"
00037 #include "DataFormats/CSCDigi/interface/CSCDDUStatusDigiCollection.h"
00038 #include "DataFormats/CSCDigi/interface/CSCDCCStatusDigi.h"
00039 #include "DataFormats/CSCDigi/interface/CSCDCCStatusDigiCollection.h"
00040 #include "DataFormats/CSCDigi/interface/CSCALCTStatusDigi.h"
00041 #include "DataFormats/CSCDigi/interface/CSCALCTStatusDigiCollection.h"
00042 #include "DataFormats/CSCDigi/interface/CSCALCTStatusDigiCollection.h"
00043 #include "DataFormats/CSCDigi/interface/CSCDCCFormatStatusDigi.h"
00044 #include "DataFormats/CSCDigi/interface/CSCDCCFormatStatusDigiCollection.h"
00045
00046 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00047
00048 #include "EventFilter/CSCRawToDigi/interface/CSCDCCEventData.h"
00049 #include "EventFilter/CSCRawToDigi/interface/CSCEventData.h"
00050 #include "EventFilter/CSCRawToDigi/interface/CSCCFEBData.h"
00051 #include "EventFilter/CSCRawToDigi/interface/CSCALCTHeader.h"
00052 #include "EventFilter/CSCRawToDigi/interface/CSCAnodeData.h"
00053 #include "EventFilter/CSCRawToDigi/interface/CSCCLCTData.h"
00054 #include "EventFilter/CSCRawToDigi/interface/CSCDDUEventData.h"
00055 #include "EventFilter/CSCRawToDigi/interface/CSCTMBData.h"
00056 #include "EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h"
00057 #include "EventFilter/CSCRawToDigi/interface/CSCRPCData.h"
00058 #include "EventFilter/CSCRawToDigi/interface/CSCDCCExaminer.h"
00059 #include "CondFormats/CSCObjects/interface/CSCCrateMap.h"
00060 #include "CondFormats/DataRecord/interface/CSCCrateMapRcd.h"
00061 #include <EventFilter/CSCRawToDigi/interface/CSCMonitorInterface.h>
00062 #include "FWCore/ServiceRegistry/interface/Service.h"
00063
00064 #include <iostream>
00065 #include <sstream>
00066 #include <string>
00067 #include <iomanip>
00068 #include <cstdio>
00069
00070 CSCDCCUnpacker::CSCDCCUnpacker(const edm::ParameterSet & pset) :
00071 numOfEvents(0) {
00072
00073
00074
00075 inputObjectsTag = pset.getParameter<edm::InputTag>("InputObjects");
00076 useExaminer = pset.getParameter<bool>("UseExaminer");
00077 examinerMask = pset.getParameter<unsigned int>("ExaminerMask");
00079 useSelectiveUnpacking = pset.getParameter<bool>("UseSelectiveUnpacking");
00080 errorMask = pset.getParameter<unsigned int>("ErrorMask");
00081 unpackStatusDigis = pset.getParameter<bool>("UnpackStatusDigis");
00083 useFormatStatus = pset.getParameter<bool>("UseFormatStatus");
00084
00085
00086
00087 printEventNumber = pset.getUntrackedParameter<bool>("PrintEventNumber", true);
00088 debug = pset.getUntrackedParameter<bool>("Debug", false);
00089 instantiateDQM = pset.getUntrackedParameter<bool>("runDQM", false);
00090
00092 visualFEDInspect = pset.getUntrackedParameter<bool>("VisualFEDInspect", false);
00093 visualFEDShort = pset.getUntrackedParameter<bool>("VisualFEDShort", false);
00094 formatedEventDump = pset.getUntrackedParameter<bool>("FormatedEventDump", false);
00095
00097 SuppressZeroLCT = pset.getUntrackedParameter<bool>("SuppressZeroLCT", true);
00098
00099
00100
00101 if(instantiateDQM) {
00102 monitor = edm::Service<CSCMonitorInterface>().operator->();
00103 }
00104
00105 produces<CSCWireDigiCollection>("MuonCSCWireDigi");
00106 produces<CSCStripDigiCollection>("MuonCSCStripDigi");
00107 produces<CSCComparatorDigiCollection>("MuonCSCComparatorDigi");
00108 produces<CSCALCTDigiCollection>("MuonCSCALCTDigi");
00109 produces<CSCCLCTDigiCollection>("MuonCSCCLCTDigi");
00110 produces<CSCRPCDigiCollection>("MuonCSCRPCDigi");
00111 produces<CSCCorrelatedLCTDigiCollection>("MuonCSCCorrelatedLCTDigi");
00112
00113 if (unpackStatusDigis) {
00114 produces<CSCCFEBStatusDigiCollection>("MuonCSCCFEBStatusDigi");
00115 produces<CSCTMBStatusDigiCollection>("MuonCSCTMBStatusDigi");
00116 produces<CSCDMBStatusDigiCollection>("MuonCSCDMBStatusDigi");
00117 produces<CSCALCTStatusDigiCollection>("MuonCSCALCTStatusDigi");
00118 produces<CSCDDUStatusDigiCollection>("MuonCSCDDUStatusDigi");
00119 produces<CSCDCCStatusDigiCollection>("MuonCSCDCCStatusDigi");
00120 }
00121
00122 if (useFormatStatus) {
00123 produces<CSCDCCFormatStatusDigiCollection>("MuonCSCDCCFormatStatusDigi");
00124 }
00125
00126 CSCALCTHeader::setDebug(debug);
00127 CSCCLCTData::setDebug(debug);
00128 CSCEventData::setDebug(debug);
00129 CSCTMBData::setDebug(debug);
00130 CSCDCCEventData::setDebug(debug);
00131 CSCDDUEventData::setDebug(debug);
00132 CSCTMBHeader::setDebug(debug);
00133 CSCRPCData::setDebug(debug);
00134 CSCDDUEventData::setErrorMask(errorMask);
00135
00136 }
00137
00138 CSCDCCUnpacker::~CSCDCCUnpacker(){
00139
00140 }
00141
00142
00143 void CSCDCCUnpacker::produce(edm::Event & e, const edm::EventSetup& c){
00144
00146
00147
00148
00149 edm::ESHandle<CSCCrateMap> hcrate;
00150 c.get<CSCCrateMapRcd>().get(hcrate);
00151 const CSCCrateMap* pcrate = hcrate.product();
00152
00153
00154 if (printEventNumber) ++numOfEvents;
00155
00157 edm::Handle<FEDRawDataCollection> rawdata;
00158 e.getByLabel(inputObjectsTag, rawdata);
00159
00161 std::auto_ptr<CSCWireDigiCollection> wireProduct(new CSCWireDigiCollection);
00162 std::auto_ptr<CSCStripDigiCollection> stripProduct(new CSCStripDigiCollection);
00163 std::auto_ptr<CSCALCTDigiCollection> alctProduct(new CSCALCTDigiCollection);
00164 std::auto_ptr<CSCCLCTDigiCollection> clctProduct(new CSCCLCTDigiCollection);
00165 std::auto_ptr<CSCComparatorDigiCollection> comparatorProduct(new CSCComparatorDigiCollection);
00166 std::auto_ptr<CSCRPCDigiCollection> rpcProduct(new CSCRPCDigiCollection);
00167 std::auto_ptr<CSCCorrelatedLCTDigiCollection> corrlctProduct(new CSCCorrelatedLCTDigiCollection);
00168 std::auto_ptr<CSCCFEBStatusDigiCollection> cfebStatusProduct(new CSCCFEBStatusDigiCollection);
00169 std::auto_ptr<CSCDMBStatusDigiCollection> dmbStatusProduct(new CSCDMBStatusDigiCollection);
00170 std::auto_ptr<CSCTMBStatusDigiCollection> tmbStatusProduct(new CSCTMBStatusDigiCollection);
00171 std::auto_ptr<CSCDDUStatusDigiCollection> dduStatusProduct(new CSCDDUStatusDigiCollection);
00172 std::auto_ptr<CSCDCCStatusDigiCollection> dccStatusProduct(new CSCDCCStatusDigiCollection);
00173 std::auto_ptr<CSCALCTStatusDigiCollection> alctStatusProduct(new CSCALCTStatusDigiCollection);
00174
00175 std::auto_ptr<CSCDCCFormatStatusDigiCollection> formatStatusProduct(new CSCDCCFormatStatusDigiCollection);
00176
00177
00178
00179
00180
00181 unsigned long dccBinCheckMask = 0x06080016;
00182
00183 for (int id=FEDNumbering::MINCSCFEDID;
00184 id<=FEDNumbering::MAXCSCFEDID; ++id) {
00187
00189 const FEDRawData& fedData = rawdata->FEDData(id);
00190 unsigned long length = fedData.size();
00191
00192
00193 if (length>=32){
00194 CSCDCCExaminer* examiner = NULL;
00195 std::stringstream examiner_out, examiner_err;
00196 goodEvent = true;
00197 if (useExaminer) {
00198
00199 examiner = new CSCDCCExaminer();
00200 examiner->output1().redirect(examiner_out);
00201 examiner->output2().redirect(examiner_err);
00202 if( examinerMask&0x40000 ) examiner->crcCFEB(1);
00203 if( examinerMask&0x8000 ) examiner->crcTMB (1);
00204 if( examinerMask&0x0400 ) examiner->crcALCT(1);
00205 examiner->output1().show();
00206 examiner->output2().show();
00207 examiner->setMask(examinerMask);
00208 const short unsigned int *data = (short unsigned int *)fedData.data();
00209
00210 LogTrace("badData") << "Length: "<< length/2;
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221 int res = examiner->check(data,long(fedData.size()/2));
00222 if( res < 0 ) {
00223 goodEvent=false;
00224 }
00225 else {
00226 if (useSelectiveUnpacking) goodEvent=!(examiner->errors()&dccBinCheckMask);
00227 else goodEvent=!(examiner->errors()&examinerMask);
00228 }
00229
00230
00231
00232
00233
00234
00235
00236
00237 if (useFormatStatus && (examiner->errors() !=0))
00238
00239 formatStatusProduct->insertDigi(CSCDetId(1,1,1,1,1),
00240 CSCDCCFormatStatusDigi(id,dccBinCheckMask,
00241 examiner->getMask(),
00242 examiner->errors(),
00243 examiner->errorsDetailedDDU(),
00244 examiner->errorsDetailed(),
00245 examiner->payloadDetailed(),
00246 examiner->statusDetailed()));
00247 }
00248
00250 if(visualFEDInspect || formatedEventDump){
00251 if (!goodEvent || formatedEventDump){
00252 short unsigned * buf = (short unsigned int *)fedData.data();
00253 visual_raw(length/2, id,(int)e.id().run(),(int)e.id().event(),
00254 visualFEDShort, formatedEventDump, buf);
00255 }
00256 }
00257
00258 if (goodEvent) {
00260
00261
00262 CSCDCCExaminer * ptrExaminer = examiner;
00263 if (!useSelectiveUnpacking) ptrExaminer = NULL;
00264
00265 CSCDCCEventData dccData((short unsigned int *) fedData.data(), ptrExaminer);
00266
00267
00268
00269 if(instantiateDQM) monitor->process(examiner, &dccData);
00270
00272 const std::vector<CSCDDUEventData> & dduData = dccData.dduData();
00273
00275 CSCDetId layer(1, 1, 1, 1, 1);
00276
00277 if (unpackStatusDigis) {
00278
00280 short unsigned * bufForDcc = (short unsigned int *)fedData.data();
00281
00282
00283
00284
00285 dccStatusProduct->insertDigi(layer, CSCDCCStatusDigi(dccData.dccHeader().data(),
00286 dccData.dccTrailer().data(),
00287 examiner->errors(),
00288 bufForDcc[length/2-4]));
00289
00290 }
00291
00292 for (unsigned int iDDU=0; iDDU<dduData.size(); ++iDDU) {
00295 if (dduData[iDDU].trailer().errorstat()&errorMask) {
00296 LogTrace("CSCDCCUnpacker|CSCRawToDigi") << "DDU# " << iDDU << " has serious error - no digis unpacked! " <<
00297 std::hex << dduData[iDDU].trailer().errorstat();
00298 continue;
00299 }
00300
00301 if (unpackStatusDigis) dduStatusProduct->
00302 insertDigi(layer, CSCDDUStatusDigi(dduData[iDDU].header().data(),
00303 dduData[iDDU].trailer().data(),
00305 dduData[iDDU].trailer0()));
00306
00308 const std::vector<CSCEventData> & cscData = dduData[iDDU].cscData();
00309
00310
00311 for (unsigned int iCSC=0; iCSC<cscData.size(); ++iCSC) {
00312
00314 int vmecrate = cscData[iCSC].dmbHeader()->crateID();
00315 int dmb = cscData[iCSC].dmbHeader()->dmbID();
00316
00317 int icfeb = 0;
00318 int ilayer = 0;
00319
00320 if (debug)
00321 LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << "crate = " << vmecrate << "; dmb = " << dmb;
00322
00323 if ((vmecrate>=1)&&(vmecrate<=60) && (dmb>=1)&&(dmb<=10)&&(dmb!=6)) {
00324 layer = pcrate->detId(vmecrate, dmb,icfeb,ilayer );
00325 }
00326 else{
00327 LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << " detID input out of range!!! ";
00328 LogTrace ("CSCDCCUnpacker|CSCRawToDigi")
00329 << " skipping chamber vme= " << vmecrate << " dmb= " << dmb;
00330 continue;
00331 }
00332
00333
00335 int nalct = cscData[iCSC].dmbHeader()->nalct();
00336 bool goodALCT=false;
00337
00338 if (nalct&&cscData[iCSC].alctHeader()) {
00339 if (cscData[iCSC].alctHeader()->check()){
00340 goodALCT=true;
00341 }
00342 else {
00343 LogTrace ("CSCDCCUnpacker|CSCRawToDigi") <<
00344 "not storing ALCT digis; alct is bad or not present";
00345 }
00346 } else {
00347 if (debug) LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << "nALCT==0 !!!";
00348 }
00349
00351 if (goodALCT){
00352 std::vector <CSCALCTDigi> alctDigis =
00353 cscData[iCSC].alctHeader()->ALCTDigis();
00354 if(SuppressZeroLCT){
00355 std::vector<CSCALCTDigi> alctDigis_0;
00356 for (int unsigned i=0; i<alctDigis.size(); ++i){
00357 if(alctDigis[i].isValid())
00358 alctDigis_0.push_back(alctDigis[i]);
00359 }
00360 alctProduct->put(std::make_pair(alctDigis_0.begin(), alctDigis_0.end()),layer);
00361 }
00362 else
00363 alctProduct->put(std::make_pair(alctDigis.begin(), alctDigis.end()),layer);
00364 }
00365
00366
00368 int nclct = cscData[iCSC].dmbHeader()->nclct();
00369 bool goodTMB=false;
00370
00371 if (nclct&&cscData[iCSC].tmbData()) {
00372 if (cscData[iCSC].tmbHeader()->check()){
00373 if (cscData[iCSC].clctData()->check()) goodTMB=true;
00374 }
00375 else {
00376 LogTrace ("CSCDCCUnpacker|CSCRawToDigi") <<
00377 "one of TMB checks failed! not storing TMB digis ";
00378 }
00379 }
00380 else {
00381 if (debug) LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << "nCLCT==0 !!!";
00382 }
00383
00385 if (goodTMB) {
00386 std::vector <CSCCorrelatedLCTDigi> correlatedlctDigis =
00387 cscData[iCSC].tmbHeader()->CorrelatedLCTDigis(layer.rawId());
00388 if(SuppressZeroLCT){
00389 std::vector<CSCCorrelatedLCTDigi> correlatedlctDigis_0;
00390 for (int unsigned i=0; i<correlatedlctDigis.size(); ++i){
00391 if(correlatedlctDigis[i].isValid())
00392 correlatedlctDigis_0.push_back(correlatedlctDigis[i]);
00393 }
00394 corrlctProduct->put(std::make_pair(correlatedlctDigis_0.begin(),
00395 correlatedlctDigis_0.end()),layer);
00396 }
00397 else
00398 corrlctProduct->put(std::make_pair(correlatedlctDigis.begin(),
00399 correlatedlctDigis.end()),layer);
00400
00401 std::vector <CSCCLCTDigi> clctDigis =
00402 cscData[iCSC].tmbHeader()->CLCTDigis(layer.rawId());
00403 if(SuppressZeroLCT){
00404 std::vector<CSCCLCTDigi> clctDigis_0;
00405 for (int unsigned i=0; i<clctDigis.size(); ++i){
00406 if(clctDigis[i].isValid())
00407 clctDigis_0.push_back(clctDigis[i]);
00408 }
00409 clctProduct->put(std::make_pair(clctDigis_0.begin(), clctDigis_0.end()),layer);
00410 }
00411 else
00412 clctProduct->put(std::make_pair(clctDigis.begin(), clctDigis.end()),layer);
00413
00415 if (cscData[iCSC].tmbData()->checkSize()) {
00416 if (cscData[iCSC].tmbData()->hasRPC()) {
00417 std::vector <CSCRPCDigi> rpcDigis =
00418 cscData[iCSC].tmbData()->rpcData()->digis();
00419 rpcProduct->put(std::make_pair(rpcDigis.begin(), rpcDigis.end()),layer);
00420 }
00421 }
00422 else LogTrace("CSCDCCUnpacker|CSCRawToDigi") <<" TMBData check size failed!";
00423 }
00424
00425
00427 if (unpackStatusDigis) {
00428 for ( icfeb = 0; icfeb < 5; ++icfeb ) {
00429 if ( cscData[iCSC].cfebData(icfeb) != NULL )
00430 cfebStatusProduct->
00431 insertDigi(layer, cscData[iCSC].cfebData(icfeb)->statusDigi());
00432 }
00434 dmbStatusProduct->insertDigi(layer, CSCDMBStatusDigi(cscData[iCSC].dmbHeader()->data(),
00435 cscData[iCSC].dmbTrailer()->data()));
00436 if (goodTMB) tmbStatusProduct->
00437 insertDigi(layer, CSCTMBStatusDigi(cscData[iCSC].tmbHeader()->data(),
00438 cscData[iCSC].tmbData()->tmbTrailer()->data()));
00439 if (goodALCT) alctStatusProduct->
00440 insertDigi(layer, CSCALCTStatusDigi(cscData[iCSC].alctHeader()->data(),
00441 cscData[iCSC].alctTrailer()->data()));
00442 }
00443
00444
00446 for (int ilayer = 1; ilayer <= 6; ++ilayer) {
00448
00449
00450
00451 layer = pcrate->detId( vmecrate, dmb, 0, ilayer );
00452
00453 std::vector <CSCWireDigi> wireDigis = cscData[iCSC].wireDigis(ilayer);
00454
00455 wireProduct->put(std::make_pair(wireDigis.begin(), wireDigis.end()),layer);
00456
00457 for ( icfeb = 0; icfeb < 5; ++icfeb ) {
00458 layer = pcrate->detId( vmecrate, dmb, icfeb,ilayer );
00459 if (cscData[iCSC].cfebData(icfeb)) {
00460 std::vector<CSCStripDigi> stripDigis;
00461 cscData[iCSC].cfebData(icfeb)->digis(layer.rawId(),stripDigis);
00462 stripProduct->put(std::make_pair(stripDigis.begin(),
00463 stripDigis.end()),layer);
00464 }
00465
00466 if (goodTMB){
00467 std::vector <CSCComparatorDigi> comparatorDigis =
00468 cscData[iCSC].clctData()->comparatorDigis(layer.rawId(), icfeb);
00469
00470
00471 layer = pcrate->detId( vmecrate, dmb, 0, ilayer );
00472 comparatorProduct->put(std::make_pair(comparatorDigis.begin(),
00473 comparatorDigis.end()),layer);
00474 }
00475 }
00476 }
00477 }
00478 }
00479 }
00480 else {
00481 LogTrace("CSCDCCUnpacker|CSCRawToDigi") <<
00482 "ERROR! Examiner rejected FED #" << id;
00483 if (examiner) {
00484 for (int i=0; i<examiner->nERRORS; ++i) {
00485 if (((examinerMask&examiner->errors())>>i)&0x1)
00486 LogTrace("CSCDCCUnpacker|CSCRawToDigi")<<examiner->errName(i);
00487 }
00488 if (debug) {
00489 LogTrace("CSCDCCUnpacker|CSCRawToDigi")
00490 << " Examiner errors:0x" << std::hex << examiner->errors()
00491 << " & 0x" << examinerMask
00492 << " = " << (examiner->errors()&examinerMask);
00493 if (examinerMask&examiner->errors()) {
00494 LogTrace("CSCDCCUnpacker|CSCRawToDigi")
00495 << "Examiner output: " << examiner_out.str();
00496 LogTrace("CSCDCCUnpacker|CSCRawToDigi")
00497 << "Examiner errors: " << examiner_err.str();
00498 }
00499 }
00500 }
00501
00502
00503
00504 }
00505 if (examiner!=NULL) delete examiner;
00506 }
00507 }
00508
00509 e.put(wireProduct, "MuonCSCWireDigi");
00510 e.put(stripProduct, "MuonCSCStripDigi");
00511 e.put(alctProduct, "MuonCSCALCTDigi");
00512 e.put(clctProduct, "MuonCSCCLCTDigi");
00513 e.put(comparatorProduct, "MuonCSCComparatorDigi");
00514 e.put(rpcProduct, "MuonCSCRPCDigi");
00515 e.put(corrlctProduct, "MuonCSCCorrelatedLCTDigi");
00516
00517 if (useFormatStatus) e.put(formatStatusProduct, "MuonCSCDCCFormatStatusDigi");
00518
00519 if (unpackStatusDigis)
00520 {
00521 e.put(cfebStatusProduct, "MuonCSCCFEBStatusDigi");
00522 e.put(dmbStatusProduct, "MuonCSCDMBStatusDigi");
00523 e.put(tmbStatusProduct, "MuonCSCTMBStatusDigi");
00524 e.put(dduStatusProduct, "MuonCSCDDUStatusDigi");
00525 e.put(dccStatusProduct, "MuonCSCDCCStatusDigi");
00526 e.put(alctStatusProduct, "MuonCSCALCTStatusDigi");
00527 }
00528 if (printEventNumber) LogTrace("CSCDCCUnpacker|CSCRawToDigi")
00529 <<"[CSCDCCUnpacker]: " << numOfEvents << " events processed ";
00530 }
00531
00532
00534
00535 void CSCDCCUnpacker::visual_raw(int hl,int id, int run, int event,bool fedshort,
00536 bool fDump, short unsigned int *buf) const {
00537
00538 std::cout << std::endl << std::endl << std::endl;
00539 std::cout << "Run: "<< run << " Event: " << event << std::endl;
00540 std::cout << std::endl << std::endl;
00541 if(formatedEventDump)
00542 std::cout << "FED-" << id << " " << "(scroll down to see summary)" << std::endl;
00543 else
00544 std::cout << "Problem seems in FED-" << id << " " << "(scroll down to see summary)" << std::endl;
00545 std::cout <<"********************************************************************************" << std::endl;
00546 std::cout << hl <<" words of data:" << std::endl;
00547
00548
00549
00550 std::vector<int> dcc_id;
00551 int dcc_h1_id=0;
00552
00553 for (int i=750;i<758;i++)
00554 dcc_id.push_back(i);
00555
00556 for (int i=830;i<838;i++)
00557 dcc_id.push_back(i);
00558
00559 char dcc_common[]="DCC-";
00560
00561
00562
00563 std::vector<int> ddu_id;
00564 int ddu_h1_12_13=0;
00565 for (int i=1;i<37;i++)
00566 ddu_id.push_back(i);
00567
00568 char ddu_common[]="DDU-";
00569 char ddu_header1[]="Header 1";
00570 char ddu_header2[]="Header 2";
00571 char ddu_header3[]="Header 3";
00572 char ddu_trail1[]="Trailer 1", ddu_trail2[]="Trailer 2", ddu_trail3[]="Trailer 3";
00573
00574 char ddu_trailer1_bit[]={'8','0','0','0','f','f','f','f','8','0','0','0','8','0','0','0'};
00575 char ddu_trailer3_bit[]={'a'};
00576
00577 char ddu_tr1_err_common[]="Incomplet";
00578
00579
00580
00581 char dmb_common[]="DMB", dmb_header1[]="Header 1", dmb_header2[]="Header 2";
00582 char dmb_common_crate[]="crate:", dmb_common_slot[]="slot:";
00583 char dmb_common_l1a[]="L1A:";
00584 char dmb_header1_bit[]={'9','9','9','9'};
00585 char dmb_header2_bit[]={'a','a','a','a'};
00586 char dmb_tr1[]="Trailer 1", dmb_tr2[]="Trailer 2";
00587 char dmb_tr1_bit[]={'f','f','f','f'}, dmb_tr2_bit[]={'e','e','e','e'};
00588
00589
00590
00591
00592
00593 char alct_common[]="ALCT", alct_header1[]="Header 1", alct_header2[]="Header 2";
00594 char alct_common_bxn[]="BXN:";
00595 char alct_common_wcnt2[]="| Actual word count:";
00596 char alct_common_wcnt1[]="Expected word count:";
00597 char alct_header1_bit[]={'d','d','d','d','b','0','a'};
00598 char alct_header2_bit[]={'0','0','0','0'};
00599 char alct_tr1[]="Trailer 1";
00600
00601
00602
00603
00604 char tmb_common[]="TMB", tmb_header1[]="Header", tmb_tr1[]="Trailer";
00605 char tmb_header1_bit[]={'d','d','d','d','b','0','c'};
00606 char tmb_tr1_bit[]={'d','d','d','d','e','0','f'};
00607
00608
00609
00610
00611 char cfeb_common[]="CFEB", cfeb_tr1[]="Trailer", cfeb_b[]="B-word";
00612 char cfeb_common_sample[]="sample:";
00613
00614
00615
00616
00617
00618
00619 int word_lines=hl/4;
00620 char tempbuf[80];
00621 char tempbuf1[80];
00622 char tempbuf_short[17];
00623 char sign1[]=" --->| ";
00624
00625
00626 int word_numbering=0;
00627 int ddu_inst_i=0, ddu_inst_n=0, ddu_inst_l1a=0;
00628 int ddu_inst_bxn=0;
00629 int dmb_inst_crate=0, dmb_inst_slot=0, dmb_inst_l1a=0;
00630 int cfeb_sample=0;
00631 int alct_inst_l1a=0;
00632 int alct_inst_bxn=0;
00633 int alct_inst_wcnt1=0;
00634 int alct_inst_wcnt2=0;
00635 int alct_start=0;
00636 int alct_stop=0;
00637 int tmb_inst_l1a=0;
00638 int tmb_inst_wcnt1=0;
00639 int tmb_inst_wcnt2=0;
00640 int tmb_start=0;
00641 int tmb_stop=0;
00642 int dcc_h1_check=0;
00643
00644
00645 int ddu_h2_found=0;
00646 int w=0;
00647
00648
00649 const int sz1=5;
00650 bool dcc_check=false;
00651 bool ddu_h2_check[sz1]={false};
00652 bool ddu_h1_check=false;
00653 bool dmb_h1_check[sz1]={false};
00654 bool dmb_h2_check[sz1]={false};
00655 bool ddu_h2_h1=false;
00656 bool ddu_tr1_check[sz1]={false};
00657 bool alct_h1_check[sz1]={false};
00658 bool alct_h2_check[sz1]={false};
00659 bool alct_tr1_check[sz1]={false};
00660 bool dmb_tr1_check[sz1]={false};
00661 bool dmb_tr2_check[sz1]={false};
00662 bool tmb_h1_check[sz1]={false};
00663 bool tmb_tr1_check[sz1]={false};
00664 bool cfeb_tr1_check[sz1]={false};
00665 bool cfeb_b_check[sz1]={false};
00666 bool ddu_tr1_bad_check[sz1]={false};
00667 bool extraction=fedshort;
00668
00669
00670
00671 std::vector<int> ddu_h1_coll;
00672 std::vector<int> ddu_h1_n_coll;
00673 std::vector<int> ddu_h2_coll;
00674 std::vector<int> ddu_h3_coll;
00675 std::vector<int> ddu_t1_coll;
00676 std::vector<int> ddu_t2_coll;
00677 std::vector<int> ddu_t3_coll;
00678 std::vector<int> ddu_l1a_coll;
00679 std::vector<int> ddu_bxn_coll;
00680
00681 std::vector<int> dmb_h1_coll;
00682 std::vector<int> dmb_h2_coll;
00683 std::vector<int> dmb_t1_coll;
00684 std::vector<int> dmb_t2_coll;
00685 std::vector<int> dmb_crate_coll;
00686 std::vector<int> dmb_slot_coll;
00687 std::vector<int> dmb_l1a_coll;
00688
00689 std::vector<int> alct_h1_coll;
00690 std::vector<int> alct_h2_coll;
00691 std::vector<int> alct_t1_coll;
00692 std::vector<int> alct_l1a_coll;
00693 std::vector<int> alct_bxn_coll;
00694 std::vector<int> alct_wcnt1_coll;
00695 std::vector<int> alct_wcnt2_coll;
00696 std::vector<int> alct_wcnt2_id_coll;
00697
00698 std::vector<int> tmb_h1_coll;
00699 std::vector<int> tmb_t1_coll;
00700 std::vector<int> tmb_l1a_coll;
00701 std::vector<int> tmb_wcnt1_coll;
00702 std::vector<int> tmb_wcnt2_coll;
00703
00704 std::vector<int> cfeb_t1_coll;
00705
00706
00707
00708
00709 char dcc_header1[]="DCC Header 1";
00710 char dcc_header2[]="DCC Header 2";
00711 char dcc_trail1[]="DCC Trailer 1", dcc_trail1_bit[]={'e'};
00712 char dcc_trail2[]="DCC Trailer 2", dcc_trail2_bit[]={'a'};
00713
00714
00715 for (int i=0;i < hl; i++) {
00716 ++word_numbering;
00717 for(int j=-1; j<4; j++){
00718
00719 sprintf(tempbuf_short,"%04x%04x%04x%04x",buf[i+4*(j-1)+3],buf[i+4*(j-1)+2],buf[i+4*(j-1)+1],buf[i+4*(j-1)]);
00720
00721
00722 ddu_h2_found++; ddu_h2_found--;
00723
00724 ddu_h2_check[j]=((buf[i+4*(j-1)+1]==0x8000)&&
00725 (buf[i+4*(j-1)+2]==0x0001)&&(buf[i+4*(j-1)+3]==0x8000));
00726
00727 ddu_tr1_check[j]=((tempbuf_short[0]==ddu_trailer1_bit[0])&&(tempbuf_short[1]==ddu_trailer1_bit[1])&&
00728 (tempbuf_short[2]==ddu_trailer1_bit[2])&&(tempbuf_short[3]==ddu_trailer1_bit[3])&&
00729 (tempbuf_short[4]==ddu_trailer1_bit[4])&&(tempbuf_short[5]==ddu_trailer1_bit[5])&&
00730 (tempbuf_short[6]==ddu_trailer1_bit[6])&&(tempbuf_short[7]==ddu_trailer1_bit[7])&&
00731 (tempbuf_short[8]==ddu_trailer1_bit[8])&&(tempbuf_short[9]==ddu_trailer1_bit[9])&&
00732 (tempbuf_short[10]==ddu_trailer1_bit[10])&&(tempbuf_short[11]==ddu_trailer1_bit[11])&&
00733 (tempbuf_short[12]==ddu_trailer1_bit[12])&&(tempbuf_short[13]==ddu_trailer1_bit[13])&&
00734 (tempbuf_short[14]==ddu_trailer1_bit[14])&&(tempbuf_short[15]==ddu_trailer1_bit[15]));
00735
00736 dmb_h1_check[j]=((tempbuf_short[0]==dmb_header1_bit[0])&&(tempbuf_short[4]==dmb_header1_bit[1])&&
00737 (tempbuf_short[8]==dmb_header1_bit[2])&&(tempbuf_short[12]==dmb_header1_bit[3]));
00738
00739 dmb_h2_check[j]=((tempbuf_short[0]==dmb_header2_bit[0])&&(tempbuf_short[4]==dmb_header2_bit[1])&&
00740 (tempbuf_short[8]==dmb_header2_bit[2])&&(tempbuf_short[12]==dmb_header2_bit[3]));
00741 alct_h1_check[j]=((tempbuf_short[0]==alct_header1_bit[0])&&(tempbuf_short[4]==alct_header1_bit[1])&&
00742 (tempbuf_short[8]==alct_header1_bit[2])&&(tempbuf_short[12]==alct_header1_bit[3])&&
00743 (tempbuf_short[13]==alct_header1_bit[4])&&(tempbuf_short[14]==alct_header1_bit[5])&&
00744 (tempbuf_short[15]==alct_header1_bit[6]));
00745 alct_h2_check[j]=(((tempbuf_short[0]==alct_header2_bit[0])&&(tempbuf_short[1]==alct_header2_bit[1])&&
00746 (tempbuf_short[2]==alct_header2_bit[2])&&(tempbuf_short[3]==alct_header2_bit[3]))||
00747 ((tempbuf_short[4]==alct_header2_bit[0])&&(tempbuf_short[5]==alct_header2_bit[1])&&
00748 (tempbuf_short[6]==alct_header2_bit[2])&&(tempbuf_short[7]==alct_header2_bit[3]))||
00749 ((tempbuf_short[8]==alct_header2_bit[0])&&(tempbuf_short[9]==alct_header2_bit[1])&&
00750 (tempbuf_short[10]==alct_header2_bit[2])&&(tempbuf_short[11]==alct_header2_bit[3]))||
00751 ((tempbuf_short[12]==alct_header2_bit[0])&&(tempbuf_short[13]==alct_header2_bit[1])&&
00752 (tempbuf_short[14]==alct_header2_bit[2])&&(tempbuf_short[15]==alct_header2_bit[3]))
00753
00754 );
00755
00756 alct_tr1_check[j]=(((buf[i+4*(j-1)]&0xFFFF)==0xDE0D)&&((buf[i+4*(j-1)+1]&0xF800)==0xD000)&&
00757 ((buf[i+4*(j-1)+2]&0xF800)==0xD000)&&((buf[i+4*(j-1)+3]&0xF000)==0xD000));
00758
00759 dmb_tr1_check[j]=((tempbuf_short[0]==dmb_tr1_bit[0])&&(tempbuf_short[4]==dmb_tr1_bit[1])&&
00760 (tempbuf_short[8]==dmb_tr1_bit[2])&&(tempbuf_short[12]==dmb_tr1_bit[3]));
00761 dmb_tr2_check[j]=((tempbuf_short[0]==dmb_tr2_bit[0])&&(tempbuf_short[4]==dmb_tr2_bit[1])&&
00762 (tempbuf_short[8]==dmb_tr2_bit[2])&&(tempbuf_short[12]==dmb_tr2_bit[3]));
00763
00764 tmb_h1_check[j]=((tempbuf_short[0]==tmb_header1_bit[0])&&(tempbuf_short[4]==tmb_header1_bit[1])&&
00765 (tempbuf_short[8]==tmb_header1_bit[2])&&(tempbuf_short[12]==tmb_header1_bit[3])&&
00766 (tempbuf_short[13]==tmb_header1_bit[4])&&(tempbuf_short[14]==tmb_header1_bit[5])&&
00767 (tempbuf_short[15]==tmb_header1_bit[6]));
00768 tmb_tr1_check[j]=((tempbuf_short[0]==tmb_tr1_bit[0])&&(tempbuf_short[4]==tmb_tr1_bit[1])&&
00769 (tempbuf_short[8]==tmb_tr1_bit[2])&&(tempbuf_short[12]==tmb_tr1_bit[3])&&
00770 (tempbuf_short[13]==tmb_tr1_bit[4])&&(tempbuf_short[14]==tmb_tr1_bit[5])&&
00771 (tempbuf_short[15]==tmb_tr1_bit[6]));
00772
00773 cfeb_tr1_check[j]=(((buf[i+4*(j-1)+1]&0xF000)==0x7000) &&
00774 ((buf[i+4*(j-1)+2]&0xF000)==0x7000) &&
00775 (( buf[i+4*(j-1)+1]!= 0x7FFF) || (buf[i+4*(j-1)+2] != 0x7FFF)) &&
00776 ((buf[i+4*(j-1)+3] == 0x7FFF) ||
00777 ((buf[i+4*(j-1)+3]&buf[i+4*(j-1)]) == 0x0&&(buf[i+4*(j-1)+3] + buf[i+4*(j-1)] == 0x7FFF ))) );
00778 cfeb_b_check[j]=(((buf[i+4*(j-1)+3]&0xF000)==0xB000)&&((buf[i+4*(j-1)+2]&0xF000)==0xB000) &&
00779 ((buf[i+4*(j-1)+1]&0xF000)==0xB000)&&((buf[i+4*(j-1)]=3&0xF000)==0xB000) );
00780
00781 ddu_tr1_bad_check[j]=((tempbuf_short[0]!=ddu_trailer1_bit[0])&&
00782
00783
00784 (tempbuf_short[4]!=ddu_trailer1_bit[4])&&
00785
00786
00787 (tempbuf_short[8]==ddu_trailer1_bit[8])&&(tempbuf_short[9]==ddu_trailer1_bit[9])&&
00788 (tempbuf_short[10]==ddu_trailer1_bit[10])&&(tempbuf_short[11]==ddu_trailer1_bit[11])&&
00789 (tempbuf_short[12]==ddu_trailer1_bit[12])&&(tempbuf_short[13]==ddu_trailer1_bit[13])&&
00790 (tempbuf_short[14]==ddu_trailer1_bit[14])&&(tempbuf_short[15]==ddu_trailer1_bit[15]));
00791 }
00792
00793
00794 ddu_h2_h1=ddu_h2_check[2];
00795
00796 sprintf(tempbuf_short,"%04x%04x%04x%04x",buf[i+3],buf[i+2],buf[i+1],buf[i]);
00797
00798
00799 ddu_h1_12_13=(buf[i]>>8);
00800 for (int kk=0; kk<36; kk++){
00801 if(((buf[i+3]&0xF000)==0x5000)&&(ddu_h1_12_13==ddu_id[kk])&&ddu_h2_h1){
00802 ddu_h1_coll.push_back(word_numbering); ddu_h1_n_coll.push_back(ddu_id[kk]);
00803 ddu_inst_l1a=((buf[i+2]&0xFFFF)+((buf[i+3]&0x00FF)<<16));
00804 ddu_l1a_coll.push_back(ddu_inst_l1a);
00805 ddu_inst_bxn=(buf[i+1]&0xFFF0)>>4;
00806 ddu_bxn_coll.push_back(ddu_inst_bxn);
00807 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s%s %s %i %s %i",
00808 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
00809 sign1,ddu_common,ddu_id[kk],ddu_header1,sign1,dmb_common_l1a,ddu_inst_l1a,alct_common_bxn,ddu_inst_bxn);
00810 std::cout << tempbuf1 << std::endl; w=0; ddu_h1_check=true; ddu_inst_l1a=0;
00811 cfeb_sample=0;
00812 }
00813 }
00814
00815
00816
00817
00818 dcc_h1_id=(((buf[i+1]<<12)&0xF000)>>4)+(buf[i]>>8);
00819 for(int dcci=0;dcci<16;dcci++){
00820 if((dcc_id[dcci]==dcc_h1_id)&&(((buf[i+3]&0xF000)==0x5000)&&(!ddu_h1_check))){
00821 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s",word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
00822 sign1,dcc_common,dcc_h1_id,dcc_header1); dcc_h1_check=word_numbering; w=0;
00823 dcc_check=true;
00824 std::cout << tempbuf1 << std::endl;
00825 }
00826 }
00827
00828
00829 if(((word_numbering-1)==dcc_h1_check)&&((buf[i+3]&0xFF00)==0xD900)) {
00830 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s",word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
00831 sign1,dcc_header2);
00832 std::cout << tempbuf1 << std::endl; w=0;
00833 }
00834 else if((word_numbering==word_lines-1)&&(tempbuf_short[0]==dcc_trail1_bit[0])){
00835 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s",word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
00836 sign1,dcc_trail1);
00837 std::cout << tempbuf1 << std::endl; w=0;
00838 }
00839 else if((word_numbering==word_lines)&&(tempbuf_short[0]==dcc_trail2_bit[0])){
00840 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s",word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
00841 sign1,dcc_trail2);
00842 std::cout << tempbuf1 << std::endl; w=0;
00843 }
00844
00845
00846 else if(ddu_h2_check[1]){
00847 ddu_inst_i = ddu_h1_n_coll.size();
00848 if(ddu_inst_i>0){
00849 ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
00850 }
00851 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s",
00852 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,ddu_common,
00853 ddu_inst_n, ddu_header2);
00854 ddu_h2_coll.push_back(word_numbering);
00855 std::cout << tempbuf1 << std::endl; w=0;
00856 ddu_h2_found=1;
00857 }
00858
00859
00860 else if((ddu_h2_check[0]&&dmb_h1_check[2])||(ddu_h2_check[0]&&ddu_tr1_check[2])){
00861 ddu_inst_i = ddu_h1_n_coll.size();
00862 if(ddu_inst_i>0){
00863 ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
00864 }
00865 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s",word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
00866 sign1,ddu_common,ddu_inst_n,ddu_header3);
00867 ddu_h3_coll.push_back(word_numbering);
00868 std::cout << tempbuf1 << std::endl; w=0;
00869 ddu_h2_found=0;
00870 }
00871
00872
00873
00874 else if(dmb_h1_check[1]){
00875 dmb_inst_crate=0; dmb_inst_slot=0; dmb_inst_l1a=0;
00876 dmb_inst_l1a=((buf[i]&0x0FFF)+((buf[i+1]&0xFFF)<<12));
00877 dmb_l1a_coll.push_back(dmb_inst_l1a);
00878 if(dmb_h2_check[2]){
00879 dmb_inst_crate=((buf[i+4+1]>>4)&0xFF); dmb_inst_slot=(buf[i+4+1]&0xF);
00880 dmb_crate_coll.push_back(dmb_inst_crate); dmb_slot_coll.push_back(dmb_inst_slot);
00881 }
00882 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s%s %i %s %i %s %i",
00883 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
00884 sign1,dmb_common,dmb_header1,sign1,dmb_common_crate,dmb_inst_crate,
00885 dmb_common_slot,dmb_inst_slot,dmb_common_l1a,dmb_inst_l1a);
00886 dmb_h1_coll.push_back(word_numbering);
00887 std::cout << tempbuf1 << std::endl; w=0;
00888 ddu_h2_found=1;
00889 }
00890
00891 else if(dmb_h2_check[1]){
00892 dmb_inst_crate=((buf[i+1]>>4)&0xFF); dmb_inst_slot=(buf[i+1]&0xF);
00893 dmb_h2_coll.push_back(word_numbering);
00894 if(dmb_h1_check[0])
00895 dmb_inst_l1a=((buf[i-4]&0x0FFF)+((buf[i-4+1]&0xFFF)<<12));
00896 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s%s %i %s %i %s %i",
00897 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
00898 sign1,dmb_common,dmb_header2,sign1,dmb_common_crate,dmb_inst_crate,
00899 dmb_common_slot,dmb_inst_slot,dmb_common_l1a,dmb_inst_l1a);
00900 std::cout << tempbuf1 << std::endl; w=0;
00901 ddu_h2_found=1;
00902 }
00903
00904
00905
00906 else if(ddu_tr1_check[1]){
00907 ddu_inst_i = ddu_h1_n_coll.size();
00908 if(ddu_inst_i>0){
00909 ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
00910 }
00911
00912 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s",
00913 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,ddu_common,ddu_inst_n,ddu_trail1);
00914 ddu_t1_coll.push_back(word_numbering);
00915 std::cout << tempbuf1 << std::endl; w=0;
00916 }
00917
00918
00919 else if(alct_h1_check[1]){
00920 alct_start=word_numbering;
00921 alct_inst_l1a=(buf[i+2]&0x0FFF);
00922 alct_l1a_coll.push_back(alct_inst_l1a);
00923 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s %s %i",
00924 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
00925 sign1,alct_common,alct_header1,sign1,dmb_common_l1a,alct_inst_l1a);
00926 alct_h1_coll.push_back(word_numbering);
00927 std::cout << tempbuf1 << std::endl; w=0; alct_inst_l1a=0;
00928 }
00929
00930 else if((alct_h1_check[0])&&(alct_h2_check[2])) {
00931 alct_inst_bxn=(buf[i]&0x0FFF);
00932 alct_bxn_coll.push_back(alct_inst_bxn);
00933 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s%s %i",
00934 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
00935 sign1,alct_common,alct_header2,sign1,alct_common_bxn,alct_inst_bxn);
00936 alct_h2_coll.push_back(word_numbering);
00937 std::cout << tempbuf1 << std::endl; w=0; alct_inst_bxn=0;
00938 }
00939
00940
00941 else if(alct_tr1_check[1]){
00942 alct_stop=word_numbering;
00943 if((alct_start!=0)&&(alct_stop!=0)&&(alct_stop>alct_start)) {
00944 alct_inst_wcnt2=4*(alct_stop-alct_start+1);
00945 alct_wcnt2_coll.push_back(alct_inst_wcnt2);
00946 alct_wcnt2_id_coll.push_back(alct_start);
00947 }
00948 alct_inst_wcnt1=(buf[i+3]&0x7FF);
00949 alct_wcnt1_coll.push_back(alct_inst_wcnt1);
00950 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s%s %i %s %i",
00951 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
00952 sign1,alct_common,alct_tr1,sign1,alct_common_wcnt1,alct_inst_wcnt1,
00953 alct_common_wcnt2,alct_inst_wcnt2);
00954 alct_t1_coll.push_back(word_numbering);
00955 std::cout << tempbuf1 << std::endl; w=0; alct_inst_wcnt1=0;
00956 alct_inst_wcnt2=0;
00957 }
00958
00959
00960 else if((ddu_tr1_check[-1])&&(tempbuf_short[0]==ddu_trailer3_bit[0])){
00961
00962 ddu_inst_i = ddu_h1_n_coll.size();
00963 if(ddu_inst_i>0){
00964 ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
00965 }
00966
00967 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s",
00968 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,ddu_common,ddu_inst_n,ddu_trail3);
00969 ddu_t3_coll.push_back(word_numbering);
00970 std::cout << tempbuf1 << std::endl; w=0;
00971 }
00972
00973 else if((ddu_tr1_check[0])&&(tempbuf_short[0]!=ddu_trailer3_bit[0])){
00974
00975 ddu_inst_i = ddu_h1_n_coll.size();
00976 if(ddu_inst_i>0){
00977 ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
00978 }
00979
00980 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s",
00981 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,ddu_common,ddu_inst_n,ddu_trail2);
00982 ddu_t2_coll.push_back(word_numbering);
00983 std::cout << tempbuf1 << std::endl; w=0;
00984 }
00985
00986
00987 else if(dmb_tr1_check[1]){
00988 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s",
00989 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,dmb_common,dmb_tr1);
00990 dmb_t1_coll.push_back(word_numbering);
00991 std::cout << tempbuf1 << std::endl; w=0;
00992 cfeb_sample=0;
00993 }
00994
00995 else if(dmb_tr2_check[1]){
00996 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s",
00997 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,dmb_common,dmb_tr2);
00998 dmb_t2_coll.push_back(word_numbering);
00999 std::cout << tempbuf1 << std::endl; w=0;
01000 }
01001
01002 else if(tmb_h1_check[1]){
01003 tmb_start=word_numbering;
01004 tmb_inst_l1a=(buf[i+2]&0x000F);
01005 tmb_l1a_coll.push_back(tmb_inst_l1a);
01006 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s%s %i",
01007 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,tmb_common,tmb_header1,
01008 sign1,dmb_common_l1a,tmb_inst_l1a);
01009 tmb_h1_coll.push_back(word_numbering);
01010 std::cout << tempbuf1 << std::endl; w=0; tmb_inst_l1a=0;
01011 }
01012 else if(tmb_tr1_check[1]){
01013 tmb_stop=word_numbering;
01014 if((tmb_start!=0)&&(tmb_stop!=0)&&(tmb_stop>tmb_start)) {
01015 tmb_inst_wcnt2=4*(tmb_stop-tmb_start+1);
01016 tmb_wcnt2_coll.push_back(tmb_inst_wcnt2);
01017 }
01018 tmb_inst_wcnt1=(buf[i+3]&0x7FF);
01019 tmb_wcnt1_coll.push_back(tmb_inst_wcnt1);
01020 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s%s %i %s %i",
01021 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
01022 sign1,tmb_common,tmb_tr1,sign1,alct_common_wcnt1,tmb_inst_wcnt1,
01023 alct_common_wcnt2,tmb_inst_wcnt2);
01024 tmb_t1_coll.push_back(word_numbering);
01025 std::cout << tempbuf1 << std::endl; w=0;
01026 tmb_inst_wcnt2=0;
01027 }
01028
01029 else if(cfeb_tr1_check[1]){
01030 ++cfeb_sample;
01031 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s %s %i",
01032 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
01033 sign1,cfeb_common,cfeb_tr1,sign1,cfeb_common_sample,cfeb_sample);
01034 cfeb_t1_coll.push_back(word_numbering); w=0;
01035 std::cout << tempbuf1 << std::endl; w=0;
01036 }
01037 else if(cfeb_b_check[1]){
01038 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s",
01039 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,cfeb_common,cfeb_b);
01040 std::cout << tempbuf1 << std::endl; w=0;
01041 }
01042
01043
01044
01045 else if(ddu_tr1_bad_check[1]){
01046 ddu_inst_i = ddu_h1_n_coll.size(); ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
01047 sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s %s",
01048 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,ddu_common,ddu_inst_n,
01049 ddu_trail1,ddu_tr1_err_common);
01050 std::cout << tempbuf1 << std::endl; w=0;
01051 }
01052
01053 else if(extraction&&(!ddu_h1_check)&&(!dcc_check)){
01054 if(w<3){
01055 sprintf(tempbuf,"%6i %04x %04x %04x %04x",
01056 word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i]);
01057 std::cout << tempbuf << std::endl; w++;}
01058 if(w==3){
01059 std::cout << "..................................................." << std::endl; w++;}
01060 }
01061
01062 else if((!ddu_h1_check)&&(!dcc_check)){
01063 sprintf(tempbuf,"%6i %04x %04x %04x %04x",word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i]);
01064 std::cout << tempbuf << std::endl;
01065 }
01066
01067 i+=3; ddu_h1_check=false; dcc_check=false;
01068 }
01069
01070 std::cout <<"********************************************************************************" <<
01071 std::endl << std::endl;
01072 if(fedshort)
01073 std::cout << "For complete output turn off VisualFEDShort in muonCSCDigis configuration file." << std::endl;
01074 std::cout <<"********************************************************************************" <<
01075 std::endl << std::endl;
01076 std::cout << std::endl << std::endl;
01077 std::cout <<" Summary " << std::endl;
01078 std::cout << std::endl << std::endl;
01079 std::cout << ddu_h1_coll.size() <<" "<< ddu_common << " "<<ddu_header1 << " "<< "found" << std::endl;
01080
01081
01082
01083
01084 for(unsigned int k=0; k<ddu_h1_coll.size();++k){
01085
01086
01087
01088
01089
01090 std::cout << "Line: " << " " << ddu_h1_coll[k] << " " << sign1 << " " <<
01091 ddu_common << " " << ddu_h1_n_coll[k] << " " << dmb_common_l1a << " " << ddu_l1a_coll[k] << " " <<
01092 alct_common_bxn << " " << ddu_bxn_coll[k] << std::endl;
01093 }
01094
01095
01096 std::cout << std::endl << std::endl;
01097 std::cout << "||||||||||||||||||||" << std::endl;
01098 std::cout << std::endl << std::endl;
01099 std::cout << ddu_h2_coll.size() <<" "<< ddu_common << " "<<ddu_header2 << " "<< "found" << std::endl;
01100 for(unsigned int k=0; k<ddu_h2_coll.size();++k)
01101 std::cout << "Line: " << ddu_h2_coll[k] << std::endl;
01102 std::cout << std::endl << std::endl;
01103 std::cout << "||||||||||||||||||||" << std::endl;
01104 std::cout << std::endl << std::endl;
01105 std::cout << ddu_h3_coll.size() <<" "<< ddu_common << " "<<ddu_header3 << " "<< "found" << std::endl;
01106 for(unsigned int k=0; k<ddu_h3_coll.size();++k)
01107 std::cout << "Line: " << ddu_h3_coll[k] << std::endl;
01108 std::cout << std::endl << std::endl;
01109 std::cout << "||||||||||||||||||||" << std::endl;
01110 std::cout << std::endl << std::endl;
01111 std::cout << ddu_t1_coll.size() <<" "<< ddu_common << " "<<ddu_trail1 << " "<< "found" << std::endl;
01112 for(unsigned int k=0; k<ddu_t1_coll.size();++k)
01113 std::cout << "Line: " << ddu_t1_coll[k] << std::endl;
01114 std::cout << std::endl << std::endl;
01115 std::cout << "||||||||||||||||||||" << std::endl;
01116 std::cout << std::endl << std::endl;
01117 std::cout << ddu_t2_coll.size() <<" "<< ddu_common << " "<<ddu_trail2 << " "<< "found" << std::endl;
01118 for(unsigned int k=0; k<ddu_t2_coll.size();++k)
01119 std::cout << "Line: " << ddu_t2_coll[k] << std::endl;
01120 std::cout << std::endl << std::endl;
01121 std::cout << "||||||||||||||||||||" << std::endl;
01122 std::cout << std::endl << std::endl;
01123 std::cout << ddu_t3_coll.size() <<" "<< ddu_common << " "<<ddu_trail3 << " "<< "found" << std::endl;
01124 for(unsigned int k=0; k<ddu_t3_coll.size();++k)
01125 std::cout << "Line: " << ddu_t3_coll[k] << std::endl;
01126 std::cout << std::endl << std::endl;
01127 std::cout << "||||||||||||||||||||" << std::endl;
01128 std::cout << std::endl << std::endl;
01129 std::cout << dmb_h1_coll.size() <<" "<< dmb_common << " "<<dmb_header1 << " "<< "found" << std::endl;
01130
01131 for(unsigned int k=0; k<dmb_h1_coll.size();++k){
01132
01133
01134
01135
01136
01137 std::cout << "Line: " << " " << dmb_h1_coll[k] << " " << sign1 << dmb_common
01138 << " " << dmb_common_crate << " " << dmb_crate_coll[k] << " " << dmb_common_slot << " " <<
01139 dmb_slot_coll[k] << " " << dmb_common_l1a << " " << dmb_l1a_coll[k] << std::endl;
01140 }
01141 std::cout << std::endl << std::endl;
01142 std::cout << "||||||||||||||||||||" << std::endl;
01143 std::cout << std::endl << std::endl;
01144 std::cout << dmb_h2_coll.size() <<" "<< dmb_common << " "<<dmb_header2 << " "<< "found" << std::endl;
01145 for(unsigned int k=0; k<dmb_h2_coll.size();++k)
01146 std::cout << "Line: " << dmb_h2_coll[k] << std::endl;
01147 std::cout << std::endl << std::endl;
01148 std::cout << "||||||||||||||||||||" << std::endl;
01149 std::cout << std::endl << std::endl;
01150 std::cout << dmb_t1_coll.size() <<" "<< dmb_common << " "<<dmb_tr1 << " "<< "found" << std::endl;
01151 for(unsigned int k=0; k<dmb_t1_coll.size();++k)
01152 std::cout << "Line: " << dmb_t1_coll[k] << std::endl;
01153 std::cout << std::endl << std::endl;
01154 std::cout << "||||||||||||||||||||" << std::endl;
01155 std::cout << std::endl << std::endl;
01156 std::cout << dmb_t2_coll.size() <<" "<< dmb_common << " "<<dmb_tr2 << " "<< "found" << std::endl;
01157 for(unsigned int k=0; k<dmb_t2_coll.size();++k)
01158 std::cout << "Line: " << dmb_t2_coll[k] << std::endl;
01159 std::cout << std::endl << std::endl;
01160 std::cout << "||||||||||||||||||||" << std::endl;
01161 std::cout << std::endl << std::endl;
01162 std::cout << alct_h1_coll.size() <<" "<< alct_common << " "<<alct_header1 << " "<< "found" << std::endl;
01163 for(unsigned int k=0; k<alct_h1_coll.size();++k){
01164
01165
01166
01167
01168
01169
01170 std::cout << "Line: " << " " <<
01171 alct_h1_coll[k] << " " << sign1 << " " << alct_common << " " <<
01172 dmb_common_l1a << " " << alct_l1a_coll[k] << std::endl;
01173 }
01174
01175 std::cout << std::endl << std::endl;
01176 std::cout << "||||||||||||||||||||" << std::endl;
01177 std::cout << std::endl << std::endl;
01178 std::cout << alct_h2_coll.size() <<" "<< alct_common << " "<<alct_header2 << " "<< "found" << std::endl;
01179 for(unsigned int k=0; k<alct_h2_coll.size();++k){
01180
01181
01182
01183
01184
01185
01186 std::cout << "Line: " << " " <<
01187 alct_h1_coll[k] << " " << sign1 << " " << alct_common << " " <<
01188 alct_common_bxn << " " << alct_bxn_coll[k] << std::endl;
01189 }
01190
01191 std::cout << std::endl << std::endl;
01192 std::cout << "||||||||||||||||||||" << std::endl;
01193 std::cout << std::endl << std::endl;
01194 std::cout << alct_t1_coll.size() <<" "<< alct_common << " "<<alct_tr1 << " "<< "found" << std::endl;
01195 for(unsigned int k=0; k<alct_t1_coll.size();++k){
01196
01197
01198
01199
01200
01201
01202 std::cout << "Line: " << " " << alct_t1_coll[k] << " " << sign1 << " " << alct_common << " " <<
01203 alct_common_wcnt1 << " " << alct_wcnt1_coll[k] << " " << alct_common_wcnt2 << " " <<
01204 alct_wcnt2_coll[k] << std::endl;
01205 }
01206
01207 std::cout << std::endl << std::endl;
01208 std::cout << "||||||||||||||||||||" << std::endl;
01209 std::cout << std::endl << std::endl;
01210 std::cout << tmb_h1_coll.size() <<" "<< tmb_common << " "<<tmb_header1 << " "<< "found" << std::endl;
01211 for(unsigned int k=0; k<tmb_h1_coll.size();++k){
01212
01213
01214
01215
01216
01217
01218 std::cout << "Line: " << " " << tmb_h1_coll[k] << " " << sign1 << " " << tmb_common << " " <<
01219 dmb_common_l1a << " " << tmb_l1a_coll[k] << std::endl;
01220 }
01221
01222 std::cout << std::endl << std::endl;
01223 std::cout << "||||||||||||||||||||" << std::endl;
01224 std::cout << std::endl << std::endl;
01225 std::cout << tmb_t1_coll.size() <<" "<< tmb_common << " "<<tmb_tr1 << " "<< "found" << std::endl;
01226 for(unsigned int k=0; k<tmb_t1_coll.size();++k){
01227
01228
01229
01230
01231
01232
01233 std::cout << "Line: " << " " << tmb_t1_coll[k] << " " << sign1 << " " << tmb_common << " " <<
01234 alct_common_wcnt1 << " " << tmb_wcnt1_coll[k] << " " << alct_common_wcnt2 << " " << tmb_wcnt2_coll[k]
01235 << std::endl;
01236 }
01237
01238
01239 std::cout << std::endl << std::endl;
01240 std::cout << "||||||||||||||||||||" << std::endl;
01241 std::cout << std::endl << std::endl;
01242 std::cout << cfeb_t1_coll.size() <<" "<< cfeb_common << " "<<cfeb_tr1 << " "<< "found" << std::endl;
01243 for(unsigned int k=0; k<cfeb_t1_coll.size();++k)
01244 std::cout << "Line: " << cfeb_t1_coll[k] << std::endl;
01245 std::cout <<"********************************************************************************" << std::endl;
01246
01247 }