CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
HcalTTPUnpacker Class Reference

#include <HcalTTPUnpacker.h>

Public Member Functions

bool unpack (const HcalHTRData &data, HcalTTPDigi &digi)
 

Detailed Description

Author
J. Mans - Minnesota

Definition at line 11 of file HcalTTPUnpacker.h.

Member Function Documentation

bool HcalTTPUnpacker::unpack ( const HcalHTRData data,
HcalTTPDigi digi 
)

Definition at line 3 of file HcalTTPUnpacker.cc.

References algorithm(), HcalHTRData::dataPointers(), HcalHTRData::getFirmwareFlavor(), HcalHTRData::getFirmwareRevision(), HcalHTRData::getNDD(), HcalHTRData::getNPS(), HcalHTRData::getPipelineLength(), HcalHTRData::getSubmodule(), i, and HcalTTPDigi::setSample().

Referenced by CastorUnpacker::unpack(), and HcalUnpacker::unpack().

3  {
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 }
int i
Definition: DBlmapReader.cc:9
< trclass="colgroup">< tdclass="colgroup"colspan=5 > Ecal cluster collections</td ></tr >< tr >< td >< ahref="classreco_1_1BasicCluster.html"> reco::BasicCluster</a ></td >< td >< ahref="DataFormats_EgammaReco.html"> reco::BasicClusterCollection</a ></td >< td >< ahref="#"> hybridSuperClusters</a ></td >< tdclass="description"> Basic clusters reconstructed with hybrid algorithm(barrel only)</td >< td >S.Rahatlou</td ></tr >< tr >< td >< a href