CMS 3D CMS Logo

genparticles_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
3 
4 
5 
6 ##################### User floats producers, selectors ##########################
7 
8 finalGenParticles = cms.EDProducer("GenParticlePruner",
9  src = cms.InputTag("prunedGenParticles"),
10  select = cms.vstring(
11  "drop *",
12  "keep++ abs(pdgId) == 15 & (pt > 15 || isPromptDecayed() )",# keep full tau decay chain for some taus
13  #"drop status==1 & pt < 1", #drop soft stable particle in tau decay
14  "keep+ abs(pdgId) == 15 ", # keep first gen decay product for all tau
15  "+keep pdgId == 22 && status == 1 && (pt > 10 || isPromptFinalState())", # keep gamma above 10 GeV (or all prompt) and its first parent
16  "+keep abs(pdgId) == 11 || abs(pdgId) == 13 || abs(pdgId) == 15", #keep leptons, with at most one mother back in the history
17  "drop abs(pdgId)= 2212 && abs(pz) > 1000", #drop LHC protons accidentally added by previous keeps
18  "keep (400 < abs(pdgId) < 600) || (4000 < abs(pdgId) < 6000)", #keep all B and C hadrons
19  "keep abs(pdgId) == 12 || abs(pdgId) == 14 || abs(pdgId) == 16", # keep neutrinos
20  "keep status == 3 || (status > 20 && status < 30)", #keep matrix element summary
21  "keep isHardProcess() || fromHardProcessDecayed() || fromHardProcessFinalState() || (statusFlags().fromHardProcess() && statusFlags().isLastCopy())", #keep event summary based on status flags
22  "keep (status > 70 && status < 80 && pt > 15) ", # keep high pt partons right before hadronization
23  "keep abs(pdgId) == 23 || abs(pdgId) == 24 || abs(pdgId) == 25 || abs(pdgId) == 37 ", # keep VIP(articles)s
24  #"keep abs(pdgId) == 310 && abs(eta) < 2.5 && pt > 1 ", # keep K0
25  "keep (1000001 <= abs(pdgId) <= 1000039 ) || ( 2000001 <= abs(pdgId) <= 2000015)", #keep SUSY fiction particles
26 
27  )
28 )
29 
30 
31 
32 ##################### Tables for final output and docs ##########################
33 genParticleTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
34  src = cms.InputTag("finalGenParticles"),
35  cut = cms.string(""), #we should not filter after pruning
36  name= cms.string("GenPart"),
37  doc = cms.string("interesting gen particles "),
38  singleton = cms.bool(False), # the number of entries is variable
39  extension = cms.bool(False), # this is the main table for the taus
40  variables = cms.PSet(
41  pt = Var("pt", float, precision=8),
42  phi = Var("phi", float,precision=8),
43  eta = Var("eta", float,precision=8),
44  mass = Var("?mass>10 || (pdgId==22 && mass > 1) || abs(pdgId)==24 || pdgId==23 || abs(pdgId)>1000000?mass:0", float,precision="?(abs(pdgId)==6 && statusFlags().isLastCopy())?20:8",doc="Mass stored for all particles with mass > 10 GeV and photons with mass > 1 GeV, plus W/Z and BSM particles. For other particles you can lookup from PDGID"),
45  pdgId = Var("pdgId", int, doc="PDG id"),
46  status = Var("status", int, doc="Particle status. 1=stable"),
47  genPartIdxMother = Var("?numberOfMothers>0?motherRef(0).key():-1", int, doc="index of the mother particle"),
48  statusFlags = (Var(
49  "statusFlags().isLastCopyBeforeFSR() * 16384 +"
50  "statusFlags().isLastCopy() * 8192 +"
51  "statusFlags().isFirstCopy() * 4096 +"
52  "statusFlags().fromHardProcessBeforeFSR() * 2048 +"
53  "statusFlags().isDirectHardProcessTauDecayProduct() * 1024 +"
54  "statusFlags().isHardProcessTauDecayProduct() * 512 +"
55  "statusFlags().fromHardProcess() * 256 +"
56  "statusFlags().isHardProcess() * 128 +"
57  "statusFlags().isDirectHadronDecayProduct() * 64 +"
58  "statusFlags().isDirectPromptTauDecayProduct() * 32 +"
59  "statusFlags().isDirectTauDecayProduct() * 16 +"
60  "statusFlags().isPromptTauDecayProduct() * 8 +"
61  "statusFlags().isTauDecayProduct() * 4 +"
62  "statusFlags().isDecayedLeptonHadron() * 2 +"
63  "statusFlags().isPrompt() * 1 ",
64  int, doc=("gen status flags stored bitwise, bits are: "
65  "0 : isPrompt, "
66  "1 : isDecayedLeptonHadron, "
67  "2 : isTauDecayProduct, "
68  "3 : isPromptTauDecayProduct, "
69  "4 : isDirectTauDecayProduct, "
70  "5 : isDirectPromptTauDecayProduct, "
71  "6 : isDirectHadronDecayProduct, "
72  "7 : isHardProcess, "
73  "8 : fromHardProcess, "
74  "9 : isHardProcessTauDecayProduct, "
75  "10 : isDirectHardProcessTauDecayProduct, "
76  "11 : fromHardProcessBeforeFSR, "
77  "12 : isFirstCopy, "
78  "13 : isLastCopy, "
79  "14 : isLastCopyBeforeFSR, ")
80  )),
81  )
82 )
83 
84 genParticleSequence = cms.Sequence(finalGenParticles)
85 genParticleTables = cms.Sequence(genParticleTable)
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:20