ROOT logo
/*****************************************************************************
 * Project: RooFit                                                           *
 * Package: RooFitModels                                                     *
 * @(#)root/roofit:$Id$
 * Authors:                                                                  *
 *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
 *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
 *                                                                           *
 * 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
// Landau Distribution p.d.f
// END_HTML
//

#include "TMath.h"
#include "RooFit.h"

#include "RooLandau.h"
#include "RooLandau.h"
#include "RooRandom.h"

using namespace std;

ClassImp(RooLandau)


//_____________________________________________________________________________
RooLandau::RooLandau(const char *name, const char *title, RooAbsReal& _x, RooAbsReal& _mean, RooAbsReal& _sigma) :
  RooAbsPdf(name,title),
  x("x","Dependent",this,_x),
  mean("mean","Mean",this,_mean),
  sigma("sigma","Width",this,_sigma)
{
}
 

//_____________________________________________________________________________
RooLandau::RooLandau(const RooLandau& other, const char* name) : 
  RooAbsPdf(other,name),
  x("x",this,other.x),
  mean("mean",this,other.mean),
  sigma("sigma",this,other.sigma)
{
} 


//_____________________________________________________________________________
Double_t RooLandau::evaluate() const
{
  return TMath::Landau(x, mean, sigma);
}


//_____________________________________________________________________________
Int_t RooLandau::getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, Bool_t /*staticInitOK*/) const
{
  if (matchArgs(directVars,generateVars,x)) return 1 ;  
  return 0 ;
}


//_____________________________________________________________________________
void RooLandau::generateEvent(Int_t code)
{
  (void)code;
  assert(code==1) ;
  Double_t xgen ;
  while(1) {    
    xgen = RooRandom::randomGenerator()->Landau(mean,sigma);
    if (xgen<x.max() && xgen>x.min()) {
      x = xgen ;
      break;
    }
  }
  return;
}


 RooLandau.cxx:1
 RooLandau.cxx:2
 RooLandau.cxx:3
 RooLandau.cxx:4
 RooLandau.cxx:5
 RooLandau.cxx:6
 RooLandau.cxx:7
 RooLandau.cxx:8
 RooLandau.cxx:9
 RooLandau.cxx:10
 RooLandau.cxx:11
 RooLandau.cxx:12
 RooLandau.cxx:13
 RooLandau.cxx:14
 RooLandau.cxx:15
 RooLandau.cxx:16
 RooLandau.cxx:17
 RooLandau.cxx:18
 RooLandau.cxx:19
 RooLandau.cxx:20
 RooLandau.cxx:21
 RooLandau.cxx:22
 RooLandau.cxx:23
 RooLandau.cxx:24
 RooLandau.cxx:25
 RooLandau.cxx:26
 RooLandau.cxx:27
 RooLandau.cxx:28
 RooLandau.cxx:29
 RooLandau.cxx:30
 RooLandau.cxx:31
 RooLandau.cxx:32
 RooLandau.cxx:33
 RooLandau.cxx:34
 RooLandau.cxx:35
 RooLandau.cxx:36
 RooLandau.cxx:37
 RooLandau.cxx:38
 RooLandau.cxx:39
 RooLandau.cxx:40
 RooLandau.cxx:41
 RooLandau.cxx:42
 RooLandau.cxx:43
 RooLandau.cxx:44
 RooLandau.cxx:45
 RooLandau.cxx:46
 RooLandau.cxx:47
 RooLandau.cxx:48
 RooLandau.cxx:49
 RooLandau.cxx:50
 RooLandau.cxx:51
 RooLandau.cxx:52
 RooLandau.cxx:53
 RooLandau.cxx:54
 RooLandau.cxx:55
 RooLandau.cxx:56
 RooLandau.cxx:57
 RooLandau.cxx:58
 RooLandau.cxx:59
 RooLandau.cxx:60
 RooLandau.cxx:61
 RooLandau.cxx:62
 RooLandau.cxx:63
 RooLandau.cxx:64
 RooLandau.cxx:65
 RooLandau.cxx:66
 RooLandau.cxx:67
 RooLandau.cxx:68
 RooLandau.cxx:69
 RooLandau.cxx:70
 RooLandau.cxx:71
 RooLandau.cxx:72
 RooLandau.cxx:73
 RooLandau.cxx:74
 RooLandau.cxx:75
 RooLandau.cxx:76
 RooLandau.cxx:77
 RooLandau.cxx:78
 RooLandau.cxx:79
 RooLandau.cxx:80
 RooLandau.cxx:81
 RooLandau.cxx:82
 RooLandau.cxx:83
 RooLandau.cxx:84
 RooLandau.cxx:85
 RooLandau.cxx:86
 RooLandau.cxx:87