Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/RooConstVar.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  *    File: $Id: RooConstVar.h,v 1.9 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_CONST_VAR
0017 #define ROO_CONST_VAR
0018 
0019 #include "RooAbsReal.h"
0020 
0021 class RooArgSet ;
0022 
0023 class RooConstVar final : public RooAbsReal {
0024 public:
0025   // Constructors, assignment etc
0026   RooConstVar() { }
0027   RooConstVar(const char *name, const char *title, double value);
0028   RooConstVar(const RooConstVar& other, const char* name=nullptr);
0029   TObject* clone(const char* newname) const override { return new RooConstVar(*this,newname); }
0030 
0031   /// Return (constant) value.
0032   double getValV(const RooArgSet*) const override {
0033     return _value;
0034   }
0035 
0036   void writeToStream(std::ostream& os, bool compact) const override ;
0037 
0038   /// Returns false, as the value of the constant doesn't depend on other objects.
0039   bool isDerived() const override {
0040     return false;
0041   }
0042 
0043   /// Change the value of this constant.
0044   /// On purpose, this is not `setVal`, as this could be confused with the `setVal`
0045   /// that is available for variables. Constants, however, should remain mostly constant.
0046   /// This function is e.g. useful when reading the constant from a file.
0047   void changeVal(double value) {
0048     _value = value;
0049   }
0050 
0051   void translate(RooFit::Detail::CodeSquashContext &ctx) const override;
0052 
0053 protected:
0054 
0055   double evaluate() const override {
0056     return _value;
0057   }
0058 
0059   ClassDefOverride(RooConstVar,2) // Constant RooAbsReal value object
0060 };
0061 
0062 #endif