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)
 
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 ~EcalFenixLinearizer ()
 

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 EcalFenixLinearizer.h.

Constructor & Destructor Documentation

◆ EcalFenixLinearizer()

EcalFenixLinearizer::EcalFenixLinearizer ( bool  famos)

Definition at line 9 of file EcalFenixLinearizer.cc.

9 : famos_(famos), init_(false) {}

◆ ~EcalFenixLinearizer()

EcalFenixLinearizer::~EcalFenixLinearizer ( )
virtual

Definition at line 11 of file EcalFenixLinearizer.cc.

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

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

Member Function Documentation

◆ process() [1/2]

int EcalFenixLinearizer::process ( )
private

Definition at line 50 of file EcalFenixLinearizer.cc.

50  {
51  int output = (uncorrectedSample_ - base_); // Substract base
52  if (famos_ || output < 0)
53  return 0;
54 
55  if (output < 0)
56  return shift_ << 12; // FENIX bug(!)
57  output = (output * mult_) >> (shift_ + 2); // Apply multiplicative factor
58  if (output > 0X3FFFF)
59  output = 0X3FFFF; // Saturation if too high
60  return output;
61 }

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

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

◆ process() [2/2]

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  for (int i = 0; i < df.size(); i++) {
62  setInput(df[i]);
63  output_percry[i] = process();
64  }
65 
66  return;
67 }

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

◆ setInput()

int EcalFenixLinearizer::setInput ( const EcalMGPASample RawSam)
private

Definition at line 63 of file EcalFenixLinearizer.cc.

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

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 EcalFenixLinearizer::setParameters ( uint32_t  raw,
const EcalTPGPedestals ecaltpPed,
const EcalTPGLinearizationConst ecaltpLin,
const EcalTPGCrystalStatus ecaltpBadX 
)

Definition at line 19 of file EcalFenixLinearizer.cc.

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

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

Referenced by EcalFenixStrip::process_part1().

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: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
EcalTPGPedestal::mean_x1
uint32_t mean_x1
Definition: EcalTPGPedestals.h:12
EcalFenixLinearizer::vectorbadXStatus_
std::vector< const EcalTPGCrystalStatusCode * > vectorbadXStatus_
Definition: EcalFenixLinearizer.h:34
EcalTPGLinearizationConstant::mult_x6
uint32_t mult_x6
Definition: EcalTPGLinearizationConst.h:12
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
EcalFenixLinearizer::mult_
int mult_
Definition: EcalFenixLinearizer.h:25
EcalTPGPedestalsMapIterator
EcalTPGPedestalsMap::const_iterator EcalTPGPedestalsMapIterator
Definition: EcalTPGPedestals.h:18
EcalFenixLinearizer::base_
int base_
Definition: EcalFenixLinearizer.h:24
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
EcalFenixLinearizer::shift_
int shift_
Definition: EcalFenixLinearizer.h:26
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
EcalFenixLinearizer::peds_
const EcalTPGPedestal * peds_
Definition: EcalFenixLinearizer.h:31
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
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
EcalFenixLinearizer::uncorrectedSample_
int uncorrectedSample_
Definition: EcalFenixLinearizer.h:22
EcalTPGPedestal::mean_x6
uint32_t mean_x6
Definition: EcalTPGPedestals.h:11
createfilelist.int
int
Definition: createfilelist.py:10
EcalFenixLinearizer::process
int process()
Definition: EcalFenixLinearizer.cc:50
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:63
EcalFenixLinearizer::init_
bool init_
Definition: EcalFenixLinearizer.h:28
hgcalPerformanceValidation.df
df
Definition: hgcalPerformanceValidation.py:733
EcalFenixLinearizer::linConsts_
const EcalTPGLinearizationConstant * linConsts_
Definition: EcalFenixLinearizer.h:30
EcalTPGCrystalStatusCode
Definition: EcalTPGCrystalStatusCode.h:14
EcalTPGPedestal::mean_x12
uint32_t mean_x12
Definition: EcalTPGPedestals.h:10