Logo ROOT   6.10/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 /** \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 
33 void TProofLimitsFinder::AutoBinFunc(TString& key,
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
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
TSocket * GetSocket() const
Definition: TProofServ.h:257
Basic string class.
Definition: TString.h:129
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
void Info(const char *location, const char *msgfmt,...)
void Error(const char *location, const char *msgfmt,...)
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
float xmax
Definition: THbookFile.cxx:93
const Bool_t kFALSE
Definition: RtypesCore.h:92
UInt_t What() const
Definition: TMessage.h:74
#define ClassImp(name)
Definition: Rtypes.h:336
double Double_t
Definition: RtypesCore.h:55
static RooMathCoreReg dummy
The TH1 histogram class.
Definition: TH1.h:56
Class to find axis limits and synchronize them between workers.
typedef void((*Func_t)())
R__EXTERN TProofServ * gProofServ
Definition: TProofServ.h:347
const Bool_t kTRUE
Definition: RtypesCore.h:91
virtual Int_t FindGoodLimits(TH1 *h, Axis_t xmin, Axis_t xmax)
Find good limits.