CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
geometry.Alignables Class Reference

Public Member Functions

def __init__
 
def create_children_list
 
def create_list
 
def get_detids
 
def get_discriminator
 
def get_name_by_objid
 
def get_ndiscriminator
 
def get_subdetid
 

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 15 of file geometry.py.

Constructor & Destructor Documentation

def geometry.Alignables.__init__ (   self,
  config 
)

Definition at line 20 of file geometry.py.

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

Member Function Documentation

def geometry.Alignables.create_children_list (   self)

Definition at line 55 of file geometry.py.

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

55 
56  def create_children_list(self):
57  for struct in self.structures:
58  # loop over discriminators -> create patterns
59  # pattern {"half": 2, "side": 2, "layer": 6, ...}
60  ranges = struct.ndiscriminator
61  pranges = [range(1, x+1) for x in ranges]
62  # loop over all possible combinations of the values of the
63  # discriminators
64  for number in itertools.product(*pranges):
65  # create pattern dict
66  pattern = dict(zip(struct.discriminator, number))
67  # name out of patten
68  name = " ".join("{0} {1}".format(key, value)
69  for (key, value) in pattern.items())
70  # get detids of child
71  detids = self.get_detids(struct.subdetid, pattern)
72  # create child and add it to parent
73  child = Structure(name, struct.subdetid, detids=detids)
74  struct.children.append(child)
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
Definition: geometry.py:55
def geometry.Alignables.create_list (   self,
  MillePedeUser 
)

Definition at line 37 of file geometry.py.

References any(), geometry.Alignables.get_detids(), geometry.Alignables.get_discriminator(), geometry.Alignables.get_name_by_objid(), geometry.Alignables.get_ndiscriminator(), geometry.Alignables.get_subdetid(), and geometry.Alignables.structures.

37 
38  def create_list(self, MillePedeUser):
39  # loop over output TTree
40  for line in MillePedeUser:
41  # check which structures were aligned
42  if (line.ObjId != 1 and 999999 not in map(abs, line.Par)):
43  # check if structure is not yet in the list
44  if not any(x.name == self.get_name_by_objid(line.ObjId) for x in self.structures):
45  # create new structure object
46  name = self.get_name_by_objid(line.ObjId)
47  subdetid = self.get_subdetid(line.ObjId)
48  discriminator = self.get_discriminator(line.ObjId)
49  ndiscriminator = self.get_ndiscriminator(line.ObjId)
50  # create structure
51  self.structures.append(
52  Structure(name, subdetid, discriminator, ndiscriminator))
53  # add detids which belong to this structure
54  self.structures[-1].detids = self.get_detids(subdetid)
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:34
def geometry.Alignables.get_detids (   self,
  subdetid,
  pattern = {} 
)

Definition at line 75 of file geometry.py.

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

75 
76  def get_detids(self, subdetid, pattern={}):
77  # list of all detids in the structure
78  detids = []
79  # open TrackerTree.root file
80  treeFile = TFile(os.path.join(self.config.mpspath, "TrackerTree.root"))
81  tree = treeFile.Get("TrackerTreeGenerator/TrackerTree/TrackerTree")
82 
83  for line in tree:
84  # check if line is part of the structure
85  if (line.SubdetId == subdetid):
86 
87  # to create a child also check the pattern
88  if ("half" in pattern):
89  if (line.Half != pattern["half"]):
90  continue
91 
92  if ("side" in pattern):
93  if (line.Side != pattern["side"]):
94  continue
95 
96  if ("layer" in pattern):
97  if (line.Layer != pattern["layer"]):
98  continue
99 
100  if ("rod" in pattern):
101  if (line.Rod != pattern["rod"]):
102  continue
103 
104  if ("ring" in pattern):
105  if (line.Ring != pattern["ring"]):
106  continue
107 
108  if ("petal" in pattern):
109  if (line.Petal != pattern["petal"]):
110  continue
111 
112  if ("blade" in pattern):
113  if (line.Blade != pattern["blade"]):
114  continue
115 
116  if ("panel" in pattern):
117  if (line.Panel != pattern["panel"]):
118  continue
119 
120  if ("outerinner" in pattern):
121  if (line.OuterInner != pattern["outerinner"]):
122  continue
123 
124  if ("module" in pattern):
125  if (line.Module != pattern["module"]):
126  continue
127 
128  detids.append(line.RawId)
129  return detids
130 
def geometry.Alignables.get_discriminator (   self,
  objid 
)

Definition at line 31 of file geometry.py.

Referenced by geometry.Alignables.create_list().

31 
32  def get_discriminator(self, objid):
33  return geometrydata.data[objid].discriminator
def geometry.Alignables.get_name_by_objid (   self,
  objid 
)

Definition at line 25 of file geometry.py.

Referenced by geometry.Alignables.create_list().

25 
26  def get_name_by_objid(self, objid):
27  return geometrydata.data[objid].name
def geometry.Alignables.get_ndiscriminator (   self,
  objid 
)

Definition at line 34 of file geometry.py.

Referenced by geometry.Alignables.create_list().

34 
35  def get_ndiscriminator(self, objid):
36  return geometrydata.data[objid].ndiscriminator
def geometry.Alignables.get_subdetid (   self,
  objid 
)

Definition at line 28 of file geometry.py.

Referenced by geometry.Alignables.create_list().

28 
29  def get_subdetid(self, objid):
30  return geometrydata.data[objid].subdetid

Member Data Documentation

geometry.Alignables.config

Definition at line 23 of file geometry.py.

Referenced by genericValidation.GenericValidation.getRepMap(), DTNoiseCalibration.DTNoiseCalibration.initCrab(), DTTTrigProd.DTTTrigProd.initCrab(), DTDQMValidation.DTDQMValidation.initCrab(), DTTTrigValid.DTTTrigValid.initCrab(), DTAnalysisResiduals.DTAnalysisResiduals.initCrab(), DTResidualCalibration.DTResidualCalibration.initCrab(), DTVDriftMeanTimerCalibration.DTVDriftMeanTimerCalibration.initCrab(), DTVDriftSegmentCalibration.DTVDriftSegmentCalibration.initCrab(), DTT0DBValidation.DTT0DBValidation.initProcess(), DTDqm.DTDqm.initProcess(), DTDQMMerge.DTDQMMerge.initProcess(), DTVDriftMeanTimerCalibration.DTVDriftMeanTimerCalibration.initProcess(), DTTTrigProd.DTTTrigProd.initProcess(), DTAnalysisResiduals.DTAnalysisResiduals.initProcess(), DTVDriftSegmentCalibration.DTVDriftSegmentCalibration.initProcess(), DTDQMHarvesting.DTDQMHarvesting.initProcess(), DTNoiseCalibration.DTNoiseCalibration.initProcess(), DTResidualCalibration.DTResidualCalibration.initProcess(), DTTTrigValid.DTTTrigValid.initProcess(), DTDQMValidation.DTDQMValidation.initProcess(), and DTCalibrationWorker.DTCalibrationWorker.run().

geometry.Alignables.structures

Definition at line 22 of file geometry.py.

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