6 """ Create selected tracks and a candidate hypothesis on AOD:
8 _label=
'makeAODTrackCandidates'
9 _defaultParameters=dicttypes.SortedKeysDict()
12 ConfigToolBase.__init__(self)
13 self.addParameter(self.
_defaultParameters,
'label',
'TrackCands',
"output collection will be <'patAOD'+label>")
14 self.addParameter(self.
_defaultParameters,
'tracks',cms.InputTag(
'generalTracks'),
'input tracks')
15 self.addParameter(self.
_defaultParameters,
'particleType',
'pi+',
'particle type (for mass)')
16 self.addParameter(self.
_defaultParameters,
'candSelection',
'pt > 10',
'preselection cut on the candidates')
28 candSelection =
None) :
33 if particleType
is None:
35 if candSelection
is None:
37 self.setParameter(
'label',label)
38 self.setParameter(
'tracks',tracks)
39 self.setParameter(
'particleType',particleType)
40 self.setParameter(
'candSelection',candSelection)
47 candSelection=self.
_parameters[
'candSelection'].value
49 process.load(
"SimGeneral.HepPDTESSource.pythiapdt_cfi");
51 setattr(process,
'patAOD' + label +
'Unfiltered', cms.EDProducer(
"ConcreteChargedCandidateProducer",
53 particleType = cms.string(particleType)
57 setattr(process,
'patAOD' + label, cms.EDFilter(
"CandViewSelector",
58 src = cms.InputTag(
'patAOD' + label +
'Unfiltered'),
59 cut = cms.string(candSelection)
68 """ Create pat track candidates from AOD track collections:
70 _label=
'makePATTrackCandidates'
71 _defaultParameters=dicttypes.SortedKeysDict()
74 ConfigToolBase.__init__(self)
75 self.addParameter(self.
_defaultParameters,
'label',
'TrackCands',
"output will be 'all/selectedLayer1'+label")
76 self.addParameter(self.
_defaultParameters,
'input',cms.InputTag(
'patAODTrackCands'),
'name of the input collection')
77 self.addParameter(self.
_defaultParameters,
'selection',
'pt > 10',
'selection on PAT Layer 1 objects')
78 self.addParameter(self.
_defaultParameters,
'isolation',{
'tracker':0.3,
'ecalTowers':0.3,
'hcalTowers':0.3},
"solation to use (as 'source': value of dR)\ntracker : as muon iso from tracks\necalTowers : as muon iso from calo tower\nhcalTowers : as muon iso from calo towers",allowedValues=[
'tracker',
'ecalTowers',
'hcalTowers'])
79 self.addParameter(self.
_defaultParameters,
'isoDeposits',[
'tracker',
'ecalTowers',
'hcalTowers'],
'iso deposits')
80 self.addParameter(self.
_defaultParameters,
'mcAs',
None,
"eplicate mc match as the one used by PAT on this AOD collection (None=no mc match); choose 'photon', 'electron', 'muon', 'tau','jet', 'met' as input string",Type=str, allowedValues=[
'photon',
'electron',
'muon',
'tau',
'jet',
'met',
None], acceptNoneValue =
True)
101 if isolation
is None:
103 if isoDeposits
is None:
107 self.setParameter(
'label',label)
108 self.setParameter(
'input',input)
109 self.setParameter(
'selection',selection)
110 self.setParameter(
'isolation',isolation)
111 self.setParameter(
'isoDeposits',isoDeposits)
112 self.setParameter(
'mcAs',mcAs,
True)
124 from PhysicsTools.PatAlgos.producersLayer1.genericParticleProducer_cfi
import patGenericParticles
125 setattr(process,
'pat' + label, patGenericParticles.clone(src = input))
127 setattr(process,
'selectedPat' + label, cms.EDFilter(
"PATGenericParticleSelector",
128 src = cms.InputTag(
"pat"+label),
129 cut = cms.string(selection)
133 from PhysicsTools.PatAlgos.cleaningLayer1.genericTrackCleaner_cfi
import cleanPatTracks
134 setattr(process,
'cleanPat' + label, cleanPatTracks.clone(src = cms.InputTag(
'selectedPat' + label)))
137 l1cands = getattr(process,
'pat' + label)
138 selectedL1cands = getattr(process,
'selectedPat' + label)
139 cleanL1cands = getattr(process,
'cleanPat' + label)
147 if(isolation
or isoDeposits):
148 process.load(
"TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAlong_cfi")
149 process.load(
"TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorOpposite_cfi")
150 process.load(
"TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAny_cfi")
151 runIsoDeps = {
'tracker':
False,
'caloTowers':
False}
153 for source,deltaR
in isolation.items():
155 if(source ==
'tracker'):
156 runIsoDeps[
'tracker'] =
True
157 l1cands.userIsolation.tracker = cms.PSet(
158 src = cms.InputTag(
'pat'+label+
'IsoDepositTracks'),
159 deltaR = cms.double(deltaR),
161 elif(source ==
'ecalTowers'):
162 runIsoDeps[
'caloTowers'] =
True
163 l1cands.userIsolation.ecal = cms.PSet(
164 src = cms.InputTag(
'pat'+label+
'IsoDepositCaloTowers',
'ecal'),
165 deltaR = cms.double(deltaR),
167 elif(source ==
'hcalTowers'):
168 runIsoDeps[
'caloTowers'] =
True
169 l1cands.userIsolation.hcal = cms.PSet(
170 src = cms.InputTag(
'pat'+label+
'IsoDepositCaloTowers',
'hcal'),
171 deltaR = cms.double(deltaR),
174 for source
in isoDeposits:
176 if(source ==
'tracker'):
177 runIsoDeps[
'tracker'] =
True
178 l1cands.isoDeposits.tracker = cms.InputTag(
'pat'+label+
'IsoDepositTracks')
179 elif(source ==
'ecalTowers'):
180 runIsoDeps[
'caloTowers'] =
True
181 l1cands.isoDeposits.ecal = cms.InputTag(
'pat'+label+
'IsoDepositCaloTowers',
'ecal')
182 elif(source ==
'hcalTowers'):
183 runIsoDeps[
'caloTowers'] =
True
184 l1cands.isoDeposits.hcal = cms.InputTag(
'pat'+label+
'IsoDepositCaloTowers',
'hcal')
186 for dep
in [ dep
for dep,runme
in runIsoDeps.items()
if runme ==
True ]:
187 if(dep ==
'tracker'):
189 setattr(process,
'pat'+label+
'IsoDepositTracks',
190 cms.EDProducer(
"CandIsoDepositProducer",
192 trackType = cms.string(
'best'),
193 MultipleDepositsFlag = cms.bool(
False),
194 ExtractorPSet = cms.PSet( MIsoTrackExtractorCtfBlock )
197 elif(dep ==
'caloTowers'):
199 setattr(process,
'pat'+label+
'IsoDepositCaloTowers',
200 cms.EDProducer(
"CandIsoDepositProducer",
202 trackType = cms.string(
'best'),
203 MultipleDepositsFlag = cms.bool(
True),
204 ExtractorPSet = cms.PSet( MIsoCaloExtractorByAssociatorTowersBlock )
208 process.load(
'TrackingTools.TrackAssociator.DetIdAssociatorESProducer_cff' )
211 if(type(mcAs) != type(
None)):
213 findMatch.append(getattr(process, mcAs+
'Match'))
216 setattr(process,
'pat'+label+
'MCMatch', findMatch[0].
clone(src = input))
217 l1cands.addGenMatch =
True
218 l1cands.genParticleMatch = cms.InputTag(
'pat'+label+
'MCMatch')
225 """ Create selected tracks and a candidate hypothesis on AOD:
227 _label=
'makeTrackCandidates'
228 _defaultParameters=dicttypes.SortedKeysDict()
231 ConfigToolBase.__init__(self)
232 self.addParameter(self.
_defaultParameters,
'label',
'TrackCands',
"output collection will be <'patAOD'+label>")
233 self.addParameter(self.
_defaultParameters,
'tracks',cms.InputTag(
'generalTracks'),
'input tracks')
234 self.addParameter(self.
_defaultParameters,
'particleType',
'pi+',
'particle type (for mass)')
235 self.addParameter(self.
_defaultParameters,
'preselection',
'pt > 10',
'preselection cut on the AOD candidates')
236 self.addParameter(self.
_defaultParameters,
'selection',
'pt > 10',
'selection cut on the PAT candidates (for the selectedLayer1Candidate collection)')
237 self.addParameter(self.
_defaultParameters,
'isolation',{
'tracker':0.3,
'ecalTowers':0.3,
'hcalTowers':0.3},
"isolation to use (as 'source': value of dR)\ntracker : as muon iso from tracks\necalTowers : as muon iso from calo tower\nhcalTowers : as muon iso from calo towers",allowedValues=[
'tracker',
'ecalTowers',
'hcalTowers'])
238 self.addParameter(self.
_defaultParameters,
'isoDeposits',[
'tracker',
'ecalTowers',
'hcalTowers'],
'iso deposits')
239 self.addParameter(self.
_defaultParameters,
'mcAs',
None,
"eplicate mc match as the one used by PAT on this AOD collection (None=no mc match); choose 'photon', 'electron', 'muon', 'tau','jet', 'met' as input string",Type=str,allowedValues=[
'photon',
'electron',
'muon',
'tau',
'jet',
'met',
None], acceptNoneValue =
True)
260 if particleType
is None:
262 if preselection
is None:
264 if selection
is None:
266 if isolation
is None:
268 if isoDeposits
is None:
272 self.setParameter(
'label',label)
273 self.setParameter(
'tracks',tracks)
274 self.setParameter(
'particleType',particleType)
275 self.setParameter(
'preselection',preselection)
276 self.setParameter(
'selection',selection)
277 self.setParameter(
'isolation',isolation)
278 self.setParameter(
'isoDeposits',isoDeposits)
279 self.setParameter(
'mcAs',mcAs,
True)
285 particleType=self.
_parameters[
'particleType'].value
286 preselection=self.
_parameters[
'preselection'].value
292 makeAODTrackCandidates(process,
294 particleType = particleType,
295 candSelection = preselection,
298 makePATTrackCandidates(process,
300 input = cms.InputTag(
'patAOD' + label),
301 isolation = isolation,
302 isoDeposits = isoDeposits,
304 selection = selection
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
if(conf.exists("allCellsPositionCalc"))