Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/RooRealMPFE.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: RooRealMPFE.h,v 1.7 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_REAL_MPFE
0017 #define ROO_REAL_MPFE
0018 
0019 #include "RooAbsReal.h"
0020 #include "RooRealProxy.h"
0021 #include "RooListProxy.h"
0022 #include "RooArgList.h"
0023 #include "TStopwatch.h"
0024 #include <vector>
0025 
0026 class RooArgSet ;
0027 namespace RooFit { class BidirMMapPipe; }
0028 
0029 class RooRealMPFE : public RooAbsReal {
0030 public:
0031   // Constructors, assignment etc
0032   RooRealMPFE(const char *name, const char *title, RooAbsReal& arg, bool calcInline=false) ;
0033   RooRealMPFE(const RooRealMPFE& other, const char* name=nullptr);
0034   TObject* clone(const char* newname) const override { return new RooRealMPFE(*this,newname); }
0035   ~RooRealMPFE() override;
0036 
0037   void calculate() const ;
0038   double getValV(const RooArgSet* nset=nullptr) const override ;
0039   void standby() ;
0040 
0041   void setVerbose(bool clientFlag=true, bool serverFlag=true) ;
0042 
0043   void applyNLLWeightSquared(bool flag) ;
0044 
0045   void enableOffsetting(bool flag) override ;
0046 
0047   void followAsSlave(RooRealMPFE& master) { _updateMaster = &master ; }
0048 
0049   RooAbsReal & arg() const { return *_arg; }
0050 
0051   protected:
0052 
0053   // Function evaluation
0054   double evaluate() const override ;
0055   friend class RooAbsTestStatistic ;
0056   void constOptimizeTestStatistic(ConstOpCode opcode, bool doAlsoTracking=true) override ;
0057   virtual double getCarry() const;
0058 
0059   enum State { Initialize,Client,Server,Inline } ;
0060   State _state ;
0061 
0062   enum Message { SendReal=0, SendCat, Calculate, Retrieve, ReturnValue, Terminate,
0063        ConstOpt, Verbose, LogEvalError, ApplyNLLW2, EnableOffset, CalculateNoOffset } ;
0064 
0065   void initialize() ;
0066   void initVars() ;
0067   void serverLoop() ;
0068 
0069   void doApplyNLLW2(bool flag) ;
0070 
0071   RooRealProxy _arg ; ///< Function to calculate in parallel process
0072   RooListProxy _vars ;   ///< Variables
0073   RooArgList _saveVars ;  ///< Copy of variables
0074   mutable bool _calcInProgress ;
0075   bool _verboseClient ;
0076   bool _verboseServer ;
0077   bool _inlineMode ;
0078   mutable bool _forceCalc ;
0079   mutable RooAbsReal::ErrorLoggingMode _remoteEvalErrorLoggingState ;
0080 
0081   RooFit::BidirMMapPipe *_pipe; ///<! connection to child
0082 
0083   mutable std::vector<bool> _valueChanged ; ///<! Flags if variable needs update on server-side
0084   mutable std::vector<bool> _constChanged ; ///<! Flags if variable needs update on server-side
0085   RooRealMPFE* _updateMaster ; ///<! Update master
0086   mutable bool _retrieveDispatched ; ///<!
0087   mutable double _evalCarry; ///<!
0088 
0089   ClassDefOverride(RooRealMPFE,2) // Multi-process front-end for parallel calculation of a real valued function
0090 };
0091 
0092 #endif