CMS 3D CMS Logo

CSCEventData Class Reference

#include <EventFilter/CSCRawToDigi/interface/CSCEventData.h>

List of all members.

Public Member Functions

void add (const std::vector< CSCCorrelatedLCTDigi > &)
void add (const std::vector< CSCCLCTDigi > &)
void add (const std::vector< CSCALCTDigi > &)
 these go in as vectors, so they get sorted right away
void add (const CSCComparatorDigi &, int layer)
void add (const CSCWireDigi &, int layer)
void add (const CSCStripDigi &, int layer)
 routines to add digis to the data
void addALCTStructures ()
 adds an empty ALCTHeader, trailer, and anode data
CSCAnodeDataalctData () const
 user must check if nalct > 0
CSCALCTHeaderalctHeader () const
 user must check if nalct > 0
CSCALCTTraileralctTrailer () const
 user must check if nalct > 0
CSCCFEBDatacfebData (unsigned icfeb) const
 unpacked in long mode: has overflow and error bits decoded
int chamberType () const
 might not be set in real data
CSCCLCTDataclctData () const
 user must check if nclct > 0
 CSCEventData (const CSCEventData &data)
 CSCEventData ()
 CSCEventData (unsigned short *buf)
 should make const input soon
 CSCEventData (int chamberType)
CSCDMBHeaderdmbHeader ()
const CSCDMBHeaderdmbHeader () const
 the DAQ motherboard header. A good place for event and chamber info
const CSCDMBTrailerdmbTrailer () const
 DMB trailer.
bool isALCT (const short unsigned int *buf)
 if dealing with ALCT data
bool isTMB (const short unsigned int *buf)
 if dealing with TMB data
int nalct () const
 the flag for existence of ALCT data
int nclct () const
 the number of CLCTs
CSCEventData operator= (const CSCEventData &data)
boost::dynamic_bitset pack ()
 returns the packed event data.
void setEventInformation (int bxnum, int lvl1num)
 this will fill the DMB header, and change all related fields in the DMBTrailer, ALCTHeader, and TMBHeader
unsigned short size () const
 size of the data buffer used, in bytes
std::vector< std::vector
< CSCStripDigi > > 
stripDigis () const
 deprecated. Use the above methods instead
std::vector< CSCStripDigistripDigis (unsigned idlayer, unsigned icfeb) const
 returns all the strip digis in the chamber's cfeb
std::vector< CSCStripDigistripDigis (unsigned ilayer) const
 returns all the strip digis in the chamber, with the comparator information.
CSCTMBDatatmbData () const
 user must check in nclct > 0
CSCTMBHeadertmbHeader () const
 user must check if nclct > 0
std::vector< std::vector
< CSCWireDigi > > 
wireDigis () const
 deprecated. Use the above method instead.
std::vector< CSCWireDigiwireDigis (unsigned ilayer) const
 ~CSCEventData ()
 since we need deep copies, need the Big Three (destructor, copy ctor, op=)

Static Public Member Functions

static void selfTest ()
static void setDebug (const bool value)
 turns on/off debug flag for this class

Static Public Attributes

static bool debug = false

Private Member Functions

void addComparatorInformation (std::vector< CSCStripDigi > &, int layer) const
 adds the comparators to the strip digis
void checkALCTClasses ()
 makes new ALCT classes, if needed
void checkTMBClasses ()
 makes new TMB classes, if needed
void copy (const CSCEventData &)
void destroy ()
void init ()
 helpers for ctors, dtor, and op= zeroes all pointers

Private Attributes

int size_
CSCALCTHeadertheALCTHeader
 these may or may not be present.
CSCALCTTrailertheALCTTrailer
CSCAnodeDatatheAnodeData
CSCCFEBDatatheCFEBData [5]
 for up to 5 CFEB boards
int theChamberType
 this won't be filled when real data is read it.
CSCDMBHeader theDMBHeader
CSCDMBTrailer theDMBTrailer
CSCTMBDatatheTMBData


Detailed Description

Definition at line 35 of file CSCEventData.h.


Constructor & Destructor Documentation

CSCEventData::CSCEventData ( int  chamberType  )  [explicit]

Definition at line 14 of file CSCEventData.cc.

References i, and theCFEBData.

00014                                           : 
00015   theDMBHeader(), 
00016   theALCTHeader(0), 
00017   theAnodeData(0),
00018   theALCTTrailer(0),
00019   theTMBData(0),
00020   theDMBTrailer(),
00021   theChamberType(chamberType){
00022   
00023   for(unsigned i = 0; i < 5; ++i) {
00024     theCFEBData[i] = 0;
00025   }
00026 }

CSCEventData::CSCEventData ( unsigned short *  buf  ) 

should make const input soon

Definition at line 29 of file CSCEventData.cc.

References CSCALCTHeader::ALCTDigis(), CSCDMBTrailer::cfeb_endtimeout, CSCDMBTrailer::cfeb_starttimeout, CSCDMBHeader::cfebAvailable(), CSCDMBHeader::check(), CSCALCTHeader::check(), debug, i, init(), isALCT(), isTMB(), LogTrace, nalct(), nclct(), CSCTMBData::size(), size_, CSCDMBHeader::sizeInWords(), CSCALCTHeader::sizeInWords(), CSCAnodeData::sizeInWords(), CSCALCTTrailer::sizeInWords(), CSCCFEBData::sizeInWords(), CSCDMBTrailer::sizeInWords(), theALCTHeader, theALCTTrailer, theAnodeData, theCFEBData, theDMBHeader, theDMBTrailer, and theTMBData.

00029                                               {
00030   // zero everything
00031   init();
00032   unsigned short * pos = buf;
00033   if(debug)    {
00034     LogTrace ("CSCEventData|CSCRawToDigi") << "The event data ";
00035     for(int i = 0; i < 16; ++i){
00036       LogTrace ("CSCEventData|CSCRawToDigi") << std::hex << pos[i ] << " ";
00037     }
00038     }
00039    
00040   theDMBHeader = CSCDMBHeader(pos);
00041   if(!(theDMBHeader.check())) {
00042     LogTrace ("CSCEventData|CSCRawToDigi")  << "Bad DMB Header??? " << " first four words: ";
00043     for(int i = 0; i < 4; ++i){
00044       LogTrace ("CSCEventData|CSCRawToDigi") << std::hex << pos[i ] << " ";
00045     }
00046   }
00047   
00048       
00049   if (debug) {
00050     LogTrace ("CSCEventData|CSCRawToDigi") << "nalct = " << nalct();
00051     LogTrace ("CSCEventData|CSCRawToDigi") << "nclct = " << nclct();
00052   }
00053 
00054   if (debug)  {
00055     LogTrace ("CSCEventData|CSCRawToDigi") << "size in words of DMBHeader" << theDMBHeader.sizeInWords();
00056     LogTrace ("CSCEventData|CSCRawToDigi") << "sizeof(DMBHeader)" << sizeof(theDMBHeader); 
00057   }
00058    
00059   pos += theDMBHeader.sizeInWords();
00060 
00061   if (nalct() ==1)  {
00062     if (isALCT(pos)) {//checking for ALCTData
00063       theALCTHeader = new CSCALCTHeader( pos );
00064       if(!theALCTHeader->check()){  
00065         LogTrace ("CSCEventData|CSCRawToDigi") <<"+++WARNING: Corrupt ALCT data - won't attempt to decode";
00066       } 
00067       else {
00068         //dataPresent|=0x40;
00069         pos += theALCTHeader->sizeInWords(); //size of the header
00070         //fill ALCT Digis
00071         theALCTHeader->ALCTDigis();    
00072         theAnodeData = new CSCAnodeData(*theALCTHeader, pos);  
00073         pos += theAnodeData->sizeInWords(); // size of the data is determined during unpacking
00074         theALCTTrailer = new CSCALCTTrailer( pos );
00075         pos += theALCTTrailer->sizeInWords();
00076       }
00077     } 
00078     else {
00079       LogTrace ("CSCEventData|CSCRawToDigi") << "Error:nalct reported but no ALCT data found!!!";
00080     }
00081   }
00082 
00083   if (nclct() ==1)  {
00084     if (isTMB(pos)) {
00085       //dataPresent|=0x20;
00086       theTMBData = new CSCTMBData(pos);  //fill all TMB data
00087       pos += theTMBData->size();
00088     }
00089     else {
00090       LogTrace ("CSCEventData|CSCRawToDigi") << "Error:nclct reported but no TMB data found!!!";
00091     }
00092   }
00093 
00094   //now let's try to find and unpack the DMBTrailer
00095   bool dmbTrailerReached= false;
00096   for (int i=0; i<12000; ++i) {//8000 max for cfeb + 1980ALCT + 287 TMB
00097     dmbTrailerReached =
00098       (*(i+pos) & 0xF000) == 0xF000 && (*(i+pos+1) & 0xF000) == 0xF000
00099       && (*(i+pos+2) & 0xF000) == 0xF000 && (*(i+pos+3) & 0xF000) == 0xF000
00100       && (*(i+pos+4) & 0xF000) == 0xE000 && (*(i+pos+5) & 0xF000) == 0xE000
00101       && (*(i+pos+6) & 0xF000) == 0xE000 && (*(i+pos+7) & 0xF000) == 0xE000;
00102     if (dmbTrailerReached) {
00103       theDMBTrailer = *( (CSCDMBTrailer *) (pos+i) );
00104       break;
00105     }
00106   }
00107   if (dmbTrailerReached) {
00108     for(int icfeb = 0; icfeb < 5; ++icfeb)  {
00109       theCFEBData[icfeb] = 0;
00110       int cfeb_available = theDMBHeader.cfebAvailable(icfeb);
00111       unsigned int cfebTimeout = theDMBTrailer.cfeb_starttimeout | theDMBTrailer.cfeb_endtimeout;    
00112       //cfeb_available cannot be trusted - need additional verification!
00113       if ( cfeb_available==1 )   {
00114         if ((cfebTimeout >> icfeb) & 1) {
00115           if (debug) LogTrace ("CSCEventData|CSCRawToDigi") << "CFEB Timed out! ";
00116         } else {
00117           //dataPresent|=(0x1>>icfeb);
00118           // Fill CFEB data and convert it into cathode digis
00119           theCFEBData[icfeb] = new CSCCFEBData(icfeb, pos);
00120           pos += theCFEBData[icfeb]->sizeInWords();
00121         }
00122       }
00123     }   
00124     pos += theDMBTrailer.sizeInWords();
00125     size_ = pos-buf;
00126   }
00127   else {
00128     LogTrace ("CSCEventData|CSCRawToDigi") << "Critical Error: DMB Trailer was not found!!! ";
00129   }
00130 }

CSCEventData::CSCEventData (  )  [inline]

Definition at line 40 of file CSCEventData.h.

00040 {}

CSCEventData::~CSCEventData (  ) 

since we need deep copies, need the Big Three (destructor, copy ctor, op=)

Definition at line 146 of file CSCEventData.cc.

References destroy().

00146                             {
00147   destroy();
00148 }

CSCEventData::CSCEventData ( const CSCEventData data  ) 

Definition at line 142 of file CSCEventData.cc.

References copy().

00142                                                     {
00143   copy(data);
00144 }


Member Function Documentation

void CSCEventData::add ( const std::vector< CSCCorrelatedLCTDigi > &  digis  ) 

Definition at line 373 of file CSCEventData.cc.

References CSCTMBHeader::add(), checkTMBClasses(), theTMBData, and CSCTMBData::tmbHeader().

00373                                                                     {
00374   checkTMBClasses();
00375   theTMBData->tmbHeader()->add(digis);
00376 }

void CSCEventData::add ( const std::vector< CSCCLCTDigi > &  digis  ) 

Definition at line 368 of file CSCEventData.cc.

References CSCTMBHeader::add(), checkTMBClasses(), theTMBData, and CSCTMBData::tmbHeader().

00368                                                            {
00369   checkTMBClasses();
00370   theTMBData->tmbHeader()->add(digis);
00371 }

void CSCEventData::add ( const std::vector< CSCALCTDigi > &  digis  ) 

these go in as vectors, so they get sorted right away

Definition at line 362 of file CSCEventData.cc.

References CSCALCTHeader::add(), checkALCTClasses(), and theALCTHeader.

00362                                                            {
00363   checkALCTClasses();
00364   theALCTHeader->add(digis);
00365 }

void CSCEventData::add ( const CSCComparatorDigi digi,
int  layer 
)

Definition at line 355 of file CSCEventData.cc.

References CSCCLCTData::add(), checkTMBClasses(), CSCTMBData::clctData(), and theTMBData.

00355                                                                 {
00356   checkTMBClasses();
00357   theTMBData->clctData()->add(digi, layer);
00358 }

void CSCEventData::add ( const CSCWireDigi digi,
int  layer 
)

Definition at line 349 of file CSCEventData.cc.

References CSCAnodeData::add(), checkALCTClasses(), CSCWireDigi::getWireGroup(), CSCALCTHeader::setDAVForChannel(), theALCTHeader, and theAnodeData.

00349                                                           {
00350   checkALCTClasses();
00351   theAnodeData->add(digi, layer);
00352   theALCTHeader->setDAVForChannel(digi.getWireGroup());
00353 }

void CSCEventData::add ( const CSCStripDigi digi,
int  layer 
)

routines to add digis to the data

Definition at line 336 of file CSCEventData.cc.

References CSCCFEBData::add(), CSCDMBHeader::addCFEB(), CSCStripDigi::getADCCounts(), CSCStripDigi::getStrip(), theCFEBData, and theDMBHeader.

Referenced by CSCDigiToRaw::add(), and selfTest().

00336                                                            {
00337   //@@ need special logic here for ME11
00338   unsigned cfeb = (digi.getStrip()-1)/16;
00339   bool sixteenSamples = false;
00340   if (digi.getADCCounts().size()==16) sixteenSamples = true;  
00341   if(theCFEBData[cfeb] == 0)    {
00342     theCFEBData[cfeb] = new CSCCFEBData(cfeb, sixteenSamples);
00343     theDMBHeader.addCFEB(cfeb);
00344   }
00345   theCFEBData[cfeb]->add(digi, layer);
00346 }

void CSCEventData::addALCTStructures (  ) 

adds an empty ALCTHeader, trailer, and anode data

void CSCEventData::addComparatorInformation ( std::vector< CSCStripDigi > &  ,
int  layer 
) const [private]

adds the comparators to the strip digis

CSCAnodeData * CSCEventData::alctData (  )  const

user must check if nalct > 0

Definition at line 276 of file CSCEventData.cc.

References Exception, nalct(), and theAnodeData.

Referenced by cscdqm::EventProcessor::processCSC().

00276                                             {
00277   if(nalct() == 0) throw cms::Exception("No ALCT for this chamber");
00278   return theAnodeData;
00279 }

CSCALCTHeader * CSCEventData::alctHeader (  )  const

user must check if nalct > 0

Definition at line 265 of file CSCEventData.cc.

References Exception, nalct(), and theALCTHeader.

Referenced by CSCMonitorModule::monitorCSC(), pack(), and cscdqm::EventProcessor::processCSC().

00265                                              {
00266   if(nalct() == 0) throw cms::Exception("No ALCT for this chamber");
00267   return theALCTHeader;
00268 }

CSCALCTTrailer * CSCEventData::alctTrailer (  )  const

user must check if nalct > 0

Definition at line 270 of file CSCEventData.cc.

References Exception, nalct(), and theALCTTrailer.

Referenced by pack(), and cscdqm::EventProcessor::processCSC().

00270                                                 {
00271   if(nalct() == 0) throw cms::Exception("No ALCT for this chamber");
00272   return theALCTTrailer;
00273 }

CSCCFEBData * CSCEventData::cfebData ( unsigned  icfeb  )  const

unpacked in long mode: has overflow and error bits decoded

Definition at line 260 of file CSCEventData.cc.

References theCFEBData.

Referenced by CSCMonitorModule::monitorCSC(), pack(), and cscdqm::EventProcessor::processCSC().

00260                                                         {
00261   return theCFEBData[icfeb];
00262 }

int CSCEventData::chamberType (  )  const [inline]

might not be set in real data

Definition at line 133 of file CSCEventData.h.

References theChamberType.

00133 {return theChamberType;}

void CSCEventData::checkALCTClasses (  )  [private]

makes new ALCT classes, if needed

Definition at line 310 of file CSCEventData.cc.

References CSCDMBHeader::addNALCT(), NULL, CSCALCTHeader::setEventInformation(), size(), CSCAnodeData::sizeInWords(), CSCALCTHeader::sizeInWords(), CSCALCTTrailer::sizeInWords(), theALCTHeader, theALCTTrailer, theAnodeData, theChamberType, and theDMBHeader.

Referenced by add().

00310                                     {
00311   if(theAnodeData == NULL)
00312   {
00313     assert(theChamberType>0);
00314     theALCTHeader = new CSCALCTHeader(theChamberType);
00315     theALCTHeader->setEventInformation(theDMBHeader);
00316     theAnodeData = new CSCAnodeData(*theALCTHeader);
00317     int size = theALCTHeader->sizeInWords() + theAnodeData->sizeInWords() + CSCALCTTrailer::sizeInWords();
00318     int firmwareVersion = 2006;
00319     theALCTTrailer = new CSCALCTTrailer(size, firmwareVersion);
00320     // set data available flag
00321     theDMBHeader.addNALCT();
00322   }
00323 }

void CSCEventData::checkTMBClasses (  )  [private]

makes new TMB classes, if needed

Definition at line 326 of file CSCEventData.cc.

References CSCDMBHeader::addNCLCT(), NULL, CSCTMBHeader::setEventInformation(), theDMBHeader, theTMBData, and CSCTMBData::tmbHeader().

Referenced by add().

00327 {
00328   if(theTMBData == NULL)    {
00329     theTMBData = new CSCTMBData();
00330     theTMBData->tmbHeader()->setEventInformation(theDMBHeader);
00331     theDMBHeader.addNCLCT();
00332   }
00333 }

CSCCLCTData * CSCEventData::clctData (  )  const

user must check if nclct > 0

Definition at line 292 of file CSCEventData.cc.

References CSCTMBData::clctData(), Exception, nclct(), NULL, and tmbData().

Referenced by cscdqm::EventProcessor::processCSC().

00292                                            {
00293   if((nclct() == 0)||(tmbData()==NULL)) throw cms::Exception("No CLCT data for this chamber");
00294   return tmbData()->clctData();
00295 }

void CSCEventData::copy ( const CSCEventData data  )  [private]

Definition at line 171 of file CSCEventData.cc.

References init(), NULL, size_, theALCTHeader, theALCTTrailer, theAnodeData, theCFEBData, theChamberType, theDMBHeader, theDMBTrailer, and theTMBData.

Referenced by CSCEventData(), and operator=().

00171                                                  {
00172   init();
00173   theDMBHeader  = data.theDMBHeader;
00174   theDMBTrailer = data.theDMBTrailer;
00175   if(data.theALCTHeader != NULL)
00176     theALCTHeader  = new CSCALCTHeader(*(data.theALCTHeader));
00177   if(data.theAnodeData != NULL) 
00178     theAnodeData   = new CSCAnodeData(*(data.theAnodeData));
00179   if(data.theALCTTrailer != NULL) 
00180     theALCTTrailer = new CSCALCTTrailer(*(data.theALCTTrailer));
00181   if(data.theTMBData != NULL) 
00182     theTMBData     = new CSCTMBData(*(data.theTMBData));
00183   for(int icfeb = 0; icfeb < 5; ++icfeb) {
00184     theCFEBData[icfeb] = 0;
00185     if(data.theCFEBData[icfeb] != NULL) 
00186       theCFEBData[icfeb] = new CSCCFEBData(*(data.theCFEBData[icfeb]));
00187   }   
00188   size_  = data.size_;
00189   theChamberType = data.theChamberType;
00190   
00191 }

void CSCEventData::destroy (  )  [private]

Definition at line 194 of file CSCEventData.cc.

References theALCTHeader, theALCTTrailer, theAnodeData, theCFEBData, and theTMBData.

Referenced by operator=(), and ~CSCEventData().

00194                            {
00195   delete theALCTHeader;
00196   delete theAnodeData;
00197   delete theALCTTrailer;
00198   delete theTMBData;
00199   for(int icfeb = 0; icfeb < 5; ++icfeb) {
00200     delete theCFEBData[icfeb];
00201   }
00202 }

CSCDMBHeader* CSCEventData::dmbHeader (  )  [inline]

Definition at line 90 of file CSCEventData.h.

References theDMBHeader.

00090 {return &theDMBHeader;}

const CSCDMBHeader* CSCEventData::dmbHeader (  )  const [inline]

the DAQ motherboard header. A good place for event and chamber info

Definition at line 89 of file CSCEventData.h.

References theDMBHeader.

Referenced by CSCDDUEventData::add(), CSCDigiToRaw::findEventData(), CSCMonitorModule::monitorCSC(), and cscdqm::EventProcessor::processCSC().

00089 {return &theDMBHeader;}

const CSCDMBTrailer* CSCEventData::dmbTrailer (  )  const [inline]

DMB trailer.

Definition at line 111 of file CSCEventData.h.

References theDMBTrailer.

Referenced by CSCMonitorModule::monitorCSC(), pack(), and cscdqm::EventProcessor::processCSC().

00111 {return &theDMBTrailer;}

void CSCEventData::init ( void   )  [private]

helpers for ctors, dtor, and op= zeroes all pointers

Definition at line 159 of file CSCEventData.cc.

References theALCTHeader, theALCTTrailer, theAnodeData, theCFEBData, and theTMBData.

Referenced by copy(), and CSCEventData().

00159                         {
00160   //dataPresent = 0;
00161   theALCTHeader = 0;
00162   theAnodeData = 0;
00163   theALCTTrailer = 0;
00164   theTMBData = 0;
00165   for(int icfeb = 0; icfeb < 5; ++icfeb) {
00166     theCFEBData[icfeb] = 0;
00167   }
00168 }

bool CSCEventData::isALCT ( const short unsigned int buf  ) 

if dealing with ALCT data

Definition at line 132 of file CSCEventData.cc.

Referenced by CSCEventData().

00132                                                         {
00133   return (((buf[0]&0xFFFF)==0xDB0A)||(((buf[0]&0xF800)==0x6000)&&((buf[1]&0xF800)==0)));
00134 }

bool CSCEventData::isTMB ( const short unsigned int buf  ) 

if dealing with TMB data

Definition at line 136 of file CSCEventData.cc.

Referenced by CSCEventData().

00136                                                        {
00137   return ((buf[0]&0xFFF)==0xB0C);
00138 }

int CSCEventData::nalct (  )  const [inline]

the flag for existence of ALCT data

Definition at line 83 of file CSCEventData.h.

References CSCDMBHeader::nalct(), and theDMBHeader.

Referenced by alctData(), alctHeader(), alctTrailer(), CSCEventData(), CSCMonitorModule::monitorCSC(), and cscdqm::EventProcessor::processCSC().

00083 {return theDMBHeader.nalct();}

int CSCEventData::nclct (  )  const [inline]

the number of CLCTs

Definition at line 86 of file CSCEventData.h.

References CSCDMBHeader::nclct(), and theDMBHeader.

Referenced by clctData(), CSCEventData(), CSCMonitorModule::monitorCSC(), cscdqm::EventProcessor::processCSC(), tmbData(), and tmbHeader().

00086 {return theDMBHeader.nclct();}

CSCEventData CSCEventData::operator= ( const CSCEventData data  ) 

Definition at line 151 of file CSCEventData.cc.

References copy(), and destroy().

00151                                                               {
00152   // check for self-assignment before destructing
00153   if(&data != this) destroy();
00154   copy(data);
00155   return *this;
00156 }

boost::dynamic_bitset CSCEventData::pack (  ) 

returns the packed event data.

Definition at line 392 of file CSCEventData.cc.

References alctHeader(), alctTrailer(), bitset_utilities::append(), cfebData(), CSCALCTTrailer::data(), CSCDMBTrailer::data(), data, CSCDMBHeader::data(), CSCAnodeData::data(), dmbTrailer(), NULL, CSCTMBData::pack(), CSCALCTHeader::pack(), HLT_VtxMuL3::result, CSCDMBHeader::sizeInWords(), CSCAnodeData::sizeInWords(), CSCALCTTrailer::sizeInWords(), CSCDMBTrailer::sizeInWords(), theALCTHeader, theALCTTrailer, theAnodeData, theCFEBData, theDMBHeader, theDMBTrailer, theTMBData, and bitset_utilities::ushortToBitset().

00392                                          {
00393   boost::dynamic_bitset<> result = bitset_utilities::ushortToBitset( theDMBHeader.sizeInWords()*16, 
00394                                                                      theDMBHeader.data());
00395 
00396   if(theALCTHeader != NULL)     {
00397     boost::dynamic_bitset<> alctHeader = theALCTHeader->pack();
00398     result = bitset_utilities::append(result, alctHeader);
00399   }
00400   if(theAnodeData != NULL) {
00401     boost::dynamic_bitset<> anodeData = bitset_utilities::ushortToBitset (theAnodeData->sizeInWords()*16,
00402                                                                           theAnodeData->data());
00403     result = bitset_utilities::append(result, anodeData);
00404   }
00405   if(theALCTTrailer != NULL)  {
00406     boost::dynamic_bitset<> alctTrailer =bitset_utilities::ushortToBitset(theALCTTrailer->sizeInWords()*16,
00407                                                                           theALCTTrailer->data());
00408     result = bitset_utilities::append(result, alctTrailer);
00409   }
00410   if(theTMBData != NULL)  {
00411     result  = bitset_utilities::append(result, theTMBData->pack());
00412   }
00413 
00414   for(int icfeb = 0;  icfeb < 5;  ++icfeb)  {
00415     if(theCFEBData[icfeb] != NULL){
00416       boost::dynamic_bitset<> cfebData = bitset_utilities::ushortToBitset(theCFEBData[icfeb]->sizeInWords()*16,
00417                                                                           theCFEBData[icfeb]->data());
00418       result = bitset_utilities::append(result, cfebData);
00419     }
00420   }
00421   
00422   boost::dynamic_bitset<> dmbTrailer = bitset_utilities::ushortToBitset( theDMBTrailer.sizeInWords()*16,
00423                                                                          theDMBTrailer.data());
00424   result = bitset_utilities::append(result, dmbTrailer);
00425   return result;
00426 }

void CSCEventData::selfTest (  )  [static]

Definition at line 429 of file CSCEventData.cc.

References add(), CSCTMBHeader::CLCTDigis(), CSCTMBHeader::CorrelatedLCTDigis(), cscPackAndUnpack(), cscPackerCompare(), detId, CSCDetId::layer(), pedestal, DetId::rawId(), stripDigis(), and tmbHeader().

00429                             {
00430   CSCEventData chamberData(5);
00431   CSCDetId detId(1, 3, 2, 1, 3);
00432   std::vector<CSCCLCTDigi> clctDigis;
00433   // Both CLCTs are read-out at the same (pre-trigger) bx, so the last-but-one
00434   // arguments in both digis must be the same.
00435   clctDigis.push_back(CSCCLCTDigi(1, 1, 4, 1, 0, 30, 3, 2, 1)); // valid for 2007
00436   clctDigis.push_back(CSCCLCTDigi(1, 1, 2, 1, 1, 31, 1, 2, 2));
00437   
00438   // BX of LCT (8th argument) is 1-bit word (the least-significant bit
00439   // of ALCT's bx).
00440   std::vector<CSCCorrelatedLCTDigi> corrDigis;
00441   corrDigis.push_back(CSCCorrelatedLCTDigi(1, 1, 2, 10, 98, 5, 0, 1, 0, 0, 0, 0));
00442   corrDigis.push_back(CSCCorrelatedLCTDigi(2, 1, 2, 20, 15, 9, 1, 0, 0, 0, 0, 0));
00443 
00444   chamberData.add(clctDigis);
00445   chamberData.add(corrDigis);
00446 
00447   CSCWireDigi wireDigi(10, 6);
00448   CSCComparatorDigi comparatorDigi(30, 1, 6);
00449   chamberData.add(wireDigi, 3);
00450   chamberData.add(comparatorDigi, 3);
00451 
00452   CSCEventData newData = cscPackAndUnpack(chamberData);
00453 
00454   std::vector<CSCCLCTDigi> clcts = newData.tmbHeader()->CLCTDigis(detId.rawId());
00455   assert(cscPackerCompare(clcts[0],clctDigis[0]));
00456   assert(cscPackerCompare(clcts[1],clctDigis[1]));
00457 
00458   std::vector<CSCCorrelatedLCTDigi> lcts = newData.tmbHeader()->CorrelatedLCTDigis(detId.rawId());
00459   assert(cscPackerCompare(lcts[0], corrDigis[0]));
00460   assert(cscPackerCompare(lcts[1], corrDigis[1]));
00461 
00462   // test strip digis
00463   CSCDetId me1adet1(1, 1, 1, 4, 1);
00464   CSCDetId me1bdet1(1, 1, 4, 4, 6);
00465   CSCDetId me1adet2(2, 1, 1, 4, 2);
00466   CSCDetId me1bdet2(2, 1, 4, 4, 5);
00467 
00468   std::vector<int> sca(16, 600);
00469   std::vector<unsigned short> overflow(16, 0), overlap(16, 0), errorfl(16,0);
00470   CSCStripDigi me1a(5, sca, overflow, overlap, errorfl);
00471   CSCStripDigi me1b(8, sca, overflow, overlap, errorfl);
00472 
00473   CSCEventData forward(1);
00474   CSCEventData backward(1);
00475   
00476   forward.add(me1a, me1adet1.layer());
00477   forward.add(me1b, me1bdet1.layer());
00478   backward.add(me1a, me1adet2.layer());
00479   backward.add(me1b, me1adet2.layer());
00480 
00481   std::vector<CSCStripDigi> me1afs = forward.stripDigis(me1adet1.layer());
00482   std::vector<CSCStripDigi> me1bfs = forward.stripDigis(me1bdet1.layer());
00483   std::vector<CSCStripDigi> me1abs = backward.stripDigis(me1adet2.layer());
00484   std::vector<CSCStripDigi> me1bbs = backward.stripDigis(me1bdet2.layer());
00485 
00486   //FIXME The current code works under the assumption that ME11 and ME1A
00487   // go into separate EventData.  They need to be combined.
00488   assert(me1afs.size() == 16);
00489   assert(me1bfs.size() == 16);
00490   assert(me1abs.size() == 16);
00491   assert(me1bbs.size() == 16);
00492   assert(me1afs[4].getStrip() == 5);
00493   assert(me1bfs[7].getStrip() == 8);
00494   assert(me1abs[4].getStrip() == 5);
00495   assert(me1bbs[7].getStrip() == 8);
00496   assert(me1afs[4].pedestal() == 600);
00497   assert(me1bfs[7].pedestal() == 600);
00498   assert(me1abs[4].pedestal() == 600);
00499   assert(me1bbs[7].pedestal() == 600);
00500 
00501 
00502 }

static void CSCEventData::setDebug ( const bool  value  )  [inline, static]

turns on/off debug flag for this class

Definition at line 51 of file CSCEventData.h.

References debug.

Referenced by CSCDCCUnpacker::CSCDCCUnpacker().

00051 {debug = value;}

void CSCEventData::setEventInformation ( int  bxnum,
int  lvl1num 
)

this will fill the DMB header, and change all related fields in the DMBTrailer, ALCTHeader, and TMBHeader

Definition at line 298 of file CSCEventData.cc.

References CSCDMBHeader::setBXN(), CSCALCTHeader::setEventInformation(), CSCTMBHeader::setEventInformation(), CSCDMBHeader::setL1A(), theALCTHeader, theDMBHeader, theTMBData, and CSCTMBData::tmbHeader().

Referenced by CSCDDUEventData::add().

00298                                                              {
00299   theDMBHeader.setBXN(bxnum);
00300   theDMBHeader.setL1A(lvl1num);
00301   if(theALCTHeader)     {
00302     theALCTHeader->setEventInformation(theDMBHeader);
00303   }
00304   if(theTMBData)  {
00305     theTMBData->tmbHeader()->setEventInformation(theDMBHeader);
00306   }
00307 }

unsigned short CSCEventData::size ( void   )  const [inline]

size of the data buffer used, in bytes

Definition at line 48 of file CSCEventData.h.

References size_.

Referenced by checkALCTClasses().

00048 {return size_;}

std::vector< std::vector< CSCStripDigi > > CSCEventData::stripDigis (  )  const

deprecated. Use the above methods instead

Definition at line 242 of file CSCEventData.cc.

References HLT_VtxMuL3::result.

Referenced by operator<<().

00242                                                                      {
00243   std::vector < std::vector<CSCStripDigi> > result;
00244   for (int layer = 1; layer <= 6; ++layer) {
00245     std::vector<CSCStripDigi> digis = stripDigis(layer);
00246     result.push_back(digis);
00247   }
00248   return result;
00249 }

std::vector< CSCStripDigi > CSCEventData::stripDigis ( unsigned  idlayer,
unsigned  icfeb 
) const

returns all the strip digis in the chamber's cfeb

Definition at line 219 of file CSCEventData.cc.

References CSCCFEBData::digis(), NULL, HLT_VtxMuL3::result, and theCFEBData.

00219                                                                                        {
00220   //  assert(ilayer > 0 && ilayer <= 6); // off because now idlayer is raw cscdetid
00221   std::vector<CSCStripDigi> result;
00222   if(theCFEBData[icfeb] != NULL) {
00223     std::vector<CSCStripDigi> newDigis = theCFEBData[icfeb]->digis(idlayer);
00224     result.insert(result.end(), newDigis.begin(), newDigis.end());
00225   }
00226   
00227 
00228   return result;
00229 }

std::vector< CSCStripDigi > CSCEventData::stripDigis ( unsigned  ilayer  )  const

returns all the strip digis in the chamber, with the comparator information.

Definition at line 205 of file CSCEventData.cc.

References CSCCFEBData::digis(), NULL, HLT_VtxMuL3::result, and theCFEBData.

Referenced by operator<<(), and selfTest().

00205                                                                       {
00206   assert(ilayer > 0 && ilayer <= 6);
00207   std::vector<CSCStripDigi> result;
00208   for(unsigned icfeb = 0; icfeb < 5; ++icfeb){
00209     if(theCFEBData[icfeb] != NULL) {
00210       std::vector<CSCStripDigi> newDigis = theCFEBData[icfeb]->digis(ilayer);
00211       result.insert(result.end(), newDigis.begin(), newDigis.end());
00212     }
00213   }
00214   
00215   return result;
00216 }

CSCTMBData * CSCEventData::tmbData (  )  const

user must check in nclct > 0

Definition at line 281 of file CSCEventData.cc.

References Exception, nclct(), and theTMBData.

Referenced by clctData(), CSCMonitorModule::monitorCSC(), cscdqm::EventProcessor::processCSC(), and tmbHeader().

00281                                          {
00282   if(nclct() == 0) throw cms::Exception("No CLCT for this chamber");
00283   return theTMBData;
00284 }

CSCTMBHeader * CSCEventData::tmbHeader (  )  const

user must check if nclct > 0

Definition at line 287 of file CSCEventData.cc.

References Exception, nclct(), NULL, tmbData(), and CSCTMBData::tmbHeader().

Referenced by selfTest().

00287                                              {
00288   if((nclct() == 0)||(tmbData()==NULL)) throw cms::Exception("No CLCT header for this chamber");
00289   return tmbData()->tmbHeader();
00290 }

std::vector< std::vector< CSCWireDigi > > CSCEventData::wireDigis (  )  const

deprecated. Use the above method instead.

Definition at line 251 of file CSCEventData.cc.

References HLT_VtxMuL3::result.

Referenced by operator<<().

00251                                                                    {
00252   std::vector < std::vector<CSCWireDigi> > result;
00253   for (int layer = 1; layer <= 6; ++layer)     {
00254     result.push_back(wireDigis(layer));
00255   }
00256   return result;
00257 }

std::vector< CSCWireDigi > CSCEventData::wireDigis ( unsigned  ilayer  )  const

Definition at line 232 of file CSCEventData.cc.

References theAnodeData, and CSCAnodeData::wireDigis().

Referenced by operator<<().

00232                                                                     {
00233   if(theAnodeData == 0)    {
00234     return std::vector<CSCWireDigi>();
00235   } 
00236   else    {
00237     return theAnodeData->wireDigis(ilayer);
00238   }
00239 }


Member Data Documentation

bool CSCEventData::debug = false [static]

Definition at line 136 of file CSCEventData.h.

Referenced by CSCEventData(), and setDebug().

int CSCEventData::size_ [private]

Definition at line 170 of file CSCEventData.h.

Referenced by copy(), CSCEventData(), and size().

CSCALCTHeader* CSCEventData::theALCTHeader [private]

these may or may not be present.

I decided to make them dynamic because most CSC chambers don't have LCTs, therefore don't have data, except for DMB headers and trailers.

Definition at line 160 of file CSCEventData.h.

Referenced by add(), alctHeader(), checkALCTClasses(), copy(), CSCEventData(), destroy(), init(), pack(), and setEventInformation().

CSCALCTTrailer* CSCEventData::theALCTTrailer [private]

Definition at line 162 of file CSCEventData.h.

Referenced by alctTrailer(), checkALCTClasses(), copy(), CSCEventData(), destroy(), init(), and pack().

CSCAnodeData* CSCEventData::theAnodeData [private]

Definition at line 161 of file CSCEventData.h.

Referenced by add(), alctData(), checkALCTClasses(), copy(), CSCEventData(), destroy(), init(), pack(), and wireDigis().

CSCCFEBData* CSCEventData::theCFEBData[5] [private]

for up to 5 CFEB boards

Definition at line 166 of file CSCEventData.h.

Referenced by add(), cfebData(), copy(), CSCEventData(), destroy(), init(), pack(), and stripDigis().

int CSCEventData::theChamberType [private]

this won't be filled when real data is read it.

It's only used when packing simulated data, so we know how many wire and strip channels to make.

Definition at line 173 of file CSCEventData.h.

Referenced by chamberType(), checkALCTClasses(), and copy().

CSCDMBHeader CSCEventData::theDMBHeader [private]

Definition at line 155 of file CSCEventData.h.

Referenced by add(), checkALCTClasses(), checkTMBClasses(), copy(), CSCEventData(), dmbHeader(), nalct(), nclct(), pack(), and setEventInformation().

CSCDMBTrailer CSCEventData::theDMBTrailer [private]

Definition at line 168 of file CSCEventData.h.

Referenced by copy(), CSCEventData(), dmbTrailer(), and pack().

CSCTMBData* CSCEventData::theTMBData [private]

Definition at line 163 of file CSCEventData.h.

Referenced by add(), checkTMBClasses(), copy(), CSCEventData(), destroy(), init(), pack(), setEventInformation(), and tmbData().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:18 2009 for CMSSW by  doxygen 1.5.4