CMS 3D CMS Logo

EcalFenixTcp.cc
Go to the documentation of this file.
3 
9 
11 
12 #include <vector>
13 //----------------------------------------------------------------------------------------
15  bool debug, bool famos, int binOfMax,
16  int maxNrSamples, int nbMaxStrips)
17  : debug_(debug), nbMaxStrips_(nbMaxStrips) {
18  bypasslin_.resize(nbMaxStrips_);
19  for (int i = 0; i < nbMaxStrips_; i++)
21  adder_ = new EcalFenixEtTot();
22  maxOf2_ = new EcalFenixMaxof2(maxNrSamples, nbMaxStrips_);
23  formatter_ = new EcalFenixTcpFormat(tcpFormat, debug_, famos, binOfMax);
24  fgvbEB_ = new EcalFenixFgvbEB(maxNrSamples);
25  fgvbEE_ = new EcalFenixTcpFgvbEE(maxNrSamples);
27 
28  // permanent data structures
29  bypasslin_out_.resize(nbMaxStrips_);
30  std::vector<int> vec(maxNrSamples, 0);
31  for (int i = 0; i < nbMaxStrips_; i++)
32  bypasslin_out_[i] = vec;
33  adder_out_.resize(maxNrSamples);
34  maxOf2_out_.resize(maxNrSamples);
35  fgvb_out_.resize(maxNrSamples);
36  strip_fgvb_out_.resize(maxNrSamples);
37 }
38 //-----------------------------------------------------------------------------------------
40  for (int i = 0; i < nbMaxStrips_; i++)
41  delete bypasslin_[i];
42  delete adder_;
43  delete maxOf2_;
44  delete formatter_;
45  delete fgvbEB_;
46  delete fgvbEE_;
47 }
48 //-----------------------------------------------------------------------------------------
49 
51  const edm::EventSetup &setup,
52  std::vector<EBDataFrame> &bid, // dummy argument for template call
53  std::vector<std::vector<int>> &tpframetow, int nStr,
54  std::vector<EcalTriggerPrimitiveSample> &tptow,
55  std::vector<EcalTriggerPrimitiveSample> &tptow2, bool isInInnerRing,
56  EcalTrigTowerDetId towid) {
57 
58  int bitMask = 12;
59  process_part1(tpframetow, nStr, bitMask);
60 
61  process_part2_barrel(tpframetow, nStr, bitMask, ecaltpgFgEBGroup_,
63  ecaltpgBadTT_, ecaltpgSpike_, tptow, tptow2, towid);
64 }
65 
66 //-----------------------------------------------------------------------------------------
68  const edm::EventSetup &setup,
69  std::vector<EEDataFrame> &bid, // dummy argument for template call
70  std::vector<std::vector<int>> &tpframetow, int nStr,
71  std::vector<EcalTriggerPrimitiveSample> &tptow,
72  std::vector<EcalTriggerPrimitiveSample> &tptow2, bool isInInnerRing,
73  EcalTrigTowerDetId towid) {
74  int bitMask = 12; // Pascal: endcap has 12 bits as in EB (bug in FENIX!!!!)
75  // {was 10 before]
76  process_part1(tpframetow, nStr, bitMask);
77 
78  process_part2_endcap(tpframetow, nStr, bitMask, ecaltpgLutGroup_, ecaltpgLut_,
80  isInInnerRing, towid);
81 }
82 //-----------------------------------------------------------------------------------------
83 void EcalFenixTcp::process_part1(std::vector<std::vector<int>> &tpframetow,
84  int nStr, int bitMask) {
85  // //call bypasslin
86  // for (int istrip=0;istrip<nStr;istrip ++){
87  // this->getBypasslin(istrip)->process(tpframetow[istrip],bypasslin_out_[istrip]);
88  // }
89  // //this is a test
90  // if (debug_) {
91  // std::cout<<"bypasslinout = "<<std::endl;
92  // for (int istrip=0;istrip<nStr;istrip ++){
93  // std::vector<int> stripin= bypasslin_out_[istrip];
94  // for (unsigned int is=0;is<stripin.size();is++){
95  // std::cout<<stripin[is]<<" ";
96  // }
97  // std::cout<<std::endl;
98  // }
99  // }
100 
101  // //call adder
102  // this->getAdder()->process(bypasslin_out_, nStr, bitMask,adder_out_);
103  this->getAdder()->process(tpframetow, nStr, bitMask, adder_out_);
104  // this is a test:
105  if (debug_) {
106  std::cout << "output of adder is a vector of size: " << adder_out_.size()
107  << std::endl;
108  std::cout << "value : " << std::endl;
109  for (unsigned int i = 0; i < adder_out_.size(); i++) {
110  std::cout << " " << adder_out_[i];
111  }
112  std::cout << std::endl;
113  }
114  // return adder_out;
115  return;
116 }
117 //-----------------------------------------------------------------------------------------
119  std::vector<std::vector<int>> &bypasslinout, int nStr, int bitMask,
120  const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup,
121  const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut,
122  const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB,
123  const EcalTPGTowerStatus *ecaltpgBadTT, const EcalTPGSpike *ecaltpgSpike,
124  std::vector<EcalTriggerPrimitiveSample> &tcp_out,
125  std::vector<EcalTriggerPrimitiveSample> &tcp_outTcc,
126  EcalTrigTowerDetId towid) {
127  // call maxof2
128  // this->getMaxOf2()->process(bypasslin_out_,nStr,maxOf2_out_);
129  this->getMaxOf2()->process(bypasslinout, nStr, bitMask, maxOf2_out_);
130  // this is a test:
131  if (debug_) {
132  std::cout << "output of maxof2 is a vector of size: " << maxOf2_out_.size()
133  << std::endl;
134  std::cout << "value : " << std::endl;
135  for (unsigned int i = 0; i < maxOf2_out_.size(); i++) {
136  std::cout << " " << std::dec << maxOf2_out_[i];
137  }
138  std::cout << std::endl;
139  }
140 
141  // call fgvb
142 
143  this->getFGVBEB()->setParameters(towid.rawId(), ecaltpgFgEBGroup,
144  ecaltpgFineGrainEB);
146 
147  // Call sFGVB
148  this->getsFGVBEB()->process(bypasslinout, nStr, bitMask, strip_fgvb_out_);
149 
150  // this is a test:
151  if (debug_) {
152  std::cout << "output of fgvb is a vector of size: " << fgvb_out_.size()
153  << std::endl;
154  std::cout << "value : " << std::endl;
155  for (unsigned int i = 0; i < fgvb_out_.size(); i++) {
156  std::cout << " " << std::dec << fgvb_out_[i];
157  }
158  std::cout << std::endl;
159  }
160 
161  // call formatter
162  int eTTotShift = 2;
163 
164  this->getFormatter()->setParameters(towid.rawId(), ecaltpgLutGroup,
165  ecaltpgLut, ecaltpgBadTT, ecaltpgSpike);
167  eTTotShift, tcp_out, tcp_outTcc, false);
168  // this is a test:
169  if (debug_) {
170  std::cout << "output of TCP formatter Barrel is a vector of size: "
171  << std::dec << tcp_out.size() << std::endl;
172  std::cout << "value : " << std::endl;
173  for (unsigned int i = 0; i < tcp_out.size(); i++) {
174  std::cout << " " << i << " " << std::dec << tcp_out[i];
175  }
176  std::cout << std::endl;
177  }
178 
179  return;
180 }
181 //-----------------------------------------------------------------------------------------
183  std::vector<std::vector<int>> &bypasslinout, int nStr, int bitMask,
184  const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut,
185  const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE,
186  const EcalTPGTowerStatus *ecaltpgbadTT,
187  std::vector<EcalTriggerPrimitiveSample> &tcp_out,
188  std::vector<EcalTriggerPrimitiveSample> &tcp_outTcc, bool isInInnerRings,
189  EcalTrigTowerDetId towid)
190 
191 {
192  // Zero EB strip records
193  for (unsigned int i = 0; i < strip_fgvb_out_.size(); ++i) {
194  strip_fgvb_out_[i] = 0;
195  }
196 
197  // call fgvb
198  this->getFGVBEE()->setParameters(towid.rawId(), ecaltpgFineGrainTowerEE);
199  // fgvbEE_->process(bypasslin_out_,nStr,bitMask,fgvb_out_);
200  fgvbEE_->process(bypasslinout, nStr, bitMask, fgvb_out_);
201 
202  // call formatter
203  int eTTotShift = 2; // Pascal: endcap has 12 bits as in EB (bug in FENIX!!!!)
204  // so shift must be applied to just keep [11:2]
205 
206  this->getFormatter()->setParameters(towid.rawId(), ecaltpgLutGroup,
207  ecaltpgLut, ecaltpgbadTT, nullptr);
208 
210  eTTotShift, tcp_out, tcp_outTcc,
211  isInInnerRings);
212  // this is a test:
213  if (debug_) {
214  std::cout << "output of TCP formatter(endcap) is a vector of size: "
215  << std::dec << tcp_out.size() << std::endl;
216  std::cout << "value : " << std::endl;
217  for (unsigned int i = 0; i < tcp_out.size(); i++) {
218  std::cout << " " << i << " " << std::dec << tcp_out[i] << std::endl;
219  }
220  std::cout << std::endl;
221  }
222  return;
223 }
void process_part2_barrel(std::vector< std::vector< int >> &, int nStr, int bitMask, 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)
void process(std::vector< int > &, std::vector< int > &)
const EcalTPGFineGrainEBIdMap * ecaltpgFineGrainEB_
Definition: EcalFenixTcp.h:130
void setParameters(uint32_t towid, const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup, const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB)
class for calculation of Et for Fenix tcp calculates the sum
EcalFenixTcpsFgvbEB * sfgvbEB_
Definition: EcalFenixTcp.h:45
EcalFenixMaxof2 * maxOf2_
Definition: EcalFenixTcp.h:40
void process(std::vector< std::vector< int >> &, int nStr, int bitMask, std::vector< int > &out)
EcalFenixTcpFormat * formatter_
Definition: EcalFenixTcp.h:47
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
calculation of Fgvb for Fenix Tcp, format barrel calculates fgvb for the barrel
void process(const edm::EventSetup &setup, 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:50
EcalFenixFgvbEB * getFGVBEB() const
Definition: EcalFenixTcp.h:123
void process(std::vector< int > &add_out, std::vector< int > &maxof2_out, std::vector< int > &output)
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
EcalFenixMaxof2 * getMaxOf2() const
Definition: EcalFenixTcp.h:121
virtual ~EcalFenixTcp()
Definition: EcalFenixTcp.cc:39
const EcalTPGSpike * ecaltpgSpike_
Definition: EcalFenixTcp.h:133
EcalFenixTcpFgvbEE * getFGVBEE() const
Definition: EcalFenixTcp.h:124
std::vector< int > fgvb_out_
Definition: EcalFenixTcp.h:53
const EcalTPGTowerStatus * ecaltpgBadTT_
Definition: EcalFenixTcp.h:132
EcalFenixTcpFgvbEE * fgvbEE_
Definition: EcalFenixTcp.h:44
std::vector< EcalFenixBypassLin * > bypasslin_
Definition: EcalFenixTcp.h:41
const EcalTPGFineGrainEBGroup * ecaltpgFgEBGroup_
Definition: EcalFenixTcp.h:127
void process_part1(std::vector< std::vector< int >> &tpframetow, int nStr, int bitMask)
Definition: EcalFenixTcp.cc:83
const EcalTPGLutIdMap * ecaltpgLut_
Definition: EcalFenixTcp.h:129
void process(std::vector< std::vector< int >> &bypasslin_out, int nStr, int bitMask, std::vector< int > &output)
void setParameters(uint32_t towid, const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE)
const EcalTPGFineGrainTowerEE * ecaltpgFineGrainTowerEE_
Definition: EcalFenixTcp.h:131
EcalFenixTcpsFgvbEB * getsFGVBEB() const
Definition: EcalFenixTcp.h:125
EcalFenixEtTot * getAdder() const
Definition: EcalFenixTcp.h:120
EcalFenixFgvbEB * fgvbEB_
Definition: EcalFenixTcp.h:43
#define debug
Definition: HDRShower.cc:19
void setParameters(uint32_t towid, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGTowerStatus *ecaltpgbadTT, const EcalTPGSpike *ecaltpgSpike)
calculation of Fgvb for Fenix Tcp, format endcap calculates fgvb for the endcap
std::vector< int > maxOf2_out_
Definition: EcalFenixTcp.h:52
std::vector< int > strip_fgvb_out_
Definition: EcalFenixTcp.h:54
EcalFenixTcpFormat * getFormatter() const
Definition: EcalFenixTcp.h:122
virtual std::vector< int > process(const std::vector< EBDataFrame * > &)
void process(std::vector< std::vector< int >> &bypasslin_out, int nStr, int bitMask, std::vector< int > &output)
const EcalTPGLutGroup * ecaltpgLutGroup_
Definition: EcalFenixTcp.h:128
std::vector< std::vector< int > > bypasslin_out_
Definition: EcalFenixTcp.h:50
EcalFenixEtTot * adder_
Definition: EcalFenixTcp.h:42
std::vector< int > adder_out_
Definition: EcalFenixTcp.h:51
EcalFenixTcp(const edm::EventSetup &setup, bool tcpFormat, bool debug, bool famos, int binOfMax, int maxNrSamples, int nbMaxStrips)
Definition: EcalFenixTcp.cc:14
Linearisation for Tcp input: 16 bits output: 12 bits +1 going to fgvb (???)
void process_part2_endcap(std::vector< std::vector< int >> &, int nStr, int bitMask, const EcalTPGLutGroup *ecaltpgLutGroup, const EcalTPGLutIdMap *ecaltpgLut, const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE, const EcalTPGTowerStatus *ecaltpgBadTT, std::vector< EcalTriggerPrimitiveSample > &tptow, std::vector< EcalTriggerPrimitiveSample > &tptow2, bool isInInnerRings, EcalTrigTowerDetId towid)
calculation of strip Fgvb for Fenix Tcp, format barrel calculates fgvb for the barrel ...