CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EBDataFrame.cc
Go to the documentation of this file.
3 #include<iostream>
4 
6 {
7  if ( size() != 10 ) {
8  edm::LogError("InvalidNumberOfSamples") << "This method only applies to signals sampled 10 times ("
9  << size() << " samples found)";
10  return 10.;
11  }
12  // skip faulty channels
13  if ( sample(5).adc() == 0 ) return 10.;
14  size_t imax = 0;
15  int maxAdc = 0;
16  for ( int i = 0; i < size(); ++i ) {
17  if ( sample(i).adc() > maxAdc ) {
18  imax = i;
19  maxAdc = sample(i).adc();
20  }
21  }
22  // skip early signals
23  if ( imax < 4 ) return 10.;
24  float ped = 1./3. * (sample(0).adc() + sample(1).adc() + sample(2).adc());
25  return 0.18*(sample(4).adc()-ped)/(sample(5).adc()-ped) + (sample(6).adc()-ped)/(sample(5).adc()-ped);
26 }
27 
28 
29 std::ostream& operator<<(std::ostream& s, const EBDataFrame& digi) {
30  s << digi.id() << " " << digi.size() << " samples " << std::endl;
31  for (int i=0; i<digi.size(); i++)
32  s << " " << digi[i] << std::endl;
33  return s;
34 }
int adc(sample_type sample)
get the ADC sample (12 bits)
float spikeEstimator() const
Definition: EBDataFrame.cc:5
int i
Definition: DBlmapReader.cc:9
key_type id() const
Definition: EBDataFrame.h:32
EcalMGPASample sample(int i) const
Definition: EcalDataFrame.h:30
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
int size() const
Definition: EcalDataFrame.h:27
int adc() const
get the ADC sample (12 bits)