This file is indexed.

/usr/include/root/TMVA/DataSet.h is in libroot-tmva-dev 5.34.30-0ubuntu8.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
// @(#)root/tmva $Id$
// Author: Andreas Hoecker, Peter Speckmayer, Joerg Stelzer, Helge Voss

/**********************************************************************************
 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
 * Package: TMVA                                                                  *
 * Class  : DataSet                                                               *
 * Web    : http://tmva.sourceforge.net                                           *
 *                                                                                *
 * Description:                                                                   *
 *      Contains all the data information                                         *
 *                                                                                *
 * Authors (alphabetical):                                                        *
 *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
 *      Joerg Stelzer   <Joerg.Stelzer@cern.ch>  - CERN, Switzerland              *
 *      Peter Speckmayer <Peter.Speckmayer@cern.ch>  - CERN, Switzerland          *
 *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
 *                                                                                *
 * Copyright (c) 2006:                                                            *
 *      CERN, Switzerland                                                         *
 *      U. of Victoria, Canada                                                    *
 *      MPI-K Heidelberg, Germany                                                 *
 *                                                                                *
 * Redistribution and use in source and binary forms, with or without             *
 * modification, are permitted according to the terms listed in LICENSE           *
 * (http://tmva.sourceforge.net/LICENSE)                                          *
 **********************************************************************************/

#ifndef ROOT_TMVA_DataSet
#define ROOT_TMVA_DataSet

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// DataSet                                                              //
//                                                                      //
// Class that contains all the data information                         //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include <vector>
#include <map>
#include <string>

#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_TTree
#include "TTree.h"
#endif
//#ifndef ROOT_TCut
//#include "TCut.h"
//#endif
//#ifndef ROOT_TMatrixDfwd
//#include "TMatrixDfwd.h"
//#endif
//#ifndef ROOT_TPrincipal
//#include "TPrincipal.h"
//#endif
#ifndef ROOT_TRandom3
#include "TRandom3.h"
#endif

#ifndef ROOT_TMVA_Types
#include "TMVA/Types.h"
#endif
#ifndef ROOT_TMVA_VariableInfo
#include "TMVA/VariableInfo.h"
#endif

namespace TMVA {

   class Event;
   class DataSetInfo;
   class MsgLogger;
   class Results;

   class DataSet {

   public:

      DataSet(const DataSetInfo&);
      virtual ~DataSet();

      void      AddEvent( Event *, Types::ETreeType );

      Long64_t  GetNEvents( Types::ETreeType type = Types::kMaxTreeType ) const;
      Long64_t  GetNTrainingEvents()              const { return GetNEvents(Types::kTraining); }
      Long64_t  GetNTestEvents()                  const { return GetNEvents(Types::kTesting); }

      // const getters
      const Event*    GetEvent()                        const; // returns event without transformations
      const Event*    GetEvent        ( Long64_t ievt ) const { fCurrentEventIdx = ievt; return GetEvent(); } // returns event without transformations
      const Event*    GetTrainingEvent( Long64_t ievt ) const { return GetEvent(ievt, Types::kTraining); }
      const Event*    GetTestEvent    ( Long64_t ievt ) const { return GetEvent(ievt, Types::kTesting); }
      const Event*    GetEvent        ( Long64_t ievt, Types::ETreeType type ) const 
      {
         fCurrentTreeIdx = TreeIndex(type); fCurrentEventIdx = ievt; return GetEvent();
      }




      UInt_t    GetNVariables()   const;
      UInt_t    GetNTargets()     const;
      UInt_t    GetNSpectators()  const;

      void      SetCurrentEvent( Long64_t ievt         ) const { fCurrentEventIdx = ievt; }
      void      SetCurrentType ( Types::ETreeType type ) const { fCurrentTreeIdx = TreeIndex(type); }
      Types::ETreeType GetCurrentType() const;

      void                       SetEventCollection( std::vector<Event*>*, Types::ETreeType );
      const std::vector<Event*>& GetEventCollection( Types::ETreeType type = Types::kMaxTreeType ) const;
      const TTree*               GetEventCollectionAsTree();

      Long64_t  GetNEvtSigTest();
      Long64_t  GetNEvtBkgdTest();
      Long64_t  GetNEvtSigTrain();
      Long64_t  GetNEvtBkgdTrain();

      Bool_t    HasNegativeEventWeights() const { return fHasNegativeEventWeights; }

      Results*  GetResults   ( const TString &,
                               Types::ETreeType type,
                               Types::EAnalysisType analysistype );
      void      DeleteResults   ( const TString &,
                                  Types::ETreeType type,
                                  Types::EAnalysisType analysistype );

      void      SetVerbose( Bool_t ) {}

      // sets the number of blocks to which the training set is divided,
      // some of which are given to the Validation sample. As default they belong all to Training set.
      void      DivideTrainingSet( UInt_t blockNum );

      // sets a certrain block from the origin training set to belong to either Training or Validation set
      void      MoveTrainingBlock( Int_t blockInd,Types::ETreeType dest, Bool_t applyChanges = kTRUE );

      void      IncrementNClassEvents( Int_t type, UInt_t classNumber );
      Long64_t  GetNClassEvents      ( Int_t type, UInt_t classNumber );
      void      ClearNClassEvents    ( Int_t type );

      TTree*    GetTree( Types::ETreeType type );

      // accessors for random and importance sampling
      void      InitSampling( Float_t fraction, Float_t weight, UInt_t seed = 0 );
      void      EventResult( Bool_t successful, Long64_t evtNumber = -1 );
      void      CreateSampling() const;

      UInt_t    TreeIndex(Types::ETreeType type) const;

   private:

      // data members
      DataSet();
      void DestroyCollection( Types::ETreeType type, Bool_t deleteEvents );

      const DataSetInfo&         fdsi;                //! datasetinfo that created this dataset

      std::vector<Event*>::iterator        fEvtCollIt;
      std::vector< std::vector<Event*>*  > fEventCollection; //! list of events for training/testing/...

      std::vector< std::map< TString, Results* > > fResults;         //!  [train/test/...][method-identifier]

      mutable UInt_t             fCurrentTreeIdx;
      mutable Long64_t           fCurrentEventIdx;

      // event sampling
      std::vector<Char_t>        fSampling;                    // random or importance sampling (not all events are taken) !! Bool_t are stored ( no std::vector<bool> taken for speed (performance) issues )
      std::vector<Int_t>         fSamplingNEvents;            // number of events which should be sampled
      std::vector<Float_t>       fSamplingWeight;              // weight change factor [weight is indicating if sampling is random (1.0) or importance (<1.0)] 
      mutable std::vector< std::vector< std::pair< Float_t, Long64_t >* > > fSamplingEventList;  // weights and indices for sampling
      mutable std::vector< std::vector< std::pair< Float_t, Long64_t >* > > fSamplingSelected;   // selected events
      TRandom3                   *fSamplingRandom;             // random generator for sampling


      // further things
      std::vector< std::vector<Long64_t> > fClassEvents;       //! number of events of class 0,1,2,... in training[0] 
                                                               // and testing[1] (+validation, trainingoriginal)

      Bool_t                     fHasNegativeEventWeights;     // true if at least one signal or bkg event has negative weight

      mutable MsgLogger*         fLogger;   // message logger
      MsgLogger& Log() const { return *fLogger; }
      std::vector<Char_t>        fBlockBelongToTraining;       // when dividing the dataset to blocks, sets whether 
                                                               // the certain block is in the Training set or else 
                                                               // in the validation set 
                                                               // boolean are stored, taken std::vector<Char_t> for performance reasons (instead of std::vector<Bool_t>)
      Long64_t                   fTrainingBlockSize;           // block size into which the training dataset is divided

      void  ApplyTrainingBlockDivision();
      void  ApplyTrainingSetDivision();
   };
}


//_______________________________________________________________________
inline UInt_t TMVA::DataSet::TreeIndex(Types::ETreeType type) const
{
   switch (type) {
   case Types::kMaxTreeType : return fCurrentTreeIdx;
   case Types::kTraining : return 0;
   case Types::kTesting : return 1;
   case Types::kValidation : return 2;
   case Types::kTrainingOriginal : return 3;
   default : return fCurrentTreeIdx;
   }
}

//_______________________________________________________________________
inline TMVA::Types::ETreeType TMVA::DataSet::GetCurrentType() const
{
   switch (fCurrentTreeIdx) {
   case 0: return Types::kTraining;
   case 1: return Types::kTesting;
   case 2: return Types::kValidation;
   case 3: return Types::kTrainingOriginal;
   }
   return Types::kMaxTreeType;
}

//_______________________________________________________________________
inline Long64_t TMVA::DataSet::GetNEvents(Types::ETreeType type) const 
{
   Int_t treeIdx = TreeIndex(type);
   if (fSampling.size() > UInt_t(treeIdx) && fSampling.at(treeIdx)) {
      return fSamplingSelected.at(treeIdx).size();
   }
   return GetEventCollection(type).size();
}

//_______________________________________________________________________
inline const std::vector<TMVA::Event*>& TMVA::DataSet::GetEventCollection( TMVA::Types::ETreeType type ) const
{
   return *(fEventCollection.at(TreeIndex(type)));
}


#endif