Diana Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QGFileHandler Class Reference

Class to handle ROOT files. More...

Public Member Functions

 QGFileHandler ()
 Constructor. More...
 
virtual ~QGFileHandler ()
 Destructor. More...
 
bool CheckForModifiedFiles ()
 Check whether any open file has been modified. More...
 
void CloseFiles ()
 Close all open files, empty the chain. More...
 
void GetEvent (const Long64_t eventNumber, const std::string &samplesName="")
 Get an event. More...
 
TEventList GetEventList (TCut cuts)
 Get an event list containing the events passing a cut. More...
 
std::vector< std::string > GetFilenames ()
 Get a vector containing the names of the open files. More...
 
const QSampleInfoGetMasterSample (const Long64_t eventNumber)
 Get master sample of an event. More...
 
const Diana::QVector & GetPulse (const Long64_t eventNumber, const std::string &samplesName)
 Get the pulse of an event. More...
 
TObject * GetGenericObject (const Long64_t eventNumber, const std::string &samplesName)
 
const QChannelRunDataGetChannelRunData (const Long64_t eventNumber)
 Get the run data for an event. More...
 
const QRunDataGetRunData (const Long64_t eventNumber)
 Get the run data for an event. More...
 
QChainGetQChain ()
 Get a pointer to the chian. More...
 
std::set< std::string > GetSetOfAliases ()
 Get the aliases defined in the tree. More...
 
std::set< std::string > GetSetOfQVectorAliases ()
 Get the aliases defined in the tree. More...
 
std::set< std::string > GetSetOfLeaves ()
 Get the names of the leaves of the tree. More...
 
std::set< std::string > GetSetOfQVectorLeaves ()
 Get the names of the leaves of the tree. More...
 
std::string GetDefaultPulseLabel () const
 Get the names of the leaves of the tree. More...
 
const std::vector< QSampleInfo > & GetSignificantSamples (const Long64_t eventNumber)
 Get significant samples of an event. More...
 
std::string GetTreeClass ()
 Get the class name of the tree. More...
 
bool IsFileOpen ()
 Check whether a file is open. More...
 
void ListOpenFiles ()
 Print a list of open files to the console. More...
 
void OpenFile ()
 Pop up a file open dialog. More...
 
void OpenFile (std::string filename)
 Open a new file, add it to the chain. More...
 
void OpenFiles (const std::vector< std::string > &files)
 Open files, add them to the chain. More...
 
void ParseFileList (const std::string &filename)
 Parse file list. More...
 

Protected Member Functions

time_t ModificationTime (const std::string &filename)
 Return modification time of file. More...
 
void ReopenFiles ()
 Reopen files. More...
 
void SetLowestStartTimeUnix (const std::string &treeName)
 Set LowestStartTimeUnix alias. More...
 
void SetUpChain ()
 Set up the chain. More...
 
void SetUpNumericTypes ()
 Specify the numeric data types. More...
 

Protected Attributes

std::string fDataDirectory
 Directory containing data files. More...
 
TEventList fEventList
 Event list. More...
 
TFile * fFile
 ROOT file. More...
 
std::vector< std::string > fFilenames
 Filenames. More...
 
bool fFileOpen
 File open flag. More...
 
double fLowestStartTimeUnix
 Lowest StartTimeUnix of open files. More...
 
std::map< std::string, time_t > fModificationTime
 Modification times of every open file. More...
 
std::set< std::string > fNumericTypes
 Collection of numeric data types. More...
 
Diana::QVector fDefaultPulse
 Default (empty) pulse, for use when opening a non-Diana file. More...
 
QHeaderfHeader
 QBaseEvent. More...
 
QPulseInfofPulseInfo
 
QChainfQChain
 QChain. More...
 
std::string fTreeClass
 Name of tree's class. More...
 
Diana::QVector fSamples
 samples (QVector or QVectorI or QPulse) to load More...
 
TObject * fGenericObject
 
Diana::QGlobalDataManager * fDataManager
 
std::string fDefaultPulseLabel
 defalt label of samples to load More...
 

Detailed Description

Class to handle ROOT files.

Author
Adam Bryant (adam_.nosp@m.brya.nosp@m.nt@be.nosp@m.rkel.nosp@m.ey.ed.nosp@m.u)

Definition at line 34 of file QGFileHandler.hh.

Constructor & Destructor Documentation

◆ QGFileHandler()

QGFileHandler::QGFileHandler ( )

Constructor.

Definition at line 50 of file QGFileHandler.cc.

References fDataManager, fDefaultPulseLabel, fGenericObject, SetUpChain(), and SetUpNumericTypes().

◆ ~QGFileHandler()

QGFileHandler::~QGFileHandler ( )
virtual

Destructor.

Definition at line 61 of file QGFileHandler.cc.

References fQChain.

Member Function Documentation

◆ CheckForModifiedFiles()

bool QGFileHandler::CheckForModifiedFiles ( )

Check whether any open file has been modified.

Definition at line 66 of file QGFileHandler.cc.

References fModificationTime, ModificationTime(), and ReopenFiles().

Referenced by QGPlot::Plot().

◆ CloseFiles()

void QGFileHandler::CloseFiles ( )

Close all open files, empty the chain.

Definition at line 88 of file QGFileHandler.cc.

References fFilenames, fFileOpen, fHeader, fLowestStartTimeUnix, fModificationTime, fPulseInfo, fQChain, fTreeClass, and SetUpChain().

Referenced by QGCanvasSetupFrame::HandleCloseFilesButton(), and ReopenFiles().

◆ GetChannelRunData()

const QChannelRunData * QGFileHandler::GetChannelRunData ( const Long64_t  eventNumber)

Get the run data for an event.

Definition at line 232 of file QGFileHandler.cc.

References chanRunData, fPulseInfo, QPulseInfo::GetChannelId(), QRunData::GetChannelRunData(), and GetRunData().

Referenced by QGPulse::GetPulseFromChain().

◆ GetDefaultPulseLabel()

std::string QGFileHandler::GetDefaultPulseLabel ( ) const
inline

Get the names of the leaves of the tree.

Definition at line 87 of file QGFileHandler.hh.

References fDefaultPulseLabel.

Referenced by QGPulseEditWindow::FillVariablesDropDownBoxes().

◆ GetEvent()

void QGFileHandler::GetEvent ( const Long64_t  eventNumber,
const std::string &  samplesName = "" 
)

◆ GetEventList()

TEventList QGFileHandler::GetEventList ( TCut  cuts)

Get an event list containing the events passing a cut.

Definition at line 143 of file QGFileHandler.cc.

References fQChain.

◆ GetFilenames()

std::vector<std::string> QGFileHandler::GetFilenames ( )
inline

Get a vector containing the names of the open files.

Definition at line 55 of file QGFileHandler.hh.

References fFilenames.

Referenced by QGPlotIconsFrame::HandlePulsesButton(), and QGCanvasWindow::UpdateFileLabel().

◆ GetGenericObject()

TObject * QGFileHandler::GetGenericObject ( const Long64_t  eventNumber,
const std::string &  samplesName 
)

Definition at line 173 of file QGFileHandler.cc.

References fGenericObject, and GetEvent().

Referenced by QGPulse::GetPulseFromChain().

◆ GetMasterSample()

const QSampleInfo & QGFileHandler::GetMasterSample ( const Long64_t  eventNumber)

Get master sample of an event.

Definition at line 154 of file QGFileHandler.cc.

References QPulseInfo::Clear(), fPulseInfo, GetEvent(), and QPulseInfo::GetMasterSample().

Referenced by QGPulse::GetPulseFromChain().

◆ GetPulse()

const QVector & QGFileHandler::GetPulse ( const Long64_t  eventNumber,
const std::string &  samplesName 
)

Get the pulse of an event.

Definition at line 166 of file QGFileHandler.cc.

References fSamples, and GetEvent().

Referenced by QGPulse::GetPulseFromChain().

◆ GetQChain()

QChain* QGFileHandler::GetQChain ( )
inline

Get a pointer to the chian.

Definition at line 72 of file QGFileHandler.hh.

References fQChain.

Referenced by QGPulse::FillEventData(), QGHistogram::Generate(), QGPulse::Generate(), QGScatterPlot::Generate(), and QGPulse::Order().

◆ GetRunData()

const QRunData * QGFileHandler::GetRunData ( const Long64_t  eventNumber)

Get the run data for an event.

Definition at line 196 of file QGFileHandler.cc.

References fDataManager, fHeader, fPulseInfo, fQChain, GetEvent(), and QHeader::GetRun().

Referenced by GetChannelRunData().

◆ GetSetOfAliases()

set< string > QGFileHandler::GetSetOfAliases ( )

◆ GetSetOfLeaves()

set< string > QGFileHandler::GetSetOfLeaves ( )

◆ GetSetOfQVectorAliases()

std::set< std::string > QGFileHandler::GetSetOfQVectorAliases ( )

Get the aliases defined in the tree.

Definition at line 273 of file QGFileHandler.cc.

Referenced by QGPulseEditWindow::FillVariablesDropDownBoxes().

◆ GetSetOfQVectorLeaves()

set< string > QGFileHandler::GetSetOfQVectorLeaves ( )

Get the names of the leaves of the tree.

Definition at line 301 of file QGFileHandler.cc.

References fDefaultPulseLabel, fFileOpen, fQChain, and QChain::GetListOfAllLeaves().

Referenced by QGPulseEditWindow::FillVariablesDropDownBoxes().

◆ GetSignificantSamples()

const vector< QSampleInfo > & QGFileHandler::GetSignificantSamples ( const Long64_t  eventNumber)

Get significant samples of an event.

Definition at line 181 of file QGFileHandler.cc.

References QPulseInfo::Clear(), fPulseInfo, GetEvent(), and QPulseInfo::GetSamplesInfo().

Referenced by QGPulse::GetPulseFromChain().

◆ GetTreeClass()

std::string QGFileHandler::GetTreeClass ( )
inline

Get the class name of the tree.

Definition at line 93 of file QGFileHandler.hh.

References fTreeClass.

◆ IsFileOpen()

bool QGFileHandler::IsFileOpen ( )
inline

◆ ListOpenFiles()

void QGFileHandler::ListOpenFiles ( )

Print a list of open files to the console.

Definition at line 327 of file QGFileHandler.cc.

References fFilenames, and fFileOpen.

Referenced by QGCanvasSetupFrame::HandleListOpenFilesButton().

◆ ModificationTime()

time_t QGFileHandler::ModificationTime ( const std::string &  filename)
protected

Return modification time of file.

Definition at line 345 of file QGFileHandler.cc.

Referenced by CheckForModifiedFiles().

◆ OpenFile() [1/2]

void QGFileHandler::OpenFile ( )

◆ OpenFile() [2/2]

void QGFileHandler::OpenFile ( std::string  filename)

Open a new file, add it to the chain.

◆ OpenFiles()

void QGFileHandler::OpenFiles ( const std::vector< std::string > &  files)

Open files, add them to the chain.

Definition at line 531 of file QGFileHandler.cc.

References OpenFile().

Referenced by QGPlotIconsFrame::HandlePulsesButton(), ReopenFiles(), and QGGraphicalCut::ViewPulses().

◆ ParseFileList()

void QGFileHandler::ParseFileList ( const std::string &  filename)

◆ ReopenFiles()

void QGFileHandler::ReopenFiles ( )
protected

◆ SetLowestStartTimeUnix()

void QGFileHandler::SetLowestStartTimeUnix ( const std::string &  treeName)
protected

Set LowestStartTimeUnix alias.

Definition at line 585 of file QGFileHandler.cc.

References fFile, fFilenames, fLowestStartTimeUnix, fQChain, and QChain::GetListOfAllAliases().

◆ SetUpChain()

void QGFileHandler::SetUpChain ( )
protected

Set up the chain.

Definition at line 608 of file QGFileHandler.cc.

References fQChain.

Referenced by CloseFiles(), and QGFileHandler().

◆ SetUpNumericTypes()

void QGFileHandler::SetUpNumericTypes ( )
protected

Specify the numeric data types.

Definition at line 614 of file QGFileHandler.cc.

References fNumericTypes.

Referenced by QGFileHandler().

Member Data Documentation

◆ fDataDirectory

std::string QGFileHandler::fDataDirectory
protected

Directory containing data files.

Definition at line 136 of file QGFileHandler.hh.

Referenced by OpenFile().

◆ fDataManager

Diana::QGlobalDataManager* QGFileHandler::fDataManager
protected

Definition at line 180 of file QGFileHandler.hh.

Referenced by GetRunData(), QGFileHandler(), and ReopenFiles().

◆ fDefaultPulse

Diana::QVector QGFileHandler::fDefaultPulse
protected

Default (empty) pulse, for use when opening a non-Diana file.

Definition at line 164 of file QGFileHandler.hh.

◆ fDefaultPulseLabel

std::string QGFileHandler::fDefaultPulseLabel
protected

defalt label of samples to load

Definition at line 183 of file QGFileHandler.hh.

Referenced by GetDefaultPulseLabel(), GetSetOfQVectorLeaves(), and QGFileHandler().

◆ fEventList

TEventList QGFileHandler::fEventList
protected

Event list.

Definition at line 139 of file QGFileHandler.hh.

◆ fFile

TFile* QGFileHandler::fFile
protected

ROOT file.

Definition at line 142 of file QGFileHandler.hh.

Referenced by SetLowestStartTimeUnix().

◆ fFilenames

std::vector<std::string> QGFileHandler::fFilenames
protected

Filenames.

Definition at line 145 of file QGFileHandler.hh.

Referenced by CloseFiles(), GetFilenames(), ListOpenFiles(), ReopenFiles(), and SetLowestStartTimeUnix().

◆ fFileOpen

bool QGFileHandler::fFileOpen
protected

File open flag.

Definition at line 148 of file QGFileHandler.hh.

Referenced by CloseFiles(), GetSetOfAliases(), GetSetOfLeaves(), GetSetOfQVectorLeaves(), IsFileOpen(), and ListOpenFiles().

◆ fGenericObject

TObject* QGFileHandler::fGenericObject
protected

Definition at line 178 of file QGFileHandler.hh.

Referenced by GetEvent(), GetGenericObject(), and QGFileHandler().

◆ fHeader

QHeader* QGFileHandler::fHeader
protected

QBaseEvent.

Definition at line 167 of file QGFileHandler.hh.

Referenced by CloseFiles(), and GetRunData().

◆ fLowestStartTimeUnix

double QGFileHandler::fLowestStartTimeUnix
protected

Lowest StartTimeUnix of open files.

Definition at line 151 of file QGFileHandler.hh.

Referenced by CloseFiles(), and SetLowestStartTimeUnix().

◆ fModificationTime

std::map<std::string, time_t> QGFileHandler::fModificationTime
protected

Modification times of every open file.

Definition at line 155 of file QGFileHandler.hh.

Referenced by CheckForModifiedFiles(), and CloseFiles().

◆ fNumericTypes

std::set<std::string> QGFileHandler::fNumericTypes
protected

Collection of numeric data types.

Definition at line 161 of file QGFileHandler.hh.

Referenced by GetSetOfLeaves(), and SetUpNumericTypes().

◆ fPulseInfo

QPulseInfo* QGFileHandler::fPulseInfo
protected

◆ fQChain

QChain* QGFileHandler::fQChain
protected

◆ fSamples

Diana::QVector QGFileHandler::fSamples
protected

samples (QVector or QVectorI or QPulse) to load

Definition at line 177 of file QGFileHandler.hh.

Referenced by GetEvent(), and GetPulse().

◆ fTreeClass

std::string QGFileHandler::fTreeClass
protected

Name of tree's class.

Definition at line 174 of file QGFileHandler.hh.

Referenced by CloseFiles(), and GetTreeClass().


The documentation for this class was generated from the following files: