CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

HcalTTPDigi Class Reference

#include <HcalTTPDigi.h>

List of all members.

Public Types

typedef int key_type

Public Member Functions

int algorithm () const
uint32_t algorithmWord (int relativeSample=0) const
unsigned int fwVersion () const
 HcalTTPDigi (int identifier, int samples, int presamples, unsigned int fwVersion, int algorithm, unsigned int lPipe)
 HcalTTPDigi ()
int id () const
std::vector< bool > inputPattern (int relativeSample=0) const
bool operator!= (const HcalTTPDigi &digi) const
bool operator== (const HcalTTPDigi &digi) const
unsigned int pipelineLength () const
int presamples () const
void setSample (int relativeSample, const uint16_t *triggerInputs, const uint32_t algodep, const uint8_t outputTrigger)
int size () const
uint8_t triggerOutput (int relativeSample=0) const

Private Attributes

uint32_t algoDepend_ [8]
int algorithm_
unsigned int fwVersion_
int identifier_
unsigned int lPipe_
int presamples_
int samples_
uint16_t triggerInputs_ [5 *8]
uint8_t triggerOutput_ [8]

Detailed Description

Date:
2010/04/07 02:06:12
Revision:
1.2
Author:
J. Mans - Minnesota

Definition at line 14 of file HcalTTPDigi.h.


Member Typedef Documentation

typedef int HcalTTPDigi::key_type

Definition at line 16 of file HcalTTPDigi.h.


Constructor & Destructor Documentation

HcalTTPDigi::HcalTTPDigi ( )

Definition at line 3 of file HcalTTPDigi.cc.

References algoDepend_, i, j, triggerInputs_, and triggerOutput_.

                         : identifier_(0), samples_(0), presamples_(0), fwVersion_(0), algorithm_(0), lPipe_(0) {
    for (int i=0; i<8; i++) {
        algoDepend_[i] = 0 ; triggerOutput_[i] = 0 ;
        for (int j=0; j<5; j++) triggerInputs_[j*8+i] = 0 ;
    }
}
HcalTTPDigi::HcalTTPDigi ( int  identifier,
int  samples,
int  presamples,
unsigned int  fwVersion,
int  algorithm,
unsigned int  lPipe 
)

Definition at line 10 of file HcalTTPDigi.cc.

References algoDepend_, i, j, triggerInputs_, and triggerOutput_.

                                                                                    :
    identifier_(identifier),
    samples_(samples),
    presamples_(presamples),
    fwVersion_(fwVersion),
    algorithm_(algorithm),
    lPipe_(lPipe) {
    for (int i=0; i<8; i++) {
        algoDepend_[i] = 0x0 ; triggerOutput_[i] = 0x0 ;
        for (int j=0; j<5; j++) triggerInputs_[i*5+j] = 0x0 ;
    }
}

Member Function Documentation

int HcalTTPDigi::algorithm ( ) const [inline]

Definition at line 36 of file HcalTTPDigi.h.

References algorithm_.

Referenced by operator<<().

{ return algorithm_ ; }
uint32_t HcalTTPDigi::algorithmWord ( int  relativeSample = 0) const

get the "algorithm-dependent-word" for the given sample

Definition at line 61 of file HcalTTPDigi.cc.

References algoDepend_, presamples_, and samples_.

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

                                                            {
  int linSample=presamples_+relativeSample;
  if (linSample>=0 && linSample<samples_) return algoDepend_[linSample];
  else return 0;
}
unsigned int HcalTTPDigi::fwVersion ( ) const [inline]

Definition at line 37 of file HcalTTPDigi.h.

References fwVersion_.

Referenced by operator<<().

{ return fwVersion_ ; }
int HcalTTPDigi::id ( void  ) const [inline]

Definition at line 33 of file HcalTTPDigi.h.

References identifier_.

Referenced by operator<<().

{ return identifier_ ; } 
std::vector< bool > HcalTTPDigi::inputPattern ( int  relativeSample = 0) const

get the input bit pattern for the given sample (relative to the SOI) the vector will be empty if there is no data for the requested sample

Definition at line 42 of file HcalTTPDigi.cc.

References i, presamples_, samples_, and triggerInputs_.

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

                                                                  {
  std::vector<bool> retval;
  int linSample=presamples_+relativeSample;
  if (linSample>=0 && linSample<samples_) {
    
    for (int i=0; i<72; i++) {
      int ioff=i/16;
      retval.push_back(triggerInputs_[linSample*5+ioff]&(1<<(i%16)));
    }
  }
  return retval ; 
}
bool HcalTTPDigi::operator!= ( const HcalTTPDigi digi) const [inline]

Definition at line 41 of file HcalTTPDigi.h.

{ return !(*this == digi) ; } 
bool HcalTTPDigi::operator== ( const HcalTTPDigi digi) const

Definition at line 67 of file HcalTTPDigi.cc.

References algorithmWord(), i, inputPattern(), presamples(), presamples_, samples_, size(), triggerOutput(), and funct::true.

                                                          {

    if (samples_ != digi.size() || presamples_ != digi.presamples()) return false ;
    int relativeSize = digi.size() - digi.presamples() ; 
    for (int i=-this->presamples(); i<relativeSize; i++) {
        if (this->inputPattern(i) != digi.inputPattern(i)) return false ; 
        if (this->algorithmWord(i) != digi.algorithmWord(i)) return false ; 
        if (this->triggerOutput(i) != digi.triggerOutput(i)) return false ; 
    }
    return true ;
}
unsigned int HcalTTPDigi::pipelineLength ( ) const [inline]

Definition at line 38 of file HcalTTPDigi.h.

References lPipe_.

Referenced by operator<<().

{ return lPipe_ ; } 
int HcalTTPDigi::presamples ( ) const [inline]

Definition at line 35 of file HcalTTPDigi.h.

References presamples_.

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

{ return presamples_ ; } 
void HcalTTPDigi::setSample ( int  relativeSample,
const uint16_t *  triggerInputs,
const uint32_t  algodep,
const uint8_t  outputTrigger 
)

Definition at line 24 of file HcalTTPDigi.cc.

References algoDepend_, i, presamples_, samples_, triggerInputs_, and triggerOutput_.

Referenced by HcalTTPDigiProducer::produce(), and HcalTTPUnpacker::unpack().

                                                         {

    int linSample=presamples_+relativeSample;
    if (linSample>=0 && linSample<samples_) {
        // Trigger input: 72 bits
        for (int i=0; i<4; i++)
            triggerInputs_[5*linSample+i] = triggerInputs[i] ;
        triggerInputs_[5*linSample+4] = triggerInputs[4]&0xFF ;
        // Algo dependency: 20 bits
        algoDepend_[linSample] = algodep&0xFFFFF ;
        // Trigger output: 4 bits
        triggerOutput_[linSample] = outputTrigger&0xF ;        
    }
}
int HcalTTPDigi::size ( void  ) const [inline]

Definition at line 34 of file HcalTTPDigi.h.

References samples_.

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

{ return samples_ ; } 
uint8_t HcalTTPDigi::triggerOutput ( int  relativeSample = 0) const

get the output trigger bit set for the given sample (relative to the SOI) the vector will be empty if there is no data for the requested sample

Definition at line 55 of file HcalTTPDigi.cc.

References presamples_, samples_, and triggerOutput_.

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

                                                           {
  int linSample=presamples_+relativeSample;
  if (linSample>=0 && linSample<samples_) return triggerOutput_[linSample];
  else return 0;
}

Member Data Documentation

uint32_t HcalTTPDigi::algoDepend_[8] [private]

Definition at line 51 of file HcalTTPDigi.h.

Referenced by algorithmWord(), HcalTTPDigi(), and setSample().

int HcalTTPDigi::algorithm_ [private]

Definition at line 47 of file HcalTTPDigi.h.

Referenced by algorithm().

unsigned int HcalTTPDigi::fwVersion_ [private]

Definition at line 46 of file HcalTTPDigi.h.

Referenced by fwVersion().

int HcalTTPDigi::identifier_ [private]

Definition at line 44 of file HcalTTPDigi.h.

Referenced by id().

unsigned int HcalTTPDigi::lPipe_ [private]

Definition at line 48 of file HcalTTPDigi.h.

Referenced by pipelineLength().

int HcalTTPDigi::presamples_ [private]
int HcalTTPDigi::samples_ [private]

Definition at line 45 of file HcalTTPDigi.h.

Referenced by algorithmWord(), inputPattern(), operator==(), setSample(), size(), and triggerOutput().

uint16_t HcalTTPDigi::triggerInputs_[5 *8] [private]

Definition at line 50 of file HcalTTPDigi.h.

Referenced by HcalTTPDigi(), inputPattern(), and setSample().

uint8_t HcalTTPDigi::triggerOutput_[8] [private]

Definition at line 52 of file HcalTTPDigi.h.

Referenced by HcalTTPDigi(), setSample(), and triggerOutput().