Hi Andy, You have a problem in the statement m_energy.e = i/10; Change it to m_energy.e = float(i)/10; and you will get the expected results Rene Brun Andy Haas wrote: > > TTree::Draw() seems to be doing funny things with decimal points in > its arguments, i.e. tree->Draw("e","e<.5") or tree->Draw("e","e>1.09"); > > Under NT 4.0 SP3, using the aug 28th version of 2.00/11, the following > macro produces erroneous results. It generates the numbers > 0,0.1,0.2,0.3, ... , 1000 and then selects them based on criteria. > Whenever a decimal point is involved in the criteria, the results are > wrong. For instance, it picks 10 numbers in the list less than .25, > where there are obviously only 3! > ///////////////////////////////////////////////////////////////////////// > { > gROOT->Reset(); > > t = new TTree("t","testtree"); > typedef struct {Float_t e;} energy; > energy m_energy; > t->Branch("energy",&m_energy,"e/F"); > > for (int i = 0; i<10000; i++) { > m_energy.e = i/10; > t->Fill(); > } > > t->Draw(">>list1","e<1000"); > list1->Print(); > > t->Draw(">>list2","e>999.2"); > list2->Print("all"); > > t->Draw(">>list3","e<100"); > list3->Print(); > > t->Draw(">>list4","e<10.24"); > list4->Print("all"); > > t->Draw(">>list17","e<10"); > list17->Print("all"); > > t->Draw(">>list5","e<1.234"); > list5->Print("all"); > > t->Draw(">>list6","e<1"); > list6->Print("all"); > > t->Draw(">>list7","e<.91"); > list7->Print("all"); > > t->Draw(">>list8","e<.25"); > list8->Print("all"); > > t->Draw(">>list9","e<.1"); > list9->Print("all"); > > t->Draw(">>list10","e<.01"); > list10->Print("all"); > > t->Draw(">>list11","e<.003"); > list11->Print("all"); > > t->Draw(">>list12","e<.0021"); > list12->Print("all"); > > t->Draw(">>list13","e<.0001"); > list13->Print("all"); > > t->Draw(">>list14","e<.00001"); > list14->Print("all"); > > t->Draw(">>list150","e<0.000001"); > list150->Print("all"); > > t->Draw(">>list151","e < 0.000001"); > list151->Print("all"); > > t->Draw(">>list152","e < .000001"); > list152->Print("all"); > > t->Draw(">>list153","e< .000001"); > list153->Print("all"); > > t->Draw(">>list154","e< 0.000001"); > list154->Print("all"); > > t->Draw(">>list155","e<0.000001"); > list155->Print("all"); > > t->Draw(">>list16","e<0.00000001"); > t->Draw("e","e<0.0000000001"); > list16->Print("all"); > > } > > the current keyboard layout is 437 > ******************************************* > * * > * W E L C O M E to R O O T * > * * > * Version 2.00/11 28 August 1998 * > * * > * You are welcome to visit our Web site * > * http://root.cern.ch * > * * > ******************************************* > > CINT/ROOT C/C++ Interpreter version 5.13.69, Aug 22 1998 > Type ? for help. Commands must be C++ statements. > Enclose multiple statements between { }. > root [0] .x haas/listtest.c > EventList:list1/e<1000, number of entries =10000, size=10000 > EventList:list2/e>999.2, number of entries =0, size=1000 > EventList:list3/e<100, number of entries =1000, size=1000 > EventList:list4/e<10.24, number of entries =110, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > 10 10 11 12 13 14 15 16 17 > 18 1 > 20 20 21 22 23 24 25 26 27 > 28 2 > 30 30 31 32 33 34 35 36 37 > 38 3 > 40 40 41 42 43 44 45 46 47 > 48 4 > 50 50 51 52 53 54 55 56 57 > 58 5 > 60 60 61 62 63 64 65 66 67 > 68 6 > 70 70 71 72 73 74 75 76 77 > 78 7 > 80 80 81 82 83 84 85 86 87 > 88 8 > 90 90 91 92 93 94 95 96 97 > 98 9 > 100 100 101 102 103 104 105 106 107 > 108 1 > EventList:list17/e<10, number of entries =100, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > 10 10 11 12 13 14 15 16 17 > 18 1 > 20 20 21 22 23 24 25 26 27 > 28 2 > 30 30 31 32 33 34 35 36 37 > 38 3 > 40 40 41 42 43 44 45 46 47 > 48 4 > 50 50 51 52 53 54 55 56 57 > 58 5 > 60 60 61 62 63 64 65 66 67 > 68 6 > 70 70 71 72 73 74 75 76 77 > 78 7 > 80 80 81 82 83 84 85 86 87 > 88 8 > 90 90 91 92 93 94 95 96 97 > 98 9 > EventList:list5/e<1.234, number of entries =20, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > 10 10 11 12 13 14 15 16 17 > 18 1 > EventList:list6/e<1, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > EventList:list7/e<.91, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > EventList:list8/e<.25, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > EventList:list9/e<.1, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > EventList:list10/e<.01, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > EventList:list11/e<.003, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > EventList:list12/e<.0021, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > EventList:list13/e<.0001, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > EventList:list14/e<.00001, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > EventList:list150/e<0.000001, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > EventList:list151/e < 0.000001, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > EventList:list152/e < .000001, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > EventList:list153/e< .000001, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > EventList:list154/e< 0.000001, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > EventList:list155/e<0.000001, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > Warning in <MakeDefCanvas>: creating a default canvas with name c1 > EventList:list16/e<0.00000001, number of entries =10, size=1000 > 0 0 1 2 3 4 5 6 7 > 8 9 > root [1] > ////////////////////////////////////////////////////////////////////// > > There can' be any less than .0001 !!! > > Cheers, > Andy. > > == > Andrew Haas - haas@yahoo.com > University of Washingon Physics > Glast - D0 > > _________________________________________________________ > DO YOU YAHOO!? > Get your free @yahoo.com address at http://mail.yahoo.com
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:37 MET