HighLAND
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
CreateMiniTree Class Reference
Inheritance diagram for CreateMiniTree:
SimpleLoopBase OutputManager TreeManager

Public Member Functions

 CreateMiniTree (int argc, char *argv[])
 
- Public Member Functions inherited from SimpleLoopBase
 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 Types

enum  miniTreeIndex { minitree = OutputManager::enumSpecialTreesLast+1 }
 

Protected Member Functions

virtual bool Initialize ()
 
virtual bool InitializeSpill ()
 
virtual void DefineOutputTree ()
 Define the tree that should be written to the output file.
 
virtual void FinalizeSpill ()
 Finalize each spill, including cleaning up data read from the input file.
 
virtual void Finalize ()
 
virtual bool Process ()
 
virtual bool CheckTruthFillMiniTree (const AnaSpill &spill)
 
virtual bool CheckReconFillMiniTree (const AnaBunchB &bunch)
 
virtual bool CheckReconFillMiniTreeOutOfBunch (const AnaBunchB &bunch)
 
virtual bool CheckTrueVertexReaction (const AnaTrueVertex &vtx)
 
virtual bool CheckTrueVertexDetector (unsigned long det)
 
virtual void FillMiniTree ()
 
virtual void FillRooTrackerVtxTree ()
 
virtual void FilterRooTrackerVtxTree ()
 
virtual void WriteGeometry ()
 
void DeleteUninterestingBunches ()
 
virtual AnaSpillBMakeSpill ()
 
virtual AnaBeamBMakeBeam ()
 
- Protected Member Functions inherited from SimpleLoopBase
void PrintUsage (const std::string &programName)
 Print the program's usage statement.
 
HighlandInputManagerinput ()
 
void FillConfigTree ()
 Fill the "config" tree, which includes details of the analysis cuts etc.
 

Protected Attributes

RooTrackerVtxManager _rooVtxManager
 
bool _saveGeometry
 
bool _saveRoo
 
bool _filterRoo
 
bool _saveTPCInfo
 
bool _saveFGDInfo
 
bool _saveECALInfo
 
bool _saveP0DInfo
 
bool _saveSMRDInfo
 
bool _saveTrackerInfo
 
bool _saveReconDirTECALInfo
 
bool _saveReconDirPECALInfo
 
bool _saveReconDirP0DInfo
 
bool _saveReconDirFGDOnlyInfo
 
bool _useTPC1
 
bool _useTPC2
 
bool _useTPC3
 
bool _useFGD1
 
bool _useFGD2
 
bool _useP0D
 
bool _useDsECal
 
bool _useTrECal
 
bool _useP0DECal
 
bool _useSMRD
 
bool _useTPC1outOfBunch
 
bool _useTPC2outOfBunch
 
bool _useTPC3outOfBunch
 
bool _useFGD1outOfBunch
 
bool _useFGD2outOfBunch
 
bool _useP0DoutOfBunch
 
bool _useDsECaloutOfBunch
 
bool _useTrECaloutOfBunch
 
bool _useP0DECaloutOfBunch
 
bool _useSMRDoutOfBunch
 
bool _saveTrueNuNC
 
bool _saveTrueAntiNuNC
 
bool _saveTrueNumuCC
 
bool _saveTrueAntiNumuCC
 
bool _saveTrueNueCC
 
bool _saveTrueAntiNueCC
 
Double_t _POTSincePreviousSavedSpill
 
Int_t _SpillsSincePreviousSavedSpill
 
bool _lastSpillSaved
 
std::vector< SubDetId::SubDetEnum_saveTrueVertexInDet
 
AnaSpill_spill
 
UInt_t _currentGeomID
 
- Protected Attributes inherited from SimpleLoopBase
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

Definition at line 10 of file CreateMiniTree.hxx.

Member Function Documentation

§ Finalize()

void CreateMiniTree::Finalize ( )
protectedvirtual

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

Reimplemented from SimpleLoopBase.

Definition at line 319 of file CreateMiniTree.cxx.

319  {
320 //********************************************************************
321  // Save the last spill (if not save yet) such that we keep track of the total POT since the last saved entry.
322 
323  if (_lastSpillSaved) return;
324 
325  // Fill the RooTrackerVtx tree
326  // Must be called before FillMiniTree since when the RooTrackerVtx filtering is applied the RooVtxIndex in true vertices changes
327  FillRooTrackerVtxTree();
328 
329  // Fill the minitree
330  FillMiniTree();
331 
332  // Delete Spills for the last entry
333  input().DeleteSpill();
334 }
void DeleteSpill()
clean up the remaining pointers to the spills.

§ Initialize()

bool CreateMiniTree::Initialize ( )
protectedvirtual

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

Reimplemented from SimpleLoopBase.

Definition at line 66 of file CreateMiniTree.cxx.

66  {
67  //********************************************************************
68  // save RooTrackerVtx tree
69  _saveGeometry = (bool)ND::params().GetParameterI("highlandIO.FlatTree.SaveGeometry");
70 
71  // save RooTrackerVtx tree
72  _saveRoo = (bool)ND::params().GetParameterI("highlandIO.FlatTree.SaveRooTracker");
73 
74  // Filter RooTrackerVtxTree
75  _filterRoo = (bool)ND::params().GetParameterI("highlandIO.FlatTree.FilterRooTracker");
76 
77  _saveTPCInfo = (bool)ND::params().GetParameterI("highlandIO.FlatTree.SaveTPCInfo");
78  _saveFGDInfo = (bool)ND::params().GetParameterI("highlandIO.FlatTree.SaveFGDInfo");
79  _saveECALInfo = (bool)ND::params().GetParameterI("highlandIO.FlatTree.SaveECALInfo");
80  _saveP0DInfo = (bool)ND::params().GetParameterI("highlandIO.FlatTree.SaveP0DInfo");
81  _saveSMRDInfo = (bool)ND::params().GetParameterI("highlandIO.FlatTree.SaveSMRDInfo");
82  _saveTrackerInfo = (bool)ND::params().GetParameterI("highlandIO.FlatTree.SaveTrackerInfo");
83 
84  // save info from the local reconstruction to the mini tree?
85  _saveReconDirFGDOnlyInfo = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseReconDirFGDOnly" );
86  _saveReconDirP0DInfo = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseReconDirP0D" );
87  _saveReconDirPECALInfo = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseReconDirP0DECal" );
88  _saveReconDirTECALInfo = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseReconDirTrackerECal");
89 
90  _useTPC1 = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseTPC1");
91  _useTPC2 = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseTPC2");
92  _useTPC3 = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseTPC3");
93  _useFGD1 = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseFGD1");
94  _useFGD2 = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseFGD2");
95  _useP0D = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseP0D");
96  _useDsECal = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseDsECal");
97  _useTrECal = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseTrECal");
98  _useP0DECal = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseP0DECal");
99  _useSMRD = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseSMRD");
100 
101  _useTPC1outOfBunch = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseTPC1outOfBunch");
102  _useTPC2outOfBunch = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseTPC2outOfBunch");
103  _useTPC3outOfBunch = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseTPC3outOfBunch");
104  _useFGD1outOfBunch = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseFGD1outOfBunch");
105  _useFGD2outOfBunch = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseFGD2outOfBunch");
106  _useP0DoutOfBunch = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseP0DoutOfBunch");
107  _useDsECaloutOfBunch = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseDsECaloutOfBunch");
108  _useTrECaloutOfBunch = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseTrECaloutOfBunch");
109  _useP0DECaloutOfBunch = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseP0DECaloutOfBunch");
110  _useSMRDoutOfBunch = (bool)ND::params().GetParameterI("highlandIO.FlatTree.UseSMRDoutOfBunch");
111 
112  _saveTrueNuNC = (bool)ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.NuNC");
113  _saveTrueAntiNuNC = (bool)ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.AntiNuNC");
114  _saveTrueNumuCC = (bool)ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.NumuCC");
115  _saveTrueAntiNumuCC = (bool)ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.AntiNumuCC");
116  _saveTrueNueCC = (bool)ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.NueCC");
117  _saveTrueAntiNueCC = (bool)ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.AntiNueCC");
118 
119 
120  if (ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.TPC1")) _saveTrueVertexInDet.push_back(SubDetId::kTPC1);
121  if (ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.TPC2")) _saveTrueVertexInDet.push_back(SubDetId::kTPC2);
122  if (ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.TPC3")) _saveTrueVertexInDet.push_back(SubDetId::kTPC3);
123  if (ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.FGD1")) _saveTrueVertexInDet.push_back(SubDetId::kFGD1);
124  if (ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.FGD2")) _saveTrueVertexInDet.push_back(SubDetId::kFGD2);
125  if (ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.P0D")) _saveTrueVertexInDet.push_back(SubDetId::kP0D);
126  if (ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.DsECal")) _saveTrueVertexInDet.push_back(SubDetId::kDSECAL);
127  if (ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.TrECal")) _saveTrueVertexInDet.push_back(SubDetId::kTECAL);
128  if (ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.P0DECal")) _saveTrueVertexInDet.push_back(SubDetId::kPECAL);
129  if (ND::params().GetParameterI("highlandIO.FlatTree.TrueVertex.SMRD")) _saveTrueVertexInDet.push_back(SubDetId::kSMRD);
130 
131 
132  _currentGeomID=999;
133 
134 
135  // Check software version compatibility between nd280AnalysisTools and current file
136  if (_versionCheck){
137  if(!ND::versioning().CheckVersionCompatibility(input().GetSoftwareVersion(),anaUtils::GetProductionIdFromND280AnalysisTools())) return false;
138  }
139 
140  // Select the production based on the software version of the input file. This will be used to select the appropriate corrections,
141  // bunching, systematics, etc. Assume production 5 when no software version exists
142  versionUtils::prod6_bunching = false;
143  versionUtils::prod6_corrections = false;
144  versionUtils::prod6_systematics = false;
145  if (_versionCheck){
146  if (ND::versioning().GetProduction(input().GetSoftwareVersion()) >= ProdId::PROD6PRE){
147  versionUtils::prod6_bunching = true;
148  versionUtils::prod6_corrections = true;
149  versionUtils::prod6_systematics = true;
150  }
151  }
152 
153  // Dump the production used for corrections, bunching, systematics, etc
154  versionUtils::DumpProductions();
155 
156 
157  // Enable any corrections that have to be done while the mini tree is being created.
158 
159 #if !VERSION_HAS_OFFICIAL_POT
160  // Only need this correction for P5 files.
161 
162  if (ND::params().GetParameterI("highlandIO.FlatTree.EnablePOTCorrection")) {
163  // Use CT4 for MR44 POT accounting, as CT5 wasn't working properly.
164  _corrections.AddCorrection(CorrId::kCT4POTCorr, "ct4pot_corr", new CT4POTCorrection());
165  }
166 #endif
167 
168 
169  // Change the main fit momentum by the muon alternate momentum, but only for P5
170 #if !VERSION_HAS_EQUIVALENT_MAIN_AND_ALT_FITS
171  if (ND::params().GetParameterI("highlandIO.FlatTree.EnableUseMuonAltMomCorrection")) {
172  _corrections.AddCorrection(CorrId::kGlobalAltMomCorr, "altmom_corr", new UseGlobalAltMomCorrection(UseGlobalAltMomCorrection::kMuon));
173  }
174 #endif
175 
176 
177  if (ND::params().GetParameterI("highlandIO.FlatTree.EnableDQCorrection")) {
178  // Correct the data quality in periods when a FGD FEB wasn't working.
179  _corrections.AddCorrection(CorrId::kDQCorr, "dq_corr", new DataQualityCorrection());
180  }
181 
182  if (ND::params().GetParameterI("highlandIO.FlatTree.EnablePileUpCorrection")){
183  _corrections.AddCorrection(CorrId::kPileUpCorr, "pileup_corr", new PileUpCorrection());
184  }
185  // Apply the TPC dE/dx correction in all configurations
186  if (ND::params().GetParameterI("highlandIO.FlatTree.EnableTPCdEdxDataCorrection")){
187  _corrections.AddCorrection(CorrId::kTPCdEdxDataCorr, "tpcdedx_data_corr", new TPCdEdxDataCorrection());
188  }
189  // Apply the TPC dE/dx correction in all configurations
190  if (ND::params().GetParameterI("highlandIO.FlatTree.EnableTPCdEdxMCCorrection")){
191  _corrections.AddCorrection(CorrId::kTPCdEdxMCCorr, "tpcdedx_mc_corr", new TPCdEdxMCCorrection());
192  }
193  // Apply the TPC expected dE/dx correction in all configurations
194  if (ND::params().GetParameterI("highlandIO.FlatTree.EnableTPCExpecteddEdxCorrection")){
195  _corrections.AddCorrection(CorrId::kTPCdEdxExpCorr, "tpcexpecteddedx_corr", new TPCExpecteddEdxCorrection());
196  }
197 
198  // Apply the TPC PID correction based on pull params smearing
199  if (ND::params().GetParameterI("highlandIO.FlatTree.EnableTPCPIDPullMCCorrection")){
200  _corrections.AddCorrection(CorrId::kTPCPIDPullMCCorr, "tpc_pid_pull_mc_corr", new TPCPIDPullMCCorrection());
201  }
202 
203  // Ignore right ECal for runs 3 and 4 as part of it is broken.
204  if (ND::params().GetParameterI("highlandIO.FlatTree.EnableIgnoreRightECalCorrection")){
205  _corrections.AddCorrection(CorrId::kRightECalRun3And4Corr, "ignorerightecal_corr", new IgnoreRightECalRuns3and4Correction());
206  }
207 
208  // Need to be called before the ToF in order to correctly flip a track if required
209  if (ND::params().GetParameterI("highlandIO.FlatTree.EnableFlipKinematicsCorrection")){
210  _corrections.AddCorrection(CorrId::kFlipKinCorr, "flipkinematics_corr", new FlipKinematicsCorrection());
211  }
212 
213  if (ND::params().GetParameterI("highlandIO.FlatTree.EnableToFCorrection")){
214  _corrections.AddCorrection(CorrId::kToFCorr, "tof_corr", new ToFCorrection());
215  }
216 
217  if (ND::params().GetParameterI("highlandIO.FlatTree.EnableMomResolMCCorrection")){
218  _corrections.AddCorrection(CorrId::kMomResolMCCorr, "mom_resol_mc_corr", new MomResolMCCorrection());
219  }
220 
221  if (ND::params().GetParameterI("highlandIO.FlatTree.EnableMomRangeCorrection")){
222  _corrections.AddCorrection(CorrId::kMomRangeCorr, "momrange_corr", new MomRangeCorrection());
223  }
224 
225 
226  _file->mkdir("geom");
227 
228  return true;
229 }
void AddCorrection(Int_t index, const std::string &name, CorrectionBase *corr)
CorrectionManager _corrections
Correction manager.
This class defines a correction that affects the reconstructed TPC Momentum of an.
TFile * _file
Root input or output file.
Definition: TreeManager.hxx:72
ProdId_h GetProductionIdFromND280AnalysisTools()
Get Production Id from nd280AnalysisTools.
bool _versionCheck
Check version compatibility between nd280AnalysisTools compilation and oaAnalysis file...

§ InitializeSpill()

virtual bool CreateMiniTree::InitializeSpill ( )
inlineprotectedvirtual

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

Reimplemented from SimpleLoopBase.

Definition at line 20 of file CreateMiniTree.hxx.

20 {return _rooVtxManager.InitializeEntry();}

§ Process()

bool CreateMiniTree::Process ( )
protectedvirtual

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().

Implements SimpleLoopBase.

Definition at line 278 of file CreateMiniTree.cxx.

278  {
279 //********************************************************************
280 
281  // Set the tree to fill
282  SetFillSingleTree(minitree);
283  SetCurrentTree(minitree);
284 
285  // Get the corrected spill and set the branch address
286  _spill = static_cast<AnaSpill*>(&input().GetCorrectedSpill());
287  GetTree(minitree)->SetBranchAddress("Spill",&_spill );
288 
289  // The number of POT and Spills since the last saved Spill
290  _POTSincePreviousSavedSpill += _spill->Beam->POTSincePreviousSavedSpill;
291  _SpillsSincePreviousSavedSpill += _spill->Beam->SpillsSincePreviousSavedSpill;
292 
293  // Delete the uninteresting bunches
294  DeleteUninterestingBunches();
295 
296  _lastSpillSaved = false;
297 
298  // The spill is saved when there are bunches or when there are true signal vertices on it (for eff calculation)
299  if (_spill->Bunches.size()>0 || CheckTruthFillMiniTree(*_spill)){
300 
301  // Write the geometry when it changes
302  if (_saveGeometry) WriteGeometry();
303 
304  // Fill the RooTrackerVtx tree
305  // Must be called before FillMiniTree since when the RooTrackerVtx filtering is applied the RooVtxIndex in true vertices changes
306  FillRooTrackerVtxTree();
307 
308  // Fill the minitree
309  FillMiniTree();
310 
311  // Mark this spill as saved
312  _lastSpillSaved=true;
313  }
314 
315  return true;
316 }
AnaSpillC & GetCorrectedSpill()
Get the current spill (to have corrections applied to it).
std::vector< AnaBunchC * > Bunches
The reconstructed objects, split into timing bunches.
Int_t SpillsSincePreviousSavedSpill
void SetCurrentTree(Int_t index)
Sets the current tree provided the index.
Definition: TreeManager.hxx:58
AnaBeamB * Beam
The beam quality flags for this spill.
Double_t POTSincePreviousSavedSpill
TTree * GetTree()
Returns the a tree set as current.
Definition: TreeManager.hxx:34

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