CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalEBFenixLinearizer Class Reference

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

#include <EcalEBFenixLinearizer.h>

Public Member Functions

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

Private Member Functions

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

Private Attributes

const EcalTPGCrystalStatusCodebadXStatus_
 
int base_
 
bool famos_
 
int gainID_
 
bool init_
 
const EcalTPGLinearizationConstantlinConsts_
 
int mult_
 
const EcalTPGPedestalpeds_
 
int shift_
 
int strip_
 
int uncorrectedSample_
 
std::vector< const EcalTPGCrystalStatusCode * > vectorbadXStatus_
 

Detailed Description

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

Definition at line 19 of file EcalEBFenixLinearizer.h.

Constructor & Destructor Documentation

◆ EcalEBFenixLinearizer()

EcalEBFenixLinearizer::EcalEBFenixLinearizer ( bool  famos)

Definition at line 9 of file EcalEBFenixLinearizer.cc.

10  : famos_(famos), init_(false), linConsts_(nullptr), peds_(nullptr), badXStatus_(nullptr) {}

◆ ~EcalEBFenixLinearizer()

EcalEBFenixLinearizer::~EcalEBFenixLinearizer ( )
virtual

Definition at line 12 of file EcalEBFenixLinearizer.cc.

12  {
13  if (init_) {
14  for (int i = 0; i < (int)vectorbadXStatus_.size(); i++) {
15  delete vectorbadXStatus_[i];
16  }
17  }
18 }

References mps_fire::i, init_, createfilelist::int, and vectorbadXStatus_.

Member Function Documentation

◆ process() [1/2]

int EcalEBFenixLinearizer::process ( )
private

Definition at line 51 of file EcalEBFenixLinearizer.cc.

51  {
52  int output = (uncorrectedSample_ - base_); //Substract base
53  //std::cout << " EcalEBFenixLinearizer::process() output non bit shifted " << output << std::endl;
54  if (famos_ || output < 0)
55  return 0;
56 
57  if (output < 0)
58  return shift_ << 12; // FENIX bug(!)
59  output = (output * mult_) >> (shift_ + 2); //Apply multiplicative factor
60  //std::cout << " EcalEBFenixLinearizer::process() output 2nd step " << output << std::endl;
61  if (output > 0X3FFFF)
62  output = 0X3FFFF; //Saturation if too high
63  //std::cout << " EcalEBFenixLinearizer::process() output 3rd step " << output << std::endl;
64  return output;
65 }

References base_, famos_, mult_, convertSQLitetoXML_cfg::output, shift_, and uncorrectedSample_.

Referenced by process(), and EcalEBTrigPrimTestAlgo::run().

◆ process() [2/2]

template<class T >
void EcalEBFenixLinearizer::process ( const T df,
std::vector< int > &  output_percry 
)

Definition at line 52 of file EcalEBFenixLinearizer.h.

52  {
53  //We know a tower numbering is:
54  // S1 S2 S3 S4 S5
55  //
56  // 4 5 14 15 24
57  // 3 6 13 16 23
58  // 2 7 12 17 22
59  // 1 8 11 18 21
60  // 0 9 10 19 20
61 
62  for (int i = 0; i < df.size(); i++) {
63  setInput(df[i]);
64  output_percry[i] = process();
65  }
66 
67  return;
68 }

References hgcalPerformanceValidation::df, mps_fire::i, process(), and setInput().

◆ setInput()

int EcalEBFenixLinearizer::setInput ( const EcalMGPASample RawSam)
private

Definition at line 67 of file EcalEBFenixLinearizer.cc.

67  {
68  //std::cout << " EcalEBFenixLinearizer::setInput RawSam.raw() " << RawSam.raw() << std::endl;
69  if (RawSam.raw() > 0X3FFF) {
70  LogDebug("EcalTPG") << "ERROR IN INPUT SAMPLE OF FENIX LINEARIZER";
71  return -1;
72  }
73 
74  uncorrectedSample_ = RawSam.adc(); //uncorrectedSample_ is coded in the 12 LSB
75  gainID_ = RawSam.gainId(); //uncorrectedSample_ is coded in the 2 next bits!
76 
77  if (gainID_ == 0) {
78  base_ = 0;
79  shift_ = 0;
80  mult_ = 0xFF;
81  if ((linConsts_->mult_x12 == 0) && (linConsts_->mult_x6 == 0) && (linConsts_->mult_x1 == 0)) {
82  mult_ = 0; // Implemented in CCSSupervisor to
83  // reject overflow cases in rejected channels
84  }
85  } else if (gainID_ == 1) {
86  base_ = peds_->mean_x12;
88 
89  // take into account the badX
90  // badXStatus_ == 0 if the crystal works
91  // badXStatus_ !=0 some problem with the crystal
92  if (badXStatus_->getStatusCode() != 0) {
93  mult_ = 0;
94  } else {
96  }
97  } else if (gainID_ == 2) {
98  base_ = peds_->mean_x6;
100 
101  // take into account the badX
102  // check if the badX has a status code=0 or 1
103  if (badXStatus_->getStatusCode() != 0) {
104  mult_ = 0;
105  } else {
107  }
108  } else if (gainID_ == 3) {
109  base_ = peds_->mean_x1;
111 
112  // take into account the badX
113  // check if the badX has a status code=0 or 1
114  if (badXStatus_->getStatusCode() != 0) {
115  mult_ = 0;
116  } else {
118  }
119  }
120 
121  //std::cout << " EcalEBFenixLinearizer::setInput uncorrectedSample_ " << RawSam.adc() << " gainID " << gainID_ << " baseline " << base_ << std::endl;
122 
123  if (famos_)
124  base_ = 200; //FIXME by preparing a correct TPG.txt for Famos
125 
126  return 1;
127 }

References EcalMGPASample::adc(), badXStatus_, base_, famos_, EcalMGPASample::gainId(), gainID_, EcalTPGCrystalStatusCode::getStatusCode(), linConsts_, LogDebug, EcalTPGPedestal::mean_x1, EcalTPGPedestal::mean_x12, EcalTPGPedestal::mean_x6, mult_, EcalTPGLinearizationConstant::mult_x1, EcalTPGLinearizationConstant::mult_x12, EcalTPGLinearizationConstant::mult_x6, peds_, EcalMGPASample::raw(), shift_, EcalTPGLinearizationConstant::shift_x1, EcalTPGLinearizationConstant::shift_x12, EcalTPGLinearizationConstant::shift_x6, and uncorrectedSample_.

Referenced by process().

◆ setParameters()

void EcalEBFenixLinearizer::setParameters ( uint32_t  raw,
const EcalTPGPedestals ecaltpPed,
const EcalTPGLinearizationConst ecaltpLin,
const EcalTPGCrystalStatus ecaltpBadX 
)

Definition at line 20 of file EcalEBFenixLinearizer.cc.

23  {
24  const EcalTPGLinearizationConstMap &linMap = ecaltpLin->getMap();
26 
27  if (it != linMap.end()) {
28  linConsts_ = &(*it);
29  } else
30  std::cout << " could not find EcalTPGLinearizationConstMap entry for " << raw << std::endl;
31 
32  EcalTPGPedestalsMapIterator itped = ecaltpPed->find(raw);
33  if (itped != ecaltpPed->end())
34  peds_ = &(*itped);
35  else
36  std::cout << " could not find EcalTPGPedestalsMap entry for " << raw << std::endl;
37 
38  const EcalTPGCrystalStatusMap &badXMap = ecaltpBadX->getMap();
39  EcalTPGCrystalStatusMapIterator itbadX = badXMap.find(raw);
40 
41  if (itbadX != badXMap.end()) {
42  badXStatus_ = &(*itbadX);
43  } else {
44  edm::LogWarning("EcalTPG") << " could not find EcalTPGCrystalStatusMap entry for " << raw;
46  vectorbadXStatus_.push_back(&(*badXStatus_));
47  init_ = true;
48  }
49 }

References badXStatus_, gather_cfg::cout, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), EcalCondObjectContainer< T >::getMap(), init_, linConsts_, peds_, and vectorbadXStatus_.

Referenced by EcalEBTrigPrimTestAlgo::run().

Member Data Documentation

◆ badXStatus_

const EcalTPGCrystalStatusCode* EcalEBFenixLinearizer::badXStatus_
private

Definition at line 32 of file EcalEBFenixLinearizer.h.

Referenced by setInput(), and setParameters().

◆ base_

int EcalEBFenixLinearizer::base_
private

Definition at line 24 of file EcalEBFenixLinearizer.h.

Referenced by process(), and setInput().

◆ famos_

bool EcalEBFenixLinearizer::famos_
private

Definition at line 21 of file EcalEBFenixLinearizer.h.

Referenced by process(), and setInput().

◆ gainID_

int EcalEBFenixLinearizer::gainID_
private

Definition at line 23 of file EcalEBFenixLinearizer.h.

Referenced by setInput().

◆ init_

bool EcalEBFenixLinearizer::init_
private

Definition at line 28 of file EcalEBFenixLinearizer.h.

Referenced by setParameters(), and ~EcalEBFenixLinearizer().

◆ linConsts_

const EcalTPGLinearizationConstant* EcalEBFenixLinearizer::linConsts_
private

Definition at line 30 of file EcalEBFenixLinearizer.h.

Referenced by setInput(), and setParameters().

◆ mult_

int EcalEBFenixLinearizer::mult_
private

Definition at line 25 of file EcalEBFenixLinearizer.h.

Referenced by process(), and setInput().

◆ peds_

const EcalTPGPedestal* EcalEBFenixLinearizer::peds_
private

Definition at line 31 of file EcalEBFenixLinearizer.h.

Referenced by setInput(), and setParameters().

◆ shift_

int EcalEBFenixLinearizer::shift_
private

Definition at line 26 of file EcalEBFenixLinearizer.h.

Referenced by process(), and setInput().

◆ strip_

int EcalEBFenixLinearizer::strip_
private

Definition at line 27 of file EcalEBFenixLinearizer.h.

◆ uncorrectedSample_

int EcalEBFenixLinearizer::uncorrectedSample_
private

Definition at line 22 of file EcalEBFenixLinearizer.h.

Referenced by process(), and setInput().

◆ vectorbadXStatus_

std::vector<const EcalTPGCrystalStatusCode *> EcalEBFenixLinearizer::vectorbadXStatus_
private

Definition at line 34 of file EcalEBFenixLinearizer.h.

Referenced by setParameters(), and ~EcalEBFenixLinearizer().

EcalCondObjectContainer::getMap
const self & getMap() const
Definition: EcalCondObjectContainer.h:78
EcalCondObjectContainer::end
const_iterator end() const
Definition: EcalCondObjectContainer.h:74
EcalTPGCrystalStatusCode::getStatusCode
uint16_t getStatusCode() const
Definition: EcalTPGCrystalStatusCode.h:26
mps_fire.i
i
Definition: mps_fire.py:428
EcalTPGLinearizationConstant::shift_x1
uint32_t shift_x1
Definition: EcalTPGLinearizationConst.h:16
EcalEBFenixLinearizer::peds_
const EcalTPGPedestal * peds_
Definition: EcalEBFenixLinearizer.h:31
EcalTPGPedestal::mean_x1
uint32_t mean_x1
Definition: EcalTPGPedestals.h:12
EcalEBFenixLinearizer::setInput
int setInput(const EcalMGPASample &RawSam)
Definition: EcalEBFenixLinearizer.cc:67
EcalTPGLinearizationConstant::mult_x6
uint32_t mult_x6
Definition: EcalTPGLinearizationConst.h:12
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
EcalEBFenixLinearizer::linConsts_
const EcalTPGLinearizationConstant * linConsts_
Definition: EcalEBFenixLinearizer.h:30
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EcalTPGPedestalsMapIterator
EcalTPGPedestalsMap::const_iterator EcalTPGPedestalsMapIterator
Definition: EcalTPGPedestals.h:18
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
EcalTPGCrystalStatusMapIterator
EcalTPGCrystalStatusMap::const_iterator EcalTPGCrystalStatusMapIterator
Definition: EcalTPGCrystalStatus.h:18
EcalMGPASample::gainId
int gainId() const
get the gainId (2 bits)
Definition: EcalMGPASample.h:33
EcalMGPASample::adc
int adc() const
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:31
EcalTPGLinearizationConstMapIterator
EcalCondObjectContainer< EcalTPGLinearizationConstant >::const_iterator EcalTPGLinearizationConstMapIterator
Definition: EcalTPGLinearizationConst.h:22
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
EcalEBFenixLinearizer::shift_
int shift_
Definition: EcalEBFenixLinearizer.h:26
EcalMGPASample::raw
uint16_t raw() const
get the raw word
Definition: EcalMGPASample.h:29
EcalEBFenixLinearizer::vectorbadXStatus_
std::vector< const EcalTPGCrystalStatusCode * > vectorbadXStatus_
Definition: EcalEBFenixLinearizer.h:34
EcalEBFenixLinearizer::famos_
bool famos_
Definition: EcalEBFenixLinearizer.h:21
EcalEBFenixLinearizer::badXStatus_
const EcalTPGCrystalStatusCode * badXStatus_
Definition: EcalEBFenixLinearizer.h:32
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
EcalTPGLinearizationConstant::mult_x12
uint32_t mult_x12
Definition: EcalTPGLinearizationConst.h:11
EcalTPGLinearizationConstant::mult_x1
uint32_t mult_x1
Definition: EcalTPGLinearizationConst.h:13
EcalTPGPedestal::mean_x6
uint32_t mean_x6
Definition: EcalTPGPedestals.h:11
createfilelist.int
int
Definition: createfilelist.py:10
EcalTPGLinearizationConstant::shift_x6
uint32_t shift_x6
Definition: EcalTPGLinearizationConst.h:15
EcalEBFenixLinearizer::base_
int base_
Definition: EcalEBFenixLinearizer.h:24
EcalTPGLinearizationConstant::shift_x12
uint32_t shift_x12
Definition: EcalTPGLinearizationConst.h:14
EcalEBFenixLinearizer::gainID_
int gainID_
Definition: EcalEBFenixLinearizer.h:23
hgcalPerformanceValidation.df
df
Definition: hgcalPerformanceValidation.py:733
EcalTPGCrystalStatusCode
Definition: EcalTPGCrystalStatusCode.h:14
EcalEBFenixLinearizer::process
int process()
Definition: EcalEBFenixLinearizer.cc:51
EcalEBFenixLinearizer::uncorrectedSample_
int uncorrectedSample_
Definition: EcalEBFenixLinearizer.h:22
EcalEBFenixLinearizer::init_
bool init_
Definition: EcalEBFenixLinearizer.h:28
EcalTPGPedestal::mean_x12
uint32_t mean_x12
Definition: EcalTPGPedestals.h:10
EcalEBFenixLinearizer::mult_
int mult_
Definition: EcalEBFenixLinearizer.h:25