``` /***************************************************************************
*
* \$Id\$
*
* Author: Marcelo Munhoz
***************************************************************************
*
* Description: SVT Hybrid System Test Array BASE class
*
***************************************************************************
*
* \$Log\$
**************************************************************************/
////////////////////////////////////////////////////////////////////////////
//                                                                        //
// Used to calculate the statistics (mean and RMS) of pixel quantities.   //
// For instance, it can be used to calculate the pedestals of a hybrid.   //
//                                                                        //
////////////////////////////////////////////////////////////////////////////

#include <math.h>
#include "StSvtHybridPixels.hh"
#include "StSvtHybridStat.hh"

ClassImp(StSvtHybridStat)

StSvtHybridStat::StSvtHybridStat() : StSvtHybrid()
{
reset();
}

StSvtHybridStat::StSvtHybridStat(int barrel, int ladder, int wafer, int hybrid) :
{
// The same as StSvtHybrid.

m0 = new StSvtHybridPixels(barrel, ladder, wafer, hybrid);
m1 = new StSvtHybridPixels(barrel, ladder, wafer, hybrid);
m2 = new StSvtHybridPixels(barrel, ladder, wafer, hybrid);
}

StSvtHybridStat::~StSvtHybridStat()
{
delete m0;
delete m1;
delete m2;
}

StSvtHybridStat& StSvtHybridStat::operator = (const StSvtHybridStat& h)
{
m0 = h.m0;
m1 = h.m1;
m2 = h.m2;
return *this;
}

{
float x0, x1, x2;

for (int i=0;i<m0->getTotalNumberOfPixels();i++) {
x0 = m0->At(i) + h->get0thMom()->At(i);
x1 = m1->At(i) + h->get1stMom()->At(i);
x2 = m2->At(i) + h->get2ndMom()->At(i);

}

return this;
}

void StSvtHybridStat::setMoms(StSvtHybridPixels* h1, StSvtHybridPixels* h2, int weight)
{
for (int i=0;i<m0->getTotalNumberOfPixels();i++)

m1 = h1;
m2 = h2;
}

void StSvtHybridStat::setMoms(float* x1, float* x2, int weight)
{
for (int i=0;i<m0->getTotalNumberOfPixels();i++)

m1->Set(m1->getTotalNumberOfPixels(),x1);
m2->Set(m2->getTotalNumberOfPixels(),x2);
}

float StSvtHybridStat::getMean(int anode, int time)
{
// Returns the mean value for pixel (anode,time)

int index = m0->getPixelIndex(anode,time);
int n = m0->At(index);
int sum = m1->At(index);

float mean;

if (n)
mean = (float)sum/(float)n;
else
return 0;

return mean;
}

float StSvtHybridStat::getRMS(int anode, int time)
{
// Returns the RMS for pixel (anode,time)

int index = m0->getPixelIndex(anode,time);
int n = m0->At(index);
int sum = m1->At(index);
int sumSQ = m2->At(index);

float mean;
float meanSQ;

if (n) {
mean = (float)sum/(float)n;
meanSQ = (float)sumSQ/(float)n;
}
else
return 0;

float rms = sqrt(meanSQ - mean*mean);

return rms;
}

void StSvtHybridStat::fillMom(int x, int anode, int time)
{
// Fills the 0th, 1st and 2nd order momenta of pixel (anode,time) with the value x

int previousValue;
int index = m0->getPixelIndex(anode,time);

previousValue = m0->At(index);

previousValue = m1->At(index);

previousValue = m2->At(index);
}

void StSvtHybridStat::fillMomAllPixels(int x)
{
for (int anode=1;anode<=m0->getNumberOfAnodes();anode++) {
for (int time=0;time<m0->getNumberOfTimeBins();time++) {
fillMom(x,anode,time);
}
}
}

void StSvtHybridStat::reset()
{
m0 = NULL;
m1 = NULL;
m2 = NULL;
}
```

ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.