GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TPPG Class Reference

Detailed Description

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

Definition at line 132 of file TPPG.h.

Public Types

using PPGMap_t = std::map<ULong_t, TPPGData*>
 

Public Member Functions

 TPPG ()
 
 TPPG (const TPPG &)
 
 TPPG (TPPG &&)=default
 
 ~TPPG ()
 
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)
 
int16_t OdbPPGCode (size_t index) const
 
std::size_t OdbPPGSize () const
 
void operator+= (const TPPG &rhs)
 
TPPGoperator= (const TPPG &)
 
TPPGoperator= (TPPG &&)=default
 
std::size_t PPGSize () const
 
const TPPGDataPrevious ()
 
void Print (Option_t *opt="") const override
 
void SetCycleLength (ULong64_t length)
 
void SetOdbCycle (std::vector< int16_t > 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) const override
 
Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) 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 {0}
 
bool fCycleSet {false}
 
std::vector< ULong64_t > fDurations {0, 0, 0, 0}
 
std::map< ULong64_t, int > fNumberOfCycleLengths
 
std::vector< int > fOdbDurations
 
std::vector< int16_t > fOdbPPGCodes
 
std::vector< int16_t > fPPGCodes {0x8, 0x2, 0x1, 0x4}
 
PPGMap_tfPPGStatusMap {nullptr}
 

Static Private Attributes

static TDirectory * fDir
 
static TPPGfSingleton
 

Friends

class TSingleton< TPPG >
 
+ Inheritance diagram for TPPG:
+ Collaboration diagram for TPPG:

Member Typedef Documentation

◆ PPGMap_t

using TPPG::PPGMap_t = std::map<ULong_t, TPPGData*>

Definition at line 136 of file TPPG.h.

Constructor & Destructor Documentation

◆ TPPG() [1/3]

TPPG::TPPG ( )

Definition at line 56 of file TPPG.cxx.

References Clear().

◆ TPPG() [2/3]

TPPG::TPPG ( const TPPG & rhs)

Definition at line 62 of file TPPG.cxx.

References Copy().

◆ TPPG() [3/3]

TPPG::TPPG ( TPPG && )
default

◆ ~TPPG()

TPPG::~TPPG ( )

Definition at line 68 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 141 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 121 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 379 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

◆ 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 482 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 595 of file TPPG.cxx.

References fCurrIterator, and MapBegin().

◆ Get()

◆ GetAll()

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

Definition at line 66 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 629 of file TPPG.cxx.

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

Referenced by Add(), Correct(), TScaler::Draw(), 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 621 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 131 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 199 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 159 of file TPPG.cxx.

References fPPGStatusMap, kJunk, and MapIsEmpty().

◆ GetNumberOfCycles()

ULong64_t TPPG::GetNumberOfCycles ( )

Definition at line 652 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 187 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 669 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 613 of file TPPG.cxx.

References GetCycleLength().

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

◆ Last()

const TPPGData * TPPG::Last ( )

Definition at line 588 of file TPPG.cxx.

References fCurrIterator, and MapEnd().

Referenced by GetNumberOfCycles(), and GetStatusStart().

◆ MapBegin()

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

Definition at line 209 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 210 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 113 of file TPPG.cxx.

References fPPGStatusMap.

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

◆ Merge()

Long64_t TPPG::Merge ( TCollection * list)

Definition at line 657 of file TPPG.cxx.

◆ Next()

const TPPGData * TPPG::Next ( )

Definition at line 570 of file TPPG.cxx.

References fCurrIterator, and MapEnd().

◆ OdbCycleLength()

Long64_t TPPG::OdbCycleLength ( ) const
inline

Definition at line 171 of file TPPG.h.

References fOdbDurations.

Referenced by ExampleEventHelper::CreateHistograms(), and Print().

◆ OdbDuration()

int TPPG::OdbDuration ( size_t index) const
inline

Definition at line 170 of file TPPG.h.

References fOdbDurations.

◆ OdbMatchesData()

bool TPPG::OdbMatchesData ( bool verbose = false)

Definition at line 339 of file TPPG.cxx.

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

◆ OdbPPGCode()

int16_t TPPG::OdbPPGCode ( size_t index) const
inline

Definition at line 169 of file TPPG.h.

References fOdbPPGCodes.

◆ OdbPPGSize()

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

Definition at line 168 of file TPPG.h.

References fOdbPPGCodes.

Referenced by Write().

◆ operator+=()

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

Definition at line 675 of file TPPG.cxx.

References Add().

◆ operator=() [1/2]

TPPG & TPPG::operator= ( const TPPG & rhs)

Definition at line 79 of file TPPG.cxx.

References Copy(), and fPPGStatusMap.

◆ operator=() [2/2]

TPPG & TPPG::operator= ( TPPG && )
default

◆ PPGSize()

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

Definition at line 167 of file TPPG.h.

References fPPGStatusMap.

Referenced by Write().

◆ Previous()

const TPPGData * TPPG::Previous ( )

Definition at line 579 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 171 of file TSingleton.h.

◆ Set()

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

Definition at line 133 of file TSingleton.h.

◆ SetCycleLength()

void TPPG::SetCycleLength ( ULong64_t length)
inline

Definition at line 182 of file TPPG.h.

References fCycleLength.

◆ SetOdbCycle()

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

Definition at line 197 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 460 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 ) const
override

Definition at line 449 of file TPPG.cxx.

References OdbPPGSize(), and PPGSize().

◆ Write() [2/2]

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

Definition at line 149 of file TPPG.h.

References Write().

Referenced by TGRSIFrame::Run(), TGRSISelector::Terminate(), TFragWriteLoop::Write(), and Write().

Friends And Related Symbol Documentation

◆ TSingleton< TPPG >

friend class TSingleton< TPPG >
friend

Definition at line 125 of file TPPG.h.

Member Data Documentation

◆ fCurrIterator

PPGMap_t::iterator TPPG::fCurrIterator
private

!

Definition at line 211 of file TPPG.h.

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

◆ fCycleLength

ULong64_t TPPG::fCycleLength {0}
private

Definition at line 214 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 220 of file TPPG.h.

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

◆ fDir

TDirectory * TSingleton< TPPG >::fDir
staticprivateinherited

Definition at line 187 of file TSingleton.h.

◆ fDurations

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

! duration of ppg state calculated from data

Definition at line 222 of file TPPG.h.

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

◆ fNumberOfCycleLengths

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

Definition at line 215 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 218 of file TPPG.h.

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

◆ fOdbPPGCodes

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

ppg state codes read from odb

Definition at line 217 of file TPPG.h.

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

◆ fPPGCodes

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

! ppg state codes (these are always set)

Definition at line 221 of file TPPG.h.

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

◆ fPPGStatusMap

PPGMap_t* TPPG::fPPGStatusMap {nullptr}
private

◆ fSingleton

TPPG * TSingleton< TPPG >::fSingleton
staticprivateinherited

Definition at line 186 of file TSingleton.h.