7def DumpPathology(inf, hvline, outfile, append):
8
9 if not inf.IsOpen():
10 print(
'File not open ?')
11 return
12
13 try:
14 if append:
15 fout=open(outfile,'a')
16 else:
17 fout=open(outfile,'w')
18 except Exception as e:
19 print(
'Could not open output file ',outfile)
20 print (e)
21 return
22
23 tree=inf.Get("hv/mytree")
24
25 br_hvline=tree.GetBranch("HVline")
26 hvdict={}
27 for i in range(0,tree.GetEntries()):
28 if i%10000 == 0:
print(i)
29 br_hvline.GetEntry(i)
30 if tree.HVline != hvline: continue
31 tree.GetEntry(i)
32 bec=tree.barrel_ec
33 side=tree.side
34 FT=tree.FT
35 slot=tree.slot
36 channel=tree.channel
37 idlist=[bec,side,FT,slot,channel]
38 if str(idlist) in hvdict: continue
39 hv=tree.hv
40 ihv=int(hv)
41 hvlist=[bec,side,FT,slot,channel,ihv]
42 hvdict[str(idlist)]=hvlist
43 pass
44
45
46 if not append: fout.write('/LAR/HVPathologiesOfl/Pathologies\n')
47 for k in list(hvdict.keys()):
48 ll=hvdict[k]
49 if len(ll) != 6:
50 print(
'Wrong list: ',ll,
' continue to next!!!')
51 continue
52 wstr=str(ll[0])+' '+str(ll[1])+' '+str(ll[2])+' '+str(ll[3])+' '+str(ll[4])+' '+str(hvline/1000)+' '+str(hvline%1000)+' '+str((ihv<<4)&0xFFF0)+'\n'
53 fout.write(wstr)
54 pass
55 fout.close()
56 return
57
void print(char *figname, TCanvas *c1)