RooRangeBoolean.cxx

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  * @(#)root/roofitcore:$Id: RooRangeBoolean.cxx 34064 2010-06-22 15:05:19Z wouter $
00005  * Authors:                                                                  *
00006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
00007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          and Stanford University. All rights reserved.    *
00011  *                                                                           *
00012  * Redistribution and use in source and binary forms,                        *
00013  * with or without modification, are permitted according to the terms        *
00014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
00015  *****************************************************************************/
00016 
00017 //////////////////////////////////////////////////////////////////////////////
00018 //
00019 // BEGIN_HTML
00020 // RooRangeBoolean
00021 // END_HTML
00022 //
00023 
00024 #include "RooFit.h"
00025 
00026 #include "Riostream.h"
00027 #include "Riostream.h"
00028 #include <math.h>
00029 #include "TMath.h"
00030 
00031 #include "RooRangeBoolean.h"
00032 #include "RooAbsReal.h"
00033 #include "RooRealVar.h"
00034 #include "RooArgList.h"
00035 #include "RooMsgService.h"
00036 #include "TMath.h"
00037 
00038 ClassImp(RooRangeBoolean)
00039 ;
00040 
00041 
00042 //_____________________________________________________________________________
00043 RooRangeBoolean::RooRangeBoolean()
00044 {
00045   // Default constructor
00046 }
00047 
00048 
00049 //_____________________________________________________________________________
00050 RooRangeBoolean::RooRangeBoolean(const char* name, const char* title, RooAbsRealLValue& x, const char* rangeName) :
00051   RooAbsReal(name, title),
00052   _x("x", "Dependent", this, x),
00053   _rangeName(rangeName)
00054 {
00055 }
00056 
00057 
00058 
00059 //_____________________________________________________________________________
00060 RooRangeBoolean::RooRangeBoolean(const RooRangeBoolean& other, const char* name) :
00061   RooAbsReal(other, name), 
00062   _x("x", this, other._x),
00063   _rangeName(other._rangeName)
00064 {
00065   // Copy constructor
00066 }
00067 
00068 
00069 
00070 
00071 //_____________________________________________________________________________
00072 RooRangeBoolean::~RooRangeBoolean() 
00073 {
00074   // Destructor
00075 }
00076 
00077 
00078 
00079 
00080 //_____________________________________________________________________________
00081 Double_t RooRangeBoolean::evaluate() const 
00082 {
00083   // Return 1 if x is in range, zero otherwis
00084   Double_t xmin = ((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data()) ;
00085   Double_t xmax = ((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data()) ;
00086   
00087   Double_t ret = (_x >= xmin && _x < xmax) ? 1.0 : 0.0 ;
00088   return ret ;
00089 }
00090 
00091 
00092 
00093 //_____________________________________________________________________________
00094 std::list<Double_t>* RooRangeBoolean::plotSamplingHint(RooAbsRealLValue& obs, Double_t /*xlo*/, Double_t /*xhi*/) const 
00095 {
00096   if (string(obs.GetName())!=_x.arg().GetName()) {
00097     return 0 ;
00098   }
00099 
00100   list<Double_t>* hint = new list<Double_t> ;
00101   hint->push_back(((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data())-1e-6) ;
00102   hint->push_back(((RooAbsRealLValue&)_x.arg()).getMin(_rangeName.Data())+1e-6) ;
00103   hint->push_back(((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data())-1e-6) ;  
00104   hint->push_back(((RooAbsRealLValue&)_x.arg()).getMax(_rangeName.Data())+1e-6) ;  
00105   return hint ;
00106 }
00107 

Generated on Tue Jul 5 15:07:08 2011 for ROOT_528-00b_version by  doxygen 1.5.1