CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalTTPUnpacker.cc
Go to the documentation of this file.
2 
3 bool HcalTTPUnpacker::unpack(const HcalHTRData& theData, HcalTTPDigi& theDigi) {
4 
5  // Get the base information for the TTP Digi
6  int theID = theData.getSubmodule() ;
7  int nSamples = theData.getNDD() ;
8  int nPresamples = theData.getNPS() ;
9  int algorithm = theData.getFirmwareFlavor()&0x1F ;
10  unsigned int fwVersion = theData.getFirmwareRevision() ;
11  unsigned int lPipe = theData.getPipelineLength() ;
12 
13  if (nSamples>8) nSamples=8; // protection in case nSamples is too large
14 
15  theDigi = HcalTTPDigi(theID,nSamples,nPresamples,fwVersion,algorithm,lPipe) ;
16 
17  // Get the data pointers
18  const unsigned short *daq_first, *daq_last, *tp_first, *tp_last ;
19  theData.dataPointers(&daq_first,&daq_last,&tp_first,&tp_last) ;
20 
21  // Each TTP data sample is 96 bits: 72 (input) + 20 (algo) + output (4)
22  for (int i=0; i<nSamples; i++) {
23 
24  const uint16_t* daq_start = (daq_first+6*i) ;
25  if ( daq_start > daq_last ) break ;
26 
27  const uint16_t* inputContent = daq_start ;
28  const uint32_t algoDep = (daq_start[4]>>8)|((uint32_t(daq_start[5])&0xFFF)<<8) ;
29  const uint8_t trigOutput = (daq_start[5]>>12)&0xF ;
30 
31  int relativeSample = i - nPresamples ;
32  theDigi.setSample(relativeSample,inputContent,algoDep,trigOutput) ;
33  }
34  return true;
35 }
36 
int i
Definition: DBlmapReader.cc:9
int getNDD() const
Get the number of daq data samples per channel when not zero-suppressed.
Definition: HcalHTRData.cc:388
unsigned int getPipelineLength() const
Get the pipeline length used for this event.
Definition: HcalHTRData.cc:403
void setSample(int relativeSample, const uint16_t *triggerInputs, const uint32_t algodep, const uint8_t outputTrigger)
Definition: HcalTTPDigi.cc:24
void dataPointers(const unsigned short **daq_first, const unsigned short **daq_last, const unsigned short **tp_first, const unsigned short **tp_last) const
Obtain the starting and ending pointers for external unpacking of the data.
Definition: HcalHTRData.cc:153
bool unpack(const HcalHTRData &data, HcalTTPDigi &digi)
int getNPS() const
Get the number of presamples in daq data.
Definition: HcalHTRData.cc:400
int getFirmwareFlavor() const
Get the HTR firmware flavor.
Definition: HcalHTRData.cc:409
unsigned int getSubmodule() const
Get the HTR submodule number.
Definition: HcalHTRData.cc:331
unsigned int getFirmwareRevision() const
Get the HTR firmware version.
Definition: HcalHTRData.cc:406