14from array
import array
17from ROOT
import HWIdentifier, Identifier, IdentifierHash, TFile
18from 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")
75 self.
nt.SetDirectory(self.
fout)
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()
119 for i
in range(0,self.
nbad[0]):
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()
149 for i
in range(0,self.
nhv[0]):
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="])
175except Exception
as e:
182ofile=
"NoisyROSum.root"
186from AthenaConfiguration.TestDefaults
import defaultGeometryTags
187detdescrtag=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"):
202sys.argv = sys.argv[:1] + [
'-b']
204from AthenaConfiguration.AllConfigFlags
import initConfigFlags
205flags=initConfigFlags()
206flags.Input.Files = [ifile]
208flags.IOVDb.DatabaseInstance=
"CONDBR2"
209flags.GeoModel.AtlasVersion = detdescrtag
210flags.LAr.doAlign=
False
212from AthenaConfiguration.DetectorConfigFlags
import disableDetectors, allDetectors
213disableDetectors(flags, allDetectors, toggle_geometry =
True)
214flags.Detector.EnableLAr =
True
215flags.Detector.EnableTile =
True
216flags.Detector.EnableCalo =
True
219flags.Exec.OutputLevel=INFO
223from RootUtils
import PyROOTFixes
224from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
225cfg=MainServicesCfg(flags)
227from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
228cfg.merge(PoolReadCfg(flags))
230from TileGeoModel.TileGMConfig
import TileGMCfg
231cfg.merge( TileGMCfg(flags) )
232from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
233cfg.merge(LArGMCfg(flags))
235cfg.addEventAlgo(
NoisyRO(ofile,hv))
void print(char *figname, TCanvas *c1)
__init__(self, ofile, hv)
virtual StatusCode execute() override
virtual StatusCode finalize() override
virtual StatusCode initialize() override