Hi Rene, thanks a lot you will implement this! Here is a small macro that creates a tree with a gaussian variable "a" and a bitfield "bits" which is a TBits(64). The selected bit depends on the value of "a" from -2 to 2. E.g: btest.Draw("a","bits.TestBitNumber(0)") will give you all entries <2. Cheers, Birger ------------------------------------------------------------- void makeBits() { TRandom r; gROOT->Reset(); Float_t a; TFile *foutP = new TFile("bittest.root","RECREATE"); TTree *outTreeP = new TTree("btest","Bits"); outTreeP->Branch("a",&a,"F"); TBits *myBits=new TBits(64); outTreeP->Branch("bits","TBits",&myBits); for(int i=0; i< 10000; i++){ float x; x=gRandom.Gaus(0,1); a=x; x=x*16+32; int j=(int) x; if(j<0) j=0; if(j>63) j=63; myBits.ResetAllBits(); myBits.SetBitNumber(j); outTreeP->Fill(); }; foutP->Write(); foutP->Close(); } ---------------------------------------------------------------- On Thu, 31 Oct 2002, Rene Brun wrote: > Hi Birger, > > On Thu, 31 Oct 2002, Birger Koblitz wrote: > > > 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]"); > > > > Yes, this was implicit in my previous mail. In the selection, mask > operations should also be supported, eg > mytree.Draw("somethingElse","myEventBits & 0x3ff"); > > > - Not only calling mytree.Draw("myEventBits"); should produce this > > histogram, but also clicking on the variable in the TBrowser. > > Yes, it is the same logic. TBrowser calls TTree::Draw. > > OK, we will implement this logic. Could you send me a small TTree file > (not HAT file) that we could use to test the new feature? > > Rene Brun > > > > > > 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 : Sat Jan 04 2003 - 23:51:16 MET