CMS 3D CMS Logo

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  triggerSelection = "HLT_ZeroBias_v*"
74  )
75  tracksCountDenomZB.combinedObjectDrawables = cms.VPSet(
76  cms.PSet (name = cms.string("Eff_denominator"), expression = cms.string("0*at(0).pt()"),
77  bins = cms.int32(1), min = cms.double(-0.5), max = cms.double(0.5))
78  )
79  ret.append(tracksCountDenomZB)
80 
81  return ret
82 
84  ret=cms.VPSet()
85  thresholds = [60, 85, 110, 135, 160]
86  for t in thresholds:
87  partialPathName = "HLT_PixelTracks_Multiplicity"+str(t)+"_v"
88  tracksL = 0
89  tracksH = 200
90  tracksBins = (tracksH-tracksL)//5
91  tracksCount = cms.PSet(
92  triggerSelection = cms.string(partialPathName+"*"),
93  handlerType = cms.string("RecoTrackCounterWithVertexConstraint"),
94  inputCol = cms.InputTag("generalTracks"),
95  # l parameters
96  vtxCollection = cms.InputTag("offlinePrimaryVertices"),
97  minNDOF = cms.int32(7),
98  maxZ = cms.double(15),
99  maxDZ = cms.double(0.12),
100  maxDZ2dzsigma = cms.double(3),
101  maxDXY = cms.double(0.12),
102  maxDXY2dxysigma = cms.double(3),
103  partialPathName = cms.string(partialPathName),
104  partialFilterName = cms.string("hltL1sETT"),
105  #dqmhistolabel = cms.string("hltPixelTracks"),
106  dqmhistolabel = cms.string("recoTracks"),
107  mainDQMDirname = cms.untracked.string(fsqdirname),
108  singleObjectsPreselection = cms.string("pt > 0.4 && abs(eta) < 2.4"),
109  singleObjectDrawables = cms.VPSet(),
110  combinedObjectSelection = cms.string("1==1"),
111  combinedObjectSortCriteria = cms.string('size()'),
112  combinedObjectDimension = cms.int32(1),
113  combinedObjectDrawables = cms.VPSet(
114  cms.PSet (name = cms.string("count_nominator"), expression = cms.string('at(0)'),
115  bins = cms.int32(tracksBins), min = cms.double(tracksL), max = cms.double(tracksH))
116  )
117  )
118  ret.append(tracksCount)
119 
120  tracksCountDenom = tracksCount.clone(
121  triggerSelection = "TRUE"
122  )
123  tracksCountDenom.combinedObjectDrawables = cms.VPSet(
124  cms.PSet (name = cms.string("count_denominator"), expression = cms.string("at(0)"),
125  bins = cms.int32(tracksBins), min = cms.double(tracksL), max = cms.double(tracksH))
126  )
127  ret.append(tracksCountDenom)
128 
129 
130  hltPixelTracks = cms.PSet(
131  triggerSelection = cms.string(partialPathName+"*"),
132  handlerType = cms.string("FromHLT"),
133  partialPathName = cms.string(partialPathName),
134  partialFilterName = cms.string("hlt1HighMult"),
135  dqmhistolabel = cms.string("hltPixelTracks"),
136  mainDQMDirname = cms.untracked.string(fsqdirname),
137  singleObjectsPreselection = cms.string("1==1"),
138  singleObjectDrawables = cms.VPSet(
139  cms.PSet (name = cms.string("pt"), expression = cms.string("pt"), bins = cms.int32(200), min = cms.double(0.0), max = cms.double(10)),
140  cms.PSet (name = cms.string("eta"), expression = cms.string("eta"), bins = cms.int32(100), min = cms.double(-2.5), max = cms.double(2.5)),
141  cms.PSet (name = cms.string("phi"), expression = cms.string("phi"), bins = cms.int32(100), min = cms.double(-3.15), max = cms.double(3.15))
142  ),
143  combinedObjectSelection = cms.string("1==1"),
144  combinedObjectSortCriteria = cms.string("at(0).pt"),
145  combinedObjectDimension = cms.int32(1),
146  combinedObjectDrawables = cms.VPSet()
147  )
148  ret.append(hltPixelTracks)
149 
150  hltPixelTracksEta16to18 = hltPixelTracks.clone(
151  singleObjectsPreselection='abs(eta) > 1.6 && abs(eta) < 1.8',
152  dqmhistolabel = "hltPixelTracksEta16to18"
153  )
154  for i in hltPixelTracksEta16to18.singleObjectDrawables:
155  if i.name == "eta":
156  hltPixelTracksEta16to18.singleObjectDrawables.remove(i)
157 
158  ret.append(hltPixelTracksEta16to18)
159 
160  # FIXME: what variables it makes sense to plot in case of ETT seeds?
161  l1 = cms.PSet(
162  triggerSelection = cms.string(partialPathName+"*"),
163  handlerType = cms.string("FromHLT"),
164  partialPathName = cms.string(partialPathName),
165  partialFilterName = cms.string("hltL1sETT"),
166  dqmhistolabel = cms.string("l1"),
167  mainDQMDirname = cms.untracked.string(fsqdirname),
168  singleObjectsPreselection = cms.string("1==1"),
169  singleObjectDrawables = cms.VPSet(),
170  combinedObjectSelection = cms.string("1==1"),
171  combinedObjectSortCriteria = cms.string("at(0).pt"),
172  combinedObjectDimension = cms.int32(1),
173  combinedObjectDrawables = cms.VPSet(
174  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)),
175  )
176  )
177  ret.append(l1)
178 
179 
180 
181  return ret
182 
183 
184 # note: always give integer values (!)
185 def getPTAveVPSet(thresholds = [30, 60, 80, 100, 160, 220, 300], flavour="HFJEC", disableCalo = False):
186  # HLT_DiPFJetAve35_HFJEC_v1
187  # HLT_DiPFJetAve15_Central_v1
188  if flavour == "HFJEC":
189  probeEtaSelection = "abs(eta) > 2.7"
190  probeEtaSelectionCombined = "abs(at(1).eta) > 2.7"
191  elif flavour == "Central":
192  probeEtaSelection = "abs(eta) < 2.7"
193  probeEtaSelectionCombined = "abs(at(1).eta) < 2.7"
194  else:
195  raise Exception("Flavour not known "+ flavour)
196  ret=cms.VPSet()
197  for t in thresholds:
198  #partialPathName = "HLT_DiPFJetAve"+ str(t) +"_HFJEC_"
199  partialPathName = "HLT_DiPFJetAve"+ str(t)+"_" + flavour + "_v"
200 
201  ptBinLow = t//2
202  ptBinHigh = max(100, t*2)
203  ptBins = min(100, ptBinHigh-ptBinLow)
204 
205 
206  if not disableCalo:
207  hltCalo = cms.PSet(
208  triggerSelection = cms.string(partialPathName+"*"),
209  handlerType = cms.string("FromHLT"),
210  partialPathName = cms.string(partialPathName),
211  partialFilterName = cms.string("ForHFJECBase"), # note: this matches to hltSingleCaloJetXXXForHFJECBase
212  dqmhistolabel = cms.string("hltCaloJets"),
213  mainDQMDirname = cms.untracked.string(fsqdirname),
214  singleObjectsPreselection = cms.string("abs(eta)<1.4 || " + probeEtaSelection),
215  singleObjectDrawables = cms.VPSet(),
216  combinedObjectSelection = cms.string("1==1"),
217  combinedObjectSortCriteria = cms.string("at(0).pt"),
218  combinedObjectDimension = cms.int32(1),
219  combinedObjectDrawables = cms.VPSet(
220  cms.PSet (name = cms.string("pt"), expression = cms.string("at(0).pt"), bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
221  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))
222  )
223  )
224  ret.append(hltCalo)
225 
226  l1 = cms.PSet(
227  triggerSelection = cms.string(partialPathName+"*"),
228  handlerType = cms.string("FromHLT"),
229  partialPathName = cms.string(partialPathName),
230  partialFilterName = cms.string("hltL1"),
231  dqmhistolabel = cms.string("l1"),
232  mainDQMDirname = cms.untracked.string(fsqdirname),
233  singleObjectsPreselection = cms.string("1==1"),
234  singleObjectDrawables = cms.VPSet(),
235  combinedObjectSelection = cms.string("1==1"),
236  combinedObjectSortCriteria = cms.string("at(0).pt"),
237  combinedObjectDimension = cms.int32(1),
238  combinedObjectDrawables = cms.VPSet(
239  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)),
240  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))
241  )
242  )
243  ret.append(l1)
244 
245  '''
246  hltPFSingle = cms.PSet(
247  triggerSelection = cms.string(partialPathName+"*"),
248  handlerType = cms.string("FromHLT"),
249  partialPathName = cms.string(partialPathName),
250  partialFilterName = cms.string("hltDiPFJetAve"),
251  dqmhistolabel = cms.string("hltpfsingle"),
252  mainDQMDirname = cms.untracked.string(fsqdirname),
253  singleObjectsPreselection = cms.string("abs(eta)<1.4 || abs(eta) > 2.7 "),
254  singleObjectDrawables = cms.VPSet(),
255  combinedObjectSelection = cms.string("1==1"),
256  combinedObjectSortCriteria = cms.string("at(0).pt"),
257  combinedObjectDimension = cms.int32(1),
258  combinedObjectDrawables = cms.VPSet(
259  cms.PSet (name = cms.string("pt"), expression = cms.string("at(0).pt"), bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
260  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))
261  )
262  )
263  ret.append(hltPFSingle)
264  '''
265 
266 
267  hltPFtopology = cms.PSet(
268  triggerSelection = cms.string(partialPathName+"*"),
269  handlerType = cms.string("FromHLT"),
270  partialPathName = cms.string(partialPathName),
271  partialFilterName = cms.string("hltDiPFJetAve"),
272  dqmhistolabel = cms.string("hltPFJetsTopology"),
273  mainDQMDirname = cms.untracked.string(fsqdirname),
274  singleObjectsPreselection = cms.string("abs(eta)<1.4 || " + probeEtaSelection),
275  singleObjectDrawables = cms.VPSet(),
276  combinedObjectSelection = cms.string("abs(at(0).eta())< 1.4 && "+ probeEtaSelectionCombined +
277  " && abs(deltaPhi(at(0).phi, at(1).phi)) > 2.5"),
278  combinedObjectSortCriteria = cms.string("(at(0).pt+at(1).pt)/2"),
279  combinedObjectDimension = cms.int32(2),
280  combinedObjectDrawables = cms.VPSet(
281  cms.PSet (name = cms.string("deltaEta"), expression = cms.string("abs(at(0).eta-at(1).eta)"),
282  bins = cms.int32(70), min = cms.double(0), max = cms.double(7)),
283  cms.PSet (name = cms.string("deltaPhi"), expression = cms.string("abs(deltaPhi(at(0).phi, at(1).phi))"),
284  bins = cms.int32(100), min = cms.double(0), max = cms.double(3.2)),
285  cms.PSet (name = cms.string("ptAve"), expression = cms.string("(at(0).pt+at(1).pt)/2"),
286  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
287  cms.PSet (name = cms.string("ptTag"), expression =
288  cms.string("? abs(at(0).eta) < abs(at(1).eta) ? at(0).pt : at(1).pt "),
289  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) ),
290  cms.PSet (name = cms.string("ptProbe"), expression =
291  cms.string("? abs(at(0).eta) < abs(at(1).eta) ? at(1).pt : at(0).pt "),
292  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) )
293  )
294  )
295  ret.append(hltPFtopology)
296 
297 
298 
299 
300  '''
301  # FromJet
302  recoThr = t
303  recoPF = cms.PSet(
304  triggerSelection = cms.string(partialPathName+"*"),
305  handlerType = cms.string("FromRecoCandidate"),
306  inputCol = cms.InputTag("ak4PFJetsCHS"),
307  partialPathName = cms.string(partialPathName),
308  partialFilterName = cms.string("hltDiPFJetAve"),
309  dqmhistolabel = cms.string("recoJet"),
310  mainDQMDirname = cms.untracked.string(fsqdirname),
311  singleObjectsPreselection = cms.string("pt > + "+str(recoThr) +" && (abs(eta)<1.3 || abs(eta) > 2.8) "),
312  singleObjectDrawables = cms.VPSet(),
313  combinedObjectSelection = cms.string("1==1"),
314  combinedObjectSortCriteria = cms.string("at(0).pt"),
315  combinedObjectDimension = cms.int32(1),
316  combinedObjectDrawables = cms.VPSet(
317  cms.PSet (name = cms.string("pt"), expression = cms.string("at(0).pt"), bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
318  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))
319  )
320  )
321  ret.append(recoPF)
322  '''
323  recoThr = t//2
324  recoPFtopology = cms.PSet(
325  triggerSelection = cms.string(partialPathName+"*"),
326  handlerType = cms.string("RecoPFJetWithJEC"),
327  PFJetCorLabel = cms.InputTag("ak4PFL1FastL2L3Corrector"),
328  inputCol = cms.InputTag("ak4PFJetsCHS"),
329  partialPathName = cms.string(partialPathName),
330  partialFilterName = cms.string("hltDiPFJetAve"),
331  dqmhistolabel = cms.string("recoPFJetsTopology"),
332  mainDQMDirname = cms.untracked.string(fsqdirname),
333  singleObjectsPreselection = cms.string("pt > "+str(recoThr) +" && (abs(eta)<1.4 ||"+probeEtaSelection + ")" ),
334  singleObjectDrawables = cms.VPSet(),
335  combinedObjectSelection = cms.string("abs(at(0).eta())< 1.3 && " + probeEtaSelectionCombined +
336  " && abs(deltaPhi(at(0).phi, at(1).phi)) > 2.5"),
337  combinedObjectSortCriteria = cms.string("(at(0).pt+at(1).pt)/2"),
338  combinedObjectDimension = cms.int32(2),
339  combinedObjectDrawables = cms.VPSet(
340  cms.PSet (name = cms.string("deltaEta"), expression = cms.string("abs(at(0).eta-at(1).eta)"),
341  bins = cms.int32(70), min = cms.double(0), max = cms.double(7)),
342  cms.PSet (name = cms.string("deltaPhi"), expression = cms.string("abs(deltaPhi(at(0).phi, at(1).phi))"),
343  bins = cms.int32(100), min = cms.double(0), max = cms.double(3.2)),
344  cms.PSet (name = cms.string("ptAve"), expression = cms.string("(at(0).pt+at(1).pt)/2"),
345  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
346  cms.PSet (name = cms.string("ptTag"), expression =
347  cms.string("? abs(at(0).eta) < abs(at(1).eta) ? at(0).pt : at(1).pt "),
348  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) ),
349  cms.PSet (name = cms.string("ptProbe"), expression =
350  cms.string("? abs(at(0).eta) < abs(at(1).eta) ? at(1).pt : at(0).pt "),
351  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) ),
352  cms.PSet (name = cms.string("ptAve_nominator"), expression = cms.string("(at(0).pt+at(1).pt)/2"),
353  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) ),
354  )
355  )
356  ret.append(recoPFtopology)
357  recoPFtopologyDenom = recoPFtopology.clone(
358  #triggerSelection = "HLTriggerFirstPath*",
359  #triggerSelection = partialPathName+"*",
360  triggerSelection = "TRUE"
361  )
362  recoPFtopologyDenom.combinedObjectDrawables = cms.VPSet(
363  cms.PSet (name = cms.string("ptAve_denominator"), expression = cms.string("(at(0).pt+at(1).pt)/2"),
364  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) )
365  )
366  ret.append(recoPFtopologyDenom)
367 
368  # RecoCandidateCounter
369  ''' example on how to count objects
370  recoThr = t//2
371  recoPFJetCnt = cms.PSet(
372  triggerSelection = cms.string(partialPathName+"*"),
373  handlerType = cms.string("RecoCandidateCounter"),
374  inputCol = cms.InputTag("ak4PFJetsCHS"),
375  partialPathName = cms.string(partialPathName),
376  partialFilterName = cms.string("hltDiPFJetAve"),
377  dqmhistolabel = cms.string("recoPFJetsCnt"),
378  mainDQMDirname = cms.untracked.string(fsqdirname),
379  singleObjectsPreselection = cms.string("pt > "+str(recoThr) +" && abs(eta)<1.4 || abs(eta) > 2.7 "),
380  singleObjectDrawables = cms.VPSet(),
381  combinedObjectSelection = cms.string("1==1"),
382  combinedObjectSortCriteria = cms.string('size()'),
383  combinedObjectDimension = cms.int32(1),
384  combinedObjectDrawables = cms.VPSet(
385  cms.PSet (name = cms.string("count"), expression = cms.string('at(0)'),
386  bins = cms.int32(30), min = cms.double(0), max = cms.double(30))
387  )
388  )
389  ret.append(recoPFJetCnt)
390  '''
391 
392  return ret
393 
394 # note: thresholds should be a list with integer only values
395 def getSinglePFJet(thresholds, flavour=None, etaMin=-1, srcType="genJets", partialPathName = "HLT_PFJet", disableEff = False):
396  if srcType == "genJets":
397  inputCol = cms.InputTag("ak4GenJets")
398  handlerType = "FromRecoCandidate"
399  label = srcType
400  elif srcType == "ak4PFJetsCHS":
401  inputCol = cms.InputTag("ak4PFJetsCHS")
402  handlerType = "RecoPFJetWithJEC"
403  label = srcType
404  elif srcType == "hlt":
405  inputCol = cms.InputTag("S")
406  handlerType = "FromHLT"
407  label = srcType
408  else:
409  raise Exception("Whooops!")
410 
411  if etaMin == None:
412  etaMin = -1
413 
414  ret=cms.VPSet()
415  for t in thresholds:
416  partialPathNameLoc = partialPathName
417  partialPathNameLoc += str(t)+"_"
418  if flavour != None:
419  partialPathNameLoc += flavour+"_"
420  partialPathNameLoc += "v"
421 
422  marginLow = max(t-t//2, 15)
423  ptBinLow = max(t-marginLow,0)
424  marginHigh = min(max(t//2, 20), 50)
425  ptBinHigh = t+marginHigh
426  ptBins = min(100, ptBinHigh-ptBinLow)
427  fromJets = cms.PSet(
428  triggerSelection = cms.string(partialPathNameLoc+"*"),
429  handlerType = cms.string(handlerType),
430  PFJetCorLabel = cms.InputTag("ak4PFL1FastL2L3Corrector"),
431  inputCol = inputCol,
432  # inputCol = cms.InputTag("ak4PFJetsCHS"),
433  partialPathName = cms.string(partialPathNameLoc),
434  partialFilterName = cms.string("hltSinglePFJet"),
435  dqmhistolabel = cms.string(label),
436  mainDQMDirname = cms.untracked.string(fsqdirname),
437  singleObjectsPreselection = cms.string("abs(eta) < 5.5 && abs(eta) > " + str(etaMin) ),
438  singleObjectDrawables = cms.VPSet(),
439  combinedObjectSelection = cms.string("1==1"),
440  combinedObjectSortCriteria = cms.string("at(0).pt"),
441  combinedObjectDimension = cms.int32(1),
442  combinedObjectDrawables = cms.VPSet(
443  cms.PSet (name = cms.string("pt"), expression = cms.string("at(0).pt"),
444  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
445  cms.PSet (name = cms.string("eta"), expression = cms.string("at(0).eta"),
446  bins = cms.int32(52), min = cms.double(-5.2), max = cms.double(5.2)),
447  cms.PSet (name = cms.string("pt_nominator"), expression = cms.string("at(0).pt"),
448  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) )
449  )
450  )
451  if disableEff:
452  for p in fromJets.combinedObjectDrawables:
453  if p.name == cms.string("pt_nominator"):
454  fromJets.combinedObjectDrawables.remove(p)
455  break
456  else:
457  fromJetsDenom = fromJets.clone(
458  triggerSelection = "HLT_ZeroBias_v*"
459  )
460  fromJetsDenom.singleObjectDrawables = cms.VPSet()
461  fromJetsDenom.combinedObjectDrawables = cms.VPSet(
462  cms.PSet (name = cms.string("pt_denominator"), expression = cms.string("at(0).pt"),
463  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) )
464  )
465  ret.append(fromJetsDenom)
466  ret.append(fromJets)
467  return ret
468 
469 # note: thresholds should be a list with integer only values
470 # fixme: most of the code repeated from single jet case above
471 def getDoublePFJet(thresholds, flavour=None, etaMin=-1, srcType="genJets" ):
472  if srcType == "genJets":
473  inputCol = cms.InputTag("ak4GenJets")
474  handlerType = "FromRecoCandidate"
475  label = srcType
476  elif srcType == "ak4PFJetsCHS":
477  inputCol = cms.InputTag("ak4PFJetsCHS")
478  handlerType = "RecoPFJetWithJEC"
479  label = srcType
480  elif srcType == "hlt":
481  inputCol = cms.InputTag("S")
482  handlerType = "FromHLT"
483  label = srcType
484  else:
485  raise Exception("Whooops!")
486 
487  combinedObjectSortCriteria = "at(0).pt + at(1).pt"
488  combinedObjectSelection = "1 == 1"
489  if flavour != None and "FB" in flavour :
490  combinedObjectSortCriteria = "("+combinedObjectSortCriteria+")*( ? at(0).eta*at(1).eta < 0 ? 1 : 0 )"
491  combinedObjectSelection = "at(0).eta*at(1).eta < 0"
492 
493  if etaMin == None:
494  etaMin = -1
495 
496  ret=cms.VPSet()
497  for t in thresholds:
498  partialPathName = "HLT_DiPFJet"+ str(t)+"_"
499  if flavour != None:
500  partialPathName += flavour+"_"
501  partialPathName += "v"
502 
503  marginLow = max(t-t//2, 15)
504  ptBinLow = max(t-marginLow,0)
505  marginHigh = min(max(t//3, 15), 50)
506  ptBinHigh = t+marginHigh
507  ptBins = min(100, ptBinHigh-ptBinLow)
508  fromJets = cms.PSet(
509  triggerSelection = cms.string(partialPathName+"*"),
510  handlerType = cms.string(handlerType),
511  PFJetCorLabel = cms.InputTag("ak4PFL1FastL2L3Corrector"),
512  inputCol = inputCol,
513  partialPathName = cms.string(partialPathName),
514  partialFilterName = cms.string("hltDoublePFJet"),
515  dqmhistolabel = cms.string(label),
516  mainDQMDirname = cms.untracked.string(fsqdirname),
517  singleObjectsPreselection = cms.string("abs(eta) < 5.5 && abs(eta) > " + str(etaMin) ),
518  #singleObjectsPreselection = cms.string("pt > 15 && abs(eta) < 5.5 && abs(eta) > " + str(etaMin) ),
519  singleObjectDrawables = cms.VPSet(),
520  combinedObjectSelection = cms.string(combinedObjectSelection),
521  combinedObjectSortCriteria = cms.string(combinedObjectSortCriteria),
522  combinedObjectDimension = cms.int32(2),
523  combinedObjectDrawables = cms.VPSet(
524  #cms.PSet (name = cms.string("ptLead"), expression = cms.string("max(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("ptSublead"), expression = cms.string("min(at(0).pt, at(1).pt())"),
527  # bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
528  cms.PSet (name = cms.string("ptMostFwd"),
529  expression = cms.string("? at(0).eta > at(1).eta ? at(0).pt : at(1).pt"),
530  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
531  cms.PSet (name = cms.string("ptMostBkw"),
532  expression = cms.string("? at(0).eta > at(1).eta ? at(1).pt : at(0).pt"),
533  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
534 
535  cms.PSet (name = cms.string("etaMostFwd"),
536  expression = cms.string("? at(0).eta > at(1).eta ? at(0).eta : at(1).eta"),
537  bins = cms.int32(52), min = cms.double(-5.2), max = cms.double(5.2)),
538  cms.PSet (name = cms.string("etaMostBkw"),
539  expression = cms.string("? at(0).eta > at(1).eta ? at(1).eta : at(0).eta"),
540  bins = cms.int32(52), min = cms.double(-5.2), max = cms.double(5.2)),
541  #cms.PSet (name = cms.string("pt_nominator"), expression = cms.string("min(at(0).pt, at(1).pt)"),
542  # bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) )
543  )
544  )
545  #fromJets.triggerSelection = cms.string("HLT_ZeroBias_v*")
546  ret.append(fromJets)
547  if srcType != "hlt":
548  fromJets.combinedObjectDrawables.append( cms.PSet(name = cms.string("ptm_nominator"),
549  expression = cms.string("min(at(0).pt, at(1).pt)"),
550  bins = cms.int32(ptBins),
551  min = cms.double(ptBinLow),
552  max = cms.double(ptBinHigh) ))
553 
554  fromJetsDenom = fromJets.clone(
555  triggerSelection = "HLT_ZeroBias_v*"
556  )
557  fromJetsDenom.singleObjectDrawables = cms.VPSet()
558  fromJetsDenom.combinedObjectDrawables = cms.VPSet(
559  cms.PSet (name = cms.string("ptm_denominator"), expression = cms.string("min(at(0).pt, at(1).pt)"),
560  bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh) )
561  )
562  ret.append(fromJetsDenom)
563 
564 
565  return ret
566 
567 def getFSQAll():
568  ret = cms.VPSet()
569  ret.extend(getHighMultVPSet())
571  ret.extend( getPTAveVPSet())
572 
573  ret.extend( getPTAveVPSet(thresholds = [15,25,35], disableCalo= True, flavour="HFJEC" ))
574  ret.extend( getPTAveVPSet(thresholds = [15,25,35], disableCalo= True, flavour="Central" ))
575  #todo = ["genJets", "ak4PFJetsCHS", "hlt"]
576  todo = ["ak4PFJetsCHS", "hlt"]
577  for t in todo:
578  ret.extend(getSinglePFJet([20], flavour="NoCaloMatched", etaMin=None, srcType=t))
579  ret.extend(getSinglePFJet([15, 25,40], flavour="NoCaloMatched", etaMin=None, srcType=t))
580  ret.extend(getSinglePFJet([15, 25,40], flavour="FwdEta2_NoCaloMatched", etaMin=2, srcType=t))
581  ret.extend(getSinglePFJet([15, 25,40], flavour="FwdEta3_NoCaloMatched", etaMin=3, srcType=t))
582 
583  ret.extend(getDoublePFJet([15], flavour="NoCaloMatched", etaMin=None, srcType=t))
584  ret.extend(getDoublePFJet([15], flavour="FBEta2_NoCaloMatched", etaMin=2, srcType=t))
585  ret.extend(getDoublePFJet([15], flavour="FBEta3_NoCaloMatched", etaMin=3, srcType=t))
586 
587  ret.extend(getSinglePFJet([15], partialPathName="HLT_L1Tech62_CASTORJet_SinglePFJet", srcType=t, disableEff=True))
588 
589 
590  return ret
591 
592 def getFSQHI():
593  ret = cms.VPSet()
595  #ret.extend(getHighMultVPSet())
596  return ret
597 
598 fsqdirname = "HLT/FSQ/"
599 
600 processName = "HLT"
601 #processName = "TEST"
602 
603 from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
604 fsqHLTOfflineSource = DQMEDAnalyzer('FSQDiJetAve',
605  triggerConfiguration = cms.PSet(
606  hltResults = cms.InputTag('TriggerResults','',processName),
607  l1tResults = cms.InputTag(''),
608  l1tIgnoreMaskAndPrescale = cms.bool( False ),
609  throw = cms.bool( False )
610  ),
611 
612  #dirname = cms.untracked.string("HLT/FSQ/DiJETAve/"),
613  triggerSummaryLabel = cms.InputTag("hltTriggerSummaryAOD","", processName),
614  triggerResultsLabel = cms.InputTag("TriggerResults","", processName),
615  useGenWeight = cms.bool(False),
616  #useGenWeight = cms.bool(True),
617  todo = cms.VPSet(getFSQAll())
618 )
def getPTAveVPSet(thresholds=[30, flavour="HFJEC", disableCalo=False)
def getSinglePFJet(thresholds, flavour=None, etaMin=-1, srcType="genJets", partialPathName="HLT_PFJet", disableEff=False)
def getDoublePFJet(thresholds, flavour=None, etaMin=-1, srcType="genJets")
#define str(s)