CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
objects.IsoTrackAnalyzer Namespace Reference

Classes

class  IsoTrackAnalyzer
 

Functions

def makeNearestLeptons
 
def matchIsoTrack
 alltrack = map( IsoTrack, charged ) More...
 
def mtw
 
def printInfo
 
def process
 

Variables

string candidates = 'packedPFCandidates'
 
string candidatesTypes = 'std::vector<pat::PackedCandidate>'
 
 class_object = IsoTrackAnalyzer,
 event.pdgIdIsoTrack.append(event.selectedIsoTrack[0].pdgId()) event.isoIsoTrack.append(minIsoSum) event.dzIsoTrack.append(abs(dz(event.selectedIsoTrack[0]))) More...
 
 doPrune = True,
 
 doSecondVeto = False,
 unused More...
 
float dzMax = 0.1
 
float dzPartMax = 0.1
 
float isoDR = 0.3
 
tuple isoSum = self.IsoTrackIsolationComputer.chargedAbsIso(track.physObj, self.cfg_ana.isoDR, 0., self.cfg_ana.ptPartMin)
 ===> require is not the leading lepton and opposite to the leading lepton More...
 
int maxAbsIso = 8
 
float MaxIsoSum = 0.1
 
float MaxIsoSumEMU = 0.2
 unused More...
 
tuple mtwIsoTrack = mtw(track, myMet)
 
list myLeptons = [ l for l in event.selectedLeptons if l.pt() > 10 ]
 
list myMet = self.handles['met']
 store a preIso track event.preIsoTrack.append(track) More...
 
tuple nearestSelectedLeptons = makeNearestLeptons(myLeptons,track, event)
 
int ptMin = 5
 
int ptMinEMU = 5
 
int ptPartMin = 0
 
 setOff = True,
 

Function Documentation

def objects.IsoTrackAnalyzer.makeNearestLeptons (   leptons,
  track,
  event 
)

Definition at line 29 of file IsoTrackAnalyzer.py.

References deltaR().

29 
30 def makeNearestLeptons(leptons,track, event):
31 
32  minDeltaR = 99999
33 
34  nearestLepton = []
35  ibest=-1
36  for i,lepton in enumerate(leptons):
37  minDeltaRtemp=deltaR(lepton.eta(),lepton.phi(),track.eta(),track.phi())
38  if minDeltaRtemp < minDeltaR:
39  minDeltaR = minDeltaRtemp
40  ibest=i
41 
42  if len(leptons) > 0 and ibest!=-1:
43  nearestLepton.append(leptons[ibest])
44 
45  return nearestLepton
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
def objects.IsoTrackAnalyzer.matchIsoTrack (   self,
  event 
)

alltrack = map( IsoTrack, charged )

   for track in alltrack:

       foundNonIsoTrack = False

===> require Track Candidate above some pt and charged if ( (abs(track.pdgId())!=11) and (abs(track.pdgId())!=13) and (track.pt() < self.cfg_ana.ptMin) ): continue if ( track.pt() < self.cfg_ana.ptMinEMU ): continue

===> require is not the leading lepton and opposite to the leading lepton if( (self.cfg_ana.doSecondVeto) and len(event.selectedLeptons)>0) : if( deltaR(event.selectedLeptons[0].eta(), event.selectedLeptons[0].phi(), track.eta(), track.phi()) <0.01) : continue if ( (abs(track.pdgId())!=11) and (abs(track.pdgId())!=13) and (track.charge()*event.selectedLeptons[0].charge()) ): continue

===> Redundant:: require the Track Candidate with a minimum dz track.associatedVertex = event.goodVertices[0]

===> compute the isolation and find the most isolated track

       othertracks = [ p for p in charged if( deltaR(p.eta(), p.phi(), track.eta(), track.phi()) < self.cfg_ana.isoDR and p.pt()>self.cfg_ana.ptPartMin ) ]
       #othertracks = alltrack

       isoSum=0
       for part in othertracks:
           #### ===> skip pfcands with a pt min (this should be 0)
           #if part.pt()<self.cfg_ana.ptPartMin : continue
           #### ===> skip pfcands outside the cone (this should be 0.3)
           #if deltaR(part.eta(), part.phi(), track.eta(), track.phi()) > self.cfg_ana.isoDR : continue
           isoSum += part.pt()
           ### break the loop to save time
           if(isoSum > (self.cfg_ana.maxAbsIso + track.pt())):
               foundNonIsoTrack = True
               break

       if foundNonIsoTrack: continue

          ## reset
          #isoSum=0
          #for part in othertracks :
          #### ===> skip pfcands with a pt min (this should be 0)
          #    if part.pt()<self.cfg_ana.ptPartMin : continue
          #### ===> skip pfcands outside the cone (this should be 0.3)
          #    if deltaR(part.eta(), part.phi(), track.eta(), track.phi()) > self.cfg_ana.isoDR : continue
          #    isoSum += part.pt()

       #    ###            isoSum = isoSum/track.pt()  ## <--- this is for relIso

       ### ===> the sum should not contain the track candidate

       track.absIso = isoSum - track.pt()

       #### store a preIso track
       #event.preIsoTrack.append(track)

       if (isoSum < minIsoSum ) :
       if(track.absIso < min(0.2*track.pt(), self.cfg_ana.maxAbsIso)): 
           event.selectedIsoTrack.append(track)

           if self.cfg_ana.doPrune:
               myMet = self.handles['met'].product()[0]
               mtwIsoTrack = mtw(track, myMet)
               if mtwIsoTrack < 100:
                   if abs(track.pdgId()) == 11 or abs(track.pdgId()) == 13:
                       if track.pt()>5 and track.absIso/track.pt()<0.2:

                           myLeptons = [ l for l in event.selectedLeptons if l.pt() > 10 ] 
                           nearestSelectedLeptons = makeNearestLeptons(myLeptons,track, event)
                           if len(nearestSelectedLeptons) > 0:
                               for lep in nearestSelectedLeptons:
                                   if deltaR(lep.eta(), lep.phi(), track.eta(), track.phi()) > 0.1:
                                       event.selectedIsoCleanTrack.append(track)
                           else: 
                               event.selectedIsoCleanTrack.append(track) 

Definition at line 222 of file IsoTrackAnalyzer.py.

References deltar.matchObjectCollection3().

223  def matchIsoTrack(self, event):
224  matchTau = matchObjectCollection3(event.selectedIsoTrack, event.gentaus + event.gentauleps + event.genleps, deltaRMax = 0.5)
225  for lep in event.selectedIsoTrack:
226  gen = matchTau[lep]
227  lep.mcMatchId = 1 if gen else 0
def matchIsoTrack
alltrack = map( IsoTrack, charged )
def matchObjectCollection3
Definition: deltar.py:41
def objects.IsoTrackAnalyzer.mtw (   x1,
  x2 
)

Definition at line 25 of file IsoTrackAnalyzer.py.

25 
26 def mtw(x1,x2):
27  import math
28  return math.sqrt(2*x1.pt()*x2.pt()*(1-math.cos(x1.phi()-x2.phi())))
def objects.IsoTrackAnalyzer.printInfo (   self,
  event 
)

Definition at line 228 of file IsoTrackAnalyzer.py.

References eta, benchmark_cfg.pdgId, and EnergyCorrector.pt.

229  def printInfo(self, event):
230  print 'event to Veto'
231  print '----------------'
232 
233  if len(event.selectedIsoTrack)>0:
234  print 'lenght: ',len(event.selectedIsoTrack)
235  print 'track candidate pt: ',event.selectedIsoTrack[0].pt()
236  print 'track candidate eta: ',event.selectedIsoTrack[0].eta()
237  print 'track candidate phi: ',event.selectedIsoTrack[0].phi()
238  print 'track candidate mass: ',event.selectedIsoTrack[0].mass()
239  print 'pdgId candidate : ',event.selectedIsoTrack[0].pdgId()
240  print 'dz: ',event.selectedIsoTrack[0].dz()
241  print 'iso: ',event.selectedIsoTrack[0].absIso
242  print 'matchId: ',event.selectedIsoTrack[0].mcMatchId
243 
244 # for lepton in event.selectedLeptons:
245 # print 'good lepton type: ',lepton.pdgId()
246 # print 'pt: ',lepton.pt()
247 
248 # for tau in event.selectedTaus:
249 # print 'good lepton type: ',tau.pdgId()
250 # print 'pt: ',tau.pt()
251 
252  print '----------------'
253 
def objects.IsoTrackAnalyzer.process (   self,
  event 
)

Definition at line 254 of file IsoTrackAnalyzer.py.

255  def process(self, event):
256 
257  if self.cfg_ana.setOff:
258  return True
259 
260  self.readCollections( event.input )
261  self.makeIsoTrack(event)
262 
263  if len(event.selectedIsoTrack)==0 : return True

Variable Documentation

string objects.IsoTrackAnalyzer.candidates = 'packedPFCandidates'

Definition at line 296 of file IsoTrackAnalyzer.py.

Referenced by pat::CandidateSummaryTable.analyze(), HWWAnalyzer.analyze(), CalibratableTest.analyze(), FWPFCandidateWithHitsProxyBuilder.build(), DTCombinatorialPatternReco.buildBestSegment(), DTCombinatorialExtendedPatternReco.buildBestSegment(), FWPFTauProxyBuilder.buildViewType(), L1RCTElectronIsolationCard.calcElectronCandidates(), ecaldqm.createMESet(), DDIsValid(), PFTauExtractor.depositFromObject(), PythiaFilterEMJetHeep.filter(), reco::modules::JetFlavourIdentifier.findLeptons(), TauTagValidation.getSumPt(), GroupedCkfTrajectoryBuilder.groupedLimitedCandidates(), MSLayersKeeperX0AtEta.init(), CkfTrajectoryBuilder.limitedCandidates(), operator<<(), TSGFromL1Muon.produce(), L3MuonCandidateProducerFromMuons.produce(), L2MuonCandidateProducer.produce(), L3MuonCandidateProducer.produce(), pat::PATCleaner< PATObjType >.produce(), edm::GenericSelectorByValueMap< T, C >.produce(), pat::PATTriggerMatchEmbedder< PATObjectType >.produce(), ObjectViewMatcher< T1, T2 >.produce(), ObjectViewCleaner< T >.produce(), DTCombinatorialPatternReco.reconstruct(), DTCombinatorialExtendedPatternReco.reconstruct(), DTMeantimerPatternReco.reconstruct(), TrajectorySegmentBuilder.segments(), reco::isodeposit::OtherCandidatesDeltaRVeto.setEvent(), and reco::isodeposit::OtherCandVeto.setEvent().

string objects.IsoTrackAnalyzer.candidatesTypes = 'std::vector<pat::PackedCandidate>'

Definition at line 297 of file IsoTrackAnalyzer.py.

objects.IsoTrackAnalyzer.class_object = IsoTrackAnalyzer,

event.pdgIdIsoTrack.append(event.selectedIsoTrack[0].pdgId()) event.isoIsoTrack.append(minIsoSum) event.dzIsoTrack.append(abs(dz(event.selectedIsoTrack[0])))

===> do matching self.printInfo(event) ===> do veto if needed self.printInfo(event) return False self.printInfo(event) return False

Definition at line 293 of file IsoTrackAnalyzer.py.

objects.IsoTrackAnalyzer.doPrune = True,

Definition at line 311 of file IsoTrackAnalyzer.py.

objects.IsoTrackAnalyzer.doSecondVeto = False,

unused

Definition at line 309 of file IsoTrackAnalyzer.py.

float objects.IsoTrackAnalyzer.dzMax = 0.1

Definition at line 300 of file IsoTrackAnalyzer.py.

Referenced by BeamMonitor.beginJob(), PhotonIDValueMapProducer.computeWorstPFChargedIsolation(), and PhotonIDValueMapProducer.produce().

float objects.IsoTrackAnalyzer.dzPartMax = 0.1

Definition at line 304 of file IsoTrackAnalyzer.py.

float objects.IsoTrackAnalyzer.isoDR = 0.3

Definition at line 302 of file IsoTrackAnalyzer.py.

tuple objects.IsoTrackAnalyzer.isoSum = self.IsoTrackIsolationComputer.chargedAbsIso(track.physObj, self.cfg_ana.isoDR, 0., self.cfg_ana.ptPartMin)

===> require is not the leading lepton and opposite to the leading lepton

===> Redundant:: require the Track Candidate with a minimum dz ===> compute the isolation and find the most isolated track

Definition at line 106 of file IsoTrackAnalyzer.py.

Referenced by pf2pat::IsolatedPFCandidateSelectorDefinition.select().

int objects.IsoTrackAnalyzer.maxAbsIso = 8

Definition at line 305 of file IsoTrackAnalyzer.py.

float objects.IsoTrackAnalyzer.MaxIsoSum = 0.1

Definition at line 307 of file IsoTrackAnalyzer.py.

float objects.IsoTrackAnalyzer.MaxIsoSumEMU = 0.2

unused

Definition at line 308 of file IsoTrackAnalyzer.py.

tuple objects.IsoTrackAnalyzer.mtwIsoTrack = mtw(track, myMet)

Definition at line 123 of file IsoTrackAnalyzer.py.

list objects.IsoTrackAnalyzer.myLeptons = [ l for l in event.selectedLeptons if l.pt() > 10 ]

Definition at line 128 of file IsoTrackAnalyzer.py.

list objects.IsoTrackAnalyzer.myMet = self.handles['met']

store a preIso track event.preIsoTrack.append(track)

Definition at line 122 of file IsoTrackAnalyzer.py.

Referenced by ZeePlots.analyze(), and WenuPlots.analyze().

tuple objects.IsoTrackAnalyzer.nearestSelectedLeptons = makeNearestLeptons(myLeptons,track, event)

Definition at line 129 of file IsoTrackAnalyzer.py.

int objects.IsoTrackAnalyzer.ptMin = 5

Definition at line 298 of file IsoTrackAnalyzer.py.

int objects.IsoTrackAnalyzer.ptMinEMU = 5

Definition at line 299 of file IsoTrackAnalyzer.py.

int objects.IsoTrackAnalyzer.ptPartMin = 0

Definition at line 303 of file IsoTrackAnalyzer.py.

objects.IsoTrackAnalyzer.setOff = True,

Definition at line 294 of file IsoTrackAnalyzer.py.