CMS 3D CMS Logo

EcalFenixTcp.cc
Go to the documentation of this file.
2 
9 
11 
12 #include <vector>
13 //----------------------------------------------------------------------------------------
15  bool tcpFormat, bool debug, bool famos, int binOfMax, int maxNrSamples, int nbMaxStrips, bool tpInfoPrintout)
16  : debug_(debug), nbMaxStrips_(nbMaxStrips), tpInfoPrintout_(tpInfoPrintout) {
17  bypasslin_.resize(nbMaxStrips_);
18  for (int i = 0; i < nbMaxStrips_; i++)
20  adder_ = new EcalFenixEtTot();
21  maxOf2_ = new EcalFenixMaxof2(maxNrSamples, nbMaxStrips_);
22  formatter_EB_ = new EcalFenixTcpFormatEB(tcpFormat, debug_, famos, binOfMax);
23  formatter_EE_ = new EcalFenixTcpFormatEE(tcpFormat, debug_, famos, binOfMax);
24  fgvbEB_ = new EcalFenixFgvbEB(maxNrSamples);
25  fgvbEE_ = new EcalFenixTcpFgvbEE(maxNrSamples);
27 
28  // permanent data structures
30  std::vector<int> vec(maxNrSamples, 0);
31  for (int i = 0; i < nbMaxStrips_; i++)
32  bypasslin_out_[i] = vec;
33 
34  adder_even_out_.resize(maxNrSamples);
35  adder_odd_out_.resize(maxNrSamples);
36  maxOf2_out_.resize(maxNrSamples);
37  fgvb_out_.resize(maxNrSamples);
38  strip_fgvb_out_.resize(maxNrSamples);
39 }
40 //-----------------------------------------------------------------------------------------
42  for (int i = 0; i < nbMaxStrips_; i++)
43  delete bypasslin_[i];
44  delete adder_;
45  delete maxOf2_;
46  delete formatter_EB_;
47  delete formatter_EE_;
48  delete fgvbEB_;
49  delete fgvbEE_;
50 }
51 //-----------------------------------------------------------------------------------------
52 
53 void EcalFenixTcp::process(std::vector<EBDataFrame> &bid, // dummy argument for template call
54  std::vector<std::vector<int>> &tpframetow,
55  int nStr,
56  std::vector<EcalTriggerPrimitiveSample> &tptow,
57  std::vector<EcalTriggerPrimitiveSample> &tptow2,
58  bool isInInnerRing,
59  EcalTrigTowerDetId towid) {
60  int bitMask = 12;
61  // The 14th bit is always used for the odd>even flag. If the flagging is off in the Strip fenix the feature will be not used.
62  int bitOddEven = 13;
63  process_part1(tpframetow, nStr, bitMask, bitOddEven);
64 
65  process_part2_barrel(tpframetow,
66  nStr,
67  bitMask,
68  bitOddEven,
75  tptow,
76  tptow2,
77  towid);
78 }
79 
80 //-----------------------------------------------------------------------------------------
81 void EcalFenixTcp::process(std::vector<EEDataFrame> &bid, // dummy argument for template call
82  std::vector<std::vector<int>> &tpframetow,
83  int nStr,
84  std::vector<EcalTriggerPrimitiveSample> &tptow,
85  std::vector<EcalTriggerPrimitiveSample> &tptow2,
86  bool isInInnerRing,
87  EcalTrigTowerDetId towid) {
88  int bitMask = 12; // Pascal: endcap has 12 bits as in EB (bug in FENIX!!!!)
89  // The 14th bit is always used for the odd>even flag. If the flagging is off in the Strip fenix the feature will be not used.
90  int bitOddEven = 13;
91 
92  process_part1(tpframetow, nStr, bitMask, bitOddEven);
93 
94  process_part2_endcap(tpframetow,
95  nStr,
96  bitMask,
97  bitOddEven,
102  tptow,
103  tptow2,
104  isInInnerRing,
105  towid);
106 }
107 //-----------------------------------------------------------------------------------------
108 void EcalFenixTcp::process_part1(std::vector<std::vector<int>> &tpframetow, int nStr, int bitMask, int bitOddEven) {
109  // //call adder
110  // this->getAdder()->process(bypasslin_out_, nStr, bitMask,adder_out_);
111  this->getAdder()->process(tpframetow, nStr, bitMask, bitOddEven, adder_even_out_, adder_odd_out_);
112  // this is a test:
113  if (debug_) {
114  std::cout << "output of TCP adder is a vector of size: " << adder_even_out_.size() << std::endl;
115  std::cout << "even sum : " << std::endl;
116  for (unsigned int i = 0; i < adder_even_out_.size(); i++) {
117  std::cout << " " << adder_even_out_[i];
118  }
119  std::cout << std::endl;
120  std::cout << "odd sum : " << std::endl;
121  for (unsigned int i = 0; i < adder_odd_out_.size(); i++) {
122  std::cout << " " << adder_odd_out_[i];
123  }
124  std::cout << std::endl;
125  }
126  return;
127 }
128 //-----------------------------------------------------------------------------------------
129 void EcalFenixTcp::process_part2_barrel(std::vector<std::vector<int>> &bypasslinout,
130  int nStr,
131  int bitMask,
132  int bitOddEven,
133  const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup,
134  const EcalTPGLutGroup *ecaltpgLutGroup,
135  const EcalTPGLutIdMap *ecaltpgLut,
136  const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB,
137  const EcalTPGTowerStatus *ecaltpgBadTT,
138  const EcalTPGSpike *ecaltpgSpike,
139  std::vector<EcalTriggerPrimitiveSample> &tcp_out,
140  std::vector<EcalTriggerPrimitiveSample> &tcp_outTcc,
141  EcalTrigTowerDetId towid) {
142  // call maxof2
143  // this->getMaxOf2()->process(bypasslin_out_,nStr,maxOf2_out_);
144  // the oddEven flag is used to exclude "odd" strip from the computation of the maxof2 as in the fenix firmware
145  this->getMaxOf2()->process(bypasslinout, nStr, bitMask, bitOddEven, maxOf2_out_);
146 
147  if (debug_) {
148  std::cout << "output of maxof2 is a vector of size: " << maxOf2_out_.size() << std::endl;
149  std::cout << "value : " << std::endl;
150  for (unsigned int i = 0; i < maxOf2_out_.size(); i++) {
151  std::cout << " " << std::dec << maxOf2_out_[i];
152  }
153  std::cout << std::endl;
154  }
155 
156  // call fgvb
157  this->getFGVBEB()->setParameters(towid.rawId(), ecaltpgFgEBGroup, ecaltpgFineGrainEB);
158  // The FGVB is computed only on the even sum, as in the firmware
160 
161  // Call sFGVB
162  this->getsFGVBEB()->process(bypasslinout, nStr, bitMask, strip_fgvb_out_);
163 
164  // this is a test:
165  if (debug_) {
166  std::cout << "output of fgvb is a vector of size: " << fgvb_out_.size() << std::endl;
167  std::cout << "value : " << std::endl;
168  for (unsigned int i = 0; i < fgvb_out_.size(); i++) {
169  std::cout << " " << std::dec << fgvb_out_[i];
170  }
171  std::cout << std::endl;
172  }
173 
174  // call formatter
175  int eTTotShift = 2;
176 
177  this->getFormatterEB()->setParameters(
178  towid.rawId(), ecaltpgLutGroup, ecaltpgLut, ecaltpgBadTT, ecaltpgSpike, ecaltpgTPMode_);
179  this->getFormatterEB()->process(
180  adder_even_out_, adder_odd_out_, fgvb_out_, strip_fgvb_out_, eTTotShift, tcp_out, tcp_outTcc);
181 
182  if (tpInfoPrintout_) {
183  for (unsigned int i = 3; i < tcp_out.size(); i++) {
184  std::cout << " " << i << " " << std::dec << tcp_out[i] << std::endl;
185  }
186  }
187 
188  if (debug_) {
189  std::cout << "output of TCP formatter Barrel is a vector of size: " << std::dec << tcp_out.size() << std::endl;
190  std::cout << "value : " << std::endl;
191  for (unsigned int i = 0; i < tcp_out.size(); i++) {
192  std::cout << " " << i << " " << std::dec << tcp_out[i] << std::endl;
193  }
194  std::cout << std::endl;
195  }
196 
197  return;
198 }
199 //-----------------------------------------------------------------------------------------
200 void EcalFenixTcp::process_part2_endcap(std::vector<std::vector<int>> &bypasslinout,
201  int nStr,
202  int bitMask,
203  int bitOddEven,
204  const EcalTPGLutGroup *ecaltpgLutGroup,
205  const EcalTPGLutIdMap *ecaltpgLut,
206  const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE,
207  const EcalTPGTowerStatus *ecaltpgbadTT,
208  std::vector<EcalTriggerPrimitiveSample> &tcp_out,
209  std::vector<EcalTriggerPrimitiveSample> &tcp_outTcc,
210  bool isInInnerRings,
211  EcalTrigTowerDetId towid)
212 
213 {
214  // Zero EB strip records
215  for (unsigned int i = 0; i < strip_fgvb_out_.size(); ++i) {
216  strip_fgvb_out_[i] = 0;
217  }
218 
219  // call fgvb
220  this->getFGVBEE()->setParameters(towid.rawId(), ecaltpgFineGrainTowerEE);
221  // fgvbEE_->process(bypasslin_out_,nStr,bitMask,fgvb_out_);
222  fgvbEE_->process(bypasslinout, nStr, bitMask, fgvb_out_);
223 
224  // call formatter
225  int eTTotShift = 2; // Pascal: endcap has 12 bits as in EB (bug in FENIX!!!!)
226  // so shift must be applied to just keep [11:2]
227 
228  this->getFormatterEE()->setParameters(
229  towid.rawId(), ecaltpgLutGroup, ecaltpgLut, ecaltpgbadTT, nullptr, ecaltpgTPMode_);
230 
231  // Pass both the even and the odd Et sums to the EE formatter also if there is not TCP in the electronics.
232  // The feature can be implemented in the TCC in the future: the emulator is kept generic.
233  this->getFormatterEE()->process(
234  adder_even_out_, adder_odd_out_, fgvb_out_, strip_fgvb_out_, eTTotShift, tcp_out, tcp_outTcc, isInInnerRings);
235  // this is a test:
236  if (debug_) {
237  std::cout << "output of TCP formatter(endcap) is a vector of size: " << std::dec << tcp_out.size() << std::endl;
238  std::cout << "value : " << std::endl;
239  for (unsigned int i = 0; i < tcp_out.size(); i++) {
240  std::cout << " " << i << " " << std::dec << tcp_out[i] << std::endl;
241  }
242  std::cout << std::endl;
243  }
244  return;
245 }
EcalFenixTcp::process_part2_barrel
void process_part2_barrel(std::vector< std::vector< int >> &, int nStr, int bitMask, int bitOddEven, const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB, const EcalTPGTowerStatus *ecaltpgBadTT, const EcalTPGSpike *ecaltpgSpike, std::vector< EcalTriggerPrimitiveSample > &tptow, std::vector< EcalTriggerPrimitiveSample > &tptow2, EcalTrigTowerDetId towid)
Definition: EcalFenixTcp.cc:129
EcalFenixBypassLin
Linearisation for Tcp input: 16 bits output: 12 bits +1 going to fgvb (???)
Definition: EcalFenixBypassLin.h:16
mps_fire.i
i
Definition: mps_fire.py:428
EcalFenixEtTot::process
virtual std::vector< int > process(const std::vector< EBDataFrame * > &)
Definition: EcalFenixEtTot.cc:8
ESHandle.h
EcalFenixTcp::adder_odd_out_
std::vector< int > adder_odd_out_
Definition: EcalFenixTcp.h:52
EcalFenixTcpFormatEB::setParameters
void setParameters(uint32_t towid, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGTowerStatus *ecaltpgbadTT, const EcalTPGSpike *ecaltpgSpike, const EcalTPGTPMode *ecaltpgTPMode)
Definition: EcalFenixTcpFormatEB.cc:115
EcalFenixMaxof2
Definition: EcalFenixMaxof2.h:20
EcalTPGSpike
Definition: EcalTPGSpike.h:9
EcalFenixTcp::ecaltpgFgEBGroup_
const EcalTPGFineGrainEBGroup * ecaltpgFgEBGroup_
Definition: EcalFenixTcp.h:135
EcalFenixTcp::tpInfoPrintout_
bool tpInfoPrintout_
Definition: EcalFenixTcp.h:37
EcalFenixTcp::getsFGVBEB
EcalFenixTcpsFgvbEB * getsFGVBEB() const
Definition: EcalFenixTcp.h:133
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EcalTPGFineGrainEBIdMap.h
EcalTPGFineGrainEBIdMap
Definition: EcalTPGFineGrainEBIdMap.h:10
EcalFenixTcp.h
EcalFenixTcp::nbMaxStrips_
int nbMaxStrips_
Definition: EcalFenixTcp.h:36
EcalFenixFgvbEB::process
void process(std::vector< int > &add_out, std::vector< int > &maxof2_out, std::vector< int > &output)
Definition: EcalFenixFgvbEB.cc:10
EcalFenixTcpFormatEE::setParameters
void setParameters(uint32_t towid, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGTowerStatus *ecaltpgbadTT, const EcalTPGSpike *ecaltpgSpike, const EcalTPGTPMode *ecaltpgTPMode)
Definition: EcalFenixTcpFormatEE.cc:120
EcalFenixTcp::maxOf2_out_
std::vector< int > maxOf2_out_
Definition: EcalFenixTcp.h:53
EcalFenixTcpFormatEB
Definition: EcalFenixTcpFormatEB.h:24
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
EcalFenixFgvbEB
calculation of Fgvb for Fenix Tcp, format barrel calculates fgvb for the barrel
Definition: EcalFenixFgvbEB.h:23
EcalFenixMaxof2::process
void process(std::vector< std::vector< int >> &, int nStr, int bitMask, int bitOddEven, std::vector< int > &out)
Definition: EcalFenixMaxof2.cc:13
EcalFenixTcp::adder_even_out_
std::vector< int > adder_even_out_
Definition: EcalFenixTcp.h:51
EcalTPGLutGroup
Definition: EcalTPGLutGroup.h:13
EcalTPGFineGrainTowerEE.h
EcalFenixTcpsFgvbEB
calculation of strip Fgvb for Fenix Tcp, format barrel calculates fgvb for the barrel
Definition: EcalFenixTcpsFgvbEB.h:15
EcalTPGFineGrainTowerEE
Definition: EcalTPGFineGrainTowerEE.h:9
EcalTPGLutIdMap.h
debug
#define debug
Definition: HDRShower.cc:19
EcalFenixTcp::ecaltpgLutGroup_
const EcalTPGLutGroup * ecaltpgLutGroup_
Definition: EcalFenixTcp.h:136
EcalFenixTcp::getFGVBEB
EcalFenixFgvbEB * getFGVBEB() const
Definition: EcalFenixTcp.h:131
EcalTPGTPMode.h
EcalFenixTcp::debug_
bool debug_
Definition: EcalFenixTcp.h:35
EcalFenixTcp::getAdder
EcalFenixEtTot * getAdder() const
Definition: EcalFenixTcp.h:127
EcalTPGLutIdMap
Definition: EcalTPGLutIdMap.h:10
EcalFenixTcp::process_part1
void process_part1(std::vector< std::vector< int >> &tpframetow, int nStr, int bitMask, int bitOddEven)
Definition: EcalFenixTcp.cc:108
EcalFenixTcpFormatEE::process
virtual std::vector< int > process(const std::vector< int > &, const std::vector< int > &)
Definition: EcalFenixTcpFormatEE.h:27
EcalFenixTcp::fgvb_out_
std::vector< int > fgvb_out_
Definition: EcalFenixTcp.h:54
EcalTPGLutGroup.h
EcalFenixTcp::bypasslin_out_
std::vector< std::vector< int > > bypasslin_out_
Definition: EcalFenixTcp.h:50
EcalFenixTcp::adder_
EcalFenixEtTot * adder_
Definition: EcalFenixTcp.h:41
EcalFenixTcp::formatter_EB_
EcalFenixTcpFormatEB * formatter_EB_
Definition: EcalFenixTcp.h:46
EcalFenixTcp::~EcalFenixTcp
virtual ~EcalFenixTcp()
Definition: EcalFenixTcp.cc:41
EcalTPGFineGrainEBGroup
Definition: EcalTPGFineGrainEBGroup.h:13
EcalFenixTcpFgvbEE::process
void process(std::vector< std::vector< int >> &bypasslin_out, int nStr, int bitMask, std::vector< int > &output)
Definition: EcalFenixTcpFgvbEE.cc:12
EcalFenixTcp::ecaltpgSpike_
const EcalTPGSpike * ecaltpgSpike_
Definition: EcalFenixTcp.h:141
EcalFenixTcp::getFGVBEE
EcalFenixTcpFgvbEE * getFGVBEE() const
Definition: EcalFenixTcp.h:132
EcalFenixTcp::ecaltpgFineGrainEB_
const EcalTPGFineGrainEBIdMap * ecaltpgFineGrainEB_
Definition: EcalFenixTcp.h:138
EcalTPGFineGrainEBGroup.h
EcalFenixTcpFormatEB::process
virtual std::vector< int > process(const std::vector< int > &, const std::vector< int > &)
Definition: EcalFenixTcpFormatEB.h:28
EcalFenixTcpFgvbEE
calculation of Fgvb for Fenix Tcp, format endcap calculates fgvb for the endcap
Definition: EcalFenixTcpFgvbEE.h:24
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
EcalFenixTcp::getFormatterEB
EcalFenixTcpFormatEB * getFormatterEB() const
Definition: EcalFenixTcp.h:129
EcalFenixTcp::getFormatterEE
EcalFenixTcpFormatEE * getFormatterEE() const
Definition: EcalFenixTcp.h:130
EcalFenixTcp::process
void process(std::vector< EBDataFrame > &bid, std::vector< std::vector< int >> &tpframetow, int nStr, std::vector< EcalTriggerPrimitiveSample > &tptow, std::vector< EcalTriggerPrimitiveSample > &tptow2, bool isInInnerRings, EcalTrigTowerDetId thisTower)
Definition: EcalFenixTcp.cc:53
EcalFenixTcpFormatEE
Definition: EcalFenixTcpFormatEE.h:23
EcalFenixTcp::sfgvbEB_
EcalFenixTcpsFgvbEB * sfgvbEB_
Definition: EcalFenixTcp.h:44
EcalFenixTcpFgvbEE::setParameters
void setParameters(uint32_t towid, const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE)
Definition: EcalFenixTcpFgvbEE.cc:41
EcalFenixEtTot
class for calculation of Et for Fenix tcp calculates the sum. As in the firmware the Et sum is splitt...
Definition: EcalFenixEtTot.h:28
EcalTPGTowerStatus
Definition: EcalTPGTowerStatus.h:9
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalFenixTcp::formatter_EE_
EcalFenixTcpFormatEE * formatter_EE_
Definition: EcalFenixTcp.h:47
EcalFenixTcp::EcalFenixTcp
EcalFenixTcp(bool tcpFormat, bool debug, bool famos, int binOfMax, int maxNrSamples, int nbMaxStrips, bool TPinfoPrintout)
Definition: EcalFenixTcp.cc:14
EcalFenixTcp::ecaltpgFineGrainTowerEE_
const EcalTPGFineGrainTowerEE * ecaltpgFineGrainTowerEE_
Definition: EcalFenixTcp.h:139
EcalFenixTcp::ecaltpgLut_
const EcalTPGLutIdMap * ecaltpgLut_
Definition: EcalFenixTcp.h:137
EcalFenixTcp::fgvbEB_
EcalFenixFgvbEB * fgvbEB_
Definition: EcalFenixTcp.h:42
EcalFenixTcp::process_part2_endcap
void process_part2_endcap(std::vector< std::vector< int >> &, int nStr, int bitMask, int bitOddEven, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE, const EcalTPGTowerStatus *ecaltpgBadTT, std::vector< EcalTriggerPrimitiveSample > &tptow, std::vector< EcalTriggerPrimitiveSample > &tptow2, bool isInInnerRings, EcalTrigTowerDetId towid)
Definition: EcalFenixTcp.cc:200
EcalFenixTcp::ecaltpgTPMode_
const EcalTPGTPMode * ecaltpgTPMode_
Definition: EcalFenixTcp.h:142
EcalFenixFgvbEB::setParameters
void setParameters(uint32_t towid, const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup, const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB)
Definition: EcalFenixFgvbEB.cc:71
EcalFenixTcpsFgvbEB::process
void process(std::vector< std::vector< int >> &bypasslin_out, int nStr, int bitMask, std::vector< int > &output)
Definition: EcalFenixTcpsFgvbEB.cc:7
EcalFenixTcp::ecaltpgBadTT_
const EcalTPGTowerStatus * ecaltpgBadTT_
Definition: EcalFenixTcp.h:140
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
EcalFenixTcp::getMaxOf2
EcalFenixMaxof2 * getMaxOf2() const
Definition: EcalFenixTcp.h:128
EcalFenixTcp::bypasslin_
std::vector< EcalFenixBypassLin * > bypasslin_
Definition: EcalFenixTcp.h:40
EcalFenixTcp::strip_fgvb_out_
std::vector< int > strip_fgvb_out_
Definition: EcalFenixTcp.h:55
EcalFenixTcp::maxOf2_
EcalFenixMaxof2 * maxOf2_
Definition: EcalFenixTcp.h:39
EcalFenixTcp::fgvbEE_
EcalFenixTcpFgvbEE * fgvbEE_
Definition: EcalFenixTcp.h:43