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

Detailed Description

The TScaler is designed to hold all of the information about the scaler status.

Definition at line 104 of file TScaler.h.

Public Member Functions

 TScaler (bool loadIntoMap=false)
 
 TScaler (const TScaler &)
 
 TScaler (TScaler &&) noexcept=default
 
 TScaler (TTree *, bool loadIntoMap=false)
 
 ~TScaler ()
 
void Clear (Option_t *opt="") override
 
void Copy (TObject &obj) const override
 
TH1D * Draw (UInt_t address, size_t index=0, Option_t *option="")
 
TH1D * Draw (UInt_t lowAddress, UInt_t highAddress, size_t index=0, Option_t *option="")
 
TH1D * DrawRawTimes (UInt_t address, Double_t lowtime, Double_t hightime, size_t index=0, Option_t *option="")
 
std::map< UInt_t, std::map< ULong64_t, int > > GetNumberOfTimePeriods ()
 
std::vector< UInt_t > GetScaler (UInt_t address, ULong64_t time) const
 
UInt_t GetScaler (UInt_t address, ULong64_t time, size_t index) const
 
UInt_t GetScalerDifference (UInt_t address, ULong64_t time, size_t index) const
 
ULong64_t GetTimePeriod (UInt_t address)
 
std::map< UInt_t, ULong64_t > GetTimePeriodMap ()
 
void ListHistograms ()
 
ULong64_t NumberOfScalerReadouts () const
 
TScaleroperator= (const TScaler &)=default
 
TScaleroperator= (TScaler &&) noexcept=default
 

Static Public Member Functions

static double GetLastScaler (TTree *tree=nullptr, UInt_t address=0xffff, size_t nominator=2, size_t denominator=1)
 

Private Member Functions

void ReadTree (bool loadIntoMap)
 

Private Attributes

Long64_t fEntries
 
std::map< UInt_t, TH1D * > fHist
 
std::map< std::pair< UInt_t, UInt_t >, TH1D * > fHistRange
 
std::map< UInt_t, std::map< ULong64_t, int > > fNumberOfTimePeriods
 
TPPGfPPG
 
TScalerDatafScalerData
 
std::map< UInt_t, std::map< ULong64_t, std::vector< UInt_t > > > fScalerMap
 
std::map< UInt_t, ULong64_t > fTimePeriod
 
std::map< ULong64_t, int > fTotalNumberOfTimePeriods
 
ULong64_t fTotalTimePeriod
 
TTree * fTree
 
+ Inheritance diagram for TScaler:
+ Collaboration diagram for TScaler:

Constructor & Destructor Documentation

◆ TScaler() [1/4]

TScaler::TScaler ( bool loadIntoMap = false)
explicit

This constructor tries to find the "ScalerTree" and uses it (if requested) to load the scaler data into the map.

Parameters
[in]loadIntoMapFlag telling TScaler to load all scaler data into fScalerMap.

Definition at line 46 of file TScaler.cxx.

References ReadTree().

◆ TScaler() [2/4]

TScaler::TScaler ( TTree * tree,
bool loadIntoMap = false )
explicit

Definition at line 54 of file TScaler.cxx.

References ReadTree().

◆ TScaler() [3/4]

TScaler::TScaler ( const TScaler & rhs)

Definition at line 74 of file TScaler.cxx.

References Copy().

◆ TScaler() [4/4]

TScaler::TScaler ( TScaler && )
defaultnoexcept

◆ ~TScaler()

Member Function Documentation

◆ Clear()

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

◆ Copy()

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

◆ Draw() [1/2]

TH1D * TScaler::Draw ( UInt_t address,
size_t index = 0,
Option_t * option = "" )

Draw scaler differences (i.e. current scaler minus last scaler) vs. time in cycle. Passing "redraw" as option forces re-drawing of the histogram (e.g. for a different index).

Definition at line 255 of file TScaler.cxx.

References fEntries, fHist, fPPG, fScalerData, fTree, TSingleton< TPPG >::Get(), TScalerData::GetAddress(), TPPG::GetCycleLength(), GetScaler(), TScalerData::GetScaler(), TPPG::GetTimeInCycle(), GetTimePeriod(), and TScalerData::GetTimeStamp().

◆ Draw() [2/2]

TH1D * TScaler::Draw ( UInt_t lowAddress,
UInt_t highAddress,
size_t index = 0,
Option_t * option = "" )

Draw scaler differences (i.e. current scaler minus last scaler) vs. time in cycle. Passing "redraw" as option forces re-drawing of the histogram (e.g. for a different index). The "single" options creates spectra for all single addresses in the given range (instead of one accumulative spectrum).

Definition at line 322 of file TScaler.cxx.

References fEntries, fHist, fHistRange, fPPG, fScalerData, fTree, TSingleton< TPPG >::Get(), TScalerData::GetAddress(), TPPG::GetCycleLength(), TScalerData::GetScaler(), TPPG::GetTimeInCycle(), GetTimePeriod(), and TScalerData::GetTimeStamp().

◆ DrawRawTimes()

TH1D * TScaler::DrawRawTimes ( UInt_t address,
Double_t lowtime,
Double_t hightime,
size_t index = 0,
Option_t * option = "" )

Draw scaler differences (i.e. current scaler minus last scaler) vs. time.

Definition at line 450 of file TScaler.cxx.

References fEntries, fScalerData, fTree, TScalerData::GetAddress(), GetScaler(), TScalerData::GetScaler(), GetTimePeriod(), and TScalerData::GetTimeStamp().

◆ GetLastScaler()

static double TScaler::GetLastScaler ( TTree * tree = nullptr,
UInt_t address = 0xffff,
size_t nominator = 2,
size_t denominator = 1 )
inlinestatic

This function returns the ratio of the two scalers nominator and denominator for the last entry with a matching address for a given tree. If no tree is provided it tries to get the "RateScaler" tree from the current directory.

Definition at line 134 of file TScaler.h.

References TScalerData::GetAddress(), TScalerData::GetScaler(), and hex().

◆ GetNumberOfTimePeriods()

std::map< UInt_t, std::map< ULong64_t, int > > TScaler::GetNumberOfTimePeriods ( )
inline

Definition at line 124 of file TScaler.h.

References fNumberOfTimePeriods.

◆ GetScaler() [1/2]

std::vector< UInt_t > TScaler::GetScaler ( UInt_t address,
ULong64_t time ) const

Returns the vector of scaler values for address "address" at the time "time". If the time is after the last entry, we return the last entry, otherwise we return the following entry (or the current entry if the time is an exact match).

Definition at line 108 of file TScaler.cxx.

References fEntries, fScalerData, fScalerMap, fTree, TScalerData::GetAddress(), TScalerData::GetScaler(), and TScalerData::GetTimeStamp().

Referenced by Draw(), DrawRawTimes(), and GetScaler().

◆ GetScaler() [2/2]

UInt_t TScaler::GetScaler ( UInt_t address,
ULong64_t time,
size_t index ) const

Definition at line 154 of file TScaler.cxx.

References GetScaler().

◆ GetScalerDifference()

UInt_t TScaler::GetScalerDifference ( UInt_t address,
ULong64_t time,
size_t index ) const

Returns the difference between "index"th scaler value for address "address" at the time "time" and the previous scaler value. If the time is after our last entry, we return the last entry divided by the number of entries, if this is before the first scaler, we just return the first scaler, otherwise we return the scaler minus the previous scaler.

Definition at line 163 of file TScaler.cxx.

References fEntries, fScalerData, fScalerMap, fTree, TScalerData::GetAddress(), TScalerData::GetScaler(), and TScalerData::GetTimeStamp().

◆ GetTimePeriod()

ULong64_t TScaler::GetTimePeriod ( UInt_t address)

Get time period of scaler readouts for address "address" by calculating all time differences and choosing the one that occurs most often. Returns 0 if the address doesn't exist in the map.

Definition at line 491 of file TScaler.cxx.

References fEntries, fNumberOfTimePeriods, fScalerData, fTimePeriod, fTree, TScalerData::GetAddress(), and TScalerData::GetTimeStamp().

Referenced by Draw(), Draw(), and DrawRawTimes().

◆ GetTimePeriodMap()

std::map< UInt_t, ULong64_t > TScaler::GetTimePeriodMap ( )
inline

Definition at line 123 of file TScaler.h.

References fTimePeriod.

◆ ListHistograms()

void TScaler::ListHistograms ( )

Definition at line 523 of file TScaler.cxx.

References fHist, fHistRange, and hex().

◆ NumberOfScalerReadouts()

ULong64_t TScaler::NumberOfScalerReadouts ( ) const
inline

Definition at line 119 of file TScaler.h.

References fEntries.

◆ operator=() [1/2]

TScaler & TScaler::operator= ( const TScaler & )
default

◆ operator=() [2/2]

TScaler & TScaler::operator= ( TScaler && )
defaultnoexcept

◆ ReadTree()

void TScaler::ReadTree ( bool loadIntoMap)
private

Member Data Documentation

◆ fEntries

Long64_t TScaler::fEntries
private

◆ fHist

std::map<UInt_t, TH1D*> TScaler::fHist
private

! map to store histograms that have already been drawn

Definition at line 174 of file TScaler.h.

Referenced by ~TScaler(), Clear(), Draw(), Draw(), and ListHistograms().

◆ fHistRange

std::map<std::pair<UInt_t, UInt_t>, TH1D*> TScaler::fHistRange
private

! map to store histograms for address-ranges

Definition at line 175 of file TScaler.h.

Referenced by ~TScaler(), Clear(), Draw(), and ListHistograms().

◆ fNumberOfTimePeriods

std::map<UInt_t, std::map<ULong64_t, int> > TScaler::fNumberOfTimePeriods
private

!

Definition at line 170 of file TScaler.h.

Referenced by ~TScaler(), Clear(), Copy(), GetNumberOfTimePeriods(), and GetTimePeriod().

◆ fPPG

TPPG* TScaler::fPPG
private

!

Definition at line 173 of file TScaler.h.

Referenced by ~TScaler(), Clear(), Draw(), and Draw().

◆ fScalerData

TScalerData* TScaler::fScalerData
private

◆ fScalerMap

std::map<UInt_t, std::map<ULong64_t, std::vector<UInt_t> > > TScaler::fScalerMap
private

! an address-map of timestamp mapped scaler values

Definition at line 168 of file TScaler.h.

Referenced by ~TScaler(), Clear(), Copy(), GetScaler(), GetScalerDifference(), and ReadTree().

◆ fTimePeriod

std::map<UInt_t, ULong64_t> TScaler::fTimePeriod
private

! a map between addresses and time differences (used to calculate the time period)

Definition at line 169 of file TScaler.h.

Referenced by ~TScaler(), Clear(), Copy(), GetTimePeriod(), and GetTimePeriodMap().

◆ fTotalNumberOfTimePeriods

std::map<ULong64_t, int> TScaler::fTotalNumberOfTimePeriods
private

!

Definition at line 172 of file TScaler.h.

Referenced by ~TScaler(), Clear(), and Copy().

◆ fTotalTimePeriod

ULong64_t TScaler::fTotalTimePeriod
private

!

Definition at line 171 of file TScaler.h.

Referenced by ~TScaler(), Clear(), and Copy().

◆ fTree

TTree* TScaler::fTree
private