CMS 3D CMS Logo

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

#include <EcalEBPhase2Linearizer.h>

Public Member Functions

 EcalEBPhase2Linearizer (bool debug)
 
void process (const EBDigiCollectionPh2::Digi &df, std::vector< int > &output_percry)
 
void setParameters (EBDetId id, const EcalLiteDTUPedestalsMap *peds, const EcalEBPhase2TPGLinearizationConstMap *ecaltplin, const EcalTPGCrystalStatus *ecaltpBadX)
 
virtual ~EcalEBPhase2Linearizer ()
 

Private Member Functions

int doOutput ()
 
int setInput (const EcalLiteDTUSample &RawSam)
 

Private Attributes

const EcalTPGCrystalStatusCodebadXStatus_
 
uint base_
 
uint coeff_
 
std::vector< uint > coeffs_
 
bool debug_
 
float gainDivideByTen_ = 0.1
 
int gainID_
 
uint I2CSub_
 
bool init_
 
const EcalEBPhase2TPGLinearizationConstantlinConsts_
 
uint mult_
 
const EcalLiteDTUPedestalspeds_
 
uint shift_
 
int strip_
 
int uncorrectedSample_
 
std::vector< const EcalTPGCrystalStatusCode * > vectorbadXStatus_
 

Detailed Description

Author
L. Lutton, N. Marinelli - Univ. of Notre Dame Description: forPhase II Performs the linearization of signal from Catia+LiteDTU

Definition at line 20 of file EcalEBPhase2Linearizer.h.

Constructor & Destructor Documentation

◆ EcalEBPhase2Linearizer()

EcalEBPhase2Linearizer::EcalEBPhase2Linearizer ( bool  debug)

Definition at line 7 of file EcalEBPhase2Linearizer.cc.

8  : debug_(debug), init_(false), peds_(nullptr), badXStatus_(nullptr) {}
const EcalLiteDTUPedestals * peds_
#define debug
Definition: HDRShower.cc:19
const EcalTPGCrystalStatusCode * badXStatus_

◆ ~EcalEBPhase2Linearizer()

EcalEBPhase2Linearizer::~EcalEBPhase2Linearizer ( )
virtual

Definition at line 10 of file EcalEBPhase2Linearizer.cc.

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

10  {
11  if (init_) {
12  for (int i = 0; i < (int)vectorbadXStatus_.size(); i++) {
13  delete vectorbadXStatus_[i];
14  }
15  }
16 }
std::vector< const EcalTPGCrystalStatusCode * > vectorbadXStatus_

Member Function Documentation

◆ doOutput()

int EcalEBPhase2Linearizer::doOutput ( )
private

Definition at line 50 of file EcalEBPhase2Linearizer.cc.

References base_, I2CSub_, mult_, convertSQLitetoXML_cfg::output, shift_, parallelization::uint, and uncorrectedSample_.

Referenced by process().

50  {
51  int tmpIntOut;
52  if (uncorrectedSample_) {
53  tmpIntOut = (uncorrectedSample_ - base_ + I2CSub_); //Substract base. Add I2C
54  } else {
55  tmpIntOut = 0;
56  }
57  if (tmpIntOut < 0) {
58  tmpIntOut = 0;
59  }
60  uint output = tmpIntOut;
61  output = (output * mult_) >> shift_;
62  // protect against saturation
63  // ...........
64 
65  return output;
66 }
Definition: output.py:1

◆ process()

void EcalEBPhase2Linearizer::process ( const EBDigiCollectionPh2::Digi df,
std::vector< int > &  output_percry 
)

Definition at line 89 of file EcalEBPhase2Linearizer.cc.

References base_, debug_, das-up-to-nevents::df, doOutput(), gainID_, mps_fire::i, I2CSub_, LogDebug, mult_, setInput(), and shift_.

Referenced by EcalEBPhase2TrigPrimAlgo::run().

89  {
90  //We know a tower numbering is: // S1 S2 S3 S4 S5
91 
92  // 4 5 14 15 24
93  // 3 6 13 16 23
94  // 2 7 12 17 22
95  // 1 8 11 18 21
96  // 0 9 10 19 20
97 
98  for (int i = 0; i < df.size(); i++) {
99  EcalLiteDTUSample thisSample = df[i];
100  setInput(thisSample);
101  output_percry[i] = doOutput();
102  }
103 
104  if (debug_) {
105  LogDebug("EcalEBPhase2Linearizer") << " mult "
106  << " ";
107  for (int i = 0; i < df.size(); i++) {
108  EcalLiteDTUSample thisSample = df[i];
109  setInput(thisSample);
110  LogDebug("") << mult_ << " ";
111  }
112  LogDebug("") << " " << std::endl;
113 
114  LogDebug("") << " gainID "
115  << " ";
116  for (int i = 0; i < df.size(); i++) {
117  EcalLiteDTUSample thisSample = df[i];
118  setInput(thisSample);
119  LogDebug("") << gainID_ << " ";
120  }
121  LogDebug("") << " " << std::endl;
122 
123  LogDebug("") << " Ped "
124  << " ";
125  for (int i = 0; i < df.size(); i++) {
126  EcalLiteDTUSample thisSample = df[i];
127  setInput(thisSample);
128  LogDebug("") << base_ << " ";
129  }
130  LogDebug("") << " " << std::endl;
131 
132  LogDebug("") << " i2c "
133  << " ";
134  for (int i = 0; i < df.size(); i++) {
135  EcalLiteDTUSample thisSample = df[i];
136  setInput(thisSample);
137  LogDebug("") << I2CSub_ << " ";
138  }
139  LogDebug("") << " " << std::endl;
140 
141  LogDebug("") << " shift "
142  << " ";
143  for (int i = 0; i < df.size(); i++) {
144  EcalLiteDTUSample thisSample = df[i];
145  setInput(thisSample);
146  LogDebug("") << shift_ << " ";
147  }
148  LogDebug("") << " " << std::endl;
149 
150  LogDebug("") << " lin out "
151  << " ";
152  for (int i = 0; i < df.size(); i++) {
153  LogDebug("") << output_percry[i] << " ";
154  }
155 
156  LogDebug("") << " " << std::endl;
157 
158  LogDebug("") << " EcalEBPhase2Linearizer::process(const .. Final output " << std::endl;
159  LogDebug("") << " output_percry "
160  << " ";
161  for (int i = 0; i < df.size(); i++) {
162  LogDebug("") << output_percry[i] << " ";
163  }
164  LogDebug("") << " " << std::endl;
165  }
166  return;
167 }
int setInput(const EcalLiteDTUSample &RawSam)
#define LogDebug(id)

◆ setInput()

int EcalEBPhase2Linearizer::setInput ( const EcalLiteDTUSample RawSam)
private

Definition at line 68 of file EcalEBPhase2Linearizer.cc.

References EcalLiteDTUSample::adc(), base_, EcalLiteDTUSample::gainId(), gainID_, I2CSub_, EcalEBPhase2TPGLinearizationConstant::i2cSub_x1, EcalEBPhase2TPGLinearizationConstant::i2cSub_x10, linConsts_, EcalLiteDTUPedestals::mean(), mult_, EcalEBPhase2TPGLinearizationConstant::mult_x1, EcalEBPhase2TPGLinearizationConstant::mult_x10, peds_, shift_, EcalEBPhase2TPGLinearizationConstant::shift_x1, EcalEBPhase2TPGLinearizationConstant::shift_x10, and uncorrectedSample_.

Referenced by process().

70 {
71  uncorrectedSample_ = RawSam.adc(); //uncorrectedSample_
72  gainID_ = RawSam.gainId();
73 
74  base_ = peds_->mean(gainID_);
75 
76  if (gainID_ == 0) {
80  } else {
84  }
85 
86  return 1;
87 }
const EcalEBPhase2TPGLinearizationConstant * linConsts_
int adc() const
get the ADC sample (12 bits)
float mean(unsigned int i) const
const EcalLiteDTUPedestals * peds_
int gainId() const
get the gainId (2 bits)

◆ setParameters()

void EcalEBPhase2Linearizer::setParameters ( EBDetId  id,
const EcalLiteDTUPedestalsMap peds,
const EcalEBPhase2TPGLinearizationConstMap ecaltplin,
const EcalTPGCrystalStatus ecaltpBadX 
)

Definition at line 18 of file EcalEBPhase2Linearizer.cc.

References badXStatus_, hcalRecHitTable_cff::detId, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), EcalCondObjectContainer< T >::getMap(), init_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, linConsts_, peds_, and vectorbadXStatus_.

Referenced by EcalEBPhase2TrigPrimAlgo::run().

23 {
24  EcalLiteDTUPedestalsMap::const_iterator itped = ecaltpPed->getMap().find(detId);
25  if (itped != ecaltpPed->end())
26  peds_ = &(*itped);
27  else
28  edm::LogError("EcalEBPhase2Linearizer") << " could not find EcalLiteDTUPedestal entry for " << detId << std::endl;
29 
30  const EcalEBPhase2TPGLinearizationConstMap &linMap = ecaltpLin->getMap();
32  if (it != linMap.end()) {
33  linConsts_ = &(*it);
34  } else
35  edm::LogError("EcalEBPhase2Linearizer")
36  << " could not find EcalEBPhase2TPGLinearizationConstMap entry for " << detId.rawId() << std::endl;
37 
38  const EcalTPGCrystalStatusMap &badXMap = ecaltpBadX->getMap();
39  EcalTPGCrystalStatusMapIterator itbadX = badXMap.find(detId.rawId());
40  if (itbadX != badXMap.end()) {
41  badXStatus_ = &(*itbadX);
42  } else {
43  edm::LogWarning("EcalTPG") << " could not find EcalTPGCrystalStatusMap entry for " << detId.rawId();
45  vectorbadXStatus_.push_back(&(*badXStatus_));
46  init_ = true;
47  }
48 }
const EcalEBPhase2TPGLinearizationConstant * linConsts_
std::vector< const EcalTPGCrystalStatusCode * > vectorbadXStatus_
EcalCondObjectContainer< EcalEBPhase2TPGLinearizationConstant >::const_iterator EcalEBPhase2TPGLinearizationConstMapIterator
Log< level::Error, false > LogError
EcalTPGCrystalStatusMap::const_iterator EcalTPGCrystalStatusMapIterator
const_iterator find(uint32_t rawId) const
const EcalLiteDTUPedestals * peds_
std::vector< Item >::const_iterator const_iterator
const EcalTPGCrystalStatusCode * badXStatus_
const_iterator end() const
Log< level::Warning, false > LogWarning

Member Data Documentation

◆ badXStatus_

const EcalTPGCrystalStatusCode* EcalEBPhase2Linearizer::badXStatus_
private

Definition at line 39 of file EcalEBPhase2Linearizer.h.

Referenced by setParameters().

◆ base_

uint EcalEBPhase2Linearizer::base_
private

Definition at line 25 of file EcalEBPhase2Linearizer.h.

Referenced by doOutput(), process(), and setInput().

◆ coeff_

uint EcalEBPhase2Linearizer::coeff_
private

Definition at line 32 of file EcalEBPhase2Linearizer.h.

◆ coeffs_

std::vector<uint> EcalEBPhase2Linearizer::coeffs_
private

Definition at line 31 of file EcalEBPhase2Linearizer.h.

◆ debug_

bool EcalEBPhase2Linearizer::debug_
private

Definition at line 22 of file EcalEBPhase2Linearizer.h.

Referenced by process().

◆ gainDivideByTen_

float EcalEBPhase2Linearizer::gainDivideByTen_ = 0.1
private

Definition at line 30 of file EcalEBPhase2Linearizer.h.

◆ gainID_

int EcalEBPhase2Linearizer::gainID_
private

Definition at line 24 of file EcalEBPhase2Linearizer.h.

Referenced by process(), and setInput().

◆ I2CSub_

uint EcalEBPhase2Linearizer::I2CSub_
private

Definition at line 35 of file EcalEBPhase2Linearizer.h.

Referenced by doOutput(), process(), and setInput().

◆ init_

bool EcalEBPhase2Linearizer::init_
private

Definition at line 29 of file EcalEBPhase2Linearizer.h.

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

◆ linConsts_

const EcalEBPhase2TPGLinearizationConstant* EcalEBPhase2Linearizer::linConsts_
private

Definition at line 38 of file EcalEBPhase2Linearizer.h.

Referenced by setInput(), and setParameters().

◆ mult_

uint EcalEBPhase2Linearizer::mult_
private

Definition at line 26 of file EcalEBPhase2Linearizer.h.

Referenced by doOutput(), process(), and setInput().

◆ peds_

const EcalLiteDTUPedestals* EcalEBPhase2Linearizer::peds_
private

Definition at line 37 of file EcalEBPhase2Linearizer.h.

Referenced by setInput(), and setParameters().

◆ shift_

uint EcalEBPhase2Linearizer::shift_
private

Definition at line 27 of file EcalEBPhase2Linearizer.h.

Referenced by doOutput(), process(), and setInput().

◆ strip_

int EcalEBPhase2Linearizer::strip_
private

Definition at line 28 of file EcalEBPhase2Linearizer.h.

◆ uncorrectedSample_

int EcalEBPhase2Linearizer::uncorrectedSample_
private

Definition at line 23 of file EcalEBPhase2Linearizer.h.

Referenced by doOutput(), and setInput().

◆ vectorbadXStatus_

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

Definition at line 41 of file EcalEBPhase2Linearizer.h.

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