Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:11

0001 /**\testCSCDigis.cpp
0002  *
0003  * Test suit for CSCDigi.
0004  * Based on testDTDigis.cpp
0005  *
0006  *
0007  * \author N. Terentiev, CMU (for CSCWireDigi, CSCRPCDigi, 
0008  *                                CSCALCTDigi, CSCCLCTDigi)
0009  * \author M. Schmitt,    Northwestern (for CSCComparatorDigi, CSCStripDigi)
0010  * \author A. Tumanov, Rice U.
0011  */
0012 
0013 #include <cppunit/extensions/HelperMacros.h>
0014 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0015 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
0016 
0017 #include "DataFormats/CSCDigi/interface/CSCWireDigi.h"
0018 #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h"
0019 
0020 #include "DataFormats/CSCDigi/interface/CSCComparatorDigi.h"
0021 #include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h"
0022 
0023 #include "DataFormats/CSCDigi/interface/CSCStripDigi.h"
0024 #include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h"
0025 
0026 #include "DataFormats/CSCDigi/interface/CSCRPCDigi.h"
0027 #include "DataFormats/CSCDigi/interface/CSCRPCDigiCollection.h"
0028 
0029 #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h"
0030 #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h"
0031 
0032 #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h"
0033 #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h"
0034 
0035 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h"
0036 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
0037 
0038 #include "DataFormats/CSCDigi/interface/CSCCFEBStatusDigi.h"
0039 #include "DataFormats/CSCDigi/interface/CSCCFEBStatusDigiCollection.h"
0040 
0041 #include "DataFormats/CSCDigi/interface/CSCTMBStatusDigi.h"
0042 #include "DataFormats/CSCDigi/interface/CSCTMBStatusDigiCollection.h"
0043 
0044 #include "DataFormats/CSCDigi/interface/CSCDCCFormatStatusDigi.h"
0045 #include "DataFormats/CSCDigi/interface/CSCDCCFormatStatusDigiCollection.h"
0046 
0047 //#include "DataFormats/CSCDigi/interface/CSCEventFormatStatusDigi.h"
0048 //#include "DataFormats/CSCDigi/interface/CSCEventFormatStatusDigiCollection.h"
0049 
0050 #include <stdio.h>
0051 #include <iostream>
0052 
0053 using namespace std;
0054 
0055 CSCIdType makeCSCId(const uint16_t crateId, const uint16_t dmbId) {
0056   return ((CSCIdType(crateId & 0xFF) << 4) | (dmbId & 0xF));
0057 }
0058 
0059 class testCSCDigis : public CppUnit::TestFixture {
0060   CPPUNIT_TEST_SUITE(testCSCDigis);
0061   CPPUNIT_TEST(testDigiCollectionPut);
0062   CPPUNIT_TEST_SUITE_END();
0063 
0064 public:
0065   void setUp() {}
0066   void tearDown() {}
0067 
0068   void fillCSCWireDigi(CSCWireDigiCollection &);
0069   void fillCSCComparatorDigi(CSCComparatorDigiCollection &);
0070   void fillCSCStripDigi(CSCStripDigiCollection &);
0071   void fillCSCRPCDigi(CSCRPCDigiCollection &);
0072   void fillCSCALCTDigi(CSCALCTDigiCollection &);
0073   void fillCSCCLCTDigi(CSCCLCTDigiCollection &);
0074   void fillCSCCorrLCTDigi(CSCCorrelatedLCTDigiCollection &);
0075   void fillCSCCFEBStatusDigi(CSCCFEBStatusDigiCollection &);
0076   void fillCSCTMBStatusDigi(CSCTMBStatusDigiCollection &);
0077   void fillCSCDCCFormatStatusDigi(CSCDCCFormatStatusDigiCollection &);
0078   //  void fillCSCEventFormatStatusDigi(CSCEventFormatStatusDigiCollection &);
0079 
0080   void readCSCWireDigi(CSCWireDigiCollection &);
0081   void readCSCComparatorDigi(CSCComparatorDigiCollection &);
0082   void readCSCStripDigi(CSCStripDigiCollection &);
0083   void readCSCRPCDigi(CSCRPCDigiCollection &);
0084   void readCSCALCTDigi(CSCALCTDigiCollection &);
0085   void readCSCCLCTDigi(CSCCLCTDigiCollection &);
0086   void readCSCCorrLCTDigi(CSCCorrelatedLCTDigiCollection &);
0087   void readCSCCFEBStatusDigi(CSCCFEBStatusDigiCollection &);
0088   void readCSCTMBStatusDigi(CSCTMBStatusDigiCollection &);
0089   void readCSCDCCFormatStatusDigi(CSCDCCFormatStatusDigiCollection &);
0090   //  void readCSCEventFormatStatusDigi(CSCEventFormatStatusDigiCollection &);
0091 
0092   void testDigiCollectionPut();
0093 };
0094 
0095 ///registration of the test so that the runner can find it
0096 CPPUNIT_TEST_SUITE_REGISTRATION(testCSCDigis);
0097 
0098 void testCSCDigis::fillCSCWireDigi(CSCWireDigiCollection &collection) {
0099   for (int endcp = 1; endcp < 3; endcp++)
0100     for (int stn = 1; stn < 5; stn++)
0101       for (int rng = 1; rng < 4; rng++)
0102         for (int csc = 1; csc < 37; csc++)
0103           for (int pln = 1; pln < 7; pln++) {
0104             CSCDetId detid(endcp, stn, rng, csc, pln);
0105 
0106             std::vector<CSCWireDigi> digivec;
0107             for (int i = 10; i < 11; ++i) {
0108               int wire = i;
0109               //           int tbin=104; // Time bins 3,5,6 - Bits 3,5,6 ON i.e.
0110               // 64+32+8 = 1101000 in binary
0111               unsigned int tbinb = 0, tbit = 1;
0112               for (int j = 0; j < 32; j++) {
0113                 if (j == 0 || j == 3 || j == 5 || j == 6 || j == 31)
0114                   tbinb = tbinb + tbit;
0115                 tbit = tbit << 1;
0116                 // Time bins 0,3,5,6,31 - Bits 0,3,5,6,31 ON i.e
0117                 // in binary - 0b10000000000000000000000001101001
0118               }
0119               CSCWireDigi digi(wire, tbinb);
0120               digivec.push_back(digi);
0121             }
0122 
0123             collection.put(std::make_pair(digivec.begin(), digivec.end()), detid);
0124 
0125           }  // end of for(int endcp=1 ...for(int pln=1 ...)
0126 }
0127 
0128 void testCSCDigis::fillCSCComparatorDigi(CSCComparatorDigiCollection &collection) {
0129   for (int endcp = 1; endcp < 3; endcp++)
0130     for (int stn = 1; stn < 5; stn++)
0131       for (int rng = 1; rng < 4; rng++)
0132         for (int csc = 1; csc < 37; csc++)
0133           for (int pln = 1; pln < 7; pln++) {
0134             CSCDetId detid(endcp, stn, rng, csc, pln);
0135 
0136             std::vector<CSCComparatorDigi> digivec;
0137             for (int i = 10; i < 11; ++i) {
0138               int aStrip = i;
0139               int aComparator = 2;
0140               int aTbin = 6;  // time bin word 0...110 (16-bits) bits 1 and 2 ON
0141               CSCComparatorDigi digi(aStrip, aComparator, aTbin);
0142               digivec.push_back(digi);
0143             }
0144 
0145             collection.put(std::make_pair(digivec.begin(), digivec.end()), detid);
0146 
0147           }  // end of for(int endcp=1 ...for(int pln=1 ...)
0148 }
0149 
0150 void testCSCDigis::fillCSCStripDigi(CSCStripDigiCollection &collection) {
0151   for (int endcp = 1; endcp < 3; endcp++)
0152     for (int stn = 1; stn < 5; stn++)
0153       for (int rng = 1; rng < 4; rng++)
0154         for (int csc = 1; csc < 37; csc++)
0155           for (int pln = 1; pln < 7; pln++) {
0156             CSCDetId detid(endcp, stn, rng, csc, pln);
0157 
0158             std::vector<CSCStripDigi> digivec;
0159             for (int i = 10; i < 11; ++i) {
0160               int aStrip = i;
0161               std::vector<int> someADCCounts(8);
0162               someADCCounts[0] = 9;
0163               someADCCounts[1] = 11;
0164               someADCCounts[2] = 23;
0165               someADCCounts[3] = 51;
0166               someADCCounts[4] = 102;
0167               someADCCounts[5] = 88;
0168               someADCCounts[6] = 48;
0169               someADCCounts[7] = 19;
0170 
0171               std::vector<uint16_t> someVec(8);
0172 
0173               CSCStripDigi digi(aStrip, someADCCounts, someVec, someVec, someVec);
0174               digivec.push_back(digi);
0175             }
0176 
0177             collection.put(std::make_pair(digivec.begin(), digivec.end()), detid);
0178 
0179           }  // end of for(int endcp=1 ...for(int pln=1 ...)
0180 }
0181 
0182 void testCSCDigis::fillCSCRPCDigi(CSCRPCDigiCollection &collection) {
0183   ///rpc digis need to be tested using
0184   ///CSCDetIDs and CSC relevant RAT readout A.T.
0185 
0186   for (int endcp = 1; endcp < 3; endcp++)
0187     for (int stn = 1; stn < 5; stn++)
0188       for (int rng = 1; rng < 4; rng++)
0189         for (int csc = 1; csc < 37; csc++)
0190           for (int pln = 3; pln < 4; pln++) {  // ALCT primitives are for layer 3 only
0191 
0192             CSCDetId detid(endcp, stn, rng, csc, pln);
0193 
0194             std::vector<CSCRPCDigi> digivec;
0195             for (int i = 5; i < 6; ++i) {
0196               int rpc = i;
0197               int bxn = 1;
0198               int pad = 1;
0199               int tbin = 3;
0200               CSCRPCDigi digi(rpc, pad, bxn, tbin);
0201               digivec.push_back(digi);
0202             }
0203 
0204             collection.put(std::make_pair(digivec.begin(), digivec.end()), detid);
0205           }
0206 }
0207 
0208 void testCSCDigis::fillCSCALCTDigi(CSCALCTDigiCollection &collection) {
0209   for (int endcp = 1; endcp < 3; endcp++)
0210     for (int stn = 1; stn < 5; stn++)
0211       for (int rng = 1; rng < 4; rng++)
0212         for (int csc = 1; csc < 37; csc++)
0213           for (int pln = 3; pln < 4; pln++) {  // ALCT primitives are for layer 3 only
0214 
0215             CSCDetId detid(endcp, stn, rng, csc, pln);
0216 
0217             std::vector<CSCALCTDigi> digivec;
0218             for (int i = 1; i < 3; ++i) {
0219               int valid = 1;
0220               int quality = 3;
0221               int accel = 0;
0222               int patternb = 1;
0223               int keywire = 16;
0224               int bx = 4;
0225               int trknmb = 1;
0226 
0227               CSCALCTDigi digi(valid, quality, accel, patternb, keywire, bx, trknmb);
0228               digivec.push_back(digi);
0229             }
0230 
0231             collection.put(std::make_pair(digivec.begin(), digivec.end()), detid);
0232 
0233           }  // end of for(int endcp=1 ...for(int pln=1 ...)
0234 }
0235 
0236 void testCSCDigis::fillCSCCLCTDigi(CSCCLCTDigiCollection &collection) {
0237   for (int endcp = 1; endcp < 3; endcp++)
0238     for (int stn = 1; stn < 5; stn++)
0239       for (int rng = 1; rng < 4; rng++)
0240         for (int csc = 1; csc < 37; csc++)
0241           for (int pln = 3; pln < 4; pln++) {  // CLCT primitives are for layer 3 only
0242 
0243             CSCDetId detid(endcp, stn, rng, csc, pln);
0244 
0245             std::vector<CSCCLCTDigi> digivec;
0246             for (int i = 1; i < 3; ++i) {
0247               int valid = 1;
0248               int quality = 3;
0249               int patshape = 2;
0250               int striptype = 1;
0251               int bend = 0;
0252               int strip = 16;
0253               int cfeb = 5;
0254               int bx = 3;
0255               int trknmb = 1;
0256 
0257               CSCCLCTDigi digi(valid, quality, patshape, striptype, bend, strip, cfeb, bx, trknmb);
0258               digivec.push_back(digi);
0259             }
0260 
0261             collection.put(std::make_pair(digivec.begin(), digivec.end()), detid);
0262 
0263           }  // end of for(int endcp=1 ...for(int pln=1 ...)
0264 }
0265 
0266 void testCSCDigis::fillCSCCorrLCTDigi(CSCCorrelatedLCTDigiCollection &collection) {
0267   for (int endcap = 1; endcap <= 2; ++endcap)
0268     for (int station = 1; station <= 4; ++station)
0269       for (int ring = 1; ring <= ((station == 1) ? 3 : 2); ++ring)
0270         for (int chamber = 1; chamber <= ((ring == 1 && station != 1) ? 18 : 36); ++chamber)
0271           for (int layer = 3; layer <= 3; ++layer) {
0272             CSCDetId detid(endcap, station, ring, chamber, layer);
0273             std::vector<CSCCorrelatedLCTDigi> digivec;
0274 
0275             for (int trknmb = 1; trknmb <= 2; ++trknmb) {
0276               int valid = 1;
0277               int quality = 15;
0278               int pattern = 2;
0279               int strip = 16;
0280               int keywire = 10;
0281               int bend = 1;
0282               int bx = 0;
0283               int mpclink = 1;
0284 
0285               CSCCorrelatedLCTDigi digi(trknmb, valid, quality, keywire, strip, pattern, bend, bx, mpclink);
0286               digivec.push_back(digi);
0287             }
0288             collection.put(std::make_pair(digivec.begin(), digivec.end()), detid);
0289           }
0290 }
0291 
0292 void testCSCDigis::fillCSCCFEBStatusDigi(CSCCFEBStatusDigiCollection &collection) {
0293   for (int endcp = 1; endcp < 3; endcp++)
0294     for (int stn = 1; stn < 5; stn++)
0295       for (int rng = 1; rng < 4; rng++)
0296         for (int csc = 1; csc < 37; csc++) {
0297           CSCDetId detid(endcp, stn, rng, csc, 0);
0298 
0299           std::vector<CSCCFEBStatusDigi> digivec;
0300           for (int i = 1; i < 6; ++i)  // loop over cfeb=1-5
0301           {
0302             int aCfeb = i;
0303             CSCCFEBStatusDigi digi(aCfeb);
0304             std::vector<uint16_t> crc(8, 0);
0305             crc[0] = 1;
0306             crc[7] = 8;
0307             digi.setCRC(crc);
0308             std::vector<uint16_t> scac(8, 0);
0309             scac[0] = 11;
0310             scac[7] = 18;
0311             scac[0] = scac[0] + 256 + 2048 + 4096 + 8192 + 16384 + 32768;
0312             scac[7] = scac[7] + 256 + 2048 + 4096 + 8192 + 16384 + 32768;
0313             digi.setSCAC(scac);
0314             digivec.push_back(digi);
0315           }
0316 
0317           collection.put(std::make_pair(digivec.begin(), digivec.end()), detid);
0318 
0319         }  // end of for(int endcp=1 ...for(int csc=1 ...)
0320 }
0321 
0322 void testCSCDigis::fillCSCTMBStatusDigi(CSCTMBStatusDigiCollection &collection) {
0323   for (int endcp = 1; endcp < 3; endcp++)
0324     for (int stn = 1; stn < 5; stn++)
0325       for (int rng = 1; rng < 4; rng++)
0326         for (int csc = 1; csc < 37; csc++) {
0327           CSCDetId detid(endcp, stn, rng, csc, 0);
0328 
0329           std::vector<CSCTMBStatusDigi> digivec;
0330           CSCTMBStatusDigi digi;
0331           digivec.push_back(digi);
0332 
0333           collection.put(std::make_pair(digivec.begin(), digivec.end()), detid);
0334 
0335         }  // end of for(int endcp=1 ...for(int csc=1 ...)
0336 }
0337 /*
0338 void testCSCDigis::fillCSCDCCFormatStatusDigi(CSCDCCFormatStatusDigiCollection & collection){
0339   std::vector<CSCDCCFormatStatusDigi> digivec;
0340   CSCDetId detid(0,0,0,0,0);
0341 
0342   for(int dcc=1; dcc<3; dcc++)
0343     for(int ddu=1; ddu<5; ddu++) {
0344  
0345            CSCDCCFormatStatusDigi digi(dcc,ddu);
0346            digi.setCSCDCCExaminerInfo(1);
0347            digi.setUnpackerInfo(2);
0348            digi.setErInfo(3);
0349            std::vector<CSCDetId> cscid;
0350            for(int i=31;i<33;i++) {
0351              CSCDetId id(1,2,3,i,0);
0352              cscid.push_back(id);
0353            } 
0354            digi.setCSCId(cscid);
0355 
0356            digivec.push_back(digi);
0357     }
0358  
0359   collection.put(std::make_pair(digivec.begin(), digivec.end()),detid);
0360 }
0361 */
0362 void testCSCDigis::fillCSCDCCFormatStatusDigi(CSCDCCFormatStatusDigiCollection &collection) {
0363   std::vector<CSCDCCFormatStatusDigi> digivec;
0364   CSCDetId detid(0, 0, 0, 0, 0);
0365   for (int dcc = FEDNumbering::MINCSCFEDID; dcc < FEDNumbering::MAXCSCFEDID; dcc++) {
0366     CSCDCCFormatStatusDigi digi(dcc);
0367 #ifdef DEBUG
0368     digi.setDCCId(dcc);
0369     digi.setDCCMask(0x111);
0370     digi.setCSCMask(0x01);
0371     for (int i = 1; i < 5; i++)
0372       digi.setDDUErrors(i, i);
0373     for (int i = 40; i < 50; i++)
0374       for (int j = 1; j < 10; j++) {
0375         digi.setCSCPayload(makeCSCId(i, j), i * j);
0376         digi.setCSCErrors(makeCSCId(i, j), i * j);
0377       }
0378 #endif
0379     digivec.push_back(digi);
0380   }
0381   collection.put(std::make_pair(digivec.begin(), digivec.end()), detid);
0382 }
0383 
0384 void testCSCDigis::readCSCCorrLCTDigi(CSCCorrelatedLCTDigiCollection &collection) {
0385   int count = 0;
0386   CSCCorrelatedLCTDigiCollection::DigiRangeIterator detUnitIt;
0387 
0388   for (detUnitIt = collection.begin(); detUnitIt != collection.end(); detUnitIt++) {
0389     const CSCDetId &id = (*detUnitIt).first;
0390 
0391     const CSCCorrelatedLCTDigiCollection::Range &range = (*detUnitIt).second;
0392 
0393     for (CSCCorrelatedLCTDigiCollection::const_iterator digiIt = range.first; digiIt != range.second; digiIt++) {
0394       ++count;
0395       CPPUNIT_ASSERT(digiIt->isValid() == 1);
0396       CPPUNIT_ASSERT(digiIt->getQuality() == 15);
0397       CPPUNIT_ASSERT(digiIt->getCLCTPattern() == 2);
0398       CPPUNIT_ASSERT(digiIt->getStrip() == 16);
0399       CPPUNIT_ASSERT(digiIt->getKeyWG() == 10);
0400       CPPUNIT_ASSERT(digiIt->getBend() == 1);
0401       CPPUNIT_ASSERT(digiIt->getBX() == 0);
0402 
0403       std::cout << "CSC Correlated LCT - endcap station ring csc layer LCT# Quality: " << id.endcap() << " "
0404                 << id.station() << " " << id.ring() << " " << id.chamber() << " " << id.layer() << " "
0405                 << digiIt->getTrknmb() << " " << digiIt->getQuality() << std::endl;
0406     }
0407   }
0408   std::cout << "CSC Correlated LCT Digi count - " << count << std::endl;
0409 }
0410 
0411 void testCSCDigis::readCSCWireDigi(CSCWireDigiCollection &collection) {
0412   int count = 0;
0413   CSCWireDigiCollection::DigiRangeIterator detUnitIt;
0414   for (detUnitIt = collection.begin(); detUnitIt != collection.end(); ++detUnitIt) {
0415     const CSCDetId &id = (*detUnitIt).first;
0416     const CSCWireDigiCollection::Range &range = (*detUnitIt).second;
0417 
0418     for (CSCWireDigiCollection::const_iterator digiIt = range.first; digiIt != range.second; ++digiIt) {
0419       count++;
0420       CPPUNIT_ASSERT((*digiIt).getWireGroup() == 10);
0421       CPPUNIT_ASSERT((*digiIt).getTimeBin() == 0);
0422       printf("CSC Wire - endcap station ring csc layer wire tbin: %3d %3d %3d %3d %3d %3d  %3d\n",
0423              id.endcap(),
0424              id.station(),
0425              id.ring(),
0426              id.chamber(),
0427              id.layer(),
0428              (*digiIt).getWireGroup(),
0429              (*digiIt).getTimeBin());
0430       std::cout << " CSC Wire Time Bins On ";
0431       std::vector<int> tbins = (*digiIt).getTimeBinsOn();
0432       for (unsigned int i = 0; i < tbins.size(); ++i)
0433         std::cout << tbins[i] << " ";
0434       std::cout << std::endl;
0435       std::cout << " CSC Wire Word with Time Bins Bits On " << (*digiIt).getTimeBinWord() << std::endl;
0436     }  // for digis in layer
0437   }    // end of for (detUnitIt=...
0438 
0439   printf("CSC Wire count:  %3d \n", count);
0440 }
0441 
0442 void testCSCDigis::readCSCComparatorDigi(CSCComparatorDigiCollection &collection) {
0443   int count = 0;
0444   CSCComparatorDigiCollection::DigiRangeIterator detUnitIt;
0445   for (detUnitIt = collection.begin(); detUnitIt != collection.end(); ++detUnitIt) {
0446     const CSCDetId &id = (*detUnitIt).first;
0447     const CSCComparatorDigiCollection::Range &range = (*detUnitIt).second;
0448 
0449     for (CSCComparatorDigiCollection::const_iterator digiIt = range.first; digiIt != range.second; ++digiIt) {
0450       count++;
0451       CPPUNIT_ASSERT((*digiIt).getComparator() == 2);
0452       CPPUNIT_ASSERT((*digiIt).getStrip() == 10);
0453       CPPUNIT_ASSERT((*digiIt).getTimeBin() == 1);  // time bin word=6 means bit 1 should be first!
0454       printf(
0455           "CSCComparatorDigi - endcap station ring csc layer strip comparator time: %3d %3d %3d %3d %3d %3d %3d %3d\n",
0456           id.endcap(),
0457           id.station(),
0458           id.ring(),
0459           id.chamber(),
0460           id.layer(),
0461           (*digiIt).getStrip(),
0462           (*digiIt).getComparator(),
0463           (*digiIt).getTimeBin());
0464       std::cout << " CSCComparatorDigi - time bins ON: ";
0465       std::vector<int> tbins = (*digiIt).getTimeBinsOn();
0466       for (unsigned int i = 0; i < tbins.size(); ++i)
0467         std::cout << tbins[i] << " ";
0468       std::cout << std::endl;
0469 
0470     }  // for digis in layer
0471   }    // end of for (detUnitIt=...
0472 
0473   printf("CSCComparatorDigi count:  %3d \n", count);
0474 }
0475 
0476 void testCSCDigis::readCSCStripDigi(CSCStripDigiCollection &collection) {
0477   int count = 0;
0478 
0479   CSCStripDigiCollection::DigiRangeIterator detUnitIt;
0480   for (detUnitIt = collection.begin(); detUnitIt != collection.end(); ++detUnitIt) {
0481     const CSCDetId &id = (*detUnitIt).first;
0482 
0483     const CSCStripDigiCollection::Range &range = (*detUnitIt).second;
0484     for (CSCStripDigiCollection::const_iterator digiIt = range.first; digiIt != range.second; ++digiIt) {
0485       count++;
0486       CPPUNIT_ASSERT((*digiIt).getStrip() == 10);
0487       printf(
0488           "CSC Strip - endcap station ring csc layer: %3d %3d %3d %3d %3d strip: %3d  ADC: %4d %4d %4d %4d %4d %4d %4d "
0489           "%4d\n",
0490           id.endcap(),
0491           id.station(),
0492           id.ring(),
0493           id.chamber(),
0494           id.layer(),
0495           (*digiIt).getStrip(),
0496           (*digiIt).getADCCounts()[0],
0497           (*digiIt).getADCCounts()[1],
0498           (*digiIt).getADCCounts()[2],
0499           (*digiIt).getADCCounts()[3],
0500           (*digiIt).getADCCounts()[4],
0501           (*digiIt).getADCCounts()[5],
0502           (*digiIt).getADCCounts()[6],
0503           (*digiIt).getADCCounts()[7]);
0504 
0505     }  // for digis in layer
0506   }    // end of for (detUnitIt=...
0507 
0508   printf("CSC Strip count:  %3d \n", count);
0509 }
0510 
0511 void testCSCDigis::readCSCRPCDigi(CSCRPCDigiCollection &collection) {
0512   int count = 0;
0513   CSCRPCDigiCollection::DigiRangeIterator detUnitIt;
0514   for (detUnitIt = collection.begin(); detUnitIt != collection.end(); ++detUnitIt) {
0515     const CSCDetId &id = (*detUnitIt).first;
0516 
0517     const CSCRPCDigiCollection::Range &range = (*detUnitIt).second;
0518     for (CSCRPCDigiCollection::const_iterator digiIt = range.first; digiIt != range.second; ++digiIt) {
0519       count++;
0520       CPPUNIT_ASSERT((*digiIt).getRpc() == 5);
0521       CPPUNIT_ASSERT((*digiIt).getBXN() == 1);
0522 
0523       printf("RPC digi - endcap station ring csc layer: %3d %3d %3d %3d %3d %3d  %4d \n",
0524              id.endcap(),
0525              id.station(),
0526              id.ring(),
0527              id.chamber(),
0528              id.layer(),
0529              (*digiIt).getRpc(),
0530              (*digiIt).getBXN());
0531 
0532     }  // for digis in layer
0533   }    // end of for (detUnitIt=...
0534 
0535   printf("RPC count:  %3d \n", count);
0536 }
0537 
0538 void testCSCDigis::readCSCALCTDigi(CSCALCTDigiCollection &collection) {
0539   int count = 0;
0540   CSCALCTDigiCollection::DigiRangeIterator detUnitIt;
0541   for (detUnitIt = collection.begin(); detUnitIt != collection.end(); ++detUnitIt) {
0542     const CSCDetId &id = (*detUnitIt).first;
0543 
0544     const CSCALCTDigiCollection::Range &range = (*detUnitIt).second;
0545     for (CSCALCTDigiCollection::const_iterator digiIt = range.first; digiIt != range.second; ++digiIt) {
0546       count++;
0547       CPPUNIT_ASSERT((*digiIt).isValid());
0548       CPPUNIT_ASSERT((*digiIt).getQuality() == 3);
0549       CPPUNIT_ASSERT((*digiIt).getAccelerator() == 0);
0550       CPPUNIT_ASSERT((*digiIt).getCollisionB() == 1);
0551       CPPUNIT_ASSERT((*digiIt).getKeyWG() == 16);
0552       CPPUNIT_ASSERT((*digiIt).getBX() == 4);
0553       CPPUNIT_ASSERT((*digiIt).getTrknmb() == 1);
0554 
0555       printf(
0556           "CSC ALCT - endcap station ring csc layer valid quality accel pattern wire bx track: %3d %3d %3d %3d %3d %3d "
0557           " %3d %3d %3d %3d %3d %3d\n",
0558           id.endcap(),
0559           id.station(),
0560           id.ring(),
0561           id.chamber(),
0562           id.layer(),
0563           (*digiIt).isValid(),
0564           (*digiIt).getQuality(),
0565           (*digiIt).getAccelerator(),
0566           (*digiIt).getCollisionB(),
0567           (*digiIt).getKeyWG(),
0568           (*digiIt).getBX(),
0569           (*digiIt).getTrknmb());
0570     }  // for digis in layer
0571   }    // end of for (detUnitIt=...
0572   printf("CSC ALCT count:  %3d \n", count);
0573 }
0574 
0575 void testCSCDigis::readCSCCLCTDigi(CSCCLCTDigiCollection &collection) {
0576   int count = 0;
0577   CSCCLCTDigiCollection::DigiRangeIterator detUnitIt;
0578   for (detUnitIt = collection.begin(); detUnitIt != collection.end(); ++detUnitIt) {
0579     const CSCDetId &id = (*detUnitIt).first;
0580 
0581     const CSCCLCTDigiCollection::Range &range = (*detUnitIt).second;
0582     for (CSCCLCTDigiCollection::const_iterator digiIt = range.first; digiIt != range.second; ++digiIt) {
0583       count++;
0584       CPPUNIT_ASSERT((*digiIt).isValid());
0585       CPPUNIT_ASSERT((*digiIt).getQuality() == 3);
0586       CPPUNIT_ASSERT((*digiIt).getPattern() == 2);
0587       CPPUNIT_ASSERT((*digiIt).getStripType() == 1);
0588       CPPUNIT_ASSERT((*digiIt).getBend() == 0);
0589       CPPUNIT_ASSERT((*digiIt).getStrip() == 16);
0590       CPPUNIT_ASSERT((*digiIt).getCFEB() == 5);
0591       CPPUNIT_ASSERT((*digiIt).getBX() == 3);
0592       CPPUNIT_ASSERT((*digiIt).getTrknmb() == 1);
0593 
0594       printf(
0595           "CSC CLCT - endcap station ring csc layer valid quality pattern striptype bend strip cfeb bx tracknmb %3d "
0596           "%3d %3d %3d %3d %3d  %3d %3d %3d %3d %3d %3d %3d %3d\n",
0597           id.endcap(),
0598           id.station(),
0599           id.ring(),
0600           id.chamber(),
0601           id.layer(),
0602           (*digiIt).isValid(),
0603           (*digiIt).getQuality(),
0604           (*digiIt).getPattern(),
0605           (*digiIt).getStripType(),
0606           (*digiIt).getBend(),
0607           (*digiIt).getStrip(),
0608           (*digiIt).getCFEB(),
0609           (*digiIt).getBX(),
0610           (*digiIt).getTrknmb());
0611 
0612     }  // for digis in layer
0613   }    // end of for (detUnitIt=...
0614   printf("CSC CLCT count:  %3d \n", count);
0615 }
0616 
0617 void testCSCDigis::readCSCCFEBStatusDigi(CSCCFEBStatusDigiCollection &collection) {
0618   CSCCFEBStatusDigiCollection::DigiRangeIterator detUnitIt;
0619   for (detUnitIt = collection.begin(); detUnitIt != collection.end(); ++detUnitIt) {
0620     const CSCDetId &id = (*detUnitIt).first;
0621 
0622     const CSCCFEBStatusDigiCollection::Range &range = (*detUnitIt).second;
0623 
0624     int cfebcount = 0;
0625     for (CSCCFEBStatusDigiCollection::const_iterator digiIt = range.first; digiIt != range.second; ++digiIt) {
0626       cfebcount++;
0627       CPPUNIT_ASSERT((*digiIt).getCFEBNmb() == cfebcount);
0628       printf("CSC CFEBStatus - endcap station ring csc cfeb: %3d %3d %3d %3d %3d \n",
0629              id.endcap(),
0630              id.station(),
0631              id.ring(),
0632              id.chamber(),
0633              (*digiIt).getCFEBNmb());
0634       /*  Commented because the latest changes in CFEBStatusdDigi are not reflected
0635       std::cout<<"CSC CFEBStatus - SCA Full Condition:";
0636       for(int i=0;i<4;i++) std::cout<<" "<<(*digiIt).getSCAFullCond()[i];
0637       std::cout<<std::endl;
0638       std::cout<<"CSC CFEBStatus - CRC:";
0639       for(int i=0;i<8;i++) std::cout<<" "<<(*digiIt).getCRC()[i];
0640       std::cout<<std::endl;
0641       std::cout<<"CSC CFEBStatus - TS_FLAG:";
0642       for(int i=0;i<8;i++) std::cout<<" "<<(*digiIt).getTS_FLAG()[i];
0643       std::cout<<std::endl;
0644       std::cout<<"CSC CFEBStatus - SCA_FULL:";
0645       for(int i=0;i<8;i++) std::cout<<" "<<(*digiIt).getSCA_FULL()[i];
0646       std::cout<<std::endl;
0647       std::cout<<"CSC CFEBStatus - LCT_PHASE:";
0648       for(int i=0;i<8;i++) std::cout<<" "<<(*digiIt).getLCT_PHASE()[i];
0649       std::cout<<std::endl;
0650       std::cout<<"CSC CFEBStatus - L1A_PHASE:";
0651       for(int i=0;i<8;i++) std::cout<<" "<<(*digiIt).getL1A_PHASE()[i];
0652       std::cout<<std::endl;
0653       std::cout<<"CSC CFEBStatus - SCA_BLK:";
0654       for(int i=0;i<8;i++) std::cout<<" "<<(*digiIt).getSCA_BLK()[i];
0655       std::cout<<std::endl;
0656       std::cout<<"CSC CFEBStatus - TRIGGER_TIME:";
0657       for(int i=0;i<8;i++) std::cout<<" "<<(*digiIt).getTRIG_TIME()[i];
0658       std::cout<<std::endl;
0659 */
0660     }  // for digis in collection
0661   }    // end of for (detUnitIt=...
0662 }
0663 
0664 void testCSCDigis::readCSCTMBStatusDigi(CSCTMBStatusDigiCollection &collection) {
0665   CSCTMBStatusDigiCollection::DigiRangeIterator detUnitIt;
0666   for (detUnitIt = collection.begin(); detUnitIt != collection.end(); ++detUnitIt) {
0667     const CSCTMBStatusDigiCollection::Range &range = (*detUnitIt).second;
0668 
0669     for (CSCTMBStatusDigiCollection::const_iterator digiIt = range.first; digiIt != range.second; ++digiIt) {
0670       /*      CPPUNIT_ASSERT((*digiIt).getDAV()==7);
0671       //      CPPUNIT_ASSERT((*digiIt).getDAV()==3);
0672       CPPUNIT_ASSERT((*digiIt).getHALF()==0);
0673       CPPUNIT_ASSERT((*digiIt).getEMPTY()==1);
0674       CPPUNIT_ASSERT((*digiIt).getStart_Timeout()==0);
0675       CPPUNIT_ASSERT((*digiIt).getEnd_Timeout()==1);
0676       CPPUNIT_ASSERT((*digiIt).getFULL()==0);
0677       CPPUNIT_ASSERT((*digiIt).getBoardId()==5);
0678       CPPUNIT_ASSERT((*digiIt).getCscId()==10);
0679       CPPUNIT_ASSERT((*digiIt).getBXNCntL1A()==512);
0680       CPPUNIT_ASSERT((*digiIt).getBXNCntPretr()==256);
0681       CPPUNIT_ASSERT((*digiIt).getNmbTbinsPretr()==8);
0682 
0683       printf("CSC TMBStatus - endcap station ring csc TMB_DAV: %3d %3d %3d %3d%3d \n",id.endcap(),id.station(),id.ring(),id.chamber(),(*digiIt).getDAV());
0684       */
0685 
0686     }  // for digis in collection
0687   }    // end of for (detUnitIt=...
0688 }
0689 /*
0690 void testCSCDigis::readCSCDCCFormatStatusDigi(CSCDCCFormatStatusDigiCollection & collection) {
0691   CSCDCCFormatStatusDigiCollection::DigiRangeIterator detUnitIt;
0692   for (detUnitIt=collection.begin();
0693        detUnitIt!=collection.end();
0694        ++detUnitIt){
0695  
0696     const CSCDetId& id = (*detUnitIt).first;
0697     std::cout<<"CSCDCCFormatStatus id "<<id<<std::endl;
0698 
0699     const CSCDCCFormatStatusDigiCollection::Range& range = (*detUnitIt).second;
0700 
0701     int count=0;
0702     for (CSCDCCFormatStatusDigiCollection::const_iterator digiIt = range.first; digiIt!=range.second; ++digiIt){
0703       
0704       CPPUNIT_ASSERT((*digiIt).getDCCNmb()==(count/4+1));
0705       count++;
0706       std::cout<<"CSCDCCFormatStatusDigi - dcc ddu exam unpack er "
0707                <<(*digiIt).getDCCNmb()<<" "<<(*digiIt).getDDUNmb()<<" "
0708                <<(*digiIt).getCSCDCCExaminerInfo()<<" "
0709                <<(*digiIt).getUnpackerInfo()<<" "
0710                <<(*digiIt).getErInfo()<<std::endl;
0711 
0712       std::cout<<"CSCDCCFormatStatusDigi - CSCId:";
0713       for(unsigned int i=0;i<(*digiIt).getCSCId().size();i++) 
0714       std::cout<<" "<<(*digiIt).getCSCId()[i];
0715       std::cout<<std::endl;
0716 
0717     }// for digis in collection
0718   }// end of for (detUnitIt=...
0719 }
0720 */
0721 void testCSCDigis::readCSCDCCFormatStatusDigi(CSCDCCFormatStatusDigiCollection &collection) {
0722   CSCDCCFormatStatusDigiCollection::DigiRangeIterator detUnitIt;
0723   for (detUnitIt = collection.begin(); detUnitIt != collection.end(); ++detUnitIt) {
0724     //   const CSCDetId& id = (*detUnitIt).first;
0725 
0726     const CSCDCCFormatStatusDigiCollection::Range &range = (*detUnitIt).second;
0727 
0728     for (CSCDCCFormatStatusDigiCollection::const_iterator digiIt = range.first; digiIt != range.second; ++digiIt) {
0729       digiIt->print();
0730 
0731     }  // for digis in collection
0732 
0733   }  // end of for (detUnitIt=...
0734 }
0735 
0736 void testCSCDigis::testDigiCollectionPut() {
0737   /************           Filling collections             *****************/
0738 
0739   CSCWireDigiCollection wiredigiCollection;
0740   fillCSCWireDigi(wiredigiCollection);
0741 
0742   CSCComparatorDigiCollection comparatordigiCollection;
0743   fillCSCComparatorDigi(comparatordigiCollection);
0744 
0745   CSCStripDigiCollection stripdigiCollection;
0746   fillCSCStripDigi(stripdigiCollection);
0747 
0748   CSCRPCDigiCollection rpcdigiCollection;
0749   fillCSCRPCDigi(rpcdigiCollection);
0750 
0751   CSCALCTDigiCollection alctdigiCollection;
0752   fillCSCALCTDigi(alctdigiCollection);
0753 
0754   CSCCLCTDigiCollection clctdigiCollection;
0755   fillCSCCLCTDigi(clctdigiCollection);
0756 
0757   CSCCorrelatedLCTDigiCollection corrlctdigiCollection;
0758   fillCSCCorrLCTDigi(corrlctdigiCollection);
0759 
0760   CSCCFEBStatusDigiCollection cfebstatusdigiCollection;
0761   fillCSCCFEBStatusDigi(cfebstatusdigiCollection);
0762 
0763   CSCTMBStatusDigiCollection tmbstatusdigiCollection;
0764   fillCSCTMBStatusDigi(tmbstatusdigiCollection);
0765 
0766   CSCDCCFormatStatusDigiCollection dccformatstatusdigiCollection;
0767   fillCSCDCCFormatStatusDigi(dccformatstatusdigiCollection);
0768 
0769   //       CSCEventFormatStatusDigiCollection eventformatstatusdigiCollection;
0770   //       fillCSCEventFormatStatusDigi(eventformatstatusdigiCollection);
0771 
0772   /************           Reading collections             *****************/
0773 
0774   readCSCWireDigi(wiredigiCollection);
0775   readCSCComparatorDigi(comparatordigiCollection);
0776   readCSCStripDigi(stripdigiCollection);
0777   readCSCRPCDigi(rpcdigiCollection);
0778   readCSCALCTDigi(alctdigiCollection);
0779   readCSCCLCTDigi(clctdigiCollection);
0780   readCSCCorrLCTDigi(corrlctdigiCollection);
0781   readCSCCFEBStatusDigi(cfebstatusdigiCollection);
0782   readCSCTMBStatusDigi(tmbstatusdigiCollection);
0783   readCSCDCCFormatStatusDigi(dccformatstatusdigiCollection);
0784   //       readCSCEventFormatStatusDigi(eventformatstatusdigiCollection);
0785 }
0786 #include "Utilities/Testing/interface/CppUnit_testdriver.icpp"