CMS 3D CMS Logo

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

#include <EcalEBPhase2TimeReconstructor.h>

Public Member Functions

 EcalEBPhase2TimeReconstructor (bool debug)
 
virtual void process (std::vector< int > &addout, std::vector< int > &ampRecoOutput, std::vector< int64_t > &output)
 
void setParameters (uint32_t raw, const EcalEBPhase2TPGTimeWeightIdMap *ecaltpgTimeWeightMap, const EcalTPGWeightGroup *ecaltpgWeightGroup)
 
virtual ~EcalEBPhase2TimeReconstructor ()
 

Private Member Functions

void process ()
 
int setInput (int input)
 

Private Attributes

uint64_t ampIn_ [maxSamplesUsed_]
 
int buffer_ [maxSamplesUsed_]
 
bool debug_
 
bool extraShift_ [2] = {false, false}
 
int inputsAlreadyIn_
 
uint64_t invAmpAr_ [512]
 
int processedOutput_
 
int shift_
 
int weights_ [maxSamplesUsed_]
 

Static Private Attributes

static const int maxSamplesUsed_ = 12
 

Detailed Description

Author
L. Lutton, N. Marinelli - Univ. of Notre Dame Description: forPhase II Measures the timing of a xTal signal

Definition at line 16 of file EcalEBPhase2TimeReconstructor.h.

Constructor & Destructor Documentation

◆ EcalEBPhase2TimeReconstructor()

EcalEBPhase2TimeReconstructor::EcalEBPhase2TimeReconstructor ( bool  debug)

◆ ~EcalEBPhase2TimeReconstructor()

EcalEBPhase2TimeReconstructor::~EcalEBPhase2TimeReconstructor ( )
virtual

Definition at line 12 of file EcalEBPhase2TimeReconstructor.cc.

12 {}

Member Function Documentation

◆ process() [1/2]

void EcalEBPhase2TimeReconstructor::process ( )
private

Definition at line 86 of file EcalEBPhase2TimeReconstructor.cc.

References ampIn_, buffer_, debug_, mps_fire::i, inputsAlreadyIn_, invAmpAr_, LogDebug, convertSQLitetoXML_cfg::output, processedOutput_, shift_, and weights_.

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

86  {
87  //UB FIXME: 5
88  processedOutput_ = 0;
89  if (inputsAlreadyIn_ < 12)
90  return;
91  int64_t output = 0;
92  for (int i = 0; i < 12; i++) {
93  output += (weights_[i] * buffer_[i]);
94  if (debug_)
95  LogDebug("") << " TimeFilter buffer " << buffer_[i] << " weight " << weights_[i] << " output " << output
96  << std::endl;
97  }
98  output = output >> shift_;
99  if (debug_)
100  LogDebug("") << " TimeFilter local output " << output << std::endl;
101  //Dividing output by the result of the amplitude reconstruction via an approximation using the invAmpAr lookup table
102  int ampInd = 0;
103  if (debug_)
104  LogDebug("") << " inputsAlreadyIn_ " << inputsAlreadyIn_ << std::endl;
105  if (inputsAlreadyIn_ > 12) {
106  ampInd = 1;
107  }
108 
109  if (debug_)
110  LogDebug("") << " Begininning Final TimeFilter Calculation" << std::endl;
111 
112  int64_t tmpOutput = output * invAmpAr_[ampIn_[ampInd]];
113  if (debug_)
114  LogDebug("") << " output*tmpInvAmpAr " << tmpOutput << std::endl;
115 
116  output = tmpOutput >> 20;
117  if (debug_)
118  LogDebug("") << " output after bit shift " << output << std::endl;
119 
120  if (output < -1024)
121  output = -1023;
122  else if (output > 1024)
123  output = 1023;
124  if (debug_)
125  LogDebug("") << " output after if/else " << output << std::endl;
127 
128  if (debug_)
129  LogDebug("") << " TimeFilter final output " << processedOutput_ << std::endl;
130 }
Definition: output.py:1
#define LogDebug(id)

◆ process() [2/2]

void EcalEBPhase2TimeReconstructor::process ( std::vector< int > &  addout,
std::vector< int > &  ampRecoOutput,
std::vector< int64_t > &  output 
)
virtual

Definition at line 37 of file EcalEBPhase2TimeReconstructor.cc.

References ampIn_, 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  //Taking in the results of the amplitude reconstruction
46  //Bit shifting them for use as index of invAmpAr_ lookup table
47  // move input amplitude (13 bits) to 9 bits to use as array index
48 
49  ampIn_[0] = ampRecoOutput[0] >> 4;
50  ampIn_[1] = ampRecoOutput[1] >> 4;
51 
52  for (unsigned int i = 0; i < addout.size(); i++) {
53  setInput(addout[i]);
54 
55  if (debug_) {
56  LogDebug("") << " EcalEBPhase2TimeReconstructor::process(std::vector<int> buffer_ " << std::endl;
57 
58  for (unsigned int j = 0; j < maxSamplesUsed_; j++) {
59  LogDebug("") << " buffer_ " << buffer_[j];
60  }
61  LogDebug("") << " " << std::endl;
62  }
63 
64  if (i == (maxSamplesUsed_ - 1)) {
65  if (debug_)
66  LogDebug("") << " EcalEBPhase2TimeReconstructor::process(std::vector<int>) i = 11 " << std::endl;
67  process();
68  if (debug_)
69  LogDebug("") << " EcalEBPhase2TimeReconstructor::process(std::vector<int>) after process() "
70  << processedOutput_ << std::endl;
72  if (debug_)
73  LogDebug("") << " EcalEBPhase2TimeReconstructor::process(std::vector<int>) after setting the output "
74  << output[0] << std::endl;
75  } else if (i == (ecalPh2::sampleSize - 1)) {
76  if (debug_)
77  LogDebug("") << " EcalEBPhase2TimeReconstructor::process(std::vector<int>) i = 15 " << std::endl;
78  process();
80  }
81  }
82 
83  return;
84 }
static constexpr unsigned int sampleSize
Definition: EcalConstants.h:36
Definition: output.py:1
#define LogDebug(id)

◆ setInput()

int EcalEBPhase2TimeReconstructor::setInput ( int  input)
private

Definition at line 14 of file EcalEBPhase2TimeReconstructor.cc.

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

Referenced by process().

14  {
15  if (input > 0X7FFF) {
16  edm::LogError("EcalEBPhase2TimeReconstructor::setInput") << "ERROR IN INPUT OF TIME FILTER" << std::endl;
17  return -1;
18  }
20  if (debug_)
21  LogDebug("") << " EcalEBPhase2TimeReconstructor::setInput inputsAlreadyIn_<5 input " << input << std::endl;
22 
25  } else {
26  for (int i = 0; i < (maxSamplesUsed_ - 1); i++) {
27  buffer_[i] = buffer_[i + 1];
28  if (debug_)
29  LogDebug("") << " EcalEBPhase2TimeReconstructor::setInput inputsAlreadyIn buffer " << buffer_[i] << std::endl;
30  }
33  }
34  return 1;
35 }
Log< level::Error, false > LogError
static std::string const input
Definition: EdmProvDump.cc:50
#define LogDebug(id)

◆ setParameters()

void EcalEBPhase2TimeReconstructor::setParameters ( uint32_t  raw,
const EcalEBPhase2TPGTimeWeightIdMap ecaltpgTimeWeightMap,
const EcalTPGWeightGroup ecaltpgWeightGroup 
)

Definition at line 132 of file EcalEBPhase2TimeReconstructor.cc.

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

Referenced by EcalEBPhase2TrigPrimAlgo::run().

134  {
135  uint32_t params_[12];
136  const EcalTPGGroups::EcalTPGGroupsMap &groupmap = ecaltpgWeightGroup->getMap();
137  if (debug_)
138  LogDebug("") << " EcalEBPhase2TimeReconstructor::setParameters groupmap size " << groupmap.size() << std::endl;
139  EcalTPGGroups::EcalTPGGroupsMapItr it = groupmap.find(raw);
140  if (it != groupmap.end()) {
141  uint32_t weightid = (*it).second;
142  const EcalEBPhase2TPGTimeWeightIdMap::EcalEBPhase2TPGTimeWeightMap &weightmap = ecaltpgWeightMap->getMap();
144 
145  (*itw).second.getValues(params_[0],
146  params_[1],
147  params_[2],
148  params_[3],
149  params_[4],
150  params_[5],
151  params_[6],
152  params_[7],
153  params_[8],
154  params_[9],
155  params_[10],
156  params_[11]);
157 
158  if (debug_)
159  LogDebug("") << " EcalEBPhase2TimeReconstructor::setParameters time weights after the map " << params_[0] << " "
160  << params_[1] << " " << params_[2] << " " << params_[3] << " " << params_[4] << " " << params_[5]
161  << " " << params_[6] << " " << params_[7] << " " << params_[8] << " " << params_[9] << " "
162  << params_[10] << " " << params_[11] << std::endl;
163 
164  // we have to transform negative coded in 16 bits into negative coded in 32 bits
165  // maybe this should go into the getValue method??
166 
167  for (int i = 0; i < 12; ++i) {
168  weights_[i] = (params_[i] & 0x8000) ? (int)(params_[i] | 0xffff8000) : (int)(params_[i]);
169  }
170 
171  } else
172  edm::LogWarning("EcalTPG")
173  << " EcalEBPhase2TimeReconstructor::setParameters could not find EcalTPGGroupsMap entry for " << raw;
174 }
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:20
std::map< uint32_t, EcalEBPhase2TPGTimeWeights > EcalEBPhase2TPGTimeWeightMap
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:25
Log< level::Warning, false > LogWarning
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:19
std::map< uint32_t, EcalEBPhase2TPGTimeWeights >::const_iterator EcalEBPhase2TPGTimeWeightMapItr
#define LogDebug(id)

Member Data Documentation

◆ ampIn_

uint64_t EcalEBPhase2TimeReconstructor::ampIn_[maxSamplesUsed_]
private

Definition at line 23 of file EcalEBPhase2TimeReconstructor.h.

Referenced by process().

◆ buffer_

int EcalEBPhase2TimeReconstructor::buffer_[maxSamplesUsed_]
private

Definition at line 21 of file EcalEBPhase2TimeReconstructor.h.

Referenced by process(), and setInput().

◆ debug_

bool EcalEBPhase2TimeReconstructor::debug_
private

Definition at line 19 of file EcalEBPhase2TimeReconstructor.h.

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

◆ extraShift_

bool EcalEBPhase2TimeReconstructor::extraShift_[2] = {false, false}
private

Definition at line 25 of file EcalEBPhase2TimeReconstructor.h.

◆ inputsAlreadyIn_

int EcalEBPhase2TimeReconstructor::inputsAlreadyIn_
private

Definition at line 20 of file EcalEBPhase2TimeReconstructor.h.

Referenced by process(), and setInput().

◆ invAmpAr_

uint64_t EcalEBPhase2TimeReconstructor::invAmpAr_[512]
private

Definition at line 61 of file EcalEBPhase2TimeReconstructor.h.

Referenced by process().

◆ maxSamplesUsed_

const int EcalEBPhase2TimeReconstructor::maxSamplesUsed_ = 12
staticprivate

Definition at line 18 of file EcalEBPhase2TimeReconstructor.h.

Referenced by process(), and setInput().

◆ processedOutput_

int EcalEBPhase2TimeReconstructor::processedOutput_
private

Definition at line 28 of file EcalEBPhase2TimeReconstructor.h.

Referenced by process().

◆ shift_

int EcalEBPhase2TimeReconstructor::shift_
private

Definition at line 24 of file EcalEBPhase2TimeReconstructor.h.

Referenced by process().

◆ weights_

int EcalEBPhase2TimeReconstructor::weights_[maxSamplesUsed_]
private

Definition at line 22 of file EcalEBPhase2TimeReconstructor.h.

Referenced by process(), and setParameters().