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

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

Definition at line 98 of file TScaler.h.

Public Member Functions

 TScaler (bool loadIntoMap=false)
 
 TScaler (TTree *, bool loadIntoMap=false)
 
 TScaler (const TScaler &)
 
 ~TScaler () override
 
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
 

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
 

#include <TScaler.h>

+ Inheritance diagram for TScaler:
+ Collaboration diagram for TScaler:

Constructor & Destructor Documentation

◆ TScaler() [1/3]

TScaler::TScaler ( bool  loadIntoMap = false)

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 51 of file TScaler.cxx.

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

◆ TScaler() [2/3]

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

◆ TScaler() [3/3]

TScaler::TScaler ( const TScaler rhs)

Definition at line 85 of file TScaler.cxx.

References Copy().

◆ ~TScaler()

TScaler::~TScaler ( )
override

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 266 of file TScaler.cxx.

References fEntries, fHist, fPPG, fScalerData, fTree, TSingleton< TPPG >::Get(), TScalerData::GetAddress(), TPPG::GetCycleLength(), TScalerData::GetScaler(), 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 334 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 463 of file TScaler.cxx.

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

◆ GetNumberOfTimePeriods()

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

Definition at line 116 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 119 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 165 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 174 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 504 of file TScaler.cxx.

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

Referenced by Draw(), and DrawRawTimes().

◆ GetTimePeriodMap()

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

Definition at line 115 of file TScaler.h.

References fTimePeriod.

◆ ListHistograms()

void TScaler::ListHistograms ( )

Definition at line 536 of file TScaler.cxx.

References fHist, fHistRange, and hex().

◆ NumberOfScalerReadouts()

ULong64_t TScaler::NumberOfScalerReadouts ( ) const
inline

Definition at line 111 of file TScaler.h.

References fEntries.

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 138 of file TScaler.h.

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

◆ fHistRange

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

! map to store histograms for address-ranges

Definition at line 139 of file TScaler.h.

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

◆ fNumberOfTimePeriods

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

!

Definition at line 134 of file TScaler.h.

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

◆ fPPG

TPPG* TScaler::fPPG
private

!

Definition at line 137 of file TScaler.h.

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

◆ 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 131 of file TScaler.h.

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

◆ 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 133 of file TScaler.h.

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

◆ fTotalNumberOfTimePeriods

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

!

Definition at line 136 of file TScaler.h.

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

◆ fTotalTimePeriod

ULong64_t TScaler::fTotalTimePeriod
private

!

Definition at line 135 of file TScaler.h.

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

◆ fTree

TTree* TScaler::fTree
private