CMS 3D CMS Logo

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