Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

HadMon Class Reference

#include <HadMon.h>

Inheritance diagram for HadMon:

Swic List of all members.

Public Member Functions

double GetStats (double &xmean, double &ymean, double &xrms, double &yrms)
 Calculate statistical values.

Static Public Member Functions

int Index (int channel)
int Channel (int row, int col)
double PixelPosition (int rowcol)

Static Public Attributes

const int NROWCOLS = 7
const double ROWCOL_SPACING = 11.43

Detailed Description

HadMon

Helper for dealing with Hadron Montor acnet devices in the Bmnt produced TTree

Definition at line 12 of file HadMon.h.


Member Function Documentation

int HadMon::Channel int  row,
int  col
[static]
 

Return the hardware channel corresponding to the given row,col ((1,1)->(7,7)). NO checks on input values are made.

Definition at line 25 of file HadMon.cxx.

Referenced by GetStats().

00026 {
00027     return col + (row-1)*NROWCOLS;
00028 }

double HadMon::GetStats double &  xmean,
double &  ymean,
double &  xrms,
double &  yrms
 

Calculate statistical values.

Definition at line 35 of file HadMon.cxx.

References Channel(), Swic::GetVoltage(), Index(), max, and PixelPosition().

00037 {
00038     double qy=0,qx=0,q=0,q2y2=0,q2x2=0,max=0;
00039     for (int col=1; col<=7; ++col) {
00040         for (int row=1; row <= 7; ++row) {
00041             double X = this->PixelPosition(col);
00042             double Y = this->PixelPosition(row);
00043             int index = Index(Channel(row,col));
00044             double Q = this->GetVoltage(index);
00045 
00046             q += Q;
00047             qx += Q*X;
00048             qy += Q*Y;
00049             q2x2 += Q*X*Q*X;
00050             q2y2 += Q*Y*Q*Y;
00051             if (max<q) max = q;
00052         }
00053     }
00054     if (q == 0.0) return q;
00055 
00056     xmean = qx/q;
00057     ymean = qy/q;
00058     xrms = sqrt(q2x2)/fabs(q);
00059     yrms = sqrt(q2y2)/fabs(q);
00060     return q;
00061 }

int HadMon::Index int  channel  )  [static]
 

Definition at line 8 of file HadMon.cxx.

Referenced by GetStats().

00009 {
00010     // hard code channel map.
00011     // Channel numbers are 1-1 with buffer indices except:
00012     // - channels start with 1, indices start with 0
00013     // - buffer starts at index 104
00014     // - vert/horiz blocks are reversed.  Ie:
00015     //   channel = (01-48)(49-96)
00016     //   buffer  = (48-95)(00-47)
00017 
00018     if (channel < 1 || channel > 49) return -1;
00019     int offset = -1;
00020     if (channel == 49) offset = 104;
00021     else offset = channel + 151;
00022     return offset - 104;
00023 }

double HadMon::PixelPosition int  rowcol  )  [static]
 

Return the position of the center of the given row or column from the origin, in cm.

Definition at line 30 of file HadMon.cxx.

Referenced by GetStats().

00031 {
00032     return (rowcol-4)*ROWCOL_SPACING;   // cm
00033 }


Member Data Documentation

const int HadMon::NROWCOLS = 7 [static]
 

Definition at line 5 of file HadMon.cxx.

const double HadMon::ROWCOL_SPACING = 11.43 [static]
 

Definition at line 6 of file HadMon.cxx.


The documentation for this class was generated from the following files:
Generated on Thu Nov 1 11:58:30 2007 for loon by  doxygen 1.3.9.1