Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:14:40

0001 #include "EventFilter/CSCRawToDigi/interface/CSCALCTHeader2006.h"
0002 #include "EventFilter/CSCRawToDigi/interface/CSCDMBHeader.h"
0003 
0004 #ifdef LOCAL_UNPACK
0005 static int activeFEBsForChamberType[11] = {0, 7, 7, 0xf, 7, 0x7f, 0xf, 0x3f, 0xf, 0x3f, 0xf};
0006 static int nTBinsForChamberType[11] = {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7};
0007 #else
0008 constexpr int activeFEBsForChamberType[11] = {0, 7, 7, 0xf, 7, 0x7f, 0xf, 0x3f, 0xf, 0x3f, 0xf};
0009 constexpr int nTBinsForChamberType[11] = {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7};
0010 #endif
0011 
0012 CSCALCTHeader2006::CSCALCTHeader2006(int chamberType) {  //constructor for digi->raw packing based on header2006
0013   // we count from 1 to 10, ME11, ME12, ME13, ME1A, ME21, ME22, ....
0014   init();
0015   flag_0 = 0xC;
0016   flag_1 = 0;
0017   reserved_1 = 0;
0018   fifoMode = 1;
0019   // examiner demands this
0020   l1aMatch = 1;
0021   lctChipRead = activeFEBsForChamberType[chamberType];
0022   activeFEBs = lctChipRead;
0023   nTBins = nTBinsForChamberType[chamberType];
0024   ///in order to be able to return header via data()
0025   //memcpy(theOriginalBuffer, &header2006, header2006.sizeForPacking());
0026 }
0027 
0028 void CSCALCTHeader2006::setEventInformation(const CSCDMBHeader& dmb) {
0029   l1Acc = dmb.l1a();
0030   cscID = dmb.dmbID();
0031   nTBins = 16;
0032   bxnCount = dmb.bxn();
0033 }
0034 
0035 unsigned short CSCALCTHeader2006::nLCTChipRead() const {  ///header2006 method
0036   int count = 0;
0037   for (int i = 0; i < 7; ++i) {
0038     if ((lctChipRead >> i) & 1)
0039       ++count;
0040   }
0041   return count;
0042 }
0043 
0044 std::vector<CSCALCTDigi> CSCALCTs2006::ALCTDigis() const {
0045   std::vector<CSCALCTDigi> result;
0046   result.reserve(2);
0047 
0048   CSCALCTDigi digi0(
0049       alct0_valid, alct0_quality, alct0_accel, alct0_pattern, alct0_key_wire, alct0_bxn_low | (alct0_bxn_high << 3), 1);
0050   CSCALCTDigi digi1(
0051       alct1_valid, alct1_quality, alct1_accel, alct1_pattern, alct1_key_wire, alct1_bxn_low | (alct1_bxn_high << 3), 2);
0052   result.push_back(digi0);
0053   result.push_back(digi1);
0054   return result;
0055 }
0056 
0057 void CSCALCTs2006::add(const std::vector<CSCALCTDigi>& digis) {
0058   //FIXME doesn't do any sorting
0059   if (!digis.empty())
0060     addALCT0(digis[0]);
0061   if (digis.size() > 1)
0062     addALCT1(digis[1]);
0063 }
0064 
0065 void CSCALCTs2006::addALCT0(const CSCALCTDigi& digi) {
0066   alct0_valid = digi.isValid();
0067   alct0_quality = digi.getQuality();
0068   alct0_accel = digi.getAccelerator();
0069   alct0_pattern = digi.getCollisionB();
0070   alct0_key_wire = digi.getKeyWG();
0071   // probably not right
0072   alct0_bxn_low = digi.getBX();
0073 }
0074 
0075 void CSCALCTs2006::addALCT1(const CSCALCTDigi& digi) {
0076   alct1_valid = digi.isValid();
0077   alct1_quality = digi.getQuality();
0078   alct1_accel = digi.getAccelerator();
0079   alct1_pattern = digi.getCollisionB();
0080   alct1_key_wire = digi.getKeyWG();
0081   // probably not right
0082   alct1_bxn_low = digi.getBX();
0083 }