NAIA
1.0.2
|
#include <NAIAChain.h>
Classes | |
class | EventItr |
union | TC |
needed for SetBranchAddress More... | |
Public Types | |
enum | AccessMode { AccessMode::Read, AccessMode::Write } |
Simple enum to express whether we are in read or write mode. More... | |
Public Member Functions | |
NAIAChain (AccessMode mode=AccessMode::Read) | |
Construct a new Single Tree Chain object. More... | |
const FileInfo & | GetEventFileInfo () |
Get the FileInfo object associated with this event. More... | |
const MCFileInfo & | GetEventMCFileInfo () |
Get the MCFileInfo object associated with this event. More... | |
const RTIInfo & | GetEventRTIInfo () |
Get the RTIInfo object associated with this event. More... | |
Event & | GetEvent (unsigned long long iEv) |
Get the Event object. More... | |
Event & | GetEventWithIndex (unsigned int run, unsigned int eventno) |
Get the Event object using the underlying index. More... | |
TChain * | GetFileInfoTree () |
Get the FileInfo TTree object. More... | |
TChain * | GetRTITree () |
Get the RTIInfo TTree object. More... | |
void | SetupBranches (bool create_MC_branches=false) |
Set all branch addresses for reading operations, or create all branches for writing operation. More... | |
SkimTreeHandle< NAIAChain > | CreateSkimTree (const std::string &filename, const std::string &exclBranches) |
Create a new SkimTree handle object and setup all internal branches. More... | |
int | Add (const std::string &filePath) |
Add a file to the chain. More... | |
void | Clear () |
Clear all the event information. More... | |
int | Fill () |
Fill the event data. More... | |
int | FillRTI () |
Fill the RTI data. More... | |
int | FillFileInfo () |
Fill the FileInfo data. More... | |
unsigned long int | GetEntries () |
Get the total number of events. More... | |
bool | IsMC () const |
Check if this file is a MC file. More... | |
void | Print () |
Print all the chains. More... | |
int | Write () |
Write the trees to disk. More... | |
void | SetDirectory (TDirectory *directory) |
Set the TDirectory for the trees. More... | |
void | SetEntryList (TEntryList *entryList, Option_t *option) |
Set an entry list for this tree. More... | |
EventItr | begin () |
EventItr | end () |
Static Private Member Functions | |
static bool | CheckVersion (const std::string &filePath) |
Private Attributes | |
bool | m_isMC = false |
unsigned long int | m_iEv = 0 |
AccessMode | m_accessMode = AccessMode::Read |
FileInfo | m_fileInfo |
MCFileInfo | m_fileInfoMC |
RTIInfo | m_rtiInfo |
Event | m_event |
FileInfo * | m_fileInfoPtr = &m_fileInfo |
MCFileInfo * | m_fileInfoMCPtr = &m_fileInfoMC |
needed for SetBranchAddress More... | |
RTIInfo * | m_rtiInfoPtr = &m_rtiInfo |
needed for SetBranchAddress More... | |
TC | m_data {} |
TC | m_rti {} |
TC | m_file {} |
Friends | |
class | NtpSelector |
class | SkimTreeHandle< NAIAChain > |
Definition at line 31 of file NAIAChain.h.
|
strong |
Simple enum to express whether we are in read or write mode.
Enumerator | |
---|---|
Read | |
Write |
Definition at line 40 of file NAIAChain.h.
|
explicit |
Construct a new Single Tree Chain object.
mode | The desired access mode |
Definition at line 11 of file NAIAChain.cpp.
int NAIA::NAIAChain::Add | ( | const std::string & | filePath | ) |
Add a file to the chain.
filePath | The path of the rootfile to be added |
Add
call on the event data chain Definition at line 127 of file NAIAChain.cpp.
References NAIA::NAIAChain::TC::chain, CheckVersion(), m_accessMode, m_data, m_file, m_rti, Read, and Write.
Referenced by main().
|
inline |
Definition at line 261 of file NAIAChain.h.
|
staticprivate |
|
inline |
Clear all the event information.
Used only in production, don't call this.
Definition at line 148 of file NAIAChain.h.
References NAIA::Event::Clear(), and m_event.
SkimTreeHandle< NAIAChain > NAIA::NAIAChain::CreateSkimTree | ( | const std::string & | filename, |
const std::string & | exclBranches | ||
) |
Create a new SkimTree handle object and setup all internal branches.
This will create a new tree in a new root file and will create all the corresponding NAIA branches (except the ones that you excluded). During the event loop you can call SkimTreeHandle::Fill to add the current event to the new tree. After looping you can call SkimTreeHandle::Write to write the new tree to disk.
filename | The rootfile where the tree will be saved |
exclBranches | A list of containers to be excluded from processing, separated by ; |
Definition at line 278 of file NAIAChain.cpp.
References NAIA::end(), NAIA::evDisablers, NAIA::getLogger(), m_event, m_isMC, NAIA::TokenizeString(), and Write.
Referenced by main().
|
inline |
Definition at line 262 of file NAIAChain.h.
References GetEntries().
int NAIA::NAIAChain::Fill | ( | ) |
Fill the event data.
Used only in production, don't call this.
Fill
call on the event data chain Definition at line 145 of file NAIAChain.cpp.
References m_accessMode, m_data, Read, NAIA::NAIAChain::TC::tree, and Write.
int NAIA::NAIAChain::FillFileInfo | ( | ) |
Fill the FileInfo data.
Used only in production, don't call this.
Fill
call on the FileInfo data chain Definition at line 167 of file NAIAChain.cpp.
References m_accessMode, m_file, Read, NAIA::NAIAChain::TC::tree, and Write.
int NAIA::NAIAChain::FillRTI | ( | ) |
Fill the RTI data.
Used only in production, don't call this.
Fill
call on the RTI data chain Definition at line 156 of file NAIAChain.cpp.
References m_accessMode, m_rti, Read, NAIA::NAIAChain::TC::tree, and Write.
unsigned long int NAIA::NAIAChain::GetEntries | ( | ) |
Get the total number of events.
Definition at line 178 of file NAIAChain.cpp.
References NAIA::NAIAChain::TC::chain, m_accessMode, m_data, Read, NAIA::NAIAChain::TC::tree, and Write.
Referenced by end(), NAIA::end(), and main().
Event & NAIA::NAIAChain::GetEvent | ( | unsigned long long | iEv | ) |
Get the Event object.
iEv | the event number |
Definition at line 28 of file NAIAChain.cpp.
References NAIA::NAIAChain::TC::chain, m_data, m_event, NAIA::Event::SetAllBranchAddress(), and NAIA::Event::SetEventNumber().
Referenced by GetEventWithIndex(), and NAIA::NAIAChain::EventItr::operator*().
const FileInfo & NAIA::NAIAChain::GetEventFileInfo | ( | ) |
Get the FileInfo object associated with this event.
Make sure this is called after GetEvent
Definition at line 66 of file NAIAChain.cpp.
References NAIA::NAIAChain::TC::chain, NAIA::Event::header, m_event, m_file, m_fileInfo, and NAIA::HeaderData::Run.
const MCFileInfo & NAIA::NAIAChain::GetEventMCFileInfo | ( | ) |
Get the MCFileInfo object associated with this event.
Make sure this is called after GetEvent
Definition at line 77 of file NAIAChain.cpp.
References NAIA::NAIAChain::TC::chain, NAIA::Event::header, IsMC(), m_event, m_file, m_fileInfoMC, and NAIA::HeaderData::Run.
const RTIInfo & NAIA::NAIAChain::GetEventRTIInfo | ( | ) |
Get the RTIInfo object associated with this event.
Make sure this is called after GetEvent
Definition at line 48 of file NAIAChain.cpp.
References NAIA::NAIAChain::TC::chain, NAIA::Event::header, IsMC(), m_event, m_rti, m_rtiInfo, and NAIA::HeaderData::UTCTime.
Event & NAIA::NAIAChain::GetEventWithIndex | ( | unsigned int | run, |
unsigned int | eventno | ||
) |
Get the Event object using the underlying index.
run | the run number |
eventno | the event number |
Definition at line 44 of file NAIAChain.cpp.
References NAIA::NAIAChain::TC::chain, GetEvent(), and m_data.
TChain * NAIA::NAIAChain::GetFileInfoTree | ( | ) |
Get the FileInfo TTree object.
If you don't want to loop on events but only care about FileInfo you can get the corresponding chain directly
Definition at line 106 of file NAIAChain.cpp.
References NAIA::NAIAChain::TC::chain, NAIA::getLogger(), m_accessMode, m_file, Read, and Write.
TChain * NAIA::NAIAChain::GetRTITree | ( | ) |
Get the RTIInfo TTree object.
If you don't want to loop on events but only care about RTIInfo you can get the corresponding chain directly
Definition at line 91 of file NAIAChain.cpp.
References NAIA::NAIAChain::TC::chain, NAIA::getLogger(), m_accessMode, m_rti, Read, and Write.
|
inline |
Check if this file is a MC file.
Definition at line 190 of file NAIAChain.h.
References m_isMC.
Referenced by GetEventMCFileInfo(), and GetEventRTIInfo().
void NAIA::NAIAChain::Print | ( | ) |
Print all the chains.
Definition at line 189 of file NAIAChain.cpp.
References NAIA::NAIAChain::TC::chain, m_accessMode, m_data, m_file, m_rti, Read, NAIA::NAIAChain::TC::tree, and Write.
void NAIA::NAIAChain::SetDirectory | ( | TDirectory * | directory | ) |
Set the TDirectory for the trees.
directory |
Definition at line 121 of file NAIAChain.cpp.
References m_data, m_file, m_rti, and NAIA::NAIAChain::TC::tree.
void NAIA::NAIAChain::SetEntryList | ( | TEntryList * | entryList, |
Option_t * | option | ||
) |
Set an entry list for this tree.
entryList | the TEntryList to be used |
option | see ROOT documentation for available options |
Definition at line 303 of file NAIAChain.cpp.
References NAIA::NAIAChain::TC::chain, NAIA::getLogger(), m_accessMode, m_data, Read, and Write.
void NAIA::NAIAChain::SetupBranches | ( | bool | create_MC_branches = false | ) |
Set all branch addresses for reading operations, or create all branches for writing operation.
Make sure you call this before the event loop
create_MC_branches | Used only in write mode to enable MC-only branches. Don't use when in read mode. |
Definition at line 227 of file NAIAChain.cpp.
References NAIA::Event::BranchAll(), NAIA::NAIAChain::TC::chain, m_accessMode, m_data, m_event, m_file, m_fileInfo, m_fileInfoMC, m_fileInfoMCPtr, m_fileInfoPtr, m_isMC, m_rti, m_rtiInfo, m_rtiInfoPtr, Read, NAIA::Event::SetAllBranchAddress(), NAIA::Event::SetMC(), NAIA::NAIAChain::TC::tree, and Write.
Referenced by main().
int NAIA::NAIAChain::Write | ( | ) |
Write the trees to disk.
Works correctly if the chain is in write mode (which happens during production). Implemented but not tested for chains in read mode.
Write
call on the event data tree Definition at line 204 of file NAIAChain.cpp.
References NAIA::NAIAChain::TC::chain, m_accessMode, m_data, m_file, m_isMC, m_rti, Read, NAIA::NAIAChain::TC::tree, and Write.
|
friend |
Definition at line 32 of file NAIAChain.h.
|
friend |
Definition at line 33 of file NAIAChain.h.
|
private |
Definition at line 269 of file NAIAChain.h.
Referenced by Add(), Fill(), FillFileInfo(), FillRTI(), GetEntries(), GetFileInfoTree(), GetRTITree(), Print(), SetEntryList(), SetupBranches(), and Write().
|
private |
Definition at line 286 of file NAIAChain.h.
Referenced by Add(), Fill(), GetEntries(), GetEvent(), GetEventWithIndex(), Print(), SetDirectory(), SetEntryList(), SetupBranches(), and Write().
|
private |
Definition at line 274 of file NAIAChain.h.
Referenced by Clear(), CreateSkimTree(), GetEvent(), GetEventFileInfo(), GetEventMCFileInfo(), GetEventRTIInfo(), and SetupBranches().
|
private |
Definition at line 288 of file NAIAChain.h.
Referenced by Add(), FillFileInfo(), GetEventFileInfo(), GetEventMCFileInfo(), GetFileInfoTree(), Print(), SetDirectory(), SetupBranches(), and Write().
|
private |
Definition at line 271 of file NAIAChain.h.
Referenced by GetEventFileInfo(), and SetupBranches().
|
private |
Definition at line 272 of file NAIAChain.h.
Referenced by GetEventMCFileInfo(), and SetupBranches().
|
private |
needed for SetBranchAddress
Definition at line 277 of file NAIAChain.h.
Referenced by SetupBranches().
|
private |
Definition at line 276 of file NAIAChain.h.
Referenced by SetupBranches().
|
private |
Definition at line 268 of file NAIAChain.h.
|
private |
Definition at line 267 of file NAIAChain.h.
Referenced by CreateSkimTree(), IsMC(), SetupBranches(), and Write().
|
private |
Definition at line 287 of file NAIAChain.h.
Referenced by Add(), FillRTI(), GetEventRTIInfo(), GetRTITree(), Print(), SetDirectory(), SetupBranches(), and Write().
|
private |
Definition at line 273 of file NAIAChain.h.
Referenced by GetEventRTIInfo(), and SetupBranches().
needed for SetBranchAddress
Definition at line 278 of file NAIAChain.h.
Referenced by SetupBranches().