The TPPG is designed to hold all of the information about the PPG status.
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 TPPGData * | First () |
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 TPPGData * | Last () |
Bool_t | MapIsEmpty () const |
Long64_t | Merge (TCollection *list) |
const TPPGData * | Next () |
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 TPPGData * | Previous () |
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 TPPG * | AddCurrent () |
static TPPG * | Get (bool verbose=false) |
static TPPG * | GetAll () |
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_t * | fPPGStatusMap |
Static Private Attributes | |
static TPPG * | fPPG = nullptr |
Friends | |
class | TSingleton< TPPG > |
#include <TPPG.h>
typedef std::map<ULong_t, TPPGData*> TPPG::PPGMap_t |
TPPG::TPPG | ( | ) |
Definition at line 61 of file TPPG.cxx.
References Clear(), and fPPGStatusMap.
TPPG::TPPG | ( | const TPPG & | rhs | ) |
Definition at line 67 of file TPPG.cxx.
References Copy(), and fPPGStatusMap.
|
override |
Definition at line 73 of file TPPG.cxx.
References Clear(), and fPPGStatusMap.
void TPPG::Add | ( | const TPPG * | ppg | ) |
Definition at line 676 of file TPPG.cxx.
References AddData(), fCycleLength, fNumberOfCycleLengths, fOdbDurations, fOdbPPGCodes, GetCycleLength(), MapBegin(), and MapEnd().
Referenced by Analyze(), and operator+=().
|
inlinestaticinherited |
Definition at line 137 of file TSingleton.h.
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().
|
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().
|
override |
Definition at line 424 of file TPPG.cxx.
References AddData(), fCurrIterator, fCycleLength, fCycleSet, fNumberOfCycleLengths, fOdbDurations, fOdbPPGCodes, and fPPGStatusMap.
|
override |
Definition at line 88 of file TPPG.cxx.
References AddData(), Clear(), fCurrIterator, fCycleLength, fNumberOfCycleLengths, fOdbDurations, fOdbPPGCodes, and fPPGStatusMap.
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.
const TPPGData * TPPG::First | ( | ) |
Definition at line 591 of file TPPG.cxx.
References fCurrIterator, and MapBegin().
|
inlinestaticinherited |
Definition at line 34 of file TSingleton.h.
Referenced by TScaler::Draw(), TFragment::GetCycleNumber(), TDetectorHit::GetCycleTimeStamp(), TDetectorHit::GetPPGStatus(), TFragment::GetTimeInCycle(), TDetectorHit::GetTimeSinceTapeMove(), TGRSIDataParser::GriffinDataToPPGEvent(), TMidasFile::SetGRIFFOdb(), TTdrDataParser::TdrToFragment(), TAnalysisWriteLoop::Write(), and TFragWriteLoop::Write().
|
inlinestaticinherited |
Definition at line 62 of file TSingleton.h.
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().
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().
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().
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().
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().
ULong64_t TPPG::GetNumberOfCycles | ( | ) |
Definition at line 648 of file TPPG.cxx.
References GetCycleLength(), TPPGData::GetTimeStamp(), and Last().
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().
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().
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().
const TPPGData * TPPG::Last | ( | ) |
Definition at line 584 of file TPPG.cxx.
References fCurrIterator, and MapEnd().
Referenced by GetNumberOfCycles(), and GetStatusStart().
|
inlineprivate |
Definition at line 190 of file TPPG.h.
References fPPGStatusMap.
Referenced by Add(), CalculateCycleFromData(), Correct(), First(), GetCycleLength(), Previous(), and Print().
|
inlineprivate |
Definition at line 191 of file TPPG.h.
References fPPGStatusMap.
Referenced by Add(), CalculateCycleFromData(), Correct(), GetCycleLength(), Last(), Next(), and Print().
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().
const TPPGData * TPPG::Next | ( | ) |
Definition at line 566 of file TPPG.cxx.
References fCurrIterator, and MapEnd().
|
inline |
Definition at line 156 of file TPPG.h.
References fOdbDurations.
|
inline |
Definition at line 155 of file TPPG.h.
References fOdbDurations.
bool TPPG::OdbMatchesData | ( | bool | verbose = false | ) |
Definition at line 333 of file TPPG.cxx.
References CalculateCycleFromData(), fDurations, fOdbDurations, fOdbPPGCodes, fPPGCodes, and hex().
|
inline |
Definition at line 154 of file TPPG.h.
References fOdbPPGCodes.
|
inline |
void TPPG::operator+= | ( | const TPPG & | rhs | ) |
|
inline |
const TPPGData * TPPG::Previous | ( | ) |
Definition at line 575 of file TPPG.cxx.
References fCurrIterator, and MapBegin().
|
override |
Definition at line 212 of file TPPG.cxx.
References fOdbDurations, fOdbPPGCodes, fPPGStatusMap, GetLastStatusTime(), hex(), kBackground, kBeamOn, kDecay, kTapeMove, MapBegin(), MapEnd(), and MapIsEmpty().
|
inlinestaticinherited |
Definition at line 166 of file TSingleton.h.
|
inlinestaticinherited |
Definition at line 129 of file TSingleton.h.
|
inline |
Definition at line 162 of file TPPG.h.
References fCycleLength.
|
inline |
Definition at line 177 of file TPPG.h.
References fOdbDurations, and fOdbPPGCodes.
Referenced by TMidasFile::SetGRIFFOdb().
void TPPG::SetOdbFromData | ( | bool | verbose = false | ) |
Definition at line 358 of file TPPG.cxx.
References CalculateCycleFromData(), fDurations, fOdbDurations, fOdbPPGCodes, fPPGCodes, RED, and RESET_COLOR.
void TPPG::Setup | ( | ) |
Definition at line 456 of file TPPG.cxx.
References Copy(), TRunInfo::RunNumber(), and TRunInfo::SubRunNumber().
|
inlineoverride |
Definition at line 134 of file TPPG.h.
Referenced by TGRSISelector::Terminate(), TAnalysisWriteLoop::Write(), and TFragWriteLoop::Write().
|
override |
Definition at line 446 of file TPPG.cxx.
References OdbPPGSize(), PPGSize(), and Write().
|
friend |
|
private |
|
private |
Definition at line 195 of file TPPG.h.
Referenced by Add(), AddData(), Clear(), Copy(), Correct(), GetCycleLength(), and SetCycleLength().
|
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().
|
private |
! duration of ppg state calculated from data
Definition at line 203 of file TPPG.h.
Referenced by CalculateCycleFromData(), OdbMatchesData(), and SetOdbFromData().
|
private |
|
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().
|
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().
|
staticprivate |
|
private |
! ppg state codes (these are always set)
Definition at line 202 of file TPPG.h.
Referenced by CalculateCycleFromData(), OdbMatchesData(), and SetOdbFromData().
|
private |
Definition at line 194 of file TPPG.h.
Referenced by AddData(), Clear(), Copy(), Correct(), GetLastStatusTime(), GetNextStatus(), GetNextStatusTime(), GetStatus(), MapBegin(), MapEnd(), MapIsEmpty(), PPGSize(), Print(), TPPG(), and ~TPPG().