Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

DatabaseToucher.cxx

Go to the documentation of this file.
00001 
00002 // $Id: DatabaseToucher.cxx,v 1.3 2007/03/01 17:23:07 rhatcher Exp $
00003 //
00004 //
00005 // n.tagg1@physics.ox.ac.uk
00007 #include "DatabaseToucher.h"
00008 #include "MessageService/MsgService.h"
00009 #include "MinosObjectMap/MomNavigator.h"
00010 #include "JobControl/JobCModuleRegistry.h" // For JOBMODULE macro
00011 #include "Plex/PlexHandle.h"
00012 #include "UgliGeometry/UgliGeomHandle.h"
00013 #include "Calibrator/Calibrator.h"
00014 
00015 #include "Record/SimSnarlRecord.h"
00016 #include "Record/SimSnarlHeader.h"
00017 #include "RawData/RawRecord.h"
00018 #include "RawData/RawHeader.h"
00019 #include "CandData/CandRecord.h"
00020 
00021 
00022 JOBMODULE(DatabaseToucher, "DatabaseToucher",
00023           "Touches all the usual DB tables with the current VldContext");
00024 CVSID("$Id: DatabaseToucher.cxx,v 1.3 2007/03/01 17:23:07 rhatcher Exp $");
00025 //......................................................................
00026 
00027 
00028 
00029 DatabaseToucher::DatabaseToucher()
00030 {
00031 }
00032 
00033 //......................................................................
00034 
00035 DatabaseToucher::~DatabaseToucher()
00036 {
00037 }
00038 
00039 //......................................................................
00040 
00041 JobCResult DatabaseToucher::Ana(const MomNavigator* mom)
00042 {
00043   // Find something with a vld context.
00044   VldContext context;
00045 
00046   const SimSnarlRecord* simsnarl = 
00047     dynamic_cast<const SimSnarlRecord*>(mom->GetFragment("SimSnarlRecord"));
00048   if(simsnarl) context = simsnarl->GetSimSnarlHeader()->GetVldContext();
00049 
00050   const RawRecord* rawrec = 
00051     dynamic_cast<const RawRecord*>(mom->GetFragment("RawRecord"));
00052   if(rawrec) context = rawrec->GetRawHeader()->GetVldContext();
00053 
00054   CandRecord *candrec = dynamic_cast<CandRecord *>
00055     (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00056   if(candrec) context = *candrec->GetVldContext();
00057 
00058   if(context.IsValid()) {
00059     // Touch everything that uses a DB:
00060     MSG("Calib",Msg::kInfo) << "Touching all databases with context" << context.AsString() << endl;
00061     PlexHandle plex(context);
00062     UgliGeomHandle ugli(context);
00063     Calibrator::Instance().Reset(context);    
00064   }
00065 
00066   return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00067 }
00068 
00069 
00070 

Generated on Sat Nov 21 22:45:51 2009 for loon by  doxygen 1.3.9.1