21 theChamberType(chamberType),
26 for(
unsigned i = 0;
i < 5; ++
i) {
41 unsigned short * pos = buf;
43 LogTrace (
"CSCEventData|CSCRawToDigi") <<
"The event data ";
44 for(
int i = 0;
i < 16; ++
i){
45 LogTrace (
"CSCEventData|CSCRawToDigi") << std::hex << pos[
i ] <<
" ";
51 LogTrace (
"CSCEventData|CSCRawToDigi") <<
"Bad DMB Header??? " <<
" first four words: ";
52 for(
int i = 0;
i < 4; ++
i){
53 LogTrace (
"CSCEventData|CSCRawToDigi") << std::hex << pos[
i ] <<
" ";
59 LogTrace (
"CSCEventData|CSCRawToDigi") <<
"nalct = " <<
nalct();
60 LogTrace (
"CSCEventData|CSCRawToDigi") <<
"nclct = " <<
nclct();
74 LogTrace (
"CSCEventData|CSCRawToDigi") <<
"+++WARNING: Corrupt ALCT data - won't attempt to decode";
103 int sizeInWord_ZSE =0;
112 int nWG_round_up = int(nWGs_per_layer/12)+(nWGs_per_layer%3?1:0);
114 unsigned short * posZSE = pos;
115 std::vector<unsigned short> alctZSErecoveredVector;
116 alctZSErecoveredVector.clear();
140 int alctZSErecoveredPos=0;
141 while (*posZSE != 0xDE0D){
142 if( (*posZSE == 0x1000) && (*posZSE != 0x3000)){
143 for(
int j=0;
j<nWG_round_up;
j++){
144 alctZSErecoveredVector.push_back(0x0000);
146 alctZSErecoveredPos+=nWG_round_up;
149 alctZSErecoveredVector.push_back(*posZSE);
150 ++alctZSErecoveredPos;
159 for(
int l=0;
l<(int)alctZSErecoveredVector.size();
l++){
181 pos +=sizeInWord_ZSE;
194 LogTrace (
"CSCEventData|CSCRawToDigi") <<
"Error:nalct reported but no ALCT data found!!!";
205 LogTrace (
"CSCEventData|CSCRawToDigi") <<
"Error:nclct reported but no TMB data found!!!";
210 bool dmbTrailerReached=
false;
211 for (
int i=0;
i<12000; ++
i) {
213 (*(
i+pos) & 0xF000) == 0xF000 && (*(
i+pos+1) & 0xF000) == 0xF000
214 && (*(
i+pos+2) & 0xF000) == 0xF000 && (*(
i+pos+3) & 0xF000) == 0xF000
215 && (*(
i+pos+4) & 0xF000) == 0xE000 && (*(
i+pos+5) & 0xF000) == 0xE000
216 && (*(
i+pos+6) & 0xF000) == 0xE000 && (*(
i+pos+7) & 0xF000) == 0xE000;
217 if (dmbTrailerReached) {
222 if (dmbTrailerReached) {
223 for(
int icfeb = 0; icfeb < 5; ++icfeb) {
228 if ( cfeb_available==1 ) {
229 if ((cfebTimeout >> icfeb) & 1) {
230 if (
debug)
LogTrace (
"CSCEventData|CSCRawToDigi") <<
"CFEB Timed out! ";
243 LogTrace (
"CSCEventData|CSCRawToDigi") <<
"Critical Error: DMB Trailer was not found!!! ";
248 return (((buf[0]&0xFFFF)==0xDB0A)||(((buf[0]&0xF800)==0x6000)&&((buf[1]&0xF800)==0)));
252 return ((buf[0]&0xFFF)==0xB0C);
280 for(
int icfeb = 0; icfeb < 5; ++icfeb) {
300 for(
int icfeb = 0; icfeb < 5; ++icfeb) {
319 for(
int icfeb = 0; icfeb < 5; ++icfeb) {
331 std::vector<CSCStripDigi>
result;
332 for(
unsigned icfeb = 0; icfeb < 5; ++icfeb){
333 std::vector<CSCStripDigi> newDigis =
stripDigis(idlayer, icfeb);
334 result.insert(result.end(), newDigis.begin(), newDigis.end());
342 std::vector<CSCStripDigi>
result;
345 result.insert(result.end(), newDigis.begin(), newDigis.end());
354 return std::vector<CSCWireDigi>();
363 std::vector < std::vector<CSCStripDigi> >
result;
364 for (
int layer = 1; layer <= 6; ++layer) {
365 std::vector<CSCStripDigi> digis =
stripDigis(layer);
366 result.push_back(digis);
372 std::vector < std::vector<CSCWireDigi> >
result;
373 for (
int layer = 1; layer <= 6; ++layer) {
457 unsigned cfeb = (digi.
getStrip()-1)/16;
458 bool sixteenSamples =
false;
459 if (digi.
getADCCounts().size()==16) sixteenSamples =
true;
501 for(
int ilayer = 1; ilayer <= 6; ++ilayer) {
502 std::vector<CSCStripDigi> stripDigis = evt.
stripDigis(ilayer);
505 std::vector<CSCWireDigi> wireDigis = evt.
wireDigis(ilayer);
533 for(
int icfeb = 0; icfeb < 5; ++icfeb) {
551 std::vector<CSCCLCTDigi> clctDigis;
554 clctDigis.push_back(
CSCCLCTDigi(1, 1, 4, 1, 0, 30, 3, 2, 1));
555 clctDigis.push_back(
CSCCLCTDigi(1, 1, 2, 1, 1, 31, 1, 2, 2));
559 std::vector<CSCCorrelatedLCTDigi> corrDigis;
560 corrDigis.push_back(
CSCCorrelatedLCTDigi(1, 1, 2, 10, 98, 5, 0, 1, 0, 0, 0, 0));
561 corrDigis.push_back(
CSCCorrelatedLCTDigi(2, 1, 2, 20, 15, 9, 1, 0, 0, 0, 0, 0));
563 chamberData.
add(clctDigis);
564 chamberData.
add(corrDigis);
568 chamberData.
add(wireDigi, 3);
569 chamberData.
add(comparatorDigi, 3);
587 std::vector<int> sca(16, 600);
588 std::vector<unsigned short> overflow(16, 0),
overlap(16, 0), errorfl(16,0);
595 forward.
add(me1a, me1adet1.
layer());
596 forward.
add(me1b, me1bdet1.
layer());
597 backward.
add(me1a, me1adet2.
layer());
598 backward.
add(me1b, me1adet2.
layer());
599 std::vector<CSCStripDigi> me1afs = forward.
stripDigis(me1adet1);
600 std::vector<CSCStripDigi> me1bfs = forward.
stripDigis(me1bdet1);
601 std::vector<CSCStripDigi> me1abs = backward.
stripDigis(me1adet2);
602 std::vector<CSCStripDigi> me1bbs = backward.
stripDigis(me1bdet2);
605 assert(me1afs.size() == 16);
606 assert(me1bfs.size() == 16);
607 assert(me1abs.size() == 16);
608 assert(me1bbs.size() == 16);
610 assert(me1afs[4].getStrip() == 5);
611 assert(me1bfs[7].getStrip() == 8);
612 assert(me1abs[4].getStrip() == 5);
613 assert(me1bbs[7].getStrip() == 8);
614 assert(me1afs[4].
pedestal() == 600);
615 assert(me1bfs[7].
pedestal() == 600);
616 assert(me1abs[4].
pedestal() == 600);
617 assert(me1bbs[7].
pedestal() == 600);
void setEventInformation(int bxnum, int lvl1num)
bool isALCT(const short unsigned int *buf)
if dealing with ALCT data
unsigned short int sizeInWords() const
the amount of the input binary buffer read, in 16-bit words
unsigned short * alctZSErecovered
Auxiliary bufer to recove the ALCT raw payload from zero suppression.
int nclct() const
the number of CLCTs
std::vector< std::vector< CSCStripDigi > > stripDigis() const
deprecated. Use the above methods instead
void checkALCTClasses()
makes new ALCT classes, if needed
std::vector< std::vector< CSCWireDigi > > wireDigis() const
deprecated. Use the above method instead.
boost::dynamic_bitset pack()
not const because it sets size int TMBTrailer
std::vector< int > const & getADCCounts() const
Get ADC readings.
const CSCDMBTrailer * dmbTrailer() const
DMB trailer.
void digis(uint32_t idlayer, std::vector< CSCStripDigi > &result)
faster way to get to digis
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...
const unsigned short size() const
void checkTMBClasses()
makes new TMB classes, if needed
void add(const CSCStripDigi &, int layer)
std::ostream & operator<<(std::ostream &out, const ALILine &li)
CSCAnodeData * alctData() const
user must check if nalct > 0
std::vector< CSCWireDigi > wireDigis(unsigned ilayer) const
CSCALCTHeader * alctHeader() const
user must check if nalct > 0
int nalct() const
the flag for existence of ALCT data
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
static int sizeInWords()
in 16-bit frames
uint32_t rawId() const
get the raw id
CSCDMBHeader theDMBHeader
CSCCLCTData * clctData() const
user must check if nclct > 0
CSCALCTTrailer * alctTrailer() const
user must check if nalct > 0
CSCALCTHeader * theALCTHeader
std::vector< CSCStripDigi > stripDigis(const CSCDetId &idlayer) const
returns all the strip digis in the chamber, with the comparator information.
unsigned cfeb_starttimeout
CSCTMBData * tmbData() const
user must check in nclct > 0
void add(const CSCWireDigi &wireDigi, int layer)
CSCDMBTrailer theDMBTrailer
void unpack_data(unsigned short *buf)
CSCEventData operator=(const CSCEventData &data)
CSCALCTTrailer * theALCTTrailer
bool isTMB(const short unsigned int *buf)
if dealing with TMB data
int getWireGroup() const
default
void copy(const CSCEventData &)
std::vector< CSCWireDigi > wireDigis(int layer) const
input layer is from 1 to 6
void add(const CSCComparatorDigi &digi, int layer)
TODO for packing. Doesn't do flipping yet.
unsigned sizeInWords() const
unsigned short size() const
size of the data buffer used, in bytes
bool cscPackerCompare(const T &t1, const T &t2)
void add(const CSCStripDigi &, int layer)
routines to add digis to the data
CSCTMBHeader * tmbHeader()
CSCTMBHeader * tmbHeader() const
user must check if nclct > 0
char data[epos_bytes_allocation]
CSCCFEBData * cfebData(unsigned icfeb) const
unpacked in long mode: has overflow and error bits decoded
boost::dynamic_bitset ushortToBitset(const unsigned int numberOfBits, unsigned short *buf)
this method takes numberOfBits bits from unsigned short * array and returns them in the bitset obj...
boost::dynamic_bitset pack()
returns the packed event data.
static unsigned sizeInWords()
CSCAnodeData * theAnodeData
CSCCFEBData * theCFEBData[5]
for up to 5 CFEB boards