ATLAS Offline Software
Functions | Variables
readCCLHist Namespace Reference

Functions

def readInput (filename, nCellsList=20, bcfile=None, cutoff=0.1)
 

Variables

 parser = argparse.ArgumentParser()
 
 type
 
 help
 
 nargs
 
 default
 
 None
 
 float
 
 int
 
 args
 
 leftover
 

Function Documentation

◆ readInput()

def readCCLHist.readInput (   filename,
  nCellsList = 20,
  bcfile = None,
  cutoff = 0.1 
)

Definition at line 10 of file readCCLHist.py.

10 def readInput(filename, nCellsList=20, bcfile=None, cutoff=0.1):
11 
12  #Set up LArOnlineID helper class in standalone mode (from xml file)
13  from ROOT import IdDictParser
14  parser=IdDictParser()
15  #Get xml files:
16  xmlpath=None
17  for dd in os.getenv('XMLPATH').split(os.pathsep):
18  d=dd+"/IdDictParser/ATLAS_IDS.xml"
19  if os.access(d,os.R_OK):
20  xmlpath=dd
21  break
22  if not xmlpath:
23  print ("ERROR, unable to locate identifier dictionaries")
24  sys.exit(-1)
25 
26 
27  parser.register_external_entity("LArCalorimeter",xmlpath+"/IdDictParser/IdDictLArCalorimeter_DC3-05-Comm-01.xml")
28  idd = parser.parse(xmlpath+"/IdDictParser/ATLAS_IDS.xml")
29  from ROOT import LArOnlineID
30  larID=LArOnlineID()
31  stat=larID.initialize_from_dictionary(idd)
32  if stat==1:
33  print ("ERROR, failed to init LArOnlineID")
34  sys.exit(-1)
35 
36 
37  #Open ROOT HIST file
38  f=TFile.Open(filename)
39  if not f.IsOpen():
40  print("ERROR, failed to open input file",filename)
41  sys.exit(-1)
42 
43  rundir=None
44  for d in f.GetListOfKeys():
45  mg=re.match("run_([0-9]*)",d.GetName())
46  rundir=mg.group(0)
47  break
48 
49  print("Found run dir:",rundir)
50  runnbr=rundir[4:]
51 
52  hist=f.Get(rundir+"/CaloMonitoring/LArClusterCellMon/Summary/cellhashPercent")
53 
54  freq=[]
55  for idx in range(hist.GetNbinsX()):
56  freq.append((idx,hist.GetBinContent(idx)))
57 
58  freq.sort(key=itemgetter(1),reverse=True)
59 
60  for f in freq[:nCellsList]:
61  c=larID.channel_Id(f[0])
62  print ("Channel %s constributes to clusters in %.3f %% of events"% (larID.channel_name(c),f[1]))
63 
64 
65  if bcfile:
66  bcfile.write("#Bad channel list for run "+runnbr+"\n")
67  for (h,f) in freq:
68  if f<cutoff: break
69  c=larID.channel_Id(h)
70  bcfile.write("%i %i %i %i %i 0 highNoiseHG\n"% (larID.barrel_ec(c), larID.pos_neg(c), larID.feedthrough(c),
71  larID.slot(c), larID.channel(c)))
72 
73  bcfile.close()
74 
75 
76 

Variable Documentation

◆ args

readCCLHist.args

Definition at line 86 of file readCCLHist.py.

◆ default

readCCLHist.default

Definition at line 82 of file readCCLHist.py.

◆ float

readCCLHist.float

Definition at line 83 of file readCCLHist.py.

◆ help

readCCLHist.help

Definition at line 81 of file readCCLHist.py.

◆ int

readCCLHist.int

Definition at line 84 of file readCCLHist.py.

◆ leftover

readCCLHist.leftover

Definition at line 86 of file readCCLHist.py.

◆ nargs

readCCLHist.nargs

Definition at line 82 of file readCCLHist.py.

◆ None

readCCLHist.None

Definition at line 82 of file readCCLHist.py.

◆ parser

readCCLHist.parser = argparse.ArgumentParser()

Definition at line 80 of file readCCLHist.py.

◆ type

readCCLHist.type

Definition at line 81 of file readCCLHist.py.

plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
IdDictParser
Definition: IdDictParser.h:12
LArOnlineID
Definition: LArOnlineID.h:20
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28
readCCLHist.readInput
def readInput(filename, nCellsList=20, bcfile=None, cutoff=0.1)
Definition: readCCLHist.py:10
Trk::split
@ split
Definition: LayerMaterialProperties.h:38