RooLinTransBinning.cxx

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  * @(#)root/roofitcore:$Id: RooLinTransBinning.cxx 24278 2008-06-15 15:21:16Z 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 // RooLinTransBinning is a special binning implementation for RooLinearVar
00021 // that transforms the binning of the RooLinearVar input variable in the same
00022 // way that RooLinearVar does
00023 // END_HTML
00024 //
00025 
00026 
00027 #include "RooFit.h"
00028 
00029 #include "RooLinTransBinning.h"
00030 #include "RooLinTransBinning.h"
00031 
00032 ClassImp(RooLinTransBinning) 
00033 ;
00034 
00035 
00036 
00037 //_____________________________________________________________________________
00038 RooLinTransBinning::RooLinTransBinning(const RooAbsBinning& input, Double_t slope, Double_t offset, const char* name) :
00039   RooAbsBinning(name),
00040   _array(0) 
00041 {
00042   // Constructor with a given input binning and the slope and offset to be applied to
00043   // construct the linear transformation
00044 
00045   updateInput(input,slope,offset) ;
00046 }
00047 
00048 
00049 
00050 //_____________________________________________________________________________
00051 RooLinTransBinning::RooLinTransBinning(const RooLinTransBinning& other, const char* name) :
00052   RooAbsBinning(name),
00053   _array(0)
00054 {
00055   // Copy constructor
00056 
00057   _input = other._input ;
00058   _slope = other._slope ;
00059   _offset = other._offset ;    
00060 }
00061 
00062 
00063 
00064 //_____________________________________________________________________________
00065 RooLinTransBinning::~RooLinTransBinning() 
00066 {
00067   // Destructor 
00068 
00069   if (_array) delete[] _array ;
00070 }
00071 
00072 
00073 
00074 //_____________________________________________________________________________
00075 void RooLinTransBinning::setRange(Double_t /*xlo*/, Double_t /*xhi*/) 
00076 {
00077 
00078   // Change limits -- not implemented
00079 }
00080 
00081 
00082 //_____________________________________________________________________________
00083 Double_t* RooLinTransBinning::array() const 
00084 {
00085   // Return array of bin boundaries
00086 
00087   Int_t n = numBoundaries() ;
00088   // Return array with boundary values
00089   if (_array) delete[] _array ;
00090   _array = new Double_t[n] ;
00091 
00092   Double_t* inputArray = _input->array() ;
00093 
00094   Int_t i ;
00095   if (_slope>0) {
00096     for (i=0 ; i<n ; i++) {
00097       _array[i] = trans(inputArray[i]) ;
00098     }
00099   } else {
00100     for (i=0 ; i<n ; i++) {
00101       _array[i] = trans(inputArray[n-i-1]) ;
00102     }
00103   }
00104   return _array ;
00105 
00106 }
00107 
00108 
00109 
00110 //_____________________________________________________________________________
00111 void RooLinTransBinning::updateInput(const RooAbsBinning& input, Double_t slope, Double_t offset)
00112 {
00113   // Update the slope and offset parameters and the pointer to the input binning
00114 
00115   _input = (RooAbsBinning*) &input ;
00116   _slope = slope ;
00117   _offset = offset ;
00118 }
00119 

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