5 from builtins
import range
10 ROOT.PyConfig.IgnoreCommandLineOptions =
True 13 import Alignment.MillePedeAlignmentAlgorithm.mpsvalidate.geometrydata
as mpsv_geometrydata
17 """ Creates a list of the aligned strucutres. Get the fields out of the 18 TrackerTree.root file. 27 return mpsv_geometrydata.data[objid].subdetid
30 return mpsv_geometrydata.data[objid].discriminator
35 ndiscriminator = {key: []
for key
in discriminator}
37 treeFile = ROOT.TFile(os.path.join(self.
config.jobDataPath,
39 tree = treeFile.Get(
"TrackerTreeGenerator/TrackerTree/TrackerTree")
43 if (entry.SubdetId == subdetid):
44 for structure
in discriminator:
45 ndiscriminator[structure].
append(getattr(entry, structure))
46 for structure
in discriminator:
47 ndiscriminator[structure] = [x
for x
in ndiscriminator[structure]
if x != 0]
49 return [len(set(ndiscriminator[structure]))
50 for structure
in discriminator]
54 for entry
in MillePedeUser:
56 if (entry.ObjId != 1
and 999999
not in map(abs, entry.Par)):
60 name =
str(entry.Name)
66 Structure(name, subdetid, discriminator, ndiscriminator))
74 ranges = struct.ndiscriminator
75 pranges = [list(
range(1, x+1))
for x
in ranges]
78 for number
in itertools.product(*pranges):
80 pattern = dict(
zip(
map(
lambda x: x.lower(), struct.discriminator), number))
82 name =
" ".
join(
"{0} {1}".
format(key.lower(), value)
83 for (key, value)
in pattern.items())
85 detids = self.
get_detids(struct.subdetid, pattern)
87 child =
Structure(name, struct.subdetid, detids=detids)
88 struct.children.append(child)
95 treeFile = ROOT.TFile(os.path.join(self.
config.jobDataPath,
97 tree = treeFile.Get(
"TrackerTreeGenerator/TrackerTree/TrackerTree")
101 if (entry.SubdetId == subdetid):
103 structure_found =
False 104 for structure
in (
"Half",
"Side",
"Layer",
"Rod",
"Ring",
105 "Petal",
"Blade",
"Panel",
"OuterInner",
107 if structure.lower()
in pattern:
108 if getattr(entry, structure) != pattern[structure.lower()]:
109 structure_found =
True 111 if structure_found:
continue 113 detids.append(entry.RawId)
118 """ A object represents a physical strucutre 121 def __init__(self, name, subdetid, discriminator=[], ndiscriminator=[], detids=[]):
bool any(const std::vector< T > &v, const T &what)
def get_detids(self, subdetid, pattern={})
def get_subdetid(self, objid)
def contains_detid(self, detid)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def __init__(self, config)
static std::string join(char **cmd)
def create_children_list(self)
def __init__(self, name, subdetid, discriminator=[], ndiscriminator=[], detids=[])
def get_discriminator(self, objid)
def create_list(self, MillePedeUser)
def get_ndiscriminator(self, objid)