CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Static Private Attributes
trackTools.MakePATTrackCandidates Class Reference
Inheritance diagram for trackTools.MakePATTrackCandidates:

Public Member Functions

def __call__ (self, process, label=None, input=None, selection=None, isolation=None, isoDeposits=None, mcAs=None)
 
def __init__ (self)
 
def getDefaultParameters (self)
 
def toolCode (self, process)
 

Private Attributes

 _comment
 
 _parameters
 

Static Private Attributes

 _defaultParameters
 
 _label
 

Detailed Description

Create pat track candidates from AOD track collections:

Definition at line 69 of file trackTools.py.

Constructor & Destructor Documentation

◆ __init__()

def trackTools.MakePATTrackCandidates.__init__ (   self)

Definition at line 76 of file trackTools.py.

76  def __init__(self):
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)
84 
85  self._parameters=copy.deepcopy(self._defaultParameters)
86  self._comment = ""
87 

References heavyIonTools.ConfigureHeavyIons._defaultParameters, metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, coreTools.RunOnData._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, tauTools.AddTauCollection._defaultParameters, jetTools.AddJetCollection._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, jetTools.UpdateJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, root::helper::RootFunctionAdapter< F, args >.addParameter(), root::helper::RootFunctionHelper< F, args, Tag >.addParameter(), ParameterMgr.addParameter(), fit::RootMinuit< Function >.addParameter(), DropBoxMetadata::Parameters.addParameter(), Python11ParameterSet.addParameter(), cmspython3::Python11ParameterSet.addParameter(), l1t::TriggerSystem.addParameter(), LutXml.addParameter(), ConfigToolBase.ConfigToolBase.addParameter(), and edm::ParameterSet.addParameter().

Member Function Documentation

◆ __call__()

def trackTools.MakePATTrackCandidates.__call__ (   self,
  process,
  label = None,
  input = None,
  selection = None,
  isolation = None,
  isoDeposits = None,
  mcAs = None 
)

Definition at line 91 of file trackTools.py.

91  def __call__(self,process,
92  label = None,
93  input = None,
94  selection = None,
95  isolation = None,
96  isoDeposits = None,
97  mcAs = None) :
98  if label is None:
99  label=self._defaultParameters['label'].value
100  if input is None:
101  input=self._defaultParameters['input'].value
102  if selection is None:
103  selection=self._defaultParameters['selection'].value
104  if isolation is None:
105  isolation=self._defaultParameters['isolation'].value
106  if isoDeposits is None:
107  isoDeposits=self._defaultParameters['isoDeposits'].value
108  if mcAs is None:
109  mcAs=self._defaultParameters['mcAs'].value
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)
116  self.apply(process)
117 

References heavyIonTools.ConfigureHeavyIons._defaultParameters, metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, coreTools.RunOnData._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, tauTools.AddTauCollection._defaultParameters, jetTools.AddJetCollection._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, jetTools.UpdateJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, SignedImpactParameter3D.apply(), SignedDecayLength3D.apply(), SignedTransverseImpactParameter.apply(), gen::PhotosInterfaceBase.apply(), SurveyParameters.apply(), DummyOOTPileupCorrection.apply(), MatrixReader.MatrixReader.apply, gen::PhotosppInterface.apply(), gen::PhotosInterface.apply(), FWPSetCellEditor.apply(), BeamSpotAlignmentParameters.apply(), RigidBodyAlignmentParameters.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), AlignmentParameters.apply(), ConfigToolBase.ConfigToolBase.apply(), BowedSurfaceAlignmentParameters.apply(), OOTPileupCorrData.apply(), AbsOOTPileupCorrection.apply(), TwoBowedSurfacesAlignmentParameters.apply(), reco::modules::TrackerTrackHitFilter::Rule.apply(), cmsswVersionTools.PickRelValInputFiles.apply(), models.RegExp.apply(), npstat::ArrayND< Num1, Len1, Dim1 >.apply(), ArrayND< Num2, Len2, Dim2 >.apply(), ArrayND< Numeric, Len2, Dim2 >.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.apply(), npstat::ArrayND< Numeric >.apply(), ArrayND< Numeric, Len, Dim >.apply(), ArrayND< Accumulator >.apply(), Config.ProcessModifier.apply(), PedeReader.setParameter(), QIE8Simulator.setParameter(), AbsElectronicODERHS.setParameter(), SiStripLorentzAngleCalibration.setParameter(), IntegratedCalibrationBase.setParameter(), SiPixelLorentzAngleCalibration.setParameter(), SiStripBackplaneCalibration.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

◆ getDefaultParameters()

def trackTools.MakePATTrackCandidates.getDefaultParameters (   self)

◆ toolCode()

def trackTools.MakePATTrackCandidates.toolCode (   self,
  process 
)

Definition at line 118 of file trackTools.py.

118  def toolCode(self, process):
119  label=self._parameters['label'].value
120  input=self._parameters['input'].value
121  selection=self._parameters['selection'].value
122  isolation=self._parameters['isolation'].value
123  isoDeposits=self._parameters['isoDeposits'].value
124  mcAs=self._parameters['mcAs'].value
125 
126 
127  from PhysicsTools.PatAlgos.producersLayer1.genericParticleProducer_cfi import patGenericParticles
128  task = getPatAlgosToolsTask(process)
129  addToProcessAndTask('pat' + label, patGenericParticles.clone(src = input), process, task)
130 
131 
132  addToProcessAndTask('selectedPat' + label,
133  cms.EDFilter("PATGenericParticleSelector",
134  src = cms.InputTag("pat"+label),
135  cut = cms.string(selection)),
136  process, task)
137 
138  from PhysicsTools.PatAlgos.cleaningLayer1.genericTrackCleaner_cfi import cleanPatTracks
139  addToProcessAndTask('cleanPat' + label,
140  cleanPatTracks.clone(src = cms.InputTag('selectedPat' + label)),
141  process, task)
142 
143 
144  l1cands = getattr(process, 'pat' + label)
145  selectedL1cands = getattr(process, 'selectedPat' + label)
146  cleanL1cands = getattr(process, 'cleanPat' + label)
147 
148 
152 
153 
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}
159 
160  for source,deltaR in isolation.items():
161 
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),
167  )
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),
173  )
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),
179  )
180 
181  for source in isoDeposits:
182 
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')
192 
193  for dep in [ dep for dep,runme in runIsoDeps.items() if runme == True ]:
194  if(dep == 'tracker'):
195  from RecoMuon.MuonIsolationProducers.trackExtractorBlocks_cff import MIsoTrackExtractorCtfBlock
196  addToProcessAndTask('pat'+label+'IsoDepositTracks',
197  cms.EDProducer("CandIsoDepositProducer",
198  src = input,
199  trackType = cms.string('best'),
200  MultipleDepositsFlag = cms.bool(False),
201  ExtractorPSet = cms.PSet( MIsoTrackExtractorCtfBlock )),
202  process, task)
203 
204 
205  elif(dep == 'caloTowers'):
206  from RecoMuon.MuonIsolationProducers.caloExtractorByAssociatorBlocks_cff import MIsoCaloExtractorByAssociatorTowersBlock
207  addToProcessAndTask('pat'+label+'IsoDepositCaloTowers',
208  cms.EDProducer("CandIsoDepositProducer",
209  src = input,
210  trackType = cms.string('best'),
211  MultipleDepositsFlag = cms.bool(True),
212  ExtractorPSet = cms.PSet( MIsoCaloExtractorByAssociatorTowersBlock )),
213  process, task)
214 
215  # ES
216  process.load( 'TrackingTools.TrackAssociator.DetIdAssociatorESProducer_cff' )
217  # MC
218  from PhysicsTools.PatAlgos.tools.helpers import MassSearchParamVisitor
219  if(not isinstance(mcAs, type(None))):
220  findMatch= []
221  findMatch.append(getattr(process, mcAs+'Match'))
222 
223 
224  addToProcessAndTask('pat'+label+'MCMatch', findMatch[0].clone(src = input), process, task)
225 
226  l1cands.addGenMatch = True
227  l1cands.genParticleMatch = cms.InputTag('pat'+label+'MCMatch')
228 
229 
230 makePATTrackCandidates=MakePATTrackCandidates()
231 
232 

References heavyIonTools.ConfigureHeavyIons._parameters, trackTools.MakeAODTrackCandidates._parameters, coreTools.RunOnData._parameters, metTools.AddMETCollection._parameters, heavyIonTools.ProductionDefaults._parameters, ConfigToolBase.ConfigToolBase._parameters, TAbsFitConstraint._parameters, TAbsFitParticle._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, coreTools.RemoveMCMatching._parameters, trackTools.MakePATTrackCandidates._parameters, heavyIonTools.SelectionDefaults._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, tauTools.AddTauCollection._parameters, jetTools.AddJetCollection._parameters, jetTools.SwitchJetCollection._parameters, jetTools.UpdateJetCollection._parameters, jetTools.AddJetID._parameters, jetTools.SetTagInfos._parameters, helpers.addToProcessAndTask(), clone(), and helpers.getPatAlgosToolsTask().

Member Data Documentation

◆ _comment

trackTools.MakePATTrackCandidates._comment
private

Definition at line 86 of file trackTools.py.

◆ _defaultParameters

trackTools.MakePATTrackCandidates._defaultParameters
staticprivate

Definition at line 74 of file trackTools.py.

Referenced by runJetUncertainties.RunJetUncertainties.__call__(), trackTools.MakePATTrackCandidates.__call__(), trigTools.SwitchOnTrigger.__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__call__(), trigTools.SwitchOnTriggerStandAlone.__call__(), trackTools.MakeTrackCandidates.__call__(), trigTools.SwitchOnTriggerMatching.__call__(), trigTools.SwitchOnTriggerMatchingStandAlone.__call__(), trigTools.SwitchOnTriggerMatchEmbedding.__call__(), runJetUncertainties.RunJetUncertainties.__init__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__init__(), trackTools.MakePATTrackCandidates.__init__(), trigTools.SwitchOnTrigger.__init__(), trigTools.SwitchOnTriggerStandAlone.__init__(), trackTools.MakeTrackCandidates.__init__(), trigTools.SwitchOnTriggerMatching.__init__(), trigTools.SwitchOnTriggerMatchingStandAlone.__init__(), trigTools.SwitchOnTriggerMatchEmbedding.__init__(), ConfigToolBase.ConfigToolBase.dumpPython(), ConfigToolBase.ConfigToolBase.getAllowedValues(), trackTools.MakePATTrackCandidates.getDefaultParameters(), trigTools.SwitchOnTrigger.getDefaultParameters(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getDefaultParameters(), trigTools.SwitchOnTriggerStandAlone.getDefaultParameters(), trackTools.MakeTrackCandidates.getDefaultParameters(), trigTools.SwitchOnTriggerMatching.getDefaultParameters(), trigTools.SwitchOnTriggerMatchingStandAlone.getDefaultParameters(), trigTools.SwitchOnTriggerMatchEmbedding.getDefaultParameters(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.initializeInputTag(), ConfigToolBase.ConfigToolBase.reset(), and ConfigToolBase.ConfigToolBase.setParameter().

◆ _label

trackTools.MakePATTrackCandidates._label
staticprivate

◆ _parameters

trackTools.MakePATTrackCandidates._parameters
private

Definition at line 85 of file trackTools.py.

Referenced by runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.ak4JetReclustering(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.createMVAMETModule(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.createSmearedJetModule(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.extractMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getCorrectedMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getMETUncertainties(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getUnclusteredVariationsForMVAMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getVariations(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.jetCleaning(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.jetConfiguration(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.miniAODConfiguration(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.miniAODConfigurationPost(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.recomputeRawMetFromPfcs(), runJetUncertainties.RunJetUncertainties.toolCode(), trigTools.SwitchOnTrigger.toolCode(), trackTools.MakePATTrackCandidates.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.toolCode(), trackTools.MakeTrackCandidates.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), trigTools.SwitchOnTriggerMatchEmbedding.toolCode(), and runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.updateJECs().

helpers.getPatAlgosToolsTask
def getPatAlgosToolsTask(process)
Definition: helpers.py:14
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
helpers
caloExtractorByAssociatorBlocks_cff
trackExtractorBlocks_cff
helpers.addToProcessAndTask
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:29