CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FSQHLTOfflineSource_cfi.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 import math
3 #
4 # see https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuidePhysicsCutParser
5 #
6 # trigger condition - check if trigger matching this pattern string was fired
7 # empty string - dont check anything
8 #
9 #
10 # handler of type "fromHLT" fetches products of filter with name matching
11 # the partialFilterName string, that was run inside path with name matching
12 # the partialPathName
13 #
14 # other handlers read data from collection pointed by inputCol parameter
15 # (partialFilterName, partialPathName params are ignored)
16 #
17 # note: be extra carefull when using singleObject and combinedObject drawables in same
18 # handler definition. Histo names may be the same, currently there is no protection against it
19 #
21  ret=cms.VPSet()
22  partialPathName = "HLT_ZeroBias_SinglePixelTrack_v"
23  hltPixelTracksZB = cms.PSet(
24  triggerSelection = cms.string(partialPathName+"*"),
25  handlerType = cms.string("FromHLT"),
26  partialPathName = cms.string(partialPathName),
27  partialFilterName = cms.string("hltMinBiasPixelFilt"),
28  dqmhistolabel = cms.string("hltPixelTracks"),
29  mainDQMDirname = cms.untracked.string(fsqdirname),
30  singleObjectsPreselection = cms.string("1==1"),
31  singleObjectDrawables = cms.VPSet(
32  cms.PSet (name = cms.string("pt"), expression = cms.string("pt"), bins = cms.int32(50), min = cms.double(0.4), max = cms.double(10)),
33  cms.PSet (name = cms.string("eta"), expression = cms.string("eta"), bins = cms.int32(100), min = cms.double(-2.5), max = cms.double(2.5)),
34  cms.PSet (name = cms.string("phi"), expression = cms.string("phi"), bins = cms.int32(100), min = cms.double(-3.15), max = cms.double(3.15))
35  ),
36  combinedObjectSelection = cms.string("1==1"),
37  combinedObjectSortCriteria = cms.string("at(0).pt"),
38  combinedObjectDimension = cms.int32(1),
39  combinedObjectDrawables = cms.VPSet()
40  )
41  ret.append(hltPixelTracksZB)
42 
43  # note: for global efficiency (ie not efficiency as a funtion of something)
44  # calculation we use RecoTrack handler in a bit twisted way.
45  # RecoTrack handler assumes, that the efficiency calculation is done
46  # only for events with at least one offline track (from generalTracks collection)
47  # passing the selection criteria from singleObjectsPreselection variable
48  # Such events are used to fill 1-bin-large-histogram with a range -0.5...0.5
49  # Note, that the histogram is always filled with the 0 value ("0*" part in
50  # expression string). The "at(0).pt()" part is needed to make expression parses
51  # happy.
52  tracksCountZB = cms.PSet(
53  triggerSelection = cms.string(partialPathName+"*"),
54  handlerType = cms.string("RecoTrack"),
55  inputCol = cms.InputTag("generalTracks"),
56  # l parameters
57  partialPathName = cms.string(partialPathName),
58  partialFilterName = cms.string("hltL1sETT"),
59  dqmhistolabel = cms.string("zb"),
60  mainDQMDirname = cms.untracked.string(fsqdirname),
61  singleObjectsPreselection = cms.string("pt > 0.4 && abs(eta) < 2.4"),
62  singleObjectDrawables = cms.VPSet(),
63  combinedObjectSelection = cms.string("1==1"),
64  combinedObjectSortCriteria = cms.string('at(0).pt()'), # doesnt matter
65  combinedObjectDimension = cms.int32(1),
66  combinedObjectDrawables = cms.VPSet(
67  cms.PSet (name = cms.string("Eff_nominator"), expression = cms.string('0*at(0).pt()'),
68  bins = cms.int32(1), min = cms.double(-0.5), max = cms.double(0.5))
69  )
70  )
71  ret.append(tracksCountZB)
72  tracksCountDenomZB = tracksCountZB.clone()
73  tracksCountDenomZB.triggerSelection = cms.string("HLT_ZeroBias_v*")
74  tracksCountDenomZB.combinedObjectDrawables = cms.VPSet(
75  cms.PSet (name = cms.string("Eff_denominator"), expression = cms.string("0*at(0).pt()"),
76  bins = cms.int32(1), min = cms.double(-0.5), max = cms.double(0.5))
77  )
78  ret.append(tracksCountDenomZB)
79 
80  return ret
81 
83  ret=cms.VPSet()
84  thresholds = [60, 85, 110, 135, 160]
85  for t in thresholds:
86  partialPathName = "HLT_PixelTracks_Multiplicity"+str(t)+"_v"
87  tracksL = 0
88  tracksH = 200
89  tracksBins = (tracksH-tracksL)/5
90  tracksCount = cms.PSet(
91  triggerSelection = cms.string(partialPathName+"*"),
92  handlerType = cms.string("RecoTrackCounterWithVertexConstraint"),
93  inputCol = cms.InputTag("generalTracks"),
94  # l parameters
95  vtxCollection = cms.InputTag("offlinePrimaryVertices"),
96  minNDOF = cms.int32(7),
97  maxZ = cms.double(15),
98  maxDZ = cms.double(0.12),
99  maxDZ2dzsigma = cms.double(3),
100  maxDXY = cms.double(0.12),
101  maxDXY2dxysigma = cms.double(3),
102  partialPathName = cms.string(partialPathName),
103  partialFilterName = cms.string("hltL1sETT"),
104  #dqmhistolabel = cms.string("hltPixelTracks"),
105  dqmhistolabel = cms.string("recoTracks"),
106  mainDQMDirname = cms.untracked.string(fsqdirname),
107  singleObjectsPreselection = cms.string("pt > 0.4 && abs(eta) < 2.4"),
108  singleObjectDrawables = cms.VPSet(),
109  combinedObjectSelection = cms.string("1==1"),
110  combinedObjectSortCriteria = cms.string('size()'),
111  combinedObjectDimension = cms.int32(1),
112  combinedObjectDrawables = cms.VPSet(
113  cms.PSet (name = cms.string("count_nominator"), expression = cms.string('at(0)'),
114  bins = cms.int32(tracksBins), min = cms.double(tracksL), max = cms.double(tracksH))
115  )
116  )
117  ret.append(tracksCount)
118 
119  tracksCountDenom = tracksCount.clone()
120  tracksCountDenom.triggerSelection = cms.string("TRUE")
121  tracksCountDenom.combinedObjectDrawables = cms.VPSet(
122  cms.PSet (name = cms.string("count_denominator"), expression = cms.string("at(0)"),
123  bins = cms.int32(tracksBins), min = cms.double(tracksL), max = cms.double(tracksH))
124  )
125  ret.append(tracksCountDenom)
126 
127 
128  hltPixelTracks = cms.PSet(
129  triggerSelection = cms.string(partialPathName+"*"),
130  handlerType = cms.string("FromHLT"),
131  partialPathName = cms.string(partialPathName),
132  partialFilterName = cms.string("hlt1HighMult"),
133  dqmhistolabel = cms.string("hltPixelTracks"),
134  mainDQMDirname = cms.untracked.string(fsqdirname),
135  singleObjectsPreselection = cms.string("1==1"),
136  singleObjectDrawables = cms.VPSet(
137  cms.PSet (name = cms.string("pt"), expression = cms.string("pt"), bins = cms.int32(200), min = cms.double(0.0), max = cms.double(10)),
138  cms.PSet (name = cms.string("eta"), expression = cms.string("eta"), bins = cms.int32(100), min = cms.double(-2.5), max = cms.double(2.5)),
139  cms.PSet (name = cms.string("phi"), expression = cms.string("phi"), bins = cms.int32(100), min = cms.double(-3.15), max = cms.double(3.15))
140  ),
141  combinedObjectSelection = cms.string("1==1"),
142  combinedObjectSortCriteria = cms.string("at(0).pt"),
143  combinedObjectDimension = cms.int32(1),
144  combinedObjectDrawables = cms.VPSet()
145  )
146  ret.append(hltPixelTracks)
147 
148  hltPixelTracksEta16to18 = hltPixelTracks.clone()
149  hltPixelTracksEta16to18.singleObjectsPreselection='abs(eta) > 1.6 && abs(eta) < 1.8'
150  hltPixelTracksEta16to18.dqmhistolabel = cms.string("hltPixelTracksEta16to18")
151  for i in hltPixelTracksEta16to18.singleObjectDrawables:
152  if i.name == "eta":
153  hltPixelTracksEta16to18.singleObjectDrawables.remove(i)
154 
155  ret.append(hltPixelTracksEta16to18)
156 
157  # FIXME: what variables it makes sense to plot in case of ETT seeds?
158  l1 = cms.PSet(
159  triggerSelection = cms.string(partialPathName+"*"),
160  handlerType = cms.string("FromHLT"),
161  partialPathName = cms.string(partialPathName),
162  partialFilterName = cms.string("hltL1sETT"),
163  dqmhistolabel = cms.string("l1"),
164  mainDQMDirname = cms.untracked.string(fsqdirname),
165  singleObjectsPreselection = cms.string("1==1"),
166  singleObjectDrawables = cms.VPSet(),
167  combinedObjectSelection = cms.string("1==1"),
168  combinedObjectSortCriteria = cms.string("at(0).pt"),
169  combinedObjectDimension = cms.int32(1),
170  combinedObjectDrawables = cms.VPSet(
171  cms.PSet (name = cms.string("pt"), expression = cms.string("at(0).pt"), bins = cms.int32(256/4), min = cms.double(0), max = cms.double(256)),
172  )
173  )
174  ret.append(l1)
175 
176 
177 
178  return ret
179 
180 
181 # note: always give integer values (!)
182 def getPTAveVPSet(thresholds = [30, 60, 80, 100, 160, 220, 300], flavour="HFJEC", disableCalo = False):
183  # HLT_DiPFJetAve35_HFJEC_v1
184  # HLT_DiPFJetAve15_Central_v1
185  if flavour == "HFJEC":
186  probeEtaSelection = "abs(eta) > 2.7"
187  probeEtaSelectionCombined = "abs(at(1).eta) > 2.7"
188  elif flavour == "Central":
189  probeEtaSelection = "abs(eta) < 2.7"
190  probeEtaSelectionCombined = "abs(at(1).eta) < 2.7"
191  else:
192  raise Exception("Flavour not known "+ flavour)
193  ret=cms.VPSet()
194  for t in thresholds:
195  #partialPathName = "HLT_DiPFJetAve"+ str(t) +"_HFJEC_"
196  partialPathName = "HLT_DiPFJetAve"+ str(t)+"_" + flavour + "_v"
197 
198  ptBinLow = t/2
199  ptBinHigh = max(100, t*2)
200  ptBins = min(100, ptBinHigh-ptBinLow)
201 
202 
203  if not disableCalo:
204  hltCalo = cms.PSet(
205  triggerSelection = cms.string(partialPathName+"*"),
206  handlerType = cms.string("FromHLT"),
207  partialPathName = cms.string(partialPathName),
208  partialFilterName = cms.string("ForHFJECBase"), # note: this matches to hltSingleCaloJetXXXForHFJECBase
209  dqmhistolabel = cms.string("hltCaloJets"),
210  mainDQMDirname = cms.untracked.string(fsqdirname),
211  singleObjectsPreselection = cms.string("abs(eta)<1.4 || " + probeEtaSelection),
212  singleObjectDrawables = cms.VPSet(),
213  combinedObjectSelection = cms.string("1==1"),
214  combinedObjectSortCriteria = cms.string("at(0).pt"),
215  combinedObjectDimension = cms.int32(1),
216  combinedObjectDrawables = cms.VPSet(
217  cms.PSet (name = cms.string("pt"), expression = cms.string("at(0).pt"), bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
218  cms.PSet (name = cms.string("eta"), expression = cms.string("at(0).eta"), bins = cms.int32(104), min = cms.double(-5.2), max = cms.double(5.2))
219  )
220  )
221  ret.append(hltCalo)
222 
223  l1 = cms.PSet(
224  triggerSelection = cms.string(partialPathName+"*"),
225  handlerType = cms.string("FromHLT"),
226  partialPathName = cms.string(partialPathName),
227  partialFilterName = cms.string("hltL1"),
228  dqmhistolabel = cms.string("l1"),
229  mainDQMDirname = cms.untracked.string(fsqdirname),
230  singleObjectsPreselection = cms.string("1==1"),
231  singleObjectDrawables = cms.VPSet(),
232  combinedObjectSelection = cms.string("1==1"),
233  combinedObjectSortCriteria = cms.string("at(0).pt"),
234  combinedObjectDimension = cms.int32(1),
235  combinedObjectDrawables = cms.VPSet(
236  cms.PSet (name = cms.string("pt"), expression = cms.string("at(0).pt"), bins = cms.int32(256/4), min = cms.double(0), max = cms.double(256)),
237  cms.PSet (name = cms.string("eta"), expression = cms.string("at(0).eta"), bins = cms.int32(104/4), min = cms.double(-5.2), max = cms.double(5.2))
238  )
239  )
240  ret.append(l1)
241 
242  '''
243  hltPFSingle = cms.PSet(
244  triggerSelection = cms.string(partialPathName+"*"),
245  handlerType = cms.string("FromHLT"),
246  partialPathName = cms.string(partialPathName),
247  partialFilterName = cms.string("hltDiPFJetAve"),
248  dqmhistolabel = cms.string("hltpfsingle"),
249  mainDQMDirname = cms.untracked.string(fsqdirname),
250  singleObjectsPreselection = cms.string("abs(eta)<1.4 || abs(eta) > 2.7 "),
251  singleObjectDrawables = cms.VPSet(),
252  combinedObjectSelection = cms.string("1==1"),
253  combinedObjectSortCriteria = cms.string("at(0).pt"),
254  combinedObjectDimension = cms.int32(1),
255  combinedObjectDrawables = cms.VPSet(
256  cms.PSet (name = cms.string("pt"), expression = cms.string("at(0).pt"), bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
257  cms.PSet (name = cms.string("eta"), expression = cms.string("at(0).eta"), bins = cms.int32(104), min = cms.double(-5.2), max = cms.double(5.2))
258  )
259  )
260  ret.append(hltPFSingle)
261  '''
262 
263 
264  hltPFtopology = cms.PSet(
265  triggerSelection = cms.string(partialPathName+"*"),
266  handlerType = cms.string("FromHLT"),
267  partialPathName = cms.string(partialPathName),
268  partialFilterName = cms.string("hltDiPFJetAve"),
269  dqmhistolabel = cms.string("hltPFJetsTopology"),
270  mainDQMDirname = cms.untracked.string(fsqdirname),
271  singleObjectsPreselection = cms.string("abs(eta)<1.4 || " + probeEtaSelection),
272  singleObjectDrawables = cms.VPSet(),
273  combinedObjectSelection = cms.string("abs(at(0).eta())< 1.4 && "+ probeEtaSelectionCombined +
274  " && abs(deltaPhi(at(0).phi, at(1).phi)) > 2.5"),
275  combinedObjectSortCriteria = cms.string("(at(0).pt+at(1).pt)/2"),
276  combinedObjectDimension = cms.int32(2),
277  combinedObjectDrawables = cms.VPSet(
278  cms.PSet (name = cms.string("deltaEta"), expression = cms.string("abs(at(0).eta-at(1).eta)"),
279  bins = cms.int32(70), min = cms.double(0), max = cms.double(7)),
280  cms.PSet (name = cms.string("deltaPhi"), expression = cms.string("abs(deltaPhi(at(0).phi, at(1).phi))"),
281  bins = cms.int32(100), min = cms.double(0), max = cms.double(3.2)),
282  cms.PSet (name = cms.string("ptAve"), expression = cms.string("(at(0).pt+at(1).pt)/2"),
283  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
284  cms.PSet (name = cms.string("ptTag"), expression =
285  cms.string("? abs(at(0).eta) < abs(at(1).eta) ? at(0).pt : at(1).pt "),
286  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) ),
287  cms.PSet (name = cms.string("ptProbe"), expression =
288  cms.string("? abs(at(0).eta) < abs(at(1).eta) ? at(1).pt : at(0).pt "),
289  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) )
290  )
291  )
292  ret.append(hltPFtopology)
293 
294 
295 
296 
297  '''
298  # FromJet
299  recoThr = t
300  recoPF = cms.PSet(
301  triggerSelection = cms.string(partialPathName+"*"),
302  handlerType = cms.string("FromRecoCandidate"),
303  inputCol = cms.InputTag("ak4PFJetsCHS"),
304  partialPathName = cms.string(partialPathName),
305  partialFilterName = cms.string("hltDiPFJetAve"),
306  dqmhistolabel = cms.string("recoJet"),
307  mainDQMDirname = cms.untracked.string(fsqdirname),
308  singleObjectsPreselection = cms.string("pt > + "+str(recoThr) +" && (abs(eta)<1.3 || abs(eta) > 2.8) "),
309  singleObjectDrawables = cms.VPSet(),
310  combinedObjectSelection = cms.string("1==1"),
311  combinedObjectSortCriteria = cms.string("at(0).pt"),
312  combinedObjectDimension = cms.int32(1),
313  combinedObjectDrawables = cms.VPSet(
314  cms.PSet (name = cms.string("pt"), expression = cms.string("at(0).pt"), bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
315  cms.PSet (name = cms.string("eta"), expression = cms.string("at(0).eta"), bins = cms.int32(52), min = cms.double(-5.2), max = cms.double(5.2))
316  )
317  )
318  ret.append(recoPF)
319  '''
320  recoThr = t/2
321  recoPFtopology = cms.PSet(
322  triggerSelection = cms.string(partialPathName+"*"),
323  handlerType = cms.string("RecoPFJetWithJEC"),
324  PFJetCorLabel = cms.InputTag("ak4PFL1FastL2L3Corrector"),
325  inputCol = cms.InputTag("ak4PFJetsCHS"),
326  partialPathName = cms.string(partialPathName),
327  partialFilterName = cms.string("hltDiPFJetAve"),
328  dqmhistolabel = cms.string("recoPFJetsTopology"),
329  mainDQMDirname = cms.untracked.string(fsqdirname),
330  singleObjectsPreselection = cms.string("pt > "+str(recoThr) +" && (abs(eta)<1.4 ||"+probeEtaSelection + ")" ),
331  singleObjectDrawables = cms.VPSet(),
332  combinedObjectSelection = cms.string("abs(at(0).eta())< 1.3 && " + probeEtaSelectionCombined +
333  " && abs(deltaPhi(at(0).phi, at(1).phi)) > 2.5"),
334  combinedObjectSortCriteria = cms.string("(at(0).pt+at(1).pt)/2"),
335  combinedObjectDimension = cms.int32(2),
336  combinedObjectDrawables = cms.VPSet(
337  cms.PSet (name = cms.string("deltaEta"), expression = cms.string("abs(at(0).eta-at(1).eta)"),
338  bins = cms.int32(70), min = cms.double(0), max = cms.double(7)),
339  cms.PSet (name = cms.string("deltaPhi"), expression = cms.string("abs(deltaPhi(at(0).phi, at(1).phi))"),
340  bins = cms.int32(100), min = cms.double(0), max = cms.double(3.2)),
341  cms.PSet (name = cms.string("ptAve"), expression = cms.string("(at(0).pt+at(1).pt)/2"),
342  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
343  cms.PSet (name = cms.string("ptTag"), expression =
344  cms.string("? abs(at(0).eta) < abs(at(1).eta) ? at(0).pt : at(1).pt "),
345  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) ),
346  cms.PSet (name = cms.string("ptProbe"), expression =
347  cms.string("? abs(at(0).eta) < abs(at(1).eta) ? at(1).pt : at(0).pt "),
348  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) ),
349  cms.PSet (name = cms.string("ptAve_nominator"), expression = cms.string("(at(0).pt+at(1).pt)/2"),
350  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) ),
351  )
352  )
353  ret.append(recoPFtopology)
354  recoPFtopologyDenom = recoPFtopology.clone()
355  #recoPFtopologyDenom.triggerSelection = cms.string("HLTriggerFirstPath*")
356  #recoPFtopologyDenom.triggerSelection = cms.string(partialPathName+"*")
357  recoPFtopologyDenom.triggerSelection = cms.string("TRUE")
358  recoPFtopologyDenom.combinedObjectDrawables = cms.VPSet(
359  cms.PSet (name = cms.string("ptAve_denominator"), expression = cms.string("(at(0).pt+at(1).pt)/2"),
360  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) )
361  )
362  ret.append(recoPFtopologyDenom)
363 
364  # RecoCandidateCounter
365  ''' example on how to count objects
366  recoThr = t/2
367  recoPFJetCnt = cms.PSet(
368  triggerSelection = cms.string(partialPathName+"*"),
369  handlerType = cms.string("RecoCandidateCounter"),
370  inputCol = cms.InputTag("ak4PFJetsCHS"),
371  partialPathName = cms.string(partialPathName),
372  partialFilterName = cms.string("hltDiPFJetAve"),
373  dqmhistolabel = cms.string("recoPFJetsCnt"),
374  mainDQMDirname = cms.untracked.string(fsqdirname),
375  singleObjectsPreselection = cms.string("pt > "+str(recoThr) +" && abs(eta)<1.4 || abs(eta) > 2.7 "),
376  singleObjectDrawables = cms.VPSet(),
377  combinedObjectSelection = cms.string("1==1"),
378  combinedObjectSortCriteria = cms.string('size()'),
379  combinedObjectDimension = cms.int32(1),
380  combinedObjectDrawables = cms.VPSet(
381  cms.PSet (name = cms.string("count"), expression = cms.string('at(0)'),
382  bins = cms.int32(30), min = cms.double(0), max = cms.double(30))
383  )
384  )
385  ret.append(recoPFJetCnt)
386  '''
387 
388  return ret
389 
390 # note: thresholds should be a list with integer only values
391 def getSinglePFJet(thresholds, flavour=None, etaMin=-1, srcType="genJets", partialPathName = "HLT_PFJet", disableEff = False):
392  if srcType == "genJets":
393  inputCol = cms.InputTag("ak4GenJets")
394  handlerType = "FromRecoCandidate"
395  label = srcType
396  elif srcType == "ak4PFJetsCHS":
397  inputCol = cms.InputTag("ak4PFJetsCHS")
398  handlerType = "RecoPFJetWithJEC"
399  label = srcType
400  elif srcType == "hlt":
401  inputCol = cms.InputTag("S")
402  handlerType = "FromHLT"
403  label = srcType
404  else:
405  raise Exception("Whooops!")
406 
407  if etaMin == None:
408  etaMin = -1
409 
410  ret=cms.VPSet()
411  for t in thresholds:
412  partialPathNameLoc = partialPathName
413  partialPathNameLoc += str(t)+"_"
414  if flavour != None:
415  partialPathNameLoc += flavour+"_"
416  partialPathNameLoc += "v"
417 
418  marginLow = max(t-t/2, 15)
419  ptBinLow = max(t-marginLow,0)
420  marginHigh = min(max(t/2, 20), 50)
421  ptBinHigh = t+marginHigh
422  ptBins = min(100, ptBinHigh-ptBinLow)
423  fromJets = cms.PSet(
424  triggerSelection = cms.string(partialPathNameLoc+"*"),
425  handlerType = cms.string(handlerType),
426  PFJetCorLabel = cms.InputTag("ak4PFL1FastL2L3Corrector"),
427  inputCol = inputCol,
428  # inputCol = cms.InputTag("ak4PFJetsCHS"),
429  partialPathName = cms.string(partialPathNameLoc),
430  partialFilterName = cms.string("hltSinglePFJet"),
431  dqmhistolabel = cms.string(label),
432  mainDQMDirname = cms.untracked.string(fsqdirname),
433  singleObjectsPreselection = cms.string("abs(eta) < 5.5 && abs(eta) > " + str(etaMin) ),
434  singleObjectDrawables = cms.VPSet(),
435  combinedObjectSelection = cms.string("1==1"),
436  combinedObjectSortCriteria = cms.string("at(0).pt"),
437  combinedObjectDimension = cms.int32(1),
438  combinedObjectDrawables = cms.VPSet(
439  cms.PSet (name = cms.string("pt"), expression = cms.string("at(0).pt"),
440  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
441  cms.PSet (name = cms.string("eta"), expression = cms.string("at(0).eta"),
442  bins = cms.int32(52), min = cms.double(-5.2), max = cms.double(5.2)),
443  cms.PSet (name = cms.string("pt_nominator"), expression = cms.string("at(0).pt"),
444  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) )
445  )
446  )
447  if disableEff:
448  for p in fromJets.combinedObjectDrawables:
449  if p.name == cms.string("pt_nominator"):
450  fromJets.combinedObjectDrawables.remove(p)
451  break
452  else:
453  fromJetsDenom = fromJets.clone()
454  fromJetsDenom.triggerSelection = cms.string("HLT_ZeroBias_v*")
455  fromJetsDenom.singleObjectDrawables = cms.VPSet()
456  fromJetsDenom.combinedObjectDrawables = cms.VPSet(
457  cms.PSet (name = cms.string("pt_denominator"), expression = cms.string("at(0).pt"),
458  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) )
459  )
460  ret.append(fromJetsDenom)
461  ret.append(fromJets)
462  return ret
463 
464 # note: thresholds should be a list with integer only values
465 # fixme: most of the code repeated from single jet case above
466 def getDoublePFJet(thresholds, flavour=None, etaMin=-1, srcType="genJets" ):
467  if srcType == "genJets":
468  inputCol = cms.InputTag("ak4GenJets")
469  handlerType = "FromRecoCandidate"
470  label = srcType
471  elif srcType == "ak4PFJetsCHS":
472  inputCol = cms.InputTag("ak4PFJetsCHS")
473  handlerType = "RecoPFJetWithJEC"
474  label = srcType
475  elif srcType == "hlt":
476  inputCol = cms.InputTag("S")
477  handlerType = "FromHLT"
478  label = srcType
479  else:
480  raise Exception("Whooops!")
481 
482  combinedObjectSortCriteria = "at(0).pt + at(1).pt"
483  combinedObjectSelection = "1 == 1"
484  if flavour != None and "FB" in flavour :
485  combinedObjectSortCriteria = "("+combinedObjectSortCriteria+")*( ? at(0).eta*at(1).eta < 0 ? 1 : 0 )"
486  combinedObjectSelection = "at(0).eta*at(1).eta < 0"
487 
488  if etaMin == None:
489  etaMin = -1
490 
491  ret=cms.VPSet()
492  for t in thresholds:
493  partialPathName = "HLT_DiPFJet"+ str(t)+"_"
494  if flavour != None:
495  partialPathName += flavour+"_"
496  partialPathName += "v"
497 
498  marginLow = max(t-t/2, 15)
499  ptBinLow = max(t-marginLow,0)
500  marginHigh = min(max(t/3, 15), 50)
501  ptBinHigh = t+marginHigh
502  ptBins = min(100, ptBinHigh-ptBinLow)
503  fromJets = cms.PSet(
504  triggerSelection = cms.string(partialPathName+"*"),
505  handlerType = cms.string(handlerType),
506  PFJetCorLabel = cms.InputTag("ak4PFL1FastL2L3Corrector"),
507  inputCol = inputCol,
508  partialPathName = cms.string(partialPathName),
509  partialFilterName = cms.string("hltDoublePFJet"),
510  dqmhistolabel = cms.string(label),
511  mainDQMDirname = cms.untracked.string(fsqdirname),
512  singleObjectsPreselection = cms.string("abs(eta) < 5.5 && abs(eta) > " + str(etaMin) ),
513  #singleObjectsPreselection = cms.string("pt > 15 && abs(eta) < 5.5 && abs(eta) > " + str(etaMin) ),
514  singleObjectDrawables = cms.VPSet(),
515  combinedObjectSelection = cms.string(combinedObjectSelection),
516  combinedObjectSortCriteria = cms.string(combinedObjectSortCriteria),
517  combinedObjectDimension = cms.int32(2),
518  combinedObjectDrawables = cms.VPSet(
519  #cms.PSet (name = cms.string("ptLead"), expression = cms.string("max(at(0).pt, at(1).pt())"),
520  # bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
521  #cms.PSet (name = cms.string("ptSublead"), expression = cms.string("min(at(0).pt, at(1).pt())"),
522  # bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
523  cms.PSet (name = cms.string("ptMostFwd"),
524  expression = cms.string("? at(0).eta > at(1).eta ? at(0).pt : at(1).pt"),
525  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
526  cms.PSet (name = cms.string("ptMostBkw"),
527  expression = cms.string("? at(0).eta > at(1).eta ? at(1).pt : at(0).pt"),
528  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
529 
530  cms.PSet (name = cms.string("etaMostFwd"),
531  expression = cms.string("? at(0).eta > at(1).eta ? at(0).eta : at(1).eta"),
532  bins = cms.int32(52), min = cms.double(-5.2), max = cms.double(5.2)),
533  cms.PSet (name = cms.string("etaMostBkw"),
534  expression = cms.string("? at(0).eta > at(1).eta ? at(1).eta : at(0).eta"),
535  bins = cms.int32(52), min = cms.double(-5.2), max = cms.double(5.2)),
536  #cms.PSet (name = cms.string("pt_nominator"), expression = cms.string("min(at(0).pt, at(1).pt)"),
537  # bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) )
538  )
539  )
540  #fromJets.triggerSelection = cms.string("HLT_ZeroBias_v*")
541  ret.append(fromJets)
542  if srcType != "hlt":
543  fromJets.combinedObjectDrawables.append( cms.PSet(name = cms.string("ptm_nominator"),
544  expression = cms.string("min(at(0).pt, at(1).pt)"),
545  bins = cms.int32(ptBins),
546  min = cms.double(ptBinLow),
547  max = cms.double(ptBinHigh) ))
548 
549  fromJetsDenom = fromJets.clone()
550  fromJetsDenom.triggerSelection = cms.string("HLT_ZeroBias_v*")
551  fromJetsDenom.singleObjectDrawables = cms.VPSet()
552  fromJetsDenom.combinedObjectDrawables = cms.VPSet(
553  cms.PSet (name = cms.string("ptm_denominator"), expression = cms.string("min(at(0).pt, at(1).pt)"),
554  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) )
555  )
556  ret.append(fromJetsDenom)
557 
558 
559  return ret
560 
561 def getFSQAll():
562  ret = cms.VPSet()
563  ret.extend(getHighMultVPSet())
565  ret.extend( getPTAveVPSet())
566 
567  ret.extend( getPTAveVPSet(thresholds = [15,25,35], disableCalo= True, flavour="HFJEC" ))
568  ret.extend( getPTAveVPSet(thresholds = [15,25,35], disableCalo= True, flavour="Central" ))
569  #todo = ["genJets", "ak4PFJetsCHS", "hlt"]
570  todo = ["ak4PFJetsCHS", "hlt"]
571  for t in todo:
572  ret.extend(getSinglePFJet([20], flavour="NoCaloMatched", etaMin=None, srcType=t))
573  ret.extend(getSinglePFJet([15, 25,40], flavour="NoCaloMatched", etaMin=None, srcType=t))
574  ret.extend(getSinglePFJet([15, 25,40], flavour="FwdEta2_NoCaloMatched", etaMin=2, srcType=t))
575  ret.extend(getSinglePFJet([15, 25,40], flavour="FwdEta3_NoCaloMatched", etaMin=3, srcType=t))
576 
577  ret.extend(getDoublePFJet([15], flavour="NoCaloMatched", etaMin=None, srcType=t))
578  ret.extend(getDoublePFJet([15], flavour="FBEta2_NoCaloMatched", etaMin=2, srcType=t))
579  ret.extend(getDoublePFJet([15], flavour="FBEta3_NoCaloMatched", etaMin=3, srcType=t))
580 
581  ret.extend(getSinglePFJet([15], partialPathName="HLT_L1Tech62_CASTORJet_SinglePFJet", srcType=t, disableEff=True))
582 
583 
584  return ret
585 
586 def getFSQHI():
587  ret = cms.VPSet()
589  #ret.extend(getHighMultVPSet())
590  return ret
591 
592 fsqdirname = "HLT/FSQ/"
593 
594 processName = "HLT"
595 #processName = "TEST"
596 
597 fsqHLTOfflineSource = cms.EDAnalyzer("FSQDiJetAve",
598  triggerConfiguration = cms.PSet(
599  hltResults = cms.InputTag('TriggerResults','',processName),
600  l1tResults = cms.InputTag(''),
601  #l1tResults = cms.InputTag('gtDigis'),
602  daqPartitions = cms.uint32(1),
603  l1tIgnoreMask = cms.bool( False ),
604  l1techIgnorePrescales = cms.bool( False ),
605  throw = cms.bool( False )
606  ),
607 
608  #dirname = cms.untracked.string("HLT/FSQ/DiJETAve/"),
609  triggerSummaryLabel = cms.InputTag("hltTriggerSummaryAOD","", processName),
610  triggerResultsLabel = cms.InputTag("TriggerResults","", processName),
611  useGenWeight = cms.bool(False),
612  #useGenWeight = cms.bool(True),
613  todo = cms.VPSet(getFSQAll())
614 )
615 
617 fsqHLTOfflineSourceSequence = cms.Sequence(ak4PFL1FastL2L3CorrectorChain + fsqHLTOfflineSource)
T min(T a, T b)
Definition: MathUtil.h:58