CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
geometry.Alignables Class Reference

Public Member Functions

def __init__ (self, config)
 
def create_children_list (self)
 
def create_list (self, MillePedeUser)
 
def get_detids (self, subdetid, pattern={})
 
def get_discriminator (self, objid)
 
def get_ndiscriminator (self, objid)
 
def get_subdetid (self, objid)
 

Public Attributes

 config
 
 structures
 

Detailed Description

Creates a list of the aligned strucutres. Get the fields out of the
TrackerTree.root file.

Definition at line 16 of file geometry.py.

Constructor & Destructor Documentation

def geometry.Alignables.__init__ (   self,
  config 
)

Definition at line 21 of file geometry.py.

21  def __init__(self, config):
22  # list of Structure objects, contains structures which were aligned
23  self.structures = []
24  self.config = config
25 
def __init__(self, config)
Definition: geometry.py:21

Member Function Documentation

def geometry.Alignables.create_children_list (   self)

Definition at line 70 of file geometry.py.

References cmsPerfStripChart.dict, geometry.Alignables.get_detids(), join(), list(), genParticles_cff.map, geometry.Alignables.structures, and ComparisonHelper.zip().

71  for struct in self.structures:
72  # loop over discriminators -> create patterns
73  # pattern {"half": 2, "side": 2, "layer": 6, ...}
74  ranges = struct.ndiscriminator
75  pranges = [list(range(1, x+1)) for x in ranges]
76  # loop over all possible combinations of the values of the
77  # discriminators
78  for number in itertools.product(*pranges):
79  # create pattern dict
80  pattern = dict(zip(map(lambda x: x.lower(), struct.discriminator), number))
81  # name out of pattern
82  name = " ".join("{0} {1}".format(key.lower(), value)
83  for (key, value) in pattern.items())
84  # get detids of child
85  detids = self.get_detids(struct.subdetid, pattern)
86  # create child and add it to parent
87  child = Structure(name, struct.subdetid, detids=detids)
88  struct.children.append(child)
89 
90 
def get_detids(self, subdetid, pattern={})
Definition: geometry.py:91
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def create_children_list(self)
Definition: geometry.py:70
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def geometry.Alignables.create_list (   self,
  MillePedeUser 
)

Definition at line 52 of file geometry.py.

References any(), geometry.Alignables.get_detids(), geometry.Alignables.get_discriminator(), geometry.Alignables.get_ndiscriminator(), geometry.Alignables.get_subdetid(), genParticles_cff.map, str, and geometry.Alignables.structures.

52  def create_list(self, MillePedeUser):
53  # loop over output TTree
54  for entry in MillePedeUser:
55  # check which structures were aligned
56  if (entry.ObjId != 1 and 999999 not in map(abs, entry.Par)):
57  # check if structure is not yet in the list
58  if not any(x.name == str(entry.Name) for x in self.structures):
59  # create new structure object
60  name = str(entry.Name)
61  subdetid = self.get_subdetid(entry.ObjId)
62  discriminator = self.get_discriminator(entry.ObjId)
63  ndiscriminator = self.get_ndiscriminator(entry.ObjId)
64  # create structure
65  self.structures.append(
66  Structure(name, subdetid, discriminator, ndiscriminator))
67  # add detids which belong to this structure
68  self.structures[-1].detids = self.get_detids(subdetid)
69 
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
def get_detids(self, subdetid, pattern={})
Definition: geometry.py:91
def get_subdetid(self, objid)
Definition: geometry.py:26
def get_discriminator(self, objid)
Definition: geometry.py:29
def create_list(self, MillePedeUser)
Definition: geometry.py:52
def get_ndiscriminator(self, objid)
Definition: geometry.py:32
#define str(s)
def geometry.Alignables.get_detids (   self,
  subdetid,
  pattern = {} 
)

Definition at line 91 of file geometry.py.

Referenced by geometry.Alignables.create_children_list(), and geometry.Alignables.create_list().

91  def get_detids(self, subdetid, pattern={}):
92  # list of all detids in the structure
93  detids = []
94  # open TrackerTree.root file
95  treeFile = ROOT.TFile(os.path.join(self.config.jobDataPath,
96  ".TrackerTree.root"))
97  tree = treeFile.Get("TrackerTreeGenerator/TrackerTree/TrackerTree")
98 
99  for entry in tree:
100  # check if entry is part of the structure
101  if (entry.SubdetId == subdetid):
102  # to create a child also check the pattern
103  structure_found = False
104  for structure in ("Half", "Side", "Layer", "Rod", "Ring",
105  "Petal", "Blade", "Panel", "OuterInner",
106  "Module"):
107  if structure.lower() in pattern:
108  if getattr(entry, structure) != pattern[structure.lower()]:
109  structure_found = True
110  break
111  if structure_found: continue
112 
113  detids.append(entry.RawId)
114  return detids
115 
116 
def get_detids(self, subdetid, pattern={})
Definition: geometry.py:91
def geometry.Alignables.get_discriminator (   self,
  objid 
)

Definition at line 29 of file geometry.py.

Referenced by geometry.Alignables.create_list(), and geometry.Alignables.get_ndiscriminator().

29  def get_discriminator(self, objid):
30  return mpsv_geometrydata.data[objid].discriminator
31 
def get_discriminator(self, objid)
Definition: geometry.py:29
def geometry.Alignables.get_ndiscriminator (   self,
  objid 
)

Definition at line 32 of file geometry.py.

References mps_setup.append, geometry.Alignables.get_discriminator(), and geometry.Alignables.get_subdetid().

Referenced by geometry.Alignables.create_list().

32  def get_ndiscriminator(self, objid):
33  subdetid = self.get_subdetid(objid)
34  discriminator = self.get_discriminator(objid)
35  ndiscriminator = {key: [] for key in discriminator}
36  # open TrackerTree.root file
37  treeFile = ROOT.TFile(os.path.join(self.config.jobDataPath,
38  ".TrackerTree.root"))
39  tree = treeFile.Get("TrackerTreeGenerator/TrackerTree/TrackerTree")
40 
41  for entry in tree:
42  # check if entry is part of the structure
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]
48 
49  return [len(set(ndiscriminator[structure]))
50  for structure in discriminator]
51 
def get_subdetid(self, objid)
Definition: geometry.py:26
def get_discriminator(self, objid)
Definition: geometry.py:29
def get_ndiscriminator(self, objid)
Definition: geometry.py:32
def geometry.Alignables.get_subdetid (   self,
  objid 
)

Definition at line 26 of file geometry.py.

Referenced by geometry.Alignables.create_list(), and geometry.Alignables.get_ndiscriminator().

26  def get_subdetid(self, objid):
27  return mpsv_geometrydata.data[objid].subdetid
28 
def get_subdetid(self, objid)
Definition: geometry.py:26

Member Data Documentation

geometry.Alignables.config
geometry.Alignables.structures