00001
00024 #ifndef BEAMMONSPILL_H
00025 #define BEAMMONSPILL_H
00026
00027 #include <Conventions/BeamType.h>
00028 #include <DatabaseInterface/DbiTableRow.h>
00029 #include <Validity/VldTimeStamp.h>
00030
00031 #include <vector>
00032
00033
00034 class BeamMonSpill : public DbiTableRow
00035 {
00036
00037 public:
00038
00039 BeamMonSpill();
00040
00044 ~BeamMonSpill();
00045
00047 virtual DbiTableRow* CreateTableRow() const;
00049 void Fill(DbiResultSet& rs, const DbiValidityRec* vrec);
00051 virtual void Store(DbiOutRowStream& ors, const DbiValidityRec* vrec) const;
00052
00058 VldTimeStamp SpillTime() const;
00059
00063 double BpmAtTarget(double &xmean, double &ymean, double &xrms, double &yrms) const;
00064
00067 BeamType::BeamType_t BeamType() const;
00068
00070 void SetTimestamps(const VldTimeStamp& dae, const VldTimeStamp& vme);
00071
00073 void SetToroids(double tor101, double tr101d, double tortgt, double trtgtd);
00074
00076 void SetHornCurrent(double cur);
00077
00079 void SetBPM(const std::vector<double>& xpos, const std::vector<double>& ypos,
00080 const std::vector<double>& intensities);
00081
00083 void SetProfile(double x, double y, double w, double h);
00084
00086 void SetHadMuInt(double had, double mu1, double mu2, double mu3);
00087
00089 struct StatusBits {
00091 unsigned int horn_on : 1;
00093 unsigned int target_in : 1;
00095 unsigned int beam_type : 3;
00097 unsigned int pedestal : 1;
00099 unsigned int pm121_in : 1;
00101 unsigned int pmtgt_in : 1;
00104 unsigned int time_source : 1;
00106 unsigned int n_batches : 3;
00108 unsigned int calibrated : 1;
00109 };
00110
00112 StatusBits GetStatusBits() const;
00113
00115 int GetStatusInt() const;
00116
00118 void SetStatusBits(StatusBits status);
00119
00121 StatusBits& Status();
00122
00123 public:
00124
00126 VldTimeStamp fDaeTime, fVmeTime;
00128 float fTor101, fTr101d, fTortgt, fTrtgtd;
00130 float fHornCur;
00132 float fTargBpmX[6], fTargBpmY[6];
00139 float fBpmInt[6];
00142 float fTargProfX, fTargProfY;
00144 float fProfWidX, fProfWidY;
00146 float fHadInt, fMuInt1, fMuInt2, fMuInt3;
00148 union { int integer; StatusBits bits; } fStatus;
00149
00150 ClassDef(BeamMonSpill,0)
00151 };
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167 inline
00168 BeamMonSpill::StatusBits& BeamMonSpill::Status()
00169 { return fStatus.bits; }
00170
00171 inline
00172 BeamMonSpill::StatusBits BeamMonSpill::GetStatusBits() const
00173 { return fStatus.bits; }
00174
00175 inline
00176 int BeamMonSpill::GetStatusInt() const
00177 { return fStatus.integer; }
00178
00179 inline
00180 void BeamMonSpill::SetStatusBits(BeamMonSpill::StatusBits status)
00181 { fStatus.bits = status; }
00182
00183 inline
00184 void BeamMonSpill::SetTimestamps(const VldTimeStamp& dae, const VldTimeStamp& vme)
00185 { fDaeTime = dae; fVmeTime = vme; }
00186
00187 inline
00188 void BeamMonSpill::SetToroids(double tor101, double tr101d,
00189 double tortgt, double trtgtd)
00190 { fTor101 = tor101; fTr101d = tr101d; fTortgt = tortgt; fTrtgtd = trtgtd; }
00191
00192 inline
00193 void BeamMonSpill::SetHornCurrent(double cur)
00194 { fHornCur = cur; }
00195
00196 inline
00197 void BeamMonSpill::SetHadMuInt(double had, double mu1, double mu2, double mu3)
00198 { fHadInt=had; fMuInt1=mu1; fMuInt2=mu2; fMuInt3=mu3; }
00199
00200 inline
00201 void BeamMonSpill::SetProfile(double x, double y, double w, double h)
00202 { fTargProfX=x;fTargProfY=y;fProfWidX=w;fProfWidY=h; }
00203
00204
00205 #endif // BEAMMONSPILL_H