This file is indexed.

/usr/include/root/TUnuranContDist.h is in libroot-math-unuran-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
// @(#)root/unuran:$Id$
// Authors: L. Moneta, J. Leydold Wed Feb 28 2007

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

// Header file for class TUnuranContDist


#ifndef ROOT_Math_TUnuranContDist
#define ROOT_Math_TUnuranContDist

#ifndef ROOT_Math_TUnuranBaseDist
#include "TUnuranBaseDist.h"
#endif

#ifndef ROOT_Math_IFunctionfwd
#include "Math/IFunctionfwd.h"
#endif

class TF1;



//______________________________________________________________
/** 
   TUnuranContDist class describing one dimensional continuous distribution. 
   It is used by TUnuran to generate random numbers according to this distribution via 
   TUnuran::Sample()
   
   The class can be constructed from a function (TF1) representing the probability density 
   function of the distribution. Optionally the derivative of the pdf can also be passed. 

   It provides a method to set the domain of the distribution ( SetDomain ) which will correspond to the range 
   of the generated random numbers. By default the domain is (-inf, + inf), indipendently of the 
   range set in the TF1 class used to construct the distribution. 

   In addition, some UNURAN methods requires extra information (cdf function, distribution mode, 
   area of pdf, etc...). This information can as well be set. 
   Some methods require instead of the pdf the log of the pdf. 
   This can also be controlled by setting a flag when constructing this class. 
*/ 
///////////////////////////////////////////////////////////////////////
class TUnuranContDist : public TUnuranBaseDist {

public: 


   /** 
      Constructor from a TF1 objects specifying the pdf and optionally from another function 
      representing the derivative of the pdf. The flag isLogPdf can be used to pass instead of the pdf 
      (and its derivative) the log (and the derivative of the log) of the pdf. 
      By default the distribution has not domain set (it is defined between [-inf,+inf], no mode, no pdf area and no 
      cdf explicity defined. UnuRan, if needed, can compute some of this quantities, but the user if he knows them can 
      set them in order to speed up the algorithm. For example in case of the Cdf, if the user has not set it, a numerical 
      integration algorithm is used to estimate the Cdf from the Pdf. 
      In case an algorithm requires only the Cdf (no Pdf), an empty distribution can be constructed and then the user must 
      set afterwards the Cdf. 
   */ 
   explicit TUnuranContDist (TF1 * pdf = 0, TF1 * deriv = 0, bool isLogPdf = false );

   /** 
      Constructor as before but from a generic function object interface for one-dim functions
   */ 
   explicit TUnuranContDist (const ROOT::Math::IGenFunction & pdf, const ROOT::Math::IGenFunction * dpdf = 0, bool isLogPdf = false, bool copyFunc = false); 


   /** 
      Destructor 
   */ 
   virtual ~TUnuranContDist ();


   /** 
      Copy constructor
   */ 
   TUnuranContDist(const TUnuranContDist &); 

   /** 
      Assignment operator
   */ 
   TUnuranContDist & operator = (const TUnuranContDist & rhs); 

   /**
      Clone (required by base class)
    */
   virtual TUnuranContDist * Clone() const { return new TUnuranContDist(*this); } 


   /**
      set cdf distribution. If a method requires it 
      and is not set it is then estimated using numerical 
      integration from the pdf
   */
   void SetCdf(TF1 *  cdf); 

   /**
      set cdf distribution using a generic function interface
   */
   void SetCdf(const ROOT::Math::IGenFunction & cdf);

   /**
      Set the distribution domain. If min < max a domain is defined otherwise is undefined
    */
   void SetDomain(double xmin, double xmax)  { 
      fXmin = xmin; 
      fXmax = xmax; 
      if (fXmin < fXmax) 
         fHasDomain = true;
      else 
         fHasDomain = false;
   }

   /**
      set the distribution mode (x position of its maximum)
   */
   void SetMode(double mode) { fMode = mode; fHasMode=true;}

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

   /**
      check if distribution has a defined domain and return in case its domain
   */
   bool GetDomain(double & xmin, double & xmax) const { 
      xmin = fXmin; 
      xmax = fXmax; 
      return fHasDomain; 
   }

   /**
      check if a cdf function is provided for the distribution 
    */
   bool HasCdf() const { return fCdf != 0; } 

   /**
      check if distribution has a pre-computed mode
    */
   bool HasMode() const { return fHasMode; } 

   
   /**
      check if distribution has a pre-computed area below the Pdf
    */
   bool HasPdfArea() const { return fHasArea; }   

   /**
      return the mode   (x location of  maximum of the pdf)  
   */
   double Mode() const { return fMode; }

   /**
      return area below the pdf
   */
   double PdfArea() const { return fArea; }


   /**
      flag to control if given function represent the log of a pdf
   */
   bool IsLogPdf() const {  return fIsLogPdf; }

   /**
      evaluate the Probability Density function. Used by the UnuRan algorithms 
   */
   double Pdf ( double x) const; 

   /**
      evaluate the derivative of the pdf. Used by  UnuRan 
   */
   double DPdf( double x) const; 

   /**
      evaluate the integral (cdf)  on the domain. Used by Unuran algorithm
   */
   double Cdf(double x) const;   


protected: 


private: 


   const ROOT::Math::IGenFunction * fPdf;         // pointer to the pdf 
   const ROOT::Math::IGenFunction * fDPdf;       //pointer to the derivative of the pdf
   const ROOT::Math::IGenFunction * fCdf;       //pointer to the cdf (cumulative dist.)

   double fXmin;            //lower value of the domain 
   double fXmax;            //upper value of the domain
   double fMode;            //mode of the distribution
   double fArea;            //area below pdf

   // flags
   bool  fIsLogPdf;         //flag to control if function pointer represent log of pdf
   bool  fHasDomain;        //flag to control if distribution has a defined domain (otherwise is [-inf,+inf]
   bool  fHasMode;          //flag to control if distribution has a pre-computed mode
   bool  fHasArea;          //flag to control if distribution has a pre-computed area below the pdf
   bool  fOwnFunc;          // flag to indicate if class manages the function pointers
   //mutable double fX[1];         //! cached vector for using TF1::EvalPar

   ClassDef(TUnuranContDist,1)  //Wrapper class for one dimensional continuous distribution


}; 



#endif /* ROOT_Math_TUnuranContDist */