Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-05 02:39:09

0001 import FWCore.ParameterSet.Config as cms
0002 import math
0003 #
0004 # see https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuidePhysicsCutParser
0005 #
0006 #   trigger condition - check if trigger matching this pattern string was fired
0007 #                       empty string - dont check anything
0008 #
0009 #
0010 #   handler of type "fromHLT" fetches products of filter with name matching 
0011 #    the  partialFilterName string,  that was run inside path with name matching 
0012 #    the  partialPathName 
0013 #  
0014 #   other handlers read data from collection pointed by inputCol parameter 
0015 #       (partialFilterName, partialPathName params are ignored)
0016 #
0017 #   note: be extra carefull when using singleObject and combinedObject drawables in same
0018 #          handler definition. Histo names may be the same, currently there is no protection against it
0019 #
0020 def getZeroBias_SinglePixelTrackVPSet():
0021     ret=cms.VPSet()
0022     partialPathName = "HLT_ZeroBias_SinglePixelTrack_v"
0023     hltPixelTracksZB =  cms.PSet(
0024         triggerSelection = cms.string(partialPathName+"*"),
0025         handlerType = cms.string("FromHLT"),
0026         partialPathName = cms.string(partialPathName),
0027         partialFilterName  = cms.string("hltMinBiasPixelFilt"),
0028         dqmhistolabel  = cms.string("hltPixelTracks"),
0029         mainDQMDirname = cms.untracked.string(fsqdirname),
0030         singleObjectsPreselection = cms.string("1==1"),
0031         singleObjectDrawables =  cms.VPSet(
0032             cms.PSet (name = cms.string("pt"), expression = cms.string("pt"), bins = cms.int32(50), min = cms.double(0.4), max = cms.double(10)),
0033             cms.PSet (name = cms.string("eta"), expression = cms.string("eta"), bins = cms.int32(100), min = cms.double(-2.5), max = cms.double(2.5)),
0034             cms.PSet (name = cms.string("phi"), expression = cms.string("phi"), bins = cms.int32(100), min = cms.double(-3.15), max = cms.double(3.15))
0035         ),
0036         combinedObjectSelection =  cms.string("1==1"),
0037         combinedObjectSortCriteria = cms.string("at(0).pt"),
0038         combinedObjectDimension = cms.int32(1),
0039         combinedObjectDrawables =  cms.VPSet()
0040     )
0041     ret.append(hltPixelTracksZB)
0042 
0043     # note: for global efficiency (ie not efficiency as a funtion of something)
0044     # calculation we use RecoTrack handler in a bit twisted way.
0045     #     RecoTrack handler assumes, that the efficiency calculation is done
0046     #   only for events with at least one offline track (from generalTracks collection)
0047     #   passing the selection criteria from singleObjectsPreselection variable
0048     #     Such events are used to fill 1-bin-large-histogram with a range -0.5...0.5
0049     #     Note, that the histogram is always filled with the 0 value ("0*" part in 
0050     #   expression string). The "at(0).pt()" part is needed to make expression parses
0051     #   happy.
0052     tracksCountZB  =  cms.PSet(
0053             triggerSelection = cms.string(partialPathName+"*"),
0054             handlerType = cms.string("RecoTrack"),
0055             inputCol = cms.InputTag("generalTracks"),
0056             # l parameters
0057             partialPathName = cms.string(partialPathName),
0058             partialFilterName  = cms.string("hltL1sETT"),
0059             dqmhistolabel  = cms.string("zb"),
0060             mainDQMDirname = cms.untracked.string(fsqdirname),
0061             singleObjectsPreselection = cms.string("pt > 0.4 && abs(eta) < 2.4"), 
0062             singleObjectDrawables =  cms.VPSet(),
0063             combinedObjectSelection =  cms.string("1==1"),
0064             combinedObjectSortCriteria = cms.string('at(0).pt()'), # doesnt matter
0065             combinedObjectDimension = cms.int32(1),
0066             combinedObjectDrawables =  cms.VPSet(
0067                 cms.PSet (name = cms.string("Eff_nominator"), expression = cms.string('0*at(0).pt()'), 
0068                          bins = cms.int32(1), min = cms.double(-0.5), max = cms.double(0.5))
0069             )
0070     )
0071     ret.append(tracksCountZB)
0072     tracksCountDenomZB = tracksCountZB.clone(
0073         triggerSelection = "HLT_ZeroBias_v*"
0074     )
0075     tracksCountDenomZB.combinedObjectDrawables =  cms.VPSet(
0076         cms.PSet (name = cms.string("Eff_denominator"), expression = cms.string("0*at(0).pt()"),
0077                          bins = cms.int32(1), min = cms.double(-0.5), max = cms.double(0.5))
0078     )
0079     ret.append(tracksCountDenomZB)
0080 
0081     return ret
0082 
0083 def getHighMultVPSet():
0084     ret=cms.VPSet()
0085     thresholds = [60, 85, 110, 135, 160]
0086     for t in thresholds:
0087         partialPathName = "HLT_PixelTracks_Multiplicity"+str(t)+"_v"
0088         tracksL = 0
0089         tracksH = 200
0090         tracksBins = (tracksH-tracksL)//5
0091         tracksCount  =  cms.PSet(
0092                 triggerSelection = cms.string(partialPathName+"*"),
0093                 handlerType = cms.string("RecoTrackCounterWithVertexConstraint"),
0094                 inputCol = cms.InputTag("generalTracks"),
0095                 # l parameters
0096                 vtxCollection = cms.InputTag("offlinePrimaryVertices"),
0097                 minNDOF = cms.int32(7),
0098                 maxZ = cms.double(15),
0099                 maxDZ = cms.double(0.12),
0100                 maxDZ2dzsigma = cms.double(3),
0101                 maxDXY = cms.double(0.12),
0102                 maxDXY2dxysigma = cms.double(3),
0103                 partialPathName = cms.string(partialPathName),
0104                 partialFilterName  = cms.string("hltL1sETT"),
0105                 #dqmhistolabel  = cms.string("hltPixelTracks"),
0106                 dqmhistolabel  = cms.string("recoTracks"),
0107                 mainDQMDirname = cms.untracked.string(fsqdirname),
0108                 singleObjectsPreselection = cms.string("pt > 0.4 && abs(eta) < 2.4"), 
0109                 singleObjectDrawables =  cms.VPSet(),
0110                 combinedObjectSelection =  cms.string("1==1"),
0111                 combinedObjectSortCriteria = cms.string('size()'),
0112                 combinedObjectDimension = cms.int32(1),
0113                 combinedObjectDrawables =  cms.VPSet(
0114                     cms.PSet (name = cms.string("count_nominator"), expression = cms.string('at(0)'), 
0115                              bins = cms.int32(tracksBins), min = cms.double(tracksL), max = cms.double(tracksH))
0116                 )
0117         )
0118         ret.append(tracksCount)             
0119 
0120         tracksCountDenom = tracksCount.clone(
0121             triggerSelection = "TRUE"
0122         )
0123         tracksCountDenom.combinedObjectDrawables =  cms.VPSet(
0124             cms.PSet (name = cms.string("count_denominator"), expression = cms.string("at(0)"),
0125                              bins = cms.int32(tracksBins), min = cms.double(tracksL), max = cms.double(tracksH))
0126         )
0127         ret.append(tracksCountDenom)
0128 
0129 
0130         hltPixelTracks =  cms.PSet(
0131             triggerSelection = cms.string(partialPathName+"*"),
0132             handlerType = cms.string("FromHLT"),
0133             partialPathName = cms.string(partialPathName),
0134             partialFilterName  = cms.string("hlt1HighMult"),
0135             dqmhistolabel  = cms.string("hltPixelTracks"),
0136             mainDQMDirname = cms.untracked.string(fsqdirname),
0137             singleObjectsPreselection = cms.string("1==1"),
0138             singleObjectDrawables =  cms.VPSet(
0139                 cms.PSet (name = cms.string("pt"), expression = cms.string("pt"), bins = cms.int32(200), min = cms.double(0.0), max = cms.double(10)),
0140                 cms.PSet (name = cms.string("eta"), expression = cms.string("eta"), bins = cms.int32(100), min = cms.double(-2.5), max = cms.double(2.5)),
0141                 cms.PSet (name = cms.string("phi"), expression = cms.string("phi"), bins = cms.int32(100), min = cms.double(-3.15), max = cms.double(3.15))
0142             ),
0143             combinedObjectSelection =  cms.string("1==1"),
0144             combinedObjectSortCriteria = cms.string("at(0).pt"),
0145             combinedObjectDimension = cms.int32(1),
0146             combinedObjectDrawables =  cms.VPSet()
0147         )
0148         ret.append(hltPixelTracks)
0149 
0150         hltPixelTracksEta16to18 = hltPixelTracks.clone(
0151             singleObjectsPreselection='abs(eta) > 1.6 && abs(eta) < 1.8',
0152             dqmhistolabel  = "hltPixelTracksEta16to18"
0153         )
0154         for i in hltPixelTracksEta16to18.singleObjectDrawables:
0155             if i.name == "eta":
0156                 hltPixelTracksEta16to18.singleObjectDrawables.remove(i)
0157 
0158         ret.append(hltPixelTracksEta16to18)
0159 
0160         # FIXME: what variables it makes sense to plot in case of ETT seeds?
0161         l1 =  cms.PSet(
0162                 triggerSelection = cms.string(partialPathName+"*"),
0163                 handlerType = cms.string("FromHLT"),
0164                 partialPathName = cms.string(partialPathName),
0165                 partialFilterName  = cms.string("hltL1sETT"),
0166                 dqmhistolabel  = cms.string("l1"),
0167                 mainDQMDirname = cms.untracked.string(fsqdirname),
0168                 singleObjectsPreselection = cms.string("1==1"),
0169                 singleObjectDrawables =  cms.VPSet(),
0170                 combinedObjectSelection =  cms.string("1==1"),
0171                 combinedObjectSortCriteria = cms.string("at(0).pt"),
0172                 combinedObjectDimension = cms.int32(1),
0173                 combinedObjectDrawables =  cms.VPSet(
0174                     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)),
0175                 )
0176         )
0177         ret.append(l1) 
0178 
0179 
0180 
0181     return ret
0182 
0183 
0184 # note: always give integer values (!)
0185 def getPTAveVPSet(thresholds = [30, 60, 80, 100, 160, 220, 300], flavour="HFJEC", disableCalo = False):
0186     # HLT_DiPFJetAve35_HFJEC_v1
0187     # HLT_DiPFJetAve15_Central_v1
0188     if flavour == "HFJEC":
0189         probeEtaSelection = "abs(eta) > 2.7"
0190         probeEtaSelectionCombined = "abs(at(1).eta) > 2.7"
0191     elif flavour == "Central":
0192         probeEtaSelection = "abs(eta) < 2.7"
0193         probeEtaSelectionCombined = "abs(at(1).eta) < 2.7"
0194     else:
0195         raise Exception("Flavour not known "+ flavour)
0196     ret=cms.VPSet()
0197     for t in thresholds:
0198             #partialPathName = "HLT_DiPFJetAve"+ str(t) +"_HFJEC_"
0199             partialPathName = "HLT_DiPFJetAve"+ str(t)+"_" + flavour + "_v"
0200 
0201             ptBinLow  = t//2
0202             ptBinHigh = max(100, t*2)
0203             ptBins = min(100, ptBinHigh-ptBinLow)
0204 
0205         
0206             if not disableCalo:
0207                 hltCalo =  cms.PSet(
0208                     triggerSelection = cms.string(partialPathName+"*"),
0209                     handlerType = cms.string("FromHLT"),
0210                     partialPathName = cms.string(partialPathName),
0211                     partialFilterName  = cms.string("ForHFJECBase"), # note: this matches to hltSingleCaloJetXXXForHFJECBase
0212                     dqmhistolabel  = cms.string("hltCaloJets"),
0213                     mainDQMDirname = cms.untracked.string(fsqdirname),
0214                     singleObjectsPreselection = cms.string("abs(eta)<1.4 || " + probeEtaSelection),
0215                     singleObjectDrawables =  cms.VPSet(),
0216                     combinedObjectSelection =  cms.string("1==1"),
0217                     combinedObjectSortCriteria = cms.string("at(0).pt"),
0218                     combinedObjectDimension = cms.int32(1),
0219                     combinedObjectDrawables =  cms.VPSet(
0220                         cms.PSet (name = cms.string("pt"), expression = cms.string("at(0).pt"), bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
0221                         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))
0222                     )
0223                 )
0224                 ret.append(hltCalo)
0225 
0226             l1 =  cms.PSet(
0227                 triggerSelection = cms.string(partialPathName+"*"),
0228                 handlerType = cms.string("FromHLT"),
0229                 partialPathName = cms.string(partialPathName),
0230                 partialFilterName  = cms.string("hltL1"),
0231                 dqmhistolabel  = cms.string("l1"),
0232                 mainDQMDirname = cms.untracked.string(fsqdirname),
0233                 singleObjectsPreselection = cms.string("1==1"),
0234                 singleObjectDrawables =  cms.VPSet(),
0235                 combinedObjectSelection =  cms.string("1==1"),
0236                 combinedObjectSortCriteria = cms.string("at(0).pt"),
0237                 combinedObjectDimension = cms.int32(1),
0238                 combinedObjectDrawables =  cms.VPSet(
0239                     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)),
0240                     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))
0241                 )
0242             )
0243             ret.append(l1)
0244 
0245             '''
0246             hltPFSingle  =  cms.PSet(
0247                 triggerSelection = cms.string(partialPathName+"*"),
0248                 handlerType = cms.string("FromHLT"),
0249                 partialPathName = cms.string(partialPathName),
0250                 partialFilterName  = cms.string("hltDiPFJetAve"),
0251                 dqmhistolabel  = cms.string("hltpfsingle"),
0252                 mainDQMDirname = cms.untracked.string(fsqdirname),
0253                 singleObjectsPreselection = cms.string("abs(eta)<1.4 || abs(eta) > 2.7 "),
0254                 singleObjectDrawables =  cms.VPSet(),
0255                 combinedObjectSelection =  cms.string("1==1"),
0256                 combinedObjectSortCriteria = cms.string("at(0).pt"),
0257                 combinedObjectDimension = cms.int32(1),
0258                 combinedObjectDrawables =  cms.VPSet(
0259                     cms.PSet (name = cms.string("pt"), expression = cms.string("at(0).pt"), bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
0260                     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))
0261                 )
0262             )
0263             ret.append(hltPFSingle)
0264             '''
0265 
0266 
0267             hltPFtopology  =  cms.PSet(
0268                 triggerSelection = cms.string(partialPathName+"*"),
0269                 handlerType = cms.string("FromHLT"),
0270                 partialPathName = cms.string(partialPathName),
0271                 partialFilterName  = cms.string("hltDiPFJetAve"),
0272                 dqmhistolabel  = cms.string("hltPFJetsTopology"),
0273                 mainDQMDirname = cms.untracked.string(fsqdirname),
0274                 singleObjectsPreselection = cms.string("abs(eta)<1.4 || " + probeEtaSelection),
0275                 singleObjectDrawables =  cms.VPSet(),
0276                 combinedObjectSelection =  cms.string("abs(at(0).eta())< 1.4 && "+ probeEtaSelectionCombined +
0277                                                       " && abs(deltaPhi(at(0).phi, at(1).phi)) > 2.5"),
0278                 combinedObjectSortCriteria = cms.string("(at(0).pt+at(1).pt)/2"),
0279                 combinedObjectDimension = cms.int32(2),
0280                 combinedObjectDrawables =  cms.VPSet(
0281                     cms.PSet (name = cms.string("deltaEta"), expression = cms.string("abs(at(0).eta-at(1).eta)"), 
0282                              bins = cms.int32(70), min = cms.double(0), max = cms.double(7)),
0283                     cms.PSet (name = cms.string("deltaPhi"), expression = cms.string("abs(deltaPhi(at(0).phi, at(1).phi))"), 
0284                              bins = cms.int32(100), min = cms.double(0), max = cms.double(3.2)),
0285                     cms.PSet (name = cms.string("ptAve"), expression = cms.string("(at(0).pt+at(1).pt)/2"), 
0286                              bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
0287                     cms.PSet (name = cms.string("ptTag"), expression = 
0288                              cms.string("? abs(at(0).eta) < abs(at(1).eta) ? at(0).pt : at(1).pt "), 
0289                              bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)  ),
0290                     cms.PSet (name = cms.string("ptProbe"), expression = 
0291                              cms.string("? abs(at(0).eta) < abs(at(1).eta) ? at(1).pt : at(0).pt "), 
0292                              bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)  )
0293                 )
0294             )
0295             ret.append(hltPFtopology)
0296 
0297 
0298 
0299 
0300             '''
0301             # FromJet
0302             recoThr = t
0303             recoPF  =  cms.PSet(
0304                 triggerSelection = cms.string(partialPathName+"*"),
0305                 handlerType = cms.string("FromRecoCandidate"),
0306                 inputCol = cms.InputTag("ak4PFJetsCHS"),
0307                 partialPathName = cms.string(partialPathName),
0308                 partialFilterName  = cms.string("hltDiPFJetAve"),
0309                 dqmhistolabel  = cms.string("recoJet"),
0310                 mainDQMDirname = cms.untracked.string(fsqdirname),
0311                 singleObjectsPreselection = cms.string("pt > + "+str(recoThr) +" && (abs(eta)<1.3 || abs(eta) > 2.8) "),
0312                 singleObjectDrawables =  cms.VPSet(),
0313                 combinedObjectSelection =  cms.string("1==1"),
0314                 combinedObjectSortCriteria = cms.string("at(0).pt"),
0315                 combinedObjectDimension = cms.int32(1),
0316                 combinedObjectDrawables =  cms.VPSet(
0317                     cms.PSet (name = cms.string("pt"), expression = cms.string("at(0).pt"), bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
0318                     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))
0319                 )
0320             )
0321             ret.append(recoPF) 
0322             '''
0323             recoThr = t//2
0324             recoPFtopology  =  cms.PSet(
0325                 triggerSelection = cms.string(partialPathName+"*"),
0326                 handlerType = cms.string("RecoPFJetWithJEC"),
0327                 PFJetCorLabel        = cms.InputTag("ak4PFL1FastL2L3Corrector"),
0328                 inputCol = cms.InputTag("ak4PFJetsCHS"),
0329                 partialPathName = cms.string(partialPathName),
0330                 partialFilterName  = cms.string("hltDiPFJetAve"),
0331                 dqmhistolabel  = cms.string("recoPFJetsTopology"),
0332                 mainDQMDirname = cms.untracked.string(fsqdirname),
0333                 singleObjectsPreselection = cms.string("pt > "+str(recoThr) +" && (abs(eta)<1.4 ||"+probeEtaSelection + ")" ),
0334                 singleObjectDrawables =  cms.VPSet(),
0335                 combinedObjectSelection =  cms.string("abs(at(0).eta())< 1.3 && " + probeEtaSelectionCombined + 
0336                                                       " && abs(deltaPhi(at(0).phi, at(1).phi)) > 2.5"),
0337                 combinedObjectSortCriteria = cms.string("(at(0).pt+at(1).pt)/2"),
0338                 combinedObjectDimension = cms.int32(2),
0339                 combinedObjectDrawables =  cms.VPSet(
0340                     cms.PSet (name = cms.string("deltaEta"), expression = cms.string("abs(at(0).eta-at(1).eta)"), 
0341                              bins = cms.int32(70), min = cms.double(0), max = cms.double(7)),
0342                     cms.PSet (name = cms.string("deltaPhi"), expression = cms.string("abs(deltaPhi(at(0).phi, at(1).phi))"), 
0343                              bins = cms.int32(100), min = cms.double(0), max = cms.double(3.2)),
0344                     cms.PSet (name = cms.string("ptAve"), expression = cms.string("(at(0).pt+at(1).pt)/2"), 
0345                              bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
0346                     cms.PSet (name = cms.string("ptTag"), expression = 
0347                             cms.string("?  abs(at(0).eta) < abs(at(1).eta) ? at(0).pt : at(1).pt "), 
0348                             bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)  ),
0349                     cms.PSet (name = cms.string("ptProbe"), expression = 
0350                             cms.string("?  abs(at(0).eta) < abs(at(1).eta) ? at(1).pt : at(0).pt "), 
0351                             bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)  ),
0352                     cms.PSet (name = cms.string("ptAve_nominator"), expression = cms.string("(at(0).pt+at(1).pt)/2"),
0353                              bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)  ),
0354                 )
0355             )
0356             ret.append(recoPFtopology)
0357             recoPFtopologyDenom = recoPFtopology.clone(
0358                 #triggerSelection = "HLTriggerFirstPath*",
0359                 #triggerSelection = partialPathName+"*",
0360                 triggerSelection = "TRUE"
0361             )
0362             recoPFtopologyDenom.combinedObjectDrawables =  cms.VPSet(
0363                 cms.PSet (name = cms.string("ptAve_denominator"), expression = cms.string("(at(0).pt+at(1).pt)/2"),
0364                              bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)  )
0365             )
0366             ret.append(recoPFtopologyDenom)
0367 
0368             # RecoCandidateCounter
0369             ''' example on how to count objects
0370             recoThr = t//2
0371             recoPFJetCnt  =  cms.PSet(
0372                 triggerSelection = cms.string(partialPathName+"*"),
0373                 handlerType = cms.string("RecoCandidateCounter"),
0374                 inputCol = cms.InputTag("ak4PFJetsCHS"),
0375                 partialPathName = cms.string(partialPathName),
0376                 partialFilterName  = cms.string("hltDiPFJetAve"),
0377                 dqmhistolabel  = cms.string("recoPFJetsCnt"),
0378                 mainDQMDirname = cms.untracked.string(fsqdirname),
0379                 singleObjectsPreselection = cms.string("pt >  "+str(recoThr) +" && abs(eta)<1.4 || abs(eta) > 2.7 "),
0380                 singleObjectDrawables =  cms.VPSet(),
0381                 combinedObjectSelection =  cms.string("1==1"),
0382                 combinedObjectSortCriteria = cms.string('size()'),
0383                 combinedObjectDimension = cms.int32(1),
0384                 combinedObjectDrawables =  cms.VPSet(
0385                     cms.PSet (name = cms.string("count"), expression = cms.string('at(0)'), 
0386                              bins = cms.int32(30), min = cms.double(0), max = cms.double(30))
0387                 )
0388             )
0389             ret.append(recoPFJetCnt)
0390             '''
0391 
0392     return ret
0393 
0394 # note: thresholds should be a list with integer only values
0395 def getSinglePFJet(thresholds, flavour=None, etaMin=-1, srcType="genJets", partialPathName = "HLT_PFJet", disableEff = False):
0396     if srcType == "genJets":
0397         inputCol = cms.InputTag("ak4GenJets")
0398         handlerType = "FromRecoCandidate"
0399         label = srcType
0400     elif srcType == "ak4PFJetsCHS":
0401         inputCol = cms.InputTag("ak4PFJetsCHS")
0402         handlerType = "RecoPFJetWithJEC"
0403         label = srcType
0404     elif srcType == "hlt":
0405         inputCol = cms.InputTag("S")
0406         handlerType = "FromHLT"
0407         label = srcType
0408     else:
0409         raise Exception("Whooops!")
0410 
0411     if etaMin == None:
0412         etaMin = -1
0413 
0414     ret=cms.VPSet()
0415     for t in thresholds:
0416         partialPathNameLoc = partialPathName
0417         partialPathNameLoc += str(t)+"_"
0418         if flavour != None:
0419             partialPathNameLoc += flavour+"_"
0420         partialPathNameLoc += "v"
0421 
0422         marginLow = max(t-t//2, 15)
0423         ptBinLow  = max(t-marginLow,0)
0424         marginHigh =  min(max(t//2, 20), 50)
0425         ptBinHigh = t+marginHigh
0426         ptBins = min(100, ptBinHigh-ptBinLow)
0427         fromJets =  cms.PSet(
0428             triggerSelection = cms.string(partialPathNameLoc+"*"),
0429             handlerType = cms.string(handlerType),
0430             PFJetCorLabel        = cms.InputTag("ak4PFL1FastL2L3Corrector"),
0431             inputCol = inputCol,
0432             #    inputCol = cms.InputTag("ak4PFJetsCHS"),
0433             partialPathName = cms.string(partialPathNameLoc),
0434             partialFilterName  = cms.string("hltSinglePFJet"),
0435             dqmhistolabel  = cms.string(label),
0436             mainDQMDirname = cms.untracked.string(fsqdirname),
0437             singleObjectsPreselection = cms.string("abs(eta) < 5.5 && abs(eta) > " + str(etaMin) ),
0438             singleObjectDrawables =  cms.VPSet(),
0439             combinedObjectSelection =  cms.string("1==1"),
0440             combinedObjectSortCriteria = cms.string("at(0).pt"),
0441             combinedObjectDimension = cms.int32(1),
0442             combinedObjectDrawables =  cms.VPSet(
0443                     cms.PSet (name = cms.string("pt"), expression = cms.string("at(0).pt"), 
0444                               bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
0445                     cms.PSet (name = cms.string("eta"), expression = cms.string("at(0).eta"), 
0446                               bins = cms.int32(52), min = cms.double(-5.2), max = cms.double(5.2)),
0447                     cms.PSet (name = cms.string("pt_nominator"), expression = cms.string("at(0).pt"),
0448                              bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)  )
0449             )
0450         )
0451         if disableEff:
0452             for p in fromJets.combinedObjectDrawables:
0453                 if p.name == cms.string("pt_nominator"):
0454                     fromJets.combinedObjectDrawables.remove(p)
0455                     break
0456         else:
0457             fromJetsDenom  = fromJets.clone(
0458                 triggerSelection = "HLT_ZeroBias_v*"
0459             )
0460             fromJetsDenom.singleObjectDrawables =  cms.VPSet()
0461             fromJetsDenom.combinedObjectDrawables =  cms.VPSet(
0462                 cms.PSet (name = cms.string("pt_denominator"), expression = cms.string("at(0).pt"),
0463                           bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)  )
0464             )
0465             ret.append(fromJetsDenom)
0466         ret.append(fromJets)
0467     return ret
0468 
0469 # note: thresholds should be a list with integer only values
0470 # fixme: most of the code repeated from single jet case above
0471 def getDoublePFJet(thresholds, flavour=None, etaMin=-1, srcType="genJets" ):
0472     if srcType == "genJets":
0473         inputCol = cms.InputTag("ak4GenJets")
0474         handlerType = "FromRecoCandidate"
0475         label = srcType
0476     elif srcType == "ak4PFJetsCHS":
0477         inputCol = cms.InputTag("ak4PFJetsCHS")
0478         handlerType = "RecoPFJetWithJEC"
0479         label = srcType
0480     elif srcType == "hlt":
0481         inputCol = cms.InputTag("S")
0482         handlerType = "FromHLT"
0483         label = srcType
0484     else:
0485         raise Exception("Whooops!")
0486 
0487     combinedObjectSortCriteria = "at(0).pt + at(1).pt"
0488     combinedObjectSelection = "1 == 1"
0489     if flavour != None and "FB" in flavour :
0490         combinedObjectSortCriteria = "("+combinedObjectSortCriteria+")*(  ? at(0).eta*at(1).eta < 0 ? 1 : 0 )"
0491         combinedObjectSelection = "at(0).eta*at(1).eta < 0"
0492         
0493     if etaMin == None:
0494         etaMin = -1
0495 
0496     ret=cms.VPSet()
0497     for t in thresholds:
0498         partialPathName = "HLT_DiPFJet"+ str(t)+"_"
0499         if flavour != None:
0500             partialPathName += flavour+"_"
0501         partialPathName += "v"
0502 
0503         marginLow = max(t-t//2, 15)
0504         ptBinLow  = max(t-marginLow,0)
0505         marginHigh =  min(max(t//3, 15), 50)
0506         ptBinHigh = t+marginHigh
0507         ptBins = min(100, ptBinHigh-ptBinLow)
0508         fromJets =  cms.PSet(
0509             triggerSelection = cms.string(partialPathName+"*"),
0510             handlerType = cms.string(handlerType),
0511             PFJetCorLabel        = cms.InputTag("ak4PFL1FastL2L3Corrector"),
0512             inputCol = inputCol,
0513             partialPathName = cms.string(partialPathName),
0514             partialFilterName  = cms.string("hltDoublePFJet"),
0515             dqmhistolabel  = cms.string(label),
0516             mainDQMDirname = cms.untracked.string(fsqdirname),
0517             singleObjectsPreselection = cms.string("abs(eta) < 5.5 && abs(eta) > " + str(etaMin) ),
0518             #singleObjectsPreselection = cms.string("pt > 15 && abs(eta) < 5.5 && abs(eta) > " + str(etaMin) ),
0519             singleObjectDrawables =  cms.VPSet(),
0520             combinedObjectSelection =  cms.string(combinedObjectSelection),
0521             combinedObjectSortCriteria = cms.string(combinedObjectSortCriteria),
0522             combinedObjectDimension = cms.int32(2),
0523             combinedObjectDrawables =  cms.VPSet(
0524                     #cms.PSet (name = cms.string("ptLead"), expression = cms.string("max(at(0).pt, at(1).pt())"), 
0525                     #          bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
0526                     #cms.PSet (name = cms.string("ptSublead"), expression = cms.string("min(at(0).pt, at(1).pt())"), 
0527                     #          bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
0528                     cms.PSet (name = cms.string("ptMostFwd"), 
0529                               expression = cms.string("? at(0).eta > at(1).eta ? at(0).pt : at(1).pt"), 
0530                               bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
0531                     cms.PSet (name = cms.string("ptMostBkw"), 
0532                               expression = cms.string("? at(0).eta > at(1).eta ? at(1).pt : at(0).pt"), 
0533                               bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)),
0534 
0535                     cms.PSet (name = cms.string("etaMostFwd"), 
0536                               expression = cms.string("? at(0).eta > at(1).eta ? at(0).eta : at(1).eta"), 
0537                               bins = cms.int32(52), min = cms.double(-5.2), max = cms.double(5.2)),
0538                     cms.PSet (name = cms.string("etaMostBkw"), 
0539                               expression = cms.string("? at(0).eta > at(1).eta ? at(1).eta : at(0).eta"), 
0540                               bins = cms.int32(52), min = cms.double(-5.2), max = cms.double(5.2)),
0541                     #cms.PSet (name = cms.string("pt_nominator"), expression = cms.string("min(at(0).pt, at(1).pt)"),
0542                     #         bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)  )
0543             )
0544         )
0545         #fromJets.triggerSelection = cms.string("HLT_ZeroBias_v*")
0546         ret.append(fromJets)
0547         if srcType != "hlt":
0548             fromJets.combinedObjectDrawables.append( cms.PSet(name = cms.string("ptm_nominator"), 
0549                                                               expression = cms.string("min(at(0).pt, at(1).pt)"),
0550                                                               bins = cms.int32(ptBins), 
0551                                                               min = cms.double(ptBinLow), 
0552                                                               max = cms.double(ptBinHigh)  ))
0553 
0554             fromJetsDenom  = fromJets.clone(
0555                 triggerSelection = "HLT_ZeroBias_v*"
0556             )
0557             fromJetsDenom.singleObjectDrawables =  cms.VPSet()
0558             fromJetsDenom.combinedObjectDrawables =  cms.VPSet(
0559                 cms.PSet (name = cms.string("ptm_denominator"), expression = cms.string("min(at(0).pt, at(1).pt)"),
0560                           bins = cms.int32(ptBins), min = cms.double(ptBinLow), max = cms.double(ptBinHigh)  )
0561             )
0562             ret.append(fromJetsDenom)
0563             
0564 
0565     return ret
0566 
0567 def getFSQAll():
0568     ret = cms.VPSet()
0569     ret.extend(getHighMultVPSet())
0570     ret.extend(getZeroBias_SinglePixelTrackVPSet())
0571     ret.extend( getPTAveVPSet())
0572 
0573     ret.extend( getPTAveVPSet(thresholds = [15,25,35], disableCalo= True, flavour="HFJEC" ))
0574     ret.extend( getPTAveVPSet(thresholds = [15,25,35], disableCalo= True, flavour="Central" ))
0575     #todo = ["genJets", "ak4PFJetsCHS", "hlt"]
0576     todo = ["ak4PFJetsCHS", "hlt"]
0577     for t in todo:
0578         ret.extend(getSinglePFJet([20], flavour="NoCaloMatched", etaMin=None, srcType=t))
0579         ret.extend(getSinglePFJet([15, 25,40], flavour="NoCaloMatched", etaMin=None, srcType=t))
0580         ret.extend(getSinglePFJet([15, 25,40], flavour="FwdEta2_NoCaloMatched", etaMin=2, srcType=t))
0581         ret.extend(getSinglePFJet([15, 25,40], flavour="FwdEta3_NoCaloMatched", etaMin=3, srcType=t))
0582 
0583         ret.extend(getDoublePFJet([15], flavour="NoCaloMatched", etaMin=None, srcType=t))
0584         ret.extend(getDoublePFJet([15], flavour="FBEta2_NoCaloMatched", etaMin=2, srcType=t))
0585         ret.extend(getDoublePFJet([15], flavour="FBEta3_NoCaloMatched", etaMin=3, srcType=t))
0586 
0587         ret.extend(getSinglePFJet([15], partialPathName="HLT_L1Tech62_CASTORJet_SinglePFJet", srcType=t,  disableEff=True))
0588 
0589 
0590     return ret
0591 
0592 def getFSQHI():
0593     ret = cms.VPSet()
0594     ret.extend(getZeroBias_SinglePixelTrackVPSet())
0595     #ret.extend(getHighMultVPSet())
0596     return ret
0597 
0598 fsqdirname = "HLT/FSQ/"
0599 
0600 processName = "HLT"
0601 #processName = "TEST"
0602 
0603 from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
0604 fsqHLTOfflineSource = DQMEDAnalyzer('FSQDiJetAve',
0605     triggerConfiguration =  cms.PSet(
0606       hltResults = cms.InputTag('TriggerResults','',processName),
0607       l1tResults = cms.InputTag(''),
0608       l1tIgnoreMaskAndPrescale = cms.bool( False ),
0609       throw = cms.bool( False )
0610     ),
0611 
0612     #dirname = cms.untracked.string("HLT/FSQ/DiJETAve/"),
0613     triggerSummaryLabel = cms.InputTag("hltTriggerSummaryAOD","", processName),
0614     triggerResultsLabel = cms.InputTag("TriggerResults","", processName),
0615     useGenWeight = cms.bool(False),
0616     #useGenWeight = cms.bool(True),
0617     todo = cms.VPSet(getFSQAll())
0618 )