CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
customizeHLTforPatatrack Namespace Reference

Functions

def _addConsumerPath
 
def consumeCPULegacyProducts
 
def consumeCPUSoAProducts
 
def consumeGPUSoAProducts
 
def customiseCommon
 
def customiseEcalLocalReconstruction
 
def customiseHcalLocalReconstruction
 
def customisePixelLocalReconstruction
 
def customisePixelTrackReconstruction
 
def customizeHLTforPatatrack
 
def customizeHLTforPatatrackTriplets
 
def enablePatatrackPixelTriplets
 
def forceGpuOffload
 
def resetGpuOffload
 

Function Documentation

def customizeHLTforPatatrack._addConsumerPath (   process)
private

Definition at line 704 of file customizeHLTforPatatrack.py.

Referenced by consumeCPULegacyProducts(), consumeCPUSoAProducts(), and consumeGPUSoAProducts().

705 def _addConsumerPath(process):
706  # add to a path all consumers and the tasks that define the producers
707  process.Consumer = cms.Path(
708  process.HLTBeginSequence +
709  process.hltPixelConsumer +
710  process.hltEcalConsumer +
711  process.hltHbheConsumer,
712  process.HLTDoLocalPixelTask,
713  process.HLTRecoPixelTracksTask,
714  process.HLTRecopixelvertexingTask,
715  process.HLTDoFullUnpackingEgammaEcalTask,
716  process.HLTDoLocalHcalTask,
717  )
718 
719  if process.schedule is not None:
720  process.schedule.append(process.Consumer)
721 
722  # done
723  return process
724 
def customizeHLTforPatatrack.consumeCPULegacyProducts (   process)

Definition at line 770 of file customizeHLTforPatatrack.py.

References _addConsumerPath().

771 def consumeCPULegacyProducts(process):
772  # consume the Pixel tracks and vertices on the CPU in legacy format
773  process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer",
774  eventProducts = cms.untracked.vstring( 'hltPixelTracks', 'hltPixelVertices' )
775  )
776 
777  # consume the ECAL runcalibrated echits on the CPU in legacy format
778  process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer",
779  eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHit' )
780  )
781 
782  # consume the HCAL rechits on the CPU in legacy format
783  process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer",
784  eventProducts = cms.untracked.vstring( 'hltHbhereco' )
785  )
786 
787  # add to a path all consumers and the tasks that define the producers
788  process = _addConsumerPath(process)
789 
790  # done
791  return process
def customizeHLTforPatatrack.consumeCPUSoAProducts (   process)

Definition at line 748 of file customizeHLTforPatatrack.py.

References _addConsumerPath().

749 def consumeCPUSoAProducts(process):
750  # consume the Pixel tracks and vertices on the CPU in SoA format
751  process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer",
752  eventProducts = cms.untracked.vstring( 'hltPixelTracksSoA', 'hltPixelVerticesSoA' )
753  )
754 
755  # consume the ECAL uncalibrated rechits on the CPU in SoA format
756  process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer",
757  eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHitSoA' )
758  )
759 
760  # consume the HCAL rechits on the CPU in legacy format
761  process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer",
762  eventProducts = cms.untracked.vstring( 'hltHbhereco' )
763  )
764 
765  # add to a path all consumers and the tasks that define the producers
766  process = _addConsumerPath(process)
767 
768  # done
769  return process
def customizeHLTforPatatrack.consumeGPUSoAProducts (   process)

Definition at line 725 of file customizeHLTforPatatrack.py.

References _addConsumerPath().

726 def consumeGPUSoAProducts(process):
727  # consume the Pixel tracks and vertices on the GPU in SoA format
728  process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer",
729  eventProducts = cms.untracked.vstring( 'hltPixelTracksCUDA', 'hltPixelVerticesCUDA' )
730  )
731 
732  # consume the ECAL uncalibrated rechits on the GPU in SoA format
733  process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer",
734  eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHitGPU' )
735  )
736 
737  # consume the HCAL rechits on the GPU in SoA format
738  process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer",
739  eventProducts = cms.untracked.vstring( 'hltHbherecoGPU' )
740  )
741 
742  # add to a path all consumers and the tasks that define the producers
743  process = _addConsumerPath(process)
744 
745  # done
746  return process
747 
def customizeHLTforPatatrack.customiseCommon (   process)

Definition at line 22 of file customizeHLTforPatatrack.py.

References common.insert_modules_after(), and common.replace_with().

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

22 
23 def customiseCommon(process):
24 
25  # Services
26 
27  process.load("HeterogeneousCore.CUDAServices.CUDAService_cfi")
28  if 'MessageLogger' in process.__dict__:
29  process.MessageLogger.CUDAService = cms.untracked.PSet()
30 
31  # NVProfilerService is broken in CMSSW 12.0.x and later
32  #process.load("HeterogeneousCore.CUDAServices.NVProfilerService_cfi")
33 
34 
35  # Paths and EndPaths
36 
37  # the hltGetConditions module would force gpu-specific ESProducers to run even if no supported gpu is present
38  if 'hltGetConditions' in process.__dict__:
39  del process.hltGetConditions
40 
41  # produce a boolean to track if the events ar being processed on gpu (true) or cpu (false)
42  process.statusOnGPU = SwitchProducerCUDA(
43  cpu = cms.EDProducer("BooleanProducer", value = cms.bool(False)),
44  cuda = cms.EDProducer("BooleanProducer", value = cms.bool(True))
45  )
46 
47  process.statusOnGPUFilter = cms.EDFilter("BooleanFilter",
48  src = cms.InputTag("statusOnGPU")
49  )
50 
51  if 'Status_OnCPU' in process.__dict__:
52  replace_with(process.Status_OnCPU, cms.Path(process.statusOnGPU + ~process.statusOnGPUFilter))
53  else:
54  process.Status_OnCPU = cms.Path(process.statusOnGPU + ~process.statusOnGPUFilter)
55  if process.schedule is not None:
56  process.schedule.append(process.Status_OnCPU)
57 
58  if 'Status_OnGPU' in process.__dict__:
59  replace_with(process.Status_OnGPU, cms.Path(process.statusOnGPU + process.statusOnGPUFilter))
60  else:
61  process.Status_OnGPU = cms.Path(process.statusOnGPU + process.statusOnGPUFilter)
62  if process.schedule is not None:
63  process.schedule.append(process.Status_OnGPU)
64 
65  # make the ScoutingCaloMuonOutput endpath compatible with using Tasks in the Scouting paths
66  if 'hltOutputScoutingCaloMuon' in process.__dict__ and not 'hltPreScoutingCaloMuonOutputSmart' in process.__dict__:
67  process.hltPreScoutingCaloMuonOutputSmart = cms.EDFilter( "TriggerResultsFilter",
68  l1tIgnoreMaskAndPrescale = cms.bool( False ),
69  l1tResults = cms.InputTag( "" ),
70  hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ),
71  triggerConditions = process.hltOutputScoutingCaloMuon.SelectEvents.SelectEvents,
72  throw = cms.bool( True )
73  )
74  insert_modules_after(process, process.hltPreScoutingCaloMuonOutput, process.hltPreScoutingCaloMuonOutputSmart)
75 
76  # make the ScoutingPFOutput endpath compatible with using Tasks in the Scouting paths
77  if 'hltOutputScoutingPF' in process.__dict__ and not 'hltPreScoutingPFOutputSmart' in process.__dict__:
78  process.hltPreScoutingPFOutputSmart = cms.EDFilter( "TriggerResultsFilter",
79  l1tIgnoreMaskAndPrescale = cms.bool( False ),
80  l1tResults = cms.InputTag( "" ),
81  hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ),
82  triggerConditions = process.hltOutputScoutingPF.SelectEvents.SelectEvents,
83  throw = cms.bool( True )
84  )
85  insert_modules_after(process, process.hltPreScoutingPFOutput, process.hltPreScoutingPFOutputSmart)
86 
87 
88  # done
89  return process
90 
91 
# customisation for running the "Patatrack" pixel local reconstruction
def replace_with
Definition: common.py:67
def insert_modules_after
Definition: common.py:50
def customizeHLTforPatatrack.customiseEcalLocalReconstruction (   process)

Definition at line 376 of file customizeHLTforPatatrack.py.

References any().

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

378 
379  hasHLTEcalPreshowerSeq = any(seq in process.__dict__ for seq in ['HLTDoFullUnpackingEgammaEcalMFSequence', 'HLTDoFullUnpackingEgammaEcalSequence'])
380  if not (hasHLTEcalPreshowerSeq or 'HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence' in process.__dict__):
381  return process
382 
383  # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases
384 
385  process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence()
386  if hasHLTEcalPreshowerSeq:
387  process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence()
388  process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence()
389 
390 
391  # Event Setup
392 
393  process.load("EventFilter.EcalRawToDigi.ecalElectronicsMappingGPUESProducer_cfi")
394  process.load("RecoLocalCalo.EcalRecProducers.ecalGainRatiosGPUESProducer_cfi")
395  process.load("RecoLocalCalo.EcalRecProducers.ecalPedestalsGPUESProducer_cfi")
396  process.load("RecoLocalCalo.EcalRecProducers.ecalPulseCovariancesGPUESProducer_cfi")
397  process.load("RecoLocalCalo.EcalRecProducers.ecalPulseShapesGPUESProducer_cfi")
398  process.load("RecoLocalCalo.EcalRecProducers.ecalSamplesCorrelationGPUESProducer_cfi")
399  process.load("RecoLocalCalo.EcalRecProducers.ecalTimeBiasCorrectionsGPUESProducer_cfi")
400  process.load("RecoLocalCalo.EcalRecProducers.ecalTimeCalibConstantsGPUESProducer_cfi")
401  process.load("RecoLocalCalo.EcalRecProducers.ecalMultifitParametersGPUESProducer_cfi")
402 
403  process.load("RecoLocalCalo.EcalRecProducers.ecalRechitADCToGeVConstantGPUESProducer_cfi")
404  process.load("RecoLocalCalo.EcalRecProducers.ecalRechitChannelStatusGPUESProducer_cfi")
405  process.load("RecoLocalCalo.EcalRecProducers.ecalIntercalibConstantsGPUESProducer_cfi")
406  process.load("RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosGPUESProducer_cfi")
407  process.load("RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosRefGPUESProducer_cfi")
408  process.load("RecoLocalCalo.EcalRecProducers.ecalLaserAlphasGPUESProducer_cfi")
409  process.load("RecoLocalCalo.EcalRecProducers.ecalLinearCorrectionsGPUESProducer_cfi")
410  process.load("RecoLocalCalo.EcalRecProducers.ecalRecHitParametersGPUESProducer_cfi")
411 
412 
413  # Modules and EDAliases
414 
415  # ECAL unpacker running on gpu
416  from EventFilter.EcalRawToDigi.ecalRawToDigiGPU_cfi import ecalRawToDigiGPU as _ecalRawToDigiGPU
417  process.hltEcalDigisGPU = _ecalRawToDigiGPU.clone()
418 
419  # SwitchProducer wrapping the legacy ECAL unpacker or the ECAL digi converter from SoA format on gpu to legacy format on cpu
420  process.hltEcalDigisLegacy = process.hltEcalDigis.clone()
421  from EventFilter.EcalRawToDigi.ecalCPUDigisProducer_cfi import ecalCPUDigisProducer as _ecalCPUDigisProducer
422 
423  process.hltEcalDigis = SwitchProducerCUDA(
424  # legacy producer
425  cpu = cms.EDAlias(
426  hltEcalDigisLegacy = cms.VPSet(
427  cms.PSet(type = cms.string("EBDigiCollection")),
428  cms.PSet(type = cms.string("EEDigiCollection")),
429  cms.PSet(type = cms.string("EBDetIdedmEDCollection")),
430  cms.PSet(type = cms.string("EEDetIdedmEDCollection")),
431  cms.PSet(type = cms.string("EBSrFlagsSorted")),
432  cms.PSet(type = cms.string("EESrFlagsSorted")),
433  cms.PSet(type = cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance = cms.string("EcalIntegrityBlockSizeErrors")),
434  cms.PSet(type = cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance = cms.string("EcalIntegrityTTIdErrors")),
435  cms.PSet(type = cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance = cms.string("EcalIntegrityZSXtalIdErrors")),
436  cms.PSet(type = cms.string("EcalPnDiodeDigisSorted")),
437  cms.PSet(type = cms.string("EcalPseudoStripInputDigisSorted"), fromProductInstance = cms.string("EcalPseudoStripInputs")),
438  cms.PSet(type = cms.string("EcalTriggerPrimitiveDigisSorted"), fromProductInstance = cms.string("EcalTriggerPrimitives")),
439  )
440  ),
441  # convert ECAL digis from SoA format on gpu to legacy format on cpu
442  cuda = _ecalCPUDigisProducer.clone(
443  digisInLabelEB = ("hltEcalDigisGPU", "ebDigis"),
444  digisInLabelEE = ("hltEcalDigisGPU", "eeDigis"),
445  produceDummyIntegrityCollections = cms.bool(True)
446  )
447  )
448 
449  # ECAL multifit running on gpu
450  from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitProducerGPU_cfi import ecalUncalibRecHitProducerGPU as _ecalUncalibRecHitProducerGPU
451  process.hltEcalUncalibRecHitGPU = _ecalUncalibRecHitProducerGPU.clone(
452  digisLabelEB = ("hltEcalDigisGPU", "ebDigis"),
453  digisLabelEE = ("hltEcalDigisGPU", "eeDigis"),
454  shouldRunTimingComputation = False
455  )
456 
457  # copy the ECAL uncalibrated rechits from gpu to cpu in SoA format
458  from RecoLocalCalo.EcalRecProducers.ecalCPUUncalibRecHitProducer_cfi import ecalCPUUncalibRecHitProducer as _ecalCPUUncalibRecHitProducer
459  process.hltEcalUncalibRecHitSoA = _ecalCPUUncalibRecHitProducer.clone(
460  recHitsInLabelEB = ("hltEcalUncalibRecHitGPU", "EcalUncalibRecHitsEB"),
461  recHitsInLabelEE = ("hltEcalUncalibRecHitGPU", "EcalUncalibRecHitsEE"),
462  )
463 
464  # SwitchProducer wrapping the legacy ECAL uncalibrated rechits producer or a converter from SoA to legacy format
465  from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitConvertGPU2CPUFormat_cfi import ecalUncalibRecHitConvertGPU2CPUFormat as _ecalUncalibRecHitConvertGPU2CPUFormat
466  process.hltEcalUncalibRecHit = SwitchProducerCUDA(
467  # legacy producer
468  cpu = process.hltEcalUncalibRecHit,
469  # convert the ECAL uncalibrated rechits from SoA to legacy format
470  cuda = _ecalUncalibRecHitConvertGPU2CPUFormat.clone(
471  recHitsLabelGPUEB = ("hltEcalUncalibRecHitSoA", "EcalUncalibRecHitsEB"),
472  recHitsLabelGPUEE = ("hltEcalUncalibRecHitSoA", "EcalUncalibRecHitsEE"),
473  )
474  )
475 
476  # Reconstructing the ECAL calibrated rechits on gpu works, but is extremely slow.
477  # Disable it for the time being, until the performance has been addressed.
478  """
479  from RecoLocalCalo.EcalRecProducers.ecalRecHitGPU_cfi import ecalRecHitGPU as _ecalRecHitGPU
480  process.hltEcalRecHitGPU = _ecalRecHitGPU.clone(
481  uncalibrecHitsInLabelEB = ("hltEcalUncalibRecHitGPU","EcalUncalibRecHitsEB"),
482  uncalibrecHitsInLabelEE = ("hltEcalUncalibRecHitGPU","EcalUncalibRecHitsEE"),
483  )
484 
485  from RecoLocalCalo.EcalRecProducers.ecalCPURecHitProducer_cfi import ecalCPURecHitProducer as _ecalCPURecHitProducer
486  process.hltEcalRecHitSoA = _ecalCPURecHitProducer.clone(
487  recHitsInLabelEB = ("hltEcalRecHitGPU", "EcalRecHitsEB"),
488  recHitsInLabelEE = ("hltEcalRecHitGPU", "EcalRecHitsEE"),
489  )
490 
491  # SwitchProducer wrapping the legacy ECAL calibrated rechits producer or a converter from SoA to legacy format
492  from RecoLocalCalo.EcalRecProducers.ecalRecHitConvertGPU2CPUFormat_cfi import ecalRecHitConvertGPU2CPUFormat as _ecalRecHitConvertGPU2CPUFormat
493  process.hltEcalRecHit = SwitchProducerCUDA(
494  # legacy producer
495  cpu = process.hltEcalRecHit,
496  # convert the ECAL calibrated rechits from SoA to legacy format
497  cuda = _ecalRecHitConvertGPU2CPUFormat.clone(
498  recHitsLabelGPUEB = ("hltEcalRecHitSoA", "EcalRecHitsEB"),
499  recHitsLabelGPUEE = ("hltEcalRecHitSoA", "EcalRecHitsEE"),
500  )
501  )
502  """
503 
504  # SwitchProducer wrapping the legacy ECAL rechits producer
505  # the gpu unpacker does not produce the TPs used for the recovery, so the SwitchProducer alias does not provide them:
506  # - the cpu uncalibrated rechit producer may mark them for recovery, read the TPs explicitly from the legacy unpacker
507  # - the gpu uncalibrated rechit producer does not flag them for recovery, so the TPs are not necessary
508  process.hltEcalRecHit = SwitchProducerCUDA(
509  cpu = process.hltEcalRecHit.clone(
510  triggerPrimitiveDigiCollection = ('hltEcalDigisLegacy', 'EcalTriggerPrimitives')
511  ),
512  cuda = process.hltEcalRecHit.clone(
513  triggerPrimitiveDigiCollection = 'unused'
514  )
515  )
516 
517  # Tasks and Sequences
518 
519  process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask = cms.Task(
520  process.hltEcalDigisGPU, # unpack ECAL digis on gpu
521  process.hltEcalDigisLegacy, # legacy producer, referenced in the SwitchProducer
522  process.hltEcalDigis, # SwitchProducer
523  process.hltEcalUncalibRecHitGPU, # run ECAL local reconstruction and multifit on gpu
524  process.hltEcalUncalibRecHitSoA, # needed by hltEcalPhiSymFilter - copy to host
525  process.hltEcalUncalibRecHit, # needed by hltEcalPhiSymFilter - convert to legacy format
526  # process.hltEcalRecHitGPU, # make ECAL calibrated rechits on gpu
527  # process.hltEcalRecHitSoA, # copy to host
528  process.hltEcalDetIdToBeRecovered, # legacy producer
529  process.hltEcalRecHit) # legacy producer
530 
531  process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence(
532  process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask)
533 
534  if hasHLTEcalPreshowerSeq:
535  process.HLTPreshowerTask = cms.Task(
536  process.hltEcalPreshowerDigis, # unpack ECAL preshower digis on the host
537  process.hltEcalPreshowerRecHit) # build ECAL preshower rechits on the host
538 
539  process.HLTPreshowerSequence = cms.Sequence(process.HLTPreshowerTask)
540 
541  process.HLTDoFullUnpackingEgammaEcalTask = cms.Task(
542  process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask,
543  process.HLTPreshowerTask)
544 
545  process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence(
546  process.HLTDoFullUnpackingEgammaEcalTask)
547 
548  process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence(
549  process.HLTDoFullUnpackingEgammaEcalTask)
550 
551  # done
552  return process
553 
# customisation for offloading the HCAL local reconstruction via CUDA if a supported gpu is present
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
def customizeHLTforPatatrack.customiseHcalLocalReconstruction (   process)

Definition at line 554 of file customizeHLTforPatatrack.py.

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

556 
557  hasHLTDoLocalHcalSeq = 'HLTDoLocalHcalSequence' in process.__dict__
558  if not (hasHLTDoLocalHcalSeq or 'HLTStoppedHSCPLocalHcalReco' in process.__dict__):
559  return process
560 
561  # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases
562 
563  if hasHLTDoLocalHcalSeq:
564  process.HLTDoLocalHcalSequence = cms.Sequence()
565  process.HLTStoppedHSCPLocalHcalReco = cms.Sequence()
566 
567 
568  # Event Setup
569 
570  process.load("EventFilter.HcalRawToDigi.hcalElectronicsMappingGPUESProducer_cfi")
571 
572  process.load("RecoLocalCalo.HcalRecProducers.hcalChannelQualityGPUESProducer_cfi")
573  process.load("RecoLocalCalo.HcalRecProducers.hcalGainsGPUESProducer_cfi")
574  process.load("RecoLocalCalo.HcalRecProducers.hcalGainWidthsGPUESProducer_cfi")
575  process.load("RecoLocalCalo.HcalRecProducers.hcalLUTCorrsGPUESProducer_cfi")
576  process.load("RecoLocalCalo.HcalRecProducers.hcalConvertedPedestalsGPUESProducer_cfi")
577  process.load("RecoLocalCalo.HcalRecProducers.hcalConvertedEffectivePedestalsGPUESProducer_cfi")
578  process.hcalConvertedEffectivePedestalsGPUESProducer.label0 = "withTopoEff"
579  process.load("RecoLocalCalo.HcalRecProducers.hcalConvertedPedestalWidthsGPUESProducer_cfi")
580  process.load("RecoLocalCalo.HcalRecProducers.hcalConvertedEffectivePedestalWidthsGPUESProducer_cfi")
581  process.hcalConvertedEffectivePedestalWidthsGPUESProducer.label0 = "withTopoEff"
582  process.hcalConvertedEffectivePedestalWidthsGPUESProducer.label1 = "withTopoEff"
583  process.load("RecoLocalCalo.HcalRecProducers.hcalQIECodersGPUESProducer_cfi")
584  process.load("RecoLocalCalo.HcalRecProducers.hcalRecoParamsWithPulseShapesGPUESProducer_cfi")
585  process.load("RecoLocalCalo.HcalRecProducers.hcalRespCorrsGPUESProducer_cfi")
586  process.load("RecoLocalCalo.HcalRecProducers.hcalTimeCorrsGPUESProducer_cfi")
587  process.load("RecoLocalCalo.HcalRecProducers.hcalQIETypesGPUESProducer_cfi")
588  process.load("RecoLocalCalo.HcalRecProducers.hcalSiPMParametersGPUESProducer_cfi")
589  process.load("RecoLocalCalo.HcalRecProducers.hcalSiPMCharacteristicsGPUESProducer_cfi")
590  process.load("RecoLocalCalo.HcalRecProducers.hcalMahiPulseOffsetsGPUESProducer_cfi")
591 
592 
593  # Modules and EDAliases
594 
595  # The HCAL unpacker running on the gpu supports only the HB and HE digis.
596  # So, run the legacy unacker on the cpu, then convert the HB and HE digis
597  # to SoA format and copy them to the gpu.
598  from EventFilter.HcalRawToDigi.hcalDigisProducerGPU_cfi import hcalDigisProducerGPU as _hcalDigisProducerGPU
599  process.hltHcalDigisGPU = _hcalDigisProducerGPU.clone(
600  hbheDigisLabel = "hltHcalDigis",
601  qie11DigiLabel = "hltHcalDigis",
602  digisLabelF01HE = "",
603  digisLabelF5HB = "",
604  digisLabelF3HB = ""
605  )
606 
607  # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu
608  from RecoLocalCalo.HcalRecProducers.hbheRecHitProducerGPU_cfi import hbheRecHitProducerGPU as _hbheRecHitProducerGPU
609  process.hltHbherecoGPU = _hbheRecHitProducerGPU.clone(
610  digisLabelF01HE = "hltHcalDigisGPU",
611  digisLabelF5HB = "hltHcalDigisGPU",
612  digisLabelF3HB = "hltHcalDigisGPU",
613  recHitsLabelM0HBHE = ""
614  )
615 
616  # transfer the HCAL rechits to the cpu, and convert them to the legacy format
617  from RecoLocalCalo.HcalRecProducers.hcalCPURecHitsProducer_cfi import hcalCPURecHitsProducer as _hcalCPURecHitsProducer
618  process.hltHbherecoFromGPU = _hcalCPURecHitsProducer.clone(
619  recHitsM0LabelIn = "hltHbherecoGPU",
620  recHitsM0LabelOut = "",
621  recHitsLegacyLabelOut = ""
622  )
623 
624  # SwitchProducer between the legacy producer and the copy from gpu with conversion
625  process.hltHbhereco = SwitchProducerCUDA(
626  # legacy producer
627  cpu = process.hltHbhereco.clone(),
628  # alias to the rechits converted to legacy format
629  cuda = cms.EDAlias(
630  hltHbherecoFromGPU = cms.VPSet(
631  cms.PSet(type = cms.string("HBHERecHitsSorted"))
632  )
633  )
634  )
635 
636 
637  # Tasks and Sequences
638  if hasHLTDoLocalHcalSeq:
639  process.HLTDoLocalHcalTask = cms.Task(
640  process.hltHcalDigis, # legacy producer, unpack HCAL digis on cpu
641  process.hltHcalDigisGPU, # copy to gpu and convert to SoA format
642  process.hltHbherecoGPU, # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu
643  process.hltHbherecoFromGPU, # transfer the HCAL rechits to the cpu, and convert them to the legacy format
644  process.hltHbhereco, # SwitchProducer between the legacy producer and the copy from gpu with conversion
645  process.hltHfprereco, # legacy producer
646  process.hltHfreco, # legacy producer
647  process.hltHoreco) # legacy producer
648 
649  process.HLTDoLocalHcalSequence = cms.Sequence(
650  process.HLTDoLocalHcalTask)
651 
652  process.HLTStoppedHSCPLocalHcalRecoTask = cms.Task(
653  process.hltHcalDigis, # legacy producer, unpack HCAL digis on cpu
654  process.hltHcalDigisGPU, # copy to gpu and convert to SoA format
655  process.hltHbherecoGPU, # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu
656  process.hltHbherecoFromGPU, # transfer the HCAL rechits to the cpu, and convert them to the legacy format
657  process.hltHbhereco) # SwitchProducer between the legacy producer and the copy from gpu with conversion
658 
659  process.HLTStoppedHSCPLocalHcalReco = cms.Sequence(
660  process.HLTStoppedHSCPLocalHcalRecoTask)
661 
662 
663  # done
664  return process
665 
666 
# customisation to enable pixel triplets instead of quadruplets
def customizeHLTforPatatrack.customisePixelLocalReconstruction (   process)

Definition at line 92 of file customizeHLTforPatatrack.py.

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

92 
94 
95  if not 'HLTDoLocalPixelSequence' in process.__dict__:
96  return process
97 
98  # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases
99 
100  process.HLTDoLocalPixelSequence = cms.Sequence()
101 
102 
103  # Event Setup
104 
105  process.load("CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi") # this should be used only on GPUs, will crash otherwise
106  process.load("CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi") # this should be used only on GPUs, will crash otherwise
107  process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEFastESProducer_cfi")
108 
109 
110  # Modules and EDAliases
111 
112  # referenced in HLTDoLocalPixelTask
113 
114  # transfer the beamspot to the gpu
115  from RecoVertex.BeamSpotProducer.offlineBeamSpotToCUDA_cfi import offlineBeamSpotToCUDA as _offlineBeamSpotToCUDA
116  process.hltOnlineBeamSpotToCUDA = _offlineBeamSpotToCUDA.clone(
117  src = "hltOnlineBeamSpot"
118  )
119 
120  # reconstruct the pixel digis and clusters on the gpu
121  from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi import siPixelRawToClusterCUDA as _siPixelRawToClusterCUDA
122  process.hltSiPixelClustersCUDA = _siPixelRawToClusterCUDA.clone(
123  # use the same thresholds as the legacy module
124  clusterThreshold_layer1 = process.hltSiPixelClusters.ClusterThreshold_L1,
125  clusterThreshold_otherLayers = process.hltSiPixelClusters.ClusterThreshold
126  )
127  # use the pixel channel calibrations scheme for Run 3
128  run3_common.toModify(process.hltSiPixelClustersCUDA, isRun2 = False)
129 
130  # copy the pixel digis errors to the host
131  from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi import siPixelDigiErrorsSoAFromCUDA as _siPixelDigiErrorsSoAFromCUDA
132  process.hltSiPixelDigiErrorsSoA = _siPixelDigiErrorsSoAFromCUDA.clone(
133  src = "hltSiPixelClustersCUDA"
134  )
135 
136  # copy the pixel digis (except errors) and clusters to the host
137  from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA
138  process.hltSiPixelDigisSoA = _siPixelDigisSoAFromCUDA.clone(
139  src = "hltSiPixelClustersCUDA"
140  )
141 
142  # reconstruct the pixel digis on the cpu
143  process.hltSiPixelDigisLegacy = process.hltSiPixelDigis.clone()
144 
145  # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors to the legacy format
146  from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA
147  process.hltSiPixelDigis = SwitchProducerCUDA(
148  # legacy producer
149  cpu = cms.EDAlias(
150  hltSiPixelDigisLegacy = cms.VPSet(
151  cms.PSet(type = cms.string("DetIdedmEDCollection")),
152  cms.PSet(type = cms.string("SiPixelRawDataErroredmDetSetVector")),
153  cms.PSet(type = cms.string("PixelFEDChanneledmNewDetSetVector"))
154  )
155  ),
156  # conversion from SoA to legacy format
157  cuda = _siPixelDigiErrorsFromSoA.clone(
158  digiErrorSoASrc = "hltSiPixelDigiErrorsSoA",
159  UsePhase1 = True
160  )
161  )
162 
163  # reconstruct the pixel clusters on the cpu
164  process.hltSiPixelClustersLegacy = process.hltSiPixelClusters.clone(
165  src = "hltSiPixelDigisLegacy"
166  )
167 
168  # SwitchProducer wrapping a subset of the legacy pixel cluster producer, or the conversion of the pixel digis (except errors) and clusters to the legacy format
169  from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA
170  process.hltSiPixelClusters = SwitchProducerCUDA(
171  # legacy producer
172  cpu = cms.EDAlias(
173  hltSiPixelClustersLegacy = cms.VPSet(
174  cms.PSet(type = cms.string("SiPixelClusteredmNewDetSetVector"))
175  )
176  ),
177  # conversion from SoA to legacy format
178  cuda = _siPixelDigisClustersFromSoA.clone(
179  src = "hltSiPixelDigisSoA",
180  produceDigis = False,
181  storeDigis = False,
182  # use the same thresholds as the legacy module
183  clusterThreshold_layer1 = process.hltSiPixelClusters.ClusterThreshold_L1,
184  clusterThreshold_otherLayers = process.hltSiPixelClusters.ClusterThreshold
185  )
186  )
187 
188  # reconstruct the pixel rechits on the gpu
189  from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA
190  process.hltSiPixelRecHitsCUDA = _siPixelRecHitCUDA.clone(
191  src = "hltSiPixelClustersCUDA",
192  beamSpot = "hltOnlineBeamSpotToCUDA"
193  )
194 
195  # cpu only: produce the pixel rechits in SoA and legacy format, from the legacy clusters
196  from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy as _siPixelRecHitSoAFromLegacy
197  process.hltSiPixelRecHitSoA = _siPixelRecHitSoAFromLegacy.clone(
198  src = "hltSiPixelClusters",
199  beamSpot = "hltOnlineBeamSpot",
200  convertToLegacy = True
201  )
202 
203  # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA
204  from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA
205  process.hltSiPixelRecHits = SwitchProducerCUDA(
206  # legacy producer
207  cpu = cms.EDAlias(
208  hltSiPixelRecHitSoA = cms.VPSet(
209  cms.PSet(type = cms.string("SiPixelRecHitedmNewDetSetVector")),
210  cms.PSet(type = cms.string("uintAsHostProduct"))
211  )
212  ),
213  # conversion from SoA to legacy format
214  cuda = _siPixelRecHitFromCUDA.clone(
215  pixelRecHitSrc = "hltSiPixelRecHitsCUDA",
216  src = "hltSiPixelClusters"
217  )
218  )
219 
220 
221  # Tasks and Sequences
222 
223  process.HLTDoLocalPixelTask = cms.Task(
224  process.hltOnlineBeamSpotToCUDA, # transfer the beamspot to the gpu
225  process.hltSiPixelClustersCUDA, # reconstruct the pixel digis and clusters on the gpu
226  process.hltSiPixelRecHitsCUDA, # reconstruct the pixel rechits on the gpu
227  process.hltSiPixelDigisSoA, # copy the pixel digis (except errors) and clusters to the host
228  process.hltSiPixelDigiErrorsSoA, # copy the pixel digis errors to the host
229  process.hltSiPixelDigisLegacy, # legacy pixel digis producer
230  process.hltSiPixelDigis, # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors from SoA
231  process.hltSiPixelClustersLegacy, # legacy pixel cluster producer
232  process.hltSiPixelClusters, # SwitchProducer wrapping a subset of the legacy pixel cluster producer, or the conversion of the pixel digis (except errors) and clusters from SoA
233  process.hltSiPixelClustersCache, # legacy module, used by the legacy pixel quadruplet producer
234  process.hltSiPixelRecHitSoA, # pixel rechits on cpu, in SoA & legacy format
235  process.hltSiPixelRecHits) # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA
236 
237  process.HLTDoLocalPixelSequence = cms.Sequence(process.HLTDoLocalPixelTask)
238 
239 
240  # workaround for AlCa paths
241  for AlCaPathName in ['AlCa_LumiPixelsCounts_Random_v1', 'AlCa_LumiPixelsCounts_ZeroBias_v1']:
242  if AlCaPathName in process.__dict__:
243  AlCaPath = getattr(process, AlCaPathName)
244  # replace hltSiPixelDigis+hltSiPixelClusters with HLTDoLocalPixelSequence
245  hasSiPixelDigis, hasSiPixelClusters = False, False
246  for (itemLabel, itemName) in AlCaPath.directDependencies():
247  if itemLabel != 'modules': continue
248  if itemName == 'hltSiPixelDigis': hasSiPixelDigis = True
249  elif itemName == 'hltSiPixelClusters': hasSiPixelClusters = True
250  if hasSiPixelDigis and hasSiPixelClusters:
251  AlCaPath.remove(process.hltSiPixelClusters)
252  AlCaPath.replace(process.hltSiPixelDigis, process.HLTDoLocalPixelSequence)
253 
254 
255  # done
256  return process
257 
258 
# customisation for running the "Patatrack" pixel track reconstruction
def customizeHLTforPatatrack.customisePixelTrackReconstruction (   process)

Definition at line 259 of file customizeHLTforPatatrack.py.

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

261 
262  if not 'HLTRecoPixelTracksSequence' in process.__dict__:
263  return process
264 
265  hasHLTPixelVertexReco = 'HLTRecopixelvertexingSequence' in process.__dict__
266 
267  # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases
268 
269  process.HLTRecoPixelTracksSequence = cms.Sequence()
270  if hasHLTPixelVertexReco:
271  process.HLTRecopixelvertexingSequence = cms.Sequence()
272 
273 
274  # Modules and EDAliases
275 
276  # referenced in process.HLTRecoPixelTracksTask
277 
278  # build pixel ntuplets and pixel tracks in SoA format on gpu
279  from RecoPixelVertexing.PixelTriplets.pixelTracksCUDA_cfi import pixelTracksCUDA as _pixelTracksCUDA
280  process.hltPixelTracksCUDA = _pixelTracksCUDA.clone(
281  idealConditions = False,
282  pixelRecHitSrc = "hltSiPixelRecHitsCUDA",
283  onGPU = True
284  )
285  # use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows
286  run3_common.toModify(process.hltPixelTracksCUDA, idealConditions = True)
287 
288  # SwitchProducer providing the pixel tracks in SoA format on cpu
289  from RecoPixelVertexing.PixelTrackFitting.pixelTracksSoA_cfi import pixelTracksSoA as _pixelTracksSoA
290  process.hltPixelTracksSoA = SwitchProducerCUDA(
291  # build pixel ntuplets and pixel tracks in SoA format on cpu
292  cpu = _pixelTracksCUDA.clone(
293  idealConditions = False,
294  pixelRecHitSrc = "hltSiPixelRecHitSoA",
295  onGPU = False
296  ),
297  # transfer the pixel tracks in SoA format to the host
298  cuda = _pixelTracksSoA.clone(
299  src = "hltPixelTracksCUDA"
300  )
301  )
302  # use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows
303  run3_common.toModify(process.hltPixelTracksSoA.cpu, idealConditions = True)
304 
305  # convert the pixel tracks from SoA to legacy format
306  from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackProducerFromSoA
307  process.hltPixelTracks = _pixelTrackProducerFromSoA.clone(
308  beamSpot = "hltOnlineBeamSpot",
309  pixelRecHitLegacySrc = "hltSiPixelRecHits",
310  trackSrc = "hltPixelTracksSoA"
311  )
312 
313 
314  # referenced in process.HLTRecopixelvertexingTask
315  if hasHLTPixelVertexReco:
316 
317  # build pixel vertices in SoA format on gpu
318  from RecoPixelVertexing.PixelVertexFinding.pixelVerticesCUDA_cfi import pixelVerticesCUDA as _pixelVerticesCUDA
319  process.hltPixelVerticesCUDA = _pixelVerticesCUDA.clone(
320  pixelTrackSrc = "hltPixelTracksCUDA",
321  onGPU = True
322  )
323 
324  # build or transfer pixel vertices in SoA format on cpu
325  from RecoPixelVertexing.PixelVertexFinding.pixelVerticesSoA_cfi import pixelVerticesSoA as _pixelVerticesSoA
326  process.hltPixelVerticesSoA = SwitchProducerCUDA(
327  # build pixel vertices in SoA format on cpu
328  cpu = _pixelVerticesCUDA.clone(
329  pixelTrackSrc = "hltPixelTracksSoA",
330  onGPU = False
331  ),
332  # transfer the pixel vertices in SoA format to cpu
333  cuda = _pixelVerticesSoA.clone(
334  src = "hltPixelVerticesCUDA"
335  )
336  )
337 
338  # convert the pixel vertices from SoA to legacy format
339  from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA
340  process.hltPixelVertices = _pixelVertexFromSoA.clone(
341  src = "hltPixelVerticesSoA",
342  TrackCollection = "hltPixelTracks",
343  beamSpot = "hltOnlineBeamSpot"
344  )
345 
346 
347  # Tasks and Sequences
348 
349  process.HLTRecoPixelTracksTask = cms.Task(
350  process.hltPixelTracksTrackingRegions, # from the original sequence
351  process.hltPixelTracksCUDA, # pixel ntuplets on gpu, in SoA format
352  process.hltPixelTracksSoA, # pixel ntuplets on cpu, in SoA format
353  process.hltPixelTracks) # pixel tracks on cpu, in legacy format
354 
355 
356  process.HLTRecoPixelTracksSequence = cms.Sequence(process.HLTRecoPixelTracksTask)
357 
358  if hasHLTPixelVertexReco:
359  process.HLTRecopixelvertexingTask = cms.Task(
360  process.HLTRecoPixelTracksTask,
361  process.hltPixelVerticesCUDA, # pixel vertices on gpu, in SoA format
362  process.hltPixelVerticesSoA, # pixel vertices on cpu, in SoA format
363  process.hltPixelVertices, # pixel vertices on cpu, in legacy format
364  process.hltTrimmedPixelVertices) # from the original sequence
365 
366  process.HLTRecopixelvertexingSequence = cms.Sequence(
367  process.hltPixelTracksFitter + # not used here, kept for compatibility with legacy sequences
368  process.hltPixelTracksFilter, # not used here, kept for compatibility with legacy sequences
369  process.HLTRecopixelvertexingTask)
370 
371 
372  # done
373  return process
374 
375 
# customisation for offloading the ECAL local reconstruction via CUDA if a supported gpu is present
def customizeHLTforPatatrack.customizeHLTforPatatrack (   process)

Definition at line 684 of file customizeHLTforPatatrack.py.

References customiseCommon(), customiseEcalLocalReconstruction(), customiseHcalLocalReconstruction(), customisePixelLocalReconstruction(), and customisePixelTrackReconstruction().

685 def customizeHLTforPatatrack(process):
686  process = customiseCommon(process)
687  process = customisePixelLocalReconstruction(process)
688  process = customisePixelTrackReconstruction(process)
689  process = customiseEcalLocalReconstruction(process)
690  process = customiseHcalLocalReconstruction(process)
691  return process
692 
693 
# customisation for running the Patatrack triplets reconstruction, with automatic offload via CUDA when a supported gpu is available
def customizeHLTforPatatrack.customizeHLTforPatatrackTriplets (   process)

Definition at line 694 of file customizeHLTforPatatrack.py.

References customiseCommon(), customiseEcalLocalReconstruction(), customiseHcalLocalReconstruction(), customisePixelLocalReconstruction(), customisePixelTrackReconstruction(), and enablePatatrackPixelTriplets().

Referenced by applyL2TauTag.update().

696  process = customiseCommon(process)
697  process = customisePixelLocalReconstruction(process)
698  process = customisePixelTrackReconstruction(process)
699  process = customiseEcalLocalReconstruction(process)
700  process = customiseHcalLocalReconstruction(process)
701  process = enablePatatrackPixelTriplets(process)
702  return process
703 
def customizeHLTforPatatrack.enablePatatrackPixelTriplets (   process)

Definition at line 667 of file customizeHLTforPatatrack.py.

Referenced by customizeHLTforPatatrackTriplets().

668 def enablePatatrackPixelTriplets(process):
669 
670  if 'hltPixelTracksCUDA' in process.__dict__:
671  # configure GPU pixel tracks for triplets
672  process.hltPixelTracksCUDA.minHitsPerNtuplet = 3
673  process.hltPixelTracksCUDA.includeJumpingForwardDoublets = True
674 
675  if 'hltPixelTracksSoA' in process.__dict__:
676  # configure CPU pixel tracks for triplets
677  process.hltPixelTracksSoA.cpu.minHitsPerNtuplet = 3
678  process.hltPixelTracksSoA.cpu.includeJumpingForwardDoublets = True
679 
680  # done
681  return process
682 
683 
# customisation for running the Patatrack reconstruction, with automatic offload via CUDA when a supported gpu is available
def customizeHLTforPatatrack.forceGpuOffload (   status = True)

Definition at line 9 of file customizeHLTforPatatrack.py.

9 
10 def forceGpuOffload(status = True):
11  import HeterogeneousCore.CUDACore.SwitchProducerCUDA
12  HeterogeneousCore.CUDACore.SwitchProducerCUDA._cuda_enabled_cached = bool(status)
13 
14 
# reset the SwitchProducerCUDA choice to pick a backend depending on the availability of a supported gpu
def customizeHLTforPatatrack.resetGpuOffload ( )

Definition at line 15 of file customizeHLTforPatatrack.py.

15 
16 def resetGpuOffload():
17  import HeterogeneousCore.CUDACore.SwitchProducerCUDA
18  HeterogeneousCore.CUDACore.SwitchProducerCUDA._cuda_enabled_cached = None
19  HeterogeneousCore.CUDACore.SwitchProducerCUDA._switch_cuda()
20 
21 
# customisation for running the Patatrack reconstruction, common parts