CMS 3D CMS Logo

EcalFenixStrip.h
Go to the documentation of this file.
1 #ifndef ECAL_FENIXSTRIP_H
2 #define ECAL_FENIXSTRIP_H
3 
9 
16 
17 class EBDataFrame;
24 class EcalTPGStripStatus;
25 
31 public:
32  // constructor, destructor
34  const EcalElectronicsMapping *theMapping,
35  bool debug,
36  bool famos,
37  int maxNrSamples,
38  int nbMaxXtals);
39  virtual ~EcalFenixStrip();
40 
41 private:
43 
44  bool debug_;
45  bool famos_;
47 
48  std::vector<EcalFenixLinearizer *> linearizer_;
49 
51 
53 
55 
57 
59 
61 
62  // data formats for each event
63  std::vector<std::vector<int>> lin_out_;
64  std::vector<int> add_out_;
65  std::vector<int> filt_out_;
66  std::vector<int> peak_out_;
67  std::vector<int> format_out_;
68  std::vector<int> fgvb_out_;
69  std::vector<int> fgvb_out_temp_;
70 
79 
80  bool identif_;
81 
82 public:
83  void setPointers(const EcalTPGPedestals *ecaltpPed,
84  const EcalTPGLinearizationConst *ecaltpLin,
85  const EcalTPGWeightIdMap *ecaltpgWeightMap,
86  const EcalTPGWeightGroup *ecaltpgWeightGroup,
87  const EcalTPGSlidingWindow *ecaltpgSlidW,
88  const EcalTPGFineGrainStripEE *ecaltpgFgStripEE,
89  const EcalTPGCrystalStatus *ecaltpgBadX,
90  const EcalTPGStripStatus *ecaltpgStripStatus) {
91  ecaltpPed_ = ecaltpPed;
92  ecaltpLin_ = ecaltpLin;
93  ecaltpgWeightMap_ = ecaltpgWeightMap;
94  ecaltpgWeightGroup_ = ecaltpgWeightGroup;
95  ecaltpgSlidW_ = ecaltpgSlidW;
96  ecaltpgFgStripEE_ = ecaltpgFgStripEE;
97  ecaltpgBadX_ = ecaltpgBadX;
98  ecaltpgStripStatus_ = ecaltpgStripStatus;
99  }
100 
101  // main methods
102  // process method is splitted in 2 parts:
103  // the first one is templated, the same except input
104  // the second part is slightly different for barrel/endcap
105  template <class T>
106  void process(const edm::EventSetup &, std::vector<const T> &, int nrxtals, std::vector<int> &out);
107  void process_part2_barrel(uint32_t stripid,
108  const EcalTPGSlidingWindow *ecaltpgSlidW,
109  const EcalTPGFineGrainStripEE *ecaltpgFgStripEE);
110 
111  void process_part2_endcap(uint32_t stripid,
112  const EcalTPGSlidingWindow *ecaltpgSlidW,
113  const EcalTPGFineGrainStripEE *ecaltpgFgStripEE,
114  const EcalTPGStripStatus *ecaltpgStripStatus);
115 
116  // getters for the algorithms ;
117 
119  EcalFenixEtStrip *getAdder() const { return adder_; }
122 
125 
126  EcalFenixStripFgvbEE *getFGVB() const { return fgvbEE_; }
127 
129  bool getbadStripMissing() const { return identif_; }
130 
131  // ========================= implementations
132  // ==============================================================
133  void process(const edm::EventSetup &setup, std::vector<EBDataFrame> &samples, int nrXtals, std::vector<int> &out) {
134  // now call processing
135  if (samples.empty()) {
136  std::cout << " Warning: 0 size vector found in EcalFenixStripProcess!!!!!" << std::endl;
137  return;
138  }
140  uint32_t stripid = elId.rawId() & 0xfffffff8; // from Pascal
141 
143 
145  samples,
146  nrXtals,
147  stripid,
148  ecaltpPed_,
149  ecaltpLin_,
152  ecaltpgBadX_); // templated part
154  ecaltpgFgStripEE_); // part different for barrel/endcap
155  out = format_out_;
156  }
157 
158  void process(const edm::EventSetup &setup, std::vector<EEDataFrame> &samples, int nrXtals, std::vector<int> &out) {
159  // now call processing
160  if (samples.empty()) {
161  std::cout << " Warning: 0 size vector found in EcalFenixStripProcess!!!!!" << std::endl;
162  return;
163  }
165  uint32_t stripid = elId.rawId() & 0xfffffff8; // from Pascal
166 
168 
170  samples,
171  nrXtals,
172  stripid,
173  ecaltpPed_,
174  ecaltpLin_,
177  ecaltpgBadX_); // templated part
179  out = format_out_; // FIXME: timing
180  return;
181  }
182 
183  template <class T>
184  void process_part1(int identif,
185  std::vector<T> &df,
186  int nrXtals,
187  uint32_t stripid,
188  const EcalTPGPedestals *ecaltpPed,
189  const EcalTPGLinearizationConst *ecaltpLin,
190  const EcalTPGWeightIdMap *ecaltpgWeightMap,
191  const EcalTPGWeightGroup *ecaltpgWeightGroup,
192  const EcalTPGCrystalStatus *ecaltpBadX) {
193  if (debug_)
194  std::cout << "\n\nEcalFenixStrip input is a vector of size: " << nrXtals << std::endl;
195 
196  // loop over crystals
197  for (int cryst = 0; cryst < nrXtals; cryst++) {
198  if (debug_) {
199  std::cout << std::endl;
200  std::cout << "cryst= " << cryst << " EBDataFrame/EEDataFrame is: " << std::endl;
201  for (int i = 0; i < df[cryst].size(); i++) {
202  std::cout << " " << std::dec << df[cryst][i].adc();
203  }
204  std::cout << std::endl;
205  }
206  // call linearizer
207  this->getLinearizer(cryst)->setParameters(df[cryst].id().rawId(), ecaltpPed, ecaltpLin, ecaltpBadX);
208  this->getLinearizer(cryst)->process(df[cryst], lin_out_[cryst]);
209  }
210 
211  if (debug_) {
212  std::cout << "output of linearizer is a vector of size: " << std::dec << lin_out_.size() << " of which used "
213  << nrXtals << std::endl;
214  for (int ix = 0; ix < nrXtals; ix++) {
215  std::cout << "cryst: " << ix << " value : " << std::dec << std::endl;
216  std::cout << " lin_out[ix].size()= " << std::dec << lin_out_[ix].size() << std::endl;
217  for (unsigned int i = 0; i < lin_out_[ix].size(); i++) {
218  std::cout << " " << std::dec << (lin_out_[ix])[i];
219  }
220  std::cout << std::endl;
221  }
222 
223  std::cout << std::endl;
224  }
225 
226  // Now call the sFGVB - this is common between EB and EE!
227  getFGVB()->setParameters(identif, stripid, ecaltpgFgStripEE_);
229 
230  if (debug_) {
231  std::cout << "output of strip fgvb is a vector of size: " << std::dec << fgvb_out_temp_.size() << std::endl;
232  for (unsigned int i = 0; i < fgvb_out_temp_.size(); i++) {
233  std::cout << " " << std::dec << (fgvb_out_temp_[i]);
234  }
235  std::cout << std::endl;
236  }
237 
238  // call adder
239  this->getAdder()->process(lin_out_, nrXtals, add_out_); // add_out is of size SIZEMAX=maxNrSamples
240 
241  if (debug_) {
242  std::cout << "output of adder is a vector of size: " << std::dec << add_out_.size() << std::endl;
243  for (unsigned int ix = 0; ix < add_out_.size(); ix++) {
244  std::cout << "cryst: " << ix << " value : " << std::dec << add_out_[ix] << std::endl;
245  }
246  std::cout << std::endl;
247  }
248 
249  if (famos_) {
250  filt_out_[0] = add_out_[0];
251  peak_out_[0] = add_out_[0];
252  return;
253  } else {
254  // call amplitudefilter
255  this->getFilter()->setParameters(stripid, ecaltpgWeightMap, ecaltpgWeightGroup);
256  this->getFilter()->process(add_out_, filt_out_, fgvb_out_temp_, fgvb_out_);
257 
258  if (debug_) {
259  std::cout << "output of filter is a vector of size: " << std::dec << filt_out_.size() << std::endl;
260  for (unsigned int ix = 0; ix < filt_out_.size(); ix++) {
261  std::cout << "cryst: " << ix << " value : " << std::dec << filt_out_[ix] << std::endl;
262  }
263  std::cout << std::endl;
264 
265  std::cout << "output of sfgvb after filter is a vector of size: " << std::dec << fgvb_out_.size() << std::endl;
266  for (unsigned int ix = 0; ix < fgvb_out_.size(); ix++) {
267  std::cout << "cryst: " << ix << " value : " << std::dec << fgvb_out_[ix] << std::endl;
268  }
269  std::cout << std::endl;
270  }
271 
272  // call peakfinder
273  this->getPeakFinder()->process(filt_out_, peak_out_);
274  if (debug_) {
275  std::cout << "output of peakfinder is a vector of size: " << peak_out_.size() << std::endl;
276  for (unsigned int ix = 0; ix < peak_out_.size(); ix++) {
277  std::cout << "cryst: " << ix << " value : " << peak_out_[ix] << std::endl;
278  }
279  std::cout << std::endl;
280  }
281  return;
282  }
283  }
284 };
285 #endif
EcalFenixStrip::ecaltpPed_
const EcalTPGPedestals * ecaltpPed_
Definition: EcalFenixStrip.h:71
EcalElectronicsMapping
Definition: EcalElectronicsMapping.h:28
EcalTPGWeightIdMap
Definition: EcalTPGWeightIdMap.h:10
EcalFenixStrip::debug_
bool debug_
Definition: EcalFenixStrip.h:44
mps_fire.i
i
Definition: mps_fire.py:355
EcalFenixStrip::getLinearizer
EcalFenixLinearizer * getLinearizer(int i) const
Definition: EcalFenixStrip.h:118
EcalFenixEtStrip.h
EcalFenixPeakFinder::process
int process()
Definition: EcalFenixPeakFinder.cc:23
EcalFenixStripFgvbEE.h
ESHandle.h
EcalTriggerElectronicsId
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...
Definition: EcalTriggerElectronicsId.h:18
EcalFenixStripFgvbEE::process
void process(std::vector< std::vector< int >> &lin_out, std::vector< int > &output)
Definition: EcalFenixStripFgvbEE.cc:14
EcalFenixStrip::add_out_
std::vector< int > add_out_
Definition: EcalFenixStrip.h:64
EcalFenixStrip::process
void process(const edm::EventSetup &, std::vector< const T > &, int nrxtals, std::vector< int > &out)
EcalFenixStrip::process
void process(const edm::EventSetup &setup, std::vector< EBDataFrame > &samples, int nrXtals, std::vector< int > &out)
Definition: EcalFenixStrip.h:133
EcalFenixStrip::~EcalFenixStrip
virtual ~EcalFenixStrip()
Definition: EcalFenixStrip.cc:43
EBDataFrame
Definition: EBDataFrame.h:11
EcalTPGFineGrainStripEE
Definition: EcalTPGFineGrainStripEE.h:9
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EcalFenixStrip::ecaltpgStripStatus_
const EcalTPGStripStatus * ecaltpgStripStatus_
Definition: EcalFenixStrip.h:78
EcalFenixStrip::process_part1
void process_part1(int identif, std::vector< T > &df, int nrXtals, uint32_t stripid, const EcalTPGPedestals *ecaltpPed, const EcalTPGLinearizationConst *ecaltpLin, const EcalTPGWeightIdMap *ecaltpgWeightMap, const EcalTPGWeightGroup *ecaltpgWeightGroup, const EcalTPGCrystalStatus *ecaltpBadX)
Definition: EcalFenixStrip.h:184
EcalFenixStrip::amplitude_filter_
EcalFenixAmplitudeFilter * amplitude_filter_
Definition: EcalFenixStrip.h:50
EcalFenixPeakFinder
calculates the peak for Fenix strip, barrel input : 18 bits output: boolean
Definition: EcalFenixPeakFinder.h:16
EcalFenixStrip::process_part2_endcap
void process_part2_endcap(uint32_t stripid, const EcalTPGSlidingWindow *ecaltpgSlidW, const EcalTPGFineGrainStripEE *ecaltpgFgStripEE, const EcalTPGStripStatus *ecaltpgStripStatus)
Definition: EcalFenixStrip.cc:77
EcalFenixStrip::setPointers
void setPointers(const EcalTPGPedestals *ecaltpPed, const EcalTPGLinearizationConst *ecaltpLin, const EcalTPGWeightIdMap *ecaltpgWeightMap, const EcalTPGWeightGroup *ecaltpgWeightGroup, const EcalTPGSlidingWindow *ecaltpgSlidW, const EcalTPGFineGrainStripEE *ecaltpgFgStripEE, const EcalTPGCrystalStatus *ecaltpgBadX, const EcalTPGStripStatus *ecaltpgStripStatus)
Definition: EcalFenixStrip.h:83
EcalFenixStripFgvbEE::getMissedStripFlag
bool getMissedStripFlag() const
Definition: EcalFenixStripFgvbEE.h:35
EcalFenixStrip::ecaltpgWeightMap_
const EcalTPGWeightIdMap * ecaltpgWeightMap_
Definition: EcalFenixStrip.h:73
EcalFenixStrip::EcalFenixStrip
EcalFenixStrip(const edm::EventSetup &setup, const EcalElectronicsMapping *theMapping, bool debug, bool famos, int maxNrSamples, int nbMaxXtals)
Definition: EcalFenixStrip.cc:11
EcalFenixStrip::getFormatterEE
EcalFenixStripFormatEE * getFormatterEE() const
Definition: EcalFenixStrip.h:124
EcalFenixStrip::ecaltpgWeightGroup_
const EcalTPGWeightGroup * ecaltpgWeightGroup_
Definition: EcalFenixStrip.h:74
EcalTPGWeightGroup
Definition: EcalTPGWeightGroup.h:13
EcalCondObjectContainer< EcalTPGPedestal >
EcalFenixEtStrip::process
void process(const std::vector< std::vector< int >> &linout, int nrXtals, std::vector< int > &output)
Definition: EcalFenixEtStrip.cc:6
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
EgammaValidation_cff.samples
samples
Definition: EgammaValidation_cff.py:19
EcalFenixStrip::fgvb_out_temp_
std::vector< int > fgvb_out_temp_
Definition: EcalFenixStrip.h:69
EcalFenixStrip::ecaltpgBadX_
const EcalTPGCrystalStatus * ecaltpgBadX_
Definition: EcalFenixStrip.h:77
EcalTPGSlidingWindow
Definition: EcalTPGSlidingWindow.h:9
EcalFenixStrip::getFilter
EcalFenixAmplitudeFilter * getFilter() const
Definition: EcalFenixStrip.h:120
debug
#define debug
Definition: HDRShower.cc:19
EcalFenixStrip::fenixFormatterEB_
EcalFenixStripFormatEB * fenixFormatterEB_
Definition: EcalFenixStrip.h:54
EcalFenixStrip::getAdder
EcalFenixEtStrip * getAdder() const
Definition: EcalFenixStrip.h:119
EcalFenixStripFgvbEE::setParameters
void setParameters(int identif, uint32_t id, const EcalTPGFineGrainStripEE *)
Definition: EcalFenixStripFgvbEE.cc:33
EcalFenixStrip::famos_
bool famos_
Definition: EcalFenixStrip.h:45
EcalFenixStrip::nbMaxXtals_
int nbMaxXtals_
Definition: EcalFenixStrip.h:46
EcalFenixStrip::adder_
EcalFenixEtStrip * adder_
Definition: EcalFenixStrip.h:58
EcalFenixStrip::format_out_
std::vector< int > format_out_
Definition: EcalFenixStrip.h:67
EcalFenixEtStrip
Definition: EcalFenixEtStrip.h:20
EcalFenixLinearizer::setParameters
void setParameters(uint32_t raw, const EcalTPGPedestals *ecaltpPed, const EcalTPGLinearizationConst *ecaltpLin, const EcalTPGCrystalStatus *ecaltpBadX)
Definition: EcalFenixLinearizer.cc:20
EcalFenixStrip::fgvbEE_
EcalFenixStripFgvbEE * fgvbEE_
Definition: EcalFenixStrip.h:60
EcalFenixStrip::getFormatterEB
EcalFenixStripFormatEB * getFormatterEB() const
Definition: EcalFenixStrip.h:123
EcalFenixStripFormatEE
Formatting for Fenix strip input: 18 bits + 3x 1bit (fgvb, gapflagbit, output from peakfinder) output...
Definition: EcalFenixStripFormatEE.h:19
EcalFenixStrip::process_part2_barrel
void process_part2_barrel(uint32_t stripid, const EcalTPGSlidingWindow *ecaltpgSlidW, const EcalTPGFineGrainStripEE *ecaltpgFgStripEE)
Definition: EcalFenixStrip.cc:55
EcalFenixPeakFinder.h
EcalElectronicsMapping.h
EcalFenixLinearizer
Linearisation for Fenix strip input: 16 bits corresponding to input EBDataFrame output: 18 bits.
Definition: EcalFenixLinearizer.h:19
EcalFenixStrip::ecaltpgSlidW_
const EcalTPGSlidingWindow * ecaltpgSlidW_
Definition: EcalFenixStrip.h:75
EcalFenixStripFgvbEE
calculation of Fgvb for the endcap in Fenix Strip calculates fgvb for the endcap in Fenix Strip
Definition: EcalFenixStripFgvbEE.h:21
EcalFenixStrip::getFGVB
EcalFenixStripFgvbEE * getFGVB() const
Definition: EcalFenixStrip.h:126
EcalTriggerElectronicsId.h
EcalElectronicsMapping::getTriggerElectronicsId
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
Definition: EcalElectronicsMapping.cc:389
EcalFenixLinearizer::process
int process()
Definition: EcalFenixLinearizer.cc:51
EcalFenixStrip
class representing the Fenix chip, format strip
Definition: EcalFenixStrip.h:30
EBDataFrame.h
edm::EventSetup
Definition: EventSetup.h:57
EcalFenixStrip::filt_out_
std::vector< int > filt_out_
Definition: EcalFenixStrip.h:65
EcalFenixStrip::setbadStripMissing
void setbadStripMissing(bool flag)
Definition: EcalFenixStrip.h:128
EcalFenixStrip::lin_out_
std::vector< std::vector< int > > lin_out_
Definition: EcalFenixStrip.h:63
EEDataFrame.h
EcalFenixStrip::getPeakFinder
EcalFenixPeakFinder * getPeakFinder() const
Definition: EcalFenixStrip.h:121
EcalFenixAmplitudeFilter::setParameters
void setParameters(uint32_t raw, const EcalTPGWeightIdMap *ecaltpgWeightMap, const EcalTPGWeightGroup *ecaltpgWeightGroup)
Definition: EcalFenixAmplitudeFilter.cc:95
EcalFenixStrip::identif_
bool identif_
Definition: EcalFenixStrip.h:80
EcalFenixStrip::peak_out_
std::vector< int > peak_out_
Definition: EcalFenixStrip.h:66
EcalFenixStrip::linearizer_
std::vector< EcalFenixLinearizer * > linearizer_
Definition: EcalFenixStrip.h:48
EcalFenixAmplitudeFilter
calculates .... for Fenix strip, barrel input: 18 bits output: 18 bits
Definition: EcalFenixAmplitudeFilter.h:17
EcalFenixStrip::ecaltpgFgStripEE_
const EcalTPGFineGrainStripEE * ecaltpgFgStripEE_
Definition: EcalFenixStrip.h:76
EcalFenixStrip::fenixFormatterEE_
EcalFenixStripFormatEE * fenixFormatterEE_
Definition: EcalFenixStrip.h:56
EventSetup.h
EcalTPGStripStatus
Definition: EcalTPGStripStatus.h:9
EcalFenixAmplitudeFilter.h
EcalFenixStrip::theMapping_
const EcalElectronicsMapping * theMapping_
Definition: EcalFenixStrip.h:42
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
EcalTriggerPrimitiveSample
Definition: EcalTriggerPrimitiveSample.h:12
EcalFenixStrip::fgvb_out_
std::vector< int > fgvb_out_
Definition: EcalFenixStrip.h:68
EcalFenixStrip::getbadStripMissing
bool getbadStripMissing() const
Definition: EcalFenixStrip.h:129
EcalFenixLinearizer.h
EcalFenixStripFormatEB
Formatting for Fenix strip input: 18 bits + 3x 1bit (fgvb, gapflagbit, output from peakfinder) output...
Definition: EcalFenixStripFormatEB.h:18
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
EcalTriggerElectronicsId::rawId
uint32_t rawId() const
Definition: EcalTriggerElectronicsId.h:28
EcalFenixAmplitudeFilter::process
void process()
Definition: EcalFenixAmplitudeFilter.cc:72
EcalFenixStrip::ecaltpLin_
const EcalTPGLinearizationConst * ecaltpLin_
Definition: EcalFenixStrip.h:72
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
EcalFenixStrip::peak_finder_
EcalFenixPeakFinder * peak_finder_
Definition: EcalFenixStrip.h:52
EcalFenixStrip::process
void process(const edm::EventSetup &setup, std::vector< EEDataFrame > &samples, int nrXtals, std::vector< int > &out)
Definition: EcalFenixStrip.h:158