Logo ROOT   6.14/05
Reference Guide
RooLinTransBinning.cxx
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * @(#)root/roofitcore:$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 RooLinTransBinning.cxx
19 \class RooLinTransBinning
20 \ingroup Roofitcore
21 
22 RooLinTransBinning is a special binning implementation for RooLinearVar
23 that transforms the binning of the RooLinearVar input variable in the same
24 way that RooLinearVar does
25 **/
26 
27 
28 #include "RooFit.h"
29 
30 #include "RooLinTransBinning.h"
31 #include "RooLinTransBinning.h"
32 
33 using namespace std;
34 
36 ;
37 
38 
39 
40 ////////////////////////////////////////////////////////////////////////////////
41 /// Constructor with a given input binning and the slope and offset to be applied to
42 /// construct the linear transformation
43 
44 RooLinTransBinning::RooLinTransBinning(const RooAbsBinning& input, Double_t slope, Double_t offset, const char* name) :
45  RooAbsBinning(name),
46  _array(0)
47 {
48  updateInput(input,slope,offset) ;
49 }
50 
51 
52 
53 ////////////////////////////////////////////////////////////////////////////////
54 /// Copy constructor
55 
57  RooAbsBinning(name),
58  _array(0)
59 {
60  _input = other._input ;
61  _slope = other._slope ;
62  _offset = other._offset ;
63 }
64 
65 
66 
67 ////////////////////////////////////////////////////////////////////////////////
68 /// Destructor
69 
71 {
72  if (_array) delete[] _array ;
73 }
74 
75 
76 
77 ////////////////////////////////////////////////////////////////////////////////
78 
80 {
81  // Change limits -- not implemented
82 }
83 
84 
85 ////////////////////////////////////////////////////////////////////////////////
86 /// Return array of bin boundaries
87 
89 {
90  Int_t n = numBoundaries() ;
91  // Return array with boundary values
92  if (_array) delete[] _array ;
93  _array = new Double_t[n] ;
94 
95  Double_t* inputArray = _input->array() ;
96 
97  Int_t i ;
98  if (_slope>0) {
99  for (i=0 ; i<n ; i++) {
100  _array[i] = trans(inputArray[i]) ;
101  }
102  } else {
103  for (i=0 ; i<n ; i++) {
104  _array[i] = trans(inputArray[n-i-1]) ;
105  }
106  }
107  return _array ;
108 
109 }
110 
111 
112 
113 ////////////////////////////////////////////////////////////////////////////////
114 /// Update the slope and offset parameters and the pointer to the input binning
115 
117 {
118  _input = (RooAbsBinning*) &input ;
119  _slope = slope ;
120  _offset = offset ;
121 }
122 
virtual Double_t * array() const
Return array of bin boundaries.
void updateInput(const RooAbsBinning &input, Double_t slope=1.0, Double_t offset=0.0)
Update the slope and offset parameters and the pointer to the input binning.
int Int_t
Definition: RtypesCore.h:41
STL namespace.
RooAbsBinning * _input
RooLinTransBinning(const char *name=0)
virtual ~RooLinTransBinning()
Destructor.
Double_t trans(Double_t x) const
RooLinTransBinning is a special binning implementation for RooLinearVar that transforms the binning o...
virtual Int_t numBoundaries() const
RooAbsBinning is the abstract base class for RooRealVar binning definitions This class defines the in...
Definition: RooAbsBinning.h:26
#define ClassImp(name)
Definition: Rtypes.h:359
double Double_t
Definition: RtypesCore.h:55
virtual void setRange(Double_t xlo, Double_t xhi)
virtual Double_t * array() const =0
const Int_t n
Definition: legend1.C:16
char name[80]
Definition: TGX11.cxx:109