GRSISort
Created by P.C. Bender
Developement Team: P.C. Bender, R. Dunlop, V. Bildstein
An extension of the ROOT analysis Framework
TPPG Class Reference

The TPPG is designed to hold all of the information about the PPG status.

Definition at line 122 of file TPPG.h.

Public Types

typedef std::map< ULong_t, TPPGData * > PPGMap_t
 

Public Member Functions

 TPPG ()
 
 TPPG (const TPPG &)
 
 ~TPPG () override
 
void Add (const TPPG *ppg)
 
void AddData (TPPGData *pat)
 
void Clear (Option_t *opt="") override
 
void Copy (TObject &obj) const override
 
bool Correct (bool verbose=false)
 
const TPPGDataFirst ()
 
ULong64_t GetCycleLength ()
 
ULong64_t GetCycleNumber (ULong64_t real_time)
 
ULong64_t GetLastStatusTime (ULong64_t time, EPpgPattern pat=EPpgPattern::kJunk) const
 
EPpgPattern GetNextStatus (ULong64_t time) const
 
ULong64_t GetNextStatusTime (ULong64_t time, EPpgPattern pat=EPpgPattern::kJunk) const
 
ULong64_t GetNumberOfCycles ()
 
EPpgPattern GetStatus (ULong64_t time) const
 
ULong64_t GetStatusStart (EPpgPattern)
 
ULong64_t GetTimeInCycle (ULong64_t real_time)
 
const TPPGDataLast ()
 
Bool_t MapIsEmpty () const
 
Long64_t Merge (TCollection *list)
 
const TPPGDataNext ()
 
Long64_t OdbCycleLength () const
 
int OdbDuration (size_t index) const
 
bool OdbMatchesData (bool verbose=false)
 
short OdbPPGCode (size_t index) const
 
std::size_t OdbPPGSize () const
 
void operator+= (const TPPG &rhs)
 
std::size_t PPGSize () const
 
const TPPGDataPrevious ()
 
void Print (Option_t *opt="") const override
 
void SetCycleLength (ULong64_t length)
 
void SetOdbCycle (std::vector< short > ppgCodes, std::vector< int > durations)
 
void SetOdbFromData (bool verbose=false)
 
void Setup ()
 
Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override
 
Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const override
 

Static Public Member Functions

static TPPGAddCurrent ()
 
static TPPGGet (bool verbose=false)
 
static TPPGGetAll ()
 
static void PrintDirectory ()
 
static void Set (TPPG *val)
 

Private Member Functions

bool CalculateCycleFromData (bool verbose=false)
 
PPGMap_t::iterator MapBegin () const
 
PPGMap_t::iterator MapEnd () const
 

Private Attributes

PPGMap_t::iterator fCurrIterator
 
ULong64_t fCycleLength
 
bool fCycleSet {false}
 
std::vector< ULong64_t > fDurations { 0, 0, 0, 0}
 
std::map< ULong64_t, int > fNumberOfCycleLengths
 
std::vector< int > fOdbDurations
 
std::vector< short > fOdbPPGCodes
 
std::vector< short > fPPGCodes {0x8, 0x2, 0x1, 0x4}
 
PPGMap_tfPPGStatusMap
 

Static Private Attributes

static TPPGfPPG = nullptr
 

Friends

class TSingleton< TPPG >
 

#include <TPPG.h>

+ Inheritance diagram for TPPG:
+ Collaboration diagram for TPPG:

Member Typedef Documentation

◆ PPGMap_t

typedef std::map<ULong_t, TPPGData*> TPPG::PPGMap_t

Definition at line 126 of file TPPG.h.

Constructor & Destructor Documentation

◆ TPPG() [1/2]

TPPG::TPPG ( )

Definition at line 61 of file TPPG.cxx.

References Clear(), and fPPGStatusMap.

◆ TPPG() [2/2]

TPPG::TPPG ( const TPPG rhs)

Definition at line 67 of file TPPG.cxx.

References Copy(), and fPPGStatusMap.

◆ ~TPPG()

TPPG::~TPPG ( )
override

Definition at line 73 of file TPPG.cxx.

References Clear(), and fPPGStatusMap.

Member Function Documentation

◆ Add()

void TPPG::Add ( const TPPG ppg)

◆ AddCurrent()

static TPPG * TSingleton< TPPG >::AddCurrent ( )
inlinestaticinherited

Definition at line 137 of file TSingleton.h.

◆ AddData()

void TPPG::AddData ( TPPGData pat)

Adds a PPG status word at a given time in the current run. Makes a copy of the pointer to store in the map.

Definition at line 119 of file TPPG.cxx.

References fCycleLength, fCycleSet, fNumberOfCycleLengths, fPPGStatusMap, and TPPGData::GetTimeStamp().

Referenced by Add(), Clear(), Copy(), TGRSIDataParser::GriffinDataToPPGEvent(), and TTdrDataParser::TdrToFragment().

◆ CalculateCycleFromData()

bool TPPG::CalculateCycleFromData ( bool  verbose = false)
private

Calculate the cycle from the data and store it.

Definition at line 373 of file TPPG.cxx.

References fCycleSet, fDurations, fPPGCodes, GetLastStatusTime(), hex(), kBackground, kBeamOn, kDecay, kTapeMove, MapBegin(), and MapEnd().

Referenced by OdbMatchesData(), and SetOdbFromData().

◆ Clear()

void TPPG::Clear ( Option_t *  opt = "")
override

◆ Copy()

void TPPG::Copy ( TObject &  obj) const
override

Definition at line 88 of file TPPG.cxx.

References AddData(), Clear(), fCurrIterator, fCycleLength, fNumberOfCycleLengths, fOdbDurations, fOdbPPGCodes, and fPPGStatusMap.

Referenced by Setup(), and TPPG().

◆ Correct()

bool TPPG::Correct ( bool  verbose = false)

Correct the map of PPG events by checking that we always have a PPG event with the same status that occured fCycleLength ago.

Definition at line 478 of file TPPG.cxx.

References DBLUE, DRED, fCycleLength, fNumberOfCycleLengths, fPPGStatusMap, GetCycleLength(), GetLastStatusTime(), hex(), MapBegin(), MapEnd(), and RESET_COLOR.

◆ First()

const TPPGData * TPPG::First ( )

Definition at line 591 of file TPPG.cxx.

References fCurrIterator, and MapBegin().

◆ Get()

◆ GetAll()

static TPPG * TSingleton< TPPG >::GetAll ( )
inlinestaticinherited

Definition at line 62 of file TSingleton.h.

◆ GetCycleLength()

ULong64_t TPPG::GetCycleLength ( )

Calculates cycle length from the most often occuring time difference between two PPG events with the same code. The result is also stored in fCycleLength (which prevents a second calculation of it the next time this function is called)

Definition at line 625 of file TPPG.cxx.

References fCycleLength, fNumberOfCycleLengths, GetLastStatusTime(), MapBegin(), and MapEnd().

Referenced by Add(), Correct(), TScaler::Draw(), GetCycleNumber(), GetNumberOfCycles(), GetTimeInCycle(), and TParsingDiagnostics::ReadPPG().

◆ GetCycleNumber()

ULong64_t TPPG::GetCycleNumber ( ULong64_t  real_time)

Returns the cycle number based on "real_time", i.e. the time divided by the cycle length. "real_time" is in ns since that's how we store the PPG timestamps as well.

Definition at line 617 of file TPPG.cxx.

References GetCycleLength().

Referenced by TFragment::GetCycleNumber().

◆ GetLastStatusTime()

ULong64_t TPPG::GetLastStatusTime ( ULong64_t  time,
EPpgPattern  pat = EPpgPattern::kJunk 
) const

Gets the last time that a status was given. If the EPpgPattern kJunk is passed, the current status at the time "time" is looked for. "time" is in ns (since we store the PPG timestamp in ns as well)

Definition at line 129 of file TPPG.cxx.

References fPPGStatusMap, kJunk, and MapIsEmpty().

Referenced by CalculateCycleFromData(), Correct(), GetCycleLength(), TDetectorHit::GetCycleTimeStamp(), TDetectorHit::GetPPGStatus(), GetStatusStart(), TDetectorHit::GetTimeSinceTapeMove(), and Print().

◆ GetNextStatus()

EPpgPattern TPPG::GetNextStatus ( ULong64_t  time) const

Returns the next status of the PPG at the time "time". "time" is in ns (since we store the PPG timestamp in ns as well)

Definition at line 197 of file TPPG.cxx.

References fPPGStatusMap, kJunk, and MapIsEmpty().

◆ GetNextStatusTime()

ULong64_t TPPG::GetNextStatusTime ( ULong64_t  time,
EPpgPattern  pat = EPpgPattern::kJunk 
) const

Gets the next time that a status was given. If the EPpgPattern kJunk is passed, the current status at the time "time" is looked for. "time" is in ns (since we store the PPG timestamp in ns as well)

Definition at line 157 of file TPPG.cxx.

References fPPGStatusMap, kJunk, and MapIsEmpty().

◆ GetNumberOfCycles()

ULong64_t TPPG::GetNumberOfCycles ( )

Definition at line 648 of file TPPG.cxx.

References GetCycleLength(), TPPGData::GetTimeStamp(), and Last().

◆ GetStatus()

EPpgPattern TPPG::GetStatus ( ULong64_t  time) const

Returns the current status of the PPG at the time "time". "time" is in ns (since we store the PPG timestamp in ns as well)

Definition at line 185 of file TPPG.cxx.

References fPPGStatusMap, and MapIsEmpty().

Referenced by TDetectorHit::GetCycleTimeStamp(), and TDetectorHit::GetPPGStatus().

◆ GetStatusStart()

ULong64_t TPPG::GetStatusStart ( EPpgPattern  pat)

return the time in the cycle when pat starts

Definition at line 665 of file TPPG.cxx.

References GetLastStatusTime(), GetTimeInCycle(), and Last().

◆ GetTimeInCycle()

ULong64_t TPPG::GetTimeInCycle ( ULong64_t  real_time)

Returns the time in the cycle based on "real_time", i.e. the modulus of the time and the cycle length. "real_time" is in ns since that's how we store the PPG timestamps as well.

Definition at line 609 of file TPPG.cxx.

References GetCycleLength().

Referenced by TScaler::Draw(), GetStatusStart(), and TFragment::GetTimeInCycle().

◆ Last()

const TPPGData * TPPG::Last ( )

Definition at line 584 of file TPPG.cxx.

References fCurrIterator, and MapEnd().

Referenced by GetNumberOfCycles(), and GetStatusStart().

◆ MapBegin()

PPGMap_t::iterator TPPG::MapBegin ( ) const
inlineprivate

Definition at line 190 of file TPPG.h.

References fPPGStatusMap.

Referenced by Add(), CalculateCycleFromData(), Correct(), First(), GetCycleLength(), Previous(), and Print().

◆ MapEnd()

PPGMap_t::iterator TPPG::MapEnd ( ) const
inlineprivate

Definition at line 191 of file TPPG.h.

References fPPGStatusMap.

Referenced by Add(), CalculateCycleFromData(), Correct(), GetCycleLength(), Last(), Next(), and Print().

◆ MapIsEmpty()

Bool_t TPPG::MapIsEmpty ( ) const

Checks to see if the ppg map is empty. We need this because we need to put a default PPG in at time T=0 to prevent bad things from happening. This function says the map is empty when only the default is there, which it essentially is.

Definition at line 108 of file TPPG.cxx.

References fPPGStatusMap.

Referenced by GetLastStatusTime(), GetNextStatus(), GetNextStatusTime(), GetStatus(), and Print().

◆ Merge()

Long64_t TPPG::Merge ( TCollection *  list)

Definition at line 653 of file TPPG.cxx.

◆ Next()

const TPPGData * TPPG::Next ( )

Definition at line 566 of file TPPG.cxx.

References fCurrIterator, and MapEnd().

◆ OdbCycleLength()

Long64_t TPPG::OdbCycleLength ( ) const
inline

Definition at line 156 of file TPPG.h.

References fOdbDurations.

◆ OdbDuration()

int TPPG::OdbDuration ( size_t  index) const
inline

Definition at line 155 of file TPPG.h.

References fOdbDurations.

◆ OdbMatchesData()

bool TPPG::OdbMatchesData ( bool  verbose = false)

Definition at line 333 of file TPPG.cxx.

References CalculateCycleFromData(), fDurations, fOdbDurations, fOdbPPGCodes, fPPGCodes, and hex().

◆ OdbPPGCode()

short TPPG::OdbPPGCode ( size_t  index) const
inline

Definition at line 154 of file TPPG.h.

References fOdbPPGCodes.

◆ OdbPPGSize()

std::size_t TPPG::OdbPPGSize ( ) const
inline

Definition at line 153 of file TPPG.h.

References fOdbPPGCodes.

Referenced by Write().

◆ operator+=()

void TPPG::operator+= ( const TPPG rhs)

Definition at line 671 of file TPPG.cxx.

References Add().

◆ PPGSize()

std::size_t TPPG::PPGSize ( ) const
inline

Definition at line 152 of file TPPG.h.

References fPPGStatusMap.

Referenced by Write().

◆ Previous()

const TPPGData * TPPG::Previous ( )

Definition at line 575 of file TPPG.cxx.

References fCurrIterator, and MapBegin().

◆ Print()

void TPPG::Print ( Option_t *  opt = "") const
override

◆ PrintDirectory()

static void TSingleton< TPPG >::PrintDirectory ( )
inlinestaticinherited

Definition at line 166 of file TSingleton.h.

◆ Set()

static void TSingleton< TPPG >::Set ( TPPG val)
inlinestaticinherited

Definition at line 129 of file TSingleton.h.

◆ SetCycleLength()

void TPPG::SetCycleLength ( ULong64_t  length)
inline

Definition at line 162 of file TPPG.h.

References fCycleLength.

◆ SetOdbCycle()

void TPPG::SetOdbCycle ( std::vector< short >  ppgCodes,
std::vector< int >  durations 
)
inline

Definition at line 177 of file TPPG.h.

References fOdbDurations, and fOdbPPGCodes.

Referenced by TMidasFile::SetGRIFFOdb().

◆ SetOdbFromData()

void TPPG::SetOdbFromData ( bool  verbose = false)

◆ Setup()

void TPPG::Setup ( )

Definition at line 456 of file TPPG.cxx.

References Copy(), TRunInfo::RunNumber(), and TRunInfo::SubRunNumber().

◆ Write() [1/2]

Int_t TPPG::Write ( const char *  name = nullptr,
Int_t  option = 0,
Int_t  bufsize = 0 
)
inlineoverride

◆ Write() [2/2]

Int_t TPPG::Write ( const char *  name = nullptr,
Int_t  option = 0,
Int_t  bufsize = 0 
) const
override

Definition at line 446 of file TPPG.cxx.

References OdbPPGSize(), PPGSize(), and Write().

Friends And Related Function Documentation

◆ TSingleton< TPPG >

friend class TSingleton< TPPG >
friend

Definition at line 124 of file TPPG.h.

Member Data Documentation

◆ fCurrIterator

PPGMap_t::iterator TPPG::fCurrIterator
private

!

Definition at line 192 of file TPPG.h.

Referenced by Clear(), Copy(), First(), Last(), Next(), and Previous().

◆ fCycleLength

ULong64_t TPPG::fCycleLength
private

Definition at line 195 of file TPPG.h.

Referenced by Add(), AddData(), Clear(), Copy(), Correct(), GetCycleLength(), and SetCycleLength().

◆ fCycleSet

bool TPPG::fCycleSet {false}
private

! flag to indicate whether the codes and durations have been calculated from the data

Definition at line 201 of file TPPG.h.

Referenced by AddData(), CalculateCycleFromData(), and Clear().

◆ fDurations

std::vector<ULong64_t> TPPG::fDurations { 0, 0, 0, 0}
private

! duration of ppg state calculated from data

Definition at line 203 of file TPPG.h.

Referenced by CalculateCycleFromData(), OdbMatchesData(), and SetOdbFromData().

◆ fNumberOfCycleLengths

std::map<ULong64_t, int> TPPG::fNumberOfCycleLengths
private

Definition at line 196 of file TPPG.h.

Referenced by Add(), AddData(), Clear(), Copy(), Correct(), and GetCycleLength().

◆ fOdbDurations

std::vector<int> TPPG::fOdbDurations
private

duration of ppg state as read from odb

Definition at line 199 of file TPPG.h.

Referenced by Add(), Clear(), Copy(), OdbCycleLength(), OdbDuration(), OdbMatchesData(), Print(), SetOdbCycle(), and SetOdbFromData().

◆ fOdbPPGCodes

std::vector<short> TPPG::fOdbPPGCodes
private

ppg state codes read from odb

Definition at line 198 of file TPPG.h.

Referenced by Add(), Clear(), Copy(), OdbMatchesData(), OdbPPGCode(), OdbPPGSize(), Print(), SetOdbCycle(), and SetOdbFromData().

◆ fPPG

TPPG * TPPG::fPPG = nullptr
staticprivate

static pointer to TPPG

Definition at line 189 of file TPPG.h.

◆ fPPGCodes

std::vector<short> TPPG::fPPGCodes {0x8, 0x2, 0x1, 0x4}
private

! ppg state codes (these are always set)

Definition at line 202 of file TPPG.h.

Referenced by CalculateCycleFromData(), OdbMatchesData(), and SetOdbFromData().

◆ fPPGStatusMap