ATLAS Offline Software
Loading...
Searching...
No Matches
checkRpcDigits Namespace Reference

Classes

class  RpcDigit
 Representation of a single RPC digit. More...
class  RpcSDO

Functions

 readDigitTree (in_file, treeName="HitValidTree")
 readSDOTree (in_file, treeName="HitValidTree")

Variables

 parser = ArgumentParser(prog="checkRpcDigits", description="Script comparing the Rpc digitization validation n-tuples")
 help
 default
 type
 args = parser.parse_args()
 refDigits = readDigitTree(args.refFile)
 testDigits = readDigitTree(args.testFile)
 refSDOs = readSDOTree(args.refFile)
 testSDOs = readSDOTree(args.testFile)
 outFile = open(args.outFile, "w")
bool allGood = True
 Loop over the SDOs & Digits.
 testContent = testDigits[event]
str errorStr
 digit

Function Documentation

◆ readDigitTree()

checkRpcDigits.readDigitTree ( in_file,
treeName = "HitValidTree" )

Definition at line 77 of file checkRpcDigits.py.

77def readDigitTree(in_file, treeName = "HitValidTree"):
78
79 t_file = TFile.Open(in_file, "READ")
80 if not t_file:
81 print(f"Failed to open {in_file}")
82 exit(1)
83 tree = t_file.Get(treeName)
84 if not tree:
85 print("Failed to read tree {treeName} from {file}".format(treeName=treeName, file=t_file.GetName()))
86 exit(1)
87 allDigits = {}
88 for entry in range(tree.GetEntries()):
89 tree.GetEntry(entry)
90 evt= tree.eventNumber
91 digits = []
92 for digit in range(len(tree.Digits_RPC_stationIndex)):
93 digits.append(RpcDigit(stationIndex = ord(tree.Digits_RPC_stationIndex[digit]),
94 stationEta = ord(tree.Digits_RPC_stationEta[digit]),
95 stationPhi = ord(tree.Digits_RPC_stationPhi[digit]),
96 doubletR = ord(tree.Digits_RPC_doubletR[digit]),
97 doubletPhi= ord(tree.Digits_RPC_doubletPhi[digit]),
98 gasGap = ord(tree.Digits_RPC_gasGap[digit]),
99 measuresPhi=tree.Digits_RPC_measuresPhi[digit],
100 strip = ord(tree.Digits_RPC_strip[digit]),
101 globPosX= tree.Digits_RPC_globalPosX[digit],
102 globPosY= tree.Digits_RPC_globalPosY[digit],
103 globPosZ= tree.Digits_RPC_globalPosZ[digit],
104
105 locPosX = tree.Digits_RPC_localPosX[digit],
106 locPosY = tree.Digits_RPC_localPosY[digit],
107 time = tree.Digits_RPC_time[digit]
108 ))
109 if digits[-1].identify().stationName() == "BIS":
110 digits.pop()
111 if len (digits): allDigits[evt] = digits
112 return allDigits
113
void print(char *figname, TCanvas *c1)

◆ readSDOTree()

checkRpcDigits.readSDOTree ( in_file,
treeName = "HitValidTree" )

Definition at line 114 of file checkRpcDigits.py.

114def readSDOTree(in_file, treeName = "HitValidTree"):
115 allSDOS = {}
116 t_file = TFile.Open(in_file, "READ")
117 if not t_file:
118 print(f"Failed to open {in_file}")
119 exit(1)
120 tree = t_file.Get(treeName)
121 if not tree:
122 print("Failed to read tree {treeName} from {file}".format(treeName=treeName, file=t_file.GetName()))
123 exit(1)
124 allSDOS = {}
125 for entry in range(tree.GetEntries()):
126 tree.GetEntry(entry)
127 evt= tree.eventNumber
128
129 SDOs = []
130 for sdo in range(len(tree.SDO_RPC_stationIndex)):
131 SDOs.append(RpcSDO(stationIndex = ord(tree.SDO_RPC_stationIndex[sdo]),
132 stationEta = ord(tree.SDO_RPC_stationEta[sdo]),
133 stationPhi = ord(tree.SDO_RPC_stationPhi[sdo]),
134 doubletR = ord(tree.SDO_RPC_doubletR[sdo]),
135 doubletPhi = ord(tree.SDO_RPC_doubletPhi[sdo]),
136 gasGap = ord(tree.SDO_RPC_gasGap[sdo]),
137 measuresPhi=tree.SDO_RPC_measuresPhi[sdo],
138 strip = ord(tree.SDO_RPC_strip[sdo]),
139 globPosX = tree.SDO_RPC_globalPosX[sdo],
140 globPosY = tree.SDO_RPC_globalPosY[sdo],
141 globPosZ = tree.SDO_RPC_globalPosZ[sdo],
142
143 locPosX = tree.SDO_RPC_localPosX[sdo],
144 locPosY = tree.SDO_RPC_localPosY[sdo],
145 #time = tree.SDO_RPC_global_time[sdo],
146 barcode=tree.SDO_RPC_barcode[sdo]
147 ))
148
149 if len(SDOs):
150 allSDOS[evt] = SDOs
151
152 return allSDOS
153

Variable Documentation

◆ allGood

bool checkRpcDigits.allGood = True

Loop over the SDOs & Digits.

Definition at line 171 of file checkRpcDigits.py.

◆ args

checkRpcDigits.args = parser.parse_args()

Definition at line 160 of file checkRpcDigits.py.

◆ default

checkRpcDigits.default

Definition at line 157 of file checkRpcDigits.py.

◆ digit

checkRpcDigits.digit

Definition at line 186 of file checkRpcDigits.py.

◆ errorStr

str checkRpcDigits.errorStr
Initial value:
1= "In Event {event}, {digit} cannot be found in the test sample. Potential candidates: \n".format(digit = str(refObj),
2 event = event)

Definition at line 182 of file checkRpcDigits.py.

◆ help

checkRpcDigits.help

Definition at line 157 of file checkRpcDigits.py.

◆ outFile

checkRpcDigits.outFile = open(args.outFile, "w")

Definition at line 168 of file checkRpcDigits.py.

◆ parser

checkRpcDigits.parser = ArgumentParser(prog="checkRpcDigits", description="Script comparing the Rpc digitization validation n-tuples")

Definition at line 156 of file checkRpcDigits.py.

◆ refDigits

checkRpcDigits.refDigits = readDigitTree(args.refFile)

Definition at line 162 of file checkRpcDigits.py.

◆ refSDOs

checkRpcDigits.refSDOs = readSDOTree(args.refFile)

Definition at line 165 of file checkRpcDigits.py.

◆ testContent

checkRpcDigits.testContent = testDigits[event]

Definition at line 176 of file checkRpcDigits.py.

◆ testDigits

checkRpcDigits.testDigits = readDigitTree(args.testFile)

Definition at line 163 of file checkRpcDigits.py.

◆ testSDOs

checkRpcDigits.testSDOs = readSDOTree(args.testFile)

Definition at line 166 of file checkRpcDigits.py.

◆ type

checkRpcDigits.type

Definition at line 157 of file checkRpcDigits.py.