ClockCalibrationModule Class Reference

#include <ClockCalibrationModule.h>

Inheritance diagram for ClockCalibrationModule:
JobCModule

List of all members.

Public Member Functions

 ClockCalibrationModule ()
virtual ~ClockCalibrationModule ()
virtual JobCResult Ana (const MomNavigator *mom)
virtual void BeginJob ()
virtual void EndJob ()

Private Member Functions

virtual void IncrementSnarlCounter ()
virtual void ResetSnarlCounter ()
virtual void RunNumber (const Int_t runNumber)
virtual Int_t RunNumber () const

Private Attributes

Int_t fSnarlCounter
Int_t fRunNumber
TGraph * fCalibrationGraph
TH2D * fCalibrationPlot

Detailed Description

Definition at line 26 of file ClockCalibrationModule.h.


Constructor & Destructor Documentation

ClockCalibrationModule::ClockCalibrationModule (  ) 

Definition at line 31 of file ClockCalibrationModule.cxx.

00032   : fSnarlCounter(0)
00033 {
00034   fCalibrationPlot = new TH2D("CalibrationPlot","",
00035                               1000,0,1e9,
00036                               1000,0,70e3);
00037   fCalibrationGraph = new TGraph();
00038 }

ClockCalibrationModule::~ClockCalibrationModule (  )  [virtual]

Definition at line 41 of file ClockCalibrationModule.cxx.

References fCalibrationGraph, and fCalibrationPlot.

00042 {
00043   if (fCalibrationPlot){delete fCalibrationPlot; fCalibrationPlot = 0;}
00044   if (fCalibrationGraph){delete fCalibrationGraph; fCalibrationGraph = 0;}
00045 }


Member Function Documentation

JobCResult ClockCalibrationModule::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 48 of file ClockCalibrationModule.cxx.

References NtpSRTimeStatus::crate_t0_ns, fCalibrationGraph, fCalibrationPlot, fSnarlCounter, MomNavigator::GetFragment(), RecRecordImp< T >::GetHeader(), VldTimeStamp::GetNanoSec(), RecDataHeader::GetRun(), SpillTimeFinder::GetTimeOfNearestSpill(), VldContext::GetTimeStamp(), RecHeader::GetVldContext(), IncrementSnarlCounter(), SpillTimeFinder::Instance(), JobCResult::kFailed, JobCResult::kPassed, Msg::kWarning, MSG, RunNumber(), and NtpStRecord::timestatus.

00049 {
00050 
00051   //Does mom exist?
00052   if (!mom){
00053     MSG("ClockCalibrationModule",Msg::kWarning)
00054       << "No Mom found. Asserting." << endl;
00055   }
00056 
00057   //Get hold of the NtpStRecord
00058   const NtpStRecord* ntpSt = dynamic_cast<NtpStRecord*>
00059     (mom->GetFragment("NtpStRecord"));
00060   if (!ntpSt){
00061     MSG("ClockCalibrationModule",Msg::kWarning)
00062       << "No NtpStRecord found in Mom" << endl;
00063     return JobCResult::kFailed;
00064   }
00065 
00066   //Get hold of the RecCandHeader, which holds the time of the snarl
00067   //(defined by the time, according to the ND 53 MHz clock, of the
00068   //first digit above threshold in the spill).
00069   const RecCandHeader& rec = ntpSt->GetHeader();
00070   this->RunNumber(rec.GetRun());
00071   VldContext ndSpillContext = rec.GetVldContext();
00072   Int_t ndSpillNanoSec = ndSpillContext.GetTimeStamp().GetNanoSec();
00073 
00074   SpillTimeFinder& spillFinder = SpillTimeFinder::Instance();
00075   VldTimeStamp gpsSpillTime = spillFinder.GetTimeOfNearestSpill(ndSpillContext);
00076   Int_t gpsSpillNanoSec = gpsSpillTime.GetNanoSec();
00077   Int_t crateT0NanoSec = ntpSt->timestatus.crate_t0_ns;
00078 
00079   fCalibrationPlot->Fill(ndSpillNanoSec,
00080                          ndSpillNanoSec-gpsSpillNanoSec-crateT0NanoSec);
00081   fCalibrationGraph->SetPoint(fSnarlCounter,
00082                               ndSpillNanoSec,
00083                               ndSpillNanoSec-gpsSpillNanoSec-crateT0NanoSec);
00084 
00085   this->IncrementSnarlCounter();
00086   return JobCResult::kPassed;
00087 }

void ClockCalibrationModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 90 of file ClockCalibrationModule.cxx.

References ResetSnarlCounter().

00091 {
00092   this->ResetSnarlCounter();
00093 }

void ClockCalibrationModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 96 of file ClockCalibrationModule.cxx.

References fCalibrationGraph, fCalibrationPlot, Form(), and RunNumber().

00097 {
00098   string fileName = Form("TheHistogram%d.root", this->RunNumber());
00099   TFile f(fileName.c_str(), "RECREATE");
00100   fCalibrationPlot->Write();
00101   fCalibrationGraph->Write("CalibrationGraph");
00102   f.Close();
00103 }

virtual void ClockCalibrationModule::IncrementSnarlCounter (  )  [inline, private, virtual]

Definition at line 37 of file ClockCalibrationModule.h.

References fSnarlCounter.

Referenced by Ana().

00037 {++fSnarlCounter;};

virtual void ClockCalibrationModule::ResetSnarlCounter (  )  [inline, private, virtual]

Definition at line 38 of file ClockCalibrationModule.h.

References fSnarlCounter.

Referenced by BeginJob().

00038 {fSnarlCounter = 0;};

virtual Int_t ClockCalibrationModule::RunNumber (  )  const [inline, private, virtual]

Definition at line 40 of file ClockCalibrationModule.h.

References fRunNumber.

Referenced by Ana(), and EndJob().

00040 {return fRunNumber;};

virtual void ClockCalibrationModule::RunNumber ( const Int_t  runNumber  )  [inline, private, virtual]

Definition at line 39 of file ClockCalibrationModule.h.

References fRunNumber.

00039 {fRunNumber = runNumber;};


Member Data Documentation

Definition at line 44 of file ClockCalibrationModule.h.

Referenced by Ana(), EndJob(), and ~ClockCalibrationModule().

Definition at line 45 of file ClockCalibrationModule.h.

Referenced by Ana(), EndJob(), and ~ClockCalibrationModule().

Definition at line 43 of file ClockCalibrationModule.h.

Referenced by RunNumber().

Definition at line 40 of file ClockCalibrationModule.h.

Referenced by Ana(), IncrementSnarlCounter(), and ResetSnarlCounter().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1