/***************************************************************************** 
  * Project: RooFit                                                           * 
  *                                                                           * 
  * Copyright (c) 2000-2005, Regents of the University of California          * 
  *                          and Stanford University. All rights reserved.    * 
  *                                                                           * 
  * Redistribution and use in source and binary forms,                        * 
  * with or without modification, are permitted according to the terms        * 
  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             * 
  *****************************************************************************/ 

//////////////////////////////////////////////////////////////////////////////
// 
// BEGIN_HTML
// RooAbsCachedPdf is the abstract base class for p.d.f.s that need or
// want to cache their evaluate() output in a RooHistPdf defined in
// terms of the used observables. This base class manages the creation
// and storage of all RooHistPdf cache p.d.fs and the RooDataHists
// that define their shape. Implementations of RooAbsCachedPdf must
// define member function fillCacheObject() which serves to fill an
// already created RooDataHist with the p.d.fs function values. In
// addition the member functions actualObservables() and
// actualParameters() must be define which report what the actual
// observables to be cached are for a given set of observables passed
// by the user to getVal() and on which parameters need to be tracked
// for changes to trigger a refilling of the cache histogram.
// END_HTML
//
//
//
//

#include "Riostream.h" 
using namespace std ;

#include "RooFit.h"
#include "TString.h"
#include "RooAbsCachedPdf.h" 
#include "RooAbsReal.h" 
#include "RooMsgService.h"
#include "RooDataHist.h"
#include "RooHistPdf.h"
#include "RooGlobalFunc.h"
#include "RooRealVar.h"
#include "RooChangeTracker.h"
#include "RooExpensiveObjectCache.h"

ClassImp(RooAbsCachedPdf) 



//_____________________________________________________________________________
RooAbsCachedPdf::RooAbsCachedPdf(const char *name, const char *title, Int_t ipOrder) :
  RooAbsPdf(name,title), 
  _cacheMgr(this,10),
  _ipOrder(ipOrder),
  _disableCache(kFALSE)
 { 
   // Constructor
 } 



//_____________________________________________________________________________
RooAbsCachedPdf::RooAbsCachedPdf(const RooAbsCachedPdf& other, const char* name) :  
   RooAbsPdf(other,name), 
   _cacheMgr(other._cacheMgr,this),
   _ipOrder(other._ipOrder),
   _disableCache(other._disableCache)
 { 
   // Copy constructor
 } 



//_____________________________________________________________________________
RooAbsCachedPdf::~RooAbsCachedPdf() 
{
  // Destructor
}



//_____________________________________________________________________________
Double_t RooAbsCachedPdf::getValV(const RooArgSet* nset) const 
{
  // Implementation of getVal() overriding default implementation
  // of RooAbsPdf. Return normalized value stored in cache p.d.f
  // rather than return value of evaluate() which is undefined
  // for RooAbsCachedPdf

  if (_disableCache) {
    return RooAbsPdf::getValV(nset) ;
  }

  // Calculate current unnormalized value of object
  PdfCacheElem* cache = getCache(nset) ;

  Double_t value = cache->pdf()->getVal(nset) ;  

  _value = value ;    
  return _value ;
}



//_____________________________________________________________________________
RooAbsPdf* RooAbsCachedPdf::getCachePdf(const RooArgSet* nset) const 
{
  // Return pointer to RooHistPdf cache pdf for given choice of observables

  PdfCacheElem* cache = getCache(nset) ;

  if (cache) {
    return cache->pdf() ;
  } else {
    return 0 ;
  }
}


//_____________________________________________________________________________
RooDataHist* RooAbsCachedPdf::getCacheHist(const RooArgSet* nset) const 
{
  // Return pointer to RooDataHist cache histogram for given choice of observables

  PdfCacheElem* cache = getCache(nset) ;

  if (cache) {
    return cache->hist() ;
  } else {
    return 0 ;
  }
}


//_____________________________________________________________________________
void RooAbsCachedPdf::clearCacheObject(PdfCacheElem& cache) const 
{
  // Mark all bins of given cache as unitialized (value -1)

  cache.hist()->setAllWeights(-1) ;  
}



//_____________________________________________________________________________
RooAbsCachedPdf::PdfCacheElem* RooAbsCachedPdf::getCache(const RooArgSet* nset, Bool_t recalculate) const
{
  // Retrieve cache object associated with given choice of observables. If cache object
  // does not exist, create and fill and register it on the fly. If recalculate=false
  // recalculation of cache contents of existing caches that are marked dirty due to
  // dependent parameter changes is suppressed. 

  // Check if this configuration was created becfore
  Int_t sterileIdx(-1) ;
  PdfCacheElem* cache = (PdfCacheElem*) _cacheMgr.getObj(nset,0,&sterileIdx) ;

  // Check if we have a cache histogram in the global expensive object cache
  if (cache) {
    if (cache->paramTracker()->hasChanged(kTRUE) && (recalculate || !cache->pdf()->haveUnitNorm()) ) {
      cxcoutD(Eval) << "RooAbsCachedPdf::getCache(" << GetName() << ") cache " << cache << " pdf " 
		    << cache->pdf()->GetName() << " requires recalculation as parameters changed" << endl ;     
      fillCacheObject(*cache) ;  
      cache->pdf()->setValueDirty() ;
    }
    return cache ;
  }

  // Create and fill cache
  cache = createCache(nset) ; 

  // Check if we have contents registered already in global expensive object cache 
  RooDataHist* htmp = (RooDataHist*) expensiveObjectCache().retrieveObject(cache->hist()->GetName(),RooDataHist::Class(),cache->paramTracker()->parameters()) ;

  if (htmp) {    

    cache->hist()->reset() ;
    cache->hist()->add(*htmp) ;

  } else {

    fillCacheObject(*cache) ;  

    RooDataHist* eoclone = new RooDataHist(*cache->hist()) ;
    eoclone->removeSelfFromDir() ;
    expensiveObjectCache().registerObject(GetName(),cache->hist()->GetName(),*eoclone,cache->paramTracker()->parameters()) ;
    
  } 

  
  // Store this cache configuration
  Int_t code = _cacheMgr.setObj(nset,0,((RooAbsCacheElement*)cache),0) ;

  coutI(Caching) << "RooAbsCachedPdf::getCache(" << GetName() << ") creating new cache " << cache << " with pdf "
		 << cache->pdf()->GetName() << " for nset " << (nset?*nset:RooArgSet()) << " with code " << code ;
  if (htmp) {
    ccoutI(Caching) << " from preexisting content." ;
  }
  ccoutI(Caching) << endl ;
  
  return cache ;
}




//_____________________________________________________________________________
RooAbsCachedPdf::PdfCacheElem::PdfCacheElem(const RooAbsCachedPdf& self, const RooArgSet* nsetIn) : 
  _pdf(0), _paramTracker(0), _hist(0), _norm(0) 
{
  // Constructor of cache object which owns RooDataHist cache histogram,
  // RooHistPdf pdf that represents is shape and RooChangeTracker meta
  // object that tracks changes in listed dependent parameter of cache.

  // Create cache object itself -- Default implementation is a RooHistPdf
  RooArgSet* nset2 = self.actualObservables(nsetIn?*nsetIn:RooArgSet()) ;

  RooArgSet orderedObs ;
  if (nset2) {
    self.preferredObservableScanOrder(*nset2,orderedObs) ;
  }

  // Create RooDataHist
  TString hname = self.GetName() ;
  hname.Append("_") ;
  hname.Append(self.inputBaseName()) ;
  hname.Append("_CACHEHIST") ;
  hname.Append(self.cacheNameSuffix(orderedObs)) ;
  hname.Append(self.histNameSuffix()) ;
  _hist = new RooDataHist(hname,hname,orderedObs,self.binningName()) ;
  _hist->removeSelfFromDir() ;

  //RooArgSet* observables= self.getObservables(orderedObs) ;
  // cout << "orderedObs = " << orderedObs << " observables = " << *observables << endl ;

  // Get set of p.d.f. observable corresponding to set of histogram observables
  RooArgSet pdfObs ;
  RooArgSet pdfFinalObs ;
  TIterator* iter = orderedObs.createIterator() ;
  RooAbsArg* harg ;
  while((harg=(RooAbsArg*)iter->Next())) {
    RooAbsArg& po = self.pdfObservable(*harg) ;
    pdfObs.add(po) ;
    if (po.isFundamental()) {
      pdfFinalObs.add(po) ;
    } else {      
      RooArgSet* tmp = po.getVariables() ;
      pdfFinalObs.add(*tmp) ;
      delete tmp ;
    }
  }
  delete iter ;

  // Create RooHistPdf
  TString pdfname = self.inputBaseName() ;
  pdfname.Append("_CACHE") ;
  pdfname.Append(self.cacheNameSuffix(pdfFinalObs)) ;
  _pdf = new RooHistPdf(pdfname,pdfname,pdfObs,orderedObs,*_hist,self.getInterpolationOrder()) ;
  if (nsetIn) {
    _nset.addClone(*nsetIn) ;
  }

  // Create pseudo-object that tracks changes in parameter values

  RooArgSet* params = self.actualParameters(pdfFinalObs) ;
  params->remove(pdfFinalObs,kTRUE,kTRUE) ;
  
  string name= Form("%s_CACHEPARAMS",_pdf->GetName()) ;
  _paramTracker = new RooChangeTracker(name.c_str(),name.c_str(),*params,kTRUE) ;
  _paramTracker->hasChanged(kTRUE) ; // clear dirty flag as cache is up-to-date upon creation

  // Introduce formal dependency of RooHistPdf on parameters so that const optimization code
  // makes the correct decisions
  _pdf->addServerList(*params) ;

  // Set initial state of cache to dirty
  _pdf->setValueDirty() ;

  //delete observables ;
  delete params ;
  delete nset2 ;

}



//_____________________________________________________________________________
TString RooAbsCachedPdf::cacheNameSuffix(const RooArgSet& nset) const 
{
  // Construct string with unique suffix for cache objects based on 
  // observable names that define cache configuration

  TString name ;
  name.Append("_Obs[") ;
  if (nset.getSize()>0) {
    TIterator* iter = nset.createIterator() ;
    RooAbsArg* arg ;
    Bool_t first(kTRUE) ;
    while((arg=(RooAbsArg*)iter->Next())) {
      if (first) {
	first=kFALSE ;
      } else {
	name.Append(",") ;
      }
      name.Append(arg->GetName()) ;
    }
    delete iter ;
  } 

  name.Append("]") ;
  const char* payloadUS = payloadUniqueSuffix() ;
  if (payloadUS) {
    name.Append(payloadUS) ;
  }
  return name ;
}



//_____________________________________________________________________________
void RooAbsCachedPdf::setInterpolationOrder(Int_t order) 
{
  // Change the interpolation order that is used in RooHistPdf cache
  // representation smoothing the RooDataHist shapes.

  _ipOrder = order ;

  Int_t i ;
  for (i=0 ; i<_cacheMgr.cacheSize() ; i++) {
    PdfCacheElem* cache = (PdfCacheElem*) _cacheMgr.getObjByIndex(i) ;
    if (cache) {
      cache->pdf()->setInterpolationOrder(order) ;
    }
  }
}



//_____________________________________________________________________________
RooArgList RooAbsCachedPdf::PdfCacheElem::containedArgs(Action) 
{
  // Returns all RooAbsArg objects contained in the cache element
  RooArgList ret(*_pdf) ;
  ret.add(*_paramTracker) ;
  if (_norm) ret.add(*_norm) ;
  return ret ;
}



//_____________________________________________________________________________
RooAbsCachedPdf::PdfCacheElem::~PdfCacheElem() 
{
  // Cache element destructor

  if (_norm) {
    delete _norm ;
  }
  if (_pdf) {
    delete _pdf ;
  }
  if (_paramTracker) {
    delete _paramTracker ;
  }
  if (_hist) {
    delete _hist ;
  }
}



//_____________________________________________________________________________
void RooAbsCachedPdf::PdfCacheElem::printCompactTreeHook(ostream& os, const char* indent, Int_t curElem, Int_t maxElem) 
{
  // Print contents of cache when printing self as part of object tree

  if (curElem==0) {
    os << indent << "--- RooAbsCachedPdf begin cache ---" << endl ;
  }

  TString indent2(indent) ;
  os << Form("[%d] Configuration for observables ",curElem) << _nset << endl ;
  indent2 += Form("[%d] ",curElem) ;
  _pdf->printCompactTree(os,indent2) ;
  if (_norm) {
    os << Form("[%d] Norm ",curElem) ;
    _norm->printStream(os,kName|kArgs,kSingleLine) ;
  }
  
  if (curElem==maxElem) {
    os << indent << "--- RooAbsCachedPdf end cache --- " << endl ;
  }
}



//_____________________________________________________________________________
Bool_t RooAbsCachedPdf::forceAnalyticalInt(const RooAbsArg& dep) const 
{
  // Force RooRealIntegral to offer all our actual observable for internal
  // integration

  RooArgSet* actObs = actualObservables(dep) ;
  Bool_t ret = (actObs->getSize()>0) ;
  delete actObs ;
  return ret ;
}



//_____________________________________________________________________________
Int_t RooAbsCachedPdf::getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& analVars, const RooArgSet* normSet, const char* rangeName) const 
{
  // Advertises internal (analytical) integration capabilities. Call
  // is forwarded to RooHistPdf cache p.d.f of cache that is used for
  // given choice of observables

  if (allVars.getSize()==0) {
    return 0 ;
  }

  PdfCacheElem* cache = getCache(normSet?normSet:&allVars) ;
  Int_t code = cache->pdf()->getAnalyticalIntegralWN(allVars,analVars,normSet,rangeName) ;

  if (code==0) {
    return 0 ;
  }

  RooArgSet* all = new RooArgSet ;
  RooArgSet* ana = new RooArgSet ;
  RooArgSet* nrm = new RooArgSet ;
  all->addClone(allVars) ;
  ana->addClone(analVars) ;
  if (normSet) {
    nrm->addClone(*normSet) ;
  }
  std::vector<Int_t> codeList(2);
  codeList[0] = code ;
  codeList[1] = cache->pdf()->haveUnitNorm() ? 1 : 0 ;
  Int_t masterCode = _anaReg.store(codeList,all,ana,nrm)+1 ; // takes ownership of all sets

  
  // Mark all observables as internally integrated 
  if (cache->pdf()->haveUnitNorm()) {
    analVars.add(allVars,kTRUE) ;
  }

  return masterCode ;
}



//_____________________________________________________________________________
Double_t RooAbsCachedPdf::analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName) const
{  
  // Implements internal (analytical) integration capabilities. Call
  // is forwarded to RooHistPdf cache p.d.f of cache that is used for
  // given choice of observables

  if (code==0) {
    return getVal(normSet) ; 
  }  

  RooArgSet *allVars(0),*anaVars(0),*normSet2(0),*dummy(0) ;
  const std::vector<Int_t> codeList = _anaReg.retrieve(code-1,allVars,anaVars,normSet2,dummy) ;
  
  PdfCacheElem* cache = getCache(normSet2?normSet2:anaVars,kFALSE) ;
  Double_t ret = cache->pdf()->analyticalIntegralWN(codeList[0],normSet,rangeName) ;

  if (codeList[1]>0) {
    RooArgSet factObs(*allVars) ;
    factObs.remove(*anaVars,kTRUE,kTRUE) ;
    TIterator* iter = factObs.createIterator() ;
    RooAbsLValue* arg ;
    while((arg=dynamic_cast<RooAbsLValue*>(iter->Next()))) {
      ret *= arg->volume(rangeName) ;
    }
    delete iter ;
  }
  
  return ret ;
}





 RooAbsCachedPdf.cxx:1
 RooAbsCachedPdf.cxx:2
 RooAbsCachedPdf.cxx:3
 RooAbsCachedPdf.cxx:4
 RooAbsCachedPdf.cxx:5
 RooAbsCachedPdf.cxx:6
 RooAbsCachedPdf.cxx:7
 RooAbsCachedPdf.cxx:8
 RooAbsCachedPdf.cxx:9
 RooAbsCachedPdf.cxx:10
 RooAbsCachedPdf.cxx:11
 RooAbsCachedPdf.cxx:12
 RooAbsCachedPdf.cxx:13
 RooAbsCachedPdf.cxx:14
 RooAbsCachedPdf.cxx:15
 RooAbsCachedPdf.cxx:16
 RooAbsCachedPdf.cxx:17
 RooAbsCachedPdf.cxx:18
 RooAbsCachedPdf.cxx:19
 RooAbsCachedPdf.cxx:20
 RooAbsCachedPdf.cxx:21
 RooAbsCachedPdf.cxx:22
 RooAbsCachedPdf.cxx:23
 RooAbsCachedPdf.cxx:24
 RooAbsCachedPdf.cxx:25
 RooAbsCachedPdf.cxx:26
 RooAbsCachedPdf.cxx:27
 RooAbsCachedPdf.cxx:28
 RooAbsCachedPdf.cxx:29
 RooAbsCachedPdf.cxx:30
 RooAbsCachedPdf.cxx:31
 RooAbsCachedPdf.cxx:32
 RooAbsCachedPdf.cxx:33
 RooAbsCachedPdf.cxx:34
 RooAbsCachedPdf.cxx:35
 RooAbsCachedPdf.cxx:36
 RooAbsCachedPdf.cxx:37
 RooAbsCachedPdf.cxx:38
 RooAbsCachedPdf.cxx:39
 RooAbsCachedPdf.cxx:40
 RooAbsCachedPdf.cxx:41
 RooAbsCachedPdf.cxx:42
 RooAbsCachedPdf.cxx:43
 RooAbsCachedPdf.cxx:44
 RooAbsCachedPdf.cxx:45
 RooAbsCachedPdf.cxx:46
 RooAbsCachedPdf.cxx:47
 RooAbsCachedPdf.cxx:48
 RooAbsCachedPdf.cxx:49
 RooAbsCachedPdf.cxx:50
 RooAbsCachedPdf.cxx:51
 RooAbsCachedPdf.cxx:52
 RooAbsCachedPdf.cxx:53
 RooAbsCachedPdf.cxx:54
 RooAbsCachedPdf.cxx:55
 RooAbsCachedPdf.cxx:56
 RooAbsCachedPdf.cxx:57
 RooAbsCachedPdf.cxx:58
 RooAbsCachedPdf.cxx:59
 RooAbsCachedPdf.cxx:60
 RooAbsCachedPdf.cxx:61
 RooAbsCachedPdf.cxx:62
 RooAbsCachedPdf.cxx:63
 RooAbsCachedPdf.cxx:64
 RooAbsCachedPdf.cxx:65
 RooAbsCachedPdf.cxx:66
 RooAbsCachedPdf.cxx:67
 RooAbsCachedPdf.cxx:68
 RooAbsCachedPdf.cxx:69
 RooAbsCachedPdf.cxx:70
 RooAbsCachedPdf.cxx:71
 RooAbsCachedPdf.cxx:72
 RooAbsCachedPdf.cxx:73
 RooAbsCachedPdf.cxx:74
 RooAbsCachedPdf.cxx:75
 RooAbsCachedPdf.cxx:76
 RooAbsCachedPdf.cxx:77
 RooAbsCachedPdf.cxx:78
 RooAbsCachedPdf.cxx:79
 RooAbsCachedPdf.cxx:80
 RooAbsCachedPdf.cxx:81
 RooAbsCachedPdf.cxx:82
 RooAbsCachedPdf.cxx:83
 RooAbsCachedPdf.cxx:84
 RooAbsCachedPdf.cxx:85
 RooAbsCachedPdf.cxx:86
 RooAbsCachedPdf.cxx:87
 RooAbsCachedPdf.cxx:88
 RooAbsCachedPdf.cxx:89
 RooAbsCachedPdf.cxx:90
 RooAbsCachedPdf.cxx:91
 RooAbsCachedPdf.cxx:92
 RooAbsCachedPdf.cxx:93
 RooAbsCachedPdf.cxx:94
 RooAbsCachedPdf.cxx:95
 RooAbsCachedPdf.cxx:96
 RooAbsCachedPdf.cxx:97
 RooAbsCachedPdf.cxx:98
 RooAbsCachedPdf.cxx:99
 RooAbsCachedPdf.cxx:100
 RooAbsCachedPdf.cxx:101
 RooAbsCachedPdf.cxx:102
 RooAbsCachedPdf.cxx:103
 RooAbsCachedPdf.cxx:104
 RooAbsCachedPdf.cxx:105
 RooAbsCachedPdf.cxx:106
 RooAbsCachedPdf.cxx:107
 RooAbsCachedPdf.cxx:108
 RooAbsCachedPdf.cxx:109
 RooAbsCachedPdf.cxx:110
 RooAbsCachedPdf.cxx:111
 RooAbsCachedPdf.cxx:112
 RooAbsCachedPdf.cxx:113
 RooAbsCachedPdf.cxx:114
 RooAbsCachedPdf.cxx:115
 RooAbsCachedPdf.cxx:116
 RooAbsCachedPdf.cxx:117
 RooAbsCachedPdf.cxx:118
 RooAbsCachedPdf.cxx:119
 RooAbsCachedPdf.cxx:120
 RooAbsCachedPdf.cxx:121
 RooAbsCachedPdf.cxx:122
 RooAbsCachedPdf.cxx:123
 RooAbsCachedPdf.cxx:124
 RooAbsCachedPdf.cxx:125
 RooAbsCachedPdf.cxx:126
 RooAbsCachedPdf.cxx:127
 RooAbsCachedPdf.cxx:128
 RooAbsCachedPdf.cxx:129
 RooAbsCachedPdf.cxx:130
 RooAbsCachedPdf.cxx:131
 RooAbsCachedPdf.cxx:132
 RooAbsCachedPdf.cxx:133
 RooAbsCachedPdf.cxx:134
 RooAbsCachedPdf.cxx:135
 RooAbsCachedPdf.cxx:136
 RooAbsCachedPdf.cxx:137
 RooAbsCachedPdf.cxx:138
 RooAbsCachedPdf.cxx:139
 RooAbsCachedPdf.cxx:140
 RooAbsCachedPdf.cxx:141
 RooAbsCachedPdf.cxx:142
 RooAbsCachedPdf.cxx:143
 RooAbsCachedPdf.cxx:144
 RooAbsCachedPdf.cxx:145
 RooAbsCachedPdf.cxx:146
 RooAbsCachedPdf.cxx:147
 RooAbsCachedPdf.cxx:148
 RooAbsCachedPdf.cxx:149
 RooAbsCachedPdf.cxx:150
 RooAbsCachedPdf.cxx:151
 RooAbsCachedPdf.cxx:152
 RooAbsCachedPdf.cxx:153
 RooAbsCachedPdf.cxx:154
 RooAbsCachedPdf.cxx:155
 RooAbsCachedPdf.cxx:156
 RooAbsCachedPdf.cxx:157
 RooAbsCachedPdf.cxx:158
 RooAbsCachedPdf.cxx:159
 RooAbsCachedPdf.cxx:160
 RooAbsCachedPdf.cxx:161
 RooAbsCachedPdf.cxx:162
 RooAbsCachedPdf.cxx:163
 RooAbsCachedPdf.cxx:164
 RooAbsCachedPdf.cxx:165
 RooAbsCachedPdf.cxx:166
 RooAbsCachedPdf.cxx:167
 RooAbsCachedPdf.cxx:168
 RooAbsCachedPdf.cxx:169
 RooAbsCachedPdf.cxx:170
 RooAbsCachedPdf.cxx:171
 RooAbsCachedPdf.cxx:172
 RooAbsCachedPdf.cxx:173
 RooAbsCachedPdf.cxx:174
 RooAbsCachedPdf.cxx:175
 RooAbsCachedPdf.cxx:176
 RooAbsCachedPdf.cxx:177
 RooAbsCachedPdf.cxx:178
 RooAbsCachedPdf.cxx:179
 RooAbsCachedPdf.cxx:180
 RooAbsCachedPdf.cxx:181
 RooAbsCachedPdf.cxx:182
 RooAbsCachedPdf.cxx:183
 RooAbsCachedPdf.cxx:184
 RooAbsCachedPdf.cxx:185
 RooAbsCachedPdf.cxx:186
 RooAbsCachedPdf.cxx:187
 RooAbsCachedPdf.cxx:188
 RooAbsCachedPdf.cxx:189
 RooAbsCachedPdf.cxx:190
 RooAbsCachedPdf.cxx:191
 RooAbsCachedPdf.cxx:192
 RooAbsCachedPdf.cxx:193
 RooAbsCachedPdf.cxx:194
 RooAbsCachedPdf.cxx:195
 RooAbsCachedPdf.cxx:196
 RooAbsCachedPdf.cxx:197
 RooAbsCachedPdf.cxx:198
 RooAbsCachedPdf.cxx:199
 RooAbsCachedPdf.cxx:200
 RooAbsCachedPdf.cxx:201
 RooAbsCachedPdf.cxx:202
 RooAbsCachedPdf.cxx:203
 RooAbsCachedPdf.cxx:204
 RooAbsCachedPdf.cxx:205
 RooAbsCachedPdf.cxx:206
 RooAbsCachedPdf.cxx:207
 RooAbsCachedPdf.cxx:208
 RooAbsCachedPdf.cxx:209
 RooAbsCachedPdf.cxx:210
 RooAbsCachedPdf.cxx:211
 RooAbsCachedPdf.cxx:212
 RooAbsCachedPdf.cxx:213
 RooAbsCachedPdf.cxx:214
 RooAbsCachedPdf.cxx:215
 RooAbsCachedPdf.cxx:216
 RooAbsCachedPdf.cxx:217
 RooAbsCachedPdf.cxx:218
 RooAbsCachedPdf.cxx:219
 RooAbsCachedPdf.cxx:220
 RooAbsCachedPdf.cxx:221
 RooAbsCachedPdf.cxx:222
 RooAbsCachedPdf.cxx:223
 RooAbsCachedPdf.cxx:224
 RooAbsCachedPdf.cxx:225
 RooAbsCachedPdf.cxx:226
 RooAbsCachedPdf.cxx:227
 RooAbsCachedPdf.cxx:228
 RooAbsCachedPdf.cxx:229
 RooAbsCachedPdf.cxx:230
 RooAbsCachedPdf.cxx:231
 RooAbsCachedPdf.cxx:232
 RooAbsCachedPdf.cxx:233
 RooAbsCachedPdf.cxx:234
 RooAbsCachedPdf.cxx:235
 RooAbsCachedPdf.cxx:236
 RooAbsCachedPdf.cxx:237
 RooAbsCachedPdf.cxx:238
 RooAbsCachedPdf.cxx:239
 RooAbsCachedPdf.cxx:240
 RooAbsCachedPdf.cxx:241
 RooAbsCachedPdf.cxx:242
 RooAbsCachedPdf.cxx:243
 RooAbsCachedPdf.cxx:244
 RooAbsCachedPdf.cxx:245
 RooAbsCachedPdf.cxx:246
 RooAbsCachedPdf.cxx:247
 RooAbsCachedPdf.cxx:248
 RooAbsCachedPdf.cxx:249
 RooAbsCachedPdf.cxx:250
 RooAbsCachedPdf.cxx:251
 RooAbsCachedPdf.cxx:252
 RooAbsCachedPdf.cxx:253
 RooAbsCachedPdf.cxx:254
 RooAbsCachedPdf.cxx:255
 RooAbsCachedPdf.cxx:256
 RooAbsCachedPdf.cxx:257
 RooAbsCachedPdf.cxx:258
 RooAbsCachedPdf.cxx:259
 RooAbsCachedPdf.cxx:260
 RooAbsCachedPdf.cxx:261
 RooAbsCachedPdf.cxx:262
 RooAbsCachedPdf.cxx:263
 RooAbsCachedPdf.cxx:264
 RooAbsCachedPdf.cxx:265
 RooAbsCachedPdf.cxx:266
 RooAbsCachedPdf.cxx:267
 RooAbsCachedPdf.cxx:268
 RooAbsCachedPdf.cxx:269
 RooAbsCachedPdf.cxx:270
 RooAbsCachedPdf.cxx:271
 RooAbsCachedPdf.cxx:272
 RooAbsCachedPdf.cxx:273
 RooAbsCachedPdf.cxx:274
 RooAbsCachedPdf.cxx:275
 RooAbsCachedPdf.cxx:276
 RooAbsCachedPdf.cxx:277
 RooAbsCachedPdf.cxx:278
 RooAbsCachedPdf.cxx:279
 RooAbsCachedPdf.cxx:280
 RooAbsCachedPdf.cxx:281
 RooAbsCachedPdf.cxx:282
 RooAbsCachedPdf.cxx:283
 RooAbsCachedPdf.cxx:284
 RooAbsCachedPdf.cxx:285
 RooAbsCachedPdf.cxx:286
 RooAbsCachedPdf.cxx:287
 RooAbsCachedPdf.cxx:288
 RooAbsCachedPdf.cxx:289
 RooAbsCachedPdf.cxx:290
 RooAbsCachedPdf.cxx:291
 RooAbsCachedPdf.cxx:292
 RooAbsCachedPdf.cxx:293
 RooAbsCachedPdf.cxx:294
 RooAbsCachedPdf.cxx:295
 RooAbsCachedPdf.cxx:296
 RooAbsCachedPdf.cxx:297
 RooAbsCachedPdf.cxx:298
 RooAbsCachedPdf.cxx:299
 RooAbsCachedPdf.cxx:300
 RooAbsCachedPdf.cxx:301
 RooAbsCachedPdf.cxx:302
 RooAbsCachedPdf.cxx:303
 RooAbsCachedPdf.cxx:304
 RooAbsCachedPdf.cxx:305
 RooAbsCachedPdf.cxx:306
 RooAbsCachedPdf.cxx:307
 RooAbsCachedPdf.cxx:308
 RooAbsCachedPdf.cxx:309
 RooAbsCachedPdf.cxx:310
 RooAbsCachedPdf.cxx:311
 RooAbsCachedPdf.cxx:312
 RooAbsCachedPdf.cxx:313
 RooAbsCachedPdf.cxx:314
 RooAbsCachedPdf.cxx:315
 RooAbsCachedPdf.cxx:316
 RooAbsCachedPdf.cxx:317
 RooAbsCachedPdf.cxx:318
 RooAbsCachedPdf.cxx:319
 RooAbsCachedPdf.cxx:320
 RooAbsCachedPdf.cxx:321
 RooAbsCachedPdf.cxx:322
 RooAbsCachedPdf.cxx:323
 RooAbsCachedPdf.cxx:324
 RooAbsCachedPdf.cxx:325
 RooAbsCachedPdf.cxx:326
 RooAbsCachedPdf.cxx:327
 RooAbsCachedPdf.cxx:328
 RooAbsCachedPdf.cxx:329
 RooAbsCachedPdf.cxx:330
 RooAbsCachedPdf.cxx:331
 RooAbsCachedPdf.cxx:332
 RooAbsCachedPdf.cxx:333
 RooAbsCachedPdf.cxx:334
 RooAbsCachedPdf.cxx:335
 RooAbsCachedPdf.cxx:336
 RooAbsCachedPdf.cxx:337
 RooAbsCachedPdf.cxx:338
 RooAbsCachedPdf.cxx:339
 RooAbsCachedPdf.cxx:340
 RooAbsCachedPdf.cxx:341
 RooAbsCachedPdf.cxx:342
 RooAbsCachedPdf.cxx:343
 RooAbsCachedPdf.cxx:344
 RooAbsCachedPdf.cxx:345
 RooAbsCachedPdf.cxx:346
 RooAbsCachedPdf.cxx:347
 RooAbsCachedPdf.cxx:348
 RooAbsCachedPdf.cxx:349
 RooAbsCachedPdf.cxx:350
 RooAbsCachedPdf.cxx:351
 RooAbsCachedPdf.cxx:352
 RooAbsCachedPdf.cxx:353
 RooAbsCachedPdf.cxx:354
 RooAbsCachedPdf.cxx:355
 RooAbsCachedPdf.cxx:356
 RooAbsCachedPdf.cxx:357
 RooAbsCachedPdf.cxx:358
 RooAbsCachedPdf.cxx:359
 RooAbsCachedPdf.cxx:360
 RooAbsCachedPdf.cxx:361
 RooAbsCachedPdf.cxx:362
 RooAbsCachedPdf.cxx:363
 RooAbsCachedPdf.cxx:364
 RooAbsCachedPdf.cxx:365
 RooAbsCachedPdf.cxx:366
 RooAbsCachedPdf.cxx:367
 RooAbsCachedPdf.cxx:368
 RooAbsCachedPdf.cxx:369
 RooAbsCachedPdf.cxx:370
 RooAbsCachedPdf.cxx:371
 RooAbsCachedPdf.cxx:372
 RooAbsCachedPdf.cxx:373
 RooAbsCachedPdf.cxx:374
 RooAbsCachedPdf.cxx:375
 RooAbsCachedPdf.cxx:376
 RooAbsCachedPdf.cxx:377
 RooAbsCachedPdf.cxx:378
 RooAbsCachedPdf.cxx:379
 RooAbsCachedPdf.cxx:380
 RooAbsCachedPdf.cxx:381
 RooAbsCachedPdf.cxx:382
 RooAbsCachedPdf.cxx:383
 RooAbsCachedPdf.cxx:384
 RooAbsCachedPdf.cxx:385
 RooAbsCachedPdf.cxx:386
 RooAbsCachedPdf.cxx:387
 RooAbsCachedPdf.cxx:388
 RooAbsCachedPdf.cxx:389
 RooAbsCachedPdf.cxx:390
 RooAbsCachedPdf.cxx:391
 RooAbsCachedPdf.cxx:392
 RooAbsCachedPdf.cxx:393
 RooAbsCachedPdf.cxx:394
 RooAbsCachedPdf.cxx:395
 RooAbsCachedPdf.cxx:396
 RooAbsCachedPdf.cxx:397
 RooAbsCachedPdf.cxx:398
 RooAbsCachedPdf.cxx:399
 RooAbsCachedPdf.cxx:400
 RooAbsCachedPdf.cxx:401
 RooAbsCachedPdf.cxx:402
 RooAbsCachedPdf.cxx:403
 RooAbsCachedPdf.cxx:404
 RooAbsCachedPdf.cxx:405
 RooAbsCachedPdf.cxx:406
 RooAbsCachedPdf.cxx:407
 RooAbsCachedPdf.cxx:408
 RooAbsCachedPdf.cxx:409
 RooAbsCachedPdf.cxx:410
 RooAbsCachedPdf.cxx:411
 RooAbsCachedPdf.cxx:412
 RooAbsCachedPdf.cxx:413
 RooAbsCachedPdf.cxx:414
 RooAbsCachedPdf.cxx:415
 RooAbsCachedPdf.cxx:416
 RooAbsCachedPdf.cxx:417
 RooAbsCachedPdf.cxx:418
 RooAbsCachedPdf.cxx:419
 RooAbsCachedPdf.cxx:420
 RooAbsCachedPdf.cxx:421
 RooAbsCachedPdf.cxx:422
 RooAbsCachedPdf.cxx:423
 RooAbsCachedPdf.cxx:424
 RooAbsCachedPdf.cxx:425
 RooAbsCachedPdf.cxx:426
 RooAbsCachedPdf.cxx:427
 RooAbsCachedPdf.cxx:428
 RooAbsCachedPdf.cxx:429
 RooAbsCachedPdf.cxx:430
 RooAbsCachedPdf.cxx:431
 RooAbsCachedPdf.cxx:432
 RooAbsCachedPdf.cxx:433
 RooAbsCachedPdf.cxx:434
 RooAbsCachedPdf.cxx:435
 RooAbsCachedPdf.cxx:436
 RooAbsCachedPdf.cxx:437
 RooAbsCachedPdf.cxx:438
 RooAbsCachedPdf.cxx:439
 RooAbsCachedPdf.cxx:440
 RooAbsCachedPdf.cxx:441
 RooAbsCachedPdf.cxx:442
 RooAbsCachedPdf.cxx:443
 RooAbsCachedPdf.cxx:444
 RooAbsCachedPdf.cxx:445
 RooAbsCachedPdf.cxx:446
 RooAbsCachedPdf.cxx:447
 RooAbsCachedPdf.cxx:448
 RooAbsCachedPdf.cxx:449
 RooAbsCachedPdf.cxx:450
 RooAbsCachedPdf.cxx:451
 RooAbsCachedPdf.cxx:452
 RooAbsCachedPdf.cxx:453
 RooAbsCachedPdf.cxx:454
 RooAbsCachedPdf.cxx:455
 RooAbsCachedPdf.cxx:456
 RooAbsCachedPdf.cxx:457
 RooAbsCachedPdf.cxx:458
 RooAbsCachedPdf.cxx:459
 RooAbsCachedPdf.cxx:460
 RooAbsCachedPdf.cxx:461
 RooAbsCachedPdf.cxx:462
 RooAbsCachedPdf.cxx:463
 RooAbsCachedPdf.cxx:464
 RooAbsCachedPdf.cxx:465
 RooAbsCachedPdf.cxx:466
 RooAbsCachedPdf.cxx:467
 RooAbsCachedPdf.cxx:468
 RooAbsCachedPdf.cxx:469
 RooAbsCachedPdf.cxx:470
 RooAbsCachedPdf.cxx:471
 RooAbsCachedPdf.cxx:472
 RooAbsCachedPdf.cxx:473
 RooAbsCachedPdf.cxx:474
 RooAbsCachedPdf.cxx:475
 RooAbsCachedPdf.cxx:476
 RooAbsCachedPdf.cxx:477
 RooAbsCachedPdf.cxx:478
 RooAbsCachedPdf.cxx:479
 RooAbsCachedPdf.cxx:480
 RooAbsCachedPdf.cxx:481
 RooAbsCachedPdf.cxx:482
 RooAbsCachedPdf.cxx:483
 RooAbsCachedPdf.cxx:484
 RooAbsCachedPdf.cxx:485
 RooAbsCachedPdf.cxx:486
 RooAbsCachedPdf.cxx:487
 RooAbsCachedPdf.cxx:488