CMS 3D CMS Logo

Public Member Functions | Private Attributes

EcalFenixTcpFormat Class Reference

#include <EcalFenixTcpFormat.h>

List of all members.

Public Member Functions

 EcalFenixTcpFormat (bool tccFormat, bool debug, bool famos, int binOfMax)
void process (std::vector< int > &Et, std::vector< int > &fgvb, std::vector< int > &sfgvb, int eTTotShift, std::vector< EcalTriggerPrimitiveSample > &out, std::vector< EcalTriggerPrimitiveSample > &outTcc, bool isInInnerRings)
virtual std::vector< int > process (std::vector< int >, std::vector< int >)
void setParameters (uint32_t towid, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGTowerStatus *ecaltpgbadTT, const EcalTPGSpike *ecaltpgSpike)
virtual ~EcalFenixTcpFormat ()

Private Attributes

const uint16_t * badTTStatus_
unsigned int binOfMax_
bool debug_
bool famos_
const unsigned int * lut_
uint16_t spikeZeroThresh_
uint16_t status_
bool tcpFormat_

Detailed Description

Definition at line 22 of file EcalFenixTcpFormat.h.


Constructor & Destructor Documentation

EcalFenixTcpFormat::EcalFenixTcpFormat ( bool  tccFormat,
bool  debug,
bool  famos,
int  binOfMax 
)

Definition at line 11 of file EcalFenixTcpFormat.cc.

References badTTStatus_, and status_.

  : tcpFormat_(tcpFormat),debug_(debug),famos_(famos),binOfMax_(binOfMax)
{
  status_=0;
  badTTStatus_=&status_;
}
EcalFenixTcpFormat::~EcalFenixTcpFormat ( ) [virtual]

Definition at line 18 of file EcalFenixTcpFormat.cc.

                                        {
}

Member Function Documentation

virtual std::vector<int> EcalFenixTcpFormat::process ( std::vector< int >  ,
std::vector< int >   
) [inline, virtual]

Definition at line 27 of file EcalFenixTcpFormat.h.

References findQualityFiles::v.

Referenced by EcalFenixTcp::process_part2_barrel(), and EcalFenixTcp::process_part2_endcap().

{  std::vector<int> v;return v;}
void EcalFenixTcpFormat::process ( std::vector< int > &  Et,
std::vector< int > &  fgvb,
std::vector< int > &  sfgvb,
int  eTTotShift,
std::vector< EcalTriggerPrimitiveSample > &  out,
std::vector< EcalTriggerPrimitiveSample > &  outTcc,
bool  isInInnerRings 
)

Definition at line 22 of file EcalFenixTcpFormat.cc.

References badTTStatus_, binOfMax_, famos_, i, lut_, spikeZeroThresh_, and tcpFormat_.

                                                                                                   {
  // put TP-s in the output
  // on request also in TcpFormat    
  // for famos version we have to write dummies except for the middle
  
  int myEt;
  if (famos_) {
    for (unsigned int i=0; i<out.size();++i) {
      if (i==binOfMax_-1) {
        myEt=Et[0]>>eTTotShift;
        if (myEt>0x3ff) myEt=0x3ff ;
        if (isInInnerRings) myEt = myEt /2 ;
        
        // badTTStatus_ ==0 if the TT works
        // badTTStatus_ !=0 if there are some problems
        int lut_out;
        if (*badTTStatus_!=0){
          lut_out = 0;
        }
        else
          lut_out = (lut_)[myEt] ;
        
        int ttFlag = (lut_out & 0x700) >> 8 ;
        myEt = lut_out & 0xff ;
        out[i]=EcalTriggerPrimitiveSample( myEt,fgvb[0],sfgvb[0],ttFlag); 
      }
      else out[i]=EcalTriggerPrimitiveSample( );
    }
  }
  else {
    for (unsigned int i=0; i<Et.size();++i) {
      int myFgvb=fgvb[i];
      int mysFgvb=sfgvb[i];
      //myEt=Et[i]>>eTTotShift;
      //if (myEt>0x3ff) myEt=0x3ff ;
      //if (isInInnerRings) myEt = myEt /2 ;  

      // bug fix 091009:
      myEt=Et[i]; 
      if (myEt>0xfff) 
        myEt=0xfff ;
      if (isInInnerRings) 
        myEt = myEt /2 ;  
      myEt >>= eTTotShift ;
      if (myEt>0x3ff) myEt=0x3ff ;

      // Spike killing
      if((myEt > spikeZeroThresh_) && (mysFgvb == 0))
      {
        myEt = 0;
      }

        int lut_out;
        if (*badTTStatus_!=0){
          lut_out = 0;
        }
        else
          lut_out = (lut_)[myEt] ;
      
      int ttFlag = (lut_out & 0x700) >> 8 ;
      if (tcpFormat_)  {
        out2[i]=EcalTriggerPrimitiveSample( ((ttFlag&0x7)<<11) | ((myFgvb & 0x1)<<10) |  (myEt & 0x3ff));
      }
      myEt = lut_out & 0xff ;
      out[i]=EcalTriggerPrimitiveSample( myEt,myFgvb,mysFgvb,ttFlag); 
    }
  }
}
void EcalFenixTcpFormat::setParameters ( uint32_t  towid,
const EcalTPGLutGroup ecaltpgLutGroup,
const EcalTPGLutIdMap ecaltpgLut,
const EcalTPGTowerStatus ecaltpgbadTT,
const EcalTPGSpike ecaltpgSpike 
)

Definition at line 94 of file EcalFenixTcpFormat.cc.

References badTTStatus_, EcalTPGSpike::getMap(), lut_, and spikeZeroThresh_.

Referenced by EcalFenixTcp::process_part2_barrel(), and EcalFenixTcp::process_part2_endcap().

{
  // Get TP zeroing threshold - defaut to 1023 for old data (no record found or EE)
  spikeZeroThresh_ = 1023;
  if(ecaltpgSpike != 0)
  {
    const EcalTPGSpike::EcalTPGSpikeMap &spikeMap = ecaltpgSpike->getMap();
    EcalTPGSpike:: EcalTPGSpikeMapIterator sit = spikeMap.find(towid);
    if(sit != spikeMap.end())
    {
      spikeZeroThresh_ = sit->second;
    }
  }

  const EcalTPGGroups::EcalTPGGroupsMap & groupmap = ecaltpgLutGroup -> getMap();
  EcalTPGGroups::EcalTPGGroupsMapItr it=groupmap.find(towid);
  if (it!=groupmap.end()) {
    uint32_t lutid=(*it).second;
    const EcalTPGLutIdMap::EcalTPGLutMap &lutmap = ecaltpgLut-> getMap();
    EcalTPGLutIdMap::EcalTPGLutMapItr itl=lutmap.find(lutid);
    if (itl!=lutmap.end()) {
      lut_=(*itl).second.getLut();
    }  else edm::LogWarning("EcalTPG")<<" could not find EcalTPGLutMap for "<<lutid;

  }
  else edm::LogWarning("EcalTPG")<<" could not find EcalTPGFineGrainTowerEEMap for "<<towid;
  
  const EcalTPGTowerStatusMap & badTTMap = ecaltpgbadTT -> getMap();
  EcalTPGTowerStatusMapIterator itbadTT = badTTMap.find(towid);
  if (itbadTT!=badTTMap.end()) {
    badTTStatus_=&(*itbadTT).second;
  }
}

Member Data Documentation

const uint16_t* EcalFenixTcpFormat::badTTStatus_ [private]

Definition at line 33 of file EcalFenixTcpFormat.h.

Referenced by EcalFenixTcpFormat(), process(), and setParameters().

unsigned int EcalFenixTcpFormat::binOfMax_ [private]

Definition at line 38 of file EcalFenixTcpFormat.h.

Referenced by process().

Definition at line 36 of file EcalFenixTcpFormat.h.

Definition at line 37 of file EcalFenixTcpFormat.h.

Referenced by process().

const unsigned int* EcalFenixTcpFormat::lut_ [private]

Definition at line 32 of file EcalFenixTcpFormat.h.

Referenced by process(), and setParameters().

Definition at line 39 of file EcalFenixTcpFormat.h.

Referenced by process(), and setParameters().

uint16_t EcalFenixTcpFormat::status_ [private]

Definition at line 34 of file EcalFenixTcpFormat.h.

Referenced by EcalFenixTcpFormat().

Definition at line 35 of file EcalFenixTcpFormat.h.

Referenced by process().