31 #include "StSvtHybridPixels.hh"
32 #include "StSvtHybridStat.hh"
46 StSvtHybridStat::~StSvtHybridStat()
65 for (
int i=0;i<m0->getTotalNumberOfPixels();i++) {
66 x0 = m0->At(i) + h->get0thMom()->At(i);
67 x1 = m1->At(i) + h->get1stMom()->At(i);
68 x2 = m2->At(i) + h->get2ndMom()->At(i);
80 for (
int i=0;i<m0->getTotalNumberOfPixels();i++)
87 void StSvtHybridStat::setMoms(
float* x1,
float* x2,
int weight)
89 for (
int i=0;i<m0->getTotalNumberOfPixels();i++)
92 m1->Set(m1->getTotalNumberOfPixels(),x1);
93 m2->Set(m2->getTotalNumberOfPixels(),x2);
96 float StSvtHybridStat::getMean(
int anode,
int time)
100 int index = m0->getPixelIndex(anode,time);
101 int n = (int)m0->At(index);
102 int sum = (int)m1->At(index);
107 mean = (float)sum/(
float)n;
114 float StSvtHybridStat::getRMS(
int anode,
int time)
118 int index = m0->getPixelIndex(anode,time);
119 int n = (int)m0->At(index);
120 int sum = (int)m1->At(index);
121 int sumSQ = (int)m2->At(index);
127 mean = (float)sum/(
float)n;
128 meanSQ = (float)sumSQ/(
float)n;
133 float rms = ::sqrt(meanSQ - mean*mean);
138 void StSvtHybridStat::fillMom(
int x,
int anode,
int time)
143 int index = m0->getPixelIndex(anode,time);
145 previousValue = (int)m0->At(index);
146 m0->AddAt(1+previousValue,index);
148 previousValue = (int)m1->At(index);
149 m1->AddAt(x+previousValue,index);
151 previousValue = (int)m2->At(index);
152 m2->AddAt(x*x+previousValue,index);
155 void StSvtHybridStat::fillMomAllPixels(
int x)
157 for (
int anode=1;anode<=m0->getNumberOfAnodes();anode++) {
158 for (
int time=0;time<m0->getNumberOfTimeBins();time++) {
159 fillMom(x,anode,time);
164 void StSvtHybridStat::reset()