This file is indexed.

/usr/include/root/TUnuranSampler.h is in libroot-math-unuran-dev 5.34.19+dfsg-1.2.

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
// @(#)root/mathcore:$Id$
// Author: L. Moneta Fri Sep 22 15:06:47 2006

/**********************************************************************
 *                                                                    *
 * Copyright (c) 2006  LCG ROOT Math Team, CERN/PH-SFT                *
 *                                                                    *
 *                                                                    *
 **********************************************************************/
// Header file for class TUnuranSampler

#ifndef ROOT_TUnuranSampler
#define ROOT_TUnuranSampler


#ifndef ROOT_Math_DistSampler
#include "Math/DistSampler.h"
#endif


namespace ROOT { 
   
   namespace Fit { 

      class DataRange; 
      class BinData;
      class UnBinData; 
   }

   namespace Math { 
   }
}



//_______________________________________________________________________________
/**
   TUnuranSampler class
   class implementing  the ROOT::Math::DistSampler interface using the UNU.RAN 
   package for sampling distributions. 


*/

class TRandom; 
class TF1; 
class TUnuran; 

class TUnuranSampler : public ROOT::Math::DistSampler { 

public: 

   /// default constructor 
   TUnuranSampler(); 


   /// virtual destructor 
   virtual ~TUnuranSampler();


   using DistSampler::SetFunction; 

   /// set the parent function distribution to use for random sampling (one dim case)
   void SetFunction(const ROOT::Math::IGenFunction & func)  { 
      fFunc1D = &func; 
      SetFunction<const ROOT::Math::IGenFunction>(func, 1);
   }

   /// set the Function using a TF1 pointer
   void SetFunction(TF1 * pdf); 


   /**
      initialize the generators with the given algorithm
      If no algorithm is passed used the default one for the type of distribution
   */
   bool Init(const char * algo ="");


   /**
      initialize the generators with the given algorithm
      If no algorithm is passed used the default one for the type of distribution
   */
   bool Init(const ROOT::Math::DistSamplerOptions & opt );

   /** 
       Set the random engine to be used 
       Needs to be called before Init to have effect
   */ 
   void SetRandom(TRandom * r);

   /** 
       Set the random seed for the TRandom instances used by the sampler 
       classes
       Needs to be called before Init to have effect      
   */ 
   void SetSeed(unsigned int seed);

   /**
      Set the print level 
      (if level=-1 use default)
    */
   void SetPrintLevel(int level) {fLevel = level;}

   /* 
      set the mode
    */
   void SetMode(double mode) { 
      fMode = mode; 
      fHasMode = true; 
   }

   /*
     set the area 
    */
   void SetArea(double area) { 
      fArea = area;
      fHasArea = true; 
   }

   /**
      Get the random engine used by the sampler
    */
   TRandom * GetRandom();

   /**
      sample one event in one dimension
      better implementation could be provided by the derived classes   
   */
   double Sample1D();//  { 
//       return fUnuran->Sample();
//    }

   /**
      sample one event in multi-dimension by filling the given array
      return false if sampling failed
   */
   bool Sample(double * x);
//  { 
//       if (!fOneDim) return fUnuran->SampleMulti(x); 
//       x[0] = Sample1D(); 
//       return true; 
//    } 

   /**
      sample one bin given an estimated of the pdf in the bin
      (this can be function value at the center or its integral in the bin 
      divided by the bin width)
      By default do not do random sample, just return the function values
    */
   bool SampleBin(double prob, double & value, double *error = 0);



protected: 

   //initialization for 1D distributions
   bool DoInit1D(const char * algo); 
   //initialization for 1D discrete distributions
   bool DoInitDiscrete1D(const char * algo); 
   //initialization for multi-dim distributions
   bool DoInitND(const char * algo); 
   
   
private: 

   // private member
   bool                              fOneDim;      // flag to indicate if the function is 1 dimension
   bool                              fDiscrete;    // flag to indicate if the function is discrete
   bool                              fHasMode;     // flag to indicate if a mode is set
   bool                              fHasArea;     // flag to indicate if a area is set
   int                               fLevel;       // debug level
   double                            fMode;        // mode of dist
   double                            fArea;        // area of dist
   const ROOT::Math::IGenFunction *  fFunc1D;      // 1D function pointer
   TUnuran *                         fUnuran;      // unuran engine class

   //ClassDef(TUnuranSampler,1)  //Distribution sampler class based on UNU.RAN

};



#endif /* ROOT_TUnuranSampler */