CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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__
 
def __init__
 
def getDefaultParameters
 
def toolCode
 

Private Attributes

 _comment
 
 _parameters
 

Static Private Attributes

tuple _defaultParameters = dicttypes.SortedKeysDict()
 
string _label = 'makePATTrackCandidates'
 

Detailed Description

Create pat track candidates from AOD track collections:

Definition at line 68 of file trackTools.py.

Constructor & Destructor Documentation

def trackTools.MakePATTrackCandidates.__init__ (   self)

Definition at line 75 of file trackTools.py.

References metTools.AddMETCollection._defaultParameters, editorTools.UserCodeTool._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, jetTools.AddJetCollection._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, tauTools.AddTauCollection._defaultParameters, jetTools.SwitchJetCollection._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(), PythonParameterSet.addParameter(), LutXml.addParameter(), ConfigToolBase.ConfigToolBase.addParameter(), and edm::ParameterSet.addParameter().

75 
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 = ""

Member Function Documentation

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

Definition at line 96 of file trackTools.py.

References metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, jetTools.AddJetCollection._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, tauTools.AddTauCollection._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, SignedImpactParameter3D.apply(), MatrixReader.MatrixReader.apply, SignedTransverseImpactParameter.apply(), SignedDecayLength3D.apply(), SurveyParameters.apply(), gen::PhotosInterface.apply(), FWPSetCellEditor.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), BeamSpotAlignmentParameters.apply(), RigidBodyAlignmentParameters.apply(), MatRepSparse< T, D1, D2, S, F >.apply(), ConfigToolBase.ConfigToolBase.apply(), BowedSurfaceAlignmentParameters.apply(), AlignmentParameters.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ApplyTool.apply(), TwoBowedSurfacesAlignmentParameters.apply(), reco::modules::TrackerTrackHitFilter::Rule.apply(), Vispa.Gui.BoxContentDialog.BoxContentDialog.apply(), Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog.apply(), reco::Add< T >.apply(), reco::Sub< T >.apply(), reco::Mul< T >.apply(), reco::Div< T >.apply(), cmsswVersionTools.PickRelValInputFiles.apply(), reco::And< bool >.apply(), reco::Or< bool >.apply(), reco::Less< T >.apply(), reco::LessEqual< T >.apply(), reco::More< T >.apply(), reco::MoreEqual< T >.apply(), reco::Equal< T >.apply(), ArrayND< Num2, Len2, Dim2 >.apply(), npstat::ArrayND< Num1, Len1, Dim1 >.apply(), ArrayND< Accumulator >.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.apply(), ArrayND< Numeric, Len, Dim >.apply(), npstat::ArrayND< Numeric >.apply(), ArrayND< Numeric, Len2, Dim2 >.apply(), ora::OraMainTable.setParameter(), ora::IMainTable.setParameter(), ora::PoolMainTable.setParameter(), PedeReader.setParameter(), IntegratedCalibrationBase.setParameter(), SiStripLorentzAngleCalibration.setParameter(), SiPixelLorentzAngleCalibration.setParameter(), SiStripBackplaneCalibration.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

Referenced by trackTools.MakePATTrackCandidates.getDefaultParameters().

96 
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)
def trackTools.MakePATTrackCandidates.getDefaultParameters (   self)

Definition at line 87 of file trackTools.py.

References trackTools.MakePATTrackCandidates.__call__(), metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, jetTools.AddJetCollection._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, tauTools.AddTauCollection._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, jetTools.AddJetID._defaultParameters, and jetTools.SetTagInfos._defaultParameters.

87 
88  def getDefaultParameters(self):
89  return self._defaultParameters
def trackTools.MakePATTrackCandidates.toolCode (   self,
  process 
)

Definition at line 117 of file trackTools.py.

References editorTools.UserCodeTool._parameters, heavyIonTools.ConfigureHeavyIons._parameters, coreTools.RunOnData._parameters, trackTools.MakeAODTrackCandidates._parameters, metTools.AddMETCollection._parameters, Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigFolder._parameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._parameters, heavyIonTools.ProductionDefaults._parameters, ConfigToolBase.ConfigToolBase._parameters, editorTools.ChangeSource._parameters, jetTools.AddJetCollection._parameters, TAbsFitConstraint._parameters, TAbsFitParticle._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, coreTools.RemoveMCMatching._parameters, trackTools.MakePATTrackCandidates._parameters, heavyIonTools.SelectionDefaults._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, tauTools.AddTauCollection._parameters, jetTools.SwitchJetCollection._parameters, jetTools.AddJetID._parameters, jetTools.SetTagInfos._parameters, clone(), and reco.if().

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  ## add patTracks to the process
127  from PhysicsTools.PatAlgos.producersLayer1.genericParticleProducer_cfi import patGenericParticles
128  setattr(process, 'pat' + label, patGenericParticles.clone(src = input))
129  ## add selectedPatTracks to the process
130  setattr(process, 'selectedPat' + label, cms.EDFilter("PATGenericParticleSelector",
131  src = cms.InputTag("pat"+label),
132  cut = cms.string(selection)
133  )
134  )
135  ## add cleanPatTracks to the process
136  from PhysicsTools.PatAlgos.cleaningLayer1.genericTrackCleaner_cfi import cleanPatTracks
137  setattr(process, 'cleanPat' + label, cleanPatTracks.clone(src = cms.InputTag('selectedPat' + label)))
138 
139  ## get them as variables, so we can put them in the sequences and/or configure them
140  l1cands = getattr(process, 'pat' + label)
141  selectedL1cands = getattr(process, 'selectedPat' + label)
142  cleanL1cands = getattr(process, 'cleanPat' + label)
143 
144  ## insert them in sequence, after the electrons
145  process.patCandidates.replace(process.patElectrons, l1cands + process.patElectrons)
146  process.selectedPatCandidates.replace(process.selectedPatElectrons, process.selectedPatElectrons + selectedL1cands)
147  process.cleanPatCandidates.replace(process.cleanPatElectrons, process.cleanPatElectrons + cleanL1cands)
148 
149  ## add them to the Summary Tables
150  process.patCandidateSummary.candidates += [ cms.InputTag("allPat"+label) ]
151  process.selectedPatCandidateSummary.candidates += [ cms.InputTag("selectedPat"+label) ]
152  process.cleanPatCandidateSummary.candidates += [ cms.InputTag("cleanPat"+label) ]
153 
154  ## isolation: start with empty config
155  if(isolation or isoDeposits):
156  process.load("TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAlong_cfi")
157  process.load("TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorOpposite_cfi")
158  process.load("TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAny_cfi")
159  isoModules = []
160  runIsoDeps = {'tracker':False, 'caloTowers':False}
161 
162  for source,deltaR in isolation.items():
163  ## loop items in isolation
164  if(source == 'tracker'):
165  runIsoDeps['tracker'] = True
166  l1cands.userIsolation.tracker = cms.PSet(
167  src = cms.InputTag('pat'+label+'IsoDepositTracks'),
168  deltaR = cms.double(deltaR),
169  )
170  elif(source == 'ecalTowers'):
171  runIsoDeps['caloTowers'] = True
172  l1cands.userIsolation.ecal = cms.PSet(
173  src = cms.InputTag('pat'+label+'IsoDepositCaloTowers', 'ecal'),
174  deltaR = cms.double(deltaR),
175  )
176  elif(source == 'hcalTowers'):
177  runIsoDeps['caloTowers'] = True
178  l1cands.userIsolation.hcal = cms.PSet(
179  src = cms.InputTag('pat'+label+'IsoDepositCaloTowers', 'hcal'),
180  deltaR = cms.double(deltaR),
181  )
182 
183  for source in isoDeposits:
184  ## loop items in isoDeposits
185  if(source == 'tracker'):
186  runIsoDeps['tracker'] = True
187  l1cands.isoDeposits.tracker = cms.InputTag('pat'+label+'IsoDepositTracks')
188  elif(source == 'ecalTowers'):
189  runIsoDeps['caloTowers'] = True
190  l1cands.isoDeposits.ecal = cms.InputTag('pat'+label+'IsoDepositCaloTowers', 'ecal')
191  elif(source == 'hcalTowers'):
192  runIsoDeps['caloTowers'] = True
193  l1cands.isoDeposits.hcal = cms.InputTag('pat'+label+'IsoDepositCaloTowers', 'hcal')
194 
195  for dep in [ dep for dep,runme in runIsoDeps.items() if runme == True ]:
196  if(dep == 'tracker'):
197  from RecoMuon.MuonIsolationProducers.trackExtractorBlocks_cff import MIsoTrackExtractorCtfBlock
198  setattr(process, 'pat'+label+'IsoDepositTracks',
199  cms.EDProducer("CandIsoDepositProducer",
200  src = input,
201  trackType = cms.string('best'),
202  MultipleDepositsFlag = cms.bool(False),
203  ExtractorPSet = cms.PSet( MIsoTrackExtractorCtfBlock )
204  )
205  )
206  isoModules.append( getattr(process, 'pat'+label+'IsoDepositTracks') )
207  elif(dep == 'caloTowers'):
208  from RecoMuon.MuonIsolationProducers.caloExtractorByAssociatorBlocks_cff import MIsoCaloExtractorByAssociatorTowersBlock
209  setattr(process, 'pat'+label+'IsoDepositCaloTowers',
210  cms.EDProducer("CandIsoDepositProducer",
211  src = input,
212  trackType = cms.string('best'),
213  MultipleDepositsFlag = cms.bool(True),
214  ExtractorPSet = cms.PSet( MIsoCaloExtractorByAssociatorTowersBlock )
215  )
216  )
217  isoModules.append( getattr(process, 'pat'+label+'IsoDepositCaloTowers') )
218  for m in isoModules:
219  process.patDefaultSequence.replace(l1cands, m * l1cands)
220  # ES
221  process.load( 'TrackingTools.TrackAssociator.DetIdAssociatorESProducer_cff' )
222  # MC
223  from PhysicsTools.PatAlgos.tools.helpers import MassSearchParamVisitor
224  if(type(mcAs) != type(None)):
225  findMatch= []
226  findMatch.append(getattr(process, mcAs+'Match'))
227 
228  ## clone mc matchiong module of object mcAs and add it to the path
229  setattr(process, 'pat'+label+'MCMatch', findMatch[0].clone(src = input))
230  process.patDefaultSequence.replace( l1cands, getattr(process, 'pat'+label+'MCMatch') * l1cands)
231  l1cands.addGenMatch = True
232  l1cands.genParticleMatch = cms.InputTag('pat'+label+'MCMatch')
233 
234 
235 makePATTrackCandidates=MakePATTrackCandidates()
236 
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
if(dp >Float(M_PI)) dp-

Member Data Documentation

trackTools.MakePATTrackCandidates._comment
private

Definition at line 85 of file trackTools.py.

Referenced by metUncertaintyTools.RunMEtUncertainties.__init__().

tuple trackTools.MakePATTrackCandidates._defaultParameters = dicttypes.SortedKeysDict()
staticprivate

Definition at line 73 of file trackTools.py.

Referenced by HiCoreTools.RestrictInputToAOD.__call__(), HiCoreTools.RemoveMCMatching.__call__(), trackTools.MakePATTrackCandidates.__call__(), trigTools.SwitchOnTrigger.__call__(), HiCoreTools.RemoveAllPATObjectsBut.__call__(), HiCoreTools.RemoveSpecificPATObjects.__call__(), trigTools.SwitchOnTriggerStandAlone.__call__(), trackTools.MakeTrackCandidates.__call__(), trigTools.SwitchOnTriggerMatching.__call__(), HiCoreTools.RemoveCleaning.__call__(), HiCoreTools.AddCleaning.__call__(), trigTools.SwitchOnTriggerMatchingStandAlone.__call__(), trigTools.SwitchOnTriggerMatchEmbedding.__call__(), metUncertaintyTools.RunMEtUncertainties.__call__(), HiCoreTools.RestrictInputToAOD.__init__(), metUncertaintyTools.RunMEtUncertainties.__init__(), HiCoreTools.RemoveMCMatching.__init__(), trackTools.MakePATTrackCandidates.__init__(), trigTools.SwitchOnTrigger.__init__(), HiCoreTools.RemoveAllPATObjectsBut.__init__(), HiCoreTools.RemoveSpecificPATObjects.__init__(), trigTools.SwitchOnTriggerStandAlone.__init__(), trackTools.MakeTrackCandidates.__init__(), trigTools.SwitchOnTriggerMatching.__init__(), HiCoreTools.RemoveCleaning.__init__(), HiCoreTools.AddCleaning.__init__(), trigTools.SwitchOnTriggerMatchingStandAlone.__init__(), trigTools.SwitchOnTriggerMatchEmbedding.__init__(), metUncertaintyTools.RunMEtUncertainties._initializeInputTag(), ConfigToolBase.ConfigToolBase.dumpPython(), ConfigToolBase.ConfigToolBase.getAllowedValues(), HiCoreTools.RestrictInputToAOD.getDefaultParameters(), HiCoreTools.RemoveMCMatching.getDefaultParameters(), metUncertaintyTools.RunMEtUncertainties.getDefaultParameters(), trackTools.MakePATTrackCandidates.getDefaultParameters(), trigTools.SwitchOnTrigger.getDefaultParameters(), HiCoreTools.RemoveAllPATObjectsBut.getDefaultParameters(), HiCoreTools.RemoveSpecificPATObjects.getDefaultParameters(), trigTools.SwitchOnTriggerStandAlone.getDefaultParameters(), trackTools.MakeTrackCandidates.getDefaultParameters(), trigTools.SwitchOnTriggerMatching.getDefaultParameters(), HiCoreTools.RemoveCleaning.getDefaultParameters(), HiCoreTools.AddCleaning.getDefaultParameters(), trigTools.SwitchOnTriggerMatchingStandAlone.getDefaultParameters(), trigTools.SwitchOnTriggerMatchEmbedding.getDefaultParameters(), ConfigToolBase.ConfigToolBase.reset(), and ConfigToolBase.ConfigToolBase.setParameter().

string trackTools.MakePATTrackCandidates._label = 'makePATTrackCandidates'
staticprivate

Definition at line 72 of file trackTools.py.

Referenced by trigTools.SwitchOnTrigger.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), and trigTools.SwitchOnTriggerMatchEmbedding.toolCode().

trackTools.MakePATTrackCandidates._parameters
private

Definition at line 84 of file trackTools.py.

Referenced by metUncertaintyTools.RunMEtUncertainties.__init__(), HiCoreTools.RestrictInputToAOD.toolCode(), HiCoreTools.RemoveMCMatching.toolCode(), trigTools.SwitchOnTrigger.toolCode(), trackTools.MakePATTrackCandidates.toolCode(), HiCoreTools.RemoveAllPATObjectsBut.toolCode(), HiCoreTools.RemoveSpecificPATObjects.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), trackTools.MakeTrackCandidates.toolCode(), HiCoreTools.RemoveCleaning.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), HiCoreTools.AddCleaning.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), trigTools.SwitchOnTriggerMatchEmbedding.toolCode(), and metUncertaintyTools.RunMEtUncertainties.toolCode().