ROOT  6.06/09
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 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TProofLimitsFinder //
15 // //
16 // Class to find nice axis limits and synchronize them between workers //
17 // //
18 //////////////////////////////////////////////////////////////////////////
19 
20 #include "TProofLimitsFinder.h"
21 #include "TProofServ.h"
22 #include "TSocket.h"
23 #include "TH1.h"
24 #include "TMessage.h"
25 #include "TProofDebug.h"
26 #include "TError.h"
27 
29 
30 ////////////////////////////////////////////////////////////////////////////////
31 /// Get bining information. Send current min and max and receive common
32 /// min max in return.
33 
34 void TProofLimitsFinder::AutoBinFunc(TString& key,
37  Double_t& zmin, Double_t& zmax)
38 {
39  if (!gProofServ) return;
40 
43 
44  PDB(kGlobal, 2) {
45  ::Info("TProofLimitsFinder::AutoBinFunc",
46  "Sending %f, %f, %f, %f, %f, %f", xmin, xmax, ymin, ymax, zmin, zmax);
47  }
48  mess << key << xmin << xmax << ymin << ymax << zmin << zmax;
49 
50  s->Send(mess);
51 
52  Bool_t notdone = kTRUE;
53  while (notdone) {
54  TMessage *answ;
55  if (s->Recv(answ) <= 0 || !answ)
56  return;
57 
58  Int_t what = answ->What();
59  if (what == kPROOF_AUTOBIN) {
60  (*answ) >> key >> xmin >> xmax >> ymin >> ymax >> zmin >> zmax;
61  notdone = kFALSE;
62  } else {
64  if (xrc == -1) {
65  ::Error("TProofLimitsFinder::AutoBinFunc", "command %d cannot be executed while processing", what);
66  } else if (xrc == -2) {
67  ::Error("TProofLimitsFinder::AutoBinFunc", "unknown command %d ! Protocol error?", what);
68  }
69  }
70  delete answ;
71  }
72 }
73 
74 ////////////////////////////////////////////////////////////////////////////////
75 /// Find good limits
76 
78 {
79  Double_t dummy = 0;
80 
81  TString key = h->GetName();
82  AutoBinFunc(key, xmin, xmax, dummy, dummy, dummy, dummy);
83 
84  return THLimitsFinder::FindGoodLimits( h, xmin, xmax);
85 }
86 
87 
88 ////////////////////////////////////////////////////////////////////////////////
89 /// Find good limits
90 
92 {
93  Double_t dummy = 0;
94 
95  TString key = h->GetName();
96  AutoBinFunc(key, xmin, xmax, ymin, ymax, dummy, dummy);
97 
98  return THLimitsFinder::FindGoodLimits( h, xmin, xmax, ymin, ymax);
99 }
100 
101 
102 ////////////////////////////////////////////////////////////////////////////////
103 /// Find good limits
104 
106 {
107  TString key = h->GetName();
108  AutoBinFunc(key, xmin, xmax, ymin, ymax, zmin, zmax);
109 
110  return THLimitsFinder::FindGoodLimits( h, xmin, xmax, ymin, ymax, zmin, zmax);
111 }
float xmin
Definition: THbookFile.cxx:93
float ymin
Definition: THbookFile.cxx:93
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
Definition: TSocket.cxx:520
double Axis_t
Definition: RtypesCore.h:72
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
Definition: TSocket.cxx:818
TH1 * h
Definition: legend2.C:5
ClassImp(TProofLimitsFinder) void TProofLimitsFinder
Get bining information.
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
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:58
void Info(const char *location, const char *msgfmt,...)
void Error(const char *location, const char *msgfmt,...)
static const char * what
Definition: stlLoader.cc:6
TSocket * GetSocket() const
Definition: TProofServ.h:269
float ymax
Definition: THbookFile.cxx:93
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
float xmax
Definition: THbookFile.cxx:93
double Double_t
Definition: RtypesCore.h:55
static RooMathCoreReg dummy
The TH1 histogram class.
Definition: TH1.h:80
UInt_t What() const
Definition: TMessage.h:80
typedef void((*Func_t)())
R__EXTERN TProofServ * gProofServ
Definition: TProofServ.h:359
const Bool_t kTRUE
Definition: Rtypes.h:91
static void AutoBinFunc(TString &key, Double_t &xmin, Double_t &xmax, Double_t &ymin, Double_t &ymax, Double_t &zmin, Double_t &zmax)
virtual Int_t FindGoodLimits(TH1 *h, Axis_t xmin, Axis_t xmax)
Find good limits.