14 from array
import array
17 from ROOT
import HWIdentifier, Identifier, IdentifierHash, TFile
18 from AthenaPython
import PyAthena
23 self.
fout = ROOT.TFile(ofile,
"RECREATE")
28 self.
sg = PyAthena.py_svc(
'StoreGateSvc')
35 self.
detStore = PyAthena.py_svc(
'DetectorStore')
37 print(
"Failed to get DetectorStore")
42 print(
"Failed to get CaloCell_ID")
44 EI = self.
sg[
'EventInfo']
46 self.
msg.warning(
"Failed to get EventInfo")
50 self.
evtid=EI.eventNumber()
54 self.
msg.
debug(
"Doing NoisyRO Ttree init")
74 self.
nt = ROOT.TTree(
"mytree",
"mytree")
76 self.
nt.Branch(
"Event",self.
aevtid,
"Event/l")
77 self.
nt.Branch(
"BCID",self.
abcid,
"BCID/I")
78 self.
nt.Branch(
"badFEBPart",self.
badFEBPart,
"badFEBPart/s")
85 self.
nt.Branch(
"nbad",self.
nbad,
"nbad/i")
86 self.
nt.Branch(
"bad_febs",self.
idvec,
"bad_febs[nbad]/I")
87 self.
nt.Branch(
"nMNBTight",self.
nMNBTight,
"nMNBTight/i")
88 self.
nt.Branch(
"MNBTight_febs",self.
MNBTightvec,
"MNBTight_febs[nbad]/I")
89 self.
nt.Branch(
"nMNBLoose",self.
nMNBLoose,
"nMNBLoose/i")
90 self.
nt.Branch(
"MNBLoose_febs",self.
MNBLoosevec,
"MNBLoose_febs[nbad]/I")
97 self.
nt.Branch(
"hvLinesPart",self.
hvLinesPart,
"hvLinesPart/s")
98 self.
nt.Branch(
"nhv",self.
nhv,
"nhv/i")
99 self.
nt.Branch(
"hvLines_febs",self.
hvLinesvec,
"hvLines_febs[nbad]/I")
104 Nro = self.
sg[
'LArNoisyROSummary']
106 print(
"badFEBPart: ",self.
badFEBPart,
" ",Nro.BadFEBFlaggedPartitions())
115 hwvec=Nro.get_noisy_febs()
116 self.
nbad[0]=hwvec.size()
120 self.
idvec[i]=hwvec[i].get_identifier32().get_compact()
122 hwvec=Nro.get_MNBTight_febs()
127 self.
MNBTightvec[i]=hwvec[i].get_identifier32().get_compact()
129 hwvec=Nro.get_MNBLoose_febs()
134 self.
MNBLoosevec[i]=hwvec[i].get_identifier32().get_compact()
136 hwvec=Nro.get_MNBTight_PsVeto_febs()
145 hwvec=Nro.get_noisy_hvlines()
146 self.
nhv[0]=hwvec.size()
150 self.
hvLinesvec[i]=hwvec[i].get_identifier32().get_compact()
163 print(sys.argv[0]+
": Dump LArNoisyROSummary from pool file to ntuple")
165 print(
"-i input file (default ESD.pool.root)")
166 print(
"-o output file (default NoisyROSum.root)")
167 print(
"-n number of events to dump (default -1)")
168 print(
"-m MC pool file (default fals)")
169 print(
"-v add HVline info (default fals)")
170 print(
"--detdescr <DetDescrVersion>")
171 print(
"-h Print this help text and exit")
174 opts,args=getopt.getopt(sys.argv[1:],
"i:o:n:mvh",[
"help",
"detdescr="])
175 except Exception
as e:
181 ifile=
'ESD.pool.root'
182 ofile=
"NoisyROSum.root"
186 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
187 detdescrtag=defaultGeometryTags.RUN2
190 if (o==
"-i"): ifile=a
191 if (o==
"-o"): ofile=a
192 if (o==
"-n"): nev=
int(a)
193 if (o==
"-m"): mc=
True
194 if (o==
"-v"): hv=
True
195 if (o==
"-h" or o==
"--help"):
198 if (o==
"--detdescr"):
202 sys.argv = sys.argv[:1] + [
'-b']
204 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
206 flags.Input.Files = [ifile]
208 flags.IOVDb.DatabaseInstance=
"CONDBR2"
209 flags.GeoModel.AtlasVersion = detdescrtag
210 flags.LAr.doAlign=
False
212 from AthenaConfiguration.DetectorConfigFlags
import disableDetectors, allDetectors
214 flags.Detector.EnableLAr =
True
215 flags.Detector.EnableTile =
True
216 flags.Detector.EnableCalo =
True
219 flags.Exec.OutputLevel=INFO
223 from RootUtils
import PyROOTFixes
224 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
227 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
230 from TileGeoModel.TileGMConfig
import TileGMCfg
232 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
235 cfg.addEventAlgo(
NoisyRO(ofile,hv))