CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
EcalTPGLinearizationConstant
linConsts_
 
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 ( bool  famos)

Definition at line 9 of file EcalFenixLinearizer.cc.

10  : famos_(famos), init_(false)
11 {
12 }
EcalFenixLinearizer::~EcalFenixLinearizer ( )
virtual

Definition at line 14 of file EcalFenixLinearizer.cc.

References i, init_, and vectorbadXStatus_.

14  {
15  if (init_) {
16  for (int i=0;i<(int)vectorbadXStatus_.size();i++){
17  delete vectorbadXStatus_[i];
18  }
19  }
20 }
int i
Definition: DBlmapReader.cc:9
std::vector< const EcalTPGCrystalStatusCode * > vectorbadXStatus_

Member Function Documentation

int EcalFenixLinearizer::process ( )
private

Definition at line 51 of file EcalFenixLinearizer.cc.

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

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare_FASTSIM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), process(), EcalFenixStrip::process_part1(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

52 {
53  int output=(uncorrectedSample_-base_); //Substract base
54  if(famos_ && output<0) return 0;
55 
56  if(output<0) return shift_ << 12; // FENIX bug(!)
57  output=(output*mult_)>>(shift_+2); //Apply multiplicative factor
58  if(output>0X3FFFF)output=0X3FFFF; //Saturation if too high
59  return output;
60 }
template<class T >
void EcalFenixLinearizer::process ( const T df,
std::vector< int > &  output_percry 
)
int EcalFenixLinearizer::setInput ( const EcalMGPASample RawSam)
private

Definition at line 62 of file EcalFenixLinearizer.cc.

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

Referenced by process().

63 {
64  if(RawSam.raw()>0X3FFF)
65  {
66  LogDebug("EcalTPG")<<"ERROR IN INPUT SAMPLE OF FENIX LINEARIZER";
67  return -1;
68  }
69  uncorrectedSample_=RawSam.adc(); //uncorrectedSample_ is coded in the 12 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  {
75  base_ = 0;
76  shift_ = 0;
77  mult_ = 0xFF;
78  if((linConsts_->mult_x12 == 0) && (linConsts_->mult_x6 == 0) && (linConsts_->mult_x1 == 0))
79  {
80  mult_ = 0; // Implemented in CCSSupervisor to
81  // reject overflow cases in rejected channels
82  }
83  }
84  else if (gainID_==1) {
85  base_ = peds_ -> mean_x12;
86  shift_ = linConsts_ -> shift_x12;
87 
88  // take into account the badX
89  // badXStatus_ == 0 if the crystal works
90  // badXStatus_ !=0 some problem with the crystal
91  if (badXStatus_->getStatusCode()!=0){
92  mult_ = 0;
93  }
94  else{
95  mult_ = linConsts_ -> mult_x12;
96  }
97  }
98  else if (gainID_==2) {
99  base_ = peds_ -> mean_x6;
100  shift_ = linConsts_ -> shift_x6;
101 
102  // take into account the badX
103  // check if the badX has a status code=0 or 1
104  if (badXStatus_->getStatusCode()!=0){
105  mult_ = 0;
106  }
107  else{
108  mult_ = linConsts_ -> mult_x6;
109  }
110  }
111  else if (gainID_==3){
112  base_ = peds_-> mean_x1;
113  shift_ = linConsts_ -> shift_x1;
114 
115  // take into account the badX
116  // check if the badX has a status code=0 or 1
117  if (badXStatus_->getStatusCode()!=0){
118  mult_ = 0;
119  }
120  else{
121  mult_ = linConsts_ -> mult_x1;
122  }
123  }
124 
125 
126  if (famos_) base_=200; //FIXME by preparing a correct TPG.txt for Famos
127 
128  return 1;
129 }
#define LogDebug(id)
const EcalTPGPedestal * peds_
uint16_t raw() const
get the raw word
int gainId() const
get the gainId (2 bits)
const EcalTPGLinearizationConstant * linConsts_
const EcalTPGCrystalStatusCode * badXStatus_
int adc() const
get the ADC sample (12 bits)
void EcalFenixLinearizer::setParameters ( uint32_t  raw,
const EcalTPGPedestals ecaltpPed,
const EcalTPGLinearizationConst ecaltpLin,
const EcalTPGCrystalStatus ecaltpBadX 
)

Definition at line 22 of file EcalFenixLinearizer.cc.

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

Referenced by EcalFenixStrip::process_part1().

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

Member Data Documentation

const EcalTPGCrystalStatusCode* EcalFenixLinearizer::badXStatus_
private

Definition at line 34 of file EcalFenixLinearizer.h.

Referenced by setInput(), and setParameters().

int EcalFenixLinearizer::base_
private

Definition at line 26 of file EcalFenixLinearizer.h.

Referenced by process(), and setInput().

bool EcalFenixLinearizer::famos_
private

Definition at line 23 of file EcalFenixLinearizer.h.

Referenced by process(), and setInput().

int EcalFenixLinearizer::gainID_
private

Definition at line 25 of file EcalFenixLinearizer.h.

Referenced by setInput().

bool EcalFenixLinearizer::init_
private

Definition at line 30 of file EcalFenixLinearizer.h.

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

const EcalTPGLinearizationConstant* EcalFenixLinearizer::linConsts_
private

Definition at line 32 of file EcalFenixLinearizer.h.

Referenced by setInput(), and setParameters().

int EcalFenixLinearizer::mult_
private

Definition at line 27 of file EcalFenixLinearizer.h.

Referenced by process(), and setInput().

const EcalTPGPedestal* EcalFenixLinearizer::peds_
private

Definition at line 33 of file EcalFenixLinearizer.h.

Referenced by setInput(), and setParameters().

int EcalFenixLinearizer::shift_
private

Definition at line 28 of file EcalFenixLinearizer.h.

Referenced by process(), and setInput().

int EcalFenixLinearizer::strip_
private

Definition at line 29 of file EcalFenixLinearizer.h.

int EcalFenixLinearizer::uncorrectedSample_
private

Definition at line 24 of file EcalFenixLinearizer.h.

Referenced by process(), and setInput().

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

Definition at line 36 of file EcalFenixLinearizer.h.

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