#include <HvStatusFinder.h>
Public Member Functions | |
| virtual | ~HvStatusFinder () |
| HvStatus::HvStatus_t | GetHvStatus (const VldContext &context, Int_t window=60, Int_t task=1) |
Static Public Member Functions | |
| HvStatusFinder & | Instance () |
Private Member Functions | |
| HvStatusFinder () | |
| void | ExtendedQuery (const VldContext &context) |
| void | LocalQuery (const VldContext &context) |
| void | Reset () |
Private Attributes | |
| DbiResultPtr< DbuHvFromSingles > | fHvTable |
| Int_t | fTask |
| Int_t | fWindow |
| Int_t | fMinTime |
| Int_t | fMaxTime |
| Int_t | fMinTimeExt |
| Int_t | fMaxTimeExt |
| HvStatus::HvStatus_t | fStatus |
| HvStatus::HvStatus_t | kStatusNearOK |
| HvStatus::HvStatus_t | kStatusFarOK |
Static Private Attributes | |
| HvStatusFinder * | fMyInstance = 0 |
Friends | |
| struct | Cleaner |
|
|
Definition at line 57 of file HvStatusFinder.cxx. References MSG. 00058 {
00059 MSG("HvStatus", Msg::kVerbose) << " *** HvStatusFinder::~HvStatusFinder() *** " << endl;
00060
00061 }
|
|
|
Definition at line 40 of file HvStatusFinder.cxx. References fTask, fWindow, kStatusFarOK, kStatusNearOK, MSG, and Reset(). 00041 {
00042 MSG("HvStatus", Msg::kVerbose) << " *** HvStatusFinder::HvStatusFinder() *** " << endl;
00043
00044 fWindow = 0;
00045 fTask = 1;
00046
00047 kStatusNearOK = HvStatus::kOK;
00048 kStatusNearOK = (HvStatus::HvStatus_t)(kStatusNearOK|HvStatus::kSM1OK);
00049
00050 kStatusFarOK = HvStatus::kOK;
00051 kStatusFarOK = (HvStatus::HvStatus_t)(kStatusFarOK|HvStatus::kSM1OK);
00052 kStatusFarOK = (HvStatus::HvStatus_t)(kStatusFarOK|HvStatus::kSM2OK);
00053
00054 this->Reset();
00055 }
|
|
|
Definition at line 118 of file HvStatusFinder.cxx. References VldTimeStamp::Add(), fHvTable, fMaxTimeExt, fMinTimeExt, fTask, fWindow, DbuHvFromSingles::GetColdChips(), VldContext::GetDetector(), DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRow(), VldTimeStamp::GetSec(), VldContext::GetSimFlag(), DbuHvFromSingles::GetStatus(), DbuHvFromSingles::GetSupermodule(), VldRange::GetTimeEnd(), VldContext::GetTimeStamp(), VldRange::GetTimeStart(), DbiResultPtr< T >::GetValidityRec(), DbiValidityRec::GetVldRange(), DbiValidityRec::IsGap(), MSG, and DbiResultPtr< T >::NewQuery(). Referenced by GetHvStatus(). 00119 {
00120 MSG("HvStatus", Msg::kVerbose) << " *** HvStatusFinder::ExtendedQuery(...) *** " << endl;
00121
00122 // query the HV database using extended context
00123 VldTimeStamp minTime = context.GetTimeStamp();
00124 VldTimeStamp maxTime = context.GetTimeStamp();
00125 minTime.Add(-fWindow-3600); maxTime.Add(+fWindow+3600);
00126
00127 MSG("HvStatus", Msg::kDebug) << " query: time=" << context.GetTimeStamp().GetSec() << endl;
00128 MSG("HvStatus", Msg::kDebug) << " query: range=" << minTime.GetSec() << "->" << maxTime.GetSec() << " (window=" << fWindow << "+3600" << ")" << endl;
00129
00130 DbiSqlContext econtext(DbiSqlContext::kOverlaps,
00131 minTime,
00132 maxTime,
00133 context.GetDetector(),
00134 context.GetSimFlag() );
00135
00136 fHvTable.NewQuery(econtext,fTask);
00137
00138 const DbiValidityRec* vldRec = fHvTable.GetValidityRec();
00139 const VldRange& vldRange = vldRec->GetVldRange();
00140 VldTimeStamp vldStart = vldRange.GetTimeStart();
00141 VldTimeStamp vldEnd = vldRange.GetTimeEnd();
00142
00143 MSG("HvStatus", Msg::kDebug) << " result: rows=" << fHvTable.GetNumRows() << endl;
00144 MSG("HvStatus", Msg::kDebug) << " result: range=" << vldStart.GetSec() << "->" << vldEnd.GetSec() << endl;
00145
00146 if( vldRec->IsGap() ){
00147 MSG("HvStatus", Msg::kVerbose) << " result: no data is available " << endl;
00148 }
00149
00150 fMinTimeExt = minTime.GetSec();
00151 fMaxTimeExt = maxTime.GetSec();
00152
00153 if( fHvTable.GetNumRows()>0 ){
00154 for( UInt_t irow = 0; irow < fHvTable.GetNumRows(); irow++ ){
00155 const DbuHvFromSingles* hvState = fHvTable.GetRow(irow);
00156 const DbiValidityRec* hvRec = fHvTable.GetValidityRec(hvState);
00157 const VldRange& hvRange = hvRec->GetVldRange();
00158
00159 MSG("HvStatus", Msg::kVerbose) << " row=" << irow << " SM=" << hvState->GetSupermodule() << " status=" << hvState->GetStatus() << ", coldchips=" << hvState->GetColdChips() << " range=" << hvRange.GetTimeStart().GetSec() << "->" << hvRange.GetTimeEnd().GetSec() << endl;
00160
00161 if( hvRange.GetTimeStart().GetSec()<fMinTimeExt ) fMinTimeExt = hvRange.GetTimeStart().GetSec();
00162 if( hvRange.GetTimeEnd().GetSec()>fMaxTimeExt ) fMaxTimeExt = hvRange.GetTimeEnd().GetSec();
00163 }
00164 }
00165
00166 fMinTimeExt += fWindow;
00167 fMaxTimeExt -= fWindow;
00168
00169 MSG("HvStatus", Msg::kDebug) << " validity: " << fMinTimeExt << "->" << fMaxTimeExt << endl;
00170
00171 return;
00172 }
|
|
||||||||||||||||
|
Definition at line 63 of file HvStatusFinder.cxx. References ExtendedQuery(), fMaxTime, fMaxTimeExt, fMinTime, fMinTimeExt, fStatus, fTask, fWindow, VldContext::GetDetector(), VldTimeStamp::GetSec(), VldContext::GetSimFlag(), VldContext::GetTimeStamp(), LocalQuery(), MSG, and Reset(). Referenced by MadPIDAnalysis::CreatePAN(), ANtpInfoObjectFiller::FillHeaderInformation(), DataUtil::IsGoodDataHV(), and DataQualityInterface::ProcessDetectorStatus(). 00064 {
00065 MSG("HvStatus", Msg::kVerbose) << " *** HvStatusFinder::GetHvStatus(...) *** " << endl;
00066
00067 MSG("HvStatus", Msg::kDebug) << " time: " << context.GetTimeStamp().GetSec() << endl;
00068
00069 // if it's not real data, return kOK
00070 if( context.GetSimFlag() != SimFlag::kData ){
00071 if( context.GetDetector()==Detector::kNear ) return kStatusNearOK;
00072 if( context.GetDetector()==Detector::kFar ) return kStatusFarOK;
00073 return HvStatus::kOK;
00074 }
00075
00076 // reset db query, if needed
00077 Bool_t reset = 0;
00078
00079 Int_t new_window = window;
00080 if( new_window<1 ) new_window = 1;
00081 if( new_window!=fWindow ){ fWindow = new_window; reset = 1; }
00082
00083 Int_t new_task = task;
00084 if( !(new_task==0||new_task==1) ) new_task = 1;
00085 if( new_task!=fTask ){ fTask = new_task; reset = 1; }
00086
00087 if( reset ) this->Reset();
00088
00089 // extended query of HV database
00090 if( fMinTimeExt<0
00091 || fMaxTimeExt<0
00092 || context.GetTimeStamp().GetSec()<fMinTimeExt
00093 || context.GetTimeStamp().GetSec()>fMaxTimeExt ){
00094 MSG("HvStatus", Msg::kDebug) << " new extended query... " << endl;
00095 this->ExtendedQuery(context);
00096 }
00097 else{
00098 MSG("HvStatus", Msg::kVerbose) << " use current extended query [" << fMinTimeExt << "->" << fMaxTimeExt << "]" << endl;
00099 }
00100
00101 // local query of HV database
00102 if( fMinTime<0
00103 || fMaxTime<0
00104 || context.GetTimeStamp().GetSec()<fMinTime
00105 || context.GetTimeStamp().GetSec()>fMaxTime ){
00106 MSG("HvStatus", Msg::kDebug) << " new local query... " << endl;
00107 this->LocalQuery(context);
00108 }
00109 else{
00110 MSG("HvStatus", Msg::kVerbose) << " use current local query [" << fMinTime << "->" << fMaxTime << "]" << endl;
00111 }
00112
00113 MSG("HvStatus", Msg::kDebug) << " status: " << fStatus << endl;
00114
00115 return fStatus;
00116 }
|
|
|
Definition at line 12 of file HvStatusFinder.cxx. References MSG, and HvStatusFinder::Cleaner::UseMe(). Referenced by MadPIDAnalysis::CreatePAN(), ANtpInfoObjectFiller::FillHeaderInformation(), DataUtil::IsGoodDataHV(), and DataQualityInterface::ProcessDetectorStatus(). 00013 {
00014 MSG("HvStatus", Msg::kDebug) << " *** HvStatusFinder::Instance() *** " << endl;
00015
00016 // Cleaner destructor calls HvStatusFinder dtor
00017 static Cleaner cleaner;
00018
00019 // create singleton instance of spillfinder
00020 if(!fMyInstance){
00021 MSG("HvStatus", Msg::kDebug) << " Creating new instance of HvStatusFinder " << endl;
00022 cleaner.UseMe();
00023 fMyInstance = new HvStatusFinder();
00024 }
00025
00026 // die if finder hasn't actually been created
00027 if(!fMyInstance){
00028 MSG("HvStatus", Msg::kFatal) << " No HvStatusFinder Instance - aagghhh, I'm going to die!!!." << endl;
00029 assert(fMyInstance);
00030 }
00031
00032 // can do re-setting here
00033 if(fMyInstance){
00034
00035 }
00036
00037 return *fMyInstance;
00038 }
|
|
|
Definition at line 174 of file HvStatusFinder.cxx. References fHvTable, fMaxTime, fMinTime, fStatus, fWindow, DbuHvFromSingles::GetColdChips(), VldContext::GetDetector(), DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRow(), VldTimeStamp::GetSec(), DbuHvFromSingles::GetStatus(), DbuHvFromSingles::GetSupermodule(), VldRange::GetTimeEnd(), VldContext::GetTimeStamp(), VldRange::GetTimeStart(), DbiResultPtr< T >::GetValidityRec(), DbiValidityRec::GetVldRange(), and MSG. Referenced by GetHvStatus(). 00175 {
00176 MSG("HvStatus", Msg::kVerbose) << " *** HvStatusFinder::LocalQuery(...) *** " << endl;
00177
00178 fStatus = HvStatus::kUnknown;
00179 fMinTime = fMinTimeExt;
00180 fMaxTime = fMaxTimeExt;
00181
00182 Int_t hvstatus = -1;
00183 Int_t hvstatusSM1 = -1;
00184 Int_t hvstatusSM2 = -1;
00185
00186 // loop over database entries
00187 if( fHvTable.GetNumRows()>0 ){
00188 for( UInt_t irow = 0; irow < fHvTable.GetNumRows(); irow++ ){
00189 const DbuHvFromSingles* hvState = fHvTable.GetRow(irow);
00190 const DbiValidityRec* hvRec = fHvTable.GetValidityRec(hvState);
00191 const VldRange& hvRange = hvRec->GetVldRange();
00192
00193 // HV status - overall, SM1, SM2
00194 if( context.GetTimeStamp().GetSec()>hvRange.GetTimeStart().GetSec()-fWindow
00195 && context.GetTimeStamp().GetSec()<hvRange.GetTimeEnd().GetSec()+fWindow ){
00196
00197 MSG("HvStatus", Msg::kVerbose) << " row=" << irow << " SM=" << hvState->GetSupermodule() << " status=" << hvState->GetStatus() << ", coldchips=" << hvState->GetColdChips() << " range=" << hvRange.GetTimeStart().GetSec() << "->" << hvRange.GetTimeEnd().GetSec() << endl;
00198
00199 if( ( hvState->GetStatus()==0 )
00200 || ( hvState->GetStatus()==1 && hvstatus==-1 ) ){
00201 hvstatus = hvState->GetStatus();
00202 }
00203
00204 if( hvState->GetSupermodule()==1 ){
00205 if( ( hvState->GetStatus()==0 )
00206 || ( hvState->GetStatus()==1 && hvstatusSM1==-1 ) ){
00207 hvstatusSM1 = hvState->GetStatus();
00208 }
00209 }
00210
00211 if( hvState->GetSupermodule()==2 ){
00212 if( ( hvState->GetStatus()==0 )
00213 || ( hvState->GetStatus()==1 && hvstatusSM2==-1 ) ){
00214 hvstatusSM2 = hvState->GetStatus();
00215 }
00216 }
00217 }
00218
00219 // time boundary - minimum time
00220 if( hvRange.GetTimeStart().GetSec()-fWindow>fMinTime
00221 && hvRange.GetTimeStart().GetSec()-fWindow<context.GetTimeStamp().GetSec() ){
00222 fMinTime = hvRange.GetTimeStart().GetSec()-fWindow;
00223 }
00224
00225 if( hvRange.GetTimeStart().GetSec()+fWindow>fMinTime
00226 && hvRange.GetTimeStart().GetSec()+fWindow<context.GetTimeStamp().GetSec() ){
00227 fMinTime = hvRange.GetTimeStart().GetSec()+fWindow;
00228 }
00229
00230 if( hvRange.GetTimeEnd().GetSec()-fWindow>fMinTime
00231 && hvRange.GetTimeEnd().GetSec()-fWindow<context.GetTimeStamp().GetSec() ){
00232 fMinTime = hvRange.GetTimeEnd().GetSec()-fWindow;
00233 }
00234
00235 if( hvRange.GetTimeEnd().GetSec()+fWindow>fMinTime
00236 && hvRange.GetTimeEnd().GetSec()+fWindow<context.GetTimeStamp().GetSec() ){
00237 fMinTime = hvRange.GetTimeEnd().GetSec()+fWindow;
00238 }
00239
00240 // time boundary - maximum time
00241 if( hvRange.GetTimeStart().GetSec()-fWindow<fMaxTime
00242 && hvRange.GetTimeStart().GetSec()-fWindow>context.GetTimeStamp().GetSec() ){
00243 fMaxTime = hvRange.GetTimeStart().GetSec()-fWindow;
00244 }
00245
00246 if( hvRange.GetTimeStart().GetSec()+fWindow<fMaxTime
00247 && hvRange.GetTimeStart().GetSec()+fWindow>context.GetTimeStamp().GetSec() ){
00248 fMaxTime = hvRange.GetTimeStart().GetSec()+fWindow;
00249 }
00250
00251 if( hvRange.GetTimeEnd().GetSec()-fWindow<fMaxTime
00252 && hvRange.GetTimeEnd().GetSec()-fWindow>context.GetTimeStamp().GetSec() ){
00253 fMaxTime = hvRange.GetTimeEnd().GetSec()-fWindow;
00254 }
00255
00256 if( hvRange.GetTimeEnd().GetSec()+fWindow<fMaxTime
00257 && hvRange.GetTimeEnd().GetSec()+fWindow>context.GetTimeStamp().GetSec() ){
00258 fMaxTime = hvRange.GetTimeEnd().GetSec()+fWindow;
00259 }
00260
00261 }
00262 }
00263
00264 MSG("HvStatus", Msg::kDebug) << " result: status=" << hvstatus << " (SM1=" << hvstatusSM1 << ",SM2=" << hvstatusSM2 << ")" << endl;
00265
00266 // determine HV status - far detector
00267 if( context.GetDetector() == Detector::kFar ){
00268 if( hvstatus==0 ) fStatus = (HvStatus::HvStatus_t)(fStatus|HvStatus::kBad);
00269 else if( hvstatus==1 ) fStatus = (HvStatus::HvStatus_t)(fStatus|HvStatus::kOK);
00270
00271 if( hvstatusSM1==-1 ) fStatus = (HvStatus::HvStatus_t)(fStatus|HvStatus::kSM1Unknown);
00272 else if( hvstatusSM1==0 ) fStatus = (HvStatus::HvStatus_t)(fStatus|HvStatus::kSM1Bad);
00273 else if( hvstatusSM1==1 ) fStatus = (HvStatus::HvStatus_t)(fStatus|HvStatus::kSM1OK);
00274
00275 if( hvstatusSM2==-1 ) fStatus = (HvStatus::HvStatus_t)(fStatus|HvStatus::kSM2Unknown);
00276 else if( hvstatusSM2==0 ) fStatus = (HvStatus::HvStatus_t)(fStatus|HvStatus::kSM2Bad);
00277 else if( hvstatusSM2==1 ) fStatus = (HvStatus::HvStatus_t)(fStatus|HvStatus::kSM2OK);
00278 }
00279
00280 // determine HV status - near detector
00281 if( context.GetDetector() == Detector::kNear ){
00282 if( hvstatus==0 ) fStatus = (HvStatus::HvStatus_t)(fStatus|HvStatus::kBad);
00283 else if( hvstatus==1 ) fStatus = (HvStatus::HvStatus_t)(fStatus|HvStatus::kOK);
00284
00285 if( hvstatusSM1==-1 ) fStatus = (HvStatus::HvStatus_t)(fStatus|HvStatus::kSM1Unknown);
00286 else if( hvstatusSM1==0 ) fStatus = (HvStatus::HvStatus_t)(fStatus|HvStatus::kSM1Bad);
00287 else if( hvstatusSM1==1 ) fStatus = (HvStatus::HvStatus_t)(fStatus|HvStatus::kSM1OK);
00288 }
00289
00290 MSG("HvStatus", Msg::kDebug) << " result: hvstatus=" << fStatus << endl;
00291 MSG("HvStatus", Msg::kDebug) << " validity: " << fMinTime << "->" << fMaxTime << endl;
00292
00293 return;
00294 }
|
|
|
Definition at line 296 of file HvStatusFinder.cxx. References fMaxTime, fMaxTimeExt, fMinTime, fMinTimeExt, fStatus, and MSG. Referenced by GetHvStatus(), and HvStatusFinder(). 00297 {
00298 MSG("HvStatus", Msg::kVerbose) << " *** HvStatusFinder::Reset() *** " << endl;
00299
00300 fMinTime = -1;
00301 fMaxTime = -1;
00302 fMinTimeExt = -1;
00303 fMaxTimeExt = -1;
00304
00305 fStatus = HvStatus::kUnknown;
00306 }
|
|
|
Definition at line 53 of file HvStatusFinder.h. |
|
|
Definition at line 24 of file HvStatusFinder.h. Referenced by ExtendedQuery(), and LocalQuery(). |
|
|
Definition at line 30 of file HvStatusFinder.h. Referenced by GetHvStatus(), LocalQuery(), and Reset(). |
|
|
Definition at line 32 of file HvStatusFinder.h. Referenced by ExtendedQuery(), GetHvStatus(), and Reset(). |
|
|
Definition at line 29 of file HvStatusFinder.h. Referenced by GetHvStatus(), LocalQuery(), and Reset(). |
|
|
Definition at line 31 of file HvStatusFinder.h. Referenced by ExtendedQuery(), GetHvStatus(), and Reset(). |
|
|
Definition at line 10 of file HvStatusFinder.cxx. Referenced by HvStatusFinder::Cleaner::~Cleaner(). |
|
|
Definition at line 34 of file HvStatusFinder.h. Referenced by GetHvStatus(), LocalQuery(), and Reset(). |
|
|
Definition at line 26 of file HvStatusFinder.h. Referenced by ExtendedQuery(), GetHvStatus(), and HvStatusFinder(). |
|
|
Definition at line 27 of file HvStatusFinder.h. Referenced by ExtendedQuery(), GetHvStatus(), HvStatusFinder(), and LocalQuery(). |
|
|
Definition at line 37 of file HvStatusFinder.h. Referenced by HvStatusFinder(). |
|
|
Definition at line 36 of file HvStatusFinder.h. Referenced by HvStatusFinder(). |
1.3.9.1