// @(#)root/roostats:$Id$
// Author: Kyle Cranmer   28/07/2008

/*************************************************************************
 * 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.             *
 *************************************************************************/

//___________________________________________________
/*
BEGIN_HTML
<p>
A factory for building PDFs and data for a number counting combination.  
The factory produces a PDF for N channels with uncorrelated background 
uncertainty.  Correlations can be added by extending this PDF with additional terms.
The factory relates the signal in each channel to a master signal strength times the 
expected signal in each channel.  Thus, the final test is performed on the master signal strength.
This yields a more powerful test than letting signal in each channel be independent.
</p>
<p>
The problem has been studied in these references:
<ul>
 <li>   http://arxiv.org/abs/physics/0511028</li>
 <li>   http://arxiv.org/abs/physics/0702156</li>
 <li>   http://cdsweb.cern.ch/record/1099969?ln=en</li>
</ul>
</p>

<p>
One can incorporate uncertainty on the expected signal by adding additional terms.
For the future, perhaps this factory should be extended to include the efficiency terms automatically.
</p>
END_HTML
*/

#ifndef RooStats_NumberCountingPdfFactory
#include "RooStats/NumberCountingPdfFactory.h"
#endif

#ifndef RooStats_RooStatsUtils
#include "RooStats/RooStatsUtils.h"
#endif

#include "RooRealVar.h"
#include "RooAddition.h"
#include "RooProduct.h"
#include "RooDataSet.h"
#include "RooProdPdf.h"
#include "RooFitResult.h"
#include "RooPoisson.h"
#include "RooGlobalFunc.h"
#include "RooCmdArg.h"
#include "RooWorkspace.h"
#include "RooMsgService.h"
#include "TTree.h"
#include <sstream>



ClassImp(RooStats::NumberCountingPdfFactory) ;


using namespace RooStats;
using namespace RooFit;
using namespace std;


//_______________________________________________________
NumberCountingPdfFactory::NumberCountingPdfFactory() {
   // constructor

}

//_______________________________________________________
NumberCountingPdfFactory::~NumberCountingPdfFactory(){
   // destructor
}

//_______________________________________________________
void NumberCountingPdfFactory::AddModel(Double_t* sig, 
					Int_t nbins, 
					RooWorkspace* ws, 
					const char* pdfName, const char* muName) {
  

// This method produces a PDF for N channels with uncorrelated background 
// uncertainty. It relates the signal in each channel to a master signal strength times the 
// expected signal in each channel.
//
// For the future, perhaps this method should be extended to include the efficiency terms automatically.

   using namespace RooFit;
   using std::vector;

   TList likelihoodFactors;

   //  Double_t MaxSigma = 8; // Needed to set ranges for varaibles.

   RooRealVar*   masterSignal = 
      new RooRealVar(muName,"masterSignal",1., 0., 3.);


   // loop over individual channels
   for(Int_t i=0; i<nbins; ++i){
      // need to name the variables dynamically, so please forgive the string manipulation and focus on values & ranges.
      std::stringstream str;
      str<<"_"<<i;
      RooRealVar*   expectedSignal = 
         new RooRealVar(("expected_s"+str.str()).c_str(),("expected_s"+str.str()).c_str(),sig[i], 0., 2*sig[i]);
      expectedSignal->setConstant(kTRUE);

      RooProduct*   s = 
         new RooProduct(("s"+str.str()).c_str(),("s"+str.str()).c_str(), RooArgSet(*masterSignal, *expectedSignal)); 

      RooRealVar*   b = 
         new RooRealVar(("b"+str.str()).c_str(),("b"+str.str()).c_str(), .5,  0.,1.);
      RooRealVar*  tau = 
         new RooRealVar(("tau"+str.str()).c_str(),("tau"+str.str()).c_str(), .5, 0., 1.); 
      tau->setConstant(kTRUE);

      RooAddition*  splusb = 
         new RooAddition(("splusb"+str.str()).c_str(),("s"+str.str()+"+"+"b"+str.str()).c_str(),   
                         RooArgSet(*s,*b)); 
      RooProduct*   bTau = 
         new RooProduct(("bTau"+str.str()).c_str(),("b*tau"+str.str()).c_str(),   RooArgSet(*b, *tau)); 
      RooRealVar*   x = 
         new RooRealVar(("x"+str.str()).c_str(),("x"+str.str()).c_str(),  0.5 , 0., 1.);
      RooRealVar*   y = 
         new RooRealVar(("y"+str.str()).c_str(),("y"+str.str()).c_str(),  0.5,  0., 1.);


      RooPoisson* sigRegion = 
         new RooPoisson(("sigRegion"+str.str()).c_str(),("sigRegion"+str.str()).c_str(), *x,*splusb);

      //LM:  need to set noRounding since y can take non integer values
      RooPoisson* sideband = 
         new RooPoisson(("sideband"+str.str()).c_str(),("sideband"+str.str()).c_str(), *y,*bTau,true);

      likelihoodFactors.Add(sigRegion);
      likelihoodFactors.Add(sideband);
    
   }

   RooArgSet likelihoodFactorSet(likelihoodFactors);
   RooProdPdf joint(pdfName,"joint", likelihoodFactorSet );
   //  joint.printCompactTree();

   // add this PDF to workspace.  
   // Need to do import into workspace now to get all the structure imported as well.
   // Just returning the WS will loose the rest of the structure b/c it will go out of scope
   RooMsgService::instance().setGlobalKillBelow(RooFit::ERROR) ;
   ws->import(joint);
   RooMsgService::instance().setGlobalKillBelow(RooFit::DEBUG) ;
}

//_______________________________________________________
void NumberCountingPdfFactory::AddExpData(Double_t* sig, 
					  Double_t* back, 
					  Double_t* back_syst, 
					  Int_t nbins, 
					  RooWorkspace* ws, const char* dsName) {

   // Arguements are an array of expected signal, expected background, and relative 
   // background uncertainty (eg. 0.1 for 10% uncertainty), and the number of channels.

   std::vector<Double_t> mainMeas(nbins);

   // loop over channels
   for(Int_t i=0; i<nbins; ++i){
      mainMeas[i] = sig[i] + back[i];
   }
   return AddData(&mainMeas[0], back, back_syst, nbins, ws, dsName);
}

//_______________________________________________________
void NumberCountingPdfFactory::AddExpDataWithSideband(Double_t* sigExp, 
                                                      Double_t* backExp, 
                                                      Double_t* tau, 
                                                      Int_t nbins, 
                                                      RooWorkspace* ws, const char* dsName) {

   // Arguements are an array of expected signal, expected background, and relative 
   // ratio of background expected in the sideband to that expected in signal region, and the number of channels.

   std::vector<Double_t> mainMeas(nbins);
   std::vector<Double_t> sideband(nbins);
   for(Int_t i=0; i<nbins; ++i){
      mainMeas[i] = sigExp[i] + backExp[i];
      sideband[i] = backExp[i]*tau[i];
   }
   return AddDataWithSideband(&mainMeas[0], &sideband[0], tau, nbins, ws, dsName);

}

//_______________________________________________________
RooRealVar* NumberCountingPdfFactory::SafeObservableCreation(RooWorkspace* ws, const char* varName, Double_t value) {
   // need to be careful here that the range of observable in the dataset is consistent with the one in the workspace
   // don't rescale unless necessary.  If it is necessary, then rescale by x10 or a defined maximum.

   return SafeObservableCreation(ws, varName, value, 10.*value);

}

//_______________________________________________________
RooRealVar* NumberCountingPdfFactory::SafeObservableCreation(RooWorkspace* ws, const char* varName, 
							     Double_t value, Double_t maximum) {
   // need to be careful here that the range of observable in the dataset is consistent with the one in the workspace
   // don't rescale unless necessary.  If it is necessary, then rescale by x10 or a defined maximum.

   RooRealVar*   x = ws->var( varName );
   if( !x )
      x = new RooRealVar(varName, varName, value, 0, maximum );
   if( x->getMax() < value )
      x->setMax( max(x->getMax(), 10*value ) );
   x->setVal( value );

   return x;
}


//_______________________________________________________
void NumberCountingPdfFactory::AddData(Double_t* mainMeas, 
                                       Double_t* back, 
                                       Double_t* back_syst, 
                                       Int_t nbins, 
                                       RooWorkspace* ws, const char* dsName) {

   // Arguments are an array of results from a main measurement, a measured background,
   //  and relative background uncertainty (eg. 0.1 for 10% uncertainty), and the number of channels.

   using namespace RooFit;
   using std::vector;

   Double_t MaxSigma = 8; // Needed to set ranges for varaibles.

   TList observablesCollection;

   TTree* tree = new TTree();
   std::vector<Double_t> xForTree(nbins);
   std::vector<Double_t> yForTree(nbins);

   // loop over channels
   for(Int_t i=0; i<nbins; ++i){
      std::stringstream str;
      str<<"_"<<i;

      //Double_t _tau = 1./back[i]/back_syst[i]/back_syst[i];
      // LM: compute tau correctly for the Gamma distribution : mode = tau*b  and variance is (tau*b+1)
      Double_t err = back_syst[i]; 
      Double_t _tau = (1.0 + sqrt(1 + 4 * err * err))/ (2. * err * err)/ back[i];

      RooRealVar*  tau = SafeObservableCreation(ws,  ("tau"+str.str()).c_str(), _tau );

      oocoutW(ws,ObjectHandling) << "NumberCountingPdfFactory: changed value of " << tau->GetName() << " to " << tau->getVal() << 
         " to be consistent with background and its uncertainty. " <<
         " Also stored these values of tau into workspace with name . " << (string(tau->GetName())+string(dsName)).c_str() <<
         " if you test with a different dataset, you should adjust tau appropriately.\n"<< endl;
      RooMsgService::instance().setGlobalKillBelow(RooFit::ERROR) ;
      ws->import(*((RooRealVar*) tau->clone( (string(tau->GetName())+string(dsName)).c_str() ) ) );
      RooMsgService::instance().setGlobalKillBelow(RooFit::DEBUG) ;

      // need to be careful
      RooRealVar* x = SafeObservableCreation(ws, ("x"+str.str()).c_str(), mainMeas[i]);
    
      // need to be careful
      RooRealVar*   y = SafeObservableCreation(ws, ("y"+str.str()).c_str(), back[i]*_tau );

      observablesCollection.Add(x);
      observablesCollection.Add(y);
    
      xForTree[i] = mainMeas[i];
      yForTree[i] = back[i]*_tau;

      tree->Branch(("x"+str.str()).c_str(), &xForTree[i] ,("x"+str.str()+"/D").c_str());
      tree->Branch(("y"+str.str()).c_str(), &yForTree[i] ,("y"+str.str()+"/D").c_str());

      ws->var(("b"+str.str()).c_str())->setMax( 1.2*back[i]+MaxSigma*(sqrt(back[i])+back[i]*back_syst[i]) );
      ws->var(("b"+str.str()).c_str())->setVal( back[i] );

   }
   tree->Fill();
   //  tree->Print();
   //  tree->Scan();

   RooArgList* observableList = new RooArgList(observablesCollection);

   //  observableSet->Print();
   //  observableList->Print();

   RooDataSet* data = new RooDataSet(dsName,"Number Counting Data", tree, *observableList); // one experiment
   //  data->Scan();


   // import hypothetical data
   RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL) ;
   ws->import(*data);
   RooMsgService::instance().setGlobalKillBelow(RooFit::DEBUG) ;

}

//_______________________________________________________
void NumberCountingPdfFactory::AddDataWithSideband(Double_t* mainMeas, 
                                                   Double_t* sideband, 
                                                   Double_t* tauForTree, 
                                                   Int_t nbins, 
                                                   RooWorkspace* ws, const char* dsName) {

   // Arguements are an array of expected signal, expected background, and relative 
   // background uncertainty (eg. 0.1 for 10% uncertainty), and the number of channels.

   using namespace RooFit;
   using std::vector;

   Double_t MaxSigma = 8; // Needed to set ranges for varaibles.

   TList observablesCollection;

   TTree* tree = new TTree();

   std::vector<Double_t> xForTree(nbins);
   std::vector<Double_t> yForTree(nbins);


   // loop over channels
   for(Int_t i=0; i<nbins; ++i){
      std::stringstream str;
      str<<"_"<<i;

      Double_t _tau = tauForTree[i];
      Double_t back_syst = 1./sqrt(sideband[i]);
      Double_t back = (sideband[i]/_tau);


      RooRealVar*  tau = SafeObservableCreation(ws,  ("tau"+str.str()).c_str(), _tau );

      oocoutW(ws,ObjectHandling) << "NumberCountingPdfFactory: changed value of " << tau->GetName() << " to " << tau->getVal() << 
         " to be consistent with background and its uncertainty. " <<
         " Also stored these values of tau into workspace with name . " << (string(tau->GetName())+string(dsName)).c_str() <<
         " if you test with a different dataset, you should adjust tau appropriately.\n"<< endl;
      RooMsgService::instance().setGlobalKillBelow(RooFit::ERROR) ;
      ws->import(*((RooRealVar*) tau->clone( (string(tau->GetName())+string(dsName)).c_str() ) ) );
      RooMsgService::instance().setGlobalKillBelow(RooFit::DEBUG) ;

      // need to be careful
      RooRealVar* x = SafeObservableCreation(ws, ("x"+str.str()).c_str(), mainMeas[i]);
    
      // need to be careful
      RooRealVar*   y = SafeObservableCreation(ws, ("y"+str.str()).c_str(), sideband[i] );


      observablesCollection.Add(x);
      observablesCollection.Add(y);
    
      xForTree[i] = mainMeas[i];
      yForTree[i] = sideband[i];

      tree->Branch(("x"+str.str()).c_str(), &xForTree[i] ,("x"+str.str()+"/D").c_str());
      tree->Branch(("y"+str.str()).c_str(), &yForTree[i] ,("y"+str.str()+"/D").c_str());

      ws->var(("b"+str.str()).c_str())->setMax(  1.2*back+MaxSigma*(sqrt(back)+back*back_syst) );
      ws->var(("b"+str.str()).c_str())->setVal( back );

   }
   tree->Fill();
   //  tree->Print();
   //  tree->Scan();

   RooArgList* observableList = new RooArgList(observablesCollection);

   //  observableSet->Print();
   //  observableList->Print();

   RooDataSet* data = new RooDataSet(dsName,"Number Counting Data", tree, *observableList); // one experiment
   //  data->Scan();


   // import hypothetical data
   RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL) ;
   ws->import(*data);
   RooMsgService::instance().setGlobalKillBelow(RooFit::DEBUG) ;

}



 NumberCountingPdfFactory.cxx:1
 NumberCountingPdfFactory.cxx:2
 NumberCountingPdfFactory.cxx:3
 NumberCountingPdfFactory.cxx:4
 NumberCountingPdfFactory.cxx:5
 NumberCountingPdfFactory.cxx:6
 NumberCountingPdfFactory.cxx:7
 NumberCountingPdfFactory.cxx:8
 NumberCountingPdfFactory.cxx:9
 NumberCountingPdfFactory.cxx:10
 NumberCountingPdfFactory.cxx:11
 NumberCountingPdfFactory.cxx:12
 NumberCountingPdfFactory.cxx:13
 NumberCountingPdfFactory.cxx:14
 NumberCountingPdfFactory.cxx:15
 NumberCountingPdfFactory.cxx:16
 NumberCountingPdfFactory.cxx:17
 NumberCountingPdfFactory.cxx:18
 NumberCountingPdfFactory.cxx:19
 NumberCountingPdfFactory.cxx:20
 NumberCountingPdfFactory.cxx:21
 NumberCountingPdfFactory.cxx:22
 NumberCountingPdfFactory.cxx:23
 NumberCountingPdfFactory.cxx:24
 NumberCountingPdfFactory.cxx:25
 NumberCountingPdfFactory.cxx:26
 NumberCountingPdfFactory.cxx:27
 NumberCountingPdfFactory.cxx:28
 NumberCountingPdfFactory.cxx:29
 NumberCountingPdfFactory.cxx:30
 NumberCountingPdfFactory.cxx:31
 NumberCountingPdfFactory.cxx:32
 NumberCountingPdfFactory.cxx:33
 NumberCountingPdfFactory.cxx:34
 NumberCountingPdfFactory.cxx:35
 NumberCountingPdfFactory.cxx:36
 NumberCountingPdfFactory.cxx:37
 NumberCountingPdfFactory.cxx:38
 NumberCountingPdfFactory.cxx:39
 NumberCountingPdfFactory.cxx:40
 NumberCountingPdfFactory.cxx:41
 NumberCountingPdfFactory.cxx:42
 NumberCountingPdfFactory.cxx:43
 NumberCountingPdfFactory.cxx:44
 NumberCountingPdfFactory.cxx:45
 NumberCountingPdfFactory.cxx:46
 NumberCountingPdfFactory.cxx:47
 NumberCountingPdfFactory.cxx:48
 NumberCountingPdfFactory.cxx:49
 NumberCountingPdfFactory.cxx:50
 NumberCountingPdfFactory.cxx:51
 NumberCountingPdfFactory.cxx:52
 NumberCountingPdfFactory.cxx:53
 NumberCountingPdfFactory.cxx:54
 NumberCountingPdfFactory.cxx:55
 NumberCountingPdfFactory.cxx:56
 NumberCountingPdfFactory.cxx:57
 NumberCountingPdfFactory.cxx:58
 NumberCountingPdfFactory.cxx:59
 NumberCountingPdfFactory.cxx:60
 NumberCountingPdfFactory.cxx:61
 NumberCountingPdfFactory.cxx:62
 NumberCountingPdfFactory.cxx:63
 NumberCountingPdfFactory.cxx:64
 NumberCountingPdfFactory.cxx:65
 NumberCountingPdfFactory.cxx:66
 NumberCountingPdfFactory.cxx:67
 NumberCountingPdfFactory.cxx:68
 NumberCountingPdfFactory.cxx:69
 NumberCountingPdfFactory.cxx:70
 NumberCountingPdfFactory.cxx:71
 NumberCountingPdfFactory.cxx:72
 NumberCountingPdfFactory.cxx:73
 NumberCountingPdfFactory.cxx:74
 NumberCountingPdfFactory.cxx:75
 NumberCountingPdfFactory.cxx:76
 NumberCountingPdfFactory.cxx:77
 NumberCountingPdfFactory.cxx:78
 NumberCountingPdfFactory.cxx:79
 NumberCountingPdfFactory.cxx:80
 NumberCountingPdfFactory.cxx:81
 NumberCountingPdfFactory.cxx:82
 NumberCountingPdfFactory.cxx:83
 NumberCountingPdfFactory.cxx:84
 NumberCountingPdfFactory.cxx:85
 NumberCountingPdfFactory.cxx:86
 NumberCountingPdfFactory.cxx:87
 NumberCountingPdfFactory.cxx:88
 NumberCountingPdfFactory.cxx:89
 NumberCountingPdfFactory.cxx:90
 NumberCountingPdfFactory.cxx:91
 NumberCountingPdfFactory.cxx:92
 NumberCountingPdfFactory.cxx:93
 NumberCountingPdfFactory.cxx:94
 NumberCountingPdfFactory.cxx:95
 NumberCountingPdfFactory.cxx:96
 NumberCountingPdfFactory.cxx:97
 NumberCountingPdfFactory.cxx:98
 NumberCountingPdfFactory.cxx:99
 NumberCountingPdfFactory.cxx:100
 NumberCountingPdfFactory.cxx:101
 NumberCountingPdfFactory.cxx:102
 NumberCountingPdfFactory.cxx:103
 NumberCountingPdfFactory.cxx:104
 NumberCountingPdfFactory.cxx:105
 NumberCountingPdfFactory.cxx:106
 NumberCountingPdfFactory.cxx:107
 NumberCountingPdfFactory.cxx:108
 NumberCountingPdfFactory.cxx:109
 NumberCountingPdfFactory.cxx:110
 NumberCountingPdfFactory.cxx:111
 NumberCountingPdfFactory.cxx:112
 NumberCountingPdfFactory.cxx:113
 NumberCountingPdfFactory.cxx:114
 NumberCountingPdfFactory.cxx:115
 NumberCountingPdfFactory.cxx:116
 NumberCountingPdfFactory.cxx:117
 NumberCountingPdfFactory.cxx:118
 NumberCountingPdfFactory.cxx:119
 NumberCountingPdfFactory.cxx:120
 NumberCountingPdfFactory.cxx:121
 NumberCountingPdfFactory.cxx:122
 NumberCountingPdfFactory.cxx:123
 NumberCountingPdfFactory.cxx:124
 NumberCountingPdfFactory.cxx:125
 NumberCountingPdfFactory.cxx:126
 NumberCountingPdfFactory.cxx:127
 NumberCountingPdfFactory.cxx:128
 NumberCountingPdfFactory.cxx:129
 NumberCountingPdfFactory.cxx:130
 NumberCountingPdfFactory.cxx:131
 NumberCountingPdfFactory.cxx:132
 NumberCountingPdfFactory.cxx:133
 NumberCountingPdfFactory.cxx:134
 NumberCountingPdfFactory.cxx:135
 NumberCountingPdfFactory.cxx:136
 NumberCountingPdfFactory.cxx:137
 NumberCountingPdfFactory.cxx:138
 NumberCountingPdfFactory.cxx:139
 NumberCountingPdfFactory.cxx:140
 NumberCountingPdfFactory.cxx:141
 NumberCountingPdfFactory.cxx:142
 NumberCountingPdfFactory.cxx:143
 NumberCountingPdfFactory.cxx:144
 NumberCountingPdfFactory.cxx:145
 NumberCountingPdfFactory.cxx:146
 NumberCountingPdfFactory.cxx:147
 NumberCountingPdfFactory.cxx:148
 NumberCountingPdfFactory.cxx:149
 NumberCountingPdfFactory.cxx:150
 NumberCountingPdfFactory.cxx:151
 NumberCountingPdfFactory.cxx:152
 NumberCountingPdfFactory.cxx:153
 NumberCountingPdfFactory.cxx:154
 NumberCountingPdfFactory.cxx:155
 NumberCountingPdfFactory.cxx:156
 NumberCountingPdfFactory.cxx:157
 NumberCountingPdfFactory.cxx:158
 NumberCountingPdfFactory.cxx:159
 NumberCountingPdfFactory.cxx:160
 NumberCountingPdfFactory.cxx:161
 NumberCountingPdfFactory.cxx:162
 NumberCountingPdfFactory.cxx:163
 NumberCountingPdfFactory.cxx:164
 NumberCountingPdfFactory.cxx:165
 NumberCountingPdfFactory.cxx:166
 NumberCountingPdfFactory.cxx:167
 NumberCountingPdfFactory.cxx:168
 NumberCountingPdfFactory.cxx:169
 NumberCountingPdfFactory.cxx:170
 NumberCountingPdfFactory.cxx:171
 NumberCountingPdfFactory.cxx:172
 NumberCountingPdfFactory.cxx:173
 NumberCountingPdfFactory.cxx:174
 NumberCountingPdfFactory.cxx:175
 NumberCountingPdfFactory.cxx:176
 NumberCountingPdfFactory.cxx:177
 NumberCountingPdfFactory.cxx:178
 NumberCountingPdfFactory.cxx:179
 NumberCountingPdfFactory.cxx:180
 NumberCountingPdfFactory.cxx:181
 NumberCountingPdfFactory.cxx:182
 NumberCountingPdfFactory.cxx:183
 NumberCountingPdfFactory.cxx:184
 NumberCountingPdfFactory.cxx:185
 NumberCountingPdfFactory.cxx:186
 NumberCountingPdfFactory.cxx:187
 NumberCountingPdfFactory.cxx:188
 NumberCountingPdfFactory.cxx:189
 NumberCountingPdfFactory.cxx:190
 NumberCountingPdfFactory.cxx:191
 NumberCountingPdfFactory.cxx:192
 NumberCountingPdfFactory.cxx:193
 NumberCountingPdfFactory.cxx:194
 NumberCountingPdfFactory.cxx:195
 NumberCountingPdfFactory.cxx:196
 NumberCountingPdfFactory.cxx:197
 NumberCountingPdfFactory.cxx:198
 NumberCountingPdfFactory.cxx:199
 NumberCountingPdfFactory.cxx:200
 NumberCountingPdfFactory.cxx:201
 NumberCountingPdfFactory.cxx:202
 NumberCountingPdfFactory.cxx:203
 NumberCountingPdfFactory.cxx:204
 NumberCountingPdfFactory.cxx:205
 NumberCountingPdfFactory.cxx:206
 NumberCountingPdfFactory.cxx:207
 NumberCountingPdfFactory.cxx:208
 NumberCountingPdfFactory.cxx:209
 NumberCountingPdfFactory.cxx:210
 NumberCountingPdfFactory.cxx:211
 NumberCountingPdfFactory.cxx:212
 NumberCountingPdfFactory.cxx:213
 NumberCountingPdfFactory.cxx:214
 NumberCountingPdfFactory.cxx:215
 NumberCountingPdfFactory.cxx:216
 NumberCountingPdfFactory.cxx:217
 NumberCountingPdfFactory.cxx:218
 NumberCountingPdfFactory.cxx:219
 NumberCountingPdfFactory.cxx:220
 NumberCountingPdfFactory.cxx:221
 NumberCountingPdfFactory.cxx:222
 NumberCountingPdfFactory.cxx:223
 NumberCountingPdfFactory.cxx:224
 NumberCountingPdfFactory.cxx:225
 NumberCountingPdfFactory.cxx:226
 NumberCountingPdfFactory.cxx:227
 NumberCountingPdfFactory.cxx:228
 NumberCountingPdfFactory.cxx:229
 NumberCountingPdfFactory.cxx:230
 NumberCountingPdfFactory.cxx:231
 NumberCountingPdfFactory.cxx:232
 NumberCountingPdfFactory.cxx:233
 NumberCountingPdfFactory.cxx:234
 NumberCountingPdfFactory.cxx:235
 NumberCountingPdfFactory.cxx:236
 NumberCountingPdfFactory.cxx:237
 NumberCountingPdfFactory.cxx:238
 NumberCountingPdfFactory.cxx:239
 NumberCountingPdfFactory.cxx:240
 NumberCountingPdfFactory.cxx:241
 NumberCountingPdfFactory.cxx:242
 NumberCountingPdfFactory.cxx:243
 NumberCountingPdfFactory.cxx:244
 NumberCountingPdfFactory.cxx:245
 NumberCountingPdfFactory.cxx:246
 NumberCountingPdfFactory.cxx:247
 NumberCountingPdfFactory.cxx:248
 NumberCountingPdfFactory.cxx:249
 NumberCountingPdfFactory.cxx:250
 NumberCountingPdfFactory.cxx:251
 NumberCountingPdfFactory.cxx:252
 NumberCountingPdfFactory.cxx:253
 NumberCountingPdfFactory.cxx:254
 NumberCountingPdfFactory.cxx:255
 NumberCountingPdfFactory.cxx:256
 NumberCountingPdfFactory.cxx:257
 NumberCountingPdfFactory.cxx:258
 NumberCountingPdfFactory.cxx:259
 NumberCountingPdfFactory.cxx:260
 NumberCountingPdfFactory.cxx:261
 NumberCountingPdfFactory.cxx:262
 NumberCountingPdfFactory.cxx:263
 NumberCountingPdfFactory.cxx:264
 NumberCountingPdfFactory.cxx:265
 NumberCountingPdfFactory.cxx:266
 NumberCountingPdfFactory.cxx:267
 NumberCountingPdfFactory.cxx:268
 NumberCountingPdfFactory.cxx:269
 NumberCountingPdfFactory.cxx:270
 NumberCountingPdfFactory.cxx:271
 NumberCountingPdfFactory.cxx:272
 NumberCountingPdfFactory.cxx:273
 NumberCountingPdfFactory.cxx:274
 NumberCountingPdfFactory.cxx:275
 NumberCountingPdfFactory.cxx:276
 NumberCountingPdfFactory.cxx:277
 NumberCountingPdfFactory.cxx:278
 NumberCountingPdfFactory.cxx:279
 NumberCountingPdfFactory.cxx:280
 NumberCountingPdfFactory.cxx:281
 NumberCountingPdfFactory.cxx:282
 NumberCountingPdfFactory.cxx:283
 NumberCountingPdfFactory.cxx:284
 NumberCountingPdfFactory.cxx:285
 NumberCountingPdfFactory.cxx:286
 NumberCountingPdfFactory.cxx:287
 NumberCountingPdfFactory.cxx:288
 NumberCountingPdfFactory.cxx:289
 NumberCountingPdfFactory.cxx:290
 NumberCountingPdfFactory.cxx:291
 NumberCountingPdfFactory.cxx:292
 NumberCountingPdfFactory.cxx:293
 NumberCountingPdfFactory.cxx:294
 NumberCountingPdfFactory.cxx:295
 NumberCountingPdfFactory.cxx:296
 NumberCountingPdfFactory.cxx:297
 NumberCountingPdfFactory.cxx:298
 NumberCountingPdfFactory.cxx:299
 NumberCountingPdfFactory.cxx:300
 NumberCountingPdfFactory.cxx:301
 NumberCountingPdfFactory.cxx:302
 NumberCountingPdfFactory.cxx:303
 NumberCountingPdfFactory.cxx:304
 NumberCountingPdfFactory.cxx:305
 NumberCountingPdfFactory.cxx:306
 NumberCountingPdfFactory.cxx:307
 NumberCountingPdfFactory.cxx:308
 NumberCountingPdfFactory.cxx:309
 NumberCountingPdfFactory.cxx:310
 NumberCountingPdfFactory.cxx:311
 NumberCountingPdfFactory.cxx:312
 NumberCountingPdfFactory.cxx:313
 NumberCountingPdfFactory.cxx:314
 NumberCountingPdfFactory.cxx:315
 NumberCountingPdfFactory.cxx:316
 NumberCountingPdfFactory.cxx:317
 NumberCountingPdfFactory.cxx:318
 NumberCountingPdfFactory.cxx:319
 NumberCountingPdfFactory.cxx:320
 NumberCountingPdfFactory.cxx:321
 NumberCountingPdfFactory.cxx:322
 NumberCountingPdfFactory.cxx:323
 NumberCountingPdfFactory.cxx:324
 NumberCountingPdfFactory.cxx:325
 NumberCountingPdfFactory.cxx:326
 NumberCountingPdfFactory.cxx:327
 NumberCountingPdfFactory.cxx:328
 NumberCountingPdfFactory.cxx:329
 NumberCountingPdfFactory.cxx:330
 NumberCountingPdfFactory.cxx:331
 NumberCountingPdfFactory.cxx:332
 NumberCountingPdfFactory.cxx:333
 NumberCountingPdfFactory.cxx:334
 NumberCountingPdfFactory.cxx:335
 NumberCountingPdfFactory.cxx:336
 NumberCountingPdfFactory.cxx:337
 NumberCountingPdfFactory.cxx:338
 NumberCountingPdfFactory.cxx:339
 NumberCountingPdfFactory.cxx:340
 NumberCountingPdfFactory.cxx:341
 NumberCountingPdfFactory.cxx:342
 NumberCountingPdfFactory.cxx:343
 NumberCountingPdfFactory.cxx:344
 NumberCountingPdfFactory.cxx:345
 NumberCountingPdfFactory.cxx:346
 NumberCountingPdfFactory.cxx:347
 NumberCountingPdfFactory.cxx:348
 NumberCountingPdfFactory.cxx:349
 NumberCountingPdfFactory.cxx:350
 NumberCountingPdfFactory.cxx:351
 NumberCountingPdfFactory.cxx:352
 NumberCountingPdfFactory.cxx:353
 NumberCountingPdfFactory.cxx:354
 NumberCountingPdfFactory.cxx:355
 NumberCountingPdfFactory.cxx:356
 NumberCountingPdfFactory.cxx:357
 NumberCountingPdfFactory.cxx:358
 NumberCountingPdfFactory.cxx:359
 NumberCountingPdfFactory.cxx:360
 NumberCountingPdfFactory.cxx:361
 NumberCountingPdfFactory.cxx:362
 NumberCountingPdfFactory.cxx:363
 NumberCountingPdfFactory.cxx:364
 NumberCountingPdfFactory.cxx:365
 NumberCountingPdfFactory.cxx:366
 NumberCountingPdfFactory.cxx:367
 NumberCountingPdfFactory.cxx:368
 NumberCountingPdfFactory.cxx:369
 NumberCountingPdfFactory.cxx:370
 NumberCountingPdfFactory.cxx:371
 NumberCountingPdfFactory.cxx:372
 NumberCountingPdfFactory.cxx:373
 NumberCountingPdfFactory.cxx:374
 NumberCountingPdfFactory.cxx:375
 NumberCountingPdfFactory.cxx:376
 NumberCountingPdfFactory.cxx:377
 NumberCountingPdfFactory.cxx:378
 NumberCountingPdfFactory.cxx:379
 NumberCountingPdfFactory.cxx:380
 NumberCountingPdfFactory.cxx:381
 NumberCountingPdfFactory.cxx:382
 NumberCountingPdfFactory.cxx:383
 NumberCountingPdfFactory.cxx:384
 NumberCountingPdfFactory.cxx:385
 NumberCountingPdfFactory.cxx:386
 NumberCountingPdfFactory.cxx:387
 NumberCountingPdfFactory.cxx:388