#include <BDHadMuMon.h>
Inheritance diagram for BDHadMuMon:

Public Member Functions | |
| BDHadMuMon () | |
| Default constructor. | |
| BDHadMuMon (const RawBeamData &hadmu_data) | |
| Construct a BDHadMuMon with an initial RawBeamData object. | |
| virtual | ~BDHadMuMon () |
| virtual void | SetData (const RawBeamData &hadmu_data) |
| Set the RawBeamData from a Hadron or Muon monitor device. | |
| int | Index (int channel) |
| Convert hardware channel [1,max_channel] to index into data array [0,max_channel-1]. | |
| int | Channel (int row, int col) |
| Convert pixel row,col (each [1,max_rowcol]) to hardware channel [1,max_channel]. Pixel origin is lower left. | |
| double | PixelPosition (int rowcol) |
| Return the pixel position given either a row or column [1,max_rowcol]. Rows and column numbers originate in lower left. | |
| double | GetStats (double &xmean, double &ymean, double &xrms, double &yrms) |
| Calculate statistical measure of beam center and width. | |
| int | GetNrowcol () const |
Private Member Functions | |
| void | UpdateCache () |
Private Attributes | |
| int | fNrowcol |
| int | fNchannels |
| double | fRowColSpacing |
Provide routines specific to hadron and muon monitors for unpacking the data based on channel or pixel numbers.
The hadron monitor channel mapping is different (transposed) from the muon monitors mapping. Both count pixels starting from row=1 and col=1 with the origin at the lower left. See NuMI-B-1084 for diagrams.
Created on: Fri Apr 15 14:25:38 2005
Definition at line 35 of file BDHadMuMon.h.
|
|
Default constructor. Constructed this way, this object will not be valid until SetData() is called. Definition at line 13 of file BDHadMuMon.cxx. 00014 : BDSwicDevice(), fNrowcol(0),fNchannels(0),fRowColSpacing(0.0) 00015 { 00016 }
|
|
|
Construct a BDHadMuMon with an initial RawBeamData object. The RawBeamData object should be from Hadron or muon monitor data. Definition at line 18 of file BDHadMuMon.cxx. References UpdateCache(). 00019 : BDSwicDevice(hadmu_data), fNrowcol(0),fNchannels(0),fRowColSpacing(0.0) 00020 { 00021 this->UpdateCache(); 00022 }
|
|
|
Definition at line 23 of file BDHadMuMon.cxx. 00024 {
00025 }
|
|
||||||||||||
|
Convert pixel row,col (each [1,max_rowcol]) to hardware channel [1,max_channel]. Pixel origin is lower left.
Definition at line 65 of file BDHadMuMon.cxx. Referenced by dump_hadmus(), HadMuMonModule::Fill(), and GetStats(). 00066 {
00067 --row; // internally we use
00068 --col; // 0 based counting
00069
00070 int chan = -2;
00071
00072 if (row<0||row>=fNrowcol||col<0||col>=fNrowcol) {
00073 MSG("BD",Msg::kWarning)
00074 << "BDHadMuMon::Channel: row/col out of bounds, r,c = "
00075 << row << "," << col << endl;
00076 return -2;
00077 }
00078
00079 // The PTB decided to transpose the channel numbering between the two....
00080 if (fNrowcol == 7) // hadron monitor
00081 chan = (6-row)*fNrowcol + col;
00082 else if (fNrowcol == 9) // muon monitors
00083 chan = col*fNrowcol + (8-row);
00084 else
00085 MSG("BD",Msg::kWarning)
00086 << "BDHadMuMon::Channel: Unknown number or rows/columns: " << fNrowcol << endl;
00087
00088 return chan+1; // externally Had/Mu channes are 1 based counting
00089 }
|
|
|
Definition at line 75 of file BDHadMuMon.h. Referenced by dump_hadmus(), and HadMuMonModule::Fill(). 00075 { return fNrowcol; }
|
|
||||||||||||||||||||
|
Calculate statistical measure of beam center and width.
Definition at line 95 of file BDHadMuMon.cxx. References Channel(), BDSwicDevice::GetCharge(), Index(), and max. Referenced by dump_hadmus(), and HadMuMonModule::Fill(). 00096 {
00097 double qy=0,qx=0,q=0,q2y2=0,q2x2=0,max=0;
00098
00099 for (int col=0; col<fNrowcol; ++col) {
00100 double X = (col-(fNrowcol-1)/2)* fRowColSpacing;
00101
00102 for (int row=0; row <fNrowcol; ++row) {
00103 double Y = (row-(fNrowcol-1)/2)*fRowColSpacing;
00104
00105 int offset = this->Index(Channel(row+1,col+1));
00106 double Q = this->GetCharge(offset);
00107
00108 q += Q;
00109 qx += Q*X;
00110 qy += Q*Y;
00111 q2x2 += Q*X*Q*X;
00112 q2y2 += Q*Y*Q*Y;
00113 if (max<q) max = q;
00114 }
00115 }
00116 if (q == 0.0) return q;
00117
00118 xmean = qx/q;
00119 ymean = qy/q;
00120 xrms = sqrt(q2x2)/fabs(q);
00121 yrms = sqrt(q2y2)/fabs(q);
00122 return q;
00123
00124 }
|
|
|
Convert hardware channel [1,max_channel] to index into data array [0,max_channel-1].
Definition at line 55 of file BDHadMuMon.cxx. Referenced by dump_hadmus(), HadMuMonModule::Fill(), and GetStats(). 00056 {
00057 --channel; // internally we use 0 based counting
00058
00059 // offset = (00-47)(48-95)
00060 // channel = (48-95)(00-47)
00061 if (channel < 0 || channel >= fNchannels) return -1;
00062 if (channel < 48) return channel + 48;
00063 return channel - 48; // array offset is by definition 0 based
00064 }
|
|
|
Return the pixel position given either a row or column [1,max_rowcol]. Rows and column numbers originate in lower left.
Definition at line 90 of file BDHadMuMon.cxx. References fNrowcol. Referenced by HadMuMonModule::Fill(). 00091 {
00092 --rowcol; // internally we use 0 based counting
00093 return (rowcol - (fNrowcol-1)/2) * fRowColSpacing;
00094 }
|
|
|
Set the RawBeamData from a Hadron or Muon monitor device.
Reimplemented from BDSwicDevice. Definition at line 27 of file BDHadMuMon.cxx. References BDSwicDevice::SetData(), and UpdateCache(). Referenced by TestCalibModule::Ana(), and BeamMonDbuModule::Process(). 00028 {
00029 this->BDSwicDevice::SetData(hadmu_data);
00030 this->UpdateCache();
00031 }
|
|
|
Definition at line 33 of file BDHadMuMon.cxx. References fNchannels, fNrowcol, fRowColSpacing, RawBeamSwicData::GetData(), RawBeamData::GetName(), RawBeamSwicData::IsValid(), and MSG. Referenced by BDHadMuMon(), and SetData(). 00034 {
00035 if (!this->IsValid()) {
00036 MSG("BD",Msg::kDebug)
00037 << "UpdateCache called with invalid device data\n";
00038 return;
00039 }
00040 RawBeamData& rbd = this->GetData();
00041 string name = rbd.GetName();
00042 if (name == "E:HADMDS") { // hadron monitor
00043 fNrowcol = 7;
00044 fNchannels = 7*7;
00045 fRowColSpacing = 11.43*Munits::cm;
00046 }
00047 else { // muon monitor
00048 fNrowcol = 9;
00049 fNchannels = 9*9;
00050 fRowColSpacing = 25.4*Munits::cm;
00051 }
00052
00053 }
|
|
|
Definition at line 81 of file BDHadMuMon.h. Referenced by UpdateCache(). |
|
|
Definition at line 81 of file BDHadMuMon.h. Referenced by Channel(), PixelPosition(), and UpdateCache(). |
|
|
Definition at line 82 of file BDHadMuMon.h. Referenced by UpdateCache(). |
1.3.9.1