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

Public Types | |
| enum | BeamType { kUnknown = 0, kLE, kME, kHE, kPsME, kPsHE } |
Public Member Functions | |
| BDTarget () | |
| virtual | ~BDTarget () |
| void | SetSpill (const RawBeamMonHeaderBlock &rbmhb, const RawBeamMonBlock &rbmb) |
| Set the current spill blocks. | |
| BDProfMon & | GetPM121 () |
| BDProfMon & | GetPMTGT () |
| void | BpmProjection (std::vector< double > &xp, std::vector< double > &yp, std::vector< double > &xi, std::vector< double > &yi) const |
| int | ProfileProjection (double &x, double &y, double &xrms, double &yrms) const |
| BeamType | TargetIn (bool &is_in, double &z_location, double spilltime=0) const |
Private Member Functions | |
| int | GetNbatches () const |
Private Attributes | |
| const RawBeamData * | fBpms [6] |
| const RawBeamData * | fPMs [2] |
| const RawBeamData * | fTgt [3] |
| BDProfMon | fPM121 |
| BDProfMon | fPMTGT |
This collects info about the beam at the target and the target itself. It projects the beam via the last two BPMs and profile monitors. It also provides access to info about if the target is in and at what location.
Created on: Mon Apr 18 11:25:53 2005
Definition at line 41 of file BDTarget.h.
|
|
Enumerate possible target+horns configuration.
Definition at line 51 of file BDTarget.h. Referenced by TargetIn().
|
|
|
Definition at line 17 of file BDTarget.cxx. References fBpms, fPMs, and fTgt. 00018 : BDProcessor() 00019 { 00020 for (int ind=0; ind<4; ++ind) fBpms[ind] = 0; 00021 for (int ind=0; ind<2; ++ind) fPMs[ind] = 0; 00022 for (int ind=0; ind<3; ++ind) fTgt[ind] = 0; 00023 }
|
|
|
Definition at line 25 of file BDTarget.cxx. 00026 {
00027 }
|
|
||||||||||||||||||||
|
Fill vectors with projected BPM centers on target (using BPM at 121 and TGT) and intensities (using TGT).
Definition at line 120 of file BDTarget.cxx. References check_data(), extrapolate_position(), fBpms, get_dae_time(), RawBeamData::GetData(), GetNbatches(), TargetIn(), and z_hp121. Referenced by fill_bdtest(), and BMSpillFiller::Spill(). 00122 {
00123 xp.clear();
00124 yp.clear();
00125 xi.clear();
00126 yi.clear();
00127
00128 if (!check_data(fBpms,6)) return;
00129
00130 double devtime = get_dae_time(fBpms,6);
00131 double z_targ=0;
00132 bool is_in = false;
00133 if (! this->TargetIn(is_in,z_targ,devtime) || !is_in) return;
00134
00135 // find smallest number of batches (should all be same)
00136 int n = this->GetNbatches();
00137
00138 int start=0;
00139 if (n>1) ++start; // skip average but only if multiple batches
00140
00141 for (int ind=start; ind<n; ++ind) {
00142
00143 if (fBpms[4]->GetData()[ind] == 0 || fBpms[5]->GetData()[ind] == 0) {
00144 yp.push_back(0.0);
00145 xp.push_back(0.0);
00146 yi.push_back(0.0);
00147 xi.push_back(0.0);
00148 continue;
00149 }
00150
00151 yp.push_back
00152 (extrapolate_position(fBpms[0]->GetData()[ind]*Munits::mm,z_vp121,
00153 fBpms[2]->GetData()[ind]*Munits::mm,z_vptgt,
00154 z_targ));
00155 xp.push_back
00156 (extrapolate_position(fBpms[1]->GetData()[ind]*Munits::mm,z_hp121,
00157 fBpms[3]->GetData()[ind]*Munits::mm,z_hptgt,
00158 z_targ));
00159 yi.push_back(fBpms[4]->GetData()[ind]);
00160 xi.push_back(fBpms[5]->GetData()[ind]);
00161 }
00162 return;
00163 }
|
|
|
Definition at line 107 of file BDTarget.cxx. References fBpms, and RawBeamData::GetDataLength(). Referenced by BpmProjection(). 00108 {
00109 // return the shortest physical array length of all BPM positions
00110 // and intensities used.
00111 int n = fBpms[0]->GetDataLength();
00112 for (int ind=1; ind<6; ++ind) {
00113 int n2 = fBpms[ind]->GetDataLength();
00114 if (n2<n) n=n2;
00115 }
00116 return n;
00117 }
|
|
|
Definition at line 66 of file BDTarget.h. 00066 { return fPM121; }
|
|
|
Definition at line 67 of file BDTarget.h. 00067 { return fPMTGT; }
|
|
||||||||||||||||||||
|
Project Profile centers and widths to target.
Definition at line 165 of file BDTarget.cxx. References check_data(), extrapolate_position(), fPM121, fPMs, fPMTGT, get_dae_time(), BDProfMon::GetGaussFit(), and TargetIn(). Referenced by TargetModule::Fill(), fill_bdtest(), and BMSpillFiller::Spill(). 00166 {
00167 if (!check_data(fPMs,2)) return 0;
00168
00169 double devtime = get_dae_time(fPMs,2);
00170
00171 double z_targ=0;
00172 bool is_in = false;
00173 if (! this->TargetIn(is_in,z_targ,devtime) || !is_in) return 0;
00174
00175 double x121=-999,y121=-999,xrms121=-999,yrms121=-999;
00176 // fPM121.GetStats(x121,y121,xrms121,yrms121);
00177 fPM121.GetGaussFit(x121,y121,xrms121,yrms121);
00178
00179 double xtgt=0,ytgt=0,xrmstgt=0,yrmstgt=0;
00180 // fPMTGT.GetStats(xtgt,ytgt,xrmstgt,yrmstgt);
00181 fPMTGT.GetGaussFit(xtgt,ytgt,xrmstgt,yrmstgt);
00182
00183 if (fabs(x121) < 11*Munits::mm &&
00184 fabs(xtgt) < 11*Munits::mm &&
00185 fabs(y121) < 11*Munits::mm &&
00186 fabs(ytgt) < 11*Munits::mm) {
00187 x = extrapolate_position(x121,z_pm121,xtgt,z_pmtgt,z_targ);
00188 y = extrapolate_position(y121,z_pm121,ytgt,z_pmtgt,z_targ);
00189 }
00190
00191 xrms = xrmstgt;
00192 yrms = yrmstgt;
00193
00194 return 1;
00195 }
|
|
||||||||||||
|
Set the current spill blocks.
Implements BDProcessor. Definition at line 48 of file BDTarget.cxx. References check_data(), fBpms, fPM121, fPMs, fPMTGT, fTgt, MSG, and BDProfMon::SetData(). Referenced by TargetModule::Fill(), and fill_bdtest(). 00050 {
00051
00052 // Order matters!
00053 const char* bpms[] = { "E:VP121", "E:HP121", "E:VPTGT", "E:HPTGT",
00054 "E:VITGT", "E:HITGT", 0 };
00055 for (int ind=0; bpms[ind]; ++ind) {
00056 fBpms[ind] = rbmb[bpms[ind]];
00057 if (!fBpms[ind])
00058 MSG("BDU",Msg::kDebug) << "BPM \"" << bpms[ind] << "\" not found\n";
00059 }
00060
00061 const char* pms[] = { "E:M121DS", "E:MTGTDS", 0 };
00062 for (int ind=0; pms[ind]; ++ind) fPMs[ind] = rbmb[pms[ind]];
00063 if (check_data(fPMs,2)) {
00064 fPM121.SetData(*fPMs[0]);
00065 fPMTGT.SetData(*fPMs[1]);
00066 }
00067
00068 const char* tgt[] = { "I:NUTARZ", "I:NUTGUV", "I:NUTGDV", 0 };
00069 for (int ind=0; tgt[ind]; ++ind) fTgt[ind] = rbmb[tgt[ind]];
00070 }
|
|
||||||||||||||||
|
Target location. Fill is_in with true if target is in the beam link, fill z_location with distance from nominal LE. Using a non-zero spilltime will use the average position of the target instead of the readout
Definition at line 197 of file BDTarget.cxx. References BeamType, check_data(), fTgt, and RawBeamData::GetData(). Referenced by BpmProjection(), fill_bdtest(), ProfileProjection(), and BMSpillFiller::Spill(). 00198 {
00199 /* From Jim Hylen
00200
00201 Look at I:NUTGUV and I:NUTGDV
00202 If they are around 1531 and 1441, target is "in"
00203 If they are between 8800 and 8900, target is "out"
00204 Unit is .001"
00205
00206 For I:NUTARZ, LE ~ 0, Semi-ME ~ 39373, Semi-HE ~98408
00207 Calibration appears to have been drifting by a few
00208 tenths of a percent.
00209 */
00210
00211 // note on units: mils are used here implicitly as this is what
00212 // the raw data is in. location is returned in Munits
00213
00214 is_in = false;
00215 location = -9999/Munits::mil;
00216
00217 if (spilltime==0){
00218 // use the device readout to determine the target position
00219 if (!check_data(fTgt,3)) return kUnknown;
00220 location = fTgt[0]->GetData()[0];
00221 double up = fTgt[1]->GetData()[0];
00222 double down = fTgt[2]->GetData()[0];
00223
00224 // Check insert.
00225 if (up < 2000 && down < 2000) is_in = true;
00226
00227 }
00228 else {
00229 // use the measured average over a period of time in order to
00230 // avoid throwing away spills where the target was actually in
00231 // but the device failed to read out
00232
00233 // default assume target is in
00234 is_in = true;
00235 // target positions
00236 // FIXME: this is hardcoded for the time being, it would be
00237 // good if this goes into a database
00238 if (spilltime <= 1109540100) location = 39465; // 100 cm
00239 else if (spilltime <= 1109899600) location = 98070; // 250 cm
00240 else if (spilltime <= 1110280000) location = 39465; // 100 cm
00241 else if (spilltime <= 1112010000) location = 815.4; // 0 cm
00242 else if (spilltime <= 1112574300) location = 39350; // 100 cm
00243 else if (spilltime <= 1114040000) is_in = false;
00244 else if (spilltime <= 1114062000) location = 39372; // 100 cm
00245 else if (spilltime <= 1114640000) is_in = false;
00246 else if (spilltime <= 1115935000) location = 39363; // 100 cm
00247 else if (spilltime <= 1116615000) location = 98578; // 250 cm
00248 else if (spilltime <= 1149202720) location = 3935; // 10 cm
00249 else if (spilltime <= 1150047812) location = 57313; // 150 cm
00250 else if (spilltime <= 1155564632) location = 96227; // 250 cm
00251 else location = 3937; // 10 cm
00252 }
00253
00254 location *= Munits::mil;
00255 BeamType bt = kUnknown;
00256 const float dist_cut = 0.35*Munits::meter;
00257 const float le_pos = 0.0*Munits::meter;
00258 const float pme_pos = 1.25*Munits::meter;
00259 const float phe_pos = 2.5*Munits::meter;
00260 if (fabs(location-le_pos) < dist_cut) bt = kLE;
00261 else if (fabs(location-pme_pos) < dist_cut) bt = kPsME;
00262 else if (fabs(location-phe_pos) < dist_cut) bt = kPsHE;
00263 else bt = kUnknown;
00264
00265 return bt;
00266 }
|
|
|
Definition at line 100 of file BDTarget.h. Referenced by BDTarget(), BpmProjection(), GetNbatches(), and SetSpill(). |
|
|
Definition at line 101 of file BDTarget.h. Referenced by ProfileProjection(), and SetSpill(). |
|
|
Definition at line 100 of file BDTarget.h. Referenced by BDTarget(), ProfileProjection(), and SetSpill(). |
|
|
Definition at line 101 of file BDTarget.h. Referenced by ProfileProjection(), and SetSpill(). |
|
|
Definition at line 100 of file BDTarget.h. Referenced by BDTarget(), SetSpill(), and TargetIn(). |
1.3.9.1