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

Public Member Functions | |
| AlgDataQuality () | |
| ~AlgDataQuality () | |
| void | RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx) |
| void | Trace (const char *c) const |
|
|
Definition at line 32 of file AlgDataQuality.cxx. 00033 {
00034
00035 }
|
|
|
Definition at line 37 of file AlgDataQuality.cxx. 00038 {
00039
00040 }
|
|
||||||||||||||||
|
Implements AlgBase. Definition at line 42 of file AlgDataQuality.cxx. References abs(), CandHandle::AddDaughterLink(), DQRawDigits::At(), DQHotColdElectronics::At(), DQLightInjection::At(), AlgFactory::GetAlgHandle(), DQHeader::GetBaseNanosec(), CandDataQualityHandle::GetBusyChips(), DQLightInjection::GetCalibPoint(), DQLightInjection::GetCalibType(), CandContext::GetCandRecord(), CandDataQualityHandle::GetColdChips(), CandDataQualityHandle::GetCrateMask(), CandContext::GetDataIn(), CandDataQualityHandle::GetDataQuality(), VldContext::GetDetector(), CandDataQualityHandle::GetErrorCode(), DQHeader::GetErrorCode(), CandDataQualityHandle::GetHotChips(), AlgFactory::GetInstance(), DQLightInjection::GetLast(), DQHotColdElectronics::GetLast(), DQRawDigits::GetLast(), CandDataQualityHandle::GetLiCalibPoint(), CandDataQualityHandle::GetLiCalibType(), CandDataQualityHandle::GetLiPulseHeight(), CandDataQualityHandle::GetLiPulserBox(), CandDataQualityHandle::GetLiPulserLed(), CandDataQualityHandle::GetLiPulseWidth(), CandDataQualityHandle::GetLiRelativeTime(), CandDataQualityHandle::GetLiSubtractedTime(), CandDataQualityHandle::GetLiTime(), CandDataQualityHandle::GetLiTrigger(), CandContext::GetMom(), RawChip::GetNanosec(), DQHotColdElectronics::GetNumberOfCrates(), DQHotColdElectronics::GetNumberOfCratesInReadout(), CandDataQualityHandle::GetPostTriggerDigits(), DQRawDigits::GetPostTriggerDigits(), CandDataQualityHandle::GetPreTriggerDigits(), DQRawDigits::GetPreTriggerDigits(), DQLightInjection::GetPulseHeight(), DQLightInjection::GetPulserBox(), DQLightInjection::GetPulserLed(), DQLightInjection::GetPulseWidth(), CandDataQualityHandle::GetReadoutErrors(), CandDataQualityHandle::GetRun(), DQHeader::GetRun(), CandDataQualityHandle::GetRunType(), DQHeader::GetRunType(), CandDataQualityHandle::GetSnarl(), DQHeader::GetSnarl(), CandDataQualityHandle::GetSnarlMultiplicity(), DQRawDigits::GetSnarlMultiplicity(), DQRawDigits::GetSnarlPassFail(), CandDataQualityHandle::GetSpillStatus(), DQSpillServer::GetSpillStatus(), CandDataQualityHandle::GetSpillTimeError(), DQSpillServer::GetSpillTimeError(), CandDataQualityHandle::GetSpillType(), DQSpillServer::GetSpillType(), CandDataQualityHandle::GetSubRun(), DQHeader::GetSubRun(), CandDataQualityHandle::GetTime(), DQSpillServer::GetTime(), DQLightInjection::GetTime(), DQHotColdElectronics::GetTime(), DQRawDigits::GetTime(), DQHeader::GetTime(), CandDataQualityHandle::GetTimeFrame(), DQHeader::GetTimeFrame(), DQHeader::GetTriggerNanosec(), CandDataQualityHandle::GetTriggerSource(), DQHeader::GetTriggerSource(), CandDataQualityHandle::GetTriggerTime(), RecMinos::GetVldContext(), RawChip::IsSameChip(), CandDeadChip::MakeCandidate(), MSG, CandDataQualityHandle::SetCrateMask(), CandDataQualityHandle::SetDataQuality(), CandDataQualityHandle::SetErrorCode(), CandDataQualityHandle::SetLiCalibPoint(), CandDataQualityHandle::SetLiCalibType(), CandDataQualityHandle::SetLiPulseHeight(), CandDataQualityHandle::SetLiPulserBox(), CandDataQualityHandle::SetLiPulserLed(), CandDataQualityHandle::SetLiPulseWidth(), CandDataQualityHandle::SetLiRelativeTime(), CandDataQualityHandle::SetLiSubtractedTime(), CandDataQualityHandle::SetLiTime(), CandDataQualityHandle::SetLiTrigger(), CandHandle::SetName(), CandDataQualityHandle::SetPostTriggerDigits(), CandDataQualityHandle::SetPreTriggerDigits(), CandDataQualityHandle::SetRun(), CandDataQualityHandle::SetRunType(), CandDataQualityHandle::SetSnarl(), CandDataQualityHandle::SetSnarlMultiplicity(), CandDataQualityHandle::SetSpillStatus(), CandDataQualityHandle::SetSpillTimeError(), CandDataQualityHandle::SetSpillType(), CandDataQualityHandle::SetSubRun(), CandDataQualityHandle::SetTime(), CandDataQualityHandle::SetTimeFrame(), CandHandle::SetTitle(), CandDataQualityHandle::SetTriggerSource(), and CandDataQualityHandle::SetTriggerTime(). 00043 {
00044 MSG("DataQuality", Msg::kDebug) << " AlgDataQuality::RunAlg(...) " << endl;
00045
00046 Int_t i,j;
00047 Int_t addme;
00048 Int_t time,subtime;
00049 Int_t fSnarlPassFail;
00050
00051 CandDataQualityHandle& cdh = dynamic_cast<CandDataQualityHandle&>(ch);
00052 const TObjArray* arr = dynamic_cast<const TObjArray*>(cx.GetDataIn());
00053
00054 CandRecord* candrec = (CandRecord*)(cx.GetCandRecord());
00055 Detector::Detector_t detector = candrec->GetVldContext()->GetDetector();
00056
00057
00058 // STORE DATA QUALITY INFORMATION
00059 // ==============================
00060 // Sort through monitoring objects and store header information
00061
00062 MSG("DataQuality", Msg::kDebug) << " Store the Header Information " << endl;
00063
00064 // Store information from the data quality header
00065 // [ run, snarl, timeframe, trigger source etc ... ]
00066 DQHeader* myDQHeader = (DQHeader*)(arr->At(0));
00067 MSG("DataQuality", Msg::kDebug) << " Header (+" << myDQHeader->GetTime()-myDQHeader->GetTime() << ")" << endl;
00068 MSG("DataQuality", Msg::kDebug) << " [run=" << myDQHeader->GetRun() << ", snarl=" << myDQHeader->GetSnarl() << "]" << endl;
00069 MSG("DataQuality", Msg::kDebug) << " [trigger=" << myDQHeader->GetTriggerNanosec() << ", base=" << myDQHeader->GetBaseNanosec() << ", subtracted=" << myDQHeader->GetTriggerNanosec()-myDQHeader->GetBaseNanosec() << "]" << endl;
00070 cdh.SetTime(myDQHeader->GetTime());
00071 cdh.SetRunType(myDQHeader->GetRunType());
00072 cdh.SetRun(myDQHeader->GetRun());
00073 cdh.SetSubRun(myDQHeader->GetSubRun());
00074 cdh.SetTimeFrame(myDQHeader->GetTimeFrame());
00075 cdh.SetSnarl(myDQHeader->GetSnarl());
00076 cdh.SetTriggerSource(myDQHeader->GetTriggerSource());
00077 cdh.SetTriggerTime(myDQHeader->GetTriggerNanosec());
00078 cdh.SetErrorCode(myDQHeader->GetErrorCode());
00079 fSnarlPassFail = 1;
00080
00081 // Store information on the raw digit data block
00082 // [ readout errors, busy electronics etc ... ]
00083 DQRawDigits* myDQRawDigits = (DQRawDigits*)(arr->At(1));
00084 MSG("DataQuality", Msg::kDebug) << " Raw Digits (+" << myDQRawDigits->GetTime()-myDQHeader->GetTime() << ")" << endl;
00085 MSG("DataQuality", Msg::kDebug) << " [pre hits=" << myDQRawDigits->GetPreTriggerDigits() << ", post hits=" << myDQRawDigits->GetPostTriggerDigits() << ", snarl hits=" << myDQRawDigits->GetSnarlMultiplicity() << ", busy/error chips=" << 1+myDQRawDigits->GetLast()<< ", pass/fail=" << myDQRawDigits->GetSnarlPassFail() << "]" << endl;
00086 cdh.SetPreTriggerDigits(myDQRawDigits->GetPreTriggerDigits());
00087 cdh.SetPostTriggerDigits(myDQRawDigits->GetPostTriggerDigits());
00088 cdh.SetSnarlMultiplicity(myDQRawDigits->GetSnarlMultiplicity());
00089 fSnarlPassFail = myDQRawDigits->GetSnarlPassFail();
00090
00091 // Store information on the hot and cold electronics (check time)
00092 // [ crate mask etc... ]
00093 DQHotColdElectronics* myDQHotColdElectronics = (DQHotColdElectronics*)(arr->At(2));
00094 if( myDQHotColdElectronics->GetTime()>0 ){
00095 MSG("DataQuality", Msg::kDebug) << " Hot/Cold Electronics (+" << myDQHotColdElectronics->GetTime()-myDQHeader->GetTime() << ")" << endl;
00096 MSG("DataQuality", Msg::kDebug) << " [crates=" << myDQHotColdElectronics->GetNumberOfCrates() << ", hot/cold chips=" << 1+myDQHotColdElectronics->GetLast() << "]" << endl;
00097 }
00098 if( myDQHotColdElectronics->GetTime()>0
00099 && myDQHotColdElectronics->GetTime()-myDQHeader->GetTime()==0 ){
00100 cdh.SetCrateMask(myDQHotColdElectronics->GetNumberOfCratesInReadout());
00101 }
00102
00103 // Store information on light injection (check time)
00104 // [ LI type, LI pulser box/led, LI pulse parameters, LI time etc... ]
00105 DQLightInjection* myDQLightInjection = (DQLightInjection*)(arr->At(3));
00106 if( myDQLightInjection->GetTime()>0 ){
00107 MSG("DataQuality", Msg::kDebug) << " Light Injection (+" << myDQLightInjection->GetTime()-myDQHeader->GetTime() << ")" << endl;
00108 MSG("DataQuality", Msg::kDebug) << " [box=" << myDQLightInjection->GetPulserBox() << ", led=" << myDQLightInjection->GetPulserLed() << ", tpmt hits=" << 1+myDQLightInjection->GetLast()<< "]" << endl;
00109 }
00110 if( myDQLightInjection->GetTime()>0
00111 && myDQLightInjection->GetTime()-myDQHeader->GetTime()==0 ){
00112 cdh.SetLiCalibPoint(myDQLightInjection->GetCalibPoint());
00113 cdh.SetLiCalibType(myDQLightInjection->GetCalibType());
00114 cdh.SetLiPulserBox(myDQLightInjection->GetPulserBox());
00115 cdh.SetLiPulserLed(myDQLightInjection->GetPulserLed());
00116 cdh.SetLiPulseHeight(myDQLightInjection->GetPulseHeight());
00117 cdh.SetLiPulseWidth(myDQLightInjection->GetPulseWidth());
00118 }
00119
00120 // Store information on spills (check time)
00121 // [ spill status, type, time error etc... ]
00122 DQSpillServer* myDQSpillServer = (DQSpillServer*)(arr->At(4));
00123 if( myDQSpillServer->GetTime()>0 ){
00124 MSG("DataQuality", Msg::kDebug) << " Spill Server (+" << myDQSpillServer->GetTime()-myDQHeader->GetTime() << ")" << endl;
00125 MSG("DataQuality", Msg::kDebug) << " [status=" << myDQSpillServer->GetSpillStatus() << ", type=" << myDQSpillServer->GetSpillType() << ", error=" << myDQSpillServer->GetSpillTimeError() << "]" << endl;
00126 }
00127 if( myDQSpillServer->GetTime()>0
00128 && myDQSpillServer->GetTime()-myDQHeader->GetTime()==0 ){
00129 cdh.SetSpillStatus(myDQSpillServer->GetSpillStatus());
00130 cdh.SetSpillType(myDQSpillServer->GetSpillType());
00131 cdh.SetSpillTimeError(myDQSpillServer->GetSpillTimeError());
00132 }
00133
00134
00135 // CALCULATE THE CLOSEST TPMT HIT
00136 // ==============================
00137 // look in window [-100,+100] microseconds around trigger time
00138
00139 if( myDQLightInjection->GetTime()>0
00140 && myDQLightInjection->GetTime()-myDQHeader->GetTime()==0 ){
00141
00142 Int_t fMinSubTime=-100000;
00143 Int_t fMaxSubTime=+100000;
00144
00145 Int_t litrigger=0;
00146 Int_t litime=-99999;
00147 Int_t lisubtime=-99999;
00148 Int_t lireltime=-99999;
00149
00150 for(i=0;i<1+myDQLightInjection->GetLast();i++){
00151 RawChip* tpmt = (RawChip*)(myDQLightInjection->At(i));
00152
00153 time=tpmt->GetNanosec();
00154 subtime=tpmt->GetNanosec()-(myDQHeader->GetTriggerNanosec()-myDQHeader->GetBaseNanosec());
00155
00156 if( (subtime>fMinSubTime && subtime<fMaxSubTime)
00157 && (lireltime<0 || abs(subtime)<lireltime) ){
00158 litrigger=1;
00159 litime=time;
00160 lisubtime=subtime;
00161 lireltime=abs(subtime);
00162 }
00163 }
00164
00165 MSG("DataQuality", Msg::kDebug) << " Tpmt Hits (+" << myDQLightInjection->GetTime()-myDQHeader->GetTime() << ")" << endl;
00166 MSG("DataQuality", Msg::kDebug) << " [trigger=" << litrigger << ", litime=" << litime << ", lisubtime=" << lisubtime << ", lireltime=" << lireltime << "]" << endl;
00167
00168 cdh.SetLiTrigger(litrigger);
00169 cdh.SetLiTime(litime);
00170 cdh.SetLiSubtractedTime(lisubtime);
00171 cdh.SetLiRelativeTime(lireltime);
00172 }
00173
00174
00175 // STORE THE BAD CHANNELS
00176 // ======================
00177 //
00178
00179 MSG("DataQuality", Msg::kDebug) << " Sort the Bad Chips " << endl;
00180
00181 TObjArray* badelectronics = new TObjArray();
00182
00183 // Adding Hot/Cold Chips
00184 for(i=0;i<1+myDQHotColdElectronics->GetLast();i++){
00185 RawChip* badchip = (RawChip*)(myDQHotColdElectronics->At(i));
00186 addme=1;
00187 for(j=0;j<1+badelectronics->GetLast();j++){
00188 TObjArray* tmparray = (TObjArray*)(badelectronics->At(j));
00189 RawChip* tmpchip = (RawChip*)(tmparray->First());
00190 if( badchip->IsSameChip(tmpchip) ){
00191 tmparray->Add(badchip);
00192 addme=0;
00193 }
00194 }
00195 if( addme ){
00196 TObjArray* newarray = new TObjArray();
00197 newarray->Add(badchip);
00198 badelectronics->Add(newarray);
00199 }
00200 }
00201
00202 // Adding Raw Digits
00203 for(i=0;i<1+myDQRawDigits->GetLast();i++){
00204 RawChip* badchip = (RawChip*)(myDQRawDigits->At(i));
00205 addme=1;
00206 for(j=0;j<1+badelectronics->GetLast();j++){
00207 TObjArray* tmparray = (TObjArray*)(badelectronics->At(j));
00208 RawChip* tmpchip = (RawChip*)(tmparray->First());
00209 if( badchip->IsSameChip(tmpchip) ){
00210 tmparray->Add(badchip);
00211 addme=0;
00212 }
00213 }
00214 if( addme ){
00215 TObjArray* newarray = new TObjArray();
00216 newarray->Add(badchip);
00217 badelectronics->Add(newarray);
00218 }
00219 }
00220
00221 MSG("DataQuality", Msg::kDebug) << " ... Found " << 1+badelectronics->GetLast() << " Bad Chips " << endl;
00222
00223 // Create CandDeadChips
00224 AlgFactory &af = AlgFactory::GetInstance();
00225 AlgHandle ah = af.GetAlgHandle("AlgDeadChip", "default");
00226 CandContext mycx(this, cx.GetMom());
00227 mycx.SetCandRecord(candrec);
00228
00229 for(i=0;i<1+badelectronics->GetLast();i++){
00230 TObjArray* tmparray = (TObjArray*)(badelectronics->At(i));
00231 mycx.SetDataIn(tmparray);
00232 CandDeadChipHandle deadchip = CandDeadChip::MakeCandidate(ah,mycx);
00233 deadchip.SetName(TString("CandDeadChipHandle"));
00234 deadchip.SetTitle(TString("Created by CandDataQualityModule"));
00235 cdh.AddDaughterLink(deadchip);
00236 }
00237
00238 badelectronics->Delete();
00239 delete badelectronics;
00240
00241
00242 // SET THE DATA QUALITY SUMMARY
00243 // ============================
00244
00245 CandDataQuality::DataQuality_t quality(CandDataQuality::kOkay);
00246
00247 // Far Detector
00248 if( detector==Detector::kFar ){
00249
00250 Int_t fMinMultiplicity=10;
00251 Int_t fMaxMultiplicity=1000;
00252 Int_t fMaxColdChips=20;
00253 Int_t fMaxBusyChips=20;
00254 Int_t fMaxHotChips=9999;
00255 Int_t fMaxReadoutErrors=9999;
00256
00257 // low multiplicity (less than 10 hits)
00258 if( cdh.GetSnarlMultiplicity()<fMinMultiplicity ){
00259 quality=(CandDataQuality::DataQuality_t)(quality|CandDataQuality::kLowMultiplicity);
00260 }
00261
00262 // high multiplicity (more than 1000 hits)
00263 if( cdh.GetSnarlMultiplicity()>fMaxMultiplicity ){
00264 quality=(CandDataQuality::DataQuality_t)(quality|CandDataQuality::kHighMultiplicity);
00265 }
00266
00267 // proximity to Light Injection
00268 if( cdh.GetLiTrigger()==1 ){
00269 quality=(CandDataQuality::DataQuality_t)(quality|CandDataQuality::kLightInjection);
00270 };
00271
00272 // proximity to Timeframe Boundary
00273 if( cdh.GetTriggerTime()-1000000000>-100000 ){
00274 quality=(CandDataQuality::DataQuality_t)(quality|CandDataQuality::kTimeFrameBoundary);
00275 }
00276
00277 // too many cold chips
00278 if( cdh.GetColdChips()>fMaxColdChips ){
00279 quality=(CandDataQuality::DataQuality_t)(quality|CandDataQuality::kBad);
00280 quality=(CandDataQuality::DataQuality_t)(quality|CandDataQuality::kManyColdChips);
00281 }
00282
00283 // too many hot chips
00284 if( cdh.GetBusyChips()>fMaxHotChips ){
00285 quality=(CandDataQuality::DataQuality_t)(quality|CandDataQuality::kBad);
00286 quality=(CandDataQuality::DataQuality_t)(quality|CandDataQuality::kManyHotChips);
00287 }
00288
00289 // too many busy chips
00290 if( cdh.GetBusyChips()>fMaxBusyChips ){
00291 quality=(CandDataQuality::DataQuality_t)(quality|CandDataQuality::kBad);
00292 quality=(CandDataQuality::DataQuality_t)(quality|CandDataQuality::kManyBusyChips);
00293 }
00294
00295 // too many readout errors
00296 if( cdh.GetReadoutErrors()>fMaxReadoutErrors ){
00297 quality=(CandDataQuality::DataQuality_t)(quality|CandDataQuality::kBad);
00298 quality=(CandDataQuality::DataQuality_t)(quality|CandDataQuality::kManyReadoutErrors);
00299 }
00300
00301 }
00302
00303 // Near Detector
00304 if( detector==Detector::kNear ){
00305
00306 //
00307 // SET NEAR DETECTOR STUFF
00308 //
00309
00310 }
00311
00312 // bailed out of snarl
00313 if( fSnarlPassFail==0 ){
00314 quality=(CandDataQuality::DataQuality_t)(quality|CandDataQuality::kBad);
00315 quality=(CandDataQuality::DataQuality_t)(quality|CandDataQuality::kFailed);
00316 }
00317
00318 // set data quality summary
00319 cdh.SetDataQuality(quality);
00320
00321
00322 MSG("DataQuality", Msg::kDebug) << endl
00323 << " NEW CANDDATAQUALITYHANDLE " << endl
00324 << " ========================= " << endl
00325 << " Time=" << cdh.GetTime() << endl
00326 << " RunType=" << cdh.GetRunType() << endl
00327 << " Run=" << cdh.GetRun() << endl
00328 << " SubRun=" << cdh.GetSubRun() << endl
00329 << " TimeFrame=" << cdh.GetTimeFrame() << endl
00330 << " Snarl=" << cdh.GetSnarl() << endl
00331 << " TriggerSource=" << cdh.GetTriggerSource() << endl
00332 << " TriggerTime=" << cdh.GetTriggerTime() << endl
00333 << " ErrorCode=" << cdh.GetErrorCode() << endl
00334 << " CrateMask=" << cdh.GetCrateMask() << endl
00335 << " PreTriggerDigits=" << cdh.GetPreTriggerDigits() << endl
00336 << " PostTriggerDigits=" << cdh.GetPostTriggerDigits() << endl
00337 << " SnarlMultiplicity=" << cdh.GetSnarlMultiplicity() << endl
00338 << " SpillStatus=" << cdh.GetSpillStatus() << endl
00339 << " SpillType=" << cdh.GetSpillType() << endl
00340 << " SpillTimeError=" << cdh.GetSpillTimeError() << endl
00341 << " LiTrigger=" << cdh.GetLiTrigger() << endl
00342 << " LiTime=" << cdh.GetLiTime() << endl
00343 << " LiSubtractedTime=" << cdh.GetLiSubtractedTime() << endl
00344 << " LiRelativeTime=" << cdh.GetLiRelativeTime() << endl
00345 << " LiCalibPoint=" << cdh.GetLiCalibPoint() << endl
00346 << " LiCalibType=" << cdh.GetLiCalibType() << endl
00347 << " LiPulserBox=" << cdh.GetLiPulserBox() << endl
00348 << " LiPulserLed=" << cdh.GetLiPulserLed() << endl
00349 << " LiPulseHeight=" << cdh.GetLiPulseHeight() << endl
00350 << " LiPulseWidth=" << cdh.GetLiPulseWidth() << endl
00351 << " ColdChips=" << cdh.GetColdChips() << endl
00352 << " HotChips=" << cdh.GetHotChips() << endl
00353 << " BusyChips=" << cdh.GetBusyChips() << endl
00354 << " ReadoutErrors=" << cdh.GetReadoutErrors() << endl
00355 << " DataQuality=" << cdh.GetDataQuality() << endl;
00356
00357 return;
00358 }
|
|
|
Reimplemented from AlgBase. Definition at line 360 of file AlgDataQuality.cxx. 00361 {
00362
00363 }
|
1.3.9.1