DataQualityInterface Class Reference

#include <DataQualityInterface.h>

List of all members.

Public Member Functions

 DataQualityInterface ()
 DataQualityInterface (const DataQualityInterface &rhs)
 ~DataQualityInterface ()
Int_t GetSpillStatus (VldContext vldc)
Int_t GetBeamStatus (VldContext vldc)
Int_t GetBeamType (VldContext vldc)
Double_t GetProtonsOnTarget (VldContext vldc)
Int_t GetDetectorStatus (VldContext vldc)
Int_t GetRunStatus (VldContext vldc)
Int_t GetHvStatus (VldContext vldc)
Int_t GetCoilStatus (VldContext vldc)
Int_t GetGpsStatus (VldContext vldc)
Int_t LookupDetectorStatus (VldContext vldc)
Int_t LookupRunStatus (VldContext vldc)
Int_t LookupHvStatus (VldContext vldc)
Int_t LookupCoilStatus (VldContext vldc)
Int_t LookupGpsStatus (VldContext vldc)

Private Member Functions

void ProcessBeamStatus (VldContext vldc, Bool_t useDB=0)
void ProcessDetectorStatus (VldContext vldc, Bool_t useDB=0)
 ClassDef (DataQualityInterface, 1)

Private Attributes

Int_t fBeamTime
Int_t fBeamStatus
Int_t fNearDetStatus
Int_t fBeamMonStatus
Int_t fNearDetSpill
Int_t fBeamMonSpill
Int_t fBeamType
Double_t fProtonsOnTarget
Int_t fDetectorTime
Int_t fDetectorStatus
Int_t fRunStatus
Int_t fCoilStatus
Int_t fHvStatus
Int_t fGpsStatus
Int_t fGpsError
DataQualityLookupfDataQualityLookup

Detailed Description

Definition at line 10 of file DataQualityInterface.h.


Constructor & Destructor Documentation

DataQualityInterface::DataQualityInterface (  ) 

Definition at line 26 of file DataQualityInterface.cxx.

00026                                            :
00027   fBeamTime(-1),
00028   fBeamStatus(-1),
00029   fNearDetStatus(-1),
00030   fBeamType(-1),
00031   fProtonsOnTarget(0.0),
00032   fDetectorTime(-1),
00033   fDetectorStatus(-1),
00034   fRunStatus(-1),
00035   fCoilStatus(-1),
00036   fHvStatus(-1),
00037   fGpsStatus(-1),
00038   fGpsError(-999),
00039   fDataQualityLookup(0)
00040 {
00041 
00042 }
  

DataQualityInterface::DataQualityInterface ( const DataQualityInterface rhs  ) 

Definition at line 44 of file DataQualityInterface.cxx.

00044                                                                           :
00045   TObject(rhs)
00046 {
00047 
00048 }
  

DataQualityInterface::~DataQualityInterface (  ) 

Definition at line 50 of file DataQualityInterface.cxx.

References fDataQualityLookup.

00051 {
00052   if(fDataQualityLookup) delete fDataQualityLookup;
00053 }


Member Function Documentation

DataQualityInterface::ClassDef ( DataQualityInterface  ,
 
) [private]
Int_t DataQualityInterface::GetBeamStatus ( VldContext  vldc  ) 

Definition at line 61 of file DataQualityInterface.cxx.

References fBeamStatus, and ProcessBeamStatus().

Referenced by DataQualityFilter::Ana().

00062 {
00063   this->ProcessBeamStatus(vldc,1);
00064   return fBeamStatus;
00065 }

Int_t DataQualityInterface::GetBeamType ( VldContext  vldc  ) 

Definition at line 67 of file DataQualityInterface.cxx.

References fBeamType, and ProcessBeamStatus().

Referenced by DataQualityFilter::Ana().

00068 {
00069   this->ProcessBeamStatus(vldc,1);
00070   return fBeamType;
00071 }

Int_t DataQualityInterface::GetCoilStatus ( VldContext  vldc  ) 

Definition at line 97 of file DataQualityInterface.cxx.

References fCoilStatus, and ProcessDetectorStatus().

Referenced by DataQualityFilter::Ana().

00098 {
00099   this->ProcessDetectorStatus(vldc,1);
00100   return fCoilStatus;
00101 }

Int_t DataQualityInterface::GetDetectorStatus ( VldContext  vldc  ) 

Definition at line 79 of file DataQualityInterface.cxx.

References fDetectorStatus, and ProcessDetectorStatus().

Referenced by DataQualityFilter::Ana().

00080 {
00081   this->ProcessDetectorStatus(vldc,1);
00082   return fDetectorStatus;
00083 }

Int_t DataQualityInterface::GetGpsStatus ( VldContext  vldc  ) 

Definition at line 103 of file DataQualityInterface.cxx.

References fGpsStatus, and ProcessDetectorStatus().

Referenced by DataQualityFilter::Ana().

00104 {
00105   this->ProcessDetectorStatus(vldc,1);
00106   return fGpsStatus;
00107 }

Int_t DataQualityInterface::GetHvStatus ( VldContext  vldc  ) 

Definition at line 91 of file DataQualityInterface.cxx.

References fHvStatus, and ProcessDetectorStatus().

Referenced by DataQualityFilter::Ana().

00092 {
00093   this->ProcessDetectorStatus(vldc,1);
00094   return fHvStatus;
00095 }

Double_t DataQualityInterface::GetProtonsOnTarget ( VldContext  vldc  ) 

Definition at line 73 of file DataQualityInterface.cxx.

References fProtonsOnTarget, and ProcessBeamStatus().

Referenced by DataQualityFilter::Ana().

00074 {
00075   this->ProcessBeamStatus(vldc,1);
00076   return fProtonsOnTarget;
00077 }

Int_t DataQualityInterface::GetRunStatus ( VldContext  vldc  ) 

Definition at line 85 of file DataQualityInterface.cxx.

References fRunStatus, and ProcessDetectorStatus().

00086 {
00087   this->ProcessDetectorStatus(vldc,1);
00088   return fRunStatus;
00089 }

Int_t DataQualityInterface::GetSpillStatus ( VldContext  vldc  ) 

Definition at line 55 of file DataQualityInterface.cxx.

References fNearDetStatus, and ProcessBeamStatus().

Referenced by DataQualityFilter::Ana().

00056 {
00057   this->ProcessBeamStatus(vldc,1);
00058   return fNearDetStatus;
00059 }

Int_t DataQualityInterface::LookupCoilStatus ( VldContext  vldc  ) 

Definition at line 127 of file DataQualityInterface.cxx.

References fCoilStatus, and ProcessDetectorStatus().

Referenced by DataQualityFilter::Ana().

00128 {
00129   this->ProcessDetectorStatus(vldc,0);
00130   return fCoilStatus;
00131 }

Int_t DataQualityInterface::LookupDetectorStatus ( VldContext  vldc  ) 

Definition at line 109 of file DataQualityInterface.cxx.

References fDetectorStatus, and ProcessDetectorStatus().

Referenced by DataQualityFilter::Ana().

00110 {
00111   this->ProcessDetectorStatus(vldc,0);
00112   return fDetectorStatus;
00113 }

Int_t DataQualityInterface::LookupGpsStatus ( VldContext  vldc  ) 

Definition at line 133 of file DataQualityInterface.cxx.

References fGpsStatus, and ProcessDetectorStatus().

00134 {
00135   this->ProcessDetectorStatus(vldc,0);
00136   return fGpsStatus;
00137 }

Int_t DataQualityInterface::LookupHvStatus ( VldContext  vldc  ) 

Definition at line 121 of file DataQualityInterface.cxx.

References fHvStatus, and ProcessDetectorStatus().

Referenced by DataQualityFilter::Ana().

00122 {
00123   this->ProcessDetectorStatus(vldc,0);
00124   return fHvStatus;
00125 }

Int_t DataQualityInterface::LookupRunStatus ( VldContext  vldc  ) 

Definition at line 115 of file DataQualityInterface.cxx.

References fRunStatus, and ProcessDetectorStatus().

00116 {
00117   this->ProcessDetectorStatus(vldc,0);
00118   return fRunStatus;
00119 }

void DataQualityInterface::ProcessBeamStatus ( VldContext  vldc,
Bool_t  useDB = 0 
) [private]

Definition at line 139 of file DataQualityInterface.cxx.

References BeamMonSpill::BeamType(), SpillTimeFinder::DataIsAvailable(), MuELoss::e, fBeamMonSpill, fBeamMonStatus, fBeamStatus, fBeamTime, fBeamType, fNearDetSpill, fNearDetStatus, fProtonsOnTarget, BeamMonSpill::fTor101, BeamMonSpill::fTortgt, BeamMonSpill::fTrtgtd, BDSpillAccessor::Get(), VldTimeStamp::GetNanoSec(), SpillTimeFinder::GetNearestSpill(), VldTimeStamp::GetSec(), SpillTimeND::GetTimeStamp(), VldContext::GetTimeStamp(), SpillTimeFinder::GetTimeToNearestSpill(), SpillTimeFinder::Instance(), Msg::kVerbose, BDSpillAccessor::LoadSpill(), MSG, BMSpillAna::SelectSpill(), BMSpillAna::SetSpill(), BMSpillAna::SetTimeDiff(), BeamMonSpill::SpillTime(), and BMSpillAna::UseDatabaseCuts().

Referenced by GetBeamStatus(), GetBeamType(), GetProtonsOnTarget(), and GetSpillStatus().

00140 {
00141   if( vldc.GetTimeStamp().GetSec()!=fBeamTime ){
00142     MSG("DataQualityFilter",Msg::kVerbose) << " DataQualityInterface::ProcessBeamStatus(VldContext) " << endl;
00143 
00144     fBeamTime=vldc.GetTimeStamp().GetSec();
00145     fBeamStatus=-1;
00146     fNearDetStatus=-1;
00147     fBeamMonStatus=-1;
00148     fNearDetSpill=0;
00149     fBeamMonSpill=0;
00150     fBeamType=-1;
00151     fProtonsOnTarget=0.0;
00152 
00153     // USE BEAM DATABASE TABLES
00154     // ========================
00155     if( useDB ){
00156 
00157       // Check NearDet Spill Times
00158       SpillTimeFinder& NDaccess = SpillTimeFinder::Instance();
00159       fNearDetStatus = NDaccess.DataIsAvailable(vldc);
00160       const SpillTimeND& ndspill = NDaccess.GetNearestSpill(vldc);
00161       VldTimeStamp NDtime = ndspill.GetTimeStamp();
00162 
00163       Double_t nd_subtime = NDaccess.GetTimeToNearestSpill(vldc);
00164 
00165       if( nd_subtime>=0.0 && nd_subtime<1.0 ){
00166         fNearDetSpill = 1;
00167       }
00168 
00169       MSG("DataQualityFilter",Msg::kVerbose) << " NearDet [status=" << fNearDetStatus << ", spill=" << fNearDetSpill << ", time=" << nd_subtime << "]" << endl;
00170       
00171       // Check Beam Monitoring
00172       BDSpillAccessor& BMaccess = BDSpillAccessor::Get();
00173       const BeamMonSpill& BMspill = *(BMaccess.LoadSpill(NDtime));
00174       VldTimeStamp BMtime = BMspill.SpillTime();
00175 
00176       Double_t bm_subtime = ( BMtime.GetSec()-NDtime.GetSec() )
00177                    + 1.0e-9*( BMtime.GetNanoSec()-NDtime.GetNanoSec() );
00178 
00179       BMSpillAna BMana;
00180       BMana.UseDatabaseCuts();
00181       BMana.SetSpill(BMspill); 
00182       BMana.SetTimeDiff(bm_subtime);
00183 
00184       Double_t pots = 0.0;
00185       if(BMspill.fTrtgtd !=0.)      pots = BMspill.fTrtgtd;
00186       else if(BMspill.fTortgt !=0.) pots = BMspill.fTortgt;
00187       else if(BMspill.fTor101 !=0.) pots = BMspill.fTor101;
00188 
00189       if( fNearDetSpill
00190        && abs(bm_subtime)<1.0 ){
00191         fBeamMonSpill = 1;
00192         fProtonsOnTarget = pots;
00193         fBeamType = BMspill.BeamType();
00194         fBeamMonStatus = BMana.SelectSpill();
00195       }
00196 
00197       MSG("DataQualityFilter",Msg::kVerbose) << " BeamMon [spill=" << fBeamMonSpill << ", isgood=" << fBeamMonStatus << ", time=" << nd_subtime+bm_subtime << ", type=" << fBeamType << ", PoTs=" << fProtonsOnTarget << "]" << endl;
00198 
00199     }
00200 
00201     // USE BEAM LOOKUP TABLES
00202     // ======================
00203     else{
00204 
00205     }
00206 
00207     // APPLY BEAM QUALITY CUTS
00208     // =======================
00209     // check the beam monitoring
00210     //    1 = beam monitoring is good
00211     //    0 = beam monitoring is bad
00212     //   -1 = no beam monitoring information 
00213 
00214     if( fBeamMonStatus==1 && fNearDetStatus==1 ){
00215       fBeamStatus=1;
00216     }
00217     if( fBeamMonStatus==0 || fNearDetStatus==0 ){
00218       fBeamStatus=0;
00219     }
00220 
00221   }
00222 
00223   return;
00224 }

void DataQualityInterface::ProcessDetectorStatus ( VldContext  vldc,
Bool_t  useDB = 0 
) [private]

Definition at line 226 of file DataQualityInterface.cxx.

References SpillServerMonFinder::DataIsAvailable(), MuELoss::e, fCoilStatus, fDataQualityLookup, fDetectorStatus, fDetectorTime, fGpsError, fGpsStatus, fHvStatus, fRunStatus, DataQualityLookup::GetCoilStatus(), HvStatusFinder::GetHvStatus(), DataQualityLookup::GetHvStatus(), VldTimeStamp::GetNanoSec(), SpillServerMonFinder::GetNearestSpill(), VldTimeStamp::GetSec(), SpillServerMon::GetSpillTimeError(), SpillServerMon::GetSpillType(), SpillServerMon::GetTimeStamp(), VldContext::GetTimeStamp(), HvStatus::Good(), RunQualityFinder::Instance(), SpillServerMonFinder::Instance(), HvStatusFinder::Instance(), CoilTools::IsOK(), RunStatus::IsOK(), Msg::kVerbose, and MSG.

Referenced by GetCoilStatus(), GetDetectorStatus(), GetGpsStatus(), GetHvStatus(), GetRunStatus(), LookupCoilStatus(), LookupDetectorStatus(), LookupGpsStatus(), LookupHvStatus(), and LookupRunStatus().

00227 {
00228   if( vldc.GetTimeStamp().GetSec()!=fDetectorTime ){
00229     MSG("DataQualityFilter",Msg::kVerbose) << " DataQualityInterface::ProcessDetectorStatus(VldContext) " << endl;
00230 
00231     fDetectorTime=vldc.GetTimeStamp().GetSec();
00232     fDetectorStatus = -1; 
00233     fRunStatus      = -1;   
00234     fCoilStatus     = -1;
00235     fHvStatus       = -1;
00236     fGpsStatus      = -1;
00237     fGpsError       = -999;
00238 
00239     // USE DETECTOR DATABASE TABLES
00240     // ============================
00241     if( useDB ){
00242 
00243       // Check Run Quality
00244       if( RunQualityFinder::Instance().IsOK(vldc) ) fRunStatus=1; else fRunStatus=0;
00245       MSG("DataQualityFilter",Msg::kVerbose) << " RunStatus [status=" << fRunStatus << "]" << endl;
00246       MSG("DataQualityFilter",Msg::kVerbose) << " Run [lookup=0, status=" << fRunStatus << "]" << endl;
00247 
00248       // Check Coil Current
00249       if( CoilTools::IsOK(vldc) ) fCoilStatus=1; else fCoilStatus=0; 
00250       MSG("DataQualityFilter",Msg::kVerbose) << " CoilCurrentStatus [status=" << fCoilStatus << "]" << endl;
00251       MSG("DataQualityFilter",Msg::kVerbose) << " CoilCurrent [lookup=0, status=" << fCoilStatus << "]" << endl;
00252 
00253       // Check High Voltage
00254       HvStatus::HvStatus_t status = HvStatusFinder::Instance().GetHvStatus(vldc,60,1);
00255       if( HvStatus::Good(status) ) fHvStatus=1; else fHvStatus=0;
00256       MSG("DataQualityFilter",Msg::kVerbose) << " HighVoltageStatus [statusword=" << status << ", status=" << fHvStatus << "]" << endl;
00257       MSG("DataQualityFilter",Msg::kVerbose) << " HighVoltage [lookup=0, status=" << fHvStatus << "]" << endl;      
00258 
00259       // Check GPS Error
00260       fGpsStatus = 1; // default status
00261       
00262       SpillServerMonFinder& GPSaccess = SpillServerMonFinder::Instance();
00263       if( GPSaccess.DataIsAvailable(vldc) ){
00264         const SpillServerMon& spill_nearest = GPSaccess.GetNearestSpill(vldc);
00265 
00266         Double_t gps_subtime = ( spill_nearest.GetTimeStamp().GetSec()-vldc.GetTimeStamp().GetSec() )
00267                       + 1.0e-9*( spill_nearest.GetTimeStamp().GetNanoSec()-vldc.GetTimeStamp().GetNanoSec() );
00268 
00269         if( fabs(gps_subtime)<360.0 ){
00270           fGpsError = 0;
00271           if( spill_nearest.GetSpillType()==1 ){
00272             fGpsError = spill_nearest.GetSpillTimeError();
00273           }
00274         }
00275             
00276         if( fGpsError>=1000 ) fGpsStatus = 0;
00277       }
00278       MSG("DataQualityFilter",Msg::kVerbose) << " GpsErrorStatus [error=" << fGpsError << ", status=" << fGpsStatus << "]" << endl;
00279       MSG("DataQualityFilter",Msg::kVerbose) << " GpsError [lookup=0, status=" << fGpsStatus << "]" << endl;
00280 
00281     }
00282 
00283     // USE DETECTOR LOOKUP TABLES
00284     // ==========================
00285     else{
00286       if(!fDataQualityLookup) fDataQualityLookup = new DataQualityLookup();
00287   
00288       // Check Run Status
00289       fRunStatus=1;
00290       MSG("DataQualityFilter",Msg::kVerbose) << " Run [lookup=1, status=" << fRunStatus << "]" << endl;
00291 
00292       // Check Coil Current
00293       fCoilStatus=fDataQualityLookup->GetCoilStatus(vldc);
00294       MSG("DataQualityFilter",Msg::kVerbose) << " CoilCurrent [lookup=1, status=" << fCoilStatus << "]" << endl;
00295 
00296       // Check High Voltage
00297       fHvStatus=fDataQualityLookup->GetHvStatus(vldc);
00298       MSG("DataQualityFilter",Msg::kVerbose) << " HighVoltage [lookup=1, status=" << fHvStatus << "]" << endl;
00299 
00300       // Check GPS Error;
00301       fGpsStatus=1;
00302       MSG("DataQualityFilter",Msg::kVerbose) << " GpsError [lookup=1, status=" << fGpsStatus << "]" << endl;
00303 
00304     }
00305 
00306     // APPLY DETECTOR QUALITY CUTS
00307     // ===========================
00308     //  1 = coil and HV are good
00309     //  0 = coil or HV are bad or unknown
00310     // -1 = no detector information
00311 
00312     if( fRunStatus==1 && fCoilStatus==1 && fHvStatus==1 && fGpsStatus==1 ){
00313       fDetectorStatus=1;
00314     }
00315     if( fRunStatus==0 || fCoilStatus==0 || fHvStatus==0 || fGpsStatus==0 ){
00316       fDetectorStatus=0;
00317     }
00318 
00319   }
00320 
00321   return;
00322 }


Member Data Documentation

Definition at line 42 of file DataQualityInterface.h.

Referenced by ProcessBeamStatus().

Definition at line 40 of file DataQualityInterface.h.

Referenced by ProcessBeamStatus().

Definition at line 38 of file DataQualityInterface.h.

Referenced by GetBeamStatus(), and ProcessBeamStatus().

Definition at line 37 of file DataQualityInterface.h.

Referenced by ProcessBeamStatus().

Definition at line 43 of file DataQualityInterface.h.

Referenced by GetBeamType(), and ProcessBeamStatus().

Definition at line 49 of file DataQualityInterface.h.

Referenced by GetCoilStatus(), LookupCoilStatus(), and ProcessDetectorStatus().

Definition at line 54 of file DataQualityInterface.h.

Referenced by ProcessDetectorStatus(), and ~DataQualityInterface().

Definition at line 46 of file DataQualityInterface.h.

Referenced by ProcessDetectorStatus().

Definition at line 52 of file DataQualityInterface.h.

Referenced by ProcessDetectorStatus().

Definition at line 51 of file DataQualityInterface.h.

Referenced by GetGpsStatus(), LookupGpsStatus(), and ProcessDetectorStatus().

Definition at line 50 of file DataQualityInterface.h.

Referenced by GetHvStatus(), LookupHvStatus(), and ProcessDetectorStatus().

Definition at line 41 of file DataQualityInterface.h.

Referenced by ProcessBeamStatus().

Definition at line 39 of file DataQualityInterface.h.

Referenced by GetSpillStatus(), and ProcessBeamStatus().

Definition at line 44 of file DataQualityInterface.h.

Referenced by GetProtonsOnTarget(), and ProcessBeamStatus().

Definition at line 48 of file DataQualityInterface.h.

Referenced by GetRunStatus(), LookupRunStatus(), and ProcessDetectorStatus().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1