EICrecon
JANA based reconstruction for the EPIC detector
Loading...
Searching...
No Matches
Public Member Functions | List of all members
RootFile_service Class Reference

#include <RootFile_service.h>

Inheritance diagram for RootFile_service:
Inheritance graph
[legend]
Collaboration diagram for RootFile_service:
Collaboration graph
[legend]

Public Member Functions

 RootFile_service (JApplication *app)
 
 ~RootFile_service () override
 
void acquire_services (JServiceLocator *) override
 
TDirectory * GetHistFile (bool create_if_needed=true)
 
void CloseHistFile ()
 

Detailed Description

This Service centralizes creation of a root file for histograms

Constructor & Destructor Documentation

◆ RootFile_service()

RootFile_service::RootFile_service ( JApplication app)
inlineexplicit

◆ ~RootFile_service()

RootFile_service::~RootFile_service ( )
inlineoverride

Member Function Documentation

◆ acquire_services()

void RootFile_service::acquire_services ( JServiceLocator *  )
inlineoverride

◆ CloseHistFile()

void RootFile_service::CloseHistFile ( )
inline

Close the histogram file. If no histogram file was opened, then this does nothing.

This should generally never be called by anything other than the destructor so that it is automatically closed when the service is destructed at the end of processing. This is only here for use in execptional circumstances like the program is suffering a fatal crash and we want to try and save the work by closing the file cleanly.

◆ GetHistFile()

TDirectory * RootFile_service::GetHistFile ( bool  create_if_needed = true)
inline

This will return a pointer to the top-level directory of the common output root file for histograms. If create_if_needed is true and the root file has not already been created, then one will be created. If create_if_needed is false, the pointer to the existing file will be returned or nullptr if it does not already exist.

NOTE: This should only be called by a thread already holding the global root lock, e.g.:

auto rootfile_service = japp->GetService<RootFile_service>(); auto globalRootLock = japp->GetService<JGlobalRootLock>(); globalRootLock->acquire_write_lock(); auto rootfile = rootfile_service->GetHistFile(); globalWriteLock->release_lock();

Parameters
create_if_neededcreate file if not already created
Returns

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