CheckND Class Reference

#include <CheckND.h>

Inheritance diagram for CheckND:
JobCModule

List of all members.

Public Member Functions

 CheckND ()
 ~CheckND ()
JobCResult Ana (const MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)

Private Attributes

TH1 * fRawHist
TH1 * fAdcHist
TH1 * fHitHist

Detailed Description

Definition at line 19 of file CheckND.h.


Constructor & Destructor Documentation

CheckND::CheckND (  ) 

Definition at line 39 of file CheckND.cxx.

References fAdcHist, fHitHist, and fRawHist.

00040 {
00041   fRawHist=fAdcHist=fHitHist=0;
00042 }

CheckND::~CheckND (  ) 

Definition at line 46 of file CheckND.cxx.

References fAdcHist, and fHitHist.

00047 {
00048   TFile f("checknd.root","RECREATE");
00049   if(fAdcHist) fAdcHist->Write();
00050   if(fHitHist) fHitHist->Write();
00051   f.Write();
00052   f.Close();
00053 }


Member Function Documentation

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

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 57 of file CheckND.cxx.

References fAdcHist, fHitHist, fRawHist, RawDigit::GetADC(), RawDigitDataBlock::GetDatumIter(), VldTimeStamp::GetNanoSec(), VldTimeStamp::GetSec(), RawDigit::GetTDC(), RawDaqSnarlHeader::GetTrigSrc(), header, SpillTimeFinder::Instance(), JobCResult::kPassed, RawDigitDataBlock::SetDebugFlags(), and TRIGGER_BIT_SPILL.

00058 {
00059 
00060   static int latch53 = 0;
00061 
00062   const RawDaqSnarlHeader* header = 
00063     DataUtil::GetRawHeader<RawDaqSnarlHeader>(mom);
00064   if(header) {
00065     if((header->GetTrigSrc() & TRIGGER_BIT_SPILL)>0) {
00066 
00067       const RawDigitDataBlock* rddb = 
00068         DataUtil::GetRawBlock<RawDigitDataBlock>(mom);
00069       
00070       if(rddb) {
00071         
00072         rddb->SetDebugFlags(0);
00073         if(!fRawHist) fRawHist = new TH1F("hRaw","hRaw",5400000,0,54e6);
00074         if(!fAdcHist) fAdcHist = new TH1F("hAdc","hAdc",3000,-1000,2000);
00075         if(!fHitHist) fHitHist = new TH1F("hHit","hHit",3000,-1000,2000);
00076         
00077         fRawHist->Reset();
00078 
00079         double hits = 0;
00080         double ntdc = 0;
00081         double qtdc = 0;
00082         double q = 0;
00083         int first_tdc = 54000000;
00084         
00085         RawDigit *rawdigit;
00086         TIter iter = rddb->GetDatumIter();
00087         TObject* tobj;
00088         while( (tobj=iter.Next() ) ) {
00089           if( ( rawdigit = dynamic_cast<RawDigit*>(tobj) ) ) {;
00090             RawDigit* rawdigit = dynamic_cast<RawDigit*>(tobj);
00091             fRawHist->Fill(rawdigit->GetTDC(),rawdigit->GetADC());
00092             fAdcHist->Fill(rawdigit->GetTDC()-latch53,rawdigit->GetADC());
00093             fHitHist->Fill(rawdigit->GetTDC()-latch53);
00094             hits +=1;
00095             ntdc += rawdigit->GetTDC();
00096             qtdc += rawdigit->GetTDC()*rawdigit->GetADC();
00097             q    += rawdigit->GetADC();
00098             if(rawdigit->GetTDC() < first_tdc) first_tdc = rawdigit->GetTDC();
00099           }
00100         }
00101         cout << "Caught spill: "
00102              << "hits: " << hits
00103              << "\tq: " << q
00104              << "\tntdc: " << ntdc/hits
00105              << "\tqtdc: " << qtdc/q
00106              << "\tfirst: "  << first_tdc
00107              << "\tfirst-latch: "  << first_tdc-latch53
00108              << endl;
00109       }
00110     }
00111   }
00112   
00113   const std::vector<const RawVtmTimeInfoBlock*> vtmBlocks = 
00114     DataUtil::GetRawBlocks<RawVtmTimeInfoBlock>(mom);
00115   
00116   if(vtmBlocks.size()>0) {
00117 
00118     //for(UInt_t i=0;i<vtmBlocks.size(); i++) {
00119     //  vtmBlocks[i]->Print();
00120     // }
00121     
00122     // Find if a new value has been latched.
00123     static int sLast10MHz =0;
00124     if(vtmBlocks[0]->GetSpillTimeGPS() != sLast10MHz) {
00125       
00126       sLast10MHz = vtmBlocks[0]->GetSpillTimeGPS();
00127       
00128       // Get time to nearest spill.
00129       VldContext cx = vtmBlocks[0]->GetVldContext();
00130       VldTimeStamp spill = SpillTimeFinder::Instance().
00131         GetTimeOfRecentSpill(cx);
00132       
00133       int nsec_spill = spill.GetNanoSec();
00134       int nsec_10MHz = (int)(1e9*(double)vtmBlocks[0]->GetSpillTimeGPS()/10e6);
00135       int nsec_53MHz = (int)(1e9*(double)vtmBlocks[0]->GetSpillTimeRF()
00136                              /(double)vtmBlocks[0]->GetLastTimeStamp());
00137       
00138       static double offset_tot=0;
00139       static double nspill = 0;
00140 
00141       offset_tot +=  nsec_spill-nsec_10MHz;
00142       nspill += 1;
00143       
00144       std::cout << "Sec: " << spill.GetSec()
00145                 << "\tGPS latch: " << nsec_10MHz
00146                 << "\t RF latch: " << nsec_53MHz
00147                 << "\t spill: " << nsec_spill
00148                 << "\t spill-gps: " << nsec_spill-nsec_10MHz
00149                 << "\t GPS-RF: " << nsec_10MHz - nsec_53MHz
00150                 << std::endl;
00151       std::cout << "Avg spill-gps: " << offset_tot / nspill << endl;
00152 
00153 
00154       latch53 = vtmBlocks[0]->GetSpillTimeRF();
00155     }
00156   } 
00157   
00158   return JobCResult::kPassed;
00159 }

void CheckND::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 187 of file CheckND.cxx.

00188 {
00189 //======================================================================
00190 // Configure the module given the Registry r
00191 //======================================================================
00192 
00193 }

const Registry & CheckND::DefaultConfig ( void   )  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 163 of file CheckND.cxx.

References JobCModule::GetName(), Registry::LockValues(), and Registry::UnLockValues().

00164 {
00165 //======================================================================
00166 // Supply the default configuration for the module
00167 //======================================================================
00168   static Registry r; // Default configuration for module
00169 
00170   // Set name of config
00171   std::string name = this->GetName();
00172   name += ".config.default";
00173   r.SetName(name.c_str());
00174 
00175   // Set values in configuration
00176   r.UnLockValues();
00177 
00178 
00179 
00180   r.LockValues();
00181 
00182   return r;
00183 }


Member Data Documentation

TH1* CheckND::fAdcHist [private]

Definition at line 36 of file CheckND.h.

Referenced by Ana(), CheckND(), and ~CheckND().

TH1* CheckND::fHitHist [private]

Definition at line 37 of file CheckND.h.

Referenced by Ana(), CheckND(), and ~CheckND().

TH1* CheckND::fRawHist [private]

Definition at line 35 of file CheckND.h.

Referenced by Ana(), and CheckND().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1