<commit_before>// @(#)root/treeplayer:$Id$
// Author: <NAME>   19/01/96

/*************************************************************************
 * Copyright (C) 1995-2000, <NAME> and <NAME>.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/
// ---------------------------------- TreeFormula.h

#ifndef ROOT_TTreeFormula
#define ROOT_TTreeFormula



//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TTreeFormula                                                         //
//                                                                      //
// The Tree formula class                                               //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "v5/TFormula.h"

#include "TLeaf.h"

#include "TObjArray.h"

#include <string>
#include <vector>

#ifdef R__OLDHPACC
namespace std {
   using ::string;
   using ::vector;
}
#endif

const Int_t kMAXCODES = kMAXFOUND; // must be the same as kMAXFOUND in TFormulaOld
const Int_t kMAXFORMDIM = 5; // Maximum number of array dimensions support in TTreeFormula

class TTree;
class TArrayI;
class TMethodCall;
class TLeafObject;
class TDataMember;
class TStreamerElement;
class TFormLeafInfoMultiVarDim;
class TFormLeafInfo;
class TBranchElement;
class TAxis;
class TTreeFormulaManager;


class TTreeFormula : public ROOT::v5::TFormula {

friend class TTreeFormulaManager;

protected:
   enum EStatusBits {
      kIsCharacter = BIT(12),
      kMissingLeaf = BIT(15), // true if some of the needed leaves are missing in the current TTree
      kIsInteger   = BIT(17), // true if the branch contains an integer variable
      kNeedEntries = BIT(18)  // true if the formula uses Entries$
   };
   enum {
      kDirect, kDataMember, kMethod,
      kIndexOfEntry, kEntries, kLength, kIteration, kLengthFunc, kSum, kEntryList,
      kTreeMember,
      kIndexOfLocalEntry,
      kMin, kMax,
      kLocalEntries

   };
   enum {
      kAlias           = 200,
      kAliasString     = 201,
      kAlternate       = 202,
      kAlternateString = 203,
      kMinIf           = 204,
      kMaxIf           = 205
   };

   // Helper struct to hold a cache
   // that can accelerate calculation of the RealIndex.
   struct RealInstanceCache {
      Int_t fInstanceCache = 0;
      Int_t fLocalIndexCache = 0;
      Int_t fVirtAccumCache = 0;
   };

   TTree       *fTree;            //! pointer to Tree
   Int_t        fCodes[kMAXCODES]; //  List of leaf numbers referenced in formula
   Int_t       fNdata[kMAXCODES]; //! This caches the physical number of element in the leaf or datamember.
   Int_t       fNcodes;           //  Number of leaves referenced in formula
   Bool_t      fHasCast;          //  Record whether the formula contain a cast operation or not
   Int_t       fMultiplicity;     //  Indicator of the variability of the formula
   Int_t       fNindex;           //  Size of fIndex
   Int_t      *fLookupType;       //[fNindex] array indicating how each leaf should be looked-up
   TObjArray   fLeaves;           //!  List of leaf used in this formula.
   TObjArray   fDataMembers;      //!  List of leaf data members
   TObjArray   fMethods;          //!  List of leaf method calls
   TObjArray   fExternalCuts;     //!  List of TCutG and TEntryList used in the formula
   TObjArray   fAliases;          //!  List of TTreeFormula for each alias used.
   TObjArray   fLeafNames;        //   List of TNamed describing leaves
   TObjArray   fBranches;         //!  List of branches to read.  Similar to fLeaces but duplicates are zeroed out.
   Bool_t      fQuickLoad;        //!  If true, branch GetEntry is only called when the entry number changes.
   Bool_t      fNeedLoading;      //!  If true, the current entry has not been loaded yet.

   Int_t       fNdimensions[kMAXCODES];              //Number of array dimensions in each leaf
   Int_t       fFixedSizes[kMAXCODES][kMAXFORMDIM];  //Physical sizes of lower dimensions for each leaf
   UChar_t     fHasMultipleVarDim[kMAXCODES];        //True if the corresponding variable is an array with more than one variable dimension.<commit_msg>typos<commit_after>// @(#)root/treeplayer:$Id$
// Author: <NAME>   19/01/96

/*************************************************************************
 * Copyright (C) 1995-2000, <NAME> and <NAME>.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/
// ---------------------------------- TreeFormula.h

#ifndef ROOT_TTreeFormula
#define ROOT_TTreeFormula



//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TTreeFormula                                                         //
//                                                                      //
// The Tree formula class                                               //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "v5/TFormula.h"

#include "TLeaf.h"

#include "TObjArray.h"

#include <string>
#include <vector>

#ifdef R__OLDHPACC
namespace std {
   using ::string;
   using ::vector;
}
#endif

const Int_t kMAXCODES = kMAXFOUND; // must be the same as kMAXFOUND in TFormulaOld
const Int_t kMAXFORMDIM = 5; // Maximum number of array dimensions support in TTreeFormula

class TTree;
class TArrayI;
class TMethodCall;
class TLeafObject;
class TDataMember;
class TStreamerElement;
class TFormLeafInfoMultiVarDim;
class TFormLeafInfo;
class TBranchElement;
class TAxis;
class TTreeFormulaManager;


class TTreeFormula : public ROOT::v5::TFormula {

friend class TTreeFormulaManager;

protected:
   enum EStatusBits {
      kIsCharacter = BIT(12),
      kMissingLeaf = BIT(15), // true if some of the needed leaves are missing in the current TTree
      kIsInteger   = BIT(17), // true if the branch contains an integer variable
      kNeedEntries = BIT(18)  // true if the formula uses Entries$
   };
   enum {
      kDirect, kDataMember, kMethod,
      kIndexOfEntry, kEntries, kLength, kIteration, kLengthFunc, kSum, kEntryList,
      kTreeMember,
      kIndexOfLocalEntry,
      kMin, kMax,
      kLocalEntries

   };
   enum {
      kAlias           = 200,
      kAliasString     = 201,
      kAlternate       = 202,
      kAlternateString = 203,
      kMinIf           = 204,
      kMaxIf           = 205
   };

   // Helper struct to hold a cache
   // that can accelerate calculation of the RealIndex.
   struct RealInstanceCache {
      Int_t fInstanceCache = 0;
      Int_t fLocalIndexCache = 0;
      Int_t fVirtAccumCache = 0;
   };

   TTree      *fTree;             //! pointer to Tree
   Int_t       fCodes[kMAXCODES]; //  List of leaf numbers referenced in formula
   Int_t       fNdata[kMAXCODES]; //! This caches the physical number of element in the leaf or data member.
   Int_t       fNcodes;           //  Number of leaves referenced in formula
   Bool_t      fHasCast;          //  Record whether the formula contain a cast operation or not
   Int_t       fMultiplicity;     //  Indicator of the variability of the formula
   Int_t       fNindex;           //  Size of fIndex
   Int_t      *fLookupType;       //[fNindex] array indicating how each leaf should be looked-up
   TObjArray   fLeaves;           //!  List of leaf used in this formula.
   TObjArray   fDataMembers;      //!  List of leaf data members
   TObjArray   fMethods;          //!  List of leaf method calls
   TObjArray   fExternalCuts;     //!  List of TCutG and TEntryList used in the formula
   TObjArray   fAliases;          //!  List of TTreeFormula for each alias used.
   TObjArray   fLeafNames;        //   List of TNamed describing leaves
   TObjArray   fBranches;         //!  List of branches to read.  Similar to fLeaves but duplicates are zeroed out.
   Bool_t      fQuickLoad;        //!  If true, branch GetEntry is only called when the entry number changes.
   Bool_t      fNeedLoading;      //!  If true, the current entry has not been loaded yet.

   Int_t       fNdimensions[kMAXCODES];              //Number of array dimensions in each leaf
   Int_t       fFixedSizes[kMAXCODES][kMAXFORMDIM];  //Physical sizes of lower dimensions for each leaf
   UChar_t     fHasMultipleVarDim[kMAXCODES];        //True if the corresponding variable is an array with more than one variable dimension.
{'fraction_non_alphanumeric': 0.135339974014725, 'fraction_numerical': 0.00996102208748376, 'mean_word_length': 1.6204255319148937, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 36, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6325909', 'n_tokens_mistral': 2486, 'n_tokens_neox': 2369, 'n_words': 798}