9 ROOT.PyConfig.IgnoreCommandLineOptions =
True 12 import Alignment.MillePedeAlignmentAlgorithm.mpsvalidate.geometrydata
as mpsv_geometrydata
16 """ Creates a list of the aligned strucutres. Get the fields out of the 17 TrackerTree.root file. 26 return mpsv_geometrydata.data[objid].subdetid
29 return mpsv_geometrydata.data[objid].discriminator
34 ndiscriminator = {key: []
for key
in discriminator}
36 treeFile = ROOT.TFile(os.path.join(self.config.jobDataPath,
38 tree = treeFile.Get(
"TrackerTreeGenerator/TrackerTree/TrackerTree")
42 if (entry.SubdetId == subdetid):
43 for structure
in discriminator:
44 ndiscriminator[structure].
append(getattr(entry, structure))
45 for structure
in discriminator:
46 ndiscriminator[structure] = [x
for x
in ndiscriminator[structure]
if x != 0]
48 return [len(set(ndiscriminator[structure]))
49 for structure
in discriminator]
53 for entry
in MillePedeUser:
55 if (entry.ObjId != 1
and 999999
not in map(abs, entry.Par)):
59 name =
str(entry.Name)
64 self.structures.append(
65 Structure(name, subdetid, discriminator, ndiscriminator))
73 ranges = struct.ndiscriminator
74 pranges = [range(1, x+1)
for x
in ranges]
77 for number
in itertools.product(*pranges):
79 pattern =
dict(
zip(
map(
lambda x: x.lower(), struct.discriminator), number))
81 name =
" ".
join(
"{0} {1}".
format(key.lower(), value)
82 for (key, value)
in pattern.items())
84 detids = self.
get_detids(struct.subdetid, pattern)
86 child =
Structure(name, struct.subdetid, detids=detids)
87 struct.children.append(child)
94 treeFile = ROOT.TFile(os.path.join(self.config.jobDataPath,
96 tree = treeFile.Get(
"TrackerTreeGenerator/TrackerTree/TrackerTree")
100 if (entry.SubdetId == subdetid):
102 structure_found =
False 103 for structure
in (
"Half",
"Side",
"Layer",
"Rod",
"Ring",
104 "Petal",
"Blade",
"Panel",
"OuterInner",
106 if structure.lower()
in pattern:
107 if getattr(entry, structure) != pattern[structure.lower()]:
108 structure_found =
True 110 if structure_found:
continue 112 detids.append(entry.RawId)
117 """ A object represents a physical strucutre 120 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)