Re: SetXTitle

From: Selim Issever (selim.issever@desy.de)
Date: Mon Nov 15 1999 - 18:13:45 MET


Rene Brun wrote:
> 
> Hi Selim,
> 
> I cannot reproduce this problem. Which version are you using ?
> Could you send me a small & working macro to show your problem ?

In the macro it works fine. The problem arises, when I use a compiled
class-member-function, in which the axis titles are set. I've attached
StyledCanvas.C/H to this email. The memberfunction 'null' is the one of
concern.

I create mydict.C via:
mydict.C: 	StyledCanvas.H 
		rm -f mydict.C
		rootcint mydict.C -c StyledCanvas.H moLinkDef.h

I've also attached moLinkDef.h to this email.
When I compile all this and startup my own flavor of root:

==================================================================
[hb-sun02] ~/public/analysis/7of9 $ BorgTransmitter 

Neural tranceiver turned on.
Connecting to the collective!

Cube OS: Solaris_sparc
Listen to your drone: 7 of 9.
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   2.21/05  10 February 1999   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

CINT/ROOT C/C++ Interpreter version 5.13.88, Jan 17 1999
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.

        A softspoken, smug voice in your brain:
        "Welcome to the collective.
         You will be assigned a name: 43 of 81."

subspace transmission: StyledCanvas *a = new StyledCanvas();
subspace transmission: a->null(0,1,0,1)
=====================================================================

and again, I get an "X" at the y axis and nothing at the x axis,..
I hope to be not too much confusing,... 

Thanks a lot and Best Wishes,
Selim


 
> Rene Brun
> 
> Selim Issever wrote:
> >
> > Hi,..
> >
> > I've the following following member function of a class called moBase:
> >
> > void moBase::test() {
> >   cout << "Test start:" << endl;
> >
> >   static TH2C* a = 0;
> >   if(a) delete a;
> >
> >   a = new TH2C("Kirk", "", 250, 0, 2, 250, 0, 3);
> >   a->SetXTitle("X");
> >   a->SetYTitle("Y");
> >   a->Draw();
> >
> >   cout << "Test is successful!" << endl;
> > }
> >
> > I compile the whole thing,
> > create my own rootapplication,
> > start it,
> > in cint create an object m of type mo (inherits from moBase) and then:
> > m.test()
> >
> > This gives me a histogram with the right sizes but with no x axis title and
> > with "X" as y axis title.
> >
> > Strange enough: if I now type in
> > Kirk->SetXTitle("aaa")
> > I get, what I want: a title at the x axis.
> >
> > If I play all the game in mo::test() from within cint, it works too?!?,.. Do
> > you think, there is something strange with my objects? or is it real? do you
> > know, how I can get what I want to get?
> >
> > Thanks a lot,
> > Selim
> >
> > --
> > Selim Issever | Tel: 040 8998-2843    +---- I'd horsewhip you --------
> > DESY-F15      | Fax: 040 8998-4033    +--------- if I had a horse. ---
> > Notkestr. 85  | selim.issever@desy.de +--------------- Groucho Marx --
> > 22603 Hamburg/Germany   |  http://www.physik.uni-dortmund.de/~issevers

-- 
Selim Issever | Tel: 040 8998-2843    +- It is nothing; they are only -
DESY-F15      | Fax: 040 8998-4033    +- killing my husband.      -----
Notkestr. 85  | selim.issever@desy.de +----- Portuguese Proverb -------
22603 Hamburg/Germany   |  http://www.physik.uni-dortmund.de/~issevers
-----------------------------------------------------------------------
This signature was automatically generated with Signify v1.04.
For this and other cool products, check out http://www.verisim.com/

#include "StyledCanvas.H"
#include <iostream.h>
#include <stdlib.h>

extern  TVirtualPad *gPad;

// ===============================================================================
// ===============================================================================
// ===============================================================================
StyledCanvas::StyledCanvas() {
  pH = 0;
  // init the rest
  pCanvas     = new TCanvas("pCanvas", "Believe it!", 0, 0, 825, 500);
  pCanvas->Draw();  
  pCanvas->Update();
  pCanvas->cd();
}
void StyledCanvas::null(Axis_t xmin, Axis_t xmax, Axis_t ymin, Axis_t ymax, char* title="") {
  if ( pH ) {
    delete pH;
  }
  pH = new TH2C("Kirk", title, 250, xmin, xmax, 250, ymin, ymax);   
  pH->SetXTitle("X");
  pH->SetYTitle("Y");
  pH->Draw();  
  pCanvas->Update();  
}


#ifndef StyledCanvas_H
#define StyledCanvas_H

#include "TCanvas.h"
#include "TNtuple.h"
#include "TTree.h"
#include "TPaveLabel.h"
#include "TGraph.h"
#include "TPad.h"
#include "TH2.h"

#include "Date.H"

class StyledCanvas {
public:
  StyledCanvas();
  void null       (float xmin, float xmax, float ymin, float ymax, char *title="");
private:
  // === main stuff
  TCanvas    *pCanvas;
  TH2C       *pH;
};

#endif


#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ enum OvStyle;

#pragma link C++ class mo;
#pragma link C++ class moBase;
#pragma link C++ class StyledCanvas;
#pragma link C++ class DateRangeList;
#pragma link C++ class DateRange;
#pragma link C++ class Date;

#endif



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:42 MET