CMS 3D CMS Logo

ValidateTausOnRealElectronsData_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
3 import copy
4 
7 
8 ElPrimaryVertexFilter = cms.EDFilter(
9  "VertexSelector",
10  src = cms.InputTag("offlinePrimaryVertices"),
11  cut = cms.string("!isFake && ndof > 4 && abs(z) <= 24 && position.Rho <= 2"),
12  filter = cms.bool(False)
13  )
14 
15 ElBestPV = cms.EDProducer(
16  "HighestSumP4PrimaryVertexSelector",
17  src = cms.InputTag("ElPrimaryVertexFilter")
18  )
19 
20 selectedElectrons = cms.EDFilter(
21  "TauValElectronSelector",
22  src = cms.InputTag('gedGsfElectrons'),
23  cut = cms.string("pt > 25.0 && abs(eta) < 2.4 && isElectron"),
24  filter = cms.bool(False)
25  )
26 
27 ElectronsFromPV = cms.EDProducer(
28  "GsfElectronFromPVSelector",
29  srcElectron = cms.InputTag("selectedElectrons"),
30  srcVertex = cms.InputTag("ElBestPV"),
31  max_dxy = cms.double(0.01),
32  max_dz = cms.double(0.1)
33  )
34 
35 idElectrons = cms.EDFilter(
36  "TauValElectronSelector",
37  src = cms.InputTag('ElectronsFromPV'),
38  cut = cms.string('ecalDrivenSeed & isGsfCtfScPixChargeConsistent & isGsfScPixChargeConsistent & isGsfCtfChargeConsistent & !isEBEEGap & (isEB & sigmaIetaIeta<0.01 & abs(deltaPhiSuperClusterTrackAtVtx)<0.06 & abs(deltaEtaSuperClusterTrackAtVtx)<0.006 & hadronicOverEm<0.04 | isEE & sigmaIetaIeta<0.03 & abs(deltaPhiSuperClusterTrackAtVtx)<0.04 & abs(deltaEtaSuperClusterTrackAtVtx)<0.007 & hadronicOverEm<0.025)'),
39  filter = cms.bool(False)
40 )
41 
42 trackElectrons = cms.EDFilter(
43  "TauValElectronSelector",
44  src = cms.InputTag('idElectrons'),
45  cut = cms.string('gsfTrack.isNonnull && 0.7 < eSuperClusterOverP < 1.5'),
46 # cut = cms.string('gsfTrack.isNonnull && gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\') = 0 && 0.7 < eSuperClusterOverP < 1.5'),
47  filter = cms.bool(False)
48 )
49 
50 isolatedElectrons = cms.EDFilter(
51  "TauValElectronSelector",
52  src = cms.InputTag('trackElectrons'),
53  cut = cms.string("(isEB & (dr04TkSumPt/pt + max(0.,dr04EcalRecHitSumEt-2.)/pt + dr04HcalTowerSumEt/pt < 0.10)) | (isEE & (dr04TkSumPt/pt + dr04EcalRecHitSumEt/pt + dr04HcalTowerSumEt/pt < 0.09))"),
54  filter = cms.bool(False)
55  )
56 
58 
59 ElGoodTracks = cms.EDFilter(
60  "TrackSelector",
61  src = cms.InputTag("generalTracks"),
62  cut = cms.string("pt > 5 && abs(eta) < 2.5"),
63  filter = cms.bool(False)
64  )
65 
66 ElIsoTracks = cms.EDProducer(
67  "IsoTracks",
68  src = cms.InputTag("ElGoodTracks"),
69  radius = cms.double(0.3),
70  SumPtFraction = cms.double(0.5)
71  )
72 
73 ElTrackFromPV = cms.EDProducer(
74  "TrackFromPVSelector",
75  srcTrack = cms.InputTag("ElIsoTracks"),
76  srcVertex = cms.InputTag("ElBestPV"),
77  max_dxy = cms.double(0.01),
78  max_dz = cms.double(0.1)
79  )
80 
81 ElTrackCands = cms.EDProducer(
82  "ConcreteChargedCandidateProducer",
83  src = cms.InputTag("ElTrackFromPV"),
84  particleType = cms.string("e+") # this is needed to define a mass do not trust the sign, it is dummy
85  )
86 
87 ZeeCandElectronTrack = cms.EDProducer(
88  "CandViewShallowCloneCombiner",
89  decay = cms.string("isolatedElectrons@+ ElTrackCands@-"), # it takes opposite sign collection, no matter if +- or -+
90  cut = cms.string("80 < mass < 100")
91  )
92 
93 BestZee = cms.EDProducer(
94  "BestMassZArbitrationProducer", # returns the Z with mass closest to 91.18 GeV
95  ZCandidateCollection = cms.InputTag("ZeeCandElectronTrack")
96  )
97 
98 ElZLegs = cms.EDProducer(
99  "CollectionFromZLegProducer",
100  ZCandidateCollection = cms.InputTag("BestZee"),
101  )
102 
103 procAttributes = dir(proc) #Takes a snapshot of what there in the process
104 helpers.cloneProcessingSnippet( proc, proc.TauValNumeratorAndDenominator, 'RealElectronsData') #clones the sequence inside the process with RealElectronsData postfix
105 helpers.cloneProcessingSnippet( proc, proc.TauEfficiencies, 'RealElectronsData') #clones the sequence inside the process with RealElectronsData postfix
106 helpers.massSearchReplaceAnyInputTag(proc.TauValNumeratorAndDenominatorRealElectronsData, 'kinematicSelectedTauValDenominator', cms.InputTag("ElZLegs","theProbeLeg")) #sets the correct input tag
107 
108 #adds to TauValNumeratorAndDenominator modules in the sequence RealElectronsData to the extention name
109 zttLabeler = lambda module : SetValidationExtention(module, 'RealElectronsData')
110 zttModifier = ApplyFunctionToSequence(zttLabeler)
111 proc.TauValNumeratorAndDenominatorRealElectronsData.visit(zttModifier)
112 
113 binning = cms.PSet(
114  pt = cms.PSet( nbins = cms.int32(10), min = cms.double(0.), max = cms.double(100.) ), #hinfo(75, 0., 150.)
115  eta = cms.PSet( nbins = cms.int32(4), min = cms.double(-3.), max = cms.double(3.) ), #hinfo(60, -3.0, 3.0);
116  phi = cms.PSet( nbins = cms.int32(4), min = cms.double(-180.), max = cms.double(180.) ), #hinfo(36, -180., 180.);
117  pileup = cms.PSet( nbins = cms.int32(18), min = cms.double(0.), max = cms.double(72.) ),#hinfo(25, 0., 25.0);
118  )
119 zttModifier = ApplyFunctionToSequence(lambda m: setBinning(m,binning))
120 proc.TauValNumeratorAndDenominatorRealElectronsData.visit(zttModifier)
121 #-----------------------------------------
122 
123 #Sets the correct naming to efficiency histograms
124 proc.efficienciesRealElectronsData.plots = Utils.SetPlotSequence(proc.TauValNumeratorAndDenominatorRealElectronsData)
125 
126 #checks what's new in the process (the cloned sequences and modules in them)
127 newProcAttributes = [x for x in dir(proc) if (x not in procAttributes) and (x.find('RealElectronsData') != -1)]
128 
129 #spawns a local variable with the same name as the proc attribute, needed for future process.load
130 for newAttr in newProcAttributes:
131  locals()[newAttr] = getattr(proc,newAttr)
132 
133 produceDenominatorRealElectronsData = cms.Sequence( cms.ignore(ElPrimaryVertexFilter) * ElBestPV *
134  ( (cms.ignore(selectedElectrons) * ElectronsFromPV * cms.ignore(idElectrons) * cms.ignore(trackElectrons) * cms.ignore(isolatedElectrons)) +
135  (cms.ignore(ElGoodTracks) * ElIsoTracks * ElTrackFromPV * ElTrackCands) ) *
136  ZeeCandElectronTrack *
137  BestZee *
138  ElZLegs
139  )
140 
141 produceDenominator = cms.Sequence(produceDenominatorRealElectronsData)
142 
143 runTauValidationBatchMode = cms.Sequence(
144  produceDenominatorRealElectronsData
145  +TauValNumeratorAndDenominatorRealElectronsData
146  )
147 
148 runTauValidation = cms.Sequence(
149  runTauValidationBatchMode
150  +TauEfficienciesRealElectronsData
151  )
def cloneProcessingSnippet(process, sequence, postfix, removePostfix="", noClones=[], addToTask=False)
Definition: helpers.py:257
def SetValidationExtention(module, extension)
def setBinning(module, pset)
dbl *** dir
Definition: mlp_gen.cc:35