CMS 3D CMS Logo

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

#include <EcalEBPhase2AmplitudeReconstructor.h>

Public Member Functions

 EcalEBPhase2AmplitudeReconstructor (bool debug)
 
virtual void process (std::vector< int > &addout, std::vector< int > &output)
 
void setParameters (uint32_t raw, const EcalEBPhase2TPGAmplWeightIdMap *ecaltpgWeightMap, const EcalTPGWeightGroup *ecaltpgWeightGroup)
 
virtual ~EcalEBPhase2AmplitudeReconstructor ()
 

Private Member Functions

void process ()
 
int setInput (int input)
 

Private Attributes

int buffer_ [maxSamplesUsed_]
 
bool debug_
 
int inputsAlreadyIn_
 
int processedOutput_
 
int shift_
 
int weights_ [maxSamplesUsed_]
 

Static Private Attributes

static const int maxSamplesUsed_ = 12
 

Detailed Description

Definition at line 17 of file EcalEBPhase2AmplitudeReconstructor.h.

Constructor & Destructor Documentation

◆ EcalEBPhase2AmplitudeReconstructor()

EcalEBPhase2AmplitudeReconstructor::EcalEBPhase2AmplitudeReconstructor ( bool  debug)

◆ ~EcalEBPhase2AmplitudeReconstructor()

EcalEBPhase2AmplitudeReconstructor::~EcalEBPhase2AmplitudeReconstructor ( )
virtual

Definition at line 13 of file EcalEBPhase2AmplitudeReconstructor.cc.

13 {}

Member Function Documentation

◆ process() [1/2]

void EcalEBPhase2AmplitudeReconstructor::process ( )
private

Definition at line 65 of file EcalEBPhase2AmplitudeReconstructor.cc.

References buffer_, debug_, mps_fire::i, inputsAlreadyIn_, LogDebug, maxSamplesUsed_, convertSQLitetoXML_cfg::output, processedOutput_, shift_, parallelization::uint, and weights_.

Referenced by process(), and EcalEBPhase2TrigPrimAlgo::run().

65  {
66  processedOutput_ = 0;
68  return;
69  int64_t tmpIntOutput = 0;
70  for (int i = 0; i < maxSamplesUsed_; i++) {
71  tmpIntOutput += (weights_[i] * buffer_[i]);
72  if (debug_)
73  LogDebug("") << " AmplitudeFilter buffer " << buffer_[i] << " weight " << weights_[i] << std::endl;
74  }
75  if (tmpIntOutput < 0)
76  tmpIntOutput = 0;
77  tmpIntOutput = tmpIntOutput >> shift_;
78  if (debug_)
79  LogDebug("") << " AmplitudeFilter tmpIntOutput " << tmpIntOutput << " shift_ " << shift_ << std::endl;
80  if (tmpIntOutput > 0X1FFF)
81  tmpIntOutput = 0X1FFF;
82  uint output = tmpIntOutput; // should be 13 bit uint at this point
84  if (debug_)
85  LogDebug("") << " AmplitudeFilter processedOutput_ " << processedOutput_ << std::endl;
86 }
Definition: output.py:1
#define LogDebug(id)

◆ process() [2/2]

void EcalEBPhase2AmplitudeReconstructor::process ( std::vector< int > &  addout,
std::vector< int > &  output 
)
virtual

Definition at line 39 of file EcalEBPhase2AmplitudeReconstructor.cc.

References buffer_, debug_, mps_fire::i, inputsAlreadyIn_, dqmiolumiharvest::j, LogDebug, maxSamplesUsed_, process(), processedOutput_, ecalPh2::sampleSize, and setInput().

39  {
40  inputsAlreadyIn_ = 0;
41  for (unsigned int i = 0; i < maxSamplesUsed_; i++) {
42  buffer_[i] = 0;
43  }
44 
45  for (unsigned int i = 0; i < linout.size(); i++) {
46  setInput(linout[i]);
47  if (debug_) {
48  for (unsigned int j = 0; j < maxSamplesUsed_; j++) {
49  LogDebug("") << " buffer_ " << buffer_[j];
50  }
51  LogDebug("") << " " << std::endl;
52  }
53 
54  if (i == (maxSamplesUsed_ - 1)) {
55  process();
57  } else if (i == (ecalPh2::sampleSize - 1)) {
58  process();
60  }
61  }
62  return;
63 }
static constexpr unsigned int sampleSize
Definition: EcalConstants.h:36
Definition: output.py:1
#define LogDebug(id)

◆ setInput()

int EcalEBPhase2AmplitudeReconstructor::setInput ( int  input)
private

Definition at line 15 of file EcalEBPhase2AmplitudeReconstructor.cc.

References buffer_, debug_, mps_fire::i, input, inputsAlreadyIn_, LogDebug, and maxSamplesUsed_.

Referenced by process().

15  {
16  if (input > 0X3FFF) {
17  edm::LogError("EcalEBPhase2AmplitudeReconstructor") << "ERROR IN INPUT OF AMPLITUDE FILTER" << std::endl;
18  return -1;
19  }
20 
22  if (debug_)
23  LogDebug("") << " EcalEBPhase2AmplitudeReconstructor::setInput inputsAlreadyIn_<5 input " << input << std::endl;
24 
27  } else {
28  for (int i = 0; i < (maxSamplesUsed_ - 1); i++) {
29  buffer_[i] = buffer_[i + 1];
30  if (debug_)
31  LogDebug("") << " EcalEBPhase2AmplitudeReconstructor::setInput inputsAlreadyIn buffer " << buffer_[i]
32  << std::endl;
33  }
35  }
36  return 1;
37 }
Log< level::Error, false > LogError
static std::string const input
Definition: EdmProvDump.cc:50
#define LogDebug(id)

◆ setParameters()

void EcalEBPhase2AmplitudeReconstructor::setParameters ( uint32_t  raw,
const EcalEBPhase2TPGAmplWeightIdMap ecaltpgWeightMap,
const EcalTPGWeightGroup ecaltpgWeightGroup 
)

Definition at line 88 of file EcalEBPhase2AmplitudeReconstructor.cc.

References debug_, EcalEBPhase2TPGAmplWeightIdMap::getMap(), EcalTPGGroups::getMap(), mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, LogDebug, maxSamplesUsed_, and weights_.

Referenced by EcalEBPhase2TrigPrimAlgo::run().

90  {
91  uint32_t params_[maxSamplesUsed_];
92  const EcalTPGGroups::EcalTPGGroupsMap &groupmap = ecaltpgWeightGroup->getMap();
93  if (debug_)
94  LogDebug("") << " EcalEBPhase2AmplitudeReconstructor::setParameters groupmap size " << groupmap.size()
95  << " channel ID " << raw << std::endl;
96  EcalTPGGroups::EcalTPGGroupsMapItr it = groupmap.find(raw);
97  if (it != groupmap.end()) {
98  uint32_t weightid = (*it).second;
99 
100  const EcalEBPhase2TPGAmplWeightIdMap::EcalEBPhase2TPGAmplWeightMap &weightmap = ecaltpgWeightMap->getMap();
102 
103  (*itw).second.getValues(params_[0],
104  params_[1],
105  params_[2],
106  params_[3],
107  params_[4],
108  params_[5],
109  params_[6],
110  params_[7],
111  params_[8],
112  params_[9],
113  params_[10],
114  params_[11]);
115 
116  if (debug_)
117  LogDebug("") << " EcalEBPhase2AmplitudeReconstructor::setParameters weights after the map " << params_[0] << " "
118  << params_[1] << " " << params_[2] << " " << params_[3] << " " << params_[4] << " " << params_[5]
119  << " " << params_[6] << " " << params_[7] << " " << params_[8] << " " << params_[9] << " "
120  << params_[10] << " " << params_[11] << std::endl;
121 
122  // we have to transform negative coded in 13 bits into negative coded in 32 bits
123  // maybe this should go into the getValue method??
124 
125  for (int i = 0; i < maxSamplesUsed_; ++i) {
126  weights_[i] = (params_[i] & 0x1000) ? (int)(params_[i] | 0xfffff000) : (int)(params_[i]);
127  }
128 
129  if (debug_) {
130  for (int i = 0; i < maxSamplesUsed_; ++i) {
131  LogDebug("") << " EcalEBPhase2AmplitudeReconstructor::setParameters weights after the cooking " << weights_[i]
132  << std::endl;
133  }
134  LogDebug("") << std::endl;
135  }
136 
137  } else
138  edm::LogWarning("EcalTPG")
139  << " EcalEBPhase2AmplitudeReconstructor::setParameters could not find EcalTPGGroupsMap entry for " << raw;
140 }
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:20
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:25
const EcalEBPhase2TPGAmplWeightMap & getMap() const
std::map< uint32_t, EcalEBPhase2TPGAmplWeights > EcalEBPhase2TPGAmplWeightMap
Log< level::Warning, false > LogWarning
std::map< uint32_t, EcalEBPhase2TPGAmplWeights >::const_iterator EcalEBPhase2TPGAmplWeightMapItr
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:19
#define LogDebug(id)

Member Data Documentation

◆ buffer_

int EcalEBPhase2AmplitudeReconstructor::buffer_[maxSamplesUsed_]
private

Definition at line 22 of file EcalEBPhase2AmplitudeReconstructor.h.

Referenced by process(), and setInput().

◆ debug_

bool EcalEBPhase2AmplitudeReconstructor::debug_
private

Definition at line 20 of file EcalEBPhase2AmplitudeReconstructor.h.

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

◆ inputsAlreadyIn_

int EcalEBPhase2AmplitudeReconstructor::inputsAlreadyIn_
private

Definition at line 21 of file EcalEBPhase2AmplitudeReconstructor.h.

Referenced by process(), and setInput().

◆ maxSamplesUsed_

const int EcalEBPhase2AmplitudeReconstructor::maxSamplesUsed_ = 12
staticprivate

Definition at line 19 of file EcalEBPhase2AmplitudeReconstructor.h.

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

◆ processedOutput_

int EcalEBPhase2AmplitudeReconstructor::processedOutput_
private

Definition at line 27 of file EcalEBPhase2AmplitudeReconstructor.h.

Referenced by process().

◆ shift_

int EcalEBPhase2AmplitudeReconstructor::shift_
private

Definition at line 24 of file EcalEBPhase2AmplitudeReconstructor.h.

Referenced by process().

◆ weights_

int EcalEBPhase2AmplitudeReconstructor::weights_[maxSamplesUsed_]
private

Definition at line 23 of file EcalEBPhase2AmplitudeReconstructor.h.

Referenced by process(), and setParameters().