BeamMonSpill Class Reference
[BeamDataUtil]

A DbiTableRow for accessing the BEAMMONSPILL table. More...

#include <BeamMonSpill.h>

Inheritance diagram for BeamMonSpill:
DbiTableRow

List of all members.

Classes

struct  StatusBits
 A bit field for status bits. More...

Public Member Functions

 BeamMonSpill ()
 ~BeamMonSpill ()
virtual DbiTableRowCreateTableRow () const
 DbiTableRow API.
void Fill (DbiResultSet &rs, const DbiValidityRec *vrec)
 DbiTableRow API.
virtual void Store (DbiOutRowStream &ors, const DbiValidityRec *vrec) const
 DbiTableRow API.
VldTimeStamp SpillTime () const
double BpmAtTarget (double &xmean, double &ymean, double &xrms, double &yrms) const
BeamType::BeamType_t BeamType () const
void SetTimestamps (const VldTimeStamp &dae, const VldTimeStamp &vme)
 Set the DAE and VME time stamps.
void SetToroids (double tor101, double tr101d, double tortgt, double trtgtd)
 Set the important toroids.
void SetHornCurrent (double cur)
 Set the horn current.
void SetBPM (const std::vector< double > &xpos, const std::vector< double > &ypos, const std::vector< double > &intensities)
 Set BPM derived info.
void SetProfile (double x, double y, double w, double h)
 Set Profile monitor derived info.
void SetHadMuInt (double had, double mu1, double mu2, double mu3)
 Set the total corrected charge in the hadron monitor.
StatusBits GetStatusBits () const
 Get the status bit field.
int GetStatusInt () const
 Get the status bit field as integer.
void SetStatusBits (StatusBits status)
 Set the status bit field.
StatusBitsStatus ()
 Access the status bit field read/write.
void Print (Option_t *option="") const
 override ROOT Print

Static Public Member Functions

static Bool_t IsRHCRunning (const VldTimeStamp &vts)

Public Attributes

VldTimeStamp fDaeTime
 Timestamps.
VldTimeStamp fVmeTime
float fTor101
 Toroids (1e12 ppp).
float fTr101d
float fTortgt
float fTrtgtd
float fHornCur
 Horn current.
float fTargBpmX [6]
 Per batch X,Y positions projected to the target via BPMs 121 and TGT.
float fTargBpmY [6]
float fBpmInt [6]
float fTargProfX
float fTargProfY
float fProfWidX
 Widths via profile monitors at TGT. No projection.
float fProfWidY
float fHadInt
 hadron/muon mon. intensities
float fMuInt1
float fMuInt2
float fMuInt3
union {
   int   integer
   StatusBits   bits
fStatus
 Status bits.

Detailed Description

A DbiTableRow for accessing the BEAMMONSPILL table.

Author:
(last to touch it)
Author
rhatcher
Version:
Revision
1.18
Date:
Date
2015/06/11 21:48:07

Contact: bv@bnl.gov

Created on: Wed Apr 13 18:18:05 2005

Id
BeamMonSpill.h,v 1.18 2015/06/11 21:48:07 rhatcher Exp

Definition at line 34 of file BeamMonSpill.h.


Constructor & Destructor Documentation

BeamMonSpill::BeamMonSpill (  ) 

Definition at line 15 of file BeamMonSpill.cxx.

References fBpmInt, fStatus, fTargBpmX, and fTargBpmY.

00016     : fDaeTime(VldTimeStamp(2038,1,1,0,0,0)) // end of time
00017     , fVmeTime(VldTimeStamp(2038,1,1,0,0,0)) // end of time
00018     , fTor101(0.0), fTr101d(0.0), fTortgt(0.0), fTrtgtd(0.0)
00019     , fHornCur(0.0)
00020     , fTargProfX(0.0), fTargProfY(0.0)
00021     , fProfWidX(0.0), fProfWidY(0.0)
00022     , fHadInt(0.0), fMuInt1(0.0), fMuInt2(0.0), fMuInt3(0.0)
00023 {
00024     fStatus.integer = 0;
00025     for (int ind=0; ind<6; ++ind) 
00026     fTargBpmX[ind] = fTargBpmY[ind] = fBpmInt[ind] = 0.0;
00027 }

BeamMonSpill::~BeamMonSpill (  ) 

Destroy this object. MUST be called when (ie, explicitly destroy object, don't just abort job) in order to write any as yet unflushed rows.

Definition at line 29 of file BeamMonSpill.cxx.

00030 {
00031 }


Member Function Documentation

BeamType::BeamType_t BeamMonSpill::BeamType (  )  const

Return the beam type determined from the target position, the horn current and intensity

Definition at line 109 of file BeamMonSpill.cxx.

References BeamMonSpill::StatusBits::beam_type, fHornCur, VldTimeStamp::GetSec(), GetStatusBits(), IsRHCRunning(), BeamType::kL000z200i, BeamType::kL010z000i, BeamType::kL010z170i, BeamType::kL010z185i, BeamType::kL010z185i_rev, BeamType::kL010z200i, BeamType::kL100z200i, BeamType::kL150z200i, BeamType::kL250z200i, BeamType::kM000z000i_nova, BeamType::kM000z200i_nova, BeamType::kUnknown, and SpillTime().

Referenced by MadTVAnalysis::CreatePAN(), NuExtraction::ExtractBeamInfoDB(), NuAnalysis::ExtractConfig(), ANtpInfoObjectFillerBeam::FillBeamInformation(), NtpMaker::FillSpillInfo(), NuBeam::IsGoodSpillAndFillPot(), Print(), DataQualityInterface::ProcessBeamStatus(), DataUtil::QueryBeamDB(), StndBmsSpin::Scan(), and BMSpillAna::SelectSpill().

00110 {
00111     BeamType::BeamType_t btype = BeamType::kUnknown;
00112     //
00113     Int_t db_btyp = this->GetStatusBits().beam_type;    
00114 
00115     // Overwrite the beamtype that is in the database for spills
00116     // after May 2006
00117     // Change triggered by problems observed for Summer 2006 spills
00118     // Some spills during pME & pHE running had a beamtype in the
00119     // database of 1, which means le running. And a large fraction of
00120     // spills in September had a beamtype of 4, i.e. pME.
00121     // The most likely casue for this is that the timing used to
00122     // determine the target position when filling the database was screwed up. 
00123 
00124 
00125     const VldTimeStamp startNOvA(2013,6,1,0/*hr*/,0/*min*/,0/*sec*/,0/*ns*/);
00126   
00127     double spilltime = this->SpillTime().GetSec();
00128     if (spilltime > 1149202720 && spilltime <= 1150047812) db_btyp=4;  // pME
00129     else if (spilltime > 1150047812 && spilltime <= 1155664632 ) db_btyp=5;  // pHE
00130     else if (spilltime > 1155664632 && spilltime < (double)startNOvA ) db_btyp=1;  // LE
00131     else if (spilltime >= (double)startNOvA ) db_btyp=6; //NOVA ME
00132     
00133     if (db_btyp==1){
00134       if (this->SpillTime().GetSec() <= 1112010000){ // early real LE data
00135     if (fHornCur < -190)                     // nominal at -200kA
00136       btype = BeamType::kL000z200i;        // 
00137       }
00138       else if (this->IsRHCRunning(this->SpillTime())){
00139     if (fHornCur < -185){
00140       btype = BeamType::kUnknown;
00141     }
00142     else if (fHornCur < -178){
00143       btype = BeamType::kL010z185i_rev;
00144     }
00145     else{
00146       btype = BeamType::kUnknown;
00147     }
00148       }
00149       else {                                       // later on LE-10 data
00150     if (fHornCur < -190)                     //  -200 kA
00151       btype = BeamType::kL010z200i;
00152     else if (fHornCur < -175){               //  -185kA 
00153       btype = BeamType::kL010z185i;        //  nominal
00154     }
00155     else if (fHornCur < -160)
00156       btype = BeamType::kL010z170i;
00157     else if (fHornCur > -5)
00158       btype = BeamType::kL010z000i;
00159       }        
00160     }
00161     else if (db_btyp==2 || db_btyp==4){                 // (p)ME
00162       if (this->SpillTime().GetSec() > 1149202720 &&
00163       this->SpillTime().GetSec() <= 1150047812){  // pME-150
00164     if (fHornCur < -190)                        // 
00165       btype = BeamType::kL150z200i;           //  -200 kA
00166       }
00167       else {
00168     if (fHornCur < -190)                        // pME-100 
00169       btype = BeamType::kL100z200i;           //  -200 kA
00170       }
00171     }
00172     else if (db_btyp==3 || db_btyp==5){             // (p)HE
00173       if (fHornCur < -190)                        // pHE-250 
00174     btype = BeamType::kL250z200i;           //  -200 kA
00175     }
00176     else if (db_btyp==6){
00177       if (fHornCur < -190)
00178         btype = BeamType::kM000z200i_nova;
00179       else if (fHornCur > -5)
00180         btype = BeamType::kM000z000i_nova;    //Horn Off Nova era;
00181     }
00182 
00183     return btype;
00184 }

double BeamMonSpill::BpmAtTarget ( double &  xmean,
double &  ymean,
double &  xrms,
double &  yrms 
) const

Fill the relative intensity averaged positions and spreads at the target as determined by the BPMs. Return total relative BPM intensity.

Definition at line 74 of file BeamMonSpill.cxx.

References fBpmInt, fTargBpmX, and fTargBpmY.

Referenced by ParticleBeamMonAna::ana(), BeamMonAna::Analyze(), NuAnalysis::ExtractConfig(), ANtpInfoObjectFillerBeam::FillBeamInformation(), BMSpillAna::FractionOnTarget(), NuBeam::IsGoodSpillAndFillPot(), Print(), NueBeamMonModule::Reco(), StndBmsSpin::Scan(), and BMSpillAna::SelectSpill().

00075 {
00076     xmean=ymean=xrms=yrms=0.0;
00077 
00078     double Itot = 0, ix=0,iy=0,ix2=0,iy2=0;
00079     for (int ind=0; ind<6; ++ind) {
00080     if (fBpmInt[ind] == 0.0) continue;
00081     
00082     double X = fTargBpmX[ind];
00083     double Y = fTargBpmY[ind];
00084     double I = fBpmInt[ind];
00085     I = I > 0 ? I : 0;
00086     Itot += I;
00087 
00088     ix += I*X;
00089     iy += I*Y;
00090 
00091     ix2 += I*X*X;
00092     iy2 += I*Y*Y;
00093     }
00094 
00095     if (Itot <= 0.0) return 0.0;
00096 
00097     xmean = ix/Itot;
00098     double xtmp = ix2/Itot-xmean*xmean;
00099     if (xtmp > 0.0) xrms = sqrt(xtmp);
00100 
00101     ymean = iy/Itot;
00102     double ytmp = iy2/Itot-ymean*ymean;
00103     if (ytmp > 0.0) yrms = sqrt(ytmp);
00104 
00105     return Itot;
00106 }

DbiTableRow * BeamMonSpill::CreateTableRow (  )  const [virtual]

DbiTableRow API.

Implements DbiTableRow.

Definition at line 33 of file BeamMonSpill.cxx.

00034 {
00035     return new BeamMonSpill;
00036 }

void BeamMonSpill::Fill ( DbiResultSet rs,
const DbiValidityRec vrec 
) [virtual]

DbiTableRow API.

Implements DbiTableRow.

Definition at line 38 of file BeamMonSpill.cxx.

References fBpmInt, fDaeTime, fHadInt, fHornCur, fMuInt1, fMuInt2, fMuInt3, fProfWidX, fProfWidY, fStatus, fTargBpmX, fTargBpmY, fTargProfX, fTargProfY, fTor101, fTortgt, fTr101d, fTrtgtd, fVmeTime, and Munits::ns.

00039 {
00040     int ns=0;
00041 
00042     rs >> fDaeTime;
00043     rs >> ns;
00044     fDaeTime.Add(VldTimeStamp(0,ns));
00045 
00046     rs >> fVmeTime;
00047     rs >> ns;
00048     fVmeTime.Add(VldTimeStamp(0,ns));
00049 
00050     rs >> fTor101 >> fTr101d >> fTortgt >> fTrtgtd;
00051     rs >> fHornCur;
00052 
00053     for (int ind=0; ind<6; ++ind) 
00054     rs >> fTargBpmX[ind] >> fTargBpmY[ind] >> fBpmInt[ind];
00055 
00056     rs >> fTargProfX >> fTargProfY >> fProfWidX >> fProfWidY;
00057     rs >> fHadInt >> fMuInt1 >> fMuInt2 >> fMuInt3;    
00058     rs >> fStatus.integer;
00059 }

BeamMonSpill::StatusBits BeamMonSpill::GetStatusBits (  )  const [inline]
int BeamMonSpill::GetStatusInt (  )  const [inline]

Get the status bit field as integer.

Definition at line 184 of file BeamMonSpill.h.

References fStatus.

Referenced by NtpBDLiteModule::FillNtpBDLite(), NtpMaker::FillSpillInfo(), and Print().

00185 { return fStatus.integer; }

Bool_t BeamMonSpill::IsRHCRunning ( const VldTimeStamp vts  )  [static]

Definition at line 206 of file BeamMonSpill.cxx.

Referenced by BeamType(), NuExtraction::ExtractBeamInfoDB(), and NuAnalysis::ExtractConfig().

00207 {
00208   //Run 4
00209   const VldTimeStamp beginRHC4(2009,9,29,17,0,0); //44820 started ~noon CDT, which is 17:00 UTC
00210   const VldTimeStamp endRHC4(2010,3,22,17,0,0); //45480 beam off 06:13 CDT, back on in FHC at 18:51 CDT
00211   //Run 7
00212   const VldTimeStamp beginRHC7(2010,11,1,1,0,0); //Beam actually strated around 11 am CDT
00213   const VldTimeStamp endRHC7(2011,3,18,22,3,10);
00214   //Run 9
00215   const VldTimeStamp beginRHC9(2011,7,11,23,0,0);
00216   const VldTimeStamp endRHC9(2011,9,15,15,50,0);
00217 
00218   if (vts >= beginRHC4 && vts <= endRHC4){return true;}
00219   if (vts >= beginRHC7 && vts <= endRHC7){return true;}
00220   if (vts >= beginRHC9 && vts <= endRHC9){return true;}
00221   return false;
00222 
00223 }

void BeamMonSpill::Print ( Option_t *  option = ""  )  const

override ROOT Print

Definition at line 226 of file BeamMonSpill.cxx.

References bfld::AsString(), VldTimeStamp::AsString(), BeamMonSpill::StatusBits::beam_type, BeamType(), BpmAtTarget(), BeamMonSpill::StatusBits::calibrated, fBpmInt, fDaeTime, fHadInt, fHornCur, fMuInt1, fMuInt2, fMuInt3, fProfWidX, fProfWidY, fTargBpmX, fTargBpmY, fTargProfX, fTargProfY, fTor101, fTortgt, fTr101d, fTrtgtd, fVmeTime, GetStatusBits(), GetStatusInt(), BeamMonSpill::StatusBits::horn_on, Munits::mm, BeamMonSpill::StatusBits::n_batches, BeamMonSpill::StatusBits::pedestal, BeamMonSpill::StatusBits::pm121_in, BeamMonSpill::StatusBits::pmtgt_in, BeamMonSpill::StatusBits::recovered, SpillTime(), BeamMonSpill::StatusBits::target_in, and BeamMonSpill::StatusBits::time_source.

00227 {
00228   std::cout << "BeamMonSpill: "
00229             << " SpillTime " << SpillTime().AsString("c")
00230             << std::endl
00231             << "  DAE " << fDaeTime.AsString("c")
00232             << " VME " << fVmeTime.AsString("c") 
00233             << std::endl
00234             << "  Toroids: "
00235             << " TOR101 " << fTor101 << " TR101D " << fTr101d
00236             << " TORTGT " << fTortgt << " TRTGTD " << fTrtgtd << std::endl
00237             << "  HornCur " << fHornCur 
00238             << " BeamType " << BeamType::AsString(BeamType())
00239             << std::endl;
00240   std::cout << "  BPM {X,Y,I}: ";
00241   for (int indx=0; indx<6; ++indx) {
00242     if ( indx == 2 || indx == 4 ) std::cout << std::endl << "               ";
00243     std::cout << "{"  << fTargBpmX[indx]/Munits::mm
00244               << ","  << fTargBpmY[indx]/Munits::mm
00245               << ","  << fBpmInt[indx] << "} ";
00246   }
00247   std::cout << " (mm)" << std::endl;
00248 
00249   Double_t xmean=0, ymean=0, xrms=0, yrms=0;
00250   BpmAtTarget(xmean,ymean,xrms,yrms);
00251   std::cout << "  BpmAtTarget {xmean,ymean,xrms,yrms}: " 
00252             << " " << xmean/Munits::mm
00253             << " " << ymean/Munits::mm
00254             << " " << xrms/Munits::mm
00255             << " " << yrms/Munits::mm
00256             << " (mm)"
00257             << std::endl;
00258 
00259   std::cout << "  Profile {X0,Y0,widX,widy}: "  
00260             << fTargProfX/Munits::mm
00261             << " "  << fTargProfY/Munits::mm
00262             << " "  << fProfWidX/Munits::mm
00263             << " "  << fProfWidY/Munits::mm << " (mm)"
00264             << std::endl
00265             << "  HadInt "  << fHadInt
00266             << " MuInt "  << fMuInt1
00267             << ", "  << fMuInt2
00268             << ", "  << fMuInt3 << std::endl;
00269   std::cout << "  Status: "  << GetStatusInt()
00270             << " = 0x" << std::hex << std::setfill('0')
00271             << std::setw(8) << GetStatusInt()
00272             << std::setfill(' ') << std::dec
00273             << std::endl;
00274   BeamMonSpill::StatusBits sb = GetStatusBits();
00275   std::cout  << "    horn_on " << sb.horn_on
00276              << " target_in " << sb.target_in
00277              << " beam_type " << sb.beam_type
00278              << " pedestal " << sb.pedestal
00279              << " pm121_in " << sb.pm121_in
00280              << " pmtgt_in " << sb.pmtgt_in
00281              << std::endl << " "
00282              << "   time_source " << sb.time_source
00283              << " n_batches " << sb.n_batches
00284              << " calibrated " << sb.calibrated
00285              << " recovered " << sb.recovered
00286              << std::endl;  
00287 }

void BeamMonSpill::SetBPM ( const std::vector< double > &  xpos,
const std::vector< double > &  ypos,
const std::vector< double > &  intensities 
)

Set BPM derived info.

Referenced by BMSpillFiller::Spill().

void BeamMonSpill::SetHadMuInt ( double  had,
double  mu1,
double  mu2,
double  mu3 
) [inline]

Set the total corrected charge in the hadron monitor.

Definition at line 205 of file BeamMonSpill.h.

References fHadInt, fMuInt1, fMuInt2, and fMuInt3.

Referenced by BMSpillFiller::Spill().

00206 { fHadInt=had; fMuInt1=mu1; fMuInt2=mu2; fMuInt3=mu3; }

void BeamMonSpill::SetHornCurrent ( double  cur  )  [inline]

Set the horn current.

Definition at line 201 of file BeamMonSpill.h.

References fHornCur.

Referenced by BMSpillFiller::Spill().

00202 { fHornCur = cur; }

void BeamMonSpill::SetProfile ( double  x,
double  y,
double  w,
double  h 
) [inline]

Set Profile monitor derived info.

Definition at line 209 of file BeamMonSpill.h.

References fProfWidX, fProfWidY, fTargProfX, and fTargProfY.

Referenced by BMSpillFiller::Spill().

void BeamMonSpill::SetStatusBits ( BeamMonSpill::StatusBits  status  )  [inline]

Set the status bit field.

Definition at line 188 of file BeamMonSpill.h.

References fStatus.

Referenced by BMSpillAna::SetSpill(), and BMSpillFiller::Spill().

00189 { fStatus.bits = status; }

void BeamMonSpill::SetTimestamps ( const VldTimeStamp dae,
const VldTimeStamp vme 
) [inline]

Set the DAE and VME time stamps.

Definition at line 192 of file BeamMonSpill.h.

References fDaeTime, and fVmeTime.

Referenced by BMSpillFiller::Spill().

00193 { fDaeTime = dae; fVmeTime = vme; }

void BeamMonSpill::SetToroids ( double  tor101,
double  tr101d,
double  tortgt,
double  trtgtd 
) [inline]

Set the important toroids.

Definition at line 196 of file BeamMonSpill.h.

References fTor101, fTortgt, fTr101d, and fTrtgtd.

Referenced by BMSpillFiller::Spill().

00198 { fTor101 = tor101; fTr101d = tr101d; fTortgt = tortgt; fTrtgtd = trtgtd; }

VldTimeStamp BeamMonSpill::SpillTime (  )  const
BeamMonSpill::StatusBits & BeamMonSpill::Status (  )  [inline]

Access the status bit field read/write.

Definition at line 176 of file BeamMonSpill.h.

References fStatus.

00177 { return fStatus.bits; }

void BeamMonSpill::Store ( DbiOutRowStream ors,
const DbiValidityRec vrec 
) const [virtual]

DbiTableRow API.

Reimplemented from DbiTableRow.

Definition at line 61 of file BeamMonSpill.cxx.

References fBpmInt, fDaeTime, fHadInt, fHornCur, fMuInt1, fMuInt2, fMuInt3, fProfWidX, fProfWidY, fStatus, fTargBpmX, fTargBpmY, fTargProfX, fTargProfY, fTor101, fTortgt, fTr101d, fTrtgtd, fVmeTime, and VldTimeStamp::GetNanoSec().

00062 {
00063     ors << fDaeTime << fDaeTime.GetNanoSec()
00064     << fVmeTime << fVmeTime.GetNanoSec();
00065     ors << fTor101 << fTr101d << fTortgt << fTrtgtd;
00066     ors << fHornCur;
00067     for (int ind=0; ind<6; ++ind) 
00068     ors << fTargBpmX[ind] << fTargBpmY[ind] << fBpmInt[ind];
00069     ors << fTargProfX << fTargProfY << fProfWidX << fProfWidY;
00070     ors << fHadInt << fMuInt1 << fMuInt2 << fMuInt3;    
00071     ors << fStatus.integer;
00072 }


Member Data Documentation

Definition at line 156 of file BeamMonSpill.h.

Referenced by BDSpillAccessor::CalibrateSpill().

Average per batch (relative) intensity via H/V BPMs at TGT. A zero intensity batch indicates mixed mode running. Initial data will have last element zero regardless of which batch relative to the spill start is missing. Later running may have a zero batch at a different element which would indicate just which batch was given to pbar production.

Definition at line 147 of file BeamMonSpill.h.

Referenced by ParticleBeamMonAna::ana(), EvtAddRawDigitBlockModule::Ana(), BeamMonSpill(), BpmAtTarget(), MadMKAnalysis::CreatePAN(), MadTVAnalysis::CreatePAN(), MadAnalysis::CreatePAN(), NuExtraction::ExtractBeamInfoDB(), Fill(), NtpBDLiteModule::FillNtpBDLite(), NtpMaker::FillSpillInfo(), DataStabilityAnalysisClass::FillTTree(), Print(), NueBeamMonModule::Reco(), BMSpillAna::SetSpill(), MadQuantities::ShowerValidation(), and Store().

Timestamps.

Definition at line 134 of file BeamMonSpill.h.

Referenced by Fill(), Print(), BMSpillAna::SetSpill(), SetTimestamps(), SpillTime(), and Store().

union { ... } BeamMonSpill::fStatus

Definition at line 134 of file BeamMonSpill.h.

Referenced by Fill(), Print(), BMSpillAna::SetSpill(), SetTimestamps(), SpillTime(), and Store().

Definition at line 156 of file BeamMonSpill.h.


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1