Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:28:32

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 
0004 class ThingExternalProcessProducer(cms.EDProducer):
0005     def __init__(self, prod):
0006         self.__dict__['_prod'] = prod
0007         super(cms.EDProducer,self).__init__('TestInterProcessProd')
0008     def __setattr__(self, name, value):
0009         setattr(self._prod, name, value)
0010     def __getattr__(self, name):
0011         if name =='_prod':
0012             return self.__dict__['_prod']
0013         return getattr(self._prod, name)
0014     def clone(self, **params):
0015         returnValue = ThingExternalProcessProducerProducer.__new__(type(self))
0016         returnValue.__init__(self._prod.clone())
0017         return returnValue
0018     def insertInto(self, parameterSet, myname):
0019         newpset = parameterSet.newPSet()
0020         newpset.addString(True, "@module_label", self.moduleLabel_(myname))
0021         newpset.addString(True, "@module_type", self.type_())
0022         newpset.addString(True, "@module_edm_type", cms.EDProducer.__name__)
0023         newpset.addString(True, "@external_type", self._prod.type_())
0024         newpset.addString(False,"@python_config", self._prod.dumpPython())
0025         self._prod.insertContentsInto(newpset)
0026         parameterSet.addPSet(True, self.nameInProcessDesc_(myname), newpset)
0027 
0028 
0029 _generator = cms.EDProducer("ThingProducer", nThings = cms.int32(100), grow=cms.bool(True), offsetDelta = cms.int32(1))
0030 
0031 process = cms.Process("TEST")
0032 
0033 process.source = cms.Source("EmptySource")
0034 
0035 process.maxEvents.input = 10;
0036 
0037 process.thing = ThingExternalProcessProducer(_generator)
0038 
0039 process.p = cms.Path(process.thing)
0040 
0041 process.getter = cms.EDAnalyzer("edmtest::ThingAnalyzer")
0042 
0043 process.o = cms.EndPath(process.getter)
0044 process.options.numberOfThreads = 4