FabPlnInstallLookup Class Reference

#include <FabPlnInstallLookup.h>

List of all members.

Public Member Functions

 FabPlnInstallLookup (const VldContext &vldc)
virtual ~FabPlnInstallLookup ()
PlexPlaneId GetFirstNormalPlane () const
PlexPlaneId GetLastNormalPlane () const
const FabPlnInstallNextInstall (const VldTimeStamp &ts, bool ignoreVeto=true) const
VldTimeStamp TimeNextInstall (const VldTimeStamp &ts, bool ignoreVeto=true) const
const FabPlnInstallNextInstall (bool ignoreVeto=true) const
VldTimeStamp TimeNextInstall (bool ignoreVeto=true) const
const FabPlnInstallGetFabPlnInstall (const PlexPlaneId &plnid) const
std::string GetScintMdlMfgId (const PlexScintMdlId &mdlid) const
std::string GetSteelSlabMfgId (const PlexPlaneId &plnid, UShort_t indx) const
PlexScintMdlId WhereIsScintMdl (const std::string &mfgid) const
std::pair< PlexPlaneId, UShort_t > WhereIsSteelSlab (const std::string &mfgid) const
std::vector< const
FabSteelPlate * > 
GetFabSteelPlates (const PlexPlaneId &plnid) const
virtual void Print (Option_t *option="") const
unsigned int LookForOddEntries () const

Public Attributes

DbiResultPtr< FabPlnInstallfPlnInstallTbl
DbiResultPtr< FabPlnInstallfPlnInstallTblAlt
DbiResultPtr< FabSteelPlatefSteelPlateTbl

Protected Attributes

VldContext fVldContext
PlexPlaneId fFirstNormal
PlexPlaneId fLastNormal

Detailed Description

Definition at line 23 of file FabPlnInstallLookup.h.


Constructor & Destructor Documentation

FabPlnInstallLookup::FabPlnInstallLookup ( const VldContext vldc  ) 

Definition at line 33 of file FabPlnInstallLookup.cxx.

References FabPlnInstall::GetPlaneId(), PlexPlaneId::IsVetoShield(), Msg::kWarning, MSG, n, and PlexPlaneId::SetIsSteel().

00034   : fPlnInstallTbl(vldc), fSteelPlateTbl(vldc), fVldContext(vldc)
00035 {
00036   // Normal constructor
00037 
00038   // determine first/last non-veto shield planes
00039   const PlexPlaneId unsetPlnId;
00040   UInt_t n = fPlnInstallTbl.GetNumRows();
00041   for (UInt_t irow=0; irow < n; ++irow) {
00042     const FabPlnInstall* fab = fPlnInstallTbl.GetRow(irow);
00043     PlexPlaneId plnid = fab->GetPlaneId(); 
00044     if ( ! plnid.IsVetoShield() ) {
00045       plnid.SetIsSteel(kTRUE);
00046       if ( plnid == unsetPlnId ) {
00047         MSG("Fabrication",Msg::kWarning)
00048           << " row " << irow << " has bad PlexPlaneId" 
00049           << endl
00050           << *fab 
00051           << endl;
00052         continue;
00053       }
00054       if ( fFirstNormal == unsetPlnId ) { // first legal row
00055         fFirstNormal = plnid;
00056         fLastNormal  = plnid;
00057       }
00058       if ( plnid < fFirstNormal ) fFirstNormal = plnid;
00059       if ( plnid > fLastNormal  ) fLastNormal  = plnid;
00060     }
00061   }
00062 
00063   // leave fPlnInstallTblAlt unset
00064 
00065 }

FabPlnInstallLookup::~FabPlnInstallLookup (  )  [virtual]

Definition at line 68 of file FabPlnInstallLookup.cxx.

00069 {
00070    // Normal dtor
00071 }


Member Function Documentation

const FabPlnInstall * FabPlnInstallLookup::GetFabPlnInstall ( const PlexPlaneId plnid  )  const

Definition at line 174 of file FabPlnInstallLookup.cxx.

References fPlnInstallTbl, fVldContext, PlexPlaneId::GetDetector(), VldContext::GetDetector(), PlexPlaneId::GetPlane(), and DbiResultPtr< T >::GetRowByIndex().

Referenced by GetScintMdlMfgId(), and GetSteelSlabMfgId().

00175 {
00176   // Find the entry for the given plane
00177 
00178   if (plnid.GetDetector() != fVldContext.GetDetector()) return 0;
00179   return fPlnInstallTbl.GetRowByIndex(plnid.GetPlane());
00180 }

std::vector< const FabSteelPlate * > FabPlnInstallLookup::GetFabSteelPlates ( const PlexPlaneId plnid  )  const

Definition at line 184 of file FabPlnInstallLookup.cxx.

References fPlnInstallTbl, fSteelPlateTbl, fVldContext, PlexPlaneId::GetDetector(), VldContext::GetDetector(), DbiResultPtr< T >::GetNumRows(), PlexPlaneId::GetPlane(), DbiResultPtr< T >::GetRow(), DbiResultPtr< T >::GetRowByIndex(), FabSteelPlate::GetSteelSlabMfgId(), and FabPlnInstall::GetSteelSlabMfgId().

00185 {
00186   // Find the entry for the given plane
00187   std::vector<const FabSteelPlate*> vplates(8);
00188 
00189   if (plnid.GetDetector() != fVldContext.GetDetector()) return vplates;
00190   const FabPlnInstall* plnrow = fPlnInstallTbl.GetRowByIndex(plnid.GetPlane());
00191   if ( ! plnrow ) return vplates;
00192 
00193   UInt_t ntotplates = fSteelPlateTbl.GetNumRows();
00194   for (UInt_t indx=0; indx<8; ++indx) {
00195     std::string mfgid1 = plnrow->GetSteelSlabMfgId(indx);
00196     // not very efficient!
00197     for (UInt_t iplate = 0; iplate < ntotplates; ++iplate) {
00198       const FabSteelPlate* platerow = fSteelPlateTbl.GetRow(iplate);
00199       std::string mfgid2 = platerow->GetSteelSlabMfgId();
00200       if ( mfgid1 == mfgid2 ) vplates[indx] = platerow;
00201     }
00202   }
00203 
00204   return vplates;
00205 }

PlexPlaneId FabPlnInstallLookup::GetFirstNormalPlane (  )  const [inline]

Definition at line 30 of file FabPlnInstallLookup.h.

References fFirstNormal.

00030 { return fFirstNormal; }

PlexPlaneId FabPlnInstallLookup::GetLastNormalPlane (  )  const [inline]

Definition at line 31 of file FabPlnInstallLookup.h.

References fLastNormal.

Referenced by AlgFarDetSliceList::RunAlg(), and AlgFarDetSlice::RunAlg().

00031 { return fLastNormal; }

std::string FabPlnInstallLookup::GetScintMdlMfgId ( const PlexScintMdlId mdlid  )  const

Definition at line 208 of file FabPlnInstallLookup.cxx.

References dummyPlnInstall, GetFabPlnInstall(), PlexScintMdlId::GetModule(), FabPlnInstall::GetScintMdlMfgId(), Msg::kInfo, Msg::kWarning, and MSG.

00209 {
00210   // Find the Mfg-Id for a logical ScintMdlId
00211 
00212   const FabPlnInstall* fab = GetFabPlnInstall(mdlid);
00213   if (!fab) {
00214     MSG("Fabrication",Msg::kInfo)
00215       << "ScintMdl " << mdlid << " not known to be installed" << endl;
00216     fab = dummyPlnInstall;
00217   }
00218   if (mdlid.GetModule() > 7) {
00219     MSG("Fabrication",Msg::kWarning)
00220       << "FabPlnInstall doesn't support modules > 7; "
00221       << mdlid << " out-of-range" << endl;
00222   }
00223   return fab->GetScintMdlMfgId(mdlid.GetModule());
00224 }

std::string FabPlnInstallLookup::GetSteelSlabMfgId ( const PlexPlaneId plnid,
UShort_t  indx 
) const

Definition at line 227 of file FabPlnInstallLookup.cxx.

References dummyPlnInstall, GetFabPlnInstall(), FabPlnInstall::GetSteelSlabMfgId(), Msg::kInfo, Msg::kWarning, and MSG.

00229 {
00230   // Find the Mfg-Id for a logical slab in a logical plane
00231 
00232   const FabPlnInstall* fab = GetFabPlnInstall(plnid);
00233   if (!fab) {
00234     MSG("Fabrication",Msg::kInfo)
00235       << "Plane " << plnid << " not known to be installed" << endl;
00236     fab = dummyPlnInstall;
00237   }
00238   if (indx > 7) {
00239     MSG("Fabrication",Msg::kWarning)
00240       << "FabPlnInstall doesn't support steel slab > 7; "
00241       << indx << " out-of-range" << endl;
00242   }
00243   return fab->GetSteelSlabMfgId(indx);
00244 }

unsigned int FabPlnInstallLookup::LookForOddEntries (  )  const

Definition at line 295 of file FabPlnInstallLookup.cxx.

References PlexPlaneId::AsString(), VldTimeStamp::AsString(), PlexScintMdlId::AsString(), Munits::day, fFirstNormal, fLastNormal, fPlnInstallTbl, VldTimeStamp::GetDate(), PlexPlaneId::GetDetector(), FabPlnInstall::GetInstallDate(), DbiResultPtr< T >::GetNumRows(), PlexPlaneId::GetPlane(), PlexPlaneId::GetPlaneCoverage(), FabPlnInstall::GetPlaneId(), DbiResultPtr< T >::GetRow(), FabPlnInstall::GetScintMdlMfgId(), FabPlnInstall::GetSteelSlabMfgId(), PlexPlaneId::IsVetoShield(), Detector::kCalDet, Detector::kFar, Detector::kNear, PlaneCoverage::kNearFull, PlaneCoverage::kNearPartial, PlaneCoverage::kNoActive, PlaneCoverage::kTotal, PlaneCoverage::kVScN, PlaneCoverage::kVSCN, PlaneCoverage::kVSCS, PlaneCoverage::kVScS, PlaneCoverage::kVSeN, PlaneCoverage::kVSEN, PlaneCoverage::kVSeS, PlaneCoverage::kVSES, month, n, PlexPlaneId::SetIsSteel(), WhereIsScintMdl(), WhereIsSteelSlab(), and Munits::year.

00296 {
00297   // Report all suspicious looking entries
00298 
00299   cout << endl << " === Looking for odd entries === " << endl;
00300 
00301   typedef set<UInt_t>                 uset_t;
00302   typedef set<UInt_t>::const_iterator usetitr_t;
00303 
00304   typedef set<std::string>            sset_t;
00305   typedef set<std::string>::iterator  ssetitr_t;
00306   typedef pair<ssetitr_t,bool>        ssetinsert_t;
00307 
00308   sset_t scintset, slabset; // list of all unique mfg-ids for dup search
00309 
00310   // slabs have "part numbers" easily confused with mfg-id's
00311   uset_t slabPartNums;
00312   slabPartNums.insert(350949);
00313   slabPartNums.insert(350950);
00314   slabPartNums.insert(350951);
00315   slabPartNums.insert(350952);
00316   slabPartNums.insert(350911);
00317   slabPartNums.insert(350912);
00318   slabPartNums.insert(350913);
00319   slabPartNums.insert(350914);
00320 
00321   unsigned int nerrors = 0;
00322 
00323   PlexPlaneId plnid;
00324   const FabPlnInstall* fab;
00325   int ipln_expect = 0;
00326 
00327   VldTimeStamp lastInstallDate((time_t)0,0);
00328   PlexPlaneId  lastPlaneId;
00329   // cross check for screwed up INSTALLDATE
00330   // will come out as "tomorrow" if entered as '0000-00-00 00:
00331   VldTimeStamp now;
00332   UInt_t year, month, day;
00333   now.GetDate(true,0,&year,&month,&day);
00334   VldTimeStamp today(year,month,day,0,0,0);
00335   VldTimeStamp tomorrow(year,month,day+1,0,0,0);
00336   //cout << " tomorrow is " << tomorrow.AsString("sql") << endl;
00337   
00338   UInt_t n = fPlnInstallTbl.GetNumRows();
00339   cout << "Total number of entries is: " << n << endl;
00340   cout << "Normal planes " << fFirstNormal << " to " << fLastNormal << endl;
00341 
00342   // create a map, so that results are in logical order
00343   // independent of how they come out of the DBI
00344 
00345   map<PlexPlaneId,const FabPlnInstall*> orderedmap;
00346 
00347   for (UInt_t irow=0; irow < n; ++irow) {
00348     fab = fPlnInstallTbl.GetRow(irow);
00349     plnid = fab->GetPlaneId(); plnid.SetIsSteel(kFALSE);
00350     orderedmap[plnid] = fab;
00351   }
00352 
00353   // loop over the map
00354 
00355   map<PlexPlaneId,const FabPlnInstall*>::const_iterator orderedItr;
00356   for (orderedItr  = orderedmap.begin();
00357        orderedItr != orderedmap.end();
00358        orderedItr++) {
00359     plnid = orderedItr->first;
00360     fab   = orderedItr->second;
00361     
00362     // check for monotonic, unitary increase in plane #
00363     // unless we're in the veto shield
00364     if ( ! plnid.IsVetoShield() ) {
00365       if (ipln_expect != plnid.GetPlane()) {
00366         cout << "Was expecting plane " << ipln_expect
00367              << ", instead got " << plnid << endl;
00368       }
00369     }
00370     ipln_expect = plnid.GetPlane()+1;
00371 
00372     // check for increasing installation date for FarDet (CalDet)
00373     //    (except for transition to veto shield)
00374     //    NearDet gets built from back to front...
00375     const VldTimeStamp& thisInstallDate = fab->GetInstallDate();
00376     // this check sometimes gets screwed up by UTC local confusion 
00377     if (thisInstallDate == tomorrow || thisInstallDate == today)
00378       cout << plnid << " tagged as installed on " 
00379            << thisInstallDate.AsString("sql") << "." << endl
00380            << "  probably entered as 0000-00-00 in DB table" << endl;
00381     bool out_of_order = false;
00382     switch (plnid.GetDetector()) {
00383     case Detector::kFar:
00384       if ( plnid.IsVetoShield() && ! lastPlaneId.IsVetoShield() )
00385         out_of_order = false; // this case is okay
00386       else
00387         out_of_order = ( thisInstallDate < lastInstallDate );
00388       break;
00389     case Detector::kNear:
00390       out_of_order = ( thisInstallDate > lastInstallDate );
00391       break;
00392     default:
00393       out_of_order = false; // don't bother checking CalDet
00394       break;
00395     }
00396     if (out_of_order) 
00397       cout << "Plane " << plnid << " installed on "
00398            << thisInstallDate.AsString("sql")
00399            << " installed before previous " << endl
00400            << "      " << lastPlaneId << " installed on " 
00401            << lastInstallDate.AsString("sql") << "." << endl;
00402     lastPlaneId     = plnid;
00403     lastInstallDate = thisInstallDate;
00404 
00405     uset_t badscint, badsteel;  // list of potential problem elements for pln
00406 
00407     UInt_t nmdls  = 8;
00408     UInt_t nslabs = 1;
00409     if (plnid.GetDetector() == Detector::kFar) {
00410       nslabs = ( plnid.IsVetoShield() ) ? 0 : 8;
00411     }
00412 
00413     switch (plnid.GetPlaneCoverage()) {
00414     case PlaneCoverage::kNoActive:     nmdls = 0; break;
00415     case PlaneCoverage::kNearPartial:  nmdls = 3; break;
00416     case PlaneCoverage::kNearFull:     nmdls = 5; break;
00417     case PlaneCoverage::kTotal:        nmdls = 8; 
00418       if (plnid.GetDetector()==Detector::kCalDet) nmdls = 1;
00419       break;
00420     case PlaneCoverage::kVScN: 
00421     case PlaneCoverage::kVSCN: 
00422     case PlaneCoverage::kVSeS: 
00423     case PlaneCoverage::kVSES: 
00424     case PlaneCoverage::kVScS: 
00425     case PlaneCoverage::kVSCS: 
00426     case PlaneCoverage::kVSeN: 
00427     case PlaneCoverage::kVSEN: 
00428       nmdls = 1; break;
00429     default:
00430       // complain
00431       break;
00432     }
00433 
00434     //
00435     // Check for oddities in the ScintMdl's
00436     //
00437     for (UInt_t imdl=0; imdl < 8; ++imdl) {
00438       string mfgid = fab->GetScintMdlMfgId(imdl);
00439 
00440       if ( imdl >= nmdls ) {
00441         // non-existent modules (ie. shouldn't be there)
00442         bool ismissing = (strlen(mfgid.c_str()) == 0 ||
00443                           strncmp(mfgid.c_str(),"n/a",3) == 0 );
00444         if (!ismissing) {
00445           nerrors++;
00446           cout << "On plane " << plnid << " mdl " << imdl
00447                << " should be 'n/a' but was '" << mfgid << "' " << endl;
00448         }
00449         continue; // move on to next module 
00450       }
00451 
00452       bool problem = false;
00453       // mfgid should be 8 char   FFFxxxxT  F=factory, xxxx=#, T=type
00454       if (strlen(mfgid.c_str()) < 8) problem = true;  
00455       PlexScintMdlId  mdlid(plnid,imdl);
00456       const char* asstring = mdlid.AsString();
00457       const char mdltype = toupper(asstring[10]);
00458       if      (strncmp(mfgid.c_str(),"CIT",3) == 0 ||
00459                strncmp(mfgid.c_str(),"UMN",3) == 0    ) {
00460         if (mfgid.c_str()[7] != mdltype) problem = true;
00461         }
00462       else problem = true; // neither CIT nor UMN
00463 
00464       if (problem) badscint.insert(imdl);
00465 
00466       if (!problem) {
00467         // doesn't look to be a problem id
00468         ssetinsert_t inpos = scintset.insert(mfgid);
00469         if (!inpos.second ) {
00470           nerrors++;
00471           // failed to insert because it already exists
00472           // WhereIsScintMdl won't work if things are misordered
00473           cout << "Duplicate scint mfg-id '" << mfgid << "' in "
00474                << mdlid << " (" << imdl << ") previously in " 
00475                << WhereIsScintMdl(mfgid) << endl;
00476         }
00477       }
00478     } // loop over all scint modules
00479 
00480     //
00481     // Check for oddities in the steel slabs
00482     //
00483     for (UInt_t islab=0; islab < 8; ++islab) {
00484       string mfgid = fab->GetSteelSlabMfgId(islab);
00485 
00486       if ( islab >= nslabs ) {
00487         // non-existent modules (ie. shouldn't be there)
00488         bool ismissing = (strlen(mfgid.c_str()) == 0 ||
00489                           strncmp(mfgid.c_str(),"n/a",3) == 0 );
00490         if (!ismissing) {
00491           nerrors++;
00492           cout << "On plane " << plnid << " slab " << islab
00493                << " should be 'n/a' but was '" << mfgid << "' " << endl;
00494         }
00495         continue; // move on to next module 
00496       }
00497 
00498       Int_t nid = -1;
00499       Int_t nscan = sscanf(mfgid.c_str(),"%d",&nid);
00500       bool problem = false;
00501       // does it look to be in range
00502       if (nscan != 1 || nid<100000 || nid>400000 ) problem = true;
00503       if ( problem && (nid>700000 && nid<=799999)) problem = false;  //special case for some duplicates
00504 
00505       if (problem) badsteel.insert(islab);
00506 
00507       if (!problem) {
00508         // check if it looks like a part #
00509         if (slabPartNums.find(nid) != slabPartNums.end()) {
00510           nerrors++;
00511           cout << "Slab " << plnid <<"," << islab << " has mfg-id '"
00512                << mfgid << "' which is a part #" << endl;
00513         }
00514         else {
00515           // doesn't look to be a problem id
00516           ssetinsert_t inpos = slabset.insert(mfgid);
00517           if (!inpos.second ) {
00518             nerrors++;
00519             // failed to insert because it already exists
00520             std::pair<PlexPlaneId,UShort_t> otherloc = WhereIsSteelSlab(mfgid);
00521             cout << "Duplicate slab mfg-id '" << mfgid << "' in "
00522                  << plnid << "," << islab << " previously in " 
00523                  << otherloc.first << "," << otherloc.second << endl;
00524           } // not a part number either
00525         }
00526       }
00527     } // loop over all slabs
00528 
00529     if (! (badscint.empty() && badsteel.empty()) ) {
00530       cout << "Potential problem on " << plnid.AsString("c") << ": " << endl;
00531       usetitr_t scintitr = badscint.begin();
00532       while (scintitr != badscint.end()) {
00533         nerrors++;
00534         PlexScintMdlId mdlid(plnid,*scintitr);
00535         cout << "  suspicious scint mdl [" << mdlid.AsString()
00536              << "] mfg-id: '" << fab->GetScintMdlMfgId(*scintitr) 
00537              << "'" << endl;
00538         scintitr++;
00539       }
00540       usetitr_t steelitr = badsteel.begin();
00541       while (steelitr != badsteel.end()) {
00542         nerrors++;
00543         cout << "  suspicious steel slab [" << *steelitr 
00544              << "] mfg-id: '" << fab->GetSteelSlabMfgId(*steelitr) 
00545              << "'" << endl;
00546         steelitr++;
00547       }
00548     } // dealt with problem
00549 
00550   } // loop over all entries (planes)
00551 
00552   cout << "last plane seen was: " << plnid << endl << endl;
00553 
00554   return nerrors;
00555 }

const FabPlnInstall* FabPlnInstallLookup::NextInstall ( bool  ignoreVeto = true  )  const [inline]

Definition at line 39 of file FabPlnInstallLookup.h.

References fVldContext, VldContext::GetTimeStamp(), and NextInstall().

Referenced by NextInstall().

00040      { return NextInstall(fVldContext.GetTimeStamp(),ignoreVeto); }

const FabPlnInstall * FabPlnInstallLookup::NextInstall ( const VldTimeStamp ts,
bool  ignoreVeto = true 
) const

Definition at line 74 of file FabPlnInstallLookup.cxx.

References farFuture, fPlnInstallTblAlt, fVldContext, VldContext::GetDetector(), FabPlnInstall::GetInstallDate(), DbiResultPtr< T >::GetNumRows(), FabPlnInstall::GetPlaneId(), DbiResultPtr< T >::GetRow(), VldContext::GetSimFlag(), VldRange::GetTimeEnd(), VldRange::GetTimeStart(), DbiResultPtr< T >::GetValidityRec(), DbiValidityRec::GetVldRange(), PlexPlaneId::IsVetoShield(), Msg::kDebug, Msg::kInfo, MSG, n, and DbiResultPtr< T >::NewQuery().

Referenced by UgliGeometry::BuildNodes(), and TimeNextInstall().

00076 {
00077   // Find the entry for the next plane that was installed after some time
00078   
00079   // Old code assumed that the database returns all the rows in ascending
00080   // time order!  NOT TRUE!
00081 
00082   // One can not use the DbiValidityRec times for determining anything
00083   // either because of the artificial (10day) trimming that goes on
00084 
00085 
00086   VldTimeStamp alttime = start;
00087   const FabPlnInstall* fab;
00088   const DbiValidityRec* dbivld;
00089 
00090   // initialize the Alt DbiResultPtr
00091   VldContext vldcStart(fVldContext.GetDetector(),
00092                        fVldContext.GetSimFlag(),alttime);
00093   fPlnInstallTblAlt.NewQuery(vldcStart);
00094 
00095   UInt_t n = fPlnInstallTblAlt.GetNumRows();
00096 
00097   if ( n <= 0) {
00098     // no planes installed at the time given
00099     // determine when first plane went up
00100     
00101     VldContext vldcAlt(fVldContext.GetDetector(),
00102                        fVldContext.GetSimFlag(),farFuture);
00103     MSG("Fabrication",Msg::kDebug)
00104       << "No planes yet installed, determine first using " << vldcAlt << endl;
00105     fPlnInstallTblAlt.NewQuery(vldcAlt);
00106     if (fPlnInstallTblAlt.GetNumRows() <= 0) {
00107       // no info about any appropriate planes 
00108       MSG("Fabrication",Msg::kInfo)
00109         << "NextInstall() has no info for " << vldcAlt << endl;
00110       return 0;
00111     }
00112     // can't determine start from the future DbiValidityRec
00113     // because of 10day Dbi window artificially limits validity range
00114     dbivld = fPlnInstallTblAlt.GetValidityRec();
00115     alttime = dbivld->GetVldRange().GetTimeStart();
00116 
00117     // find when first plane actually went up
00118     n = fPlnInstallTblAlt.GetNumRows();
00119     for (UInt_t irow=0; irow < n; ++irow) {
00120       fab = fPlnInstallTblAlt.GetRow(irow);
00121       const VldTimeStamp& ts = fab->GetInstallDate();
00122       if (ts < alttime) alttime = ts;
00123     }
00124 
00125   }
00126   else {
00127     // determine when the last plane in Alt set went up
00128     // can't use DbiValidityRec because of 10day Dbi window
00129     dbivld = fPlnInstallTblAlt.GetValidityRec();
00130     alttime = dbivld->GetVldRange().GetTimeEnd();
00131     
00132     if ( alttime > farFuture) {
00133       // way in the future means nothing new is going up
00134       MSG("Fabrication",Msg::kInfo)
00135         << "NextInstall() " << vldcStart << " detector complete?" << endl;
00136       return 0;
00137     }
00138   }
00139 
00140   // force new query with newly determined starting time
00141   VldContext vldcAlt(fVldContext.GetDetector(),
00142                      fVldContext.GetSimFlag(),alttime);
00143   fPlnInstallTblAlt.NewQuery(vldcAlt);
00144 
00145   n = fPlnInstallTblAlt.GetNumRows();
00146   for (UInt_t irow=0; irow < n; ++irow) {
00147     fab = fPlnInstallTblAlt.GetRow(irow);
00148     if ( ignoreVeto && fab->GetPlaneId().IsVetoShield() ) continue;
00149     const VldTimeStamp& ts = fab->GetInstallDate();
00150     //const PlexPlaneId& plnid = fab->GetPlaneId();
00151     //cout << "looking at " << plnid << " on " << ts << endl;
00152     if (ts >= alttime) return fab;
00153   }
00154 
00155   // if nothing after ... return empty to signal no extra info about next
00156   return 0;
00157 
00158 }

void FabPlnInstallLookup::Print ( Option_t *  option = ""  )  const [virtual]

Definition at line 284 of file FabPlnInstallLookup.cxx.

References fPlnInstallTbl, DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRow(), and n.

00285 {
00286   // Print out what we've got in hand
00287   UInt_t n = fPlnInstallTbl.GetNumRows();
00288   for (UInt_t irow=0; irow < n; ++irow) {
00289     const FabPlnInstall* fab = fPlnInstallTbl.GetRow(irow);
00290     if (fab) cout << *fab;
00291   }
00292 }

VldTimeStamp FabPlnInstallLookup::TimeNextInstall ( bool  ignoreVeto = true  )  const [inline]

Definition at line 41 of file FabPlnInstallLookup.h.

References fVldContext, VldContext::GetTimeStamp(), and TimeNextInstall().

Referenced by TimeNextInstall().

00042      { return TimeNextInstall(fVldContext.GetTimeStamp(),ignoreVeto); }

VldTimeStamp FabPlnInstallLookup::TimeNextInstall ( const VldTimeStamp ts,
bool  ignoreVeto = true 
) const

Definition at line 161 of file FabPlnInstallLookup.cxx.

References farFuture, FabPlnInstall::GetInstallDate(), and NextInstall().

00163 {
00164   // Find when the next plane was installed after some time
00165 
00166   const FabPlnInstall* fab = NextInstall(start,ignoreVeto);
00167   if (fab) return fab->GetInstallDate();
00168   else     return farFuture;
00169 
00170 }

PlexScintMdlId FabPlnInstallLookup::WhereIsScintMdl ( const std::string &  mfgid  )  const

Definition at line 247 of file FabPlnInstallLookup.cxx.

References fPlnInstallTbl, DbiResultPtr< T >::GetNumRows(), FabPlnInstall::GetPlaneId(), DbiResultPtr< T >::GetRow(), FabPlnInstall::GetScintMdlMfgId(), Msg::kInfo, MSG, and n.

Referenced by LookForOddEntries().

00248 {
00249   // Find the logical ScintMdlId given the Mfg-Id
00250   // Uses a dumb linear search -- not very efficient
00251   UInt_t n = fPlnInstallTbl.GetNumRows();
00252   for (UInt_t irow=0; irow < n; ++irow) {
00253     const FabPlnInstall* fab = fPlnInstallTbl.GetRow(irow);
00254     for (UInt_t imdl=0; imdl < 8; ++imdl) {
00255       if (fab->GetScintMdlMfgId(imdl) == mfgid)
00256         return PlexScintMdlId(fab->GetPlaneId(),imdl);
00257     }
00258   }
00259   MSG("Fabrication",Msg::kInfo)
00260     << "no placement info for ScintMdl " << mfgid << endl;
00261   return PlexScintMdlId();
00262 }

std::pair< PlexPlaneId, UShort_t > FabPlnInstallLookup::WhereIsSteelSlab ( const std::string &  mfgid  )  const

Definition at line 266 of file FabPlnInstallLookup.cxx.

References fPlnInstallTbl, DbiResultPtr< T >::GetNumRows(), FabPlnInstall::GetPlaneId(), DbiResultPtr< T >::GetRow(), FabPlnInstall::GetSteelSlabMfgId(), Msg::kInfo, MSG, and n.

Referenced by LookForOddEntries().

00267 {
00268   // Find the logical PlexPlaneId,slab# given the Mfg-Id
00269   // Uses a dumb linear search -- not very efficient
00270   UInt_t n = fPlnInstallTbl.GetNumRows();
00271   for (UInt_t irow=0; irow < n; ++irow) {
00272     const FabPlnInstall* fab = fPlnInstallTbl.GetRow(irow);
00273     for (UInt_t islab=0; islab < 8; ++islab) {
00274       if (fab->GetSteelSlabMfgId(islab) == mfgid)
00275         return pair<PlexPlaneId,UShort_t>(fab->GetPlaneId(),islab);
00276     }
00277   }
00278   MSG("Fabrication",Msg::kInfo)
00279     << "no placement info for steel slab " << mfgid << endl;
00280   return pair<PlexPlaneId,UShort_t>(PlexPlaneId(),0xffff);
00281 }


Member Data Documentation

Definition at line 69 of file FabPlnInstallLookup.h.

Referenced by GetFirstNormalPlane(), and LookForOddEntries().

Definition at line 70 of file FabPlnInstallLookup.h.

Referenced by GetLastNormalPlane(), and LookForOddEntries().

Definition at line 62 of file FabPlnInstallLookup.h.

Referenced by NextInstall().

Definition at line 63 of file FabPlnInstallLookup.h.

Referenced by GetFabSteelPlates().


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

Generated on 25 Sep 2017 for loon by  doxygen 1.6.1