CMS 3D CMS Logo

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

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

#include <EcalFenixLinearizer.h>

Public Member Functions

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

Private Member Functions

int process ()
 
int process ()
 
int setInput (const EcalMGPASample &RawSam)
 
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 EcalFenixLinearizer.h.

Constructor & Destructor Documentation

◆ EcalFenixLinearizer() [1/2]

EcalFenixLinearizer::EcalFenixLinearizer ( bool  famos)

Definition at line 9 of file EcalFenixLinearizer.cc.

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

◆ ~EcalFenixLinearizer() [1/2]

EcalFenixLinearizer::~EcalFenixLinearizer ( )
virtual

Definition at line 12 of file EcalFenixLinearizer.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_.

◆ EcalFenixLinearizer() [2/2]

EcalFenixLinearizer::EcalFenixLinearizer ( bool  famos)

◆ ~EcalFenixLinearizer() [2/2]

virtual EcalFenixLinearizer::~EcalFenixLinearizer ( )
virtual

Member Function Documentation

◆ process() [1/4]

int EcalFenixLinearizer::process ( )
private

Definition at line 51 of file EcalFenixLinearizer.cc.

51  {
52  int output = (uncorrectedSample_ - base_); //Substract base
53  //std::cout << " EcalFenixLinearizer::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 << " EcalFenixLinearizer::process() output 2nd step " << output << std::endl;
61  if (output > 0X3FFFF)
62  output = 0X3FFFF; //Saturation if too high
63  //std::cout << " EcalFenixLinearizer::process() output 3rd step " << output << std::endl;
64  return output;
65 }

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

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

◆ process() [2/4]

int EcalFenixLinearizer::process ( )
private

◆ process() [3/4]

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

◆ process() [4/4]

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

Definition at line 52 of file EcalFenixLinearizer.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  //std::cout << " EcalFenixLinearizer::process(const .. DataFrame " << std::endl;
63  for (int i = 0; i < df.size(); i++) {
64  //std::cout << df[i] << " ";
65  }
66 
67  for (int i = 0; i < df.size(); i++) {
68  setInput(df[i]);
69  output_percry[i] = process();
70  }
71 
72  //std::cout << " EcalFenixLinearizer::process(const .. Final output " << std::endl;
73  for (int i = 0; i < df.size(); i++) {
74  //std::cout << " output_percry " << output_percry[i]<< " ";
75  }
76 
77  return;
78 }

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

◆ setInput() [1/2]

int EcalFenixLinearizer::setInput ( const EcalMGPASample RawSam)
private

◆ setInput() [2/2]

int EcalFenixLinearizer::setInput ( const EcalMGPASample RawSam)
private

Definition at line 67 of file EcalFenixLinearizer.cc.

67  {
68  //std::cout << " EcalFenixLinearizer::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 << " EcalFenixLinearizer::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() [1/2]

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

◆ setParameters() [2/2]

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

Definition at line 20 of file EcalFenixLinearizer.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 EcalFenixStrip::process_part1(), and EcalEBTrigPrimTestAlgo::run().

Member Data Documentation

◆ badXStatus_

const EcalTPGCrystalStatusCode * EcalFenixLinearizer::badXStatus_
private

Definition at line 32 of file EcalFenixLinearizer.h.

Referenced by setInput(), and setParameters().

◆ base_

int EcalFenixLinearizer::base_
private

Definition at line 24 of file EcalFenixLinearizer.h.

Referenced by process(), and setInput().

◆ famos_

bool EcalFenixLinearizer::famos_
private

Definition at line 21 of file EcalFenixLinearizer.h.

Referenced by process(), and setInput().

◆ gainID_

int EcalFenixLinearizer::gainID_
private

Definition at line 23 of file EcalFenixLinearizer.h.

Referenced by setInput().

◆ init_

bool EcalFenixLinearizer::init_
private

Definition at line 28 of file EcalFenixLinearizer.h.

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

◆ linConsts_

const EcalTPGLinearizationConstant * EcalFenixLinearizer::linConsts_
private

Definition at line 30 of file EcalFenixLinearizer.h.

Referenced by setInput(), and setParameters().

◆ mult_

int EcalFenixLinearizer::mult_
private

Definition at line 25 of file EcalFenixLinearizer.h.

Referenced by process(), and setInput().

◆ peds_

const EcalTPGPedestal * EcalFenixLinearizer::peds_
private

Definition at line 31 of file EcalFenixLinearizer.h.

Referenced by setInput(), and setParameters().

◆ shift_

int EcalFenixLinearizer::shift_
private

Definition at line 26 of file EcalFenixLinearizer.h.

Referenced by process(), and setInput().

◆ strip_

int EcalFenixLinearizer::strip_
private

Definition at line 27 of file EcalFenixLinearizer.h.

◆ uncorrectedSample_

int EcalFenixLinearizer::uncorrectedSample_
private

Definition at line 22 of file EcalFenixLinearizer.h.

Referenced by process(), and setInput().

◆ vectorbadXStatus_

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

Definition at line 34 of file EcalFenixLinearizer.h.

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

EcalCondObjectContainer::getMap
const self & getMap() const
Definition: EcalCondObjectContainer.h:80
EcalCondObjectContainer::end
const_iterator end() const
Definition: EcalCondObjectContainer.h:76
EcalTPGCrystalStatusCode::getStatusCode
uint16_t getStatusCode() const
Definition: EcalTPGCrystalStatusCode.h:26
mps_fire.i
i
Definition: mps_fire.py:355
EcalTPGLinearizationConstant::shift_x1
uint32_t shift_x1
Definition: EcalTPGLinearizationConst.h:16
EcalTPGPedestal::mean_x1
uint32_t mean_x1
Definition: EcalTPGPedestals.h:12
EcalTPGLinearizationConstant::mult_x6
uint32_t mult_x6
Definition: EcalTPGLinearizationConst.h:12
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
EcalFenixLinearizer::mult_
int mult_
Definition: EcalFenixLinearizer.h:25
EcalFenixLinearizer::peds_
const EcalTPGPedestal * peds_
Definition: EcalFenixLinearizer.h:31
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EcalTPGPedestalsMapIterator
EcalTPGPedestalsMap::const_iterator EcalTPGPedestalsMapIterator
Definition: EcalTPGPedestals.h:18
EcalFenixLinearizer::base_
int base_
Definition: EcalFenixLinearizer.h:24
EcalCondObjectContainer< EcalTPGLinearizationConstant >
EcalFenixLinearizer::shift_
int shift_
Definition: EcalFenixLinearizer.h:26
EcalFenixLinearizer::vectorbadXStatus_
std::vector< const EcalTPGCrystalStatusCode * > vectorbadXStatus_
Definition: EcalFenixLinearizer.h:34
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
EcalFenixLinearizer::famos_
bool famos_
Definition: EcalFenixLinearizer.h:21
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
EcalMGPASample::raw
uint16_t raw() const
get the raw word
Definition: EcalMGPASample.h:29
edm::LogWarning
Definition: MessageLogger.h:141
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
EcalTPGLinearizationConstant::mult_x12
uint32_t mult_x12
Definition: EcalTPGLinearizationConst.h:11
EcalTPGLinearizationConstant::mult_x1
uint32_t mult_x1
Definition: EcalTPGLinearizationConst.h:13
EcalFenixLinearizer::uncorrectedSample_
int uncorrectedSample_
Definition: EcalFenixLinearizer.h:22
EcalTPGPedestal::mean_x6
uint32_t mean_x6
Definition: EcalTPGPedestals.h:11
EcalFenixLinearizer::linConsts_
const EcalTPGLinearizationConstant * linConsts_
Definition: EcalFenixLinearizer.h:30
createfilelist.int
int
Definition: createfilelist.py:10
EcalFenixLinearizer::process
int process()
Definition: EcalFenixLinearizer.cc:51
EcalTPGLinearizationConstant::shift_x6
uint32_t shift_x6
Definition: EcalTPGLinearizationConst.h:15
EcalFenixLinearizer::badXStatus_
const EcalTPGCrystalStatusCode * badXStatus_
Definition: EcalFenixLinearizer.h:32
EcalTPGLinearizationConstant::shift_x12
uint32_t shift_x12
Definition: EcalTPGLinearizationConst.h:14
EcalFenixLinearizer::gainID_
int gainID_
Definition: EcalFenixLinearizer.h:23
EcalFenixLinearizer::setInput
int setInput(const EcalMGPASample &RawSam)
Definition: EcalFenixLinearizer.cc:67
EcalFenixLinearizer::init_
bool init_
Definition: EcalFenixLinearizer.h:28
EcalTPGCrystalStatusCode
Definition: EcalTPGCrystalStatusCode.h:14
EcalTPGPedestal::mean_x12
uint32_t mean_x12
Definition: EcalTPGPedestals.h:10