Hi, With ROOT in the CVS repository you can now draw TBits objects, with mytree.Draw("myEventBits") or with a click on an unsplit branch containing a TBits. This will automatically loop on all your events and filling an hitogram with as many channels as there are bits in TBits and where the bin count is incremented by 1 or the specified weight for each event where the corresponding bit is set. After much thought, we decided not to implement the operator[] for TBits because it introduced more confusion than it solved problem. In order for it to be useful, we need operator[int i] to return 0 or (i+1). We need (i+1) because the bits range from 0 to N and we need to be able to distinguish between bit[0] being on or off! If it returns (i+1), then the histogram drawn would be, very counter-intuitively, ranging from 1 to N+1, problem which we would have wanted to fix with yet another special case. So instead we implemented drawing a TBits objects by itself (code which could be extended to allow the special drawing of other classes). Please let us know if this is sufficient. Cheers, Philippe. -----Original Message----- From: Birger Koblitz [mailto:koblitz@mail.desy.de] Sent: Friday, January 17, 2003 3:26 AM To: Rene Brun Cc: Philippe Canal; Andreas Meyer; Ursula Berthon Subject: RE: [ROOT] Feature Requests for TBits (fwd) Hi, I would really like to have the operator [] in TBits because this allows very easy access to the individual bits and many other bitfield-implementations do it like this. Phillipes suggestion to return the bitnumber is a very good idea, since the return value would still be "true" or "false" as of the C-convention while providing the necessary information for drawing. Using simply the Draw method is also to be favoured because this is what beginners would try first. Cheers, Birger On Thu, 16 Jan 2003, Rene Brun wrote: > Hi Philippe, > > One could implement the operator [] in TBits, but after thinking, > it would be more appropriate to implement in TH1 > Int_t TH1::Fill(TBits &bits); > > This function could do the loop automatically. > > Rene > > On Thu, > 16 Jan 2003, Philippe Canal wrote: > > > Hi, > > > > > - you want to do mytree.Draw("myEventBits"); > > > This will automatically loop on all your events and filling > > > an hitogram with as many channels as there are bits in TBits > > > and where the bin count is incremented by 1 or the specified weight > > > for each event where the corresponding bit is set. > > > This requires a bit more work, but I agree would be a nice addition. > > > > If this really the intent, this is a departure from the usual semantic of > > the Draw command in regard to an array of values. Typically for array > > of values, the values themself are plotted (basically doing a series of > > h->Fill(arr[i]) ). In the above description, it seems that instead what is > > plotted is the 'index' of the value, i.e. if (arr[i]) h->Fill(i). > > > > This would complexify things because if you fill you want the formula to > > return the index value but I you use it in an expression you would want it > > to return 0 or 1. > > > > This 'problem' is more or so resolved if TBits.operator[UInt bitnumber] > > returns > > either 0 (disabled bit) or bitnumber (enabled bit). > > > > What do you think? > > Philippe. > > > > > > -----Original Message----- > > From: Rene Brun [mailto:brun@pcbrun.cern.ch] > > Sent: Monday, December 02, 2002 4:21 PM > > To: pcanal@fnal.gov > > Subject: Re: [ROOT] Feature Requests for TBits (fwd) > > > > > > Hi Philippe, > > > > About one month ago, there was an exchange of mails about TBits > > and TTreeFormula. I forgot to discuss this (my answer) with you > > this afternoon. Could you implement it? > > > > Rene > > > > ---------- Forwarded message ---------- > > Date: Thu, 31 Oct 2002 16:21:35 +0100 (MET) > > From: Birger Koblitz <koblitz@mail.desy.de> > > To: Rene Brun <brun@pcbrun.cern.ch> > > Cc: Rene.Brun@cern.ch, roottalk@pcroot.cern.ch, > > Andreas Meyer <ameyer@mail.desy.de>, > > Ursula Berthon <berthon@poly.in2p3.fr> > > Subject: Re: [ROOT] Feature Requests for TBits > > > > Hi Rene, > > > > yes, this is what we would like to have. Sorry for my poor description. > > Just two additional clarifications: > > - The operator [] should also work in selections: > > mytree.Draw("somethingElse","myEventBits[10]"); > > > > - Not only calling mytree.Draw("myEventBits"); should produce this > > histogram, but also clicking on the variable in the TBrowser. > > > > Cheers, > > Birger > > > > > > On Thu, 31 Oct 2002, Rene Brun wrote: > > > > > Hi Birger, > > > > > > Let see if I understand correctly your request. > > > > > > - you are requesting an operator [] to get the ith bit in a TBits > > > instead of calling the function TestBitNumber(). > > > That is quite easy to implement. I propose in this case > > > a read only operator []. > > > > > > - you want to do mytree.Draw("myEventBits"); > > > This will automatically loop on all your events and filling > > > an hitogram with as many channels as there are bits in TBits > > > and where the bin count is incremented by 1 or the specified weight > > > for each event where the corresponding bit is set. > > > This requires a bit more work, but I agree would be a nice addition. > > > > > > Rene > > > > > > On Thu, 31 Oct 2002, Birger Koblitz wrote: > > > > > > > Hi Rene, > > > > > > > > I think Ursula Berthon already talked to you about this at the > > > > Root-Meeting: > > > > > > > > Within H1 we would like to be able to put bit-arrays into our HAT tree > > > > which should be accessible using only a browser and which is used for > > > > event selection. Currently TBits allows to use the member function > > > > TestBitNumber() which is quite inconvenient if it comes to a selection > > of > > > > a large number of status bits e.g. to check if the quality of an event > > is > > > > good. This could easily go over the maximum selection length of a tree. > > > > Therefore it would be nice if one could simply use bits[i] to check the > > > > ith bit in TBits bits. In addition it would be nice if one could view a > > > > bit-array in a TBrowser. It should show a histogram over the bits and > > the > > > > number of entries per bit. Currently fAllBits shows the entries (in 2^i > > > > form) for the lowest byte. I think this is not really useful. > > > > > > > > In the moment we are using byte-arrays which at least allow to use the > > [] > > > > operator and allow us to inspect one bit with the TBrowser. H1 would be > > > > very intersted to move to TBits because currently the bit-arrays make up > > > > most of our HAT ntuple, we would be even willing to move to a newer > > > > root-version ;-) > > > > > > > > Cheers, > > > > Birger > > > > > > > > ------------------------------------------------------------ > > > > Birger Koblitz koblitz@mail.desy.de > > > > MPI für Physik > > > > c/o DESY-FH1 Tel: +49 40 8998-2431 > > > > Notkestr. 85 Fax: +49 40 8998-3094 > > > > D-22603 HAMBURG > > > > > > > > > > > > > > ------------------------------------------------------------ > > Birger Koblitz koblitz@mail.desy.de > > MPI für Physik > > c/o DESY-FH1 Tel: +49 40 8998-2431 > > Notkestr. 85 Fax: +49 40 8998-3094 > > D-22603 HAMBURG > > > > > > ------------------------------------------------------------ Birger Koblitz koblitz@mail.desy.de MPI für Physik c/o DESY-FH1 Tel: +49 40 8998-2431 Notkestr. 85 Fax: +49 40 8998-3094 D-22603 HAMBURG
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET