CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/EventFilter/CSCRawToDigi/src/CSCALCTHeader2006.cc

Go to the documentation of this file.
00001 #include "EventFilter/CSCRawToDigi/interface/CSCALCTHeader2006.h"
00002 #include "EventFilter/CSCRawToDigi/interface/CSCDMBHeader.h"
00003 
00004 static int activeFEBsForChamberType[11] = {0,7,7,0xf,7,0x7f, 0xf,0x3f,0xf,0x3f,0xf};
00005 static int nTBinsForChamberType[11] = {7,7,7,7,7,7,7,7,7,7,7};
00006 
00007 
00008 CSCALCTHeader2006::CSCALCTHeader2006(int chamberType) { //constructor for digi->raw packing based on header2006
00009   // we count from 1 to 10, ME11, ME12, ME13, ME1A, ME21, ME22, ....
00010   init();
00011   flag_0 = 0xC;
00012   flag_1 = 0;
00013   reserved_1 = 0;
00014   fifoMode = 1;
00015   // examiner demands this
00016   l1aMatch = 1;
00017   lctChipRead = activeFEBsForChamberType[chamberType];
00018   activeFEBs = lctChipRead;
00019   nTBins = nTBinsForChamberType[chamberType];
00021   //memcpy(theOriginalBuffer, &header2006, header2006.sizeForPacking());
00022 
00023 }
00024 
00025 
00026 void CSCALCTHeader2006::setEventInformation(const CSCDMBHeader & dmb)
00027 {
00028  l1Acc = dmb.l1a();
00029  cscID = dmb.dmbID();
00030  nTBins = 16;
00031  bxnCount = dmb.bxn();
00032 }
00033 
00034 
00035 unsigned short CSCALCTHeader2006::nLCTChipRead() const {
00036   int count = 0;
00037   for(int i=0; i<7; ++i) {
00038     if( (lctChipRead>>i) & 1) ++count;
00039   }
00040   return count;
00041 }
00042 
00043 
00044 
00045 std::vector<CSCALCTDigi> CSCALCTs2006::ALCTDigis() const
00046 {
00047   std::vector<CSCALCTDigi> result;
00048   result.reserve(2);
00049 
00050   CSCALCTDigi digi0(alct0_valid, alct0_quality, alct0_accel,
00051                     alct0_pattern, alct0_key_wire,
00052                     alct0_bxn_low|(alct0_bxn_high<<3),1);
00053   CSCALCTDigi digi1(alct1_valid, alct1_quality, alct1_accel,
00054                     alct1_pattern, alct1_key_wire,
00055                     alct1_bxn_low|(alct1_bxn_high<<3),2);
00056   result.push_back(digi0); result.push_back(digi1);
00057   return result;
00058 }
00059 
00060 
00061 void CSCALCTs2006::add(const std::vector<CSCALCTDigi> & digis)
00062 {
00063   //FIXME doesn't do any sorting
00064   if(digis.size() > 0) addALCT0(digis[0]);
00065   if(digis.size() > 1) addALCT1(digis[1]);
00066 }
00067 
00068 void CSCALCTs2006::addALCT0(const CSCALCTDigi & digi)
00069 {
00070   alct0_valid = digi.isValid();
00071   alct0_quality = digi.getQuality();
00072   alct0_accel = digi.getAccelerator();
00073   alct0_pattern = digi.getCollisionB();
00074   alct0_key_wire = digi.getKeyWG();
00075   // probably not right
00076   alct0_bxn_low = digi.getBX();
00077 }
00078 
00079 
00080 void CSCALCTs2006::addALCT1(const CSCALCTDigi & digi)
00081 {
00082   alct1_valid = digi.isValid();
00083   alct1_quality = digi.getQuality();
00084   alct1_accel = digi.getAccelerator();
00085   alct1_pattern = digi.getCollisionB();
00086   alct1_key_wire = digi.getKeyWG();
00087   // probably not right
00088   alct1_bxn_low = digi.getBX();
00089 }
00090