This file is indexed.

/usr/include/root/RooStats/ProposalHelper.h is in libroot-roofit-dev 5.34.00-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
// @(#)root/roostats:$Id: ProposalHelper.h 44368 2012-05-30 15:38:44Z axel $
// Authors: Kevin Belasco        7/22/2009
// Authors: Kyle Cranmer         7/22/2009
/*************************************************************************
 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef RooStats_ProposalHelper
#define RooStats_ProposalHelper

#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif
#ifndef ROOSTATS_ProposalFunction
#include "RooStats/ProposalFunction.h"
#endif
#ifndef ROOSTATS_UniformProposal
#include "RooStats/UniformProposal.h"
#endif
#ifndef ROOSTATS_PdfProposal
#include "RooStats/PdfProposal.h"
#endif
#ifndef ROO_ARG_SET
#include "RooArgSet.h"
#endif
#ifndef ROO_MSG_SERVICE
#include "RooMsgService.h"
#endif
#ifndef ROO_REAL_VAR
#include "RooRealVar.h"
#endif
#ifndef ROOT_TObject
#include "TObject.h"
#endif



namespace RooStats {

   class ProposalHelper : public TObject {

   public:
      ProposalHelper();

      // Set the PDF to be the proposal density function
      virtual void SetPdf(RooAbsPdf& pdf) { fPdf = &pdf; }
      // Set the bank of clues to add to the current proposal density function
      virtual void SetClues(RooDataSet& clues) { fClues = &clues; }

      // Get the ProposalFunction that we've been designing
      virtual ProposalFunction* GetProposalFunction();

      virtual void SetCacheSize(Int_t size)
      {
         if (size > 0)
            fCacheSize = size;
         else
            coutE(Eval) << "Warning: Requested non-positive cache size: " <<
                           size << ". Cache size unchanged." << std::endl;
      }

      virtual void SetUpdateProposalParameters(Bool_t updateParams)
      { fUseUpdates = updateParams; }

      virtual void SetVariables(RooArgList& vars)
      { fVars = &vars; }

      virtual void SetVariables(const RooArgList& vars)
      { fVars = new RooArgList(vars); fOwnsVars = kTRUE; }

      // set what fraction of the proposal density function should come from
      // a uniform proposal distribution
      virtual void SetUniformFraction(Double_t uniFrac) { fUniFrac = uniFrac; }

      // set what fraction of the proposal density function should come from
      // the bank of clues
      virtual void SetCluesFraction(Double_t cluesFrac) { fCluesFrac = cluesFrac; }

      // set the covariance matrix to use for a multi-variate Gaussian proposal
      virtual void SetCovMatrix(const TMatrixDSym& covMatrix)
      { fCovMatrix = new TMatrixDSym(covMatrix); }

      // set what divisor we will use when dividing the range of a variable to
      // determine the width of the proposal function for each dimension
      // e.g. divisor = 6 for sigma = 1/6th
      virtual void SetWidthRangeDivisor(Double_t divisor)
      { if (divisor > 0.) fSigmaRangeDivisor = divisor; }

      // set the option string to pass to the RooNDKeysPdf constructor
      // if the bank of clues pdf is being automatically generated by this
      // ProposalHelper
      virtual void SetCluesOptions(const Option_t* options)
      { if (options != NULL) fCluesOptions = options; }

      virtual void SetVariables(RooArgSet& vars)
      {
         RooArgList* argList = new RooArgList(vars);
         SetVariables(*argList);
         fOwnsVars = kTRUE;
      }

      virtual ~ProposalHelper()
      {
         if (fOwnsPdfProp)      delete fPdfProp;
         if (fOwnsPdf)          delete fPdf;
         if (fOwnsCluesPdf)     delete fCluesPdf;
         if (fOwnsVars)         delete fVars;
         delete fCovMatrix;
         delete fUniformPdf;
      }

   protected:
      RooAbsPdf* fPdf; // the main proposal density function
      RooAbsPdf* fCluesPdf; // proposal dens. func. with clues for certain points
      RooAbsPdf* fUniformPdf; // uniform proposal dens. func.
      RooDataSet* fClues; // data set of clues
      TMatrixDSym* fCovMatrix; // covariance matrix for multi var gaussian pdf
      PdfProposal* fPdfProp; // the PdfProposal we are (probably) going to return
      RooArgList* fVars; // the RooRealVars to generate proposals for
      Int_t fCacheSize; // for generating proposals from PDFs
      Double_t fSigmaRangeDivisor; // range divisor to get sigma for each variable
      Double_t fUniFrac; // what fraction of the PDF integral is uniform
      Double_t fCluesFrac; // what fraction of the PDF integral comes from clues
      Bool_t fOwnsPdfProp; // whether we own the PdfProposal; equivalent to:
                           // !(whether we have returned it in GetProposalFunction)
      Bool_t fOwnsPdf; // whether we created (and own) the main pdf
      Bool_t fOwnsCluesPdf; // whether we created (and own) the clues pdf
      Bool_t fOwnsVars; // whether we own fVars
      Bool_t fUseUpdates; // whether to set updates for proposal params in PdfProposal
      const Option_t* fCluesOptions; // option string for clues RooNDKeysPdf

      void CreatePdf();
      void CreateCluesPdf();
      void CreateUniformPdf();
      void CreateCovMatrix(RooArgList& xVec);

      ClassDef(ProposalHelper,1)
   };
}
#endif