CMS 3D CMS Logo

Functions
customizeHLTforPatatrack Namespace Reference

Functions

def _addConsumerPath (process)
 
def consumeCPULegacyProducts (process)
 
def consumeCPUSoAProducts (process)
 
def consumeGPUSoAProducts (process)
 
def customiseCommon (process)
 
def customiseEcalLocalReconstruction (process)
 
def customiseHcalLocalReconstruction (process)
 
def customisePixelLocalReconstruction (process)
 
def customisePixelTrackReconstruction (process)
 
def customizeHLTforPatatrack (process)
 
def customizeHLTforPatatrackTriplets (process)
 
def enablePatatrackPixelTriplets (process)
 
def forceGpuOffload (status=True)
 
def resetGpuOffload ()
 

Function Documentation

◆ _addConsumerPath()

def customizeHLTforPatatrack._addConsumerPath (   process)
private

Definition at line 678 of file customizeHLTforPatatrack.py.

678 def _addConsumerPath(process):
679  # add to a path all consumers and the tasks that define the producers
680  process.Consumer = cms.Path(
681  process.HLTBeginSequence +
682  process.hltPixelConsumer +
683  process.hltEcalConsumer +
684  process.hltHbheConsumer,
685  process.HLTDoLocalPixelTask,
686  process.HLTRecoPixelTracksTask,
687  process.HLTRecopixelvertexingTask,
688  process.HLTDoFullUnpackingEgammaEcalTask,
689  process.HLTDoLocalHcalTask,
690  )
691 
692  if 'HLTSchedule' in process.__dict__:
693  process.HLTSchedule.append(process.Consumer)
694  if process.schedule is not None:
695  process.schedule.append(process.Consumer)
696 
697  # done
698  return process
699 
700 

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

◆ consumeCPULegacyProducts()

def customizeHLTforPatatrack.consumeCPULegacyProducts (   process)

Definition at line 746 of file customizeHLTforPatatrack.py.

746 def consumeCPULegacyProducts(process):
747  # consume the Pixel tracks and vertices on the CPU in legacy format
748  process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer",
749  eventProducts = cms.untracked.vstring( 'hltPixelTracks', 'hltPixelVertices' )
750  )
751 
752  # consume the ECAL runcalibrated echits on the CPU in legacy format
753  process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer",
754  eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHit' )
755  )
756 
757  # consume the HCAL rechits on the CPU in legacy format
758  process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer",
759  eventProducts = cms.untracked.vstring( 'hltHbhereco' )
760  )
761 
762  # add to a path all consumers and the tasks that define the producers
763  process = _addConsumerPath(process)
764 
765  # done
766  return process

References _addConsumerPath().

◆ consumeCPUSoAProducts()

def customizeHLTforPatatrack.consumeCPUSoAProducts (   process)

Definition at line 724 of file customizeHLTforPatatrack.py.

724 def consumeCPUSoAProducts(process):
725  # consume the Pixel tracks and vertices on the CPU in SoA format
726  process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer",
727  eventProducts = cms.untracked.vstring( 'hltPixelTracksSoA', 'hltPixelVerticesSoA' )
728  )
729 
730  # consume the ECAL uncalibrated rechits on the CPU in SoA format
731  process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer",
732  eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHitSoA' )
733  )
734 
735  # consume the HCAL rechits on the CPU in legacy format
736  process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer",
737  eventProducts = cms.untracked.vstring( 'hltHbhereco' )
738  )
739 
740  # add to a path all consumers and the tasks that define the producers
741  process = _addConsumerPath(process)
742 
743  # done
744  return process
745 

References _addConsumerPath().

◆ consumeGPUSoAProducts()

def customizeHLTforPatatrack.consumeGPUSoAProducts (   process)

Definition at line 701 of file customizeHLTforPatatrack.py.

701 def consumeGPUSoAProducts(process):
702  # consume the Pixel tracks and vertices on the GPU in SoA format
703  process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer",
704  eventProducts = cms.untracked.vstring( 'hltPixelTracksCUDA', 'hltPixelVerticesCUDA' )
705  )
706 
707  # consume the ECAL uncalibrated rechits on the GPU in SoA format
708  process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer",
709  eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHitGPU' )
710  )
711 
712  # consume the HCAL rechits on the GPU in SoA format
713  process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer",
714  eventProducts = cms.untracked.vstring( 'hltHbherecoGPU' )
715  )
716 
717  # add to a path all consumers and the tasks that define the producers
718  process = _addConsumerPath(process)
719 
720  # done
721  return process
722 
723 

References _addConsumerPath().

◆ customiseCommon()

def customizeHLTforPatatrack.customiseCommon (   process)

Definition at line 22 of file customizeHLTforPatatrack.py.

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

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

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

◆ customiseEcalLocalReconstruction()

def customizeHLTforPatatrack.customiseEcalLocalReconstruction (   process)

Definition at line 350 of file customizeHLTforPatatrack.py.

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

References any().

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

◆ customiseHcalLocalReconstruction()

def customizeHLTforPatatrack.customiseHcalLocalReconstruction (   process)

Definition at line 528 of file customizeHLTforPatatrack.py.

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

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

◆ customisePixelLocalReconstruction()

def customizeHLTforPatatrack.customisePixelLocalReconstruction (   process)

Definition at line 95 of file customizeHLTforPatatrack.py.

96 
97  if not 'HLTDoLocalPixelSequence' in process.__dict__:
98  return process
99 
100  # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases
101 
102  process.HLTDoLocalPixelSequence = cms.Sequence()
103 
104 
105  # Event Setup
106 
107  process.load("CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi") # this should be used only on GPUs, will crash otherwise
108  process.load("CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi") # this should be used only on GPUs, will crash otherwise
109  process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEFastESProducer_cfi")
110 
111 
112  # Modules and EDAliases
113 
114  # referenced in HLTDoLocalPixelTask
115 
116  # transfer the beamspot to the gpu
117  from RecoVertex.BeamSpotProducer.offlineBeamSpotToCUDA_cfi import offlineBeamSpotToCUDA as _offlineBeamSpotToCUDA
118  process.hltOnlineBeamSpotToCUDA = _offlineBeamSpotToCUDA.clone(
119  src = "hltOnlineBeamSpot"
120  )
121 
122  # reconstruct the pixel digis and clusters on the gpu
123  from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi import siPixelRawToClusterCUDA as _siPixelRawToClusterCUDA
124  process.hltSiPixelClustersCUDA = _siPixelRawToClusterCUDA.clone()
125  # use the pixel channel calibrations scheme for Run 3
126  run3_common.toModify(process.hltSiPixelClustersCUDA, isRun2 = False)
127 
128  # copy the pixel digis errors to the host
129  from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi import siPixelDigiErrorsSoAFromCUDA as _siPixelDigiErrorsSoAFromCUDA
130  process.hltSiPixelDigiErrorsSoA = _siPixelDigiErrorsSoAFromCUDA.clone(
131  src = "hltSiPixelClustersCUDA"
132  )
133 
134  # copy the pixel digis (except errors) and clusters to the host
135  from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA
136  process.hltSiPixelDigisSoA = _siPixelDigisSoAFromCUDA.clone(
137  src = "hltSiPixelClustersCUDA"
138  )
139 
140  # reconstruct the pixel digis on the cpu
141  process.hltSiPixelDigisLegacy = process.hltSiPixelDigis.clone()
142 
143  # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors to the legacy format
144  from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA
145  process.hltSiPixelDigis = SwitchProducerCUDA(
146  # legacy producer
147  cpu = cms.EDAlias(
148  hltSiPixelDigisLegacy = cms.VPSet(
149  cms.PSet(type = cms.string("DetIdedmEDCollection")),
150  cms.PSet(type = cms.string("SiPixelRawDataErroredmDetSetVector")),
151  cms.PSet(type = cms.string("PixelFEDChanneledmNewDetSetVector"))
152  )
153  ),
154  # conversion from SoA to legacy format
155  cuda = _siPixelDigiErrorsFromSoA.clone(
156  digiErrorSoASrc = "hltSiPixelDigiErrorsSoA",
157  UsePhase1 = True
158  )
159  )
160 
161  # reconstruct the pixel clusters on the cpu
162  process.hltSiPixelClustersLegacy = process.hltSiPixelClusters.clone()
163 
164  # 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
165  from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA
166  process.hltSiPixelClusters = SwitchProducerCUDA(
167  # legacy producer
168  cpu = cms.EDAlias(
169  hltSiPixelClustersLegacy = cms.VPSet(
170  cms.PSet(type = cms.string("SiPixelClusteredmNewDetSetVector"))
171  )
172  ),
173  # conversion from SoA to legacy format
174  cuda = _siPixelDigisClustersFromSoA.clone(
175  src = "hltSiPixelDigisSoA",
176  produceDigis = False,
177  storeDigis = False,
178  )
179  )
180 
181  # reconstruct the pixel rechits on the gpu
182  from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA
183  process.hltSiPixelRecHitsCUDA = _siPixelRecHitCUDA.clone(
184  src = "hltSiPixelClustersCUDA",
185  beamSpot = "hltOnlineBeamSpotToCUDA"
186  )
187 
188  # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA
189  from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA
190  process.hltSiPixelRecHits = SwitchProducerCUDA(
191  # legacy producer
192  cpu = process.hltSiPixelRecHits,
193  # conversion from SoA to legacy format
194  cuda = _siPixelRecHitFromCUDA.clone(
195  pixelRecHitSrc = "hltSiPixelRecHitsCUDA",
196  src = "hltSiPixelClusters"
197  )
198  )
199 
200 
201  # Tasks and Sequences
202 
203  process.HLTDoLocalPixelTask = cms.Task(
204  process.hltOnlineBeamSpotToCUDA, # transfer the beamspot to the gpu
205  process.hltSiPixelClustersCUDA, # reconstruct the pixel digis and clusters on the gpu
206  process.hltSiPixelRecHitsCUDA, # reconstruct the pixel rechits on the gpu
207  process.hltSiPixelDigisSoA, # copy the pixel digis (except errors) and clusters to the host
208  process.hltSiPixelDigiErrorsSoA, # copy the pixel digis errors to the host
209  process.hltSiPixelDigisLegacy, # legacy pixel digis producer
210  process.hltSiPixelDigis, # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors from SoA
211  process.hltSiPixelClustersLegacy, # legacy pixel cluster producer
212  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
213  process.hltSiPixelClustersCache, # legacy module, used by the legacy pixel quadruplet producer
214  process.hltSiPixelRecHits) # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA
215 
216  process.HLTDoLocalPixelSequence = cms.Sequence(process.HLTDoLocalPixelTask)
217 
218 
219  # done
220  return process
221 
222 
223 # customisation for running the "Patatrack" pixel track reconstruction

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

◆ customisePixelTrackReconstruction()

def customizeHLTforPatatrack.customisePixelTrackReconstruction (   process)

Definition at line 224 of file customizeHLTforPatatrack.py.

225 
226  if not 'HLTRecoPixelTracksSequence' in process.__dict__:
227  return process
228 
229  hasHLTPixelVertexReco = 'HLTRecopixelvertexingSequence' in process.__dict__
230 
231  # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases
232 
233  process.HLTRecoPixelTracksSequence = cms.Sequence()
234  if hasHLTPixelVertexReco:
235  process.HLTRecopixelvertexingSequence = cms.Sequence()
236 
237 
238  # Modules and EDAliases
239 
240  # referenced in process.HLTRecoPixelTracksTask
241 
242  # cpu only: convert the pixel rechits from legacy to SoA format
243  from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy as _siPixelRecHitSoAFromLegacy
244  process.hltSiPixelRecHitSoA = _siPixelRecHitSoAFromLegacy.clone(
245  src = "hltSiPixelClusters",
246  beamSpot = "hltOnlineBeamSpot",
247  convertToLegacy = True
248  )
249 
250  # build pixel ntuplets and pixel tracks in SoA format on gpu
251  from RecoPixelVertexing.PixelTriplets.pixelTracksCUDA_cfi import pixelTracksCUDA as _pixelTracksCUDA
252  process.hltPixelTracksCUDA = _pixelTracksCUDA.clone(
253  idealConditions = False,
254  pixelRecHitSrc = "hltSiPixelRecHitsCUDA",
255  onGPU = True
256  )
257  # use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows
258  run3_common.toModify(process.hltPixelTracksCUDA, idealConditions = True)
259 
260  # SwitchProducer providing the pixel tracks in SoA format on cpu
261  from RecoPixelVertexing.PixelTrackFitting.pixelTracksSoA_cfi import pixelTracksSoA as _pixelTracksSoA
262  process.hltPixelTracksSoA = SwitchProducerCUDA(
263  # build pixel ntuplets and pixel tracks in SoA format on cpu
264  cpu = _pixelTracksCUDA.clone(
265  idealConditions = False,
266  pixelRecHitSrc = "hltSiPixelRecHitSoA",
267  onGPU = False
268  ),
269  # transfer the pixel tracks in SoA format to the host
270  cuda = _pixelTracksSoA.clone(
271  src = "hltPixelTracksCUDA"
272  )
273  )
274  # use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows
275  run3_common.toModify(process.hltPixelTracksSoA.cpu, idealConditions = True)
276 
277  # convert the pixel tracks from SoA to legacy format
278  from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackProducerFromSoA
279  process.hltPixelTracks = _pixelTrackProducerFromSoA.clone(
280  beamSpot = "hltOnlineBeamSpot",
281  pixelRecHitLegacySrc = "hltSiPixelRecHits",
282  trackSrc = "hltPixelTracksSoA"
283  )
284 
285 
286  # referenced in process.HLTRecopixelvertexingTask
287  if hasHLTPixelVertexReco:
288 
289  # build pixel vertices in SoA format on gpu
290  from RecoPixelVertexing.PixelVertexFinding.pixelVerticesCUDA_cfi import pixelVerticesCUDA as _pixelVerticesCUDA
291  process.hltPixelVerticesCUDA = _pixelVerticesCUDA.clone(
292  pixelTrackSrc = "hltPixelTracksCUDA",
293  onGPU = True
294  )
295 
296  # build or transfer pixel vertices in SoA format on cpu
297  from RecoPixelVertexing.PixelVertexFinding.pixelVerticesSoA_cfi import pixelVerticesSoA as _pixelVerticesSoA
298  process.hltPixelVerticesSoA = SwitchProducerCUDA(
299  # build pixel vertices in SoA format on cpu
300  cpu = _pixelVerticesCUDA.clone(
301  pixelTrackSrc = "hltPixelTracksSoA",
302  onGPU = False
303  ),
304  # transfer the pixel vertices in SoA format to cpu
305  cuda = _pixelVerticesSoA.clone(
306  src = "hltPixelVerticesCUDA"
307  )
308  )
309 
310  # convert the pixel vertices from SoA to legacy format
311  from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA
312  process.hltPixelVertices = _pixelVertexFromSoA.clone(
313  src = "hltPixelVerticesSoA",
314  TrackCollection = "hltPixelTracks",
315  beamSpot = "hltOnlineBeamSpot"
316  )
317 
318 
319  # Tasks and Sequences
320 
321  process.HLTRecoPixelTracksTask = cms.Task(
322  process.hltPixelTracksTrackingRegions, # from the original sequence
323  process.hltSiPixelRecHitSoA, # pixel rechits on cpu, converted to SoA
324  process.hltPixelTracksCUDA, # pixel ntuplets on gpu, in SoA format
325  process.hltPixelTracksSoA, # pixel ntuplets on cpu, in SoA format
326  process.hltPixelTracks) # pixel tracks on cpu, in legacy format
327 
328 
329  process.HLTRecoPixelTracksSequence = cms.Sequence(process.HLTRecoPixelTracksTask)
330 
331  if hasHLTPixelVertexReco:
332  process.HLTRecopixelvertexingTask = cms.Task(
333  process.HLTRecoPixelTracksTask,
334  process.hltPixelVerticesCUDA, # pixel vertices on gpu, in SoA format
335  process.hltPixelVerticesSoA, # pixel vertices on cpu, in SoA format
336  process.hltPixelVertices, # pixel vertices on cpu, in legacy format
337  process.hltTrimmedPixelVertices) # from the original sequence
338 
339  process.HLTRecopixelvertexingSequence = cms.Sequence(
340  process.hltPixelTracksFitter + # not used here, kept for compatibility with legacy sequences
341  process.hltPixelTracksFilter, # not used here, kept for compatibility with legacy sequences
342  process.HLTRecopixelvertexingTask)
343 
344 
345  # done
346  return process
347 
348 
349 # customisation for offloading the ECAL local reconstruction via CUDA if a supported gpu is present

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

◆ customizeHLTforPatatrack()

def customizeHLTforPatatrack.customizeHLTforPatatrack (   process)

Definition at line 658 of file customizeHLTforPatatrack.py.

658 def customizeHLTforPatatrack(process):
659  process = customiseCommon(process)
660  process = customisePixelLocalReconstruction(process)
661  process = customisePixelTrackReconstruction(process)
662  process = customiseEcalLocalReconstruction(process)
663  process = customiseHcalLocalReconstruction(process)
664  return process
665 
666 
667 # customisation for running the Patatrack triplets reconstruction, with automatic offload via CUDA when a supported gpu is available

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

◆ customizeHLTforPatatrackTriplets()

def customizeHLTforPatatrack.customizeHLTforPatatrackTriplets (   process)

◆ enablePatatrackPixelTriplets()

def customizeHLTforPatatrack.enablePatatrackPixelTriplets (   process)

Definition at line 641 of file customizeHLTforPatatrack.py.

641 def enablePatatrackPixelTriplets(process):
642 
643  if 'hltPixelTracksCUDA' in process.__dict__:
644  # configure GPU pixel tracks for triplets
645  process.hltPixelTracksCUDA.minHitsPerNtuplet = 3
646  process.hltPixelTracksCUDA.includeJumpingForwardDoublets = True
647 
648  if 'hltPixelTracksSoA' in process.__dict__:
649  # configure CPU pixel tracks for triplets
650  process.hltPixelTracksSoA.cpu.minHitsPerNtuplet = 3
651  process.hltPixelTracksSoA.cpu.includeJumpingForwardDoublets = True
652 
653  # done
654  return process
655 
656 
657 # customisation for running the Patatrack reconstruction, with automatic offload via CUDA when a supported gpu is available

Referenced by customizeHLTforPatatrackTriplets().

◆ forceGpuOffload()

def customizeHLTforPatatrack.forceGpuOffload (   status = True)

Definition at line 9 of file customizeHLTforPatatrack.py.

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

References electrons_cff.bool.

◆ resetGpuOffload()

def customizeHLTforPatatrack.resetGpuOffload ( )

Definition at line 15 of file customizeHLTforPatatrack.py.

15 def resetGpuOffload():
16  import HeterogeneousCore.CUDACore.SwitchProducerCUDA
17  HeterogeneousCore.CUDACore.SwitchProducerCUDA._cuda_enabled_cached = None
18  HeterogeneousCore.CUDACore.SwitchProducerCUDA._switch_cuda()
19 
20 
21 # customisation for running the Patatrack reconstruction, common parts
customizeHLTforPatatrack.customisePixelTrackReconstruction
def customisePixelTrackReconstruction(process)
Definition: customizeHLTforPatatrack.py:224
electrons_cff.bool
bool
Definition: electrons_cff.py:366
customizeHLTforPatatrack.enablePatatrackPixelTriplets
def enablePatatrackPixelTriplets(process)
Definition: customizeHLTforPatatrack.py:641
customizeHLTforPatatrack.customiseHcalLocalReconstruction
def customiseHcalLocalReconstruction(process)
Definition: customizeHLTforPatatrack.py:528
customizeHLTforPatatrack.customiseEcalLocalReconstruction
def customiseEcalLocalReconstruction(process)
Definition: customizeHLTforPatatrack.py:350
any
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
common.replace_with
def replace_with(fromObj, toObj)
Definition: common.py:67
customizeHLTforPatatrack.customiseCommon
def customiseCommon(process)
Definition: customizeHLTforPatatrack.py:22
customizeHLTforPatatrack._addConsumerPath
def _addConsumerPath(process)
Definition: customizeHLTforPatatrack.py:678
customizeHLTforPatatrack.consumeCPULegacyProducts
def consumeCPULegacyProducts(process)
Definition: customizeHLTforPatatrack.py:746
customizeHLTforPatatrack.consumeGPUSoAProducts
def consumeGPUSoAProducts(process)
Definition: customizeHLTforPatatrack.py:701
customizeHLTforPatatrack.customizeHLTforPatatrack
def customizeHLTforPatatrack(process)
Definition: customizeHLTforPatatrack.py:658
customizeHLTforPatatrack.resetGpuOffload
def resetGpuOffload()
Definition: customizeHLTforPatatrack.py:15
customizeHLTforPatatrack.consumeCPUSoAProducts
def consumeCPUSoAProducts(process)
Definition: customizeHLTforPatatrack.py:724
customizeHLTforPatatrack.customizeHLTforPatatrackTriplets
def customizeHLTforPatatrackTriplets(process)
Definition: customizeHLTforPatatrack.py:668
customizeHLTforPatatrack.customisePixelLocalReconstruction
def customisePixelLocalReconstruction(process)
Definition: customizeHLTforPatatrack.py:95
common.insert_modules_after
def insert_modules_after(process, target, *modules)
Definition: common.py:50
customizeHLTforPatatrack.forceGpuOffload
def forceGpuOffload(status=True)
Definition: customizeHLTforPatatrack.py:9
SwitchProducerCUDA
Definition: SwitchProducerCUDA.py:1