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::EcalFenixLinearizer ( bool  famos)

Definition at line 9 of file EcalFenixLinearizer.cc.

10  : famos_(famos), init_(false),
12  peds_(NULL),
14 {
15 }
#define NULL
Definition: scimark2.h:8
const EcalTPGLinearizationConstant * linConsts_
const EcalTPGCrystalStatusCode * badXStatus_
const EcalTPGPedestal * peds_
EcalFenixLinearizer::~EcalFenixLinearizer ( )
virtual

Definition at line 17 of file EcalFenixLinearizer.cc.

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

17  {
18  if (init_) {
19  for (int i=0;i<(int)vectorbadXStatus_.size();i++){
20  delete vectorbadXStatus_[i];
21  }
22  }
23 }
int i
Definition: DBlmapReader.cc:9
std::vector< const EcalTPGCrystalStatusCode * > vectorbadXStatus_
EcalFenixLinearizer::EcalFenixLinearizer ( bool  famos)
virtual EcalFenixLinearizer::~EcalFenixLinearizer ( )
virtual

Member Function Documentation

int EcalFenixLinearizer::process ( )
private

Definition at line 59 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(), ConfigBuilder.ConfigBuilder::prepare_ALCA(), ConfigBuilder.ConfigBuilder::prepare_DQM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_PATFILTER(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), process(), EcalFenixStrip::process_part1(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), EcalEBTrigPrimTestAlgo::run(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

60 {
61 
62 
63  int output=(uncorrectedSample_-base_); //Substract base
64  //std::cout << " EcalFenixLinearizer::process() output non bit shifted " << output << std::endl;
65  if(famos_ || output<0) return 0;
66 
67  if(output<0) return shift_ << 12; // FENIX bug(!)
68  output=(output*mult_)>>(shift_+2); //Apply multiplicative factor
69  //std::cout << " EcalFenixLinearizer::process() output 2nd step " << output << std::endl;
70  if(output>0X3FFFF)output=0X3FFFF; //Saturation if too high
71  //std::cout << " EcalFenixLinearizer::process() output 3rd step " << output << std::endl;
72  return output;
73 }
int EcalFenixLinearizer::process ( )
private
template<class T >
void EcalFenixLinearizer::process ( const T ,
std::vector< int > &   
)
template<class T >
void EcalFenixLinearizer::process ( const T df,
std::vector< int > &  output_percry 
)

Definition at line 52 of file EcalFenixLinearizer.h.

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

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare(), ConfigBuilder.ConfigBuilder::prepare_ALCA(), ConfigBuilder.ConfigBuilder::prepare_DQM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_PATFILTER(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

53 {
54 
55  //We know a tower numbering is:
56 // S1 S2 S3 S4 S5
57 //
58 // 4 5 14 15 24
59 // 3 6 13 16 23
60 // 2 7 12 17 22
61 // 1 8 11 18 21
62 // 0 9 10 19 20
63 
64  //std::cout << " EcalFenixLinearizer::process(const .. DataFrame " << std::endl;
65  for (int i=0;i<df.size();i++) {
66  //std::cout << df[i] << " ";
67  }
68 
69  for (int i=0;i<df.size();i++) {
70  setInput(df[i]);
71  output_percry[i]=process();
72  }
73 
74  //std::cout << " EcalFenixLinearizer::process(const .. Final output " << std::endl;
75  for (int i=0;i<df.size();i++) {
76  //std::cout << " output_percry " << output_percry[i]<< " ";
77  }
78 
79  return;
80 }
int i
Definition: DBlmapReader.cc:9
int setInput(const EcalMGPASample &RawSam)
int EcalFenixLinearizer::setInput ( const EcalMGPASample RawSam)
private
int EcalFenixLinearizer::setInput ( const EcalMGPASample RawSam)
private

Definition at line 75 of file EcalFenixLinearizer.cc.

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

Referenced by process().

76 {
77 
78  //std::cout << " EcalFenixLinearizer::setInput RawSam.raw() " << RawSam.raw() << std::endl;
79  if(RawSam.raw()>0X3FFF)
80  {
81  LogDebug("EcalTPG")<<"ERROR IN INPUT SAMPLE OF FENIX LINEARIZER";
82  return -1;
83  }
84 
85  uncorrectedSample_=RawSam.adc(); //uncorrectedSample_ is coded in the 12 LSB
86  gainID_=RawSam.gainId(); //uncorrectedSample_ is coded in the 2 next bits!
87 
88  if ( gainID_>1) {
89  //std::cout << " EcalFenixLinearizer::setInput gain " << gainID_ << std::endl;
90  return -999;
91  }
92  //if (gainID_==0) gainID_=3;
93 
94  if(gainID_ == 0)
95  {
96  base_ = 0;
97  shift_ = 0;
98  mult_ = 0xFF;
99  if((linConsts_->mult_x12 == 0) && (linConsts_->mult_x6 == 0) && (linConsts_->mult_x1 == 0))
100  {
101 
102  mult_ = 0; // Implemented in CCSSupervisor to
103  // reject overflow cases in rejected channels
104  }
105  }
106  else if (gainID_==1) {
107  base_ = peds_ -> mean_x12;
108  shift_ = linConsts_ -> shift_x12;
109 
110  // take into account the badX
111  // badXStatus_ == 0 if the crystal works
112  // badXStatus_ !=0 some problem with the crystal
113  if (badXStatus_->getStatusCode()!=0){
114  mult_ = 0;
115  }
116  else{
117  mult_ = linConsts_ -> mult_x12;
118  }
119  }
120  else if (gainID_==2) {
121  base_ = peds_ -> mean_x6;
122  shift_ = linConsts_ -> shift_x6;
123 
124  // take into account the badX
125  // check if the badX has a status code=0 or 1
126  if (badXStatus_->getStatusCode()!=0){
127  mult_ = 0;
128  }
129  else{
130  mult_ = linConsts_ -> mult_x6;
131  }
132  }
133  else if (gainID_==3){
134  base_ = peds_-> mean_x1;
135  shift_ = linConsts_ -> shift_x1;
136 
137  // take into account the badX
138  // check if the badX has a status code=0 or 1
139  if (badXStatus_->getStatusCode()!=0){
140  mult_ = 0;
141  }
142  else{
143  mult_ = linConsts_ -> mult_x1;
144  }
145  }
146 
147  //std::cout << " EcalFenixLinearizer::setInput uncorrectedSample_ " << RawSam.adc() << " gainID " << gainID_ << " baseline " << base_ << std::endl;
148 
149  if (famos_) base_=200; //FIXME by preparing a correct TPG.txt for Famos
150 
151  return 1;
152 }
#define LogDebug(id)
uint16_t raw() const
get the raw word
int gainId() const
get the gainId (2 bits)
const EcalTPGLinearizationConstant * linConsts_
const EcalTPGCrystalStatusCode * badXStatus_
const EcalTPGPedestal * peds_
int adc() const
get the ADC sample (12 bits)
void EcalFenixLinearizer::setParameters ( uint32_t  raw,
const EcalTPGPedestals ecaltpPed,
const EcalTPGLinearizationConst ecaltpLin,
const EcalTPGCrystalStatus ecaltpBadX 
)
void EcalFenixLinearizer::setParameters ( uint32_t  raw,
const EcalTPGPedestals ecaltpPed,
const EcalTPGLinearizationConst ecaltpLin,
const EcalTPGCrystalStatus ecaltpBadX 
)

Definition at line 25 of file EcalFenixLinearizer.cc.

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().

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

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().