Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-24 02:12:56

0001 import FWCore.ParameterSet.Config as cms
0002 import os, glob
0003 
0004 def getHeterogeneousRecHitsSource(pu):
0005     indir = '/eos/user/b/bfontana/Samples/' #indir = '/home/bfontana/'
0006     filename_suff = 'step3_ttbar_PU' + str(pu) #filename_suff = 'hadd_out_PU' + str(pu)
0007     fNames = [ 'file:' + x for x in glob.glob(os.path.join(indir, filename_suff + '*.root')) ]
0008     print(indir, filename_suff, pu, fNames)
0009     for _ in range(4):
0010         fNames.extend(fNames)
0011     if len(fNames)==0:
0012         print('Used globbing: ', glob.glob(os.path.join(indir, filename_suff + '*.root')))
0013         raise ValueError('No input files!')
0014 
0015     keep = 'keep *'
0016     drop1 = 'drop CSCDetIdCSCALCTPreTriggerDigiMuonDigiCollection_simCscTriggerPrimitiveDigis__HLT'
0017     drop2 = 'drop HGCRecHitsSorted_HGCalRecHit_HGC*E*RecHits_*'
0018     return cms.Source("PoolSource",
0019                       fileNames = cms.untracked.vstring(fNames),
0020                       inputCommands = cms.untracked.vstring(keep, drop1, drop2),
0021                       duplicateCheckMode = cms.untracked.string("noDuplicateCheck"))
0022 
0023 enableGPU = True
0024 from Configuration.ProcessModifiers.gpu_cff import gpu
0025 
0026 from RecoLocalCalo.HGCalRecProducers.HGCalRecHit_cfi import HGCalRecHit
0027 from SimCalorimetry.HGCalSimProducers.hgcalDigitizer_cfi import HGCAL_noise_fC, HGCAL_chargeCollectionEfficiencies
0028 
0029 #arguments parsing
0030 from FWCore.ParameterSet.VarParsing import VarParsing
0031 F = VarParsing('analysis')
0032 F.register('PU',
0033            -1,
0034            F.multiplicity.singleton,
0035            F.varType.int,
0036            "Pileup to consider.")
0037 F.parseArguments()
0038 
0039 process = cms.Process("TESTgpu", gpu) if enableGPU else cms.Process("TESTnongpu")
0040 process.load('FWCore.MessageService.MessageLogger_cfi')
0041 process.load('Configuration.StandardSequences.Services_cff')
0042 process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
0043 process.load('Configuration.StandardSequences.MagneticField_cff')
0044 #process.load('Configuration.EventContent.EventContent_cff')
0045 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0046 process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff')
0047 process.load('HeterogeneousCore.CUDACore.ProcessAcceleratorCUDA_cfi')
0048 process.load('RecoLocalCalo.HGCalRecProducers.HGCalRecHit_cfi')
0049 process.load('SimCalorimetry.HGCalSimProducers.hgcalDigitizer_cfi')
0050 
0051 process.TFileService = cms.Service("TFileService", 
0052                                    fileName = cms.string("histo.root"),
0053                                    closeFileFast = cms.untracked.bool(True)
0054                                )
0055 
0056     
0057 process.source = getHeterogeneousRecHitsSource(F.PU)
0058 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(20) )
0059 process.options = cms.untracked.PSet(
0060     wantSummary = cms.untracked.bool( False )) #add option for edmStreams
0061 
0062 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousEERecHitGPU_cfi')
0063 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousEERecHitGPUtoSoA_cfi')
0064 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousEERecHitFromSoA_cfi')
0065 
0066 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEFRecHitGPU_cfi')
0067 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEFRecHitGPUtoSoA_cfi')
0068 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEFRecHitFromSoA_cfi')
0069 
0070 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEBRecHitGPU_cfi')
0071 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEBRecHitGPUtoSoA_cfi')
0072 process.load('RecoLocalCalo.HGCalRecProducers.HeterogeneousHEBRecHitFromSoA_cfi')
0073 
0074 
0075 #process.HeterogeneousHGCalHEFCellPositionsFiller = cms.ESProducer("HeterogeneousHGCalHEFCellPositionsFiller")
0076 
0077 
0078 #process.HGCalRecHits = HGCalRecHit.clone()
0079 
0080 #process.task = cms.Task( process.HeterogeneousHGCalHEFCellPositionsFiller, process.HeterogeneousHGCalHEFRecHits )
0081 #process.task = cms.Task( process.HGCalRecHits, process.HeterogeneousHGCalHEFRecHits )
0082 
0083 process.ee_task = cms.Task( process.EERecHitGPUProd, process.EERecHitGPUtoSoAProd, process.EERecHitFromSoAProd )
0084 process.hef_task = cms.Task( process.HEFRecHitGPUProd, process.HEFRecHitGPUtoSoAProd, process.HEFRecHitFromSoAProd )
0085 process.heb_task = cms.Task( process.HEBRecHitGPUProd, process.HEBRecHitGPUtoSoAProd, process.HEBRecHitFromSoAProd )
0086 process.recHits_task = cms.Task( process.ee_task, process.hef_task, process.heb_task )
0087 process.path = cms.Path( process.recHits_task )
0088 
0089 outkeeps = ['keep *_EERecHitFromSoAProd_*_*',
0090             'keep *_HEFRecHitFromSoAProd_*_*',
0091             'keep *_HEBRecHitFromSoAProd_*_*']
0092 
0093 process.out = cms.OutputModule( "PoolOutputModule", 
0094                                 fileName = cms.untracked.string( '/eos/user/b/bfontana/GPUs/GPUs_' + str(F.PU) + '.root'),
0095                                 outputCommands = cms.untracked.vstring(outkeeps[0], outkeeps[1], outkeeps[2])
0096 )
0097 process.outpath = cms.EndPath(process.out)