clusterInfo.h
Go to the documentation of this file.
1 #ifndef CLUSTERINFO__H
2 #define CLUSTERINFO__H
3 #include <TMath.h>
4 
5 class clusterInfo{
6 public:
7  uint64_t N() const {return n[0]+n[1];}
8  uint64_t Nx() const {return n[0];}
9  uint64_t Ny() const {return n[1];}
10  uint64_t ADC() const{return adc[0]+adc[1];}
11  uint64_t ADC_x() const{return adc[0];}
12  uint64_t ADC_y() const{return adc[1];}
13  double ADC_corr() const{return adc_corr;}
14  uint64_t x() const {return crd[0];}
15  uint64_t y() const {return crd[1];}
16  uint64_t z() const {return crd[2];}
17 
18  uint64_t t = 0;
19  uint64_t crd[3] = {0,0,0};
20  uint64_t n[2] = {0,0};
21  uint64_t adc[2]= {0,0};
22  double adc_corr= 0;
23  //uint16_t adc[2] = {0,0};
24 };
25 
27  clusterInfo c;
28  //get the minimal time
29  c.t=slice.front().TDC().val;
30  c.crd[2] = slice.front().Plane().val;
31 
32  for(auto const& hit : slice){
33 
34  const uint16_t view = hit.View().val-1;
35  if(c.n[view] == 0) c.crd[view] = hit.Cell().val;
36 
37  ++c.n[view];
38  }
39 
40  for(auto const& hit : slice){
41  // View of *this* cell
42  const uint16_t view = hit.View().val-1;
43 
44  // coordinate of the *other* view, or halfway if
45  const double pos = c.n[!view]?c.crd[!view]:384./2.;
46 
47  const double atten_len = 400./3.93; // in *cells*
48 
49  c.adc[view] += hit.ADC().val;
50  c.adc_corr += hit.ADC().val
51  *exp((384.-pos )/atten_len)
52  /exp((384./ 2. )/atten_len);
53  }
54  return c;
55 
56 }
57 
58 std::ostream& operator << (std::ostream& s,const clusterInfo& c){
59  //s<<"adc="<<(int)c.ADC()<<" n=["<<c.n[0]<<","<<c.n[1]<<"]; pos=["<<c.crd[0]<<","<<c.crd[1]<<","<<c.crd[2]<<","<<c.t<<"]";
60  s<<c.ADC()<<" "<<c.n[0]<<" "<<c.n[1]<<" "<<c.crd[0]<<" "<<c.crd[1]<<" "<<c.crd[2]<<" "<<c.t;
61  return s;
62 }
63 #endif
uint64_t y() const
Definition: clusterInfo.h:15
uint64_t ADC_y() const
Definition: clusterInfo.h:12
uint64_t n[2]
Definition: clusterInfo.h:20
uint64_t x() const
Definition: clusterInfo.h:14
double adc_corr
Definition: clusterInfo.h:22
std::vector< DAQHit > HitList
Definition: HitList.h:15
uint64_t ADC_x() const
Definition: clusterInfo.h:11
clusterInfo CalcCluster(const novaddt::HitList &slice)
Definition: clusterInfo.h:26
uint64_t Nx() const
Definition: clusterInfo.h:8
const XML_Char * s
Definition: expat.h:262
uint64_t ADC() const
Definition: clusterInfo.h:10
uint64_t N() const
Definition: clusterInfo.h:7
uint64_t t
Definition: clusterInfo.h:18
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
uint64_t z() const
Definition: clusterInfo.h:16
double ADC_corr() const
Definition: clusterInfo.h:13
uint64_t Ny() const
Definition: clusterInfo.h:9
std::ostream & operator<<(std::ostream &s, const clusterInfo &c)
Definition: clusterInfo.h:58
Definition: structs.h:12
uint64_t adc[2]
Definition: clusterInfo.h:21
uint64_t crd[3]
Definition: clusterInfo.h:19