CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Attributes
objects.TauAnalyzer.TauAnalyzer Class Reference
Inheritance diagram for objects.TauAnalyzer.TauAnalyzer:

Public Member Functions

def __init__
 
def beginLoop
 
def declareHandles
 
def id3
 
def makeTaus
 
def matchTaus
 
def process
 

Static Public Attributes

float dxyMax = 0.5
 
float dzMax = 1.0
 
int etaMax = 9999
 
 foundTau = True
 tau.dxy and tau.dz are zero if abs(tau.dxy()) > self.cfg_ana.dxyMax or abs(tau.dz()) > self.cfg_ana.dzMax: continue More...
 
float leptonVetoDR = 0.4
 
int ptMin = 20
 
string tauID = "byLooseCombinedIsolationDeltaBetaCorr3Hits"
 
string tauLooseID = "decayModeFinding"
 
 vetoLeptons = True,
 
 vetoLeptonsPOG = False,
 

Detailed Description

Definition at line 21 of file TauAnalyzer.py.

Constructor & Destructor Documentation

def objects.TauAnalyzer.TauAnalyzer.__init__ (   self,
  cfg_ana,
  cfg_comp,
  looperName 
)

Definition at line 24 of file TauAnalyzer.py.

24 
25  def __init__(self, cfg_ana, cfg_comp, looperName ):
26  super(TauAnalyzer,self).__init__(cfg_ana,cfg_comp,looperName)

Member Function Documentation

def objects.TauAnalyzer.TauAnalyzer.beginLoop (   self,
  setup 
)

Definition at line 35 of file TauAnalyzer.py.

35 
36  def beginLoop(self, setup):
37  super(TauAnalyzer,self).beginLoop(setup)
38  self.counters.addCounter('events')
39  count = self.counters.counter('events')
40  count.register('all events')
41  count.register('has >=1 tau at preselection')
42  count.register('has >=1 selected taus')
43  count.register('has >=1 loose taus')
44  count.register('has >=1 inclusive taus')
def objects.TauAnalyzer.TauAnalyzer.declareHandles (   self)

Definition at line 30 of file TauAnalyzer.py.

References core.AutoHandle.AutoHandle.handles, core.Analyzer.Analyzer.handles, and HTTP.RequestManager.handles.

30 
31  def declareHandles(self):
32  super(TauAnalyzer, self).declareHandles()
33  self.handles['taus'] = AutoHandle( ('slimmedTaus',''),'std::vector<pat::Tau>')
34 
def objects.TauAnalyzer.TauAnalyzer.id3 (   tau,
  X 
)
Create an integer equal to 1-2-3 for (loose,medium,tight)

Definition at line 76 of file TauAnalyzer.py.

76 
77  def id3(tau,X):
78  """Create an integer equal to 1-2-3 for (loose,medium,tight)"""
return tau.tauID(X%"Loose") + tau.tauID(X%"Medium") + tau.tauID(X%"Tight")
def objects.TauAnalyzer.TauAnalyzer.makeTaus (   self,
  event 
)

Definition at line 48 of file TauAnalyzer.py.

References funct.abs(), deltaR(), core.AutoHandle.AutoHandle.handles, core.Analyzer.Analyzer.handles, HTTP.RequestManager.handles, and python.multivaluedict.map().

Referenced by objects.TauAnalyzer.TauAnalyzer.process().

48 
49  def makeTaus(self, event):
50  event.selectedTaus = []
51  event.looseTaus = []
52  event.inclusiveTaus = []
53 
54  #get all
55  alltaus = map( Tau, self.handles['taus'].product() )
56 
57  foundTau = False
58  for tau in alltaus:
59  tau.associatedVertex = event.goodVertices[0]
60  tau.lepVeto = False
61  if self.cfg_ana.vetoLeptons:
62  for lep in event.selectedLeptons:
63  if deltaR(lep.eta(), lep.phi(), tau.eta(), tau.phi()) < self.cfg_ana.leptonVetoDR:
64  tau.lepVeto = True
65  if tau.lepVeto: continue
66  if self.cfg_ana.vetoLeptonsPOG:
67  if not tau.tauID("againstMuonTight"):
68  tau.lepVeto = True
69  if not tau.tauID("againstElectronLoose"):
70  tau.lepVeto = True
71  if tau.lepVeto: continue
72  if tau.pt() < self.cfg_ana.ptMin: continue
if abs(tau.eta()) > self.cfg_ana.etaMax: continue
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
def objects.TauAnalyzer.TauAnalyzer.matchTaus (   self,
  event 
)

Definition at line 98 of file TauAnalyzer.py.

References deltar.matchObjectCollection3().

Referenced by objects.TauAnalyzer.TauAnalyzer.process().

98 
99  def matchTaus(self, event):
100  match = matchObjectCollection3(event.inclusiveTaus, event.gentaus, deltaRMax = 0.5)
101  for lep in event.inclusiveTaus:
102  gen = match[lep]
103  lep.mcMatchId = 1 if gen else 0
def matchObjectCollection3
Definition: deltar.py:38
def objects.TauAnalyzer.TauAnalyzer.process (   self,
  event 
)

Definition at line 104 of file TauAnalyzer.py.

References objects.TauAnalyzer.TauAnalyzer.makeTaus(), objects.TauAnalyzer.TauAnalyzer.matchTaus(), and core.Analyzer.Analyzer.readCollections().

Referenced by ConfigBuilder.ConfigBuilder.__init__(), ConfigBuilder.ConfigBuilder.addExtraStream(), ConfigBuilder.ConfigBuilder.anyOf(), ConfigBuilder.ConfigBuilder.completeInputCommand(), ConfigBuilder.ConfigBuilder.doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules.leave(), ConfigBuilder.ConfigBuilder.prepare(), ConfigBuilder.ConfigBuilder.prepare_ALCA(), ConfigBuilder.ConfigBuilder.prepare_DQM(), ConfigBuilder.ConfigBuilder.prepare_FASTSIM(), ConfigBuilder.ConfigBuilder.prepare_HARVESTING(), ConfigBuilder.ConfigBuilder.prepare_HLT(), ConfigBuilder.ConfigBuilder.prepare_LHE(), ConfigBuilder.ConfigBuilder.prepare_VALIDATION(), ConfigBuilder.ConfigBuilder.renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder.renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder.scheduleSequence().

105  def process(self, event):
106  self.readCollections( event.input )
107 
108  self.makeTaus(event)
109 
110  if not self.cfg_comp.isMC:
111  return True
112 
113  if hasattr(event, 'gentaus'):
114  self.matchTaus(event)
115 
116  return True
117 
118 
setattr(TauAnalyzer,"defaultConfig",cfg.Analyzer(

Member Data Documentation

float objects.TauAnalyzer.TauAnalyzer.dxyMax = 0.5
static

Definition at line 122 of file TauAnalyzer.py.

float objects.TauAnalyzer.TauAnalyzer.dzMax = 1.0
static

Definition at line 123 of file TauAnalyzer.py.

int objects.TauAnalyzer.TauAnalyzer.etaMax = 9999
static

Definition at line 121 of file TauAnalyzer.py.

objects.TauAnalyzer.TauAnalyzer.foundTau = True
static

tau.dxy and tau.dz are zero if abs(tau.dxy()) > self.cfg_ana.dxyMax or abs(tau.dz()) > self.cfg_ana.dzMax: continue

Definition at line 75 of file TauAnalyzer.py.

float objects.TauAnalyzer.TauAnalyzer.leptonVetoDR = 0.4
static

Definition at line 125 of file TauAnalyzer.py.

int objects.TauAnalyzer.TauAnalyzer.ptMin = 20
static

Definition at line 120 of file TauAnalyzer.py.

string objects.TauAnalyzer.TauAnalyzer.tauID = "byLooseCombinedIsolationDeltaBetaCorr3Hits"
static

Definition at line 127 of file TauAnalyzer.py.

Referenced by Tau.Tau.electronMVA3Medium().

string objects.TauAnalyzer.TauAnalyzer.tauLooseID = "decayModeFinding"
static

Definition at line 128 of file TauAnalyzer.py.

objects.TauAnalyzer.TauAnalyzer.vetoLeptons = True,
static

Definition at line 124 of file TauAnalyzer.py.

objects.TauAnalyzer.TauAnalyzer.vetoLeptonsPOG = False,
static

Definition at line 126 of file TauAnalyzer.py.