Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:21

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  *    File: $Id: RooErrorVar.h,v 1.16 2007/05/11 09:11:30 verkerke Exp $
0005  * Authors:                                                                  *
0006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
0007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
0008  *                                                                           *
0009  * Copyright (c) 2000-2005, Regents of the University of California          *
0010  *                          and Stanford University. All rights reserved.    *
0011  *                                                                           *
0012  * Redistribution and use in source and binary forms,                        *
0013  * with or without modification, are permitted according to the terms        *
0014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
0015  *****************************************************************************/
0016 #ifndef ROO_ERROR_VAR
0017 #define ROO_ERROR_VAR
0018 
0019 #include "RooAbsReal.h"
0020 #include "RooRealVar.h"
0021 #include "RooRealProxy.h"
0022 
0023 #include <list>
0024 #include <string>
0025 
0026 class RooVectorDataStore;
0027 
0028 class RooErrorVar : public RooAbsRealLValue {
0029 public:
0030   // Constructors, assignment etc.
0031   /// Default constructor
0032   inline RooErrorVar() {
0033   }
0034   RooErrorVar(const char *name, const char *title, const RooRealVar& input) ;
0035   RooErrorVar(const RooErrorVar& other, const char* name=nullptr);
0036   TObject* clone(const char* newname) const override { return new RooErrorVar(*this,newname); }
0037   ~RooErrorVar() override ;
0038 
0039   double getValV(const RooArgSet* set=nullptr) const override ;
0040 
0041   double evaluate() const override {
0042     // return error of input RooRealVar
0043     return ((RooRealVar&)_realVar.arg()).getError() ;
0044   }
0045 
0046   void setVal(double value) override {
0047     // Set error of input RooRealVar to value
0048     ((RooRealVar&)_realVar.arg()).setVal(value) ;
0049   }
0050 
0051   inline bool isFundamental() const override {
0052     // Return true as we implement a fundamental type of AbsArg that can be stored in a dataset
0053     return true ;
0054   }
0055 
0056   // I/O streaming interface (machine readable)
0057   bool readFromStream(std::istream& is, bool compact, bool verbose=false) override ;
0058   void writeToStream(std::ostream& os, bool compact) const override ;
0059 
0060   // Set/get finite fit range limits
0061   /// Set lower bound of default range to value
0062   inline void setMin(double value) {
0063     setMin(nullptr,value) ;
0064   }
0065   /// Set upper bound of default range to value
0066   inline void setMax(double value) {
0067     setMax(nullptr,value) ;
0068   }
0069   /// Set default ranges to [min,max]
0070   inline void setRange(double min, double max) {
0071     setRange(nullptr,min,max) ;
0072   }
0073   void setMin(const char* name, double value) ;
0074   void setMax(const char* name, double value) ;
0075   void setRange(const char* name, double min, double max) ;
0076 
0077   void setBins(Int_t nBins);
0078   void setBinning(const RooAbsBinning& binning, const char* name=nullptr) ;
0079   const RooAbsBinning& getBinning(const char* name=nullptr, bool verbose=true, bool createOnTheFly=false) const override ;
0080   RooAbsBinning& getBinning(const char* name=nullptr, bool verbose=true, bool createOnTheFly=false) override ;
0081   bool hasBinning(const char* name) const override ;
0082   std::list<std::string> getBinningNames() const override ;
0083 
0084   // Set infinite fit range limits
0085   void removeMin(const char* name=nullptr);
0086   void removeMax(const char* name=nullptr);
0087   void removeRange(const char* name=nullptr);
0088 
0089   using RooAbsRealLValue::operator= ;
0090   using RooAbsRealLValue::setVal ;
0091 
0092 protected:
0093 
0094   RooLinkedList _altBinning ;  ///<! Optional alternative ranges and binnings
0095 
0096   void syncCache(const RooArgSet* set=nullptr) override ;
0097 
0098   RooRealProxy _realVar ;   ///< RealVar with the original error
0099   std::unique_ptr<RooAbsBinning> _binning ; ///<! Pointer to default binning definition
0100 
0101   ClassDefOverride(RooErrorVar,1) // RooAbsRealLValue representation of an error of a RooRealVar
0102 };
0103 
0104 #endif