11
12 if input_file_name is None:
13 print ("No input file name, assuming output.root")
14 input_file_name = "output.root"
15
16 gStyle.SetPalette(1)
17 gStyle.SetOptStat(0)
18 gStyle.SetOptFit(0)
19 gStyle.SetCanvasColor(10)
20 gStyle.SetFrameFillColor(10)
21 gStyle.SetStatY(0.85)
22 gStyle.SetStatX(0.85)
23
24
25 c1 = TCanvas('c1','Example',200,10,700,500)
26 c1.Divide(8,9)
27
28 graphs = TFile(input_file_name)
29 graphs.cd('ADC/FineTime')
30 key_list = gDirectory.GetListOfKeys()
31
32 run_directory_name = None
33
34 try:
35 for iii in key_list:
36 iii_str = str(iii)
37 line = iii_str.split("\"")
38 for name in line:
39 if 'run#' in name:
40 run_directory_name = name
41 if run_directory_name is None:
42 raise NameError
43 except Exception:
44 print ("ERROR, the file doesn't contain run# directory!")
45 sys.exit(1)
46
47
48 print ("Entering directory: ", run_directory_name)
49 gDirectory.cd(run_directory_name)
50
51
52 c1.Print("CalibrationTimingPlots.ps[")
53
54 ppm_em_2d_profile_etaPhi_adc_fineTime.SetMinimum(-10.)
55 ppm_em_2d_profile_etaPhi_adc_fineTime.SetMaximum(10.)
56 ppm_em_2d_profile_etaPhi_adc_fineTime.Draw("colz")
57 c1.Print("CalibrationTimingPlots.ps")
58
59
60 ppm_had_2d_profile_etaPhi_adc_fineTime.SetMinimum(-10.)
61 ppm_had_2d_profile_etaPhi_adc_fineTime.SetMaximum(10.)
62 ppm_had_2d_profile_etaPhi_adc_fineTime.Draw("colz")
63 c1.Print("CalibrationTimingPlots.ps")
64
65
66 directory_content = gDirectory.GetListOfKeys()
67
68
69 gStyle.SetOptStat(111111)
70 partition_histos=[]
71 for key in directory_content:
72 print (key," Class name= ", key.GetClassName(), " Name=", key.GetName())
73 if key.GetClassName() == 'TDirectoryFile':
74 print ("OK, I will create new histogram for this partition!")
75 print ("Name of partition is: ", key.GetName())
76 partition_histos.append(TH1F(key.GetName()+'_his','Timing distribution for partition: '+key.GetName(),100,-10.,10.))
77 gDirectory.cd()
78 gDirectory.cd("/ADC/FineTime/"+run_directory_name+"/"+key.GetName())
79
80 list_of_histos = gDirectory.GetListOfKeys()
81 for his_key in list_of_histos:
82
83 timing_value=his_key.ReadObj().GetBinContent(2)
84 partition_histos[-1].Fill(timing_value)
85
86
87 for iHisto in partition_histos:
88 iHisto.Draw()
89 c1.Print("CalibrationTimingPlots.ps")
90
91 c1.Print("CalibrationTimingPlots.ps]")
92
93 os.system("ps2pdf CalibrationTimingPlots.ps")
94
95 print ("Finished!")
96
97