Hall C ROOT/C++ Analyzer (hcana)
THcTimeSyncEvtHandler Class Reference

Event handler to check TI and FADC synchronization.

Check syncronization of 4ns clock times recorded by the TIs and the FADCs. Also can be used to detect CAEN1190 TDC syncronization problems and write out a new coda file that corrects the synchronization. (These TDC synchronization problems were occuring in the spring of 2018.)

This event handler is typically not used in normal anlysis scripts. It is used with custom to check suspect runs and write synchronization corrected data files.

To use as a plugin, add to the analysis script:

THcTimeSyncEvtHandler *timesync = new THcTimeSyncEvtHandler("timesync","ADC/TI Time synchrnoziation")); timesync->AddEvtType(1); timesync->AddEvtType(2); ... gHaEvtHandlers->Add(timesync);

Assumes that all FADCs are in banks with the tag 250 and all TIblob banks are tag 4. And that these banks are contained without further structure in ROC banks. Also asssumes that the only banks containing banks are ROC banks.

Author
Stephen Wood (saw@j.nosp@m.lab..nosp@m.org)

Definition at line 19 of file THcTimeSyncEvtHandler.h.

Classes

struct  RocStats
 
struct  RocTimes
 

Public Member Functions

virtual void AddExpectedOffset (Int_t roc, Int_t offset)
 
virtual Int_t AllTdcsPresent (UInt_t *bank)
 
virtual Int_t Analyze (THaEvData *evdata)
 
virtual Int_t End (THaRunBase *r=0)
 
virtual EStatus Init (const TDatime &run_time)
 
virtual void PrintStats ()
 
virtual void SetBadROC (Int_t roc)
 
virtual void SetBadSyncSizeTrigger (Int_t sizetrigger)
 
virtual void SetExpectedOffset (Int_t roc, Int_t offset)
 
virtual void SetResync (Bool_t b)
 
virtual Int_t SetRewriteFile (const char *filename)
 
 THcTimeSyncEvtHandler (const char *name, const char *description)
 
virtual ~THcTimeSyncEvtHandler ()
 

Private Types

typedef struct THcTimeSyncEvtHandler::RocStats RocStats_t
 
typedef struct THcTimeSyncEvtHandler::RocTimes RocTimes_t
 

Private Member Functions

virtual void AccumulateStats (Bool_t sync)
 
virtual void InitStats ()
 
THcTimeSyncEvtHandleroperator= (const THcTimeSyncEvtHandler &fh)
 
 THcTimeSyncEvtHandler (const THcTimeSyncEvtHandler &fh)
 

Private Attributes

std::map< Int_t, RocStats_t * > CrateStatsMap
 
std::map< Int_t, RocTimes_t * > CrateTimeMap
 
std::map< Int_t, Int_tExpectedOffsetMap
 
Int_t fBadROC
 
Int_t fBadSyncSizeTrigger
 
Decoder::THaCodaFilefCodaOut
 
Int_t fDumpNew
 
Bool_t fFirstTdcCheck
 
Bool_t fFirstTime
 
UInt_t fLastEvent [32000]
 
Bool_t fLastEventWasSync
 
Int_t fMasterRoc
 
Int_t fNEvents
 
Bool_t fResync
 
Int_t fSlippage
 
UInt_t fSlippingBank [32000]
 
UInt_t fTdcMask
 
Bool_t fWriteDelayed
 
Int_t handle
 

#include <THcTimeSyncEvtHandler.h>

Inheritance diagram for THcTimeSyncEvtHandler:

Member Typedef Documentation

Constructor & Destructor Documentation

THcTimeSyncEvtHandler::THcTimeSyncEvtHandler ( const char *  name,
const char *  description 
)

Definition at line 57 of file THcTimeSyncEvtHandler.cxx.

THcTimeSyncEvtHandler::~THcTimeSyncEvtHandler ( )
virtual

Definition at line 68 of file THcTimeSyncEvtHandler.cxx.

THcTimeSyncEvtHandler::THcTimeSyncEvtHandler ( const THcTimeSyncEvtHandler fh)
private

Member Function Documentation

void THcTimeSyncEvtHandler::AccumulateStats ( Bool_t  sync)
privatevirtual

Definition at line 402 of file THcTimeSyncEvtHandler.cxx.

void THcTimeSyncEvtHandler::AddExpectedOffset ( Int_t  roc,
Int_t  offset 
)
virtual

Definition at line 496 of file THcTimeSyncEvtHandler.cxx.

Int_t THcTimeSyncEvtHandler::AllTdcsPresent ( UInt_t bank)
virtual

Check that all the 1190 TDCs that should be present are there.

Return codes: 0: All TDCs present 1: TDCs missing at high end of crate 2: TDCs missing at low end of crate 3: Other arrangement of missing

Definition at line 559 of file THcTimeSyncEvtHandler.cxx.

Int_t THcTimeSyncEvtHandler::Analyze ( THaEvData evdata)
virtual

Definition at line 81 of file THcTimeSyncEvtHandler.cxx.

Int_t THcTimeSyncEvtHandler::End ( THaRunBase *  r = 0)
virtual

Definition at line 532 of file THcTimeSyncEvtHandler.cxx.

THaAnalysisObject::EStatus THcTimeSyncEvtHandler::Init ( const TDatime run_time)
virtual

Definition at line 500 of file THcTimeSyncEvtHandler.cxx.

void THcTimeSyncEvtHandler::InitStats ( )
privatevirtual

Initialize structure to hold statistics Record the offset of each TI and FADC time relative to the trigger time of the master TI.

Definition at line 346 of file THcTimeSyncEvtHandler.cxx.

THcTimeSyncEvtHandler& THcTimeSyncEvtHandler::operator= ( const THcTimeSyncEvtHandler fh)
private
void THcTimeSyncEvtHandler::PrintStats ( )
virtual

Definition at line 453 of file THcTimeSyncEvtHandler.cxx.

virtual void THcTimeSyncEvtHandler::SetBadROC ( Int_t  roc)
inlinevirtual

Definition at line 33 of file THcTimeSyncEvtHandler.h.

virtual void THcTimeSyncEvtHandler::SetBadSyncSizeTrigger ( Int_t  sizetrigger)
inlinevirtual

Definition at line 35 of file THcTimeSyncEvtHandler.h.

void THcTimeSyncEvtHandler::SetExpectedOffset ( Int_t  roc,
Int_t  offset 
)
virtual

Definition at line 492 of file THcTimeSyncEvtHandler.cxx.

virtual void THcTimeSyncEvtHandler::SetResync ( Bool_t  b)
inlinevirtual

Definition at line 34 of file THcTimeSyncEvtHandler.h.

Int_t THcTimeSyncEvtHandler::SetRewriteFile ( const char *  filename)
virtual

Definition at line 539 of file THcTimeSyncEvtHandler.cxx.

Member Data Documentation

std::map<Int_t, RocStats_t *> THcTimeSyncEvtHandler::CrateStatsMap
private

Definition at line 94 of file THcTimeSyncEvtHandler.h.

std::map<Int_t, RocTimes_t *> THcTimeSyncEvtHandler::CrateTimeMap
private

Definition at line 93 of file THcTimeSyncEvtHandler.h.

std::map<Int_t, Int_t> THcTimeSyncEvtHandler::ExpectedOffsetMap
private

Definition at line 95 of file THcTimeSyncEvtHandler.h.

Int_t THcTimeSyncEvtHandler::fBadROC
private

Definition at line 50 of file THcTimeSyncEvtHandler.h.

Int_t THcTimeSyncEvtHandler::fBadSyncSizeTrigger
private

Definition at line 52 of file THcTimeSyncEvtHandler.h.

Decoder::THaCodaFile* THcTimeSyncEvtHandler::fCodaOut
private

Definition at line 57 of file THcTimeSyncEvtHandler.h.

Int_t THcTimeSyncEvtHandler::fDumpNew
private

Definition at line 49 of file THcTimeSyncEvtHandler.h.

Bool_t THcTimeSyncEvtHandler::fFirstTdcCheck
private

Definition at line 54 of file THcTimeSyncEvtHandler.h.

Bool_t THcTimeSyncEvtHandler::fFirstTime
private

Definition at line 42 of file THcTimeSyncEvtHandler.h.

UInt_t THcTimeSyncEvtHandler::fLastEvent[32000]
private

Definition at line 46 of file THcTimeSyncEvtHandler.h.

Bool_t THcTimeSyncEvtHandler::fLastEventWasSync
private

Definition at line 53 of file THcTimeSyncEvtHandler.h.

Int_t THcTimeSyncEvtHandler::fMasterRoc
private

Definition at line 43 of file THcTimeSyncEvtHandler.h.

Int_t THcTimeSyncEvtHandler::fNEvents
private

Definition at line 44 of file THcTimeSyncEvtHandler.h.

Bool_t THcTimeSyncEvtHandler::fResync
private

Definition at line 51 of file THcTimeSyncEvtHandler.h.

Int_t THcTimeSyncEvtHandler::fSlippage
private

Definition at line 45 of file THcTimeSyncEvtHandler.h.

UInt_t THcTimeSyncEvtHandler::fSlippingBank[32000]
private

Definition at line 47 of file THcTimeSyncEvtHandler.h.

UInt_t THcTimeSyncEvtHandler::fTdcMask
private

Definition at line 55 of file THcTimeSyncEvtHandler.h.

Bool_t THcTimeSyncEvtHandler::fWriteDelayed
private

Definition at line 48 of file THcTimeSyncEvtHandler.h.

Int_t THcTimeSyncEvtHandler::handle
private

Definition at line 58 of file THcTimeSyncEvtHandler.h.

Collaboration diagram for THcTimeSyncEvtHandler:

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