RooAbsHiddenReal.cxx

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  * @(#)root/roofitcore:$Id: RooAbsHiddenReal.cxx 24247 2008-06-12 14:54:32Z 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 // RooAbsHiddenReal is a base class for objects that want to hide
00021 // their return value from interactive use, e.g. for implementations
00022 // of parameter unblinding functions. This class overrides all
00023 // printing methods with versions that do not reveal the objects value
00024 // and it has a protected version of getVal()
00025 // END_HTML
00026 //
00027 //
00028 
00029 #include "RooFit.h"
00030 
00031 #include "Riostream.h"
00032 
00033 #include "RooArgSet.h"
00034 #include "RooArgSet.h"
00035 #include "RooAbsHiddenReal.h"
00036 #include "RooCategory.h"
00037 #include "RooMsgService.h"
00038 
00039 ClassImp(RooAbsHiddenReal)
00040 ;
00041 
00042 RooCategory* RooAbsHiddenReal::_dummyBlindState = 0;
00043 
00044 
00045 //_____________________________________________________________________________
00046 RooAbsHiddenReal::RooAbsHiddenReal(const char *name, const char *title, const char* unit)
00047   : RooAbsReal(name,title,unit),
00048     _state("state","Blinding state",this,dummyBlindState())
00049 {  
00050   // Constructor
00051 }
00052 
00053 
00054 
00055 //_____________________________________________________________________________
00056 RooAbsHiddenReal::RooAbsHiddenReal(const char *name, const char *title, RooAbsCategory& blindState, const char* unit)
00057   : RooAbsReal(name,title,unit),
00058   _state("state","Blinding state",this,blindState)
00059 {  
00060   // Constructor
00061 }
00062 
00063 
00064 
00065 //_____________________________________________________________________________
00066 RooAbsHiddenReal::RooAbsHiddenReal(const RooAbsHiddenReal& other, const char* name) : 
00067   RooAbsReal(other, name),
00068   _state("state",this,other._state)
00069 {
00070   // Copy constructor
00071 }
00072 
00073 
00074 
00075 //_____________________________________________________________________________
00076 RooAbsHiddenReal::~RooAbsHiddenReal() 
00077 {
00078   // Destructor 
00079 }
00080 
00081 
00082 
00083 //_____________________________________________________________________________
00084 void RooAbsHiddenReal::printValue(ostream& os) const
00085 {
00086   // Special version of printValue that doesn't reveal the objects value
00087 
00088   os << "(hidden)" ;
00089 } 
00090 
00091 
00092 
00093 //_____________________________________________________________________________
00094 Bool_t RooAbsHiddenReal::readFromStream(istream& is, Bool_t compact, Bool_t verbose)
00095 {
00096   // Special version of readFromStream that disallows reading from stream
00097 
00098   if (isHidden()) {
00099     // No-op version of readFromStream 
00100     coutE(InputArguments) << "RooAbsHiddenReal::readFromStream(" << GetName() << "): not allowed" << endl ;
00101     return kTRUE ;
00102   } else {
00103     return readFromStream(is,compact,verbose) ;
00104   }
00105 }
00106 
00107 
00108 
00109 //_____________________________________________________________________________
00110 void RooAbsHiddenReal::writeToStream(ostream& os, Bool_t compact) const
00111 {
00112   // Special version of writeToStream that disallows reading from stream
00113 
00114   if (isHidden()) {
00115     // No-op version of writeToStream 
00116     coutE(InputArguments) << "RooAbsHiddenReal::writeToStream(" << GetName() << "): not allowed" << endl ;
00117   } else {
00118     RooAbsReal::writeToStream(os,compact) ;
00119   }
00120 }
00121 
00122 
00123 
00124 //_____________________________________________________________________________
00125 RooAbsCategory& RooAbsHiddenReal::dummyBlindState() const 
00126 {
00127   // Return reference to internal dummy RooCategory implementation
00128   // blinding state switch
00129 
00130   if (!_dummyBlindState) {
00131     _dummyBlindState = new RooCategory("dummyBlindState","dummy blinding state") ;
00132     _dummyBlindState->defineType("Normal",0) ;
00133     _dummyBlindState->defineType("Blind",1) ;
00134     _dummyBlindState->setIndex(1) ;
00135   }
00136   return *_dummyBlindState ;
00137 }
00138 
00139 

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