Logo ROOT   6.07/09
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 /**
18 \file RooLandau.cxx
19 \class RooLandau
20 \ingroup Roofit
21 
22 Landau Distribution p.d.f
23 **/
24 
25 #include "TMath.h"
26 #include "RooFit.h"
27 
28 #include "RooLandau.h"
29 #include "RooLandau.h"
30 #include "RooRandom.h"
31 
32 #include "TError.h"
33 
34 using namespace std;
35 
37 
38 
39 ////////////////////////////////////////////////////////////////////////////////
40 
41 RooLandau::RooLandau(const char *name, const char *title, RooAbsReal& _x, RooAbsReal& _mean, RooAbsReal& _sigma) :
42  RooAbsPdf(name,title),
43  x("x","Dependent",this,_x),
44  mean("mean","Mean",this,_mean),
45  sigma("sigma","Width",this,_sigma)
46 {
47 }
48 
49 
50 ////////////////////////////////////////////////////////////////////////////////
51 
52 RooLandau::RooLandau(const RooLandau& other, const char* name) :
53  RooAbsPdf(other,name),
54  x("x",this,other.x),
55  mean("mean",this,other.mean),
56  sigma("sigma",this,other.sigma)
57 {
58 }
59 
60 
61 ////////////////////////////////////////////////////////////////////////////////
62 
64 {
65  return TMath::Landau(x, mean, sigma);
66 }
67 
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 
71 Int_t RooLandau::getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, Bool_t /*staticInitOK*/) const
72 {
73  if (matchArgs(directVars,generateVars,x)) return 1 ;
74  return 0 ;
75 }
76 
77 
78 ////////////////////////////////////////////////////////////////////////////////
79 
81 {
82  R__ASSERT(code==1) ;
83  Double_t xgen ;
84  while(1) {
86  if (xgen<x.max() && xgen>x.min()) {
87  x = xgen ;
88  break;
89  }
90  }
91  return;
92 }
93 
94 
Double_t Landau(Double_t x, Double_t mpv=0, Double_t sigma=1, Bool_t norm=kFALSE)
The LANDAU function.
Definition: TMath.cxx:472
RooLandau()
Definition: RooLandau.h:26
#define R__ASSERT(e)
Definition: TError.h:98
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
STL namespace.
Landau Distribution p.d.f.
Definition: RooLandau.h:24
RooRealProxy mean
Definition: RooLandau.h:38
Double_t x[n]
Definition: legend1.C:17
void generateEvent(Int_t code)
Interface for generation of anan event using the algorithm corresponding to the specified code...
Definition: RooLandau.cxx:80
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
Definition: RooRandom.cxx:54
const Double_t sigma
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:71
Double_t Mean(Long64_t n, const T *a, const Double_t *w=0)
Definition: TMath.h:811
RooRealProxy x
Definition: RooLandau.h:37
#define ClassImp(name)
Definition: Rtypes.h:279
double Double_t
Definition: RtypesCore.h:55
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
Double_t min(const char *rname=0) const
Definition: RooRealProxy.h:56
Bool_t matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
Double_t evaluate() const
Definition: RooLandau.cxx:63
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:340
Double_t max(const char *rname=0) const
Definition: RooRealProxy.h:57
char name[80]
Definition: TGX11.cxx:109
RooRealProxy sigma
Definition: RooLandau.h:39