HighLAND
|
#include <InputManager.hxx>
Public Member Functions | |
InputManager () | |
Constructor. | |
virtual | ~InputManager () |
Destructor, which cleans up the spills. | |
virtual void | Reset () |
Reset the converters and the UniqueID. | |
bool | Initialize (const std::string &infile_name, const std::string &conv, const bool isCosmic=false) |
virtual void | DeleteSpill () |
clean up the remaining pointers to the spills. | |
bool | ReadFile (const std::string &infile_name, bool isROOTFile) |
virtual bool | LoadSpill (Long64_t &entry) |
bool | LoadEvent (Long64_t &entry, bool delPrevious=true) |
Long64_t | LoadTree (Long64_t entry) |
Call InputConverter::LoadTree() for the selected converter. | |
Long64_t | GetEntries () |
Return the number of entries in the input file tree(s). | |
Int_t | GetNEvents (Int_t entries=-1) |
Return the number of events for a given number of entries in the input file tree(s). | |
TChain * | GetChain (const std::string &name) |
Get a TChain with a specific name from the selected converter. | |
std::string | FindFirstFile (const std::string &infile_name, bool isROOTFile) |
bool | IsROOTFile (const std::string &infile_name) |
Is this a ROOT file ? | |
InputConverter & | GetConverter () |
Get the current selected converter. | |
void | SelectConverter (InputConverter *sel) |
Set this converter as the selected one. | |
void | SelectConverter (const std::string &conv) |
Set the converter with name as the selected one. | |
void | AddConverter (const std::string &name, InputConverter *conv) |
Add this converter to the vector of recognised converters. | |
void | ReplaceConverter (const std::string &name, InputConverter *conv) |
Replace an existing converter. | |
bool | HasConverter (const std::string &conv, bool err_message=true) |
Whether the vector of converters contains one registered with this name. | |
void | IncrementPOTBySpill () |
bool | InputIsFlatTree () |
Whether a FlatTree converter has been selected. | |
bool | InputIsMiniTree () |
Whether a FlatTree converter has been selected. | |
void | RemoveConverters () |
Delete all the converters that have been added. | |
void | MakeFinalSpill () |
Creates a clone of the corrected Spill. This must be done after applying corrections. | |
AnaSpillC & | GetCorrectedSpill () |
Get the current spill (to have corrections applied to it). | |
AnaSpillC & | GetSpill () |
Get the current spill (to have corrections and systematics applied to it). | |
void | SetCorrectedSpill (AnaSpillC *Spill) |
Set the current spill (to have corrections applied to it). | |
AnaSuperEventB & | GetSuperEvent () |
Create the event. More... | |
void | ResetSpillToCorrected () |
bool | AddDataFileToConverter (const std::string &infile_name, const std::string &conv, const bool isCosmic=false, bool reset=false) |
bool | GetIsMC () |
const std::string & | GetSoftwareVersion () |
Returns the software version from the header. | |
Header & | header () |
Protected Attributes | |
std::vector< InputConverter * > | _converters |
Vector of converters. | |
InputConverter * | _selected |
Selected converter. | |
AnaSpillC * | _CorrectedSpill |
The current corrected spill. | |
AnaSpillC * | _Spill |
The current spill with corrections and systematics. | |
AnaSuperEventB * | _sevent |
The super event. | |
AnaSuperEventB * | _prevSEvent |
The previous Super Event for deleting if necessary. | |
bool | _IsMC |
Data/MC status. | |
Int_t | _uniqueID |
The current Event UniqueID. | |
class to handle correctly any input file and convert it into the analysis structure. It contains a collection of InputConverters, and automatically selects the correct converter based on the file type.
The manager keeps track of the current active spill, and provides three copies:
Definition at line 17 of file InputManager.hxx.
bool InputManager::AddDataFileToConverter | ( | const std::string & | infile_name, |
const std::string & | conv, | ||
const bool | isCosmic = false , |
||
bool | reset = false |
||
) |
Method to add a data file to the InputConverter without resetting all the trees in that converter This allows analysers to load each data event as it comes, rather than preloading them
Definition at line 49 of file InputManager.cxx.
std::string InputManager::FindFirstFile | ( | const std::string & | infile_name, |
bool | isROOTFile | ||
) |
Find the first file in a list of files (if isROOTFile is true), or simply the name of the file if isROOTFile is false.
Definition at line 170 of file InputManager.cxx.
|
inline |
Return whether thi is Monte Carlo we are dealing with This assumes data/MC status is defined once and for all for the full input (does not change on event basis)
Definition at line 163 of file InputManager.hxx.
|
inline |
Create the event.
Create the event from the Final Spill Create the SuperEvent Get the current spill (to have corrections and systematics applied to it).
Definition at line 151 of file InputManager.hxx.
void InputManager::IncrementPOTBySpill | ( | ) |
Record the POT for the current spill, based on information in the AnaBeam member of the current AnaSpill.
Definition at line 331 of file InputManager.cxx.
bool InputManager::Initialize | ( | const std::string & | infile_name, |
const std::string & | conv, | ||
const bool | isCosmic = false |
||
) |
Initializes input tree(s) branches, selecting the appropriate converter and initializing it. The "conv" parameter is deprecated. Returns whether initialization was successful.
Definition at line 98 of file InputManager.cxx.
bool InputManager::LoadEvent | ( | Long64_t & | entry, |
bool | delPrevious = true |
||
) |
Fill the raw AnaEventB structure and create a AnaSuperEventB from the raw event. The argument entry (the entry number in the input tree) will be modified inside the method by the specific converter (hence the non-cont reference). The way entry is modified will depend on whether the input file is EVENT based (every call to this method will increment by one the argument entry) or SPILL based (several events – one per bunch – correspond to the same spill, so once the first event in a given spill is read entry number will not be varied until all events in that spill are processed). At the moment oaAnalysis and MiniTree are SPILL based while FlatTree is EVENT based.
Examples on how to use this method are available in psyche/psycheSteering/vXrY/app/RunExample.cxx and psyche/psycheSteering/vXrY/src/AnalysisManager.cxx. Just search for LoadEvent in those files.
This method Returns whether the event was successfully filled.
Definition at line 216 of file InputManager.cxx.
|
virtual |
Read one or several entries in the input tree(s) to fill a raw AnaSpill, and sets the CorrectedSpill and Spill as copies of it (to be manipulated later). The argument entry (the entry number in the input tree) will be modified inside the method by the specific converter (hence the non-cont reference). The way entry is modified will depend on whether the input file is SPILL based (every call to this method will increment by one the argument entry) or EVENT based (entry number will be incremented in several units to account for several events – bunches – in the same spill). At the moment oaAnalysis and MiniTree are SPILL based while FlatTree is EVENT based.
Examples on how to use this method are available in highland2/highlandTools/vXrY/src/AnalysisLoop.cxx, and highland2/highlandTools/vXrY/src/SimpleLoopBase.cxx. Just search for LoadSpill in those files.
This method Returns whether the event was successfully filled.
Reimplemented in HighlandInputManager.
Definition at line 191 of file InputManager.cxx.
bool InputManager::ReadFile | ( | const std::string & | infile_name, |
bool | isROOTFile | ||
) |
Read the input file, adding it to the TChains of the selected converter. If isROOTFile is false, treats the file as a text file containing a list of ROOT files to add. Returns whether the file was successfully read.
Definition at line 142 of file InputManager.cxx.
void InputManager::ResetSpillToCorrected | ( | ) |
Reset the main spill to the corrected spill. This removes all the variations applied by the systematics.
Definition at line 345 of file InputManager.cxx.