This file is indexed.

/usr/include/root/Fit/DataVector.h is in libroot-math-mathcore-dev 5.34.14-1build1.

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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
// @(#)root/mathcore:$Id$
// Author: L. Moneta Wed Aug 30 11:15:23 2006

/**********************************************************************
 *                                                                    *
 * Copyright (c) 2006  LCG ROOT Math Team, CERN/PH-SFT                *
 *                                                                    *
 *                                                                    *
 **********************************************************************/

// Header file for class DataVector

#ifndef ROOT_Fit_DataVector
#define ROOT_Fit_DataVector

/** 
@defgroup FitData Fit Data Classes 

Classes for describing the input data for fitting

@ingroup Fit
*/


// #ifndef ROOT_Fit_DataVectorfwd
// #include "Fit/DataVectorfwd.h"
// #endif

#ifndef ROOT_Fit_DataOptions
#include "Fit/DataOptions.h"
#endif


#ifndef ROOT_Fit_DataRange
#include "Fit/DataRange.h"
#endif


#include <vector>
#include <cassert>
#include <iostream> 


namespace ROOT { 

   namespace Fit { 


/**
   Base class for all the fit data types

   @ingroup FitData
 */

class FitData { 
  
public: 

   /// construct with default option and data range 
   FitData() {}

   /// dummy virtual destructor
   virtual ~FitData() {}

   /// construct passing options and default data range 
   FitData(const DataOptions & opt) : 
      fOptions(opt)
   {}


   /// construct passing range and default options 
   FitData(const DataRange & range) : 
      fRange(range)
   {}

   /// construct passing options and data range 
   FitData (const DataOptions & opt, const DataRange & range) : 
      fOptions(opt), 
      fRange(range)
   {}

   /**
      access to options
    */
   const DataOptions & Opt() const { return fOptions; }
   DataOptions & Opt() { return fOptions; }

   /**
      access to range
    */
   const DataRange & Range() const { return fRange; }

   // range cannot be modified afterwards
   // since fit method functions use all data 

   /** 
       define a max size to avoid allocating too large arrays 
   */
   static unsigned int MaxSize()  { 
      return (unsigned int) (-1) / sizeof (double);
   }


private: 

      DataOptions fOptions; 
      DataRange   fRange; 

};
      


/** 
   class holding the fit data points. It is template on the type of point,
   which can be for example a binned or unbinned point. 
   It is basicaly a wrapper on an std::vector  

   @ingroup FitData

*/ 

class DataVector {

public: 


   typedef std::vector<double>      FData;

   /** 
      default constructor for a vector of N -data
   */ 
   explicit DataVector (size_t n ) : 
      fData(std::vector<double>(n))

   {
      //if (n!=0) fData.reserve(n);
   } 


   /** 
      Destructor (no operations)
   */ 
   ~DataVector ()  {}  

   // use default copy constructor and assignment operator
   

   /**
      const access to underlying vector 
    */
   const FData & Data() const { return fData; }

   /**
      non-const access to underlying vector (in case of insertion/deletion) and iterator
    */
   FData & Data()  { return fData; }

#ifndef __CINT__
   /**
      const iterator access 
   */ 
   typedef FData::const_iterator const_iterator;
   typedef FData::iterator iterator;

   const_iterator begin() const { return fData.begin(); }
   const_iterator end() const { return fData.begin()+fData.size(); }

   /**
      non-const iterator access 
   */ 
   iterator begin() { return fData.begin(); }
   iterator end()   { return fData.end(); }

#endif
   /**
      access to the point
    */ 
   const double & operator[] (unsigned int i)  const { return fData[i]; } 
   double & operator[] (unsigned int i)   { return fData[i]; } 


   /**
      full size of data vector (npoints * point size) 
    */
   size_t Size() const { return fData.size(); } 


private: 

      FData fData; 
}; 


//       // usefule typedef's of DataVector
//       class BinPoint;
      
//       // declaration for various type of data vectors
//       typedef DataVector<ROOT::Fit::BinPoint>                    BinData; 
//       typedef DataVector<ROOT::Fit::BinPoint>::const_iterator    BinDataIterator; 

/**
   class maintaining a pointer to external data
   Using this class avoids copying the data when performing a fit
   NOTE: this class is not thread-safe and should not be used in parallel fits
   

   @ingroup FitData
 */

class DataWrapper { 

public: 

   /**
      specialized constructor for 1D data without errors and values
    */
   explicit DataWrapper(const double * dataX ) :
      fDim(1),
      fValues(0), 
      fErrors(0),
      fCoords(std::vector<const double * >(1) ),
      fX(std::vector<double>(1) )
   {
      fCoords[0] = dataX; 
   }


   /**
      constructor for 1D data (if errors are not present a null pointer should be passed) 
    */
   DataWrapper(const double * dataX, const double * val, const double * eval , const double * ex ) :
      fDim(1),
      fValues(val), 
      fErrors(eval),
      fCoords(std::vector<const double * >(1) ),
      fErrCoords(std::vector<const double * >(1) ),
      fX(std::vector<double>(1) ),
      fErr(std::vector<double>(1) )
   {
      fCoords[0] = dataX; 
      fErrCoords[0] = ex; 
   }

   /**
      constructor for 2D data (if errors are not present a null pointer should be passed) 
    */
   DataWrapper(const double * dataX, const double * dataY, const double * val, const double * eval, const double * ex , const double * ey  ) : 
      fDim(2),
      fValues(val), 
      fErrors(eval),
      fCoords(std::vector<const double * >(2) ),
      fErrCoords(std::vector<const double * >(2) ),
      fX(std::vector<double>(2) ),
      fErr(std::vector<double>(2) )
   {
      fCoords[0] = dataX; 
      fCoords[1] = dataY; 
      fErrCoords[0] = ex; 
      fErrCoords[1] = ey; 
   }

   /**
      constructor for 3D data (if errors are not present a null pointer should be passed) 
    */
   DataWrapper(const double * dataX, const double * dataY, const double * dataZ, const double * val, const double * eval, const double * ex , const double * ey, const double * ez  ) : 
      fDim(3),
      fValues(val), 
      fErrors(eval),
      fCoords(std::vector<const double * >(3) ),
      fErrCoords(std::vector<const double * >(3) ),
      fX(std::vector<double>(3) ),
      fErr(std::vector<double>(3) )
   {
      fCoords[0] = dataX; 
      fCoords[1] = dataY; 
      fCoords[2] = dataZ; 
      fErrCoords[0] = ex; 
      fErrCoords[1] = ey; 
      fErrCoords[2] = ez; 
   }

   /**
      constructor for multi-dim data without  errors 
    */
   template<class Iterator> 
   DataWrapper(unsigned int dim,  Iterator  coordItr ) :  
      fDim(dim),
      fValues(0), 
      fErrors(0),
      fCoords(std::vector<const double * >(coordItr, coordItr+dim) ),
      fX(std::vector<double>(dim) )
   { }


   /**
      constructor for multi-dim data with errors and values (if errors are not present a null pointer should be passed) 
    */
   template<class Iterator> 
   DataWrapper(size_t dim, Iterator coordItr, const double * val, const double * eval, Iterator errItr ) :  
      // use size_t for dim to avoid allocating huge vector on 64 bits when dim=-1
      fDim(dim),
      fValues(val), 
      fErrors(eval),
      fCoords(std::vector<const double * >(coordItr, coordItr+dim) ),
      fErrCoords(std::vector<const double * >(errItr, errItr+dim) ),
      fX(std::vector<double>(dim) ),
      fErr(std::vector<double>(dim) )
   { }

   // destructor 
   ~DataWrapper() { 
      //printf("Delete Data wrapper\n");
      // no operations
   }

   // use default copy constructor and assignment operator
   // copy the pointer of the data not the data


   const double * Coords(unsigned int ipoint) const { 
      for (unsigned int i = 0; i < fDim; ++i) { 
         const double * x = fCoords[i];
         assert (x != 0);
         fX[i] = x[ipoint];
      } 
      return &fX.front();
   }

   double Coord(unsigned int ipoint, unsigned int icoord) const { 
         const double * x = fCoords[icoord];
         assert (x != 0);
         return  x[ipoint]; 
   }


   const double * CoordErrors(unsigned int ipoint) const { 
      for (unsigned int i = 0; i < fDim; ++i) { 
         const double * err = fErrCoords[i];
         if (err == 0) return 0; 
         fErr[i] = err[ipoint];
      } 
      return &fErr.front();
   }

   double CoordError(unsigned int ipoint, unsigned int icoord) const { 
         const double * err = fErrCoords[icoord];
         return  (err != 0) ? err[ipoint] : 0; 
   }


   double Value(unsigned int ipoint) const { 
      return fValues[ipoint];
   }

   double Error(unsigned int ipoint) const {       
      return (fErrors) ?  fErrors[ipoint]  : 0. ;
   } 



private: 


   unsigned int fDim;
   const double * fValues; 
   const double * fErrors;   
   std::vector<const double *> fCoords;
   std::vector<const double *> fErrCoords;
   // cached vector to return x[] and errors on x
   mutable std::vector<double> fX;
   mutable std::vector<double> fErr;

};


  
   } // end namespace Fit

} // end namespace ROOT



#endif /* ROOT_Fit_DataVector */