Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:16

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 process = cms.Process("TEST")
0004 
0005 # ... the number of events to be processed
0006 process.maxEvents = cms.untracked.PSet(
0007     input = cms.untracked.int32(100)
0008 )
0009 # ... this is needed for the PtGun
0010 process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
0011 
0012 # ... this is needed for the PtGun
0013 process.RandomNumberGeneratorService = cms.Service(
0014     "RandomNumberGeneratorService",
0015     moduleSeeds = cms.PSet(
0016         generator = cms.untracked.uint32(123456781)
0017     ),
0018     sourceSeed = cms.untracked.uint32(123456781)
0019 )
0020 
0021 # ... this is needed in CMSSW >= 3_1
0022 process.source = cms.Source("EmptySource")
0023 
0024 # ... just a gun to feed something to the ProtonTaggerFilter
0025 process.generator = cms.EDProducer("FlatRandomPtGunProducer",
0026     PGunParameters = cms.PSet(
0027         # you can request more than 1 particle
0028         PartID = cms.vint32(2212),
0029         MinEta = cms.double(10.0),
0030         MaxEta = cms.double(10.4),
0031         MinPhi = cms.double(-3.14159265359), ## it must be in radians
0032         MaxPhi = cms.double(3.14159265359),
0033         MinPt = cms.double(0.4),
0034         MaxPt = cms.double(0.6)
0035     ),
0036     AddAntiParticle = cms.bool(False), ## back-to-back particles
0037     firstRun = cms.untracked.uint32(1),
0038     Verbosity = cms.untracked.int32(0) ## for printouts, set it to 1 (or greater)
0039 )
0040 
0041 # ... put generator in ProductionFilterSequence (for CMSSW >= 3_1)
0042 process.ProductionFilterSequence = cms.Sequence(process.generator)
0043 
0044 
0045 # ... this is our forward proton filter
0046 process.forwardProtonFilter = cms.EDFilter(
0047     "ProtonTaggerFilter",
0048     # ... choose where you want a proton to be detected for beam 1 (clockwise)
0049     #     0 -> ignore this beam
0050     #     1 -> only 420 (FP420)
0051     #     2 -> only 220 (TOTEM)
0052     #     3 -> 220 and 420 (region of overlay)
0053     #     4 -> 220 or 420 (combined acceptance)
0054     beam1mode = cms.uint32(4),
0055 
0056     # ... and for beam 2 (anti-clockwise)
0057     beam2mode = cms.uint32(1),
0058 
0059     # ... choose how the information for the two beam directions should be combined
0060     #     1 -> any of the two protons (clockwise or anti-clockwise) is enough
0061     #     2 -> both protons should be tagged
0062     #     3 -> two protons should be tagged as 220+220 or 420+420 (makes sence with beamXmode=4)
0063     #     4 -> two protons should be tagged as 220+420 or 420+220 (makes sence with beamXmode=4)
0064     beamCombiningMode = cms.uint32(1)
0065 )
0066 
0067 # ... request a summary to see how many events pass the filter
0068 process.options = cms.untracked.PSet(
0069     wantSummary = cms.untracked.bool(True)
0070 )
0071 
0072 # ... just run the filter
0073 process.forwardProtons = cms.Path(process.ProductionFilterSequence * process.forwardProtonFilter)
0074 
0075 # ...  define a root file for the events which pass the filter
0076 process.out = cms.OutputModule(
0077     "PoolOutputModule",
0078     fileName = cms.untracked.string('test.root'),
0079     SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('forwardProtons'))
0080 )
0081 
0082 # ...  uncomment this if you want the output file
0083 # process.saveIt = cms.EndPath(process.out)
0084