FiltMBSpillModule Class Reference

#include <FiltMBSpillModule.h>

Inheritance diagram for FiltMBSpillModule:

JobCModule List of all members.

Public Member Functions

 FiltMBSpillModule ()
 ~FiltMBSpillModule ()
void BeginJob ()
void EndJob ()
void BeginFile ()
void EndFile ()
void BeginRun ()
void EndRun ()
JobCResult Ana (const MomNavigator *mom)
JobCResult Reco (MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)
void Report ()
void Reset ()
void HandleCommand (JobCommand *c)

Private Attributes

Double_t fTWin
Int_t fTrigMask
std::vector< VldTimeStampvts
std::vector< VldTimeStamp
>::iterator 
itrts

Detailed Description

Id
FiltMBSpillModule.h,v 1.2 2007/01/20 17:54:08 rhatcher Exp

(Document me!)

Simona Murgia, murgia@slac.stanford.edu

Definition at line 14 of file FiltMBSpillModule.h.


Constructor & Destructor Documentation

FiltMBSpillModule::FiltMBSpillModule (  ) 

Definition at line 37 of file FiltMBSpillModule.cxx.

00037                                      : 
00038   fTWin(0.0),
00039   fTrigMask(0)
00040 {
00044 
00045   // vector of timestamps to store miniboone data:
00046 }

FiltMBSpillModule::~FiltMBSpillModule (  ) 

Definition at line 49 of file FiltMBSpillModule.cxx.

00050 {
00054 }


Member Function Documentation

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

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 111 of file FiltMBSpillModule.cxx.

References bfld::AsString(), VldTimeStamp::AsString(), MomNavigator::FragmentIter(), fTrigMask, fTWin, MBSpillAccessor::Get(), RecMinos::GetHeader(), MBSpill::GetNanoSec(), VldTimeStamp::GetNanoSec(), RawRecord::GetRawBlockIter(), RawDaqHeader::GetRun(), MBSpill::GetSec(), VldTimeStamp::GetSec(), RawDaqSnarlHeader::GetSnarl(), MBSpill::GetTimeStamp(), RawSnarlHeaderBlock::GetTriggerTime(), RawDaqSnarlHeader::GetTrigSrc(), Msg::kDebug, JobCResult::kFailed, JobCResult::kPassed, MBSpillAccessor::LoadSpill(), MSG, and run().

00112 {
00118 
00119   JobCResult result = JobCResult::kFailed;
00120   TObject* recObj = 0;
00121   int    nrawrec=0;
00122   int    nrawblk=0;
00123   int    nsnarlblk=0;
00124   int trgsrc=0;
00125   VldTimeStamp vldts;  
00126   time_t trgsec;
00127   int trgnsec;
00128 
00129   int snarl;
00130   int run;
00131 
00132   double dt = -9e9;
00133   int mbsec;
00134   int mbnsec;
00135 
00136   // Loop over rawrecords
00137   TIter recItr = mom->FragmentIter();
00138   while ( ( recObj = recItr.Next() ) ) {
00139     RawRecord* rawrec = dynamic_cast<RawRecord*>(recObj);
00140     if (!rawrec) continue;  // skip things in mom that aren't RawRecords
00141     nrawrec++;
00142 
00143     // Get trigger source
00144     const RawDaqSnarlHeader* snarlHdr = 
00145       dynamic_cast<const RawDaqSnarlHeader*>(rawrec->GetHeader());
00146     if ( snarlHdr ) {
00147       trgsrc =  snarlHdr->GetTrigSrc();
00148       run = snarlHdr->GetRun();
00149       snarl = snarlHdr->GetSnarl();
00150     } // snarl header
00151 
00152     // Loop over rawblocks
00153     TObject* blkObj = 0;
00154     TIter blkItr = rawrec->GetRawBlockIter();
00155     while ( ( blkObj = blkItr.Next() ) ) {
00156       const RawDataBlock* rawBlk = dynamic_cast<const RawDataBlock*>(blkObj);
00157       if (!rawBlk) continue;  
00158       nrawblk++;
00159     
00160       // Get trigger time
00161       const RawSnarlHeaderBlock* snarlblk = 
00162         dynamic_cast<const RawSnarlHeaderBlock*>(rawBlk);
00163       if (!snarlblk) continue;
00164       nsnarlblk++;
00165       vldts = snarlblk->GetTriggerTime();
00166       trgsec = vldts.GetSec();
00167       trgnsec = vldts.GetNanoSec();
00168     
00169     
00170       VldTimeStamp tmpnd=vldts;
00171       
00172       //get MinoBooNE spill
00173       MBSpillAccessor& spillAccess = MBSpillAccessor::Get();
00174       
00175       const MBSpill *spillInfo = spillAccess.LoadSpill(vldts);
00176       if (spillInfo) {
00177         dt = double(spillInfo->GetTimeStamp()-vldts);
00178         mbsec = spillInfo->GetSec();
00179         mbnsec = spillInfo->GetNanoSec();
00180       }
00181     
00182     
00183       //Select "good" snarl here. Good means: inside MB spill window and allowed trigger source
00184       // Cosmic (M/N = 4 (hex=4); Activity = 16 (hex=10)) or SGATE (65536) trigger source:
00185       if (trgsrc & fTrigMask) {
00186         
00187         if (TMath::Abs(dt)<fTWin) {
00188           MSG("Filt",Msg::kDebug) << "-------------------------------------------------" << endl;
00189           MSG("Filt",Msg::kDebug) << "ND snarl within +-" << fTWin << " seconds of MiniBooNE spill. The trigger source is: " << trgsrc << endl;
00190           MSG("Filt",Msg::kDebug) << "Run, Snarl: " << run << ", " << snarl << endl;
00191           MSG("Filt",Msg::kDebug) << "dt(MB-MINOS snarl)= " << TMath::Abs(dt) <<" seconds"<< endl;
00192           MSG("Filt",Msg::kDebug) << "ND vldtimestamp in sec, nsec, double: " << vldts.GetSec() << ", " << vldts.GetNanoSec() << ", " << vldts.AsString() << endl;
00193           MSG("Filt",Msg::kDebug) << "MB vldtimestamp in sec, nsec, double: " << mbsec << ", " << mbnsec << ", " << (spillInfo->GetTimeStamp()).AsString() << endl;
00194           result = JobCResult::kPassed;
00195         }  
00196       }
00197     
00198     } // loop over blocks
00199   }  // loop over records
00200 
00201 //  MSG("Filt",Msg::kDebug) << 
00202 //    nrawrec << " rawrecords found " << 
00203 //    nrawblk << " rawblocks found " << 
00204 //    nsnarlblk << " snarlblocks found " << endl;
00205 
00206   return result; // kNoDecision, kFailed, etc.
00207 
00208 
00209 
00210 }

void FiltMBSpillModule::BeginFile (  )  [virtual]

Implement for notification of begin of file. See GetCurrentFile().

Reimplemented from JobCModule.

Definition at line 75 of file FiltMBSpillModule.cxx.

00076 {
00080 }

void FiltMBSpillModule::BeginJob (  )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 58 of file FiltMBSpillModule.cxx.

00059 {
00060  
00061 
00062 }

void FiltMBSpillModule::BeginRun (  )  [virtual]

Implement for notification of begin of run (meaningful for Daq data only). See GetCurrentRun().

Reimplemented from JobCModule.

Definition at line 93 of file FiltMBSpillModule.cxx.

00094 {
00098 }

void FiltMBSpillModule::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 265 of file FiltMBSpillModule.cxx.

References fTrigMask, fTWin, Registry::GetDouble(), and Registry::GetInt().

00266 {
00270   fTWin = r.GetDouble("TWin");
00271   fTrigMask = r.GetInt("TrigMask");
00272 }

const Registry & FiltMBSpillModule::DefaultConfig (  )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 224 of file FiltMBSpillModule.cxx.

References MuELoss::e, JobCModule::GetName(), Registry::LockValues(), Registry::Set(), TRIGGER_BIT_ACTIVITY, TRIGGER_BIT_PLANE, TRIGGER_BIT_SPILL, and Registry::UnLockValues().

00225 {
00229   static Registry r; // Default configuration for module
00230 
00231   // Set name of config
00232   std::string name = this->GetName();
00233   name += ".config.default";
00234   r.SetName(name.c_str());
00235 
00236   // Set values in configuration
00237   r.UnLockValues();
00238   r.Set("TWin",     1.0e-3);
00239 
00240   Int_t thisTrigMask = 0;
00241 
00242   // From OnlineUtil/mdTriggerCodes.h:
00243   // TRIGGER_BIT_NULL         0x1  /* Dump of Time Frame - ie singles */
00244   // TRIGGER_BIT_RAWLI        0x2  /* Raw LI events */
00245   // TRIGGER_BIT_PLANE        0x4  /* M/N Plane Trigger */
00246   // TRIGGER_BIT_TOF          0x8  /* Time Of Flight Trigger */
00247   // TRIGGER_BIT_ACTIVITY    0x10  /* Detector Activity Trigger */
00248   // TRIGGER_BIT_E4          0x20  /* E4 Trigger */
00249   // TRIGGER_BIT_MINBIAS   0x8000  /* Minimum Bias Sampling Trigger */
00250   // TRIGGER_BIT_SPILL    0x10000  /* Spill Trigger */
00251   // TRIGGER_BIT_SPILL_IP 0x20000  /* Remote Spill Trigger - ie spill over IP */
00252   thisTrigMask |= TRIGGER_BIT_PLANE;
00253   thisTrigMask |= TRIGGER_BIT_ACTIVITY;
00254   thisTrigMask |= TRIGGER_BIT_SPILL;
00255   //  cout << "Trigger mask set to: " << thisTrigMask << endl;
00256   
00257   r.Set("TrigMask", thisTrigMask);
00258   r.LockValues();
00259 
00260   return r;
00261 }

void FiltMBSpillModule::EndFile (  )  [virtual]

Implement for notification of end of file. See GetLastFile().

Reimplemented from JobCModule.

Definition at line 84 of file FiltMBSpillModule.cxx.

00085 {
00089 }

void FiltMBSpillModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 66 of file FiltMBSpillModule.cxx.

00067 {
00071 }

void FiltMBSpillModule::EndRun (  )  [virtual]

Implement for notification of end of run (meaningful for Daq data only). See GetLastRun().

Reimplemented from JobCModule.

Definition at line 102 of file FiltMBSpillModule.cxx.

00103 {
00107 }

void FiltMBSpillModule::HandleCommand ( JobCommand c  )  [virtual]

Implement to handle a JobCommand

Reimplemented from JobCModule.

Definition at line 294 of file FiltMBSpillModule.cxx.

00295 {
00299 }

JobCResult FiltMBSpillModule::Reco ( MomNavigator mom  )  [virtual]

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 214 of file FiltMBSpillModule.cxx.

References JobCResult::kPassed.

00215 {
00219   return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00220 }

void FiltMBSpillModule::Report (  )  [virtual]

Implement to spew end of running report

Reimplemented from JobCModule.

Definition at line 276 of file FiltMBSpillModule.cxx.

00277 {
00281 }

void FiltMBSpillModule::Reset (  )  [virtual]

Implement to reset oneself

Reimplemented from JobCModule.

Definition at line 285 of file FiltMBSpillModule.cxx.

00286 {
00290 }


Member Data Documentation

Int_t FiltMBSpillModule::fTrigMask [private]

Definition at line 46 of file FiltMBSpillModule.h.

Referenced by Ana(), and Config().

Double_t FiltMBSpillModule::fTWin [private]

Definition at line 45 of file FiltMBSpillModule.h.

Referenced by Ana(), and Config().

std::vector<VldTimeStamp>::iterator FiltMBSpillModule::itrts [private]

Definition at line 50 of file FiltMBSpillModule.h.

std::vector<VldTimeStamp> FiltMBSpillModule::vts [private]

Definition at line 49 of file FiltMBSpillModule.h.


The documentation for this class was generated from the following files:
Generated on Mon Nov 10 00:55:29 2014 for loon by  doxygen 1.4.7