CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalFenixStrip.h
Go to the documentation of this file.
1 #ifndef ECAL_FENIXSTRIP_H
2 #define ECAL_FENIXSTRIP_H
3 
11 
18 
19 class EBDataFrame;
26 
32  public:
33 
34  // constructor, destructor
35  EcalFenixStrip(const edm::EventSetup& setup, const EcalElectronicsMapping* theMapping,bool debug,bool famos,int maxNrSamples, int nbMaxXtals);
36  virtual ~EcalFenixStrip() ;
37 
38  private:
40 
41  bool debug_;
42  bool famos_;
44 
45  std::vector <EcalFenixLinearizer *> linearizer_;
46 
48 
50 
52 
54 
55 
57 
59 
60  // data formats for each event
61  std::vector<std::vector<int> > lin_out_;
62  std::vector<int> add_out_;
63  std::vector<int> filt_out_;
64  std::vector<int> peak_out_;
65  std::vector<int> format_out_;
66  std::vector<int> fgvb_out_;
67 
75 
76  public:
77 
78  void setPointers( const EcalTPGPedestals * ecaltpPed,
79  const EcalTPGLinearizationConst *ecaltpLin,
80  const EcalTPGWeightIdMap *ecaltpgWeightMap,
81  const EcalTPGWeightGroup *ecaltpgWeightGroup,
82  const EcalTPGSlidingWindow *ecaltpgSlidW,
83  const EcalTPGFineGrainStripEE *ecaltpgFgStripEE,
84  const EcalTPGCrystalStatus *ecaltpgBadX)
85  {
86  ecaltpPed_=ecaltpPed;
87  ecaltpLin_=ecaltpLin;
88  ecaltpgWeightMap_=ecaltpgWeightMap;
89  ecaltpgWeightGroup_= ecaltpgWeightGroup;
90  ecaltpgSlidW_=ecaltpgSlidW;
91  ecaltpgFgStripEE_=ecaltpgFgStripEE;
92  ecaltpgBadX_=ecaltpgBadX;
93  }
94 
95  // main methods
96  // process method is splitted in 2 parts:
97  // the first one is templated, the same except input
98  // the second part is slightly different for barrel/endcap
99  template <class T>
100  void process(const edm::EventSetup&, std::vector<const T> &, int nrxtals, std::vector<int> & out);
101  void process_part2_barrel(uint32_t stripid,const EcalTPGSlidingWindow * ecaltpgSlidW);
102 
103  void process_part2_endcap(uint32_t stripid, const EcalTPGSlidingWindow * ecaltpgSlidW,const EcalTPGFineGrainStripEE * ecaltpgFgStripEE);
104 
105 
106  // getters for the algorithms ;
107 
109  EcalFenixEtStrip *getAdder() const { return adder_;}
112 
115 
117 
118  // ========================= implementations ==============================================================
119  void process(const edm::EventSetup &setup, std::vector<EBDataFrame> &samples, int nrXtals,std::vector<int> &out){
120 
121  // now call processing
122  if (samples.size()==0) {
123  std::cout<<" Warning: 0 size vector found in EcalFenixStripProcess!!!!!"<<std::endl;
124  return;
125 
126  }
127  const EcalTriggerElectronicsId elId = theMapping_->getTriggerElectronicsId(samples[0].id());
128  uint32_t stripid=elId.rawId() & 0xfffffff8; //from Pascal
129  process_part1(samples,nrXtals,stripid,ecaltpPed_,ecaltpLin_,ecaltpgWeightMap_,ecaltpgWeightGroup_,ecaltpgBadX_);//templated part
130  process_part2_barrel(stripid,ecaltpgSlidW_);//part different for barrel/endcap
131  out=format_out_;
132  }
133 
134  void process(const edm::EventSetup &setup, std::vector<EEDataFrame> &samples, int nrXtals, std::vector<int> & out){
135 
136 // now call processing
137  if (samples.size()==0) {
138  std::cout<<" Warning: 0 size vector found in EcalFenixStripProcess!!!!!"<<std::endl;
139  return;
140  }
141  const EcalTriggerElectronicsId elId = theMapping_->getTriggerElectronicsId(samples[0].id());
142  uint32_t stripid=elId.rawId() & 0xfffffff8; //from Pascal
143  process_part1(samples,nrXtals,stripid,ecaltpPed_,ecaltpLin_,ecaltpgWeightMap_,ecaltpgWeightGroup_,ecaltpgBadX_); //templated part
145  out=format_out_; //FIXME: timing
146  return;
147  }
148 
149  template <class T>
150  void process_part1(std::vector<T> & df,int nrXtals, uint32_t stripid, const EcalTPGPedestals * ecaltpPed, const
151  EcalTPGLinearizationConst *ecaltpLin,const EcalTPGWeightIdMap * ecaltpgWeightMap,const EcalTPGWeightGroup * ecaltpgWeightGroup, const EcalTPGCrystalStatus * ecaltpBadX)
152  {
153 
154  if(debug_) std::cout<<"\n\nEcalFenixStrip input is a vector of size: "<<nrXtals<< std::endl;
155 
156  //loop over crystals
157  for (int cryst=0;cryst<nrXtals;cryst++) {
158  if(debug_){
159  std::cout<<std::endl;
160  std::cout <<"cryst= "<<cryst<<" EBDataFrame/EEDataFrame is: "<<std::endl;
161  for ( int i = 0; i<df[cryst].size();i++){
162  std::cout <<" "<<std::dec<<df[cryst][i].adc();
163  }
164  std::cout<<std::endl;
165  }
166  // call linearizer
167  this->getLinearizer(cryst)->setParameters(df[cryst].id().rawId(),ecaltpPed,ecaltpLin,ecaltpBadX) ;
168  this->getLinearizer(cryst)->process(df[cryst],lin_out_[cryst]);
169  }
170 
171  if(debug_){
172  std::cout<< "output of linearizer is a vector of size: "
173  <<std::dec<<lin_out_.size()<<" of which used "<<nrXtals<<std::endl;
174  for (int ix=0;ix<nrXtals;ix++){
175  std::cout<< "cryst: "<<ix<<" value : "<<std::dec<<std::endl;
176  std::cout<<" lin_out[ix].size()= "<<std::dec<<lin_out_[ix].size()<<std::endl;
177  for (unsigned int i =0; i<lin_out_[ix].size();i++){
178  std::cout <<" "<<std::dec<<(lin_out_[ix])[i];
179  }
180  std::cout<<std::endl;
181  }
182 
183  std::cout<<std::endl;
184  }
185 
186  // call adder
187  this->getAdder()->process(lin_out_,nrXtals,add_out_); //add_out is of size SIZEMAX=maxNrSamples
188 
189  if(debug_){
190  std::cout<< "output of adder is a vector of size: "<<std::dec<<add_out_.size()<<std::endl;
191  for (unsigned int ix=0;ix<add_out_.size();ix++){
192  std::cout<< "cryst: "<<ix<<" value : "<<std::dec<<add_out_[ix]<<std::endl;
193  }
194  std::cout<<std::endl;
195  }
196 
197 
198  if (famos_) {
199  filt_out_[0]= add_out_[0];
200  peak_out_[0]= add_out_[0];
201  return;
202  }else {
203  // call amplitudefilter
204  this->getFilter()->setParameters(stripid,ecaltpgWeightMap,ecaltpgWeightGroup);
205  this->getFilter()->process(add_out_,filt_out_);
206 
207  if(debug_){
208  std::cout<< "output of filter is a vector of size: "<<std::dec<<filt_out_.size()<<std::endl;
209  for (unsigned int ix=0;ix<filt_out_.size();ix++){
210  std::cout<< "cryst: "<<ix<<" value : "<<std::dec<<filt_out_[ix]<<std::endl;
211  }
212  std::cout<<std::endl;
213  }
214 
215  // call peakfinder
217  if(debug_){
218  std::cout<< "output of peakfinder is a vector of size: "<<peak_out_.size()<<std::endl;
219  for (unsigned int ix=0;ix<peak_out_.size();ix++){
220  std::cout<< "cryst: "<<ix<<" value : "<<peak_out_[ix]<<std::endl;
221  }
222  std::cout<<std::endl;
223  }
224  return;
225  }
226  }
227 
228 };
229 #endif
230 
EcalFenixStripFgvbEE * fgvbEE_
int i
Definition: DBlmapReader.cc:9
void setParameters(uint32_t raw, const EcalTPGPedestals *ecaltpPed, const EcalTPGLinearizationConst *ecaltpLin, const EcalTPGCrystalStatus *ecaltpBadX)
std::vector< std::vector< int > > lin_out_
std::vector< int > add_out_
void process_part2_barrel(uint32_t stripid, const EcalTPGSlidingWindow *ecaltpgSlidW)
void process(const edm::EventSetup &setup, std::vector< EBDataFrame > &samples, int nrXtals, std::vector< int > &out)
std::vector< EcalFenixLinearizer * > linearizer_
EcalFenixStripFormatEB * fenixFormatterEB_
EcalFenixAmplitudeFilter * getFilter() const
class representing the Fenix chip, format strip
void process_part2_endcap(uint32_t stripid, const EcalTPGSlidingWindow *ecaltpgSlidW, const EcalTPGFineGrainStripEE *ecaltpgFgStripEE)
EcalFenixPeakFinder * getPeakFinder() const
const EcalElectronicsMapping * theMapping_
calculates the peak for Fenix strip, barrel input : 18 bits output: boolean
const EcalTPGSlidingWindow * ecaltpgSlidW_
void setPointers(const EcalTPGPedestals *ecaltpPed, const EcalTPGLinearizationConst *ecaltpLin, const EcalTPGWeightIdMap *ecaltpgWeightMap, const EcalTPGWeightGroup *ecaltpgWeightGroup, const EcalTPGSlidingWindow *ecaltpgSlidW, const EcalTPGFineGrainStripEE *ecaltpgFgStripEE, const EcalTPGCrystalStatus *ecaltpgBadX)
calculation of Fgvb for the endcap in Fenix Strip calculates fgvb for the endcap in Fenix Strip ...
Formatting for Fenix strip input: 18 bits + 3x 1bit (fgvb, gapflagbit, output from peakfinder) output...
std::vector< int > filt_out_
void process(const edm::EventSetup &, std::vector< const T > &, int nrxtals, std::vector< int > &out)
void process_part1(std::vector< T > &df, int nrXtals, uint32_t stripid, const EcalTPGPedestals *ecaltpPed, const EcalTPGLinearizationConst *ecaltpLin, const EcalTPGWeightIdMap *ecaltpgWeightMap, const EcalTPGWeightGroup *ecaltpgWeightGroup, const EcalTPGCrystalStatus *ecaltpBadX)
const EcalTPGLinearizationConst * ecaltpLin_
Linearisation for Fenix strip input: 16 bits corresponding to input EBDataFrame output: 18 bits...
virtual ~EcalFenixStrip()
const EcalTPGCrystalStatus * ecaltpgBadX_
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
EcalFenixStripFgvbEE * getFGVB() const
EcalFenixPeakFinder * peak_finder_
const EcalTPGWeightIdMap * ecaltpgWeightMap_
const EcalTPGWeightGroup * ecaltpgWeightGroup_
calculates .... for Fenix strip, barrel input: 18 bits output: 18 bits
tuple out
Definition: dbtoconf.py:99
Formatting for Fenix strip input: 18 bits + 3x 1bit (fgvb, gapflagbit, output from peakfinder) output...
const EcalTPGPedestals * ecaltpPed_
std::vector< int > fgvb_out_
EcalFenixEtStrip * getAdder() const
const EcalTPGFineGrainStripEE * ecaltpgFgStripEE_
EcalFenixStripFormatEB * getFormatterEB() const
void process(const edm::EventSetup &setup, std::vector< EEDataFrame > &samples, int nrXtals, std::vector< int > &out)
void setParameters(uint32_t raw, const EcalTPGWeightIdMap *ecaltpgWeightMap, const EcalTPGWeightGroup *ecaltpgWeightGroup)
std::vector< int > format_out_
EcalFenixStripFormatEE * getFormatterEE() const
tuple cout
Definition: gather_cfg.py:41
EcalFenixAmplitudeFilter * amplitude_filter_
EcalFenixStripFormatEE * fenixFormatterEE_
EcalFenixLinearizer * getLinearizer(int i) const
std::vector< int > peak_out_
#define debug
Definition: MEtoEDMFormat.h:34
void process(const std::vector< std::vector< int > > &linout, int nrXtals, std::vector< int > &output)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...
EcalFenixEtStrip * adder_
EcalFenixStrip(const edm::EventSetup &setup, const EcalElectronicsMapping *theMapping, bool debug, bool famos, int maxNrSamples, int nbMaxXtals)