Logo ROOT   6.18/05
Reference Guide
RooLandau.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitModels *
4 * @(#)root/roofit:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17/** \class RooLandau
18 \ingroup Roofit
19
20Landau distribution p.d.f
21\image html RF_Landau.png "PDF of the Landau distribution."
22**/
23
24#include "TMath.h"
25#include "RooFit.h"
26
27#include "RooLandau.h"
28#include "RooLandau.h"
29#include "RooRandom.h"
30
31#include "TError.h"
32
33using namespace std;
34
36
37////////////////////////////////////////////////////////////////////////////////
38
39RooLandau::RooLandau(const char *name, const char *title, RooAbsReal& _x, RooAbsReal& _mean, RooAbsReal& _sigma) :
40 RooAbsPdf(name,title),
41 x("x","Dependent",this,_x),
42 mean("mean","Mean",this,_mean),
43 sigma("sigma","Width",this,_sigma)
44{
45}
46
47////////////////////////////////////////////////////////////////////////////////
48
49RooLandau::RooLandau(const RooLandau& other, const char* name) :
50 RooAbsPdf(other,name),
51 x("x",this,other.x),
52 mean("mean",this,other.mean),
53 sigma("sigma",this,other.sigma)
54{
55}
56
57////////////////////////////////////////////////////////////////////////////////
58
60{
61 return TMath::Landau(x, mean, sigma);
62}
63
64////////////////////////////////////////////////////////////////////////////////
65
66Int_t RooLandau::getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, Bool_t /*staticInitOK*/) const
67{
68 if (matchArgs(directVars,generateVars,x)) return 1 ;
69 return 0 ;
70}
71
72////////////////////////////////////////////////////////////////////////////////
73
75{
76 R__ASSERT(code==1) ;
77 Double_t xgen ;
78 while(1) {
80 if (xgen<x.max() && xgen>x.min()) {
81 x = xgen ;
82 break;
83 }
84 }
85 return;
86}
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
#define ClassImp(name)
Definition: Rtypes.h:365
#define R__ASSERT(e)
Definition: TError.h:96
char name[80]
Definition: TGX11.cxx:109
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
Bool_t matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
Landau distribution p.d.f.
Definition: RooLandau.h:24
RooLandau()
Definition: RooLandau.h:26
void generateEvent(Int_t code)
Interface for generation of an event using the algorithm corresponding to the specified code.
Definition: RooLandau.cxx:74
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
Definition: RooLandau.cxx:59
RooRealProxy x
Definition: RooLandau.h:37
RooRealProxy sigma
Definition: RooLandau.h:39
Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const
Load generatedVars with the subset of directVars that we can generate events for, and return a code t...
Definition: RooLandau.cxx:66
RooRealProxy mean
Definition: RooLandau.h:38
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
Definition: RooRandom.cxx:54
Double_t min(const char *rname=0) const
Definition: RooRealProxy.h:56
Double_t max(const char *rname=0) const
Definition: RooRealProxy.h:57
virtual Double_t Landau(Double_t mean=0, Double_t sigma=1)
Generate a random number following a Landau distribution with location parameter mu and scale paramet...
Definition: TRandom.cxx:369
const Double_t sigma
Double_t x[n]
Definition: legend1.C:17
Double_t Landau(Double_t x, Double_t mpv=0, Double_t sigma=1, Bool_t norm=kFALSE)
The LANDAU function.
Definition: TMath.cxx:469