Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooRealMPFE.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooRealMPFE.h,v 1.7 2007/05/11 09:11:30 verkerke Exp $
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 #ifndef ROO_REAL_MPFE
17 #define ROO_REAL_MPFE
18 
19 #include "RooAbsReal.h"
20 #include "RooRealProxy.h"
21 #include "RooListProxy.h"
22 #include "RooArgList.h"
23 #include "RooMPSentinel.h"
24 #include "TStopwatch.h"
25 #include <vector>
26 
27 class RooArgSet ;
28 namespace RooFit { class BidirMMapPipe; }
29 
30 class RooRealMPFE : public RooAbsReal {
31 public:
32  // Constructors, assignment etc
33  RooRealMPFE(const char *name, const char *title, RooAbsReal& arg, Bool_t calcInline=kFALSE) ;
34  RooRealMPFE(const RooRealMPFE& other, const char* name=0);
35  virtual TObject* clone(const char* newname) const { return new RooRealMPFE(*this,newname); }
36  virtual ~RooRealMPFE();
37 
38  void calculate() const ;
39  virtual Double_t getValV(const RooArgSet* nset=0) const ;
40  void standby() ;
41 
42  void setVerbose(Bool_t clientFlag=kTRUE, Bool_t serverFlag=kTRUE) ;
43 
44  void applyNLLWeightSquared(Bool_t flag) ;
45 
46  void enableOffsetting(Bool_t flag) ;
47 
48  void followAsSlave(RooRealMPFE& master) { _updateMaster = &master ; }
49 
50  protected:
51 
52  // Function evaluation
53  virtual Double_t evaluate() const ;
54  friend class RooAbsTestStatistic ;
55  virtual void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTracking=kTRUE) ;
56  virtual Double_t getCarry() const;
57 
58  enum State { Initialize,Client,Server,Inline } ;
59  State _state ;
60 
61  enum Message { SendReal=0, SendCat, Calculate, Retrieve, ReturnValue, Terminate,
62  ConstOpt, Verbose, LogEvalError, ApplyNLLW2, EnableOffset, CalculateNoOffset } ;
63 
64  void initialize() ;
65  void initVars() ;
66  void serverLoop() ;
67 
68  void doApplyNLLW2(Bool_t flag) ;
69 
70  RooRealProxy _arg ; // Function to calculate in parallel process
71  RooListProxy _vars ; // Variables
72  RooArgList _saveVars ; // Copy of variables
73  mutable Bool_t _calcInProgress ;
74  Bool_t _verboseClient ;
75  Bool_t _verboseServer ;
76  Bool_t _inlineMode ;
77  mutable Bool_t _forceCalc ;
78  mutable RooAbsReal::ErrorLoggingMode _remoteEvalErrorLoggingState ;
79 
80  RooFit::BidirMMapPipe *_pipe; //! connection to child
81 
82  mutable std::vector<Bool_t> _valueChanged ; //! Flags if variable needs update on server-side
83  mutable std::vector<Bool_t> _constChanged ; //! Flags if variable needs update on server-side
84  RooRealMPFE* _updateMaster ; //! Update master
85  mutable Bool_t _retrieveDispatched ; //!
86  mutable Double_t _evalCarry; //!
87 
88  static RooMPSentinel _sentinel ;
89 
90  ClassDef(RooRealMPFE,2) // Multi-process front-end for parallel calculation of a real valued function
91 };
92 
93 #endif