Hi Zhu,
On Wed, 2006-05-10 at 14:32 +0800, Zhu FengRong wrote:
> Hi,
>
> I can use the code to make a plot:
> int i=3,j=4;
> spt->Draw(Form("count[%d][%d]:time/6/24+1",i,j)
> but how to add the Option like this:
> count[i][j]>0
> in Form() function ?
Note, that `Form' uses a circular buffer, and return a pointer to that buffer. That means, that subsequent calls to Form will overwrite the buffer and previous results. Therefor, unless you know that the operation is atomic, you should copy the result of form to some store. E.g.,
TString var(Form("count[%d][%d]:time/6/24+1", i, j)); TString cut(Form("count[%d][%d]>0", i, j)); spt->Draw(var.Data(), cut.Data());
If you don't do this, but do the naiive
spt->Draw(Form("count[%d][%d]:time/6/24+1", i, j), Form("count[%d][%d]>0", i, j));
One of these calls to Form could overwrite the other call (note, in which order the arguments are evaluated is unspecified). The reason is, that Form looks something like
const char* Form(const char* f, ...)
{
static char[1024] buf; va_list ap; va_begin(ap,f); vsprintf(buf, f, ap); va_end(ap); return buf; }
Yours,
-- ___ | Christian Holm Christensen |_| | ------------------------------------------------------------- | | Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91 _| DK-2200 Copenhagen N Cell: (+45) 24 61 85 91 _| Denmark Office: (+45) 353 25 404 ____| Email: cholm_at_nbi.dk Web: www.nbi.dk/~cholm | |Received on Wed May 10 2006 - 10:23:07 MEST
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:58 MET