Logo ROOT   6.07/09
Reference Guide
ToyMCImportanceSampler.cxx
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 // Author: Sven Kreiss January 2012
3 // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
4 /*************************************************************************
5  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
13 
14 #ifndef ROO_MSG_SERVICE
15 #include "RooMsgService.h"
16 #endif
17 
18 #include "RooCategory.h"
19 #include "TMath.h"
20 
21 using namespace RooFit;
22 using namespace std;
23 
24 
26 
27 namespace RooStats {
28 
29 
30 ToyMCImportanceSampler::~ToyMCImportanceSampler() {
31  for( unsigned int i=0; i < fImportanceSnapshots.size(); i++ ) if(fImportanceSnapshots[i]) delete fImportanceSnapshots[i];
32  for( unsigned int i=0; i < fNullSnapshots.size(); i++ ) if(fNullSnapshots[i]) delete fNullSnapshots[i];
33 }
34 void ToyMCImportanceSampler::ClearCache(void) {
35  ToyMCSampler::ClearCache();
36 
37  for( unsigned int i=0; i < fImpNLLs.size(); i++ ) if(fImpNLLs[i]) { delete fImpNLLs[i]; fImpNLLs[i] = NULL; }
38  for( unsigned int i=0; i < fNullNLLs.size(); i++ ) if(fNullNLLs[i]) { delete fNullNLLs[i]; fNullNLLs[i] = NULL; }
39 }
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 RooDataSet* ToyMCImportanceSampler::GetSamplingDistributionsSingleWorker(RooArgSet& paramPoint) {
50  if( fNToys == 0 ) return NULL;
51 
52  // remember original #toys, but overwrite it temporarily with the #toys per distribution
53  Int_t allToys = fNToys;
54 
55  // to keep track of which dataset entry comes form which density, define a roocategory as a label
56  RooCategory densityLabel( "densityLabel", "densityLabel" );
57  densityLabel.defineType( "null", -1 );
58  for( unsigned int i=0; i < fImportanceDensities.size(); i++ )
59  densityLabel.defineType( TString::Format( "impDens_%d", i ), i );
60 
61 
62  RooDataSet* fullResult = NULL;
63 
64  // generate null (negative i) and imp densities (0 and positive i)
65  for( int i = -1; i < (int)fImportanceDensities.size(); i++ ) {
66  if( i < 0 ) {
67  // generate null toys
68  oocoutP((TObject*)0,Generation) << endl << endl << " GENERATING FROM NULL DENSITY " << endl << endl;
69  SetDensityToGenerateFromByIndex( 0, true ); // true = generate from null
70  }else{
71  oocoutP((TObject*)0,Generation) << endl << endl << " GENERATING IMP DENS/SNAP "<<i+1<<" OUT OF "<<fImportanceDensities.size()<<endl<<endl;
72  SetDensityToGenerateFromByIndex( i, false ); // false = generate not from null
73  }
74 
75  RooRealVar reweight( "reweight", "reweight", 1.0 );
76  // apply strategy for how to distribute the #toys between the distributions
77  if( fToysStrategy == EQUALTOYSPERDENSITY ) {
78  // assuming alltoys = one null + N imp densities. And round up.
79  fNToys = TMath::CeilNint( double(allToys)/(fImportanceDensities.size()+1) );
80  }else if(fToysStrategy == EXPONENTIALTOYDISTRIBUTION ) {
81  // for N densities, split the toys into (2^(N+1))-1 parts, and assign 2^0 parts to the first
82  // density (which is the null), 2^1 to the second (first imp dens), etc, up to 2^N
83  fNToys = TMath::CeilNint( double(allToys) * pow( double(2) , i+1 ) / (pow( double(2), int(fImportanceDensities.size()+1) )-1) );
84 
85  int largestNToys = TMath::CeilNint( allToys * pow( double(2), int(fImportanceDensities.size()) ) / (pow( double(2), int(fImportanceDensities.size()+1) )-1) );
86  reweight.setVal( ((double)largestNToys) / fNToys );
87  }
88 
89  ooccoutI((TObject*)NULL,InputArguments) << "Generating " << fNToys << " toys for this density." << endl;
90  ooccoutI((TObject*)NULL,InputArguments) << "Reweight is " << reweight.getVal() << endl;
91 
92 
93  RooDataSet* result = ToyMCSampler::GetSamplingDistributionsSingleWorker( paramPoint );
94 
95  if (result->get()->getSize() > Int_t(fTestStatistics.size())) {
96  // add label
97  densityLabel.setIndex( i );
98  result->addColumn( densityLabel );
99  result->addColumn( reweight );
100  }
101 
102  if( !fullResult ) {
103  RooArgSet columns( *result->get() );
104  RooRealVar weightVar ( "weight", "weight", 1.0 );
105  columns.add( weightVar );
106 // cout << endl << endl << "Reweighted data columns: " << endl;
107 // columns.Print("v");
108 // cout << endl;
109  fullResult = new RooDataSet( result->GetName(), result->GetTitle(), columns, "weight" );
110  }
111 
112  for( int j=0; j < result->numEntries(); j++ ) {
113 // cout << "entry: " << j << endl;
114 // result->get(j)->Print();
115 // cout << "weight: " << result->weight() << endl;
116 // cout << "reweight: " << reweight.getVal() << endl;
117  const RooArgSet* row = result->get(j);
118  fullResult->add( *row, result->weight()*reweight.getVal() );
119  }
120  delete result;
121  }
122 
123  // restore #toys
124  fNToys = allToys;
125 
126  return fullResult;
127 }
128 
129 
130 
131 
132 
133 
134 
135 RooAbsData* ToyMCImportanceSampler::GenerateToyData(
136  RooArgSet& paramPoint,
137  double& weight
138 ) const {
139  if( fNullDensities.size() > 1 ) {
140  ooccoutI((TObject*)NULL,InputArguments) << "Null Densities:" << endl;
141  for( unsigned int i=0; i < fNullDensities.size(); i++) {
142  ooccoutI((TObject*)NULL,InputArguments) << " null density["<<i<<"]: " << fNullDensities[i] << " \t null snapshot["<<i<<"]: " << fNullSnapshots[i] << endl;
143  }
144  ooccoutE((TObject*)NULL,InputArguments) << "Cannot use multiple null densities and only ask for one weight." << endl;
145  return NULL;
146  }
147 
148  if( fNullDensities.size() == 0 && fPdf ) {
149  ooccoutI((TObject*)NULL,InputArguments) << "No explicit null densities specified. Going to add one based on the given paramPoint and the global fPdf. ... but cannot do that inside const function." << endl;
150  //AddNullDensity( fPdf, &paramPoint );
151  }
152 
153  // do not do anything if the given parameter point if fNullSnapshots[0]
154  // ... which is the most common case
155  if( fNullSnapshots[0] != &paramPoint ) {
156  ooccoutD((TObject*)NULL,InputArguments) << "Using given parameter point. Replaces snapshot for the only null currently defined." << endl;
157  if(fNullSnapshots[0]) delete fNullSnapshots[0];
158  fNullSnapshots.clear();
159  fNullSnapshots.push_back( (RooArgSet*)paramPoint.snapshot() );
160  }
161 
162  vector<double> weights;
163  weights.push_back( weight );
164 
165  vector<double> impNLLs;
166  for( unsigned int i=0; i < fImportanceDensities.size(); i++ ) impNLLs.push_back( 0.0 );
167  vector<double> nullNLLs;
168  for( unsigned int i=0; i < fNullDensities.size(); i++ ) nullNLLs.push_back( 0.0 );
169 
170  RooAbsData *d = GenerateToyData( weights, impNLLs, nullNLLs );
171  weight = weights[0];
172  return d;
173 }
174 RooAbsData* ToyMCImportanceSampler::GenerateToyData(
175  RooArgSet& paramPoint,
176  double& weight,
177  vector<double>& impNLLs,
178  double& nullNLL
179 ) const {
180  if( fNullDensities.size() > 1 ) {
181  ooccoutI((TObject*)NULL,InputArguments) << "Null Densities:" << endl;
182  for( unsigned int i=0; i < fNullDensities.size(); i++) {
183  ooccoutI((TObject*)NULL,InputArguments) << " null density["<<i<<"]: " << fNullDensities[i] << " \t null snapshot["<<i<<"]: " << fNullSnapshots[i] << endl;
184  }
185  ooccoutE((TObject*)NULL,InputArguments) << "Cannot use multiple null densities and only ask for one weight and NLL." << endl;
186  return NULL;
187  }
188 
189  if( fNullDensities.size() == 0 && fPdf ) {
190  ooccoutI((TObject*)NULL,InputArguments) << "No explicit null densities specified. Going to add one based on the given paramPoint and the global fPdf. ... but cannot do that inside const function." << endl;
191  //AddNullDensity( fPdf, &paramPoint );
192  }
193 
194  ooccoutI((TObject*)NULL,InputArguments) << "Using given parameter point. Overwrites snapshot for the only null currently defined." << endl;
195  if(fNullSnapshots[0]) delete fNullSnapshots[0];
196  fNullSnapshots.clear();
197  fNullSnapshots.push_back( (const RooArgSet*)paramPoint.snapshot() );
198 
199  vector<double> weights;
200  weights.push_back( weight );
201 
202  vector<double> nullNLLs;
203  nullNLLs.push_back( nullNLL );
204 
205  RooAbsData *d = GenerateToyData( weights, impNLLs, nullNLLs );
206  weight = weights[0];
207  nullNLL = nullNLLs[0];
208  return d;
209 }
210 
211 RooAbsData* ToyMCImportanceSampler::GenerateToyData(
212  vector<double>& weights
213 ) const {
214  if( fNullDensities.size() != weights.size() ) {
215  ooccoutI((TObject*)NULL,InputArguments) << "weights.size() != nullDesnities.size(). You need to provide a vector with the correct size." << endl;
216  //AddNullDensity( fPdf, &paramPoint );
217  }
218 
219  vector<double> impNLLs;
220  for( unsigned int i=0; i < fImportanceDensities.size(); i++ ) impNLLs.push_back( 0.0 );
221  vector<double> nullNLLs;
222  for( unsigned int i=0; i < fNullDensities.size(); i++ ) nullNLLs.push_back( 0.0 );
223 
224  RooAbsData *d = GenerateToyData( weights, impNLLs, nullNLLs );
225  return d;
226 }
227 RooAbsData* ToyMCImportanceSampler::GenerateToyData(
228  vector<double>& weights,
229  vector<double>& impNLLVals,
230  vector<double>& nullNLLVals
231 ) const { // This method generates a toy data set for importance sampling for the given parameter point taking
232  // global observables into account.
233  // The values of the generated global observables remain in the pdf's variables.
234  // They have to have those values for the subsequent evaluation of the
235  // test statistics.
236 
237 
238  ooccoutD((TObject*)0,InputArguments) << endl;
239  ooccoutD((TObject*)0,InputArguments) << "GenerateToyDataImportanceSampling" << endl;
240 
241  if(!fObservables) {
242  ooccoutE((TObject*)NULL,InputArguments) << "Observables not set." << endl;
243  return NULL;
244  }
245 
246  if( fNullDensities.size() == 0 ) {
247  oocoutE((TObject*)NULL,InputArguments) << "ToyMCImportanceSampler: Need to specify the null density explicitly." << endl;
248  return NULL;
249  }
250 
251  // catch the case when NLLs are not created (e.g. when ToyMCSampler was streamed for Proof)
252  if( fNullNLLs.size() == 0 && fNullDensities.size() > 0 ) {
253  for( unsigned int i = 0; i < fNullDensities.size(); i++ ) fNullNLLs.push_back( NULL );
254  }
255  if( fImpNLLs.size() == 0 && fImportanceDensities.size() > 0 ) {
256  for( unsigned int i = 0; i < fImportanceDensities.size(); i++ ) fImpNLLs.push_back( NULL );
257  }
258 
259  if( fNullDensities.size() != fNullNLLs.size() ) {
260  oocoutE((TObject*)NULL,InputArguments) << "ToyMCImportanceSampler: Something wrong. NullNLLs must be of same size as null densities." << endl;
261  return NULL;
262  }
263 
264  if( (!fGenerateFromNull && fIndexGenDensity >= fImportanceDensities.size()) ||
265  (fGenerateFromNull && fIndexGenDensity >= fNullDensities.size())
266  ) {
267  oocoutE((TObject*)NULL,InputArguments) << "ToyMCImportanceSampler: no importance density given or index out of range." << endl;
268  return NULL;
269  }
270 
271 
272  // paramPoint used to be given as parameter
273  // situation is clear when there is only one null.
274  // WHAT TO DO FOR MANY NULL DENSITIES?
275  RooArgSet paramPoint( *fNullSnapshots[0] );
276  //cout << "paramPoint: " << endl;
277  //paramPoint.Print("v");
278 
279 
280  // assign input paramPoint
281  RooArgSet* allVars = fPdf->getVariables();
282  *allVars = paramPoint;
283 
284 
285  // create nuisance parameter points
286  if(!fNuisanceParametersSampler && fPriorNuisance && fNuisancePars)
287  fNuisanceParametersSampler = new NuisanceParametersSampler(fPriorNuisance, fNuisancePars, fNToys, fExpectedNuisancePar);
288 
289  // generate global observables
290  RooArgSet observables(*fObservables);
291  if(fGlobalObservables && fGlobalObservables->getSize()) {
292  observables.remove(*fGlobalObservables);
293  // WHAT TODO FOR MANY NULL DENSITIES?
294  GenerateGlobalObservables(*fNullDensities[0]);
295  }
296 
297  // save values to restore later.
298  // but this must remain after(!) generating global observables
299  if( !fGenerateFromNull ) {
300  RooArgSet* allVarsImpDens = fImportanceDensities[fIndexGenDensity]->getVariables();
301  allVars->add(*allVarsImpDens);
302  delete allVarsImpDens;
303  }
304  const RooArgSet* saveVars = (const RooArgSet*)allVars->snapshot();
305 
306  double globalWeight = 1.0;
307  if(fNuisanceParametersSampler) { // use nuisance parameters?
308  // Construct a set of nuisance parameters that has the parameters
309  // in the input paramPoint removed. Therefore, no parameter in
310  // paramPoint is randomized.
311  // Therefore when a parameter is given (should be held fixed),
312  // but is also in the list of nuisance parameters, the parameter
313  // will be held fixed. This is useful for debugging to hold single
314  // parameters fixed although under "normal" circumstances it is
315  // randomized.
316  RooArgSet allVarsMinusParamPoint(*allVars);
317  allVarsMinusParamPoint.remove(paramPoint, kFALSE, kTRUE); // match by name
318 
319  // get nuisance parameter point and weight
320  fNuisanceParametersSampler->NextPoint(allVarsMinusParamPoint, globalWeight);
321  }
322  // populate input weights vector with this globalWeight
323  for( unsigned int i=0; i < weights.size(); i++ ) weights[i] = globalWeight;
324 
325  RooAbsData* data = NULL;
326  if( fGenerateFromNull ) {
327  //cout << "gen from null" << endl;
328  *allVars = *fNullSnapshots[fIndexGenDensity];
329  data = Generate(*fNullDensities[fIndexGenDensity], observables);
330  }else{
331  // need to be careful here not to overwrite the current state of the
332  // nuisance parameters, ie they must not be part of the snapshot
333  //cout << "gen from imp" << endl;
334  if(fImportanceSnapshots[fIndexGenDensity]) *allVars = *fImportanceSnapshots[fIndexGenDensity];
335  data = Generate(*fImportanceDensities[fIndexGenDensity], observables);
336  }
337  //cout << "data generated: " << data << endl;
338 
339  if (!data) {
340  oocoutE((TObject*)0,InputArguments) << "ToyMCImportanceSampler: error generating data" << endl;
341  return NULL;
342  }
343 
344 
345 
346  // Importance Sampling: adjust weight
347  // Sources: Alex Read, presentation by Michael Woodroofe
348 
349  ooccoutD((TObject*)0,InputArguments) << "About to create/calculate all nullNLLs." << endl;
350  for( unsigned int i=0; i < fNullDensities.size(); i++ ) {
351  //oocoutI((TObject*)0,InputArguments) << "Setting variables to nullSnapshot["<<i<<"]"<<endl;
352  //fNullSnapshots[i]->Print("v");
353 
354  *allVars = *fNullSnapshots[i];
355  if( !fNullNLLs[i] ) {
356  RooArgSet* allParams = fNullDensities[i]->getParameters(*data);
357  fNullNLLs[i] = fNullDensities[i]->createNLL(*data, RooFit::CloneData(kFALSE), RooFit::Constrain(*allParams),
358  RooFit::ConditionalObservables(fConditionalObs));
359  delete allParams;
360  }else{
361  fNullNLLs[i]->setData( *data, kFALSE );
362  }
363  nullNLLVals[i] = fNullNLLs[i]->getVal();
364  // FOR DEBuGGING!!!!!!!!!!!!!!!!!
365  if( !fReuseNLL ) { delete fNullNLLs[i]; fNullNLLs[i] = NULL; }
366  }
367 
368 
369  // for each null: find minNLLVal of null and all imp densities
370  ooccoutD((TObject*)0,InputArguments) << "About to find the minimum NLLs." << endl;
371  vector<double> minNLLVals;
372  for( unsigned int i=0; i < nullNLLVals.size(); i++ ) minNLLVals.push_back( nullNLLVals[i] );
373 
374  for( unsigned int i=0; i < fImportanceDensities.size(); i++ ) {
375  //oocoutI((TObject*)0,InputArguments) << "Setting variables to impSnapshot["<<i<<"]"<<endl;
376  //fImportanceSnapshots[i]->Print("v");
377 
378  if( fImportanceSnapshots[i] ) *allVars = *fImportanceSnapshots[i];
379  if( !fImpNLLs[i] ) {
380  RooArgSet* allParams = fImportanceDensities[i]->getParameters(*data);
381  fImpNLLs[i] = fImportanceDensities[i]->createNLL(*data, RooFit::CloneData(kFALSE), RooFit::Constrain(*allParams),
382  RooFit::ConditionalObservables(fConditionalObs));
383  delete allParams;
384  }else{
385  fImpNLLs[i]->setData( *data, kFALSE );
386  }
387  impNLLVals[i] = fImpNLLs[i]->getVal();
388  // FOR DEBuGGING!!!!!!!!!!!!!!!!!
389  if( !fReuseNLL ) { delete fImpNLLs[i]; fImpNLLs[i] = NULL; }
390 
391  for( unsigned int j=0; j < nullNLLVals.size(); j++ ) {
392  if( impNLLVals[i] < minNLLVals[j] ) minNLLVals[j] = impNLLVals[i];
393  ooccoutD((TObject*)0,InputArguments) << "minNLLVals["<<j<<"]: " << minNLLVals[j] << " nullNLLVals["<<j<<"]: " << nullNLLVals[j] << " impNLLVals["<<i<<"]: " << impNLLVals[i] << endl;
394  }
395  }
396 
397  // veto toys: this is a sort of "overlap removal" of the various distributions
398  // if not vetoed: apply weight
399  ooccoutD((TObject*)0,InputArguments) << "About to apply vetos and calculate weights." << endl;
400  for( unsigned int j=0; j < nullNLLVals.size(); j++ ) {
401  if ( fApplyVeto && fGenerateFromNull && minNLLVals[j] != nullNLLVals[j] ) weights[j] = 0.0;
402  else if( fApplyVeto && !fGenerateFromNull && minNLLVals[j] != impNLLVals[fIndexGenDensity] ) weights[j] = 0.0;
403  else if( !fGenerateFromNull ) {
404  // apply (for fImportanceGenNorm, the weight is one, so nothing needs to be done here)
405 
406  // L(pdf) / L(imp) = exp( NLL(imp) - NLL(pdf) )
407  weights[j] *= exp(minNLLVals[j] - nullNLLVals[j]);
408  }
409 
410  ooccoutD((TObject*)0,InputArguments) << "weights["<<j<<"]: " << weights[j] << endl;
411  }
412 
413 
414 
415  *allVars = *saveVars;
416  delete allVars;
417  delete saveVars;
418 
419  return data;
420 }
421 
422 
423 
424 
425 
426 // poi has to be fitted beforehand. This function expects this to be the muhat value.
427 int ToyMCImportanceSampler::CreateImpDensitiesForOnePOIAdaptively( RooAbsPdf& pdf, const RooArgSet& allPOI, RooRealVar& poi, double nStdDevOverlap, double poiValueForBackground ) {
428  // these might not necessarily be the same thing.
429  double impMaxMu = poi.getVal();
430 
431  // this includes the null
432  int n = 1;
433 
434  // check whether error is trustworthy
435  if( poi.getError() > 0.01 && poi.getError() < 5.0 ) {
436  n = TMath::CeilNint( poi.getVal() / (2.*nStdDevOverlap*poi.getError()) ); // round up
437  oocoutI((TObject*)0,InputArguments) << "Using fitFavoredMu and error to set the number of imp points" << endl;
438  oocoutI((TObject*)0,InputArguments) << "muhat: " << poi.getVal() << " optimize for distance: " << 2.*nStdDevOverlap*poi.getError() << endl;
439  oocoutI((TObject*)0,InputArguments) << "n = " << n << endl;
440  oocoutI((TObject*)0,InputArguments) << "This results in a distance of: " << impMaxMu / n << endl;
441  }
442 
443  // exclude the null, just return the number of importance snapshots
444  return CreateNImpDensitiesForOnePOI( pdf, allPOI, poi, n-1, poiValueForBackground);
445 }
446 
447 int ToyMCImportanceSampler::CreateNImpDensitiesForOnePOI( RooAbsPdf& pdf, const RooArgSet& allPOI, RooRealVar& poi, int n, double poiValueForBackground ) {
448  // n is the number of importance densities
449 
450  // these might not necessarily be the same thing.
451  double impMaxMu = poi.getVal();
452 
453  // create imp snapshots
454  if( impMaxMu > poiValueForBackground && n > 0 ) {
455  for( int i=1; i <= n; i++ ) {
456  poi.setVal( poiValueForBackground + (double)i/(n)*(impMaxMu - poiValueForBackground) );
457  oocoutI((TObject*)0,InputArguments) << endl << "create point with poi: " << endl;
458  poi.Print();
459 
460  // impSnaps without first snapshot because that is null hypothesis
461 
462  AddImportanceDensity( &pdf, &allPOI );
463  }
464  }
465 
466  return n;
467 }
468 
469 
470 
471 
472 
473 
474 
475 
476 } // end namespace RooStats
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
#define ooccoutI(o, a)
Definition: RooMsgService.h:52
RooCmdArg CloneData(Bool_t flag)
virtual Bool_t setIndex(Int_t index, Bool_t printError=kTRUE)
Set value by specifying the index code of the desired state.
#define oocoutI(o, a)
Definition: RooMsgService.h:45
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: Rtypes.h:92
STL namespace.
ToyMCImportanceSampler is an extension of the ToyMCSampler for Importance Sampling.
#define ooccoutE(o, a)
Definition: RooMsgService.h:55
#define oocoutP(o, a)
Definition: RooMsgService.h:46
virtual RooAbsArg * addColumn(RooAbsArg &var, Bool_t adjustRange=kTRUE)
Add a column with the values of the given (function) argument to this dataset.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Definition: TString.cxx:2335
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
Definition: RooAbsArg.h:227
#define oocoutE(o, a)
Definition: RooMsgService.h:48
double pow(double, double)
Double_t getVal(const RooArgSet *set=0) const
Definition: RooAbsReal.h:64
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:37
virtual void setVal(Double_t value)
Set value of variable to &#39;value&#39;.
Definition: RooRealVar.cxx:205
virtual Double_t weight() const
Return event weight of current event.
virtual Int_t numEntries() const
Definition: RooAbsData.cxx:269
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:29
RooCategory represents a fundamental (non-derived) discrete value object.
Definition: RooCategory.h:25
virtual void add(const RooArgSet &row, Double_t weight=1.0, Double_t weightError=0)
Add a data point, with its coordinates specified in the &#39;data&#39; argset, to the data set...
Namespace for the RooStats classes.
Definition: Asimov.h:20
#define ClassImp(name)
Definition: Rtypes.h:279
#define ooccoutD(o, a)
Definition: RooMsgService.h:51
Mother of all ROOT objects.
Definition: TObject.h:44
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
#define NULL
Definition: Rtypes.h:82
Bool_t defineType(const char *label)
Define a state with given name, the lowest available positive integer is assigned as index...
double result[121]
Int_t getSize() const
double exp(double)
RooCmdArg ConditionalObservables(const RooArgSet &set)
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual const RooArgSet * get(Int_t index) const
Return RooArgSet with coordinates of event &#39;index&#39;.
const Int_t n
Definition: legend1.C:16
Helper class for ToyMCSampler.
Definition: ToyMCSampler.h:51
Int_t CeilNint(Double_t x)
Definition: TMath.h:470
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add element to non-owning set.
Definition: RooArgSet.cxx:448
RooCmdArg Constrain(const RooArgSet &params)
Double_t getError() const
Definition: RooRealVar.h:54