CMS 3D CMS Logo

Classes | Functions | Variables
objects.IsoTrackAnalyzer Namespace Reference

Classes

class  IsoTrackAnalyzer
 

Functions

def attachIsoAnnulus04 (self, mu)
 
def makeNearestLeptons (leptons, track, event)
 
def matchIsoTrack (self, event)
 
def mtw (x1, x2)
 
def printInfo (self, event)
 
def process (self, event)
 

Variables

 absIso
 
 associatedVertex
 ===> require is not the leading lepton and opposite to the leading lepton More...
 
 candidates
 
 candidatesTypes
 
 class_object
 event.pdgIdIsoTrack.append(event.selectedIsoTrack[0].pdgId()) event.isoIsoTrack.append(minIsoSum) event.dzIsoTrack.append(abs(dz(event.selectedIsoTrack[0]))) More...
 
 do_mc_match
 
 doIsoAnnulus
 
 doPrune
 
 doRelIsolation
 
 doSecondVeto
 unused More...
 
 dzMax
 
 dzPartMax
 
 isoDR
 
 isoSum
 ===> compute the isolation and find the most isolated track More...
 
 key
 alltrack = map( IsoTrack, charged ) More...
 
 maxAbsIso
 
 MaxIsoSum
 
 MaxIsoSumEMU
 unused More...
 
 mtwIsoTrack
 
 myLeptons
 
 myMet
 store a preIso track event.preIsoTrack.append(track) More...
 
 nearestSelectedLeptons
 
 ptMin
 
 ptMinEMU
 
 ptPartMin
 
 relIso
 
 reverse
 
 setOff
 

Function Documentation

◆ attachIsoAnnulus04()

def objects.IsoTrackAnalyzer.attachIsoAnnulus04 (   self,
  mu 
)

Definition at line 234 of file IsoTrackAnalyzer.py.

234  def attachIsoAnnulus04(self, mu):
235  mu.absIsoAnCharged = self.IsoTrackIsolationComputer.chargedAbsIso (mu.physObj, 0.4, self.cfg_ana.isoDR, 0.0,self.IsoTrackIsolationComputer.selfVetoNone)
236  mu.absIsoAnPho = self.IsoTrackIsolationComputer.photonAbsIsoRaw (mu.physObj, 0.4, self.cfg_ana.isoDR, 0.0,self.IsoTrackIsolationComputer.selfVetoNone)
237  mu.absIsoAnNHad = self.IsoTrackIsolationComputer.neutralHadAbsIsoRaw(mu.physObj, 0.4, self.cfg_ana.isoDR, 0.0,self.IsoTrackIsolationComputer.selfVetoNone)
238  mu.absIsoAnPU = self.IsoTrackIsolationComputer.puAbsIso (mu.physObj, 0.4, self.cfg_ana.isoDR, 0.0,self.IsoTrackIsolationComputer.selfVetoNone)
239  mu.absIsoAnNeutral = max(0.0, mu.absIsoAnPho + mu.absIsoAnNHad - 0.5*mu.absIsoAnPU)
240 
241  mu.absIsoAn04 = mu.absIsoAnCharged + mu.absIsoAnNeutral
242  mu.relIsoAn04 = mu.absIsoAn04/mu.pt()
243 
244 

References SiStripPI.max.

◆ makeNearestLeptons()

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

Definition at line 30 of file IsoTrackAnalyzer.py.

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
46 

References PbPb_ZMuSkimMuonDPG_cff.deltaR.

◆ matchIsoTrack()

def objects.IsoTrackAnalyzer.matchIsoTrack (   self,
  event 
)

Definition at line 245 of file IsoTrackAnalyzer.py.

245  def matchIsoTrack(self, event):
246  matchTau = matchObjectCollection3(event.selectedIsoTrack, event.gentaus + event.gentauleps + event.genleps, deltaRMax = 0.5)
247  for lep in event.selectedIsoTrack:
248  gen = matchTau[lep]
249  lep.mcMatchId = 1 if gen else 0
250 
251 

References deltar.matchObjectCollection3().

◆ mtw()

def objects.IsoTrackAnalyzer.mtw (   x1,
  x2 
)

Definition at line 26 of file IsoTrackAnalyzer.py.

26 def mtw(x1,x2):
27  import math
28  return math.sqrt(2*x1.pt()*x2.pt()*(1-math.cos(x1.phi()-x2.phi())))
29 

◆ printInfo()

def objects.IsoTrackAnalyzer.printInfo (   self,
  event 
)

Definition at line 252 of file IsoTrackAnalyzer.py.

252  def printInfo(self, event):
253  print('event to Veto')
254  print('----------------')
255 
256  if len(event.selectedIsoTrack)>0:
257  print('lenght: ',len(event.selectedIsoTrack))
258  print('track candidate pt: ',event.selectedIsoTrack[0].pt())
259  print('track candidate eta: ',event.selectedIsoTrack[0].eta())
260  print('track candidate phi: ',event.selectedIsoTrack[0].phi())
261  print('track candidate mass: ',event.selectedIsoTrack[0].mass())
262  print('pdgId candidate : ',event.selectedIsoTrack[0].pdgId())
263  print('dz: ',event.selectedIsoTrack[0].dz())
264  print('iso: ',event.selectedIsoTrack[0].absIso)
265  print('matchId: ',event.selectedIsoTrack[0].mcMatchId)
266 
267 # for lepton in event.selectedLeptons:
268 # print 'good lepton type: ',lepton.pdgId()
269 # print 'pt: ',lepton.pt()
270 
271 # for tau in event.selectedTaus:
272 # print 'good lepton type: ',tau.pdgId()
273 # print 'pt: ',tau.pt()
274 
275  print('----------------')
276 
277 

References PVValHelper.dz, PVValHelper.eta, EgHLTOffHistBins_cfi.mass, EgammaValidation_cff.pdgId, print(), and DiDispStaMuonMonitor_cfi.pt.

◆ process()

def objects.IsoTrackAnalyzer.process (   self,
  event 
)

Definition at line 278 of file IsoTrackAnalyzer.py.

278  def process(self, event):
279 
280  if self.cfg_ana.setOff:
281  return True
282 
283  self.readCollections( event.input )
284  self.makeIsoTrack(event)
285 
286  if len(event.selectedIsoTrack)==0 : return True
287 

Variable Documentation

◆ absIso

objects.IsoTrackAnalyzer.absIso

Definition at line 123 of file IsoTrackAnalyzer.py.

◆ associatedVertex

objects.IsoTrackAnalyzer.associatedVertex

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

===> Redundant:: require the Track Candidate with a minimum dz

Definition at line 106 of file IsoTrackAnalyzer.py.

◆ candidates

objects.IsoTrackAnalyzer.candidates

Definition at line 320 of file IsoTrackAnalyzer.py.

◆ candidatesTypes

objects.IsoTrackAnalyzer.candidatesTypes

Definition at line 321 of file IsoTrackAnalyzer.py.

◆ class_object

objects.IsoTrackAnalyzer.class_object

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 317 of file IsoTrackAnalyzer.py.

◆ do_mc_match

objects.IsoTrackAnalyzer.do_mc_match

Definition at line 339 of file IsoTrackAnalyzer.py.

◆ doIsoAnnulus

objects.IsoTrackAnalyzer.doIsoAnnulus

Definition at line 336 of file IsoTrackAnalyzer.py.

◆ doPrune

objects.IsoTrackAnalyzer.doPrune

Definition at line 338 of file IsoTrackAnalyzer.py.

◆ doRelIsolation

objects.IsoTrackAnalyzer.doRelIsolation

Definition at line 331 of file IsoTrackAnalyzer.py.

◆ doSecondVeto

objects.IsoTrackAnalyzer.doSecondVeto

unused

Definition at line 334 of file IsoTrackAnalyzer.py.

◆ dzMax

objects.IsoTrackAnalyzer.dzMax

Definition at line 324 of file IsoTrackAnalyzer.py.

◆ dzPartMax

objects.IsoTrackAnalyzer.dzPartMax

Definition at line 328 of file IsoTrackAnalyzer.py.

◆ isoDR

objects.IsoTrackAnalyzer.isoDR

Definition at line 326 of file IsoTrackAnalyzer.py.

◆ isoSum

objects.IsoTrackAnalyzer.isoSum

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

Definition at line 110 of file IsoTrackAnalyzer.py.

Referenced by l1t::GenToInputProducer.produce(), pf2pat::IsolatedPFCandidateSelectorDefinition.select(), and l1t::Muon.setHwIsoSum().

◆ key

objects.IsoTrackAnalyzer.key

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 226 of file IsoTrackAnalyzer.py.

◆ maxAbsIso

objects.IsoTrackAnalyzer.maxAbsIso

Definition at line 329 of file IsoTrackAnalyzer.py.

◆ MaxIsoSum

objects.IsoTrackAnalyzer.MaxIsoSum

Definition at line 332 of file IsoTrackAnalyzer.py.

◆ MaxIsoSumEMU

objects.IsoTrackAnalyzer.MaxIsoSumEMU

unused

Definition at line 333 of file IsoTrackAnalyzer.py.

◆ mtwIsoTrack

objects.IsoTrackAnalyzer.mtwIsoTrack

Definition at line 134 of file IsoTrackAnalyzer.py.

◆ myLeptons

objects.IsoTrackAnalyzer.myLeptons

Definition at line 139 of file IsoTrackAnalyzer.py.

◆ myMet

objects.IsoTrackAnalyzer.myMet

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

Definition at line 133 of file IsoTrackAnalyzer.py.

◆ nearestSelectedLeptons

objects.IsoTrackAnalyzer.nearestSelectedLeptons

Definition at line 140 of file IsoTrackAnalyzer.py.

◆ ptMin

objects.IsoTrackAnalyzer.ptMin

Definition at line 322 of file IsoTrackAnalyzer.py.

◆ ptMinEMU

objects.IsoTrackAnalyzer.ptMinEMU

Definition at line 323 of file IsoTrackAnalyzer.py.

◆ ptPartMin

objects.IsoTrackAnalyzer.ptPartMin

Definition at line 327 of file IsoTrackAnalyzer.py.

◆ relIso

objects.IsoTrackAnalyzer.relIso

Definition at line 114 of file IsoTrackAnalyzer.py.

◆ reverse

objects.IsoTrackAnalyzer.reverse

Definition at line 226 of file IsoTrackAnalyzer.py.

◆ setOff

objects.IsoTrackAnalyzer.setOff

Definition at line 318 of file IsoTrackAnalyzer.py.

deltar.matchObjectCollection3
def matchObjectCollection3(objects, matchCollection, deltaRMax=0.3, filter=lambda x, True y)
Definition: deltar.py:41
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
objects.IsoTrackAnalyzer.process
def process(self, event)
Definition: IsoTrackAnalyzer.py:278
PVValHelper::eta
Definition: PVValidationHelpers.h:70
objects.IsoTrackAnalyzer.makeNearestLeptons
def makeNearestLeptons(leptons, track, event)
Definition: IsoTrackAnalyzer.py:30
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
objects.IsoTrackAnalyzer.attachIsoAnnulus04
def attachIsoAnnulus04(self, mu)
Definition: IsoTrackAnalyzer.py:234
EgammaValidation_cff.pdgId
pdgId
Definition: EgammaValidation_cff.py:117
objects.IsoTrackAnalyzer.printInfo
def printInfo(self, event)
Definition: IsoTrackAnalyzer.py:252
objects.IsoTrackAnalyzer.matchIsoTrack
def matchIsoTrack(self, event)
Definition: IsoTrackAnalyzer.py:245
PVValHelper::dz
Definition: PVValidationHelpers.h:51
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
objects.IsoTrackAnalyzer.mtw
def mtw(x1, x2)
Definition: IsoTrackAnalyzer.py:26