Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
from FWCore.ParameterSet.Config import *

process = Process("CandSelectorTest")

process.include("FWCore/MessageLogger/data/MessageLogger.cfi")

process.maxEvents = untracked.PSet( input = untracked.int32(10) )

process.source = Source("PoolSource",
  fileNames = untracked.vstring("file:genevents.root")
)

# select the 10 particles with the larget Pt
process.largestPtCands = EDProducer("LargestPtCandSelector",
  src = InputTag("genParticleCandidates"),
  maxNumber = uint32( 10 )
)

# select only electrons, and save a vector of references 
process.electronRefs = EDProducer("PdgIdCandRefVectorSelector",
  src = InputTag("genParticleCandidates"),
  pdgId = vint32( 11 )
)

# select only electrons, and save clones
process.electrons = EDProducer("PdgIdCandSelector",
  src = InputTag("genParticleCandidates"),
  pdgId = vint32( 11 )
)

# select only muons, and save a vector of references 
process.muonRefs = EDProducer("PdgIdCandRefVectorSelector",
  src = InputTag("genParticleCandidates"),
  pdgId = vint32( 13 )
)

# select only muons, and save clones
process.muons = EDProducer("PdgIdCandSelector",
  src = InputTag("genParticleCandidates"),
  pdgId = vint32( 13 )
)

# select only electrons within eta and Pt cuts 
process.bestElectrons = EDFilter("EtaPtMinCandViewSelector",
  src = InputTag("electronRefs"),
  ptMin = double( 20 ),
  etaMin = double( -2.5 ),
  etaMax = double( 2.5 )
)

# make Z->e+e-
process.zCands = EDProducer("CandShallowCloneCombiner",
  decay = string("electrons@+ electrons@-"),
  cut = string("20 < mass < 200")
)

# make exotic decay to three electron
process.exoticCands = EDProducer("CandShallowCloneCombiner",
  decay = string("electrons@+ electrons@- electrons@+"),
  cut = string("20 < mass < 400")
)

# merge muons and electrons into leptons
process.leptons = EDProducer("CandMerger",
  src = VInputTag("electrons", "muons")
)

process.out = OutputModule("PoolOutputModule",
  fileName = untracked.string("cands.root")
)

process.printEventNumber = OutputModule("AsciiOutputModule")

process.select = Path(
  process.largestPtCands *
  process.electronRefs *
  process.electrons *
  process.muonRefs *
  process.muons *
  process.bestElectrons *
  process.leptons *
  process.zCands *
  process.exoticCands
)
 	
process.ep = EndPath(
  process.printEventNumber *
  process.out
)