ATLAS Offline Software
Loading...
Searching...
No Matches
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
8from TileCalibBlobPython import TileCalibTools
9from TileCalibBlobObjs.Classes import TileCalibUtils
10import ROOT
11
12pointInTime = (999999999,0)
13
14#=== get a logger
15from TileCalibBlobPython.TileCalibLogger import getLogger
16log = getLogger("ps_readDb")
17
18#=== open the database
19db = TileCalibTools.openDbConn('COOLOFL_TILE/CONDBR2')
20
21#=== specify folder and tag
22folder = "/TILE/OFL02/PULSESHAPE/PHY"
23folderTag = 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
29print (folder)
30print (folderTag)
31blobReader = TileCalibTools.TileBlobReader(db,folder,folderTag)
32
33#=== write out the comment
34comment = blobReader.getComment(pointInTime)
35log.info("Comment: \"%s\"", comment)
36
37#=== write out all values
38cd = blobReader.getDrawer(0,0,pointInTime)
39
40x = -200.
41xarr = []
42yarrLG = []
43darrLG = []
44yarrHG = []
45darrHG = []
46while 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
62db.closeDatabase()
63
64np=len(xarr)
65psLG = ROOT.TGraph(np)
66dsLG = ROOT.TGraph(np)
67psHG = ROOT.TGraph(np)
68dsHG = ROOT.TGraph(np)
69for 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])
74psLG.SetMarkerColor(ROOT.kBlue)
75dsLG.SetMarkerColor(ROOT.kBlue)
76psHG.SetMarkerColor(ROOT.kBlue)
77dsHG.SetMarkerColor(ROOT.kBlue)
78psLG.SetMinimum(-0.1)
79psLG.SetMaximum(1.1)
80psHG.SetMinimum(-0.1)
81psHG.SetMaximum(1.1)
82dsLG.SetMinimum(-0.03)
83dsLG.SetMaximum(0.037)
84dsHG.SetMinimum(-0.03)
85dsHG.SetMaximum(0.037)
86psLG.SetTitle("Low gain")
87dsLG.SetTitle("Low gain derivative")
88psHG.SetTitle("High gain")
89dsHG.SetTitle("High gain derivative")
90
91can = ROOT.TCanvas("can","Pulse Shapes")
92can.Divide(2,2)
93can.cd(1)
94psLG.Draw("AP")
95can.cd(2)
96dsLG.Draw("AP")
97can.cd(3)
98psHG.Draw("AP")
99can.cd(4)
100dsHG.Draw("AP")
101
102from builtins import input
103c = input('please enter a character: ')
void print(char *figname, TCanvas *c1)
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.