CMS 3D CMS Logo

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