ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/nowaf/RootFilesInUse/FakeHelper.py
Revision: 1.1.1.1 (vendor branch)
Committed: Tue Mar 20 13:12:08 2012 UTC (13 years, 1 month ago) by nowak
Content type: text/x-python
Branch: rootFilesInUse, MAIN
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
Log Message:
t files in use

File Contents

# Content
1 def getLowerBins( hist, nEntries = 6, startAtBinCenter=-10**6 ):
2 list = []
3 list.append( hist.GetBinLowEdge( 1 ) )
4 ent = 0
5 for i in range( 2, hist.GetNbinsX() + 1 ):
6
7 if hist.GetBinCenter( i ) < startAtBinCenter :
8 list.append( hist.GetBinLowEdge( i ) )
9 else:
10 if hist.GetBinContent( i ) >= nEntries:
11 list.append( hist.GetBinLowEdge( i ) )
12 ent = 0
13 elif hist.GetBinContent( i ) > 0:
14 ent += hist.GetBinContent( i )
15 if ent > nEntries:
16 list.append( hist.GetBinLowEdge( i ) )
17 ent = 0
18 pass
19 pass
20 pass
21 pass
22 ### if the last bins are empty:
23 if not hist.GetBinLowEdge( hist.GetNbinsX() + 1 ) in list:
24 #list.append( hist.GetBinLowEdge( hist.GetNbinsX() + 1 ) )
25 ### remove last bin edge from list
26 del list[ -1 ]
27 ### add last bin edge from histogram instead
28 list.append( hist.GetBinLowEdge( hist.GetNbinsX() + 1 ) )
29 pass
30 ### if just one bin
31 if len( list ) == 1:
32 element = list[ 0 ]
33 list = [ hist.GetBinLowEdge( 1 ),element ]
34 pass
35 return list
36
37 def mergeList( listList ):
38 #print
39 #print
40 finalList = []
41 #for i in range( 0, len( listList ) ):
42 # print listList[ i ]
43 for l in listList[ 0 ]:
44 isInAll = True
45 for j in range( 1, len( listList ) ):
46 if l not in listList[ j ]:
47 isInAll = False
48 pass
49 pass
50 if isInAll:
51 finalList.append( l )
52 pass
53 pass
54
55 #print
56 #print
57 #print finalList
58
59 return finalList