RooBreitWigner.cxx

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitModels                                                     *
00004  * @(#)root/roofit:$Id: RooBreitWigner.cxx 24286 2008-06-16 15:47:04Z wouter $
00005  * Authors:                                                                  *
00006  *   AS, Abi Soffer, Colorado State University, abi@slac.stanford.edu        *
00007  *   TS, Thomas Schietinger, SLAC, schieti@slac.stanford.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          Colorado State University                        *
00011  *                          and Stanford University. All rights reserved.    *
00012  *                                                                           *
00013  * Redistribution and use in source and binary forms,                        *
00014  * with or without modification, are permitted according to the terms        *
00015  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
00016  *****************************************************************************/
00017 
00018 //////////////////////////////////////////////////////////////////////////////
00019 //
00020 // BEGIN_HTML
00021 // Class RooBreitWigner is a RooAbsPdf implementation 
00022 // that models a non-relativistic Breit-Wigner shape
00023 // END_HTML
00024 //
00025 
00026 
00027 #include "RooFit.h"
00028 
00029 #include "Riostream.h"
00030 #include "Riostream.h"
00031 #include <math.h>
00032 
00033 #include "RooBreitWigner.h"
00034 #include "RooAbsReal.h"
00035 #include "RooRealVar.h"
00036 // #include "RooFitTools/RooRandom.h"
00037 
00038 ClassImp(RooBreitWigner)
00039 
00040 
00041 //_____________________________________________________________________________
00042 RooBreitWigner::RooBreitWigner(const char *name, const char *title,
00043                          RooAbsReal& _x, RooAbsReal& _mean,
00044                          RooAbsReal& _width) :
00045   RooAbsPdf(name,title),
00046   x("x","Dependent",this,_x),
00047   mean("mean","Mean",this,_mean),
00048   width("width","Width",this,_width)
00049 {
00050 }
00051 
00052 
00053 
00054 //_____________________________________________________________________________
00055 RooBreitWigner::RooBreitWigner(const RooBreitWigner& other, const char* name) : 
00056   RooAbsPdf(other,name), x("x",this,other.x), mean("mean",this,other.mean),
00057   width("width",this,other.width)
00058 {
00059 }
00060 
00061 
00062 
00063 //_____________________________________________________________________________
00064 Double_t RooBreitWigner::evaluate() const
00065 {
00066   Double_t arg= x - mean;  
00067   return 1. / (arg*arg + 0.25*width*width);
00068 }
00069 
00070 
00071 
00072 //_____________________________________________________________________________
00073 Int_t RooBreitWigner::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* /*rangeName*/) const 
00074 {
00075   if (matchArgs(allVars,analVars,x)) return 1 ;
00076   return 0 ;
00077 }
00078 
00079 
00080 
00081 //_____________________________________________________________________________
00082 Double_t RooBreitWigner::analyticalIntegral(Int_t code, const char* rangeName) const 
00083 {
00084   switch(code) {
00085   case 1: 
00086     {
00087       Double_t c = 2./width;
00088       return c*(atan(c*(x.max(rangeName)-mean)) - atan(c*(x.min(rangeName)-mean)));
00089     }
00090   }
00091   
00092   assert(0) ;
00093   return 0 ;
00094 }
00095 

Generated on Tue Jul 5 14:54:34 2011 for ROOT_528-00b_version by  doxygen 1.5.1