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

SelectSpillTimes.cxx

Go to the documentation of this file.
00001 
00002 // $Id: SelectSpillTimes.cxx,v 1.3 2007/02/27 14:36:43 tagg Exp $
00003 //
00004 // Filter module to select events that are close in time to a spill
00005 //
00006 //
00007 // n.tagg1@physics.ox.ac.uk
00009 #include "SpillTiming/SelectSpillTimes.h"
00010 #include "MessageService/MsgService.h"
00011 #include "MinosObjectMap/MomNavigator.h"
00012 #include "JobControl/JobCModuleRegistry.h" // For JOBMODULE macro
00013 #include "RawData/RawRecord.h"
00014 #include "RawData/RawDaqSnarlHeader.h"
00015 #include "SpillTiming/SpillTimeFinder.h"
00016 #include <cmath>
00017 #include "TMath.h"
00018 
00019 JOBMODULE(SelectSpillTimes, "SelectSpillTimes",
00020           "Passes ND SGATE events. Fails non-SGATE events.");
00021 CVSID("$Id: SelectSpillTimes.cxx,v 1.3 2007/02/27 14:36:43 tagg Exp $");
00022 //......................................................................
00023 
00024 SelectSpillTimes::SelectSpillTimes()
00025 {
00026   fWindow = 100e-6;
00027 }
00028 
00029 //......................................................................
00030 
00031 SelectSpillTimes::~SelectSpillTimes()
00032 {
00033 }
00034 
00035 //......................................................................
00036 
00037 JobCResult SelectSpillTimes::Ana(const MomNavigator* mom)
00038 {
00044 
00045   JobCResult result;
00046 
00047   // Find raw data.
00048   const RawRecord* rr = dynamic_cast<const RawRecord*>(mom->GetFragment("RawRecord"));
00049   if(rr==0){
00050     MSG("SpillTiming",Msg::kInfo) << "No RawRecord in mom" << endl;
00051     result.SetWarning();
00052     return result;
00053   }
00054 
00055   const RawDaqSnarlHeader* snarlHead= dynamic_cast<const RawDaqSnarlHeader*>(rr->GetRawHeader());
00056   if(snarlHead==0) {
00057     MSG("SpillTiming",Msg::kInfo) << "No Snarl header in RawRecord." << endl;
00058     result.SetWarning();
00059     return result;
00060   }
00061   
00062   VldContext context = snarlHead->GetVldContext();
00063 
00064   SpillTimeFinder& finder = SpillTimeFinder::Instance();
00065   
00066   double t = finder.GetTimeToNearestSpill(context);
00067 
00068   if(TMath::Abs(t)<fWindow) result.SetPassed();
00069   else result.SetFailed();
00070     
00071   return result;
00072 }
00073 
00074 
00075 const Registry& SelectSpillTimes::DefaultConfig() const
00076 {
00077   static Registry r;
00078   std::string name=this->GetName();
00079   name += ".config.default";
00080   r.SetName(name.c_str());
00081 
00082   r.UnLockValues();
00083 
00084   r.Set("Window",100e-6);
00085   return r;
00086 }
00087 
00088 void  SelectSpillTimes::Config(const Registry& r)
00089 {
00090   r.Get("Window",fWindow);
00091 }
00092 

Generated on Mon Feb 15 11:07:34 2010 for loon by  doxygen 1.3.9.1