HighLAND
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SimpleLoopBase Class Referenceabstract

#include <SimpleLoopBase.hxx>

Inheritance diagram for SimpleLoopBase:
OutputManager TreeManager CreateFlatTree CreateMiniTree

Public Member Functions

 SimpleLoopBase (int argc, char *argv[])
 
void Loop (int nmax=0, int imin=0)
 
void Execute ()
 
- Public Member Functions inherited from OutputManager
virtual bool InitializeEntry ()
 
void InitializeTrees (bool iniVars=true)
 
void InitializeTree (Int_t tree_index, bool iniVars=true)
 
void InitializeTree ()
 
std::string GetString (int a)
 
std::string GetSize (const std::string &counter_name, unsigned int size)
 
const std::string & GetVarName (Int_t tree_index, Int_t var_index) const
 Returns the variable name.
 
const std::string & GetVarName (Int_t var_index) const
 
const std::string & GetCounterName (Int_t tree_index, Int_t counter_index) const
 Returns the counter name.
 
const std::string & GetCounterName (Int_t counter_index) const
 
void AddCounter (Int_t tree_index, Int_t index, Int_t counter_index, const std::string &counter_name, int size=-1)
 
void AddCounter (Int_t tree_index, Int_t counter_index, const std::string &counter_name, int size=-1)
 
void InitializeCounter (Int_t tree_name, Int_t counter_index)
 
void InitializeCounter (Int_t counter_index)
 
void ResizeCounter (Int_t tree_index, Int_t counter_index, Int_t size)
 
void ResizeCounter (Int_t counter_index, int size)
 
bool HasCounter (Int_t tree_name, Int_t counter_index)
 
bool CheckCounterType (Int_t counter_index, Int_t indx, Int_t var_index)
 
void IncrementCounter (Int_t counter_index)
 
void IncrementCounterForVar (Int_t index)
 
Int_t GetCounterIndexForVar (Int_t index)
 
Int_t GetCounterValue (Int_t counter_index)
 
Int_t GetCounterValue (Int_t tree_index, Int_t counter_index)
 
Int_t GetCounterValueForVar (Int_t index)
 
Int_t GetCounterValueForVar (Int_t tree_index, Int_t index)
 
bool GetFirstIndexFromCounter (Int_t index, Int_t &indx1)
 
void DeleteVar (Int_t tree_index, Int_t index)
 
void AddVar (Int_t index, const std::string &name, const std::string &type, const std::string &doc, double ini=-9999)
 Add a single variable to all trees.
 
void AddVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &doc, double ini=-9999)
 Add a single variable to a specific tree.
 
void AddVectorVar (Int_t index, const std::string &name, const std::string &type, const std::string &doc, Int_t counter_index, const std::string &counter_name, Int_t size=-MAXVECTORSIZE)
 Add a vector variable to all trees.
 
void AddVectorVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &doc, Int_t counter_index, const std::string &counter_name, Int_t size=-MAXVECTORSIZE)
 Add a vector variable to a specific tree.
 
void AddVectorVar (Int_t index, const std::string &name, const std::string &type, const std::string &doc, const int size)
 Add a vector variable to all trees.
 
void AddVectorVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &doc, const int size)
 Add a vector variable to a specific tree.
 
void AddMatrixVar (Int_t index, const std::string &name, const std::string &type, const std::string &doc, Int_t counter_index, const std::string &counter_name, int size1=-MAXVECTORSIZE, int size2=-1)
 Add a matrix variable to all trees.
 
void AddMatrixVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &doc, Int_t counter_index, const std::string &counter_name, int size1=-MAXVECTORSIZE, int size2=-1)
 Add a matrix variable to a specific tree.
 
void AddMatrixVar (Int_t index, const std::string &name, const std::string &type, const std::string &doc, int size1=-MAXVECTORSIZE, int size2=-1)
 Add a matrix variable to all trees.
 
void AddMatrixVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &doc, int size1=-MAXVECTORSIZE, int size2=-1)
 Add a matrix variable to a specific tree.
 
void Add3DMatrixVar (Int_t index, const std::string &name, const std::string &type, const std::string &doc, Int_t counter_index, const std::string &counter_name, int size1=-MAXVECTORSIZE, int size2=-1, int size3=-1)
 Add a 3D matrix variable to all trees.
 
void Add3DMatrixVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &doc, Int_t counter_index, const std::string &counter_name, int size1=-MAXVECTORSIZE, int size2=-1, int size3=-1)
 Add a 3D matrix variable to a specific tree.
 
void AddToyVar (Int_t index, const std::string &name, const std::string &type, const std::string &docstring)
 Add a single analysis variable to all trees.
 
void AddToyVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &docstring)
 Add a single analysis variable to a specific tree.
 
void AddToyVectorVar (Int_t index, const std::string &name, const std::string &type, const std::string &docstring, int ncomp)
 Add a vector analysis variable to all trees.
 
void AddToyVectorVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &docstring, int ncomp)
 Add a vector analysis variable to a specific tree.
 
void AddToyMatrixVar (Int_t index, const std::string &name, const std::string &type, const std::string &docstring, int ncomp1, int ncomp2)
 Add a matrix analysis variable to all trees.
 
void AddToyMatrixVar (Int_t tree_index, Int_t index, const std::string &name, const std::string &type, const std::string &docstring, int ncomp1, int ncomp2)
 Add a matrix analysis variable to a specific tree.
 
void InitializeVar (Int_t index, Double_t ini)
 
void InitializeVectorVar (Int_t index, Double_t ini)
 
void InitializeMatrixVar (Int_t index, Double_t ini)
 
void FillVar (Int_t index, Float_t var)
 Fill a single variable.
 
void FillVar (Int_t index, Double_t var)
 
void FillVar (Int_t index, Int_t var)
 
void FillVar (Int_t index, const std::string &var)
 
Float_t GetVarValueF (Int_t index)
 Get the value of a var already filled (so to be used in another package)
 
Double_t GetVarValueD (Int_t index)
 
Int_t GetVarValueI (Int_t index)
 
void FillVectorVar (Int_t index, Float_t var, Int_t indx=-1)
 Fill a vector variable.
 
void FillVectorVar (Int_t index, Int_t var, Int_t indx=-1)
 
void FillVectorVar (Int_t index, Double_t var, Int_t indx=-1)
 
void FillVectorVar (Int_t index, const std::string &var, Int_t indx=-1)
 
void FillVectorVarFromArray (Int_t index, const Double_t var[], UInt_t size)
 Fill a vector variable from array.
 
void FillVectorVarFromArray (Int_t index, const Float_t var[], UInt_t size)
 
void FillVectorVarFromArray (Int_t index, const Int_t var[], UInt_t size)
 
void FillVectorVarFromArray (Int_t index, const std::string var[], UInt_t size)
 
Float_t GetVectorVarValueF (Int_t index, Int_t i1)
 Get the value of a var already filled (so to be used in another package)
 
Double_t GetVectorVarValueD (Int_t index, Int_t i1)
 
Int_t GetVectorVarValueI (Int_t index, Int_t i1)
 
void FillMatrixVar (Int_t index, Float_t var, Int_t indx1, Int_t indx2)
 Fill a matrix variable.
 
void FillMatrixVar (Int_t index, Int_t var, Int_t indx1, Int_t indx2)
 
void FillMatrixVar (Int_t index, Double_t var, Int_t indx1, Int_t indx2)
 
void FillMatrixVarFromArray (Int_t index, const Double_t var[], Int_t indx1, UInt_t size)
 Fill a matrix variable from array.
 
void FillMatrixVarFromArray (Int_t index, const Float_t var[], Int_t indx1, UInt_t size)
 
void FillMatrixVarFromArray (Int_t index, const Int_t var[], Int_t indx1, UInt_t size)
 
void FillMatrixVarFromArray (Int_t index, const Double_t var[], UInt_t size)
 Fill a matrix variable from array.
 
void FillMatrixVarFromArray (Int_t index, const Float_t var[], UInt_t size)
 
void FillMatrixVarFromArray (Int_t index, const Int_t var[], UInt_t size)
 
Float_t GetMatrixVarValueF (Int_t index, Int_t i1, Int_t i2)
 Get the value of a var already filled (so to be used in another package)
 
Double_t GetMatrixVarValueD (Int_t index, Int_t i1, Int_t i2)
 
Int_t GetMatrixVarValueI (Int_t index, Int_t i1, Int_t i2)
 
void Fill3DMatrixVar (Int_t index, Float_t var, Int_t indx1, Int_t indx2, Int_t indx3)
 Fill a 3D matrix variable.
 
void Fill3DMatrixVar (Int_t index, Int_t var, Int_t indx1, Int_t indx2, Int_t indx3)
 
void Fill3DMatrixVar (Int_t index, Double_t var, Int_t indx1, Int_t indx2, Int_t indx3)
 
void Fill3DMatrixVarFromArray (Int_t index, const Double_t var[], Int_t indx1, Int_t indx2, UInt_t size)
 Fill a 3D matrix variable from array.
 
void Fill3DMatrixVarFromArray (Int_t index, const Float_t var[], Int_t indx1, Int_t indx2, UInt_t size)
 
void Fill3DMatrixVarFromArray (Int_t index, const Int_t var[], Int_t indx1, Int_t indx2, UInt_t size)
 
void FillToyVar (Int_t index, Int_t var)
 Fill a single analysis variable.
 
void FillToyVar (Int_t index, Float_t var)
 
void FillToyVar (Int_t index, Double_t var)
 
Float_t GetToyVarValueF (Int_t index)
 Get the value of a var already filled (so to be used in another package)
 
Double_t GetToyVarValueD (Int_t index)
 
Int_t GetToyVarValueI (Int_t index)
 
void FillToyVectorVar (Int_t index, Int_t var, Int_t comp)
 Fill a vector analysis variable.
 
void FillToyVectorVar (Int_t index, Float_t var, Int_t comp)
 
void FillToyVectorVar (Int_t index, Double_t var, Int_t comp)
 
Float_t GetToyVectorVarValueF (Int_t index, Int_t i1)
 Get the value of a var already filled (so to be used in another package)
 
Double_t GetToyVectorVarValueD (Int_t index, Int_t i1)
 
Int_t GetToyVectorVarValueI (Int_t index, Int_t i1)
 
void FillToyMatrixVar (Int_t index, Int_t var, Int_t comp1, Int_t comp2)
 Fill a matrix analysis variable.
 
void FillToyMatrixVar (Int_t index, Float_t var, Int_t comp1, Int_t comp2)
 
void FillToyMatrixVar (Int_t index, Double_t var, Int_t comp1, Int_t comp2)
 
void InitializeAnalysisVar (Int_t index, Double_t ini)
 
void InitializeAnalysisVectorVar (Int_t index, Double_t ini)
 
void FillTree (Int_t tree_index)
 Fill a specific tree.
 
void FillTree ()
 Fill the current tree.
 
void WriteTree (const std::string &file, const std::string &conf)
 Write a specific tree into a file.
 
void WriteTrees (const std::string &file)
 Write all trees into a file.
 
void AddTreeWithName (Int_t tree_index, const std::string &tree_name, TTree *tree=NULL)
 Add a tree provided its index and name.
 
bool OpenOutputFile (const std::string &file)
 open the output file
 
void CloseOutputFile ()
 close the output file
 
bool ValidateVarNameAndIndex (Int_t tree_index, Int_t var_index, const std::string &var_name)
 
bool IsSpecialTree (Int_t tree_index)
 
void SetToyIndex (Int_t index)
 Set and gets the index of the current toy experiment.
 
Int_t GetToyIndex ()
 
void SetNToys (Int_t tree_index, int ntoys)
 Sets and gets the number of toy experiments for a given configuration.
 
UInt_t GetNToys (Int_t tree_index)
 Get the number of toys for a given tree.
 
UInt_t GetNToys ()
 Get the number of toys for the current tree.
 
void AddToyWeight (Double_t w)
 
void FillMicroTrees ()
 
void SetFillSingleTree (Int_t tree_index)
 
void SetFillAllTrees ()
 
void CheckVariableType (Int_t index, const std::string &dim, const std::string &type, Bool_t exist)
 
void SetDocStringManager (DocStringManager *doc)
 
DocStringManagerdocstrings ()
 
- Public Member Functions inherited from TreeManager
std::vector< TTree *> & GetTrees ()
 Returns the map of trees.
 
TTree * GetTree (Int_t index)
 Returns the a tree with a given index.
 
TTree * GetTree (const std::string &name)
 Returns the a tree with a given name.
 
TTree * GetTree ()
 Returns the a tree set as current.
 
void ReadTree (const std::string &file, Int_t index)
 Read a tree from a file provided the index.
 
void ReadTree (const std::string &file, const std::string &name)
 Read a tree from a file provided the name.
 
void ReadFile (const std::string &file)
 Read all trees from a file.
 
Int_t GetTreeIndex (const std::string &tree_name)
 Retuns the tree index provided the name.
 
std::string GetTreeName (Int_t index)
 Retuns the tree name provided the index.
 
Int_t GetCurrentTree () const
 Retuns the current tree index.
 
std::string GetCurrentTreeName ()
 Retuns the current tree name.
 
void SetCurrentTree (Int_t index)
 Sets the current tree provided the index.
 
void SetCurrentTree (const std::string &tree_name)
 Sets the current tree provided the name.
 
bool HasTree (Int_t index)
 Check the existence of a tree provided the index.
 
bool HasTree (const std::string &tree_name)
 Check the existence of a tree provided the name.
 

Protected Member Functions

void PrintUsage (const std::string &programName)
 Print the program's usage statement.
 
virtual bool Initialize ()
 
virtual bool InitializeSpill ()
 
virtual void Finalize ()
 
virtual void FinalizeSpill ()
 Finalize each spill, including cleaning up data read from the input file.
 
virtual bool Process ()=0
 
virtual void DefineOutputTree ()
 Define the tree that should be written to the output file.
 
HighlandInputManagerinput ()
 
void FillConfigTree ()
 Fill the "config" tree, which includes details of the analysis cuts etc.
 

Protected Attributes

Long64_t _entry
 The current entry in the file.
 
std::string _inputFileName
 Input file name, as specified by the user.
 
std::string _inputFileType
 
std::string _outputFileName
 The output file name, as specified by the user.
 
bool _cosmicMode
 
bool _versionCheck
 Check version compatibility between nd280AnalysisTools compilation and oaAnalysis file.
 
MemoryUsage _memory
 Memory logging.
 
CorrectionManager _corrections
 Correction manager.
 
DocStringManager _docStrings
 DocStrings manager.
 
- Protected Attributes inherited from OutputManager
std::string _default_docstring
 
DocStringManager_doc
 
std::vector< Double_t > _toyWeights
 
int _toy_index
 current toy experiment index
 
Int_t _single_tree_fill
 
std::vector< std::vector< std::string > > _tree_vars_all_vars
 The names of all variables added.
 
std::vector< std::vector< std::string > > _tree_vars_all_counters
 The names of all counters added.
 
std::vector< std::vector< Int_t > > _link_var_to_counter
 Correspondece between a variable index and the counter index.
 
std::vector< std::vector< Int_t > > _tree_vars_counter_size
 The size of the counter: 0 for variable size vectors, >0 for fix size vectors.
 
std::vector< std::vector< Int_t > > _tree_vars_counter
 The counter it self.
 
std::vector< std::vector< Int_t > > _tree_vars_int
 Single variables.
 
std::vector< std::vector< Float_t > > _tree_vars_float
 
std::vector< std::vector< Double_t > > _tree_vars_double
 
std::vector< std::vector< achar > > _tree_vars_char
 
std::vector< std::vector< int_vector *> > _tree_vars_int_vector
 Vector variables (1 index)
 
std::vector< std::vector< float_vector *> > _tree_vars_float_vector
 
std::vector< std::vector< double_vector *> > _tree_vars_double_vector
 
std::vector< std::vector< char_vector *> > _tree_vars_char_vector
 
std::vector< std::vector< int_matrix *> > _tree_vars_int_matrix
 Matrix variables (2 indices)
 
std::vector< std::vector< float_matrix *> > _tree_vars_float_matrix
 
std::vector< std::vector< double_matrix *> > _tree_vars_double_matrix
 
std::vector< std::vector< char_matrix *> > _tree_vars_char_matrix
 
std::vector< std::vector< int_3Dmatrix *> > _tree_vars_int_3Dmatrix
 3D matrix variables (3 indices)
 
std::vector< std::vector< float_3Dmatrix *> > _tree_vars_float_3Dmatrix
 
std::vector< std::vector< double_3Dmatrix *> > _tree_vars_double_3Dmatrix
 
std::vector< std::vector< Int_t > > _tree_vars_used_counter
 The counter it self.
 
std::vector< std::vector< Int_t > > _tree_vars_used_int
 Single variables.
 
std::vector< std::vector< Int_t > > _tree_vars_used_float
 
std::vector< std::vector< Int_t > > _tree_vars_used_double
 
std::vector< std::vector< Int_t > > _tree_vars_used_char
 
std::vector< std::vector< Int_t > > _tree_vars_used_int_vector
 Vector variables (1 index)
 
std::vector< std::vector< Int_t > > _tree_vars_used_float_vector
 
std::vector< std::vector< Int_t > > _tree_vars_used_double_vector
 
std::vector< std::vector< Int_t > > _tree_vars_used_char_vector
 
std::vector< std::vector< Int_t > > _tree_vars_used_int_matrix
 Matrix variables (2 indices)
 
std::vector< std::vector< Int_t > > _tree_vars_used_float_matrix
 
std::vector< std::vector< Int_t > > _tree_vars_used_double_matrix
 
std::vector< std::vector< Int_t > > _tree_vars_used_char_matrix
 
std::vector< std::vector< Int_t > > _tree_vars_used_int_3Dmatrix
 3D matrix variables (3 indices)
 
std::vector< std::vector< Int_t > > _tree_vars_used_float_3Dmatrix
 
std::vector< std::vector< Int_t > > _tree_vars_used_double_3Dmatrix
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_int
 –— Vectors containing whether a given index is used or not More...
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_float
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_double
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_char
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_int_vector
 Vector variables (1 index)
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_float_vector
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_double_vector
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_char_vector
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_int_matrix
 Matrix variables (2 indices)
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_float_matrix
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_double_matrix
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_char_matrix
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_int_3Dmatrix
 3D matrix variables (3 indices)
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_float_3Dmatrix
 
std::vector< std::vector< Bool_t > > _tree_vars_exist_double_3Dmatrix
 
- Protected Attributes inherited from TreeManager
TFile * _file
 Root input or output file.
 
std::vector< TTree *> _trees
 Vector of trees.
 
std::vector< TTree *> _trees_nonull
 Vector of non NULL trees.
 
std::vector< Int_t > _trees_indices
 Vector of indices for the non NULL TTree in previous vector.
 
Int_t _current_tree
 The current tree.
 

Additional Inherited Members

- Public Types inherited from OutputManager
enum  enumStandardMicroTrees_OutputManager { NTOYS =0, toy_weight, toy_index, enumStandardMicroTreesLast_OutputManager }
 
enum  enumSpecialTrees {
  config =0, header, truth, NRooTrackerVtx,
  GRooTrackerVtx, RooTrackerVtx, enumSpecialTreesLast
}
 

Detailed Description

This class is a base class for simple event loops (Flat tree creation, etc). It handles the opening and reading of input files, and converting each spill to the AnaSpill format. The derived Process() function is called for each spill.

Definition at line 15 of file SimpleLoopBase.hxx.

Member Function Documentation

§ Execute()

void SimpleLoopBase::Execute ( )

Entry point to the class, where argc and argv are the command line parameters.

Definition at line 382 of file SimpleLoopBase.cxx.

382  {
383 //********************************************************************
384  Loop(_entry_nmax,_entry_imin);
385 }
void Loop(int nmax=0, int imin=0)

§ Finalize()

void SimpleLoopBase::Finalize ( )
protectedvirtual

Tidy up, including closing the output file. Called after all spills have beem read.

Reimplemented from OutputManager.

Reimplemented in CreateFlatTree, and CreateMiniTree.

Definition at line 207 of file SimpleLoopBase.cxx.

207  {
208 //********************************************************************
209 
210  // Finalize the derived class
211  Finalize();
212 
213  // Create and fill the header tree with a single entry
214  AddTreeWithName(OutputManager::header,"header");
215  Header* headerp = &_input.header();
216  GetTree(OutputManager::header)->Branch("POTInfo","Header",&headerp,32000,0);
217  GetTree(OutputManager::header)->Fill();
218 
219  // Save all trees after looping over all events
220  std::vector< TTree* >::iterator it;
221  for (it=GetTrees().begin();it!=GetTrees().end();it++){
222  (*it)->AutoSave("SaveSelf");
223  }
224 
225  // Finalize the base class
226  OutputManager::Finalize();
227 
228  // Clean up
229  input().RemoveConverters();
230 
231  // Write out the memory used.
232  _memory.Write();
233 
234  // Close the output file
235  CloseOutputFile();
236 }
void AddTreeWithName(Int_t tree_index, const std::string &tree_name, TTree *tree=NULL)
Add a tree provided its index and name.
This class handles POT info, SoftwareVersion and IsMC.
Definition: Header.hxx:10
void RemoveConverters()
Delete all the converters that have been added.
MemoryUsage _memory
Memory logging.
virtual void Finalize()
std::vector< TTree *> & GetTrees()
Returns the map of trees.
Definition: TreeManager.hxx:25
void CloseOutputFile()
close the output file
TTree * GetTree()
Returns the a tree set as current.
Definition: TreeManager.hxx:34
void Write()
Write histograms of the memory usage to the output file.
Definition: MemoryUsage.cxx:27

§ Initialize()

bool SimpleLoopBase::Initialize ( )
protectedvirtual

Initialize the input manager etc, and calls the derived version of the function. Called before any spills are read.

Reimplemented from OutputManager.

Reimplemented in CreateFlatTree, and CreateMiniTree.

Definition at line 103 of file SimpleLoopBase.cxx.

103  {
104 //********************************************************************
105 
106  // Initialize the InputManager by specifying the input type and the input file
107  if (!input().Initialize(_inputFileName,_inputFileType,_cosmicMode)) return false;
108 
109  // Read corrections from the input file
110 
111  // When running over a FlatTree corrections may already exist in it.
112  // It that case corrections are read from the input file (config tree) and added to the CorrectionManager.
113  // In this case each correction is stored as
114  // "appliedInInput" and "disabled", such that it is not applied twice.
115  if (!_input.InputIsOriginalTree()){
117  }
118 
119  // Initialize the tree manager
120  if (!OutputManager::Initialize()) return false;
121 
122  // Open the output file
123  if (!OpenOutputFile(_outputFileName)) return false;
124 
125  // Initialize the top level algorithm
126  if (!Initialize()) return false;
127 
128  // Print on the screen the corrections
130 
131  // if (input().GetChain() == 0) return;
132 
133  // Define the output tree
135 
136  // Create and fill the "config" tree with a single entry
137  FillConfigTree();
138 
139  return true;
140 }
virtual void DefineOutputTree()
Define the tree that should be written to the output file.
CorrectionManager _corrections
Correction manager.
std::string _inputFileName
Input file name, as specified by the user.
virtual bool Initialize()
void DumpCorrections()
Dump all corrections.
bool OpenOutputFile(const std::string &file)
open the output file
void FillConfigTree()
Fill the "config" tree, which includes details of the analysis cuts etc.
std::string _inputFileType
std::string _outputFileName
The output file name, as specified by the user.
void ReadCorrections(const std::string &file, bool input=false)
Readthe corrections from a file.
bool InputIsOriginalTree()
Whether an OriginalTree converter has been selected.

§ InitializeSpill()

bool SimpleLoopBase::InitializeSpill ( )
protectedvirtual

Initialize each spill, including reading it from the input file. Called before Process().

Reimplemented in CreateFlatTree, and CreateMiniTree.

Definition at line 143 of file SimpleLoopBase.cxx.

143  {
144 //********************************************************************
145 
146  // Initialize the tree manager
147  OutputManager::InitializeEntry();
148 
149  // To compute the entry increment
150  Int_t entry0 = _entry;
151 
152  // Fill the spill structure for the current spill from the input tree
153  // The previous succesfully read spill is deleted internally if the current spill is OK
154  bool spillOK = input().LoadSpill(_entry);
155 
156  // To compute the entry increment
157  Int_t entry1 = _entry;
158 
159  // Increment the number of entries run so far
160  _entry_count += entry1-entry0;
161 
162  // Dump info about number of entries run
163  if (_entry_count%1000==0 || _entry_count == _entry_nmax)
164  std::cout << "entry: " << _entry_count << " of " << _entry_nmax << " (" << (100*_entry_count/_entry_nmax) << "%) --> " << _entry << std::endl;
165 
166  // return if the read spill is not OK
167  if (!spillOK) return false;
168 
169  // Apply corrections
170  _corrections.ApplyCorrections(input().GetCorrectedSpill());
171 
172  // Create a clone of the Corrected Spill
173  input().MakeFinalSpill();
174 
175  // Record the POT for this spill
176  input().IncrementPOTBySpill();
177 
178  // initialize the MyAnalysis spill
179  if (!InitializeSpill()) return false;
180 
181  return true;
182 }
CorrectionManager _corrections
Correction manager.
void IncrementPOTBySpill()
virtual bool InitializeSpill()
void ApplyCorrections(AnaSpillC &spill)
Apply all corrections.
Long64_t _entry
The current entry in the file.
void MakeFinalSpill()
Creates a clone of the corrected Spill. This must be done after applying corrections.
bool LoadSpill(Long64_t &entry)

§ Loop()

void SimpleLoopBase::Loop ( int  nmax = 0,
int  imin = 0 
)

The main event loop, which loops over all the spills, and calls Process() for each.

Definition at line 246 of file SimpleLoopBase.cxx.

246  {
247 //********************************************************************
248 
249  if (!SimpleLoopBase::Initialize()) return;
250 
251  // Get the number of entries in the tree
252  Long64_t nentries = _input.GetEntries();
253 
254  if (imin>nentries){
255  std::cout << "SimpleLoopBase::Loop(). input tree has " << nentries << " entries. You cannot start from entry " << imin << std::endl;
256  return;
257  }
258 
259  // Compute the number of entries to be run
260  if (nmax==0 || imin+nmax>nentries) _entry_nmax = nentries-imin;
261  else _entry_nmax = nmax;
262 
263  // Compute the number of the last entry to be run
264  _entry_imax = _entry_imin+_entry_nmax;
265 
266  if (input().InputIsFlatTree())
267  std::cout << "SimpleLoopBase::Loop(). input tree has " << nentries << " entries for " << input().header().GetPOT() << " good POT" << std::endl;
268  else
269  std::cout << "SimpleLoopBase::Loop(). input tree has " << nentries << " entries (POT counted on the fly)" << std::endl;
270  std::cout << "SimpleLoopBase::Loop(). loop over " << _entry_nmax << " entries from entry number "<< _entry_imin << std::endl;
271 
272  // Initialize clock
273  timeval tim;
274  gettimeofday(&tim, NULL);
275  double t0=tim.tv_sec+(tim.tv_usec/1000000.0);
276 
277  //--------- Loop over entries in the tree ----------------------------------
278  _entry=_entry_imin;
279 
280  while (_entry<_entry_imax) {
281  if (!SimpleLoopBase::InitializeSpill()) continue;
282  Process();
284  }
286 
287  gettimeofday(&tim, NULL);
288  double t1=tim.tv_sec+(tim.tv_usec/1000000.0);
289 
290  std::cout << "--------- time profile --------------" << std::endl;
291  std::cout << _entry_nmax << " entries processed in " << t1-t0 << " seconds" << std::endl;
292 
293 }
Double_t GetPOT()
This is the method used externaly. It corresponds to POT that passed beam and ND280 quality cuts...
Definition: Header.hxx:36
virtual bool InitializeSpill()
virtual bool Process()=0
Long64_t _entry
The current entry in the file.
virtual void FinalizeSpill()
Finalize each spill, including cleaning up data read from the input file.
virtual bool Initialize()
virtual void Finalize()
Long64_t GetEntries()
Return the number of entries in the input file tree(s).

§ Process()

virtual bool SimpleLoopBase::Process ( )
protectedpure virtual

The main function that should be overridden in the derived class. Called once for each spill, after it has been read in from the input file. The current spill can be accessed using ND::input().GetSpill().

Implemented in CreateFlatTree, and CreateMiniTree.

Member Data Documentation

§ _cosmicMode

bool SimpleLoopBase::_cosmicMode
protected

Whether to run in "cosmics" mode, where all the tracks are saved in a single bunch.

Definition at line 81 of file SimpleLoopBase.hxx.

§ _inputFileType

std::string SimpleLoopBase::_inputFileType
protected

Input file type. The file type is now found automatically, so this is deprecated.

Definition at line 74 of file SimpleLoopBase.hxx.


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