7 """ Create selected tracks and a candidate hypothesis on AOD: 9 _label=
'makeAODTrackCandidates' 10 _defaultParameters=dicttypes.SortedKeysDict()
13 ConfigToolBase.__init__(self)
14 self.addParameter(self.
_defaultParameters,
'label',
'TrackCands',
"output collection will be <'patAOD'+label>")
15 self.addParameter(self.
_defaultParameters,
'tracks',cms.InputTag(
'generalTracks'),
'input tracks')
16 self.addParameter(self.
_defaultParameters,
'particleType',
'pi+',
'particle type (for mass)')
17 self.addParameter(self.
_defaultParameters,
'candSelection',
'pt > 10',
'preselection cut on the candidates')
29 candSelection =
None) :
34 if particleType
is None:
36 if candSelection
is None:
38 self.setParameter(
'label',label)
39 self.setParameter(
'tracks',tracks)
40 self.setParameter(
'particleType',particleType)
41 self.setParameter(
'candSelection',candSelection)
48 candSelection=self.
_parameters[
'candSelection'].value
50 process.load(
"SimGeneral.HepPDTESSource.pythiapdt_cfi");
54 cms.EDProducer(
"ConcreteChargedCandidateProducer",
56 particleType = cms.string(particleType)),
61 cms.EDFilter(
"CandViewSelector",
62 src = cms.InputTag(
'patAOD' + label +
'Unfiltered'),
63 cut = cms.string(candSelection)),
71 """ Create pat track candidates from AOD track collections: 73 _label=
'makePATTrackCandidates' 74 _defaultParameters=dicttypes.SortedKeysDict()
77 ConfigToolBase.__init__(self)
78 self.addParameter(self.
_defaultParameters,
'label',
'TrackCands',
"output will be 'all/selectedLayer1'+label")
79 self.addParameter(self.
_defaultParameters,
'input',cms.InputTag(
'patAODTrackCands'),
'name of the input collection')
80 self.addParameter(self.
_defaultParameters,
'selection',
'pt > 10',
'selection on PAT Layer 1 objects')
81 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'])
82 self.addParameter(self.
_defaultParameters,
'isoDeposits',[
'tracker',
'ecalTowers',
'hcalTowers'],
'iso deposits')
83 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)
102 if selection
is None:
104 if isolation
is None:
106 if isoDeposits
is None:
110 self.setParameter(
'label',label)
111 self.setParameter(
'input',input)
112 self.setParameter(
'selection',selection)
113 self.setParameter(
'isolation',isolation)
114 self.setParameter(
'isoDeposits',isoDeposits)
115 self.setParameter(
'mcAs',mcAs,
True)
127 from PhysicsTools.PatAlgos.producersLayer1.genericParticleProducer_cfi
import patGenericParticles
133 cms.EDFilter(
"PATGenericParticleSelector",
134 src = cms.InputTag(
"pat"+label),
135 cut = cms.string(selection)),
138 from PhysicsTools.PatAlgos.cleaningLayer1.genericTrackCleaner_cfi
import cleanPatTracks
140 cleanPatTracks.clone(src = cms.InputTag(
'selectedPat' + label)),
144 l1cands = getattr(process,
'pat' + label)
145 selectedL1cands = getattr(process,
'selectedPat' + label)
146 cleanL1cands = getattr(process,
'cleanPat' + label)
154 if(isolation
or isoDeposits):
155 process.load(
"TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAlong_cfi")
156 process.load(
"TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorOpposite_cfi")
157 process.load(
"TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAny_cfi")
158 runIsoDeps = {
'tracker':
False,
'caloTowers':
False}
160 for source,deltaR
in isolation.items():
162 if(source ==
'tracker'):
163 runIsoDeps[
'tracker'] =
True 164 l1cands.userIsolation.tracker = cms.PSet(
165 src = cms.InputTag(
'pat'+label+
'IsoDepositTracks'),
166 deltaR = cms.double(deltaR),
168 elif(source ==
'ecalTowers'):
169 runIsoDeps[
'caloTowers'] =
True 170 l1cands.userIsolation.ecal = cms.PSet(
171 src = cms.InputTag(
'pat'+label+
'IsoDepositCaloTowers',
'ecal'),
172 deltaR = cms.double(deltaR),
174 elif(source ==
'hcalTowers'):
175 runIsoDeps[
'caloTowers'] =
True 176 l1cands.userIsolation.hcal = cms.PSet(
177 src = cms.InputTag(
'pat'+label+
'IsoDepositCaloTowers',
'hcal'),
178 deltaR = cms.double(deltaR),
181 for source
in isoDeposits:
183 if(source ==
'tracker'):
184 runIsoDeps[
'tracker'] =
True 185 l1cands.isoDeposits.tracker = cms.InputTag(
'pat'+label+
'IsoDepositTracks')
186 elif(source ==
'ecalTowers'):
187 runIsoDeps[
'caloTowers'] =
True 188 l1cands.isoDeposits.ecal = cms.InputTag(
'pat'+label+
'IsoDepositCaloTowers',
'ecal')
189 elif(source ==
'hcalTowers'):
190 runIsoDeps[
'caloTowers'] =
True 191 l1cands.isoDeposits.hcal = cms.InputTag(
'pat'+label+
'IsoDepositCaloTowers',
'hcal')
193 for dep
in [ dep
for dep,runme
in runIsoDeps.items()
if runme ==
True ]:
194 if(dep ==
'tracker'):
197 cms.EDProducer(
"CandIsoDepositProducer",
199 trackType = cms.string(
'best'),
200 MultipleDepositsFlag = cms.bool(
False),
201 ExtractorPSet = cms.PSet( MIsoTrackExtractorCtfBlock )),
205 elif(dep ==
'caloTowers'):
208 cms.EDProducer(
"CandIsoDepositProducer",
210 trackType = cms.string(
'best'),
211 MultipleDepositsFlag = cms.bool(
True),
212 ExtractorPSet = cms.PSet( MIsoCaloExtractorByAssociatorTowersBlock )),
216 process.load(
'TrackingTools.TrackAssociator.DetIdAssociatorESProducer_cff' )
219 if(type(mcAs) != type(
None)):
221 findMatch.append(getattr(process, mcAs+
'Match'))
226 l1cands.addGenMatch =
True 227 l1cands.genParticleMatch = cms.InputTag(
'pat'+label+
'MCMatch')
234 """ Create selected tracks and a candidate hypothesis on AOD: 236 _label=
'makeTrackCandidates' 237 _defaultParameters=dicttypes.SortedKeysDict()
240 ConfigToolBase.__init__(self)
241 self.addParameter(self.
_defaultParameters,
'label',
'TrackCands',
"output collection will be <'patAOD'+label>")
242 self.addParameter(self.
_defaultParameters,
'tracks',cms.InputTag(
'generalTracks'),
'input tracks')
243 self.addParameter(self.
_defaultParameters,
'particleType',
'pi+',
'particle type (for mass)')
244 self.addParameter(self.
_defaultParameters,
'preselection',
'pt > 10',
'preselection cut on the AOD candidates')
245 self.addParameter(self.
_defaultParameters,
'selection',
'pt > 10',
'selection cut on the PAT candidates (for the selectedLayer1Candidate collection)')
246 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'])
247 self.addParameter(self.
_defaultParameters,
'isoDeposits',[
'tracker',
'ecalTowers',
'hcalTowers'],
'iso deposits')
248 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)
269 if particleType
is None:
271 if preselection
is None:
273 if selection
is None:
275 if isolation
is None:
277 if isoDeposits
is None:
281 self.setParameter(
'label',label)
282 self.setParameter(
'tracks',tracks)
283 self.setParameter(
'particleType',particleType)
284 self.setParameter(
'preselection',preselection)
285 self.setParameter(
'selection',selection)
286 self.setParameter(
'isolation',isolation)
287 self.setParameter(
'isoDeposits',isoDeposits)
288 self.setParameter(
'mcAs',mcAs,
True)
294 particleType=self.
_parameters[
'particleType'].value
295 preselection=self.
_parameters[
'preselection'].value
301 makeAODTrackCandidates(process,
303 particleType = particleType,
304 candSelection = preselection,
307 makePATTrackCandidates(process,
309 input = cms.InputTag(
'patAOD' + label),
310 isolation = isolation,
311 isoDeposits = isoDeposits,
313 selection = selection
def addToProcessAndTask(label, module, process, task)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
def getPatAlgosToolsTask(process)