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, 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)
virtual ~EcalFenixTcpFormat ()

Private Attributes

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

Detailed Description

Definition at line 21 of file EcalFenixTcpFormat.h.


Constructor & Destructor Documentation

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

Definition at line 10 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 17 of file EcalFenixTcpFormat.cc.

                                        {
}

Member Function Documentation

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

Definition at line 26 of file EcalFenixTcpFormat.h.

References 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,
int  eTTotShift,
std::vector< EcalTriggerPrimitiveSample > &  out,
std::vector< EcalTriggerPrimitiveSample > &  outTcc,
bool  isInInnerRings 
)

Definition at line 21 of file EcalFenixTcpFormat.cc.

References badTTStatus_, binOfMax_, famos_, i, lut_, 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],ttFlag); 
      }
      else out[i]=EcalTriggerPrimitiveSample( );
    }
  }
  else {
    for (unsigned int i=0; i<Et.size();++i) {
      int myFgvb=fgvb[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 ;

        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,ttFlag); 
    }
  }
}
void EcalFenixTcpFormat::setParameters ( uint32_t  towid,
const EcalTPGLutGroup ecaltpgLutGroup,
const EcalTPGLutIdMap ecaltpgLut,
const EcalTPGTowerStatus ecaltpgbadTT 
)

Definition at line 85 of file EcalFenixTcpFormat.cc.

References badTTStatus_, and lut_.

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

{
  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 32 of file EcalFenixTcpFormat.h.

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

unsigned int EcalFenixTcpFormat::binOfMax_ [private]

Definition at line 37 of file EcalFenixTcpFormat.h.

Referenced by process().

Definition at line 35 of file EcalFenixTcpFormat.h.

Definition at line 36 of file EcalFenixTcpFormat.h.

Referenced by process().

const unsigned int* EcalFenixTcpFormat::lut_ [private]

Definition at line 31 of file EcalFenixTcpFormat.h.

Referenced by process(), and setParameters().

uint16_t EcalFenixTcpFormat::status_ [private]

Definition at line 33 of file EcalFenixTcpFormat.h.

Referenced by EcalFenixTcpFormat().

Definition at line 34 of file EcalFenixTcpFormat.h.

Referenced by process().