ATLAS Offline Software
PlotPulseshapeFromCool.py
Go to the documentation of this file.
1 #!/bin/env python
2 
3 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4 #
5 # PlotPulseshapeFromCool.py
6 # Nils Gollub <nils.gollub@cern.ch>, 2008-06-05
7 
8 from TileCalibBlobPython import TileCalibTools
9 from TileCalibBlobObjs.Classes import TileCalibUtils
10 import ROOT
11 
12 pointInTime = (999999999,0)
13 
14 #=== get a logger
15 from TileCalibBlobPython.TileCalibLogger import getLogger
16 log = getLogger("ps_readDb")
17 
18 #=== open the database
19 db = TileCalibTools.openDbConn('COOLOFL_TILE/CONDBR2')
20 
21 #=== specify folder and tag
22 folder = "/TILE/OFL02/PULSESHAPE/PHY"
23 folderTag = TileCalibUtils.getFullTag(folder, "RUN2-HLT-UPD1-00")
24 #folder = "/TILE/OFL01/PULSESHAPE/LAS"
25 #folderTag = TileCalibUtils.getFullTag(folder, "RUN2-HLT-UPD1-01")
26 
27 
28 #=== get a blob reader
29 print (folder)
30 print (folderTag)
31 blobReader = TileCalibTools.TileBlobReader(db,folder,folderTag)
32 
33 #=== write out the comment
34 comment = blobReader.getComment(pointInTime)
35 log.info("Comment: \"%s\"", comment)
36 
37 #=== write out all values
38 cd = blobReader.getDrawer(0,0,pointInTime)
39 
40 x = -200.
41 xarr = []
42 yarrLG = []
43 darrLG = []
44 yarrHG = []
45 darrHG = []
46 while x<200.:
47  x+=0.1
48  yLG = cd.getY( 0,0,x)
49  dyLG = cd.getDY(0,0,x)
50  yHG = cd.getY( 0,1,x)
51  dyHG = cd.getDY(0,1,x)
52  #if y<-100.:
53  # continue
54  print("x=%5.1f \tyLG=%5.4f\tdyLG=%5.4f \tyHG=%5.4f\tdyHG=%5.4f" % (x,yLG,dyLG,yHG,dyHG) )
55  xarr.append(x)
56  yarrLG.append(yLG)
57  darrLG.append(dyLG)
58  yarrHG.append(yHG)
59  darrHG.append(dyHG)
60 
61 #=== close the database connection
62 db.closeDatabase()
63 
64 np=len(xarr)
65 psLG = ROOT.TGraph(np)
66 dsLG = ROOT.TGraph(np)
67 psHG = ROOT.TGraph(np)
68 dsHG = ROOT.TGraph(np)
69 for i in range(np):
70  psLG.SetPoint(i,xarr[i],yarrLG[i])
71  dsLG.SetPoint(i,xarr[i],darrLG[i])
72  psHG.SetPoint(i,xarr[i],yarrHG[i])
73  dsHG.SetPoint(i,xarr[i],darrHG[i])
74 psLG.SetMarkerColor(ROOT.kBlue)
75 dsLG.SetMarkerColor(ROOT.kBlue)
76 psHG.SetMarkerColor(ROOT.kBlue)
77 dsHG.SetMarkerColor(ROOT.kBlue)
78 psLG.SetMinimum(-0.1)
79 psLG.SetMaximum(1.1)
80 psHG.SetMinimum(-0.1)
81 psHG.SetMaximum(1.1)
82 dsLG.SetMinimum(-0.03)
83 dsLG.SetMaximum(0.037)
84 dsHG.SetMinimum(-0.03)
85 dsHG.SetMaximum(0.037)
86 psLG.SetTitle("Low gain")
87 dsLG.SetTitle("Low gain derivative")
88 psHG.SetTitle("High gain")
89 dsHG.SetTitle("High gain derivative")
90 
91 can = ROOT.TCanvas("can","Pulse Shapes")
92 can.Divide(2,2)
93 can.cd(1)
94 psLG.Draw("AP")
95 can.cd(2)
96 dsLG.Draw("AP")
97 can.cd(3)
98 psHG.Draw("AP")
99 can.cd(4)
100 dsHG.Draw("AP")
101 
102 try:
103  from builtins import input
104 except ImportError:
105  # old python 2 without builtins
106  input=raw_input
107 
108 c = input('please enter a character: ')
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
python.CaloCondLogger.getLogger
def getLogger(name="CaloCond")
Definition: CaloCondLogger.py:16
TileCalibUtils::getFullTag
static std::string getFullTag(const std::string &folder, const std::string &tag)
Returns the full tag string, composed of camelized folder name and tag part.
Definition: TileCalibUtils.cxx:33