Logo ROOT   6.14/05
Reference Guide
TProofLimitsFinder.cxx
Go to the documentation of this file.
1 // @(#)root/proofplayer:$Id$
2 // Author: Maarten Ballintijn 19/04/2002
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TProofLimitsFinder
13 \ingroup proofkernel
14 
15 Class to find axis limits and synchronize them between workers
16 
17 */
18 
19 #include "TProofLimitsFinder.h"
20 #include "TProofServ.h"
21 #include "TSocket.h"
22 #include "TH1.h"
23 #include "TMessage.h"
24 #include "TProofDebug.h"
25 #include "TError.h"
26 
28 
29 ////////////////////////////////////////////////////////////////////////////////
30 /// Get bining information. Send current min and max and receive common
31 /// min max in return.
32 
36  Double_t& zmin, Double_t& zmax)
37 {
38  if (!gProofServ) return;
39 
42 
43  PDB(kGlobal, 2) {
44  ::Info("TProofLimitsFinder::AutoBinFunc",
45  "Sending %f, %f, %f, %f, %f, %f", xmin, xmax, ymin, ymax, zmin, zmax);
46  }
47  mess << key << xmin << xmax << ymin << ymax << zmin << zmax;
48 
49  s->Send(mess);
50 
51  Bool_t notdone = kTRUE;
52  while (notdone) {
53  TMessage *answ;
54  if (s->Recv(answ) <= 0 || !answ)
55  return;
56 
57  Int_t what = answ->What();
58  if (what == kPROOF_AUTOBIN) {
59  (*answ) >> key >> xmin >> xmax >> ymin >> ymax >> zmin >> zmax;
60  notdone = kFALSE;
61  } else {
63  if (xrc == -1) {
64  ::Error("TProofLimitsFinder::AutoBinFunc", "command %d cannot be executed while processing", what);
65  } else if (xrc == -2) {
66  ::Error("TProofLimitsFinder::AutoBinFunc", "unknown command %d ! Protocol error?", what);
67  }
68  }
69  delete answ;
70  }
71 }
72 
73 ////////////////////////////////////////////////////////////////////////////////
74 /// Find good limits
75 
77 {
78  Double_t dummy = 0;
79 
80  TString key = h->GetName();
81  AutoBinFunc(key, xmin, xmax, dummy, dummy, dummy, dummy);
82 
83  return THLimitsFinder::FindGoodLimits( h, xmin, xmax);
84 }
85 
86 
87 ////////////////////////////////////////////////////////////////////////////////
88 /// Find good limits
89 
91 {
92  Double_t dummy = 0;
93 
94  TString key = h->GetName();
95  AutoBinFunc(key, xmin, xmax, ymin, ymax, dummy, dummy);
96 
97  return THLimitsFinder::FindGoodLimits( h, xmin, xmax, ymin, ymax);
98 }
99 
100 
101 ////////////////////////////////////////////////////////////////////////////////
102 /// Find good limits
103 
105 {
106  TString key = h->GetName();
107  AutoBinFunc(key, xmin, xmax, ymin, ymax, zmin, zmax);
108 
109  return THLimitsFinder::FindGoodLimits( h, xmin, xmax, ymin, ymax, zmin, zmax);
110 }
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
float xmin
Definition: THbookFile.cxx:93
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:854
float ymin
Definition: THbookFile.cxx:93
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
Definition: TSocket.cxx:527
double Axis_t
Definition: RtypesCore.h:72
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
Definition: TSocket.cxx:822
TSocket * GetSocket() const
Definition: TProofServ.h:257
Basic string class.
Definition: TString.h:131
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual Int_t HandleSocketInput(TMessage *mess, Bool_t all)
Process input coming from the client or from the master server.
virtual Int_t FindGoodLimits(TH1 *h, Double_t xmin, Double_t xmax)
Compute the best axis limits for the X axis.
#define PDB(mask, level)
Definition: TProofDebug.h:56
static void AutoBinFunc(TString &key, Double_t &xmin, Double_t &xmax, Double_t &ymin, Double_t &ymax, Double_t &zmin, Double_t &zmax)
Get bining information.
float ymax
Definition: THbookFile.cxx:93
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
float xmax
Definition: THbookFile.cxx:93
#define h(i)
Definition: RSha256.hxx:106
const Bool_t kFALSE
Definition: RtypesCore.h:88
UInt_t What() const
Definition: TMessage.h:74
#define ClassImp(name)
Definition: Rtypes.h:359
double Double_t
Definition: RtypesCore.h:55
static RooMathCoreReg dummy
The TH1 histogram class.
Definition: TH1.h:56
static constexpr double s
Class to find axis limits and synchronize them between workers.
R__EXTERN TProofServ * gProofServ
Definition: TProofServ.h:347
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual Int_t FindGoodLimits(TH1 *h, Axis_t xmin, Axis_t xmax)
Find good limits.