ProfMon Class Reference

#include <ProfMon.h>

Inheritance diagram for ProfMon:
Swic

List of all members.

Public Member Functions

 ProfMon ()
virtual ~ProfMon ()
double GetStats (double &xmean, double &ymean, double &xrms, double &yrms)

Static Public Member Functions

static int Xindex (int channel)
static int Yindex (int channel)
static double WirePosition (int channel)

Static Public Attributes

static const double WIRE_SPACING = 0.5
static const int MIN_CHANNEL = 1
static const int MAX_CHANNEL = 44

Detailed Description

ProfMon

Helper for dealing with Profile Monitor acnet devices in the bmnt ttree

Definition at line 12 of file ProfMon.h.


Constructor & Destructor Documentation

ProfMon::ProfMon (  ) 

Definition at line 11 of file ProfMon.cxx.

00012 {
00013 }

ProfMon::~ProfMon (  )  [virtual]

Definition at line 14 of file ProfMon.cxx.

00015 {
00016 }


Member Function Documentation

double ProfMon::GetStats ( double &  xmean,
double &  ymean,
double &  xrms,
double &  yrms 
)

Calculate statistical values. Return the sum of charge in both X and Y

Definition at line 44 of file ProfMon.cxx.

References Swic::GetVoltage(), MAX_CHANNEL, MIN_CHANNEL, WirePosition(), Xindex(), and Yindex().

Referenced by ProtonDist::Fill().

00046 {
00047     double qx=0,qx2=0,qtotx=0;
00048     double qy=0,qy2=0,qtoty=0;
00049     for (int ch = MIN_CHANNEL; ch <= MAX_CHANNEL; ++ch) {
00050         double X = this->WirePosition(ch);
00051         double Y = this->WirePosition(ch);
00052 
00053         int x_index = this->Xindex(ch);
00054         int y_index = this->Yindex(ch);
00055 
00056         double Qx = this->GetVoltage(x_index);
00057         double Qy = this->GetVoltage(y_index);
00058 
00059         Qx = Qx > 0 ? Qx : 0;
00060         Qy = Qy > 0 ? Qy : 0;
00061 
00062         qtotx += Qx;
00063         qtoty += Qy;
00064             
00065         qx += Qx*X;
00066         qy += Qy*Y;
00067 
00068         qx2 += Qx*X*X;
00069         qy2 += Qy*Y*Y;
00070     }
00071     xmean = qx/qtotx;
00072     ymean = qy/qtoty;
00073     xrms = sqrt(qx2/qtotx-xmean*xmean);
00074     yrms = sqrt(qy2/qtoty-ymean*ymean);
00075     return qtotx+qtoty;
00076 
00077 }

double ProfMon::WirePosition ( int  channel  )  [static]

Return the distance from origin to given wire channel. Origin is half way between channels 22 and 23.

Definition at line 39 of file ProfMon.cxx.

References MAX_CHANNEL, MIN_CHANNEL, and WIRE_SPACING.

Referenced by book_and_fill(), fill_profile(), and GetStats().

00040 {
00041     double mid = (MAX_CHANNEL-MIN_CHANNEL)/2.0 + MIN_CHANNEL;
00042     return (channel - mid) * WIRE_SPACING;
00043 }

int ProfMon::Xindex ( int  channel  )  [static]

Get the index into the wire data block for the given wire channel for either X or Y views. The channels are numbered 1-44, indices are confined to be [0-95] but don't fill the range completly. Negative index is returned if a bad channel is passed.

Definition at line 27 of file ProfMon.cxx.

References MAX_CHANNEL.

Referenced by fill_profile(), and GetStats().

00028 {
00029     if (channel < MIN_CHANNEL || channel > MAX_CHANNEL) return -1;
00030     return channel+1;
00031 }

int ProfMon::Yindex ( int  channel  )  [static]

Definition at line 32 of file ProfMon.cxx.

References MAX_CHANNEL.

Referenced by fill_profile(), and GetStats().

00033 {
00034     if (channel < MIN_CHANNEL || channel > MAX_CHANNEL) return -1;
00035     return channel+49;
00036 }


Member Data Documentation

const int ProfMon::MAX_CHANNEL = 44 [static]

Definition at line 17 of file ProfMon.h.

Referenced by book_and_fill(), fill_profile(), GetStats(), WirePosition(), Xindex(), and Yindex().

const int ProfMon::MIN_CHANNEL = 1 [static]

Definition at line 16 of file ProfMon.h.

Referenced by book_and_fill(), fill_profile(), GetStats(), and WirePosition().

const double ProfMon::WIRE_SPACING = 0.5 [static]

Definition at line 15 of file ProfMon.h.

Referenced by book_and_fill(), and WirePosition().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1