CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
SpecificationBuilder_cfi.Specification Class Reference
Inheritance diagram for SpecificationBuilder_cfi.Specification:

Public Member Functions

def __deepcopy__ (self, memo)
 
def __init__ (self, conf=DefaultConf)
 
def groupBy (self, cols, mode="SUM")
 
def pythonTypeName (self)
 
def reduce (self, sort)
 
def save (self)
 
def saveAll (self)
 

Public Attributes

 conf
 
 spec
 

Private Attributes

 _activeColumns
 
 _lastColumns
 
 _lastMode
 
 _state
 
 _x
 
 _y
 
 _z
 

Detailed Description

Definition at line 60 of file SpecificationBuilder_cfi.py.

Constructor & Destructor Documentation

def SpecificationBuilder_cfi.Specification.__init__ (   self,
  conf = DefaultConf 
)

Definition at line 61 of file SpecificationBuilder_cfi.py.

61  def __init__(self, conf = DefaultConf):
62  super(Specification, self).__init__()
63  # these are the steps passed down to C++. Will be filled later.
64  self.spec = cms.VPSet()
65  # this is currently only an additional enable flag. Might add topFolder or
66  # range there in the future.
67  self.conf = conf
68 
69  # these are onlly used during construction.
70  self._activeColumns = set()
71  self._state = FIRST
72 

Member Function Documentation

def SpecificationBuilder_cfi.Specification.__deepcopy__ (   self,
  memo 
)

Definition at line 73 of file SpecificationBuilder_cfi.py.

References CondFormats_MFObjects::dictionary.conf, SpecificationBuilder_cfi.Specification.conf, and SpecificationBuilder_cfi.Specification.spec.

73  def __deepcopy__(self, memo):
74  # override deepcopy to not copy .conf: it should remain a reference
75  # w/o this it is not cleanly possible to build a per-module switch.
76  t = Specification(self.conf)
77  t.spec = deepcopy(self.spec, memo)
78  return t
79 
def SpecificationBuilder_cfi.Specification.groupBy (   self,
  cols,
  mode = "SUM" 
)

Definition at line 80 of file SpecificationBuilder_cfi.py.

References SpecificationBuilder_cfi.Specification._activeColumns, SpecificationBuilder_cfi.Specification._lastColumns, SpecificationBuilder_cfi.Specification._state, hcaldqm::flag::Flag._state, ALCARECOTkAlBeamHalo_cff.filter, list(), SpecificationBuilder_cfi.Specification.spec, split, and SpecificationBuilder_cfi.val().

Referenced by SpecificationBuilder_cfi.Specification.saveAll().

80  def groupBy(self, cols, mode = "SUM"):
81  cnames = filter(len, val(cols).split("/")) # omit empty items
82  newstate = self._state
83 
84  # The behaviour of groupBy depends a lot on when it happens:
85  # - The first (or second, if there is per-event counting) are very special
86  # - others in STAGE1 have to be EXTEND, and they will be translated into a
87  # list of exactly 3 USE/EXTEND steps (one per dimension).
88  # - in STAGE2 they are just passed down to C++.
89 
90  if self._state == FIRST:
91  cname = cnames
92  if mode != "SUM":
93  raise Exception("First grouping must be SUM")
94  if "Event" in cnames:
95  cnames.remove("Event"); # per-Event grouping is done automatically
96  t = COUNT
97  mode = "COUNT"
98  newstate = FIRST
99  else:
100  t = GROUPBY
101  newstate = STAGE1
102 
103  if self._state == STAGE1:
104  cname = self._activeColumns.difference(cnames)
105  if len(cname) != 1:
106  raise Exception("EXTEND must drop exactly one column.")
107 
108  if mode == "EXTEND_X":
109  self._x.type = EXTEND_X
110  self._x.columns = cms.vstring(cname)
111  elif mode == "EXTEND_Y":
112  self._y.type = EXTEND_Y
113  self._y.columns = cms.vstring(cname)
114  else:
115  raise Exception("Only EXTEND_X or EXTEND_Y allowed here, not " + mode)
116 
117  # remove the column in the FIRST groupBy, we always re-extract in step1.
118  c = list(cname)[0]
119  for s in self.spec:
120  if s.stage == FIRST and s.type == GROUPBY and c in s.columns:
121  s.columns.remove(c)
122  if c in self._activeColumns:
123  self._activeColumns.remove(c)
124  if c in self._lastColumns:
125  self._lastColumns.remove(c)
126 
127  return self # done here, no new step to add
128 
129  if self._state == STAGE2:
130  cname = cnames
131  if self._activeColumns.issubset(cname):
132  raise Exception("Harvesting GROUPBY must drop some columns")
133  if mode == "EXTEND_X":
134  t = EXTEND_X
135  elif mode == "SUM":
136  t = GROUPBY
137  else:
138  raise Exception("Currently only EXTEND_X and SUM supported in harvesting, not " + mode)
139 
140  self._activeColumns = set(cnames)
141  self._lastColumns = cnames
142  self._lastMode = mode
143 
144  self.spec.append(cms.PSet(
145  type = t,
146  stage = self._state,
147  columns = cms.vstring(cname),
148  arg = cms.string(mode)
149  ))
150 
151  # In the very beginning emit standard column assignments, they will be
152  # changed later (above and in save()) to reflect the EXTENDS given above.
153  if newstate == STAGE1 and self._state == FIRST:
154  self._x = cms.PSet(
155  type = USE_X, stage = STAGE1,
156  columns = cms.vstring(),
157  arg = cms.string("")
158  )
159  self.spec.append(self._x)
160  self._y = cms.PSet(
161  type = USE_Y, stage = STAGE1,
162  columns = cms.vstring(),
163  arg = cms.string("")
164  )
165  self.spec.append(self._y)
166  self._z = cms.PSet(
167  type = USE_Z, stage = STAGE1,
168  columns = cms.vstring(),
169  arg = cms.string("")
170  )
171  self.spec.append(self._z)
172 
173  self._state = newstate
174 
175  return self
176 
double split
Definition: MVATrainer.cc:139
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 SpecificationBuilder_cfi.Specification.pythonTypeName (   self)
def SpecificationBuilder_cfi.Specification.reduce (   self,
  sort 
)

Definition at line 177 of file SpecificationBuilder_cfi.py.

References SpecificationBuilder_cfi.Specification._state, hcaldqm::flag::Flag._state, and SpecificationBuilder_cfi.Specification.spec.

177  def reduce(self, sort):
178  # reduce can be MEAN or COUNT. in STAGE2, just pass through.
179  # in STAGE1, MEAN (anywhere) means make a PROFILE
180  # COUNT can mean per-event counting or a occupancy plot, which is acheived
181  # by ignoring the values passed to fill() (like dimensions=0, TODO).
182  if self._state == FIRST:
183  if sort != "COUNT":
184  raise Exception("First statement must be groupBy.")
185  self.spec[0].type = COUNT # this is actually a noop
186  # groupBy already saw the "Event" column and set up counting.
187 
188  return self
189 
190  if self._state == STAGE1:
191  if sort == "MEAN":
192  self.spec.append(cms.PSet(
193  type = PROFILE, stage = STAGE1,
194  columns = cms.vstring(), arg = cms.string("")
195  ))
196  return self
197 
198  if sort != "MEAN":
199  raise Exception("Harvesting allows only reduce(MEAN) at the moment, not " + sort)
200 
201  self.spec.append(cms.PSet(
202  type = REDUCE,
203  stage = self._state,
204  columns = cms.vstring(),
205  arg = cms.string(sort)
206  ))
207  return self
208 
def SpecificationBuilder_cfi.Specification.save (   self)

Definition at line 209 of file SpecificationBuilder_cfi.py.

References SpecificationBuilder_cfi.Specification._state, hcaldqm::flag::Flag._state, and harvestTrackValidationPlots.str.

Referenced by Vispa.Main.TabController.TabController.allowClose(), Vispa.Main.TabController.TabController.checkModificationTimestamp(), and SpecificationBuilder_cfi.Specification.saveAll().

209  def save(self):
210  if self._state == FIRST:
211  raise Exception("First statement must be groupBy.")
212 
213  if self._state == STAGE1:
214  # end of STAGE1, fix the parameter assignments
215  n = 1
216  if self._x.type == USE_X: self._x.arg = cms.string(str(n)); n = n+1
217  if self._y.type == USE_Y: self._y.arg = cms.string(str(n)); n = n+1
218  if self._z.type == USE_Z: self._z.arg = cms.string(str(n)); n = n+1
219  # we don't know how many parameters the user wants to pass here, but the
220  # HistogramManager knows. So we just add 3.
221 
222  # SAVE is implicit in step1 and ignored in harvesting, so not really needed.
223  #self.spec.append(cms.PSet(
224  # type = SAVE,
225  # stage = self._state,
226  # columns = cms.vstring(),
227  # arg = cms.string("")
228  #))
229  self._state = STAGE2
230  return self
231 
def SpecificationBuilder_cfi.Specification.saveAll (   self)

Member Data Documentation

SpecificationBuilder_cfi.Specification._activeColumns
private
SpecificationBuilder_cfi.Specification._lastColumns
private
SpecificationBuilder_cfi.Specification._lastMode
private
SpecificationBuilder_cfi.Specification._x
private

Definition at line 154 of file SpecificationBuilder_cfi.py.

Referenced by plotting.PlotText.Draw().

SpecificationBuilder_cfi.Specification._y
private

Definition at line 160 of file SpecificationBuilder_cfi.py.

Referenced by plotting.PlotText.Draw().

SpecificationBuilder_cfi.Specification._z
private

Definition at line 166 of file SpecificationBuilder_cfi.py.

SpecificationBuilder_cfi.Specification.conf