CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorAlgoUtils.cc
Go to the documentation of this file.
2 #include <math.h>
3 
4 namespace reco {
5  namespace castor {
6 
7  void getLinearizedADC(const CastorQIEShape& shape,
8  const CastorQIECoder* coder,
9  int bins,int capid,
10  float& lo,
11  float& hi){
12 
13  float low = coder->charge(shape,0,capid);
14  float high = coder->charge(shape,bins-1,capid);
15  float step = (high-low)/(bins-1);
16  low -= step/2.0; high += step/2.0;
17  lo = low; hi = high;
18  return;
19  }
20 
21  float maxDiff(float one, float two, float three, float four){
22  float max=-1000; float min = 1000;
23  if(one>max) max = one; if(one<min) min = one;
24  if(two>max) max = two; if(two<min) min = two;
25  if(three>max) max = three; if(three<min) min = three;
26  if(four>max) max = four; if(four<min) min = four;
27  return fabs(max-min);
28  }
29 
30  }
31 }
#define min(a, b)
Definition: mlp_lapack.h:161
const T & max(const T &a, const T &b)
void getLinearizedADC(const CastorQIEShape &shape, const CastorQIECoder *coder, int bins, int capid, float &lo, float &hi)
float charge(const CastorQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -&gt; fC conversion.
float maxDiff(float one, float two, float three, float four)