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 _clone
 
def _clone_if_missing
 
def _load_if_missing
 
def consumeCPULegacyProducts
 
def consumeCPUSoAProducts
 
def consumeGPUSoAProducts
 
def customiseCommon
 
def customiseEcalLocalReconstruction
 
def customiseHcalLocalReconstruction
 
def customisePixelLocalReconstruction
 
def customisePixelTrackReconstruction
 
def customizeHLTforPatatrack
 
def customizeHLTforPatatrackTriplets
 
def enablePatatrackPixelTriplets
 

Function Documentation

def customizeHLTforPatatrack._addConsumerPath (   process)
private

Definition at line 854 of file customizeHLTforPatatrack.py.

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

855 def _addConsumerPath(process):
856  # add to a path all consumers and the tasks that define the producers
857  process.Consumer = cms.Path(
858  process.HLTBeginSequence +
859  process.hltPixelConsumer +
860  process.hltEcalConsumer +
861  process.hltHbheConsumer,
862  process.HLTDoLocalPixelTask,
863  process.HLTRecoPixelTracksTask,
864  process.HLTRecopixelvertexingTask,
865  process.HLTDoFullUnpackingEgammaEcalTask,
866  process.HLTDoLocalHcalTask,
867  )
868 
869  if process.schedule is not None:
870  process.schedule.append(process.Consumer)
871 
872  # done
873  return process
874 
def customizeHLTforPatatrack._clone (   _obj,
  _label,
  _config,
  _original_label = None,
  _only_if_missing = False,
  kwargs 
)
private
Utility to add "_label" to "_obj" using a clone of module "_original_label" from file "_config"
 - if "_original_label" is not specified, it is set equal to "_label"
 - if "_only_if_missing" is true and "_obj._label" exists, nothing is done
Example: _clone(process, 'hltMyFilter', 'SubSystem.Package.hltSomeFilter_cfi', 'hltSomeFilter',
           _only_if_missing = False, modArg1 = val1, modArg2 = val2)

Definition at line 18 of file customizeHLTforPatatrack.py.

References clone().

Referenced by _clone_if_missing(), customisePixelLocalReconstruction(), and customisePixelTrackReconstruction().

18 
19 def _clone(_obj, _label, _config, _original_label = None, _only_if_missing = False, **kwargs):
20  '''
21  Utility to add "_label" to "_obj" using a clone of module "_original_label" from file "_config"
22  - if "_original_label" is not specified, it is set equal to "_label"
23  - if "_only_if_missing" is true and "_obj._label" exists, nothing is done
24  Example: _clone(process, 'hltMyFilter', 'SubSystem.Package.hltSomeFilter_cfi', 'hltSomeFilter',
25  _only_if_missing = False, modArg1 = val1, modArg2 = val2)
26  '''
27  if not _only_if_missing or not hasattr(_obj, _label):
28  if _original_label is None:
29  _original_label = _label
30  _module = __import__(_config, globals(), locals(), [ _original_label ], 0)
31  setattr(_obj, _label, getattr(_module, _original_label).clone(**kwargs))
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
def customizeHLTforPatatrack._clone_if_missing (   _obj,
  _label,
  _config,
  _original_label = None,
  kwargs 
)
private
Wrapper of _clone with _only_if_missing=True (for examples, see _clone)

Definition at line 32 of file customizeHLTforPatatrack.py.

References _clone().

Referenced by customiseEcalLocalReconstruction(), customiseHcalLocalReconstruction(), customisePixelLocalReconstruction(), and customisePixelTrackReconstruction().

32 
33 def _clone_if_missing(_obj, _label, _config, _original_label = None, **kwargs):
34  '''
35  Wrapper of _clone with _only_if_missing=True (for examples, see _clone)
36  '''
37  _clone(_obj, _label, _config, _original_label, _only_if_missing = True, **kwargs)
38 
39 
# customisation for running the Patatrack reconstruction, common parts
def customizeHLTforPatatrack._load_if_missing (   process,
  label,
  config,
  check = True 
)
private
Utility to load file "config" in the process, if the process does not already hold a module named "label"
 - if "check" is true and "process.label" does not exist after loading "config", an exception is thrown
Example: _load_if_missing(process, 'SomeESProducer', 'SubSystem.Package.SomeESProducer_cfi')

Definition at line 7 of file customizeHLTforPatatrack.py.

Referenced by customiseEcalLocalReconstruction(), customiseHcalLocalReconstruction(), and customisePixelLocalReconstruction().

7 
8 def _load_if_missing(process, label, config, check = True):
9  '''
10  Utility to load file "config" in the process, if the process does not already hold a module named "label"
11  - if "check" is true and "process.label" does not exist after loading "config", an exception is thrown
12  Example: _load_if_missing(process, 'SomeESProducer', 'SubSystem.Package.SomeESProducer_cfi')
13  '''
14  if label not in process.__dict__:
15  process.load(config)
16  if check and label not in process.__dict__:
17  raise Exception('process does not have a module labelled "'+label+'" after loading "'+config+'"')
def customizeHLTforPatatrack.consumeCPULegacyProducts (   process)

Definition at line 920 of file customizeHLTforPatatrack.py.

References _addConsumerPath().

921 def consumeCPULegacyProducts(process):
922  # consume the Pixel tracks and vertices on the CPU in legacy format
923  process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer",
924  eventProducts = cms.untracked.vstring( 'hltPixelTracks', 'hltPixelVertices' )
925  )
926 
927  # consume the ECAL runcalibrated echits on the CPU in legacy format
928  process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer",
929  eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHit' )
930  )
931 
932  # consume the HCAL rechits on the CPU in legacy format
933  process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer",
934  eventProducts = cms.untracked.vstring( 'hltHbhereco' )
935  )
936 
937  # add to a path all consumers and the tasks that define the producers
938  process = _addConsumerPath(process)
939 
940  # done
941  return process
def customizeHLTforPatatrack.consumeCPUSoAProducts (   process)

Definition at line 898 of file customizeHLTforPatatrack.py.

References _addConsumerPath().

899 def consumeCPUSoAProducts(process):
900  # consume the Pixel tracks and vertices on the CPU in SoA format
901  process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer",
902  eventProducts = cms.untracked.vstring( 'hltPixelTracksSoA', 'hltPixelVerticesSoA' )
903  )
904 
905  # consume the ECAL uncalibrated rechits on the CPU in SoA format
906  process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer",
907  eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHitSoA' )
908  )
909 
910  # consume the HCAL rechits on the CPU in legacy format
911  process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer",
912  eventProducts = cms.untracked.vstring( 'hltHbhereco' )
913  )
914 
915  # add to a path all consumers and the tasks that define the producers
916  process = _addConsumerPath(process)
917 
918  # done
919  return process
def customizeHLTforPatatrack.consumeGPUSoAProducts (   process)

Definition at line 875 of file customizeHLTforPatatrack.py.

References _addConsumerPath().

876 def consumeGPUSoAProducts(process):
877  # consume the Pixel tracks and vertices on the GPU in SoA format
878  process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer",
879  eventProducts = cms.untracked.vstring( 'hltPixelTracksCUDA', 'hltPixelVerticesCUDA' )
880  )
881 
882  # consume the ECAL uncalibrated rechits on the GPU in SoA format
883  process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer",
884  eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHitGPU' )
885  )
886 
887  # consume the HCAL rechits on the GPU in SoA format
888  process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer",
889  eventProducts = cms.untracked.vstring( 'hltHbherecoGPU' )
890  )
891 
892  # add to a path all consumers and the tasks that define the producers
893  process = _addConsumerPath(process)
894 
895  # done
896  return process
897 
def customizeHLTforPatatrack.customiseCommon (   process)

Definition at line 40 of file customizeHLTforPatatrack.py.

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

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

40 
41 def customiseCommon(process):
42 
43  # Services
44 
45  process.load('Configuration.StandardSequences.Accelerators_cff')
46 
47 # # NVProfilerService is broken in CMSSW 12.0.x and later
48 # _load_if_missing(process, 'NVProfilerService', 'HeterogeneousCore.CUDAServices.NVProfilerService_cfi')
49 
50 
51  # Paths and EndPaths
52 
53  # the hltGetConditions module would force gpu-specific ESProducers to run even if no supported gpu is present
54  if 'hltGetConditions' in process.__dict__:
55  del process.hltGetConditions
56 
57  # produce a boolean to track if the events ar being processed on gpu (true) or cpu (false)
58  if 'statusOnGPU' not in process.__dict__:
59  process.statusOnGPU = SwitchProducerCUDA(
60  cpu = cms.EDProducer("BooleanProducer", value = cms.bool(False))
61  )
62 
63  if not hasattr(process.statusOnGPU, 'cuda'):
64  process.statusOnGPU.cuda = cms.EDProducer("BooleanProducer", value = cms.bool(True))
65 
66  if 'statusOnGPUFilter' not in process.__dict__:
67  process.statusOnGPUFilter = cms.EDFilter("BooleanFilter",
68  src = cms.InputTag("statusOnGPU")
69  )
70 
71  if 'Status_OnCPU' in process.__dict__:
72  replace_with(process.Status_OnCPU, cms.Path(process.statusOnGPU + ~process.statusOnGPUFilter))
73  else:
74  process.Status_OnCPU = cms.Path(process.statusOnGPU + ~process.statusOnGPUFilter)
75  if process.schedule is not None:
76  process.schedule.append(process.Status_OnCPU)
77 
78  if 'Status_OnGPU' in process.__dict__:
79  replace_with(process.Status_OnGPU, cms.Path(process.statusOnGPU + process.statusOnGPUFilter))
80  else:
81  process.Status_OnGPU = cms.Path(process.statusOnGPU + process.statusOnGPUFilter)
82  if process.schedule is not None:
83  process.schedule.append(process.Status_OnGPU)
84 
85  # make the ScoutingCaloMuonOutput endpath compatible with using Tasks in the Scouting paths
86  if 'hltOutputScoutingCaloMuon' in process.__dict__ and not 'hltPreScoutingCaloMuonOutputSmart' in process.__dict__:
87  process.hltPreScoutingCaloMuonOutputSmart = cms.EDFilter( "TriggerResultsFilter",
88  l1tIgnoreMaskAndPrescale = cms.bool( False ),
89  l1tResults = cms.InputTag( "" ),
90  hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ),
91  triggerConditions = process.hltOutputScoutingCaloMuon.SelectEvents.SelectEvents,
92  throw = cms.bool( True )
93  )
94  insert_modules_after(process, process.hltPreScoutingCaloMuonOutput, process.hltPreScoutingCaloMuonOutputSmart)
95 
96  # make the ScoutingPFOutput endpath compatible with using Tasks in the Scouting paths
97  if 'hltOutputScoutingPF' in process.__dict__ and not 'hltPreScoutingPFOutputSmart' in process.__dict__:
98  process.hltPreScoutingPFOutputSmart = cms.EDFilter( "TriggerResultsFilter",
99  l1tIgnoreMaskAndPrescale = cms.bool( False ),
100  l1tResults = cms.InputTag( "" ),
101  hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ),
102  triggerConditions = process.hltOutputScoutingPF.SelectEvents.SelectEvents,
103  throw = cms.bool( True )
104  )
105  insert_modules_after(process, process.hltPreScoutingPFOutput, process.hltPreScoutingPFOutputSmart)
106 
107 
108  # done
109  return process
110 
111 
# 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 452 of file customizeHLTforPatatrack.py.

References _clone_if_missing(), _load_if_missing(), and any().

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

454 
455  hasHLTEcalPreshowerSeq = any(seq in process.__dict__ for seq in ['HLTDoFullUnpackingEgammaEcalMFSequence', 'HLTDoFullUnpackingEgammaEcalSequence'])
456  if not (hasHLTEcalPreshowerSeq or 'HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence' in process.__dict__):
457  return process
458 
459  # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases
460  process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence()
461  if hasHLTEcalPreshowerSeq:
462  process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence()
463  process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence()
464 
465 
466  # Event Setup
467 
468  _load_if_missing(process, 'ecalElectronicsMappingGPUESProducer', 'EventFilter.EcalRawToDigi.ecalElectronicsMappingGPUESProducer_cfi')
469  _load_if_missing(process, 'ecalGainRatiosGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalGainRatiosGPUESProducer_cfi')
470  _load_if_missing(process, 'ecalPedestalsGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalPedestalsGPUESProducer_cfi')
471  _load_if_missing(process, 'ecalPulseCovariancesGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalPulseCovariancesGPUESProducer_cfi')
472  _load_if_missing(process, 'ecalPulseShapesGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalPulseShapesGPUESProducer_cfi')
473  _load_if_missing(process, 'ecalSamplesCorrelationGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalSamplesCorrelationGPUESProducer_cfi')
474  _load_if_missing(process, 'ecalTimeBiasCorrectionsGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalTimeBiasCorrectionsGPUESProducer_cfi')
475  _load_if_missing(process, 'ecalTimeCalibConstantsGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalTimeCalibConstantsGPUESProducer_cfi')
476  _load_if_missing(process, 'ecalMultifitParametersGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalMultifitParametersGPUESProducer_cfi')
477  _load_if_missing(process, 'ecalRechitADCToGeVConstantGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalRechitADCToGeVConstantGPUESProducer_cfi')
478  _load_if_missing(process, 'ecalRechitChannelStatusGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalRechitChannelStatusGPUESProducer_cfi')
479  _load_if_missing(process, 'ecalIntercalibConstantsGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalIntercalibConstantsGPUESProducer_cfi')
480  _load_if_missing(process, 'ecalLaserAPDPNRatiosGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosGPUESProducer_cfi')
481  _load_if_missing(process, 'ecalLaserAPDPNRatiosRefGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosRefGPUESProducer_cfi')
482  _load_if_missing(process, 'ecalLaserAlphasGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalLaserAlphasGPUESProducer_cfi')
483  _load_if_missing(process, 'ecalLinearCorrectionsGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalLinearCorrectionsGPUESProducer_cfi')
484  _load_if_missing(process, 'ecalRecHitParametersGPUESProducer', 'RecoLocalCalo.EcalRecProducers.ecalRecHitParametersGPUESProducer_cfi')
485 
486 
487  # Modules and EDAliases
488 
489  # ECAL unpacker running on gpu
490  _clone_if_missing(process, 'hltEcalDigisGPU', 'EventFilter.EcalRawToDigi.ecalRawToDigiGPU_cfi', 'ecalRawToDigiGPU')
491 
492  # SwitchProducer: hltEcalDigis
493  if not isinstance(process.hltEcalDigis, SwitchProducerCUDA):
494 
495  if 'hltEcalDigisLegacy' not in process.__dict__:
496  process.hltEcalDigisLegacy = process.hltEcalDigis.clone()
497  else:
498  raise Exception('unsupported configuration: "process.hltEcalDigis" is not a SwitchProducerCUDA, but "process.hltEcalDigisLegacy" already exists')
499 
500  # SwitchProducer wrapping the legacy ECAL unpacker or the ECAL digi converter from SoA format on gpu to legacy format on cpu
501  process.hltEcalDigis = SwitchProducerCUDA(
502  # legacy producer
503  cpu = cms.EDAlias(
504  hltEcalDigisLegacy = cms.VPSet(
505  cms.PSet(type = cms.string("EBDigiCollection")),
506  cms.PSet(type = cms.string("EEDigiCollection")),
507  cms.PSet(type = cms.string("EBDetIdedmEDCollection")),
508  cms.PSet(type = cms.string("EEDetIdedmEDCollection")),
509  cms.PSet(type = cms.string("EBSrFlagsSorted")),
510  cms.PSet(type = cms.string("EESrFlagsSorted")),
511  cms.PSet(type = cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance = cms.string("EcalIntegrityBlockSizeErrors")),
512  cms.PSet(type = cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance = cms.string("EcalIntegrityTTIdErrors")),
513  cms.PSet(type = cms.string("EcalElectronicsIdedmEDCollection"), fromProductInstance = cms.string("EcalIntegrityZSXtalIdErrors")),
514  cms.PSet(type = cms.string("EcalPnDiodeDigisSorted")),
515  cms.PSet(type = cms.string("EcalPseudoStripInputDigisSorted"), fromProductInstance = cms.string("EcalPseudoStripInputs")),
516  cms.PSet(type = cms.string("EcalTriggerPrimitiveDigisSorted"), fromProductInstance = cms.string("EcalTriggerPrimitives")),
517  )
518  )
519  )
520 
521  # convert ECAL digis from SoA format on gpu to legacy format on cpu
522  _clone_if_missing(process.hltEcalDigis, 'cuda', 'EventFilter.EcalRawToDigi.ecalCPUDigisProducer_cfi', 'ecalCPUDigisProducer',
523  digisInLabelEB = ('hltEcalDigisGPU', 'ebDigis'),
524  digisInLabelEE = ('hltEcalDigisGPU', 'eeDigis'),
525  produceDummyIntegrityCollections = True
526  )
527 
528  # ECAL multifit running on gpu
529  _clone_if_missing(process, 'hltEcalUncalibRecHitGPU', 'RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitProducerGPU_cfi', 'ecalUncalibRecHitProducerGPU',
530  digisLabelEB = ('hltEcalDigisGPU', 'ebDigis'),
531  digisLabelEE = ('hltEcalDigisGPU', 'eeDigis'),
532  shouldRunTimingComputation = False
533  )
534 
535  # copy the ECAL uncalibrated rechits from gpu to cpu in SoA format
536  _clone_if_missing(process, 'hltEcalUncalibRecHitSoA', 'RecoLocalCalo.EcalRecProducers.ecalCPUUncalibRecHitProducer_cfi', 'ecalCPUUncalibRecHitProducer',
537  recHitsInLabelEB = ('hltEcalUncalibRecHitGPU', 'EcalUncalibRecHitsEB'),
538  recHitsInLabelEE = ('hltEcalUncalibRecHitGPU', 'EcalUncalibRecHitsEE'),
539  )
540 
541  # SwitchProducer: hltEcalUncalibRecHit
542  if not isinstance(process.hltEcalUncalibRecHit, SwitchProducerCUDA):
543  # SwitchProducer wrapping the legacy ECAL uncalibrated rechits producer or a converter from SoA to legacy format
544  process.hltEcalUncalibRecHit = SwitchProducerCUDA(
545  # legacy producer
546  cpu = process.hltEcalUncalibRecHit
547  )
548 
549  # convert the ECAL uncalibrated rechits from SoA to legacy format
550  _clone_if_missing(process.hltEcalUncalibRecHit, 'cuda', 'RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitConvertGPU2CPUFormat_cfi', 'ecalUncalibRecHitConvertGPU2CPUFormat',
551  recHitsLabelGPUEB = ('hltEcalUncalibRecHitSoA', 'EcalUncalibRecHitsEB'),
552  recHitsLabelGPUEE = ('hltEcalUncalibRecHitSoA', 'EcalUncalibRecHitsEE'),
553  )
554 
555  # Reconstructing the ECAL calibrated rechits on gpu works, but is extremely slow.
556  # Disable it for the time being, until the performance has been addressed.
557  """
558  _clone_if_missing(process, 'hltEcalRecHitGPU', 'RecoLocalCalo.EcalRecProducers.ecalRecHitGPU_cfi', 'ecalRecHitGPU',
559  uncalibrecHitsInLabelEB = ("hltEcalUncalibRecHitGPU","EcalUncalibRecHitsEB"),
560  uncalibrecHitsInLabelEE = ("hltEcalUncalibRecHitGPU","EcalUncalibRecHitsEE"),
561  )
562 
563  _clone_if_missing(process, 'hltEcalRecHitSoA', 'RecoLocalCalo.EcalRecProducers.ecalCPURecHitProducer_cfi', 'ecalCPURecHitProducer',
564  recHitsInLabelEB = ("hltEcalRecHitGPU", "EcalRecHitsEB"),
565  recHitsInLabelEE = ("hltEcalRecHitGPU", "EcalRecHitsEE"),
566  )
567 
568  # SwitchProducer wrapping the legacy ECAL calibrated rechits producer or a converter from SoA to legacy format
569  if not isinstance(process.hltEcalRecHit, SwitchProducerCUDA):
570  process.hltEcalRecHit = SwitchProducerCUDA(
571  # legacy producer
572  cpu = process.hltEcalRecHit,
573  )
574 
575  # convert the ECAL calibrated rechits from SoA to legacy format
576  _clone_if_missing(process.hltEcalRecHit, 'cuda', 'RecoLocalCalo.EcalRecProducers.ecalRecHitConvertGPU2CPUFormat_cfi', 'ecalRecHitConvertGPU2CPUFormat',
577  recHitsLabelGPUEB = ("hltEcalRecHitSoA", "EcalRecHitsEB"),
578  recHitsLabelGPUEE = ("hltEcalRecHitSoA", "EcalRecHitsEE"),
579  )
580  """
581 
582  # SwitchProducer wrapping the legacy ECAL rechits producer
583  # the gpu unpacker does not produce the TPs used for the recovery, so the SwitchProducer alias does not provide them:
584  # - the cpu uncalibrated rechit producer may mark them for recovery, read the TPs explicitly from the legacy unpacker
585  # - the gpu uncalibrated rechit producer does not flag them for recovery, so the TPs are not necessary
586  if not isinstance(process.hltEcalRecHit, SwitchProducerCUDA):
587  process.hltEcalRecHit = SwitchProducerCUDA(
588  cpu = process.hltEcalRecHit.clone(
589  triggerPrimitiveDigiCollection = ('hltEcalDigisLegacy', 'EcalTriggerPrimitives')
590  )
591  )
592 
593  elif not hasattr(process.hltEcalRecHit, 'cpu'):
594  raise Exception('unsupported configuration: "process.hltEcalRecHit" is a SwitchProducerCUDA, but does not have a "cpu" branch')
595 
596  if not hasattr(process.hltEcalRecHit, 'cuda'):
597  process.hltEcalRecHit.cuda = process.hltEcalRecHit.cpu.clone(
598  triggerPrimitiveDigiCollection = 'unused'
599  )
600 
601 
602  # enforce consistent configuration of CPU and GPU modules for timing of ECAL RecHits
603  if process.hltEcalUncalibRecHit.cpu.algoPSet.timealgo == 'RatioMethod':
604  process.hltEcalUncalibRecHitGPU.shouldRunTimingComputation = True
605  process.hltEcalUncalibRecHitSoA.containsTimingInformation = True
606  for _parName in [
607  'EBtimeFitLimits_Lower',
608  'EBtimeFitLimits_Upper',
609  'EEtimeFitLimits_Lower',
610  'EEtimeFitLimits_Upper',
611  'EBtimeConstantTerm',
612  'EEtimeConstantTerm',
613  'EBtimeNconst',
614  'EEtimeNconst',
615  'outOfTimeThresholdGain12pEB',
616  'outOfTimeThresholdGain12pEE',
617  'outOfTimeThresholdGain12mEB',
618  'outOfTimeThresholdGain12mEE',
619  'outOfTimeThresholdGain61pEB',
620  'outOfTimeThresholdGain61pEE',
621  'outOfTimeThresholdGain61mEB',
622  'outOfTimeThresholdGain61mEE',
623  ]:
624  setattr(process.hltEcalUncalibRecHitGPU, _parName, getattr(process.hltEcalUncalibRecHit.cpu.algoPSet, _parName))
625  # note: the "RatioMethod" is the only one available in the GPU implementation
626  elif process.hltEcalUncalibRecHit.cpu.algoPSet.timealgo != 'None':
627  _logMsg = '"process.hltEcalUncalibRecHit.cpu.algoPSet.timealgo = \''+process.hltEcalUncalibRecHit.cpu.algoPSet.timealgo+'\'"'
628  _logMsg += ' has no counterpart in the GPU implementation of the ECAL local reconstruction (use "None" or "RatioMethod")'
629  raise Exception('unsupported configuration: '+_logMsg)
630 
631 
632  # Tasks and Sequences
633 
634  if 'HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask' not in process.__dict__:
635  process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask = cms.Task(
636  process.hltEcalDigisGPU, # unpack ECAL digis on gpu
637  process.hltEcalDigisLegacy, # legacy producer, referenced in the SwitchProducer
638  process.hltEcalDigis, # SwitchProducer
639  process.hltEcalUncalibRecHitGPU, # run ECAL local reconstruction and multifit on gpu
640  process.hltEcalUncalibRecHitSoA, # needed by hltEcalPhiSymFilter - copy to host
641  process.hltEcalUncalibRecHit, # needed by hltEcalPhiSymFilter - convert to legacy format
642 # process.hltEcalRecHitGPU, # make ECAL calibrated rechits on gpu
643 # process.hltEcalRecHitSoA, # copy to host
644  process.hltEcalDetIdToBeRecovered, # legacy producer
645  process.hltEcalRecHit, # legacy producer
646  )
647 
648  elif not isinstance(process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask, cms.Task):
649  raise Exception('unsupported configuration: "process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask" already exists, but it is not a Task')
650 
651  # redefine HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence (it was emptied at the start of this function)
652  process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence(
653  process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask
654  )
655 
656  if hasHLTEcalPreshowerSeq:
657 
658  if 'HLTPreshowerTask' not in process.__dict__:
659  process.HLTPreshowerTask = cms.Task(
660  process.hltEcalPreshowerDigis, # unpack ECAL preshower digis on the host
661  process.hltEcalPreshowerRecHit, # build ECAL preshower rechits on the host
662  )
663 
664  elif not isinstance(process.HLTPreshowerTask, cms.Task):
665  raise Exception('unsupported configuration: "process.HLTPreshowerTask" already exists, but it is not a Task')
666 
667  # redefine HLTPreshowerSequence (it was emptied at the start of this function)
668  process.HLTPreshowerSequence = cms.Sequence(process.HLTPreshowerTask)
669 
670  if 'HLTDoFullUnpackingEgammaEcalTask' not in process.__dict__:
671  process.HLTDoFullUnpackingEgammaEcalTask = cms.Task(
672  process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask,
673  process.HLTPreshowerTask,
674  )
675 
676  elif not isinstance(process.HLTDoFullUnpackingEgammaEcalTask, cms.Task):
677  raise Exception('unsupported configuration: "process.HLTDoFullUnpackingEgammaEcalTask" already exists, but it is not a Task')
678 
679  # redefine sequences (they were emptied at the start of this function)
680  process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence(process.HLTDoFullUnpackingEgammaEcalTask)
681  process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence(process.HLTDoFullUnpackingEgammaEcalTask)
682 
683 
684  # done
685  return process
686 
# 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 687 of file customizeHLTforPatatrack.py.

References _clone_if_missing(), and _load_if_missing().

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

689 
690  hasHLTDoLocalHcalSeq = 'HLTDoLocalHcalSequence' in process.__dict__
691  if not (hasHLTDoLocalHcalSeq or 'HLTStoppedHSCPLocalHcalReco' in process.__dict__):
692  return process
693 
694  # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases
695  if hasHLTDoLocalHcalSeq:
696  process.HLTDoLocalHcalSequence = cms.Sequence()
697  process.HLTStoppedHSCPLocalHcalReco = cms.Sequence()
698 
699 
700  # Event Setup
701 
702  _load_if_missing(process, 'hcalElectronicsMappingGPUESProducer', 'EventFilter.HcalRawToDigi.hcalElectronicsMappingGPUESProducer_cfi')
703  _load_if_missing(process, 'hcalChannelQualityGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalChannelQualityGPUESProducer_cfi')
704  _load_if_missing(process, 'hcalGainsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalGainsGPUESProducer_cfi')
705  _load_if_missing(process, 'hcalGainWidthsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalGainWidthsGPUESProducer_cfi')
706  _load_if_missing(process, 'hcalLUTCorrsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalLUTCorrsGPUESProducer_cfi')
707  _load_if_missing(process, 'hcalConvertedPedestalsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalConvertedPedestalsGPUESProducer_cfi')
708  _load_if_missing(process, 'hcalConvertedPedestalWidthsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalConvertedPedestalWidthsGPUESProducer_cfi')
709  _load_if_missing(process, 'hcalQIECodersGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalQIECodersGPUESProducer_cfi')
710  _load_if_missing(process, 'hcalRecoParamsWithPulseShapesGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalRecoParamsWithPulseShapesGPUESProducer_cfi')
711  _load_if_missing(process, 'hcalRespCorrsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalRespCorrsGPUESProducer_cfi')
712  _load_if_missing(process, 'hcalTimeCorrsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalTimeCorrsGPUESProducer_cfi')
713  _load_if_missing(process, 'hcalQIETypesGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalQIETypesGPUESProducer_cfi')
714  _load_if_missing(process, 'hcalSiPMParametersGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalSiPMParametersGPUESProducer_cfi')
715  _load_if_missing(process, 'hcalSiPMCharacteristicsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalSiPMCharacteristicsGPUESProducer_cfi')
716  _load_if_missing(process, 'hcalMahiPulseOffsetsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalMahiPulseOffsetsGPUESProducer_cfi')
717 
718  _clone_if_missing(process, 'hcalConvertedEffectivePedestalsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalConvertedEffectivePedestalsGPUESProducer_cfi',
719  label0 = 'withTopoEff'
720  )
721 
722  _clone_if_missing(process, 'hcalConvertedEffectivePedestalWidthsGPUESProducer', 'RecoLocalCalo.HcalRecProducers.hcalConvertedEffectivePedestalWidthsGPUESProducer_cfi',
723  label0 = 'withTopoEff',
724  label1 = 'withTopoEff'
725  )
726 
727 
728  # Modules and EDAliases
729 
730  # The HCAL unpacker running on the gpu supports only the HB and HE digis.
731  # So, run the legacy unacker on the cpu, then convert the HB and HE digis
732  # to SoA format and copy them to the gpu.
733 
734  _clone_if_missing(process, 'hltHcalDigisGPU', 'EventFilter.HcalRawToDigi.hcalDigisProducerGPU_cfi', 'hcalDigisProducerGPU',
735  hbheDigisLabel = 'hltHcalDigis',
736  qie11DigiLabel = 'hltHcalDigis',
737  digisLabelF01HE = '',
738  digisLabelF5HB = '',
739  digisLabelF3HB = ''
740  )
741 
742  # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu
743  _clone_if_missing(process, 'hltHbherecoGPU', 'RecoLocalCalo.HcalRecProducers.hbheRecHitProducerGPU_cfi', 'hbheRecHitProducerGPU',
744  digisLabelF01HE = 'hltHcalDigisGPU',
745  digisLabelF5HB = 'hltHcalDigisGPU',
746  digisLabelF3HB = 'hltHcalDigisGPU',
747  recHitsLabelM0HBHE = ''
748  )
749 
750  # transfer the HCAL rechits to the cpu, and convert them to the legacy format
751  _clone_if_missing(process, 'hltHbherecoFromGPU', 'RecoLocalCalo.HcalRecProducers.hcalCPURecHitsProducer_cfi', 'hcalCPURecHitsProducer',
752  recHitsM0LabelIn = 'hltHbherecoGPU',
753  recHitsM0LabelOut = '',
754  recHitsLegacyLabelOut = ''
755  )
756 
757  # SwitchProducer between the legacy producer and the copy from gpu with conversion
758  if not isinstance(process.hltHbhereco, SwitchProducerCUDA):
759  process.hltHbhereco = SwitchProducerCUDA(
760  # legacy producer
761  cpu = process.hltHbhereco.clone()
762  )
763 
764  elif not hasattr(process.hltHbhereco, 'cpu'):
765  raise Exception('unsupported configuration: "process.hltHbhereco" is a SwitchProducerCUDA, but does not have a "cpu" branch')
766 
767  if not hasattr(process.hltHbhereco, 'cuda'):
768  # alias to the rechits converted to legacy format
769  process.hltHbhereco.cuda = cms.EDAlias(
770  hltHbherecoFromGPU = cms.VPSet(
771  cms.PSet(type = cms.string('HBHERecHitsSorted'))
772  )
773  )
774 
775 
776  # Tasks and Sequences
777 
778  if hasHLTDoLocalHcalSeq:
779  if 'HLTDoLocalHcalTask' not in process.__dict__:
780  process.HLTDoLocalHcalTask = cms.Task(
781  process.hltHcalDigis, # legacy producer, unpack HCAL digis on cpu
782  process.hltHcalDigisGPU, # copy to gpu and convert to SoA format
783  process.hltHbherecoGPU, # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu
784  process.hltHbherecoFromGPU, # transfer the HCAL rechits to the cpu, and convert them to the legacy format
785  process.hltHbhereco, # SwitchProducer between the legacy producer and the copy from gpu with conversion
786  process.hltHfprereco, # legacy producer
787  process.hltHfreco, # legacy producer
788  process.hltHoreco # legacy producer
789  )
790 
791  elif not isinstance(process.HLTDoLocalHcalTask, cms.Task):
792  raise Exception('unsupported configuration: "process.HLTDoLocalHcalTask" already exists, but it is not a Task')
793 
794  # redefine HLTDoLocalHcalSequence (it was emptied at the start of this function)
795  process.HLTDoLocalHcalSequence = cms.Sequence(process.HLTDoLocalHcalTask)
796 
797  if 'HLTStoppedHSCPLocalHcalRecoTask' not in process.__dict__:
798  process.HLTStoppedHSCPLocalHcalRecoTask = cms.Task(
799  process.hltHcalDigis, # legacy producer, unpack HCAL digis on cpu
800  process.hltHcalDigisGPU, # copy to gpu and convert to SoA format
801  process.hltHbherecoGPU, # run the HCAL local reconstruction (including Method 0 and MAHI) on gpu
802  process.hltHbherecoFromGPU, # transfer the HCAL rechits to the cpu, and convert them to the legacy format
803  process.hltHbhereco # SwitchProducer between the legacy producer and the copy from gpu with conversion
804  )
805 
806  elif not isinstance(process.HLTStoppedHSCPLocalHcalRecoTask, cms.Task):
807  raise Exception('unsupported configuration: "process.HLTStoppedHSCPLocalHcalRecoTask" already exists, but it is not a Task')
808 
809  # redefine HLTStoppedHSCPLocalHcalReco (it was emptied at the start of this function)
810  process.HLTStoppedHSCPLocalHcalReco = cms.Sequence(process.HLTStoppedHSCPLocalHcalRecoTask)
811 
812 
813  # done
814  return process
815 
816 
# customisation to enable pixel triplets instead of quadruplets
def customizeHLTforPatatrack.customisePixelLocalReconstruction (   process)

Definition at line 112 of file customizeHLTforPatatrack.py.

References _clone(), _clone_if_missing(), and _load_if_missing().

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

114 
115  if not 'HLTDoLocalPixelSequence' in process.__dict__:
116  return process
117 
118 
119  # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases
120  process.HLTDoLocalPixelSequence = cms.Sequence()
121 
122 
123  # Event Setup
124 
125  _load_if_missing(process, 'PixelCPEFastESProducer', 'RecoLocalTracker.SiPixelRecHits.PixelCPEFastESProducer_cfi')
126  # these 2 modules should be used only on GPUs, will crash otherwise
127  _load_if_missing(process, 'siPixelGainCalibrationForHLTGPU', 'CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi')
128  _load_if_missing(process, 'siPixelROCsStatusAndMappingWrapperESProducer', 'CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi')
129 
130 
131  # Modules and EDAliases
132  # referenced in HLTDoLocalPixelTask
133 
134  # transfer the beamspot to the gpu
135  _clone_if_missing(process, 'hltOnlineBeamSpotToCUDA', 'RecoVertex.BeamSpotProducer.offlineBeamSpotToCUDA_cfi', 'offlineBeamSpotToCUDA',
136  src = 'hltOnlineBeamSpot'
137  )
138 
139  if 'hltSiPixelClustersCUDA' not in process.__dict__:
140  # reconstruct the pixel digis and clusters on the gpu
141  _hltSiPixelClustersLegacyLabel = 'hltSiPixelClustersLegacy' if 'hltSiPixelClustersLegacy' in process.__dict__ else 'hltSiPixelClusters'
142 
143  _clone(process, 'hltSiPixelClustersCUDA', 'RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi', 'siPixelRawToClusterCUDA',
144  # use the same thresholds as the legacy module
145  clusterThreshold_layer1 = getattr(process, _hltSiPixelClustersLegacyLabel).ClusterThreshold_L1,
146  clusterThreshold_otherLayers = getattr(process, _hltSiPixelClustersLegacyLabel).ClusterThreshold,
147  )
148  # use the pixel channel calibrations scheme for Run 3
149  run3_common.toModify(process.hltSiPixelClustersCUDA, isRun2 = False)
150 
151  # copy the pixel digis errors to the host
152  _clone_if_missing(process, 'hltSiPixelDigiErrorsSoA', 'EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi', 'siPixelDigiErrorsSoAFromCUDA',
153  src = 'hltSiPixelClustersCUDA'
154  )
155 
156  # copy the pixel digis (except errors) and clusters to the host
157  _clone_if_missing(process, 'hltSiPixelDigisSoA', 'EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi', 'siPixelDigisSoAFromCUDA',
158  src = 'hltSiPixelClustersCUDA'
159  )
160 
161  # SwitchProducer: hltSiPixelDigis
162  if not isinstance(process.hltSiPixelDigis, SwitchProducerCUDA):
163 
164  if 'hltSiPixelDigisLegacy' not in process.__dict__:
165  # reconstruct the pixel digis on the cpu
166  process.hltSiPixelDigisLegacy = process.hltSiPixelDigis.clone()
167 
168  # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors to the legacy format
169  process.hltSiPixelDigis = SwitchProducerCUDA(
170  # legacy producer
171  cpu = cms.EDAlias(
172  hltSiPixelDigisLegacy = cms.VPSet(
173  cms.PSet(type = cms.string("DetIdedmEDCollection")),
174  cms.PSet(type = cms.string("SiPixelRawDataErroredmDetSetVector")),
175  cms.PSet(type = cms.string("PixelFEDChanneledmNewDetSetVector"))
176  )
177  )
178  )
179 
180  elif not hasattr(process.hltSiPixelDigis, 'cpu'):
181  raise Exception('unsupported configuration: "process.hltSiPixelDigis" is a SwitchProducerCUDA, but does not have a "cpu" branch')
182 
183  # conversion from SoA to legacy format
184  _clone_if_missing(process.hltSiPixelDigis, 'cuda', 'EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi', 'siPixelDigiErrorsFromSoA',
185  digiErrorSoASrc = "hltSiPixelDigiErrorsSoA",
186  UsePhase1 = True
187  )
188 
189 
190  # SwitchProducer: hltSiPixelClusters
191  if not isinstance(process.hltSiPixelClusters, SwitchProducerCUDA):
192 
193  if 'hltSiPixelClustersLegacy' not in process.__dict__:
194  # reconstruct the pixel clusters on the cpu
195  process.hltSiPixelClustersLegacy = process.hltSiPixelClusters.clone(
196  src = "hltSiPixelDigisLegacy"
197  )
198 
199  # 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
200  process.hltSiPixelClusters = SwitchProducerCUDA(
201  # legacy producer
202  cpu = cms.EDAlias(
203  hltSiPixelClustersLegacy = cms.VPSet(
204  cms.PSet(type = cms.string("SiPixelClusteredmNewDetSetVector"))
205  )
206  )
207  )
208 
209  elif not hasattr(process.hltSiPixelClusters, 'cpu'):
210  raise Exception('unsupported configuration: "process.hltSiPixelClusters" is a SwitchProducerCUDA, but does not have a "cpu" branch')
211 
212  # conversion from SoA to legacy format
213  _clone_if_missing(process.hltSiPixelClusters, 'cuda', 'RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi', 'siPixelDigisClustersFromSoA',
214  src = 'hltSiPixelDigisSoA',
215  produceDigis = False,
216  storeDigis = False,
217  # use the same thresholds as the legacy module
218  clusterThreshold_layer1 = process.hltSiPixelClustersLegacy.ClusterThreshold_L1,
219  clusterThreshold_otherLayers = process.hltSiPixelClustersLegacy.ClusterThreshold
220  )
221 
222  # reconstruct the pixel rechits on the gpu
223  _clone_if_missing(process, 'hltSiPixelRecHitsCUDA', 'RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi', 'siPixelRecHitCUDA',
224  src = 'hltSiPixelClustersCUDA',
225  beamSpot = 'hltOnlineBeamSpotToCUDA'
226  )
227 
228  # cpu only: produce the pixel rechits in SoA and legacy format, from the legacy clusters
229  _clone_if_missing(process, 'hltSiPixelRecHitSoA', 'RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi', 'siPixelRecHitSoAFromLegacy',
230  src = 'hltSiPixelClusters',
231  beamSpot = 'hltOnlineBeamSpot',
232  convertToLegacy = True
233  )
234 
235  # SwitchProducer: hltSiPixelRecHits
236  if not isinstance(process.hltSiPixelRecHits, SwitchProducerCUDA):
237  # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA
238  process.hltSiPixelRecHits = SwitchProducerCUDA(
239  # legacy producer
240  cpu = cms.EDAlias(
241  hltSiPixelRecHitSoA = cms.VPSet(
242  cms.PSet(type = cms.string("SiPixelRecHitedmNewDetSetVector")),
243  cms.PSet(type = cms.string("uintAsHostProduct"))
244  )
245  )
246  )
247 
248  elif not hasattr(process.hltSiPixelRecHits, 'cpu'):
249  raise Exception('unsupported configuration: "process.hltSiPixelRecHits" is a SwitchProducerCUDA, but does not have a "cpu" branch')
250 
251  # conversion from SoA to legacy format
252  _clone_if_missing(process.hltSiPixelRecHits, 'cuda', 'RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi', 'siPixelRecHitFromCUDA',
253  pixelRecHitSrc = 'hltSiPixelRecHitsCUDA',
254  src = 'hltSiPixelClusters'
255  )
256 
257 
258  # Tasks and Sequences
259 
260  if 'HLTDoLocalPixelTask' not in process.__dict__:
261  process.HLTDoLocalPixelTask = cms.Task(
262  process.hltOnlineBeamSpotToCUDA, # transfer the beamspot to the gpu
263  process.hltSiPixelClustersCUDA, # reconstruct the pixel digis and clusters on the gpu
264  process.hltSiPixelRecHitsCUDA, # reconstruct the pixel rechits on the gpu
265  process.hltSiPixelDigisSoA, # copy the pixel digis (except errors) and clusters to the host
266  process.hltSiPixelDigiErrorsSoA, # copy the pixel digis errors to the host
267  process.hltSiPixelDigisLegacy, # legacy pixel digis producer
268  process.hltSiPixelDigis, # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors from SoA
269  process.hltSiPixelClustersLegacy, # legacy pixel cluster producer
270  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
271  process.hltSiPixelClustersCache, # legacy module, used by the legacy pixel quadruplet producer
272  process.hltSiPixelRecHitSoA, # pixel rechits on cpu, in SoA & legacy format
273  process.hltSiPixelRecHits, # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA
274  )
275 
276  elif not isinstance(process.HLTDoLocalPixelTask, cms.Task):
277  raise Exception('unsupported configuration: "process.HLTDoLocalPixelTask" already exists, but it is not a Task')
278 
279  # redefine HLTDoLocalPixelSequence (it was emptied at the start of this function)
280  process.HLTDoLocalPixelSequence = cms.Sequence(process.HLTDoLocalPixelTask)
281 
282 
283  # workaround for old version of AlCa_LumiPixelsCounts paths
284  for AlCaPathName in ['AlCa_LumiPixelsCounts_Random_v1', 'AlCa_LumiPixelsCounts_ZeroBias_v1']:
285  if AlCaPathName in process.__dict__:
286  AlCaPath = getattr(process, AlCaPathName)
287  # replace hltSiPixelDigis+hltSiPixelClusters with HLTDoLocalPixelSequence
288  hasSiPixelDigis, hasSiPixelClusters = False, False
289  for (itemLabel, itemName) in AlCaPath.directDependencies():
290  if itemLabel != 'modules': continue
291  if itemName == 'hltSiPixelDigis': hasSiPixelDigis = True
292  elif itemName == 'hltSiPixelClusters': hasSiPixelClusters = True
293  if hasSiPixelDigis and hasSiPixelClusters:
294  AlCaPath.remove(process.hltSiPixelClusters)
295  AlCaPath.replace(process.hltSiPixelDigis, process.HLTDoLocalPixelSequence)
296 
297 
298  # done
299  return process
300 
301 
# customisation for running the "Patatrack" pixel track reconstruction
def customizeHLTforPatatrack.customisePixelTrackReconstruction (   process)

Definition at line 302 of file customizeHLTforPatatrack.py.

References _clone(), and _clone_if_missing().

Referenced by customizeHLTforPatatrack(), and customizeHLTforPatatrackTriplets().

304 
305  if not 'HLTRecoPixelTracksSequence' in process.__dict__:
306  return process
307 
308  hasHLTPixelVertexReco = 'HLTRecopixelvertexingSequence' in process.__dict__
309 
310  # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases
311  process.HLTRecoPixelTracksSequence = cms.Sequence()
312  if hasHLTPixelVertexReco:
313  process.HLTRecopixelvertexingSequence = cms.Sequence()
314 
315 
316  # Modules and EDAliases
317  # referenced in process.HLTRecoPixelTracksTask
318 
319  # SwitchProducer: hltPixelTracksSoA
320  if not ('hltPixelTracksSoA' in process.__dict__ and isinstance(process.hltPixelTracksSoA, SwitchProducerCUDA)):
321  # build pixel ntuplets and pixel tracks in SoA format on gpu
322  _clone(process, 'hltPixelTracksCUDA', 'RecoPixelVertexing.PixelTriplets.pixelTracksCUDA_cfi', 'pixelTracksCUDA',
323  pixelRecHitSrc = 'hltSiPixelRecHitsCUDA',
324  onGPU = True,
325  idealConditions = False
326  )
327  # use quality cuts tuned for Run-2 ideal conditions for all Run-3 workflows
328  run3_common.toModify(process.hltPixelTracksCUDA, idealConditions = True)
329 
330  process.hltPixelTracksSoA = SwitchProducerCUDA(
331  # build pixel ntuplets and pixel tracks in SoA format on cpu
332  cpu = process.hltPixelTracksCUDA.clone(
333  pixelRecHitSrc = 'hltSiPixelRecHitSoA',
334  onGPU = False
335  )
336  )
337 
338  elif hasattr(process.hltPixelTracksSoA, 'cpu'):
339  # if cpu branch of SwitchProducerCUDA exists, take hltPixelTracksCUDA (gpu)
340  # from hltPixelTracksSoA.cpu (cpu) to enforce same configuration parameters
341  process.hltPixelTracksCUDA = process.hltPixelTracksSoA.cpu.clone(
342  pixelRecHitSrc = "hltSiPixelRecHitsCUDA",
343  onGPU = True
344  )
345 
346  else:
347  raise Exception('unsupported configuration: "process.hltPixelTracksSoA" is a SwitchProducerCUDA, but does not have a "cpu" branch')
348 
349  # transfer the pixel tracks in SoA format to cpu
350  _clone_if_missing(process.hltPixelTracksSoA, 'cuda', 'RecoPixelVertexing.PixelTrackFitting.pixelTracksSoA_cfi', 'pixelTracksSoA',
351  src = 'hltPixelTracksCUDA'
352  )
353 
354 
355  # convert the pixel tracks from SoA to legacy format
356  if process.hltPixelTracks.type_() != 'PixelTrackProducerFromSoA':
357  _clone(process, 'hltPixelTracks', 'RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi', 'pixelTrackProducerFromSoA',
358  beamSpot = 'hltOnlineBeamSpot',
359  pixelRecHitLegacySrc = 'hltSiPixelRecHits',
360  trackSrc = 'hltPixelTracksSoA'
361  )
362 
363 
364  # referenced in process.HLTRecopixelvertexingTask
365  if hasHLTPixelVertexReco:
366 
367  # SwitchProducer: hltPixelVerticesSoA
368  if not ('hltPixelVerticesSoA' in process.__dict__ and isinstance(process.hltPixelVerticesSoA, SwitchProducerCUDA)):
369  # build pixel vertices in SoA format on gpu
370  _clone(process, 'hltPixelVerticesCUDA', 'RecoPixelVertexing.PixelVertexFinding.pixelVerticesCUDA_cfi', 'pixelVerticesCUDA',
371  pixelTrackSrc = 'hltPixelTracksCUDA',
372  onGPU = True
373  )
374 
375  # build or transfer pixel vertices in SoA format on cpu
376  process.hltPixelVerticesSoA = SwitchProducerCUDA(
377  # build pixel vertices in SoA format on cpu
378  cpu = process.hltPixelVerticesCUDA.clone(
379  pixelTrackSrc = 'hltPixelTracksSoA',
380  onGPU = False
381  )
382  )
383 
384  elif hasattr(process.hltPixelVerticesSoA, 'cpu'):
385  # if cpu branch of SwitchProducerCUDA exists, take hltPixelVerticesCUDA (gpu)
386  # from hltPixelVerticesSoA.cpu (cpu) to enforce same configuration parameters
387  process.hltPixelVerticesCUDA = process.hltPixelVerticesSoA.cpu.clone(
388  pixelTrackSrc = 'hltPixelTracksCUDA',
389  onGPU = True
390  )
391 
392  else:
393  raise Exception('unsupported configuration: "process.hltPixelVerticesSoA" is a SwitchProducerCUDA, but does not have a "cpu" branch')
394 
395  # transfer the pixel vertices in SoA format to cpu
396  _clone_if_missing(process.hltPixelVerticesSoA, 'cuda', 'RecoPixelVertexing.PixelVertexFinding.pixelVerticesSoA_cfi', 'pixelVerticesSoA',
397  src = 'hltPixelVerticesCUDA'
398  )
399 
400 
401  # convert the pixel vertices from SoA to legacy format
402  if process.hltPixelVertices.type_() != 'PixelVertexProducerFromSoA':
403  _clone(process, 'hltPixelVertices', 'RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi', 'pixelVertexFromSoA',
404  src = 'hltPixelVerticesSoA',
405  TrackCollection = 'hltPixelTracks',
406  beamSpot = 'hltOnlineBeamSpot'
407  )
408 
409 
410  # Tasks and Sequences
411 
412  if 'HLTRecoPixelTracksTask' not in process.__dict__:
413  process.HLTRecoPixelTracksTask = cms.Task(
414  process.hltPixelTracksTrackingRegions, # from the original sequence
415  process.hltPixelTracksCUDA, # pixel ntuplets on gpu, in SoA format
416  process.hltPixelTracksSoA, # pixel ntuplets on cpu, in SoA format
417  process.hltPixelTracks, # pixel tracks on cpu, in legacy format
418  )
419 
420  elif not isinstance(process.HLTRecoPixelTracksTask, cms.Task):
421  raise Exception('unsupported configuration: "process.HLTRecoPixelTracksTask" already exists, but it is not a Task')
422 
423  # redefine HLTRecoPixelTracksSequence (it was emptied at the start of this function)
424  process.HLTRecoPixelTracksSequence = cms.Sequence(process.HLTRecoPixelTracksTask)
425 
426  if hasHLTPixelVertexReco:
427 
428  if 'HLTRecopixelvertexingTask' not in process.__dict__:
429  process.HLTRecopixelvertexingTask = cms.Task(
430  process.HLTRecoPixelTracksTask,
431  process.hltPixelVerticesCUDA, # pixel vertices on gpu, in SoA format
432  process.hltPixelVerticesSoA, # pixel vertices on cpu, in SoA format
433  process.hltPixelVertices, # pixel vertices on cpu, in legacy format
434  process.hltTrimmedPixelVertices, # from the original sequence
435  )
436 
437  elif not isinstance(process.HLTRecopixelvertexingTask, cms.Task):
438  raise Exception('unsupported configuration: "process.HLTRecopixelvertexingTask" already exists, but it is not a Task')
439 
440  # redefine HLTRecopixelvertexingSequence (it was emptied at the start of this function)
441  process.HLTRecopixelvertexingSequence = cms.Sequence(
442  process.hltPixelTracksFitter + # not used here, kept for compatibility with legacy sequences
443  process.hltPixelTracksFilter, # not used here, kept for compatibility with legacy sequences
444  process.HLTRecopixelvertexingTask,
445  )
446 
447 
448  # done
449  return process
450 
451 
# customisation for offloading the ECAL local reconstruction via CUDA if a supported gpu is present
def customizeHLTforPatatrack.customizeHLTforPatatrack (   process)

Definition at line 834 of file customizeHLTforPatatrack.py.

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

835 def customizeHLTforPatatrack(process):
836  process = customiseCommon(process)
837  process = customisePixelLocalReconstruction(process)
838  process = customisePixelTrackReconstruction(process)
839  process = customiseEcalLocalReconstruction(process)
840  process = customiseHcalLocalReconstruction(process)
841  return process
842 
843 
# 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 844 of file customizeHLTforPatatrack.py.

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

Referenced by applyL2TauTag.update().

846  process = customiseCommon(process)
847  process = customisePixelLocalReconstruction(process)
848  process = customisePixelTrackReconstruction(process)
849  process = customiseEcalLocalReconstruction(process)
850  process = customiseHcalLocalReconstruction(process)
851  process = enablePatatrackPixelTriplets(process)
852  return process
853 
def customizeHLTforPatatrack.enablePatatrackPixelTriplets (   process)

Definition at line 817 of file customizeHLTforPatatrack.py.

Referenced by customizeHLTforPatatrackTriplets().

818 def enablePatatrackPixelTriplets(process):
819 
820  if 'hltPixelTracksCUDA' in process.__dict__:
821  # configure GPU pixel tracks for triplets
822  process.hltPixelTracksCUDA.minHitsPerNtuplet = 3
823  process.hltPixelTracksCUDA.includeJumpingForwardDoublets = True
824 
825  if 'hltPixelTracksSoA' in process.__dict__:
826  # configure CPU pixel tracks for triplets
827  process.hltPixelTracksSoA.cpu.minHitsPerNtuplet = 3
828  process.hltPixelTracksSoA.cpu.includeJumpingForwardDoublets = True
829 
830  # done
831  return process
832 
833 
# customisation for running the Patatrack reconstruction, with automatic offload via CUDA when a supported gpu is available