CMS 3D CMS Logo

EcalFenixLinearizer Class Reference

Linearisation for Fenix strip input: 16 bits corresponding to input EBDataFrame output: 18 bits. More...

#include <SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixLinearizer.h>

List of all members.

Public Member Functions

 EcalFenixLinearizer (bool famos)
template<class T>
void process (const T &, std::vector< int > &)
void setParameters (uint32_t raw, const EcalTPGPedestals *ecaltpPed, const EcalTPGLinearizationConst *ecaltpLin)
virtual ~EcalFenixLinearizer ()

Private Member Functions

int process ()
int setInput (const EcalMGPASample &RawSam)

Private Attributes

int base_
bool famos_
int gainID_
const
EcalTPGLinearizationConstant
linConsts_
int mult_
const EcalTPGPedestalpeds_
int shift_
int strip_
int uncorrectedSample_


Detailed Description

Linearisation for Fenix strip input: 16 bits corresponding to input EBDataFrame output: 18 bits.

Definition at line 17 of file EcalFenixLinearizer.h.


Constructor & Destructor Documentation

EcalFenixLinearizer::EcalFenixLinearizer ( bool  famos  ) 

Definition at line 8 of file EcalFenixLinearizer.cc.

00009   : famos_(famos)
00010 {
00011 }

EcalFenixLinearizer::~EcalFenixLinearizer (  )  [virtual]

Definition at line 13 of file EcalFenixLinearizer.cc.

00013                                          {
00014 }


Member Function Documentation

template<class T>
void EcalFenixLinearizer::process ( const T &  df,
std::vector< int > &  output_percry 
) [inline]

Definition at line 46 of file EcalFenixLinearizer.h.

References i, process(), and setInput().

00047 {
00048 
00049   //We know a tower numbering is:
00050 // S1 S2 S3 S4 S5
00051 //
00052 // 4  5  14 15 24
00053 // 3  6  13 16 23
00054 // 2  7  12 17 22
00055 // 1  8  11 18 21
00056 // 0  9  10 19 20
00057   for (int i=0;i<df.size();i++) {
00058     setInput(df[i]);
00059     output_percry[i]=process();
00060   }
00061 
00062   return;
00063 }

int EcalFenixLinearizer::process (  )  [private]

Definition at line 31 of file EcalFenixLinearizer.cc.

References base_, mult_, output(), shift_, and uncorrectedSample_.

Referenced by process(), and EcalFenixStrip::process_part1().

00032 {
00033   int output=(uncorrectedSample_-base_); //Substract base
00034   if(output<0) return 0;
00035   output=(output*mult_)>>(shift_+2);        //Apply multiplicative factor
00036   if(output>0X3FFFF)output=0X3FFFF;         //Saturation if too high
00037   return output;
00038 }

int EcalFenixLinearizer::setInput ( const EcalMGPASample RawSam  )  [private]

Definition at line 40 of file EcalFenixLinearizer.cc.

References EcalMGPASample::adc(), base_, famos_, EcalMGPASample::gainId(), gainID_, linConsts_, LogDebug, mult_, peds_, EcalMGPASample::raw(), shift_, and uncorrectedSample_.

Referenced by process().

00041 {
00042   if(RawSam.raw()>0X3FFF)
00043     {
00044       LogDebug("EcalTPG")<<"ERROR IN INPUT SAMPLE OF FENIX LINEARIZER";
00045       return -1;
00046     }
00047   uncorrectedSample_=RawSam.adc(); //uncorrectedSample_ is coded in the 12 LSB
00048   gainID_=RawSam.gainId();       //uncorrectedSample_ is coded in the 2 next bits!
00049   if (gainID_==0)    gainID_=3;
00050 
00051   if (gainID_==1) {
00052     base_ = peds_ -> mean_x12; 
00053     mult_ = linConsts_ -> mult_x12;
00054     shift_ = linConsts_ -> shift_x12;
00055   }
00056   else if (gainID_==2) {
00057     base_ = peds_ -> mean_x6;
00058     mult_ = linConsts_ -> mult_x6;
00059     shift_ = linConsts_ -> shift_x6;  
00060   }
00061   else if (gainID_==3){
00062     base_ = peds_-> mean_x1;
00063     mult_ = linConsts_ -> mult_x1;
00064     shift_ = linConsts_ -> shift_x1; 
00065   }
00066 
00067   if (famos_) base_=200; //FIXME by preparing a correct TPG.txt for Famos
00068  
00069   return 1;
00070 }

void EcalFenixLinearizer::setParameters ( uint32_t  raw,
const EcalTPGPedestals ecaltpPed,
const EcalTPGLinearizationConst ecaltpLin 
)

Definition at line 16 of file EcalFenixLinearizer.cc.

References EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), EcalCondObjectContainer< T >::getMap(), it, linConsts_, and peds_.

Referenced by EcalFenixStrip::process_part1().

00017 {
00018   const EcalTPGLinearizationConstMap & linMap = ecaltpLin->getMap() ; 
00019 
00020   EcalTPGLinearizationConstMapIterator it=linMap.find(raw);
00021   if (it!=linMap.end()) {
00022     linConsts_=&(*it);
00023   }
00024   else edm::LogWarning("EcalTPG")<<" could not find EcalTPGLinearizationConstMap entry for "<<raw;
00025   const EcalTPGPedestalsMap & pedMap = ecaltpPed->getMap() ; 
00026   EcalTPGPedestalsMapIterator itped=pedMap.find(raw);
00027   if (itped!=pedMap.end())   peds_=&(*itped);
00028   else edm::LogWarning("EcalTPG")<<" could not find EcalTPGPedestalsMap entry for "<<raw;
00029 }


Member Data Documentation

int EcalFenixLinearizer::base_ [private]

Definition at line 24 of file EcalFenixLinearizer.h.

Referenced by process(), and setInput().

bool EcalFenixLinearizer::famos_ [private]

Definition at line 21 of file EcalFenixLinearizer.h.

Referenced by setInput().

int EcalFenixLinearizer::gainID_ [private]

Definition at line 23 of file EcalFenixLinearizer.h.

Referenced by setInput().

const EcalTPGLinearizationConstant* EcalFenixLinearizer::linConsts_ [private]

Definition at line 29 of file EcalFenixLinearizer.h.

Referenced by setInput(), and setParameters().

int EcalFenixLinearizer::mult_ [private]

Definition at line 25 of file EcalFenixLinearizer.h.

Referenced by process(), and setInput().

const EcalTPGPedestal* EcalFenixLinearizer::peds_ [private]

Definition at line 30 of file EcalFenixLinearizer.h.

Referenced by setInput(), and setParameters().

int EcalFenixLinearizer::shift_ [private]

Definition at line 26 of file EcalFenixLinearizer.h.

Referenced by process(), and setInput().

int EcalFenixLinearizer::strip_ [private]

Definition at line 27 of file EcalFenixLinearizer.h.

int EcalFenixLinearizer::uncorrectedSample_ [private]

Definition at line 22 of file EcalFenixLinearizer.h.

Referenced by process(), and setInput().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:37 2009 for CMSSW by  doxygen 1.5.4