CMS 3D CMS Logo

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

Public Member Functions

def __init__ (self, cfg_ana, cfg_comp, looperName)
 
def beginLoop (self, setup)
 
def computeMT2 (self, visaVec, visbVec, metVec)
 
def declareHandles (self)
 
def getMT2AKT (self, event, TMPobjects40jc, met, collectionPostFix, postFix)
 
def getMT2Hemi (self, event, TMPobjects40jc, met, collectionPostFix, postFix)
 
def makeMT2 (self, event)
 

Public Attributes

 jetPt
 
 met
 

Static Public Attributes

 groupingViaAKt
 
 groupingViaKt
 
 hemisphereViaAKt
 
 hemisphereViaKt
 
 mt2ViaKt_had
 get hemispheres via AntiKT -1 antikt, 1 kt, 0 CA More...
 
 mt2ViaKt_Xj_had
 
 objects
 get hemispheres via AntiKT -1 antikt, 1 kt, 0 CA More...
 

Detailed Description

Definition at line 32 of file MT2Analyzer.py.

Constructor & Destructor Documentation

def MT2Analyzer.MT2Analyzer.__init__ (   self,
  cfg_ana,
  cfg_comp,
  looperName 
)

Definition at line 33 of file MT2Analyzer.py.

33  def __init__(self, cfg_ana, cfg_comp, looperName ):
34  super(MT2Analyzer,self).__init__(cfg_ana,cfg_comp,looperName)
35  self.jetPt = cfg_ana.jetPt
36 
def __init__(self, cfg_ana, cfg_comp, looperName)
Definition: MT2Analyzer.py:33

Member Function Documentation

def MT2Analyzer.MT2Analyzer.beginLoop (   self,
  setup 
)

Definition at line 43 of file MT2Analyzer.py.

43  def beginLoop(self, setup):
44  super(MT2Analyzer,self).beginLoop(setup)
45  self.counters.addCounter('pairs')
46  count = self.counters.counter('pairs')
47  count.register('all events')
48 
def beginLoop(self, setup)
Definition: MT2Analyzer.py:43
def MT2Analyzer.MT2Analyzer.computeMT2 (   self,
  visaVec,
  visbVec,
  metVec 
)

Definition at line 49 of file MT2Analyzer.py.

Referenced by MT2Analyzer.MT2Analyzer.getMT2Hemi().

49  def computeMT2(self, visaVec, visbVec, metVec):
50 
51  import array
52  import numpy
53 
54  metVector = array.array('d',[0.,metVec.px(), metVec.py()])
55  visaVector = array.array('d',[0.,visaVec.px(), visaVec.py()])
56  visbVector = array.array('d',[0.,visbVec.px(), visbVec.py()])
57 
58  davismt2.set_momenta(visaVector,visbVector,metVector);
59  davismt2.set_mn(0);
60 
61  return davismt2.get_mt2()
62 
def computeMT2(self, visaVec, visbVec, metVec)
Definition: MT2Analyzer.py:49
def MT2Analyzer.MT2Analyzer.declareHandles (   self)

Definition at line 37 of file MT2Analyzer.py.

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

37  def declareHandles(self):
38  super(MT2Analyzer, self).declareHandles()
39  #genJets
40  self.handles['genJets'] = AutoHandle( 'slimmedGenJets','std::vector<reco::GenJet>')
41  self.handles['met'] = AutoHandle( self.cfg_ana.metCollection, 'std::vector<pat::MET>' )
42 
def MT2Analyzer.MT2Analyzer.getMT2AKT (   self,
  event,
  TMPobjects40jc,
  met,
  collectionPostFix,
  postFix 
)

Definition at line 63 of file MT2Analyzer.py.

63  def getMT2AKT(self, event, TMPobjects40jc, met , collectionPostFix, postFix):
64 
def getMT2AKT(self, event, TMPobjects40jc, met, collectionPostFix, postFix)
Definition: MT2Analyzer.py:63
def MT2Analyzer.MT2Analyzer.getMT2Hemi (   self,
  event,
  TMPobjects40jc,
  met,
  collectionPostFix,
  postFix 
)

Definition at line 91 of file MT2Analyzer.py.

References MT2Analyzer.MT2Analyzer.computeMT2().

91  def getMT2Hemi(self, event, TMPobjects40jc, met, collectionPostFix, postFix):
92 
93  if len(TMPobjects40jc)>=2:
94 
95  pxvec = ROOT.std.vector(float)()
96  pyvec = ROOT.std.vector(float)()
97  pzvec = ROOT.std.vector(float)()
98  Evec = ROOT.std.vector(float)()
99  grouping = ROOT.std.vector(int)()
100 
101  for jet in TMPobjects40jc:
102  pxvec.push_back(jet.px())
103  pyvec.push_back(jet.py())
104  pzvec.push_back(jet.pz())
105  Evec.push_back(jet.energy())
106 
107  hemisphere = Hemisphere(pxvec, pyvec, pzvec, Evec, 2, 3)
108  grouping=hemisphere.getGrouping()
109 
110  pseudoJet1px = 0
111  pseudoJet1py = 0
112  pseudoJet1pz = 0
113  pseudoJet1energy = 0
114  multPSJ1 = 0
115 
116  pseudoJet2px = 0
117  pseudoJet2py = 0
118  pseudoJet2pz = 0
119  pseudoJet2energy = 0
120  multPSJ2 = 0
121 
122  for index in range(0, len(pxvec)):
123  if(grouping[index]==1):
124  pseudoJet1px += pxvec[index]
125  pseudoJet1py += pyvec[index]
126  pseudoJet1pz += pzvec[index]
127  pseudoJet1energy += Evec[index]
128  multPSJ1 += 1
129  if(grouping[index]==2):
130  pseudoJet2px += pxvec[index]
131  pseudoJet2py += pyvec[index]
132  pseudoJet2pz += pzvec[index]
133  pseudoJet2energy += Evec[index]
134  multPSJ2 += 1
135 
136  pseudoJet1pt2 = pseudoJet1px*pseudoJet1px + pseudoJet1py*pseudoJet1py
137  pseudoJet2pt2 = pseudoJet2px*pseudoJet2px + pseudoJet2py*pseudoJet2py
138 
139  if pseudoJet1pt2 >= pseudoJet2pt2:
140  setattr(event, "pseudoJet1"+collectionPostFix+postFix, ROOT.reco.Particle.LorentzVector( pseudoJet1px, pseudoJet1py, pseudoJet1pz, pseudoJet1energy ))
141  setattr(event, "pseudoJet2"+collectionPostFix+postFix, ROOT.reco.Particle.LorentzVector( pseudoJet2px, pseudoJet2py, pseudoJet2pz, pseudoJet2energy ))
142  setattr(event, "multPseudoJet1"+collectionPostFix+postFix, multPSJ1 )
143  setattr(event, "multPseudoJet2"+collectionPostFix+postFix, multPSJ2 )
144  else:
145  setattr(event, "pseudoJet2"+collectionPostFix+postFix, ROOT.reco.Particle.LorentzVector( pseudoJet1px, pseudoJet1py, pseudoJet1pz, pseudoJet1energy ))
146  setattr(event, "pseudoJet1"+collectionPostFix+postFix, ROOT.reco.Particle.LorentzVector( pseudoJet2px, pseudoJet2py, pseudoJet2pz, pseudoJet2energy ))
147  setattr(event, "multPseudoJet1"+collectionPostFix+postFix, multPSJ2 )
148  setattr(event, "multPseudoJet2"+collectionPostFix+postFix, multPSJ1 )
149 
150  setattr(event, "mt2"+collectionPostFix+postFix, self.computeMT2(getattr(event,'pseudoJet1'+collectionPostFix+postFix), getattr(event,'pseudoJet2'+collectionPostFix+postFix), met) )
151  return self.computeMT2(getattr(event,'pseudoJet1'+collectionPostFix+postFix), getattr(event,'pseudoJet2'+collectionPostFix+postFix), met)
152 
153 
def computeMT2(self, visaVec, visbVec, metVec)
Definition: MT2Analyzer.py:49
def getMT2Hemi(self, event, TMPobjects40jc, met, collectionPostFix, postFix)
Definition: MT2Analyzer.py:91
def MT2Analyzer.MT2Analyzer.makeMT2 (   self,
  event 
)

Definition at line 154 of file MT2Analyzer.py.

154  def makeMT2(self, event):
155 # print '==> INSIDE THE PRINT MT2'
156 # print 'MET=',event.met.pt()
157 
158  self.met = ROOT.pat.MET(self.handles['met'].product()[0])
159 
160  import array
161  import numpy
162 
163  objects40jc = [ j for j in event.cleanJets if j.pt() > 40 and abs(j.eta())<2.5 ]
164  objectsXjc = [ j for j in event.cleanJets if j.pt() > self.jetPt and abs(j.eta())<2.5 ]
165 
166  setattr(event, "mt2ViaKt"+self.cfg_ana.collectionPostFix+"had", -999)
167  setattr(event, "mt2ViaKt"+self.cfg_ana.collectionPostFix+"_Xj_had", -999)
168  setattr(event, "pseudoViaKtJet1"+self.cfg_ana.collectionPostFix+"_had", ROOT.reco.Particle.LorentzVector( 0, 0, 0, 0 ))
169  setattr(event, "pseudoViaKtJet2"+self.cfg_ana.collectionPostFix+"_had", ROOT.reco.Particle.LorentzVector( 0, 0, 0, 0 ))
170  setattr(event, "pseudoViaKtJet1"+self.cfg_ana.collectionPostFix+"_Xj_had", ROOT.reco.Particle.LorentzVector( 0, 0, 0, 0 ))
171  setattr(event, "pseudoViaKtJet2"+self.cfg_ana.collectionPostFix+"_Xj_had", ROOT.reco.Particle.LorentzVector( 0, 0, 0, 0 ))
172 
173  setattr(event, "mt2ViaAKt"+self.cfg_ana.collectionPostFix+"had", -999)
174  setattr(event, "mt2ViaAKt"+self.cfg_ana.collectionPostFix+"_Xj_had", -999)
175  setattr(event, "pseudoViaAKtJet1"+self.cfg_ana.collectionPostFix+"_had", ROOT.reco.Particle.LorentzVector( 0, 0, 0, 0 ))
176  setattr(event, "pseudoViaAKtJet2"+self.cfg_ana.collectionPostFix+"_had", ROOT.reco.Particle.LorentzVector( 0, 0, 0, 0 ))
177  setattr(event, "pseudoViaAKtJet1"+self.cfg_ana.collectionPostFix+"_Xj_had", ROOT.reco.Particle.LorentzVector( 0, 0, 0, 0 ))
178  setattr(event, "pseudoViaAKtJet2"+self.cfg_ana.collectionPostFix+"_Xj_had", ROOT.reco.Particle.LorentzVector( 0, 0, 0, 0 ))
179 
def makeMT2(self, event)
Definition: MT2Analyzer.py:154
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

MT2Analyzer.MT2Analyzer.groupingViaAKt
static

Definition at line 83 of file MT2Analyzer.py.

MT2Analyzer.MT2Analyzer.groupingViaKt
static

Definition at line 73 of file MT2Analyzer.py.

MT2Analyzer.MT2Analyzer.hemisphereViaAKt
static

Definition at line 82 of file MT2Analyzer.py.

MT2Analyzer.MT2Analyzer.hemisphereViaKt
static

Definition at line 72 of file MT2Analyzer.py.

MT2Analyzer.MT2Analyzer.jetPt

Definition at line 35 of file MT2Analyzer.py.

MT2Analyzer.MT2Analyzer.met

Definition at line 158 of file MT2Analyzer.py.

MT2Analyzer.MT2Analyzer.mt2ViaKt_had
static

get hemispheres via AntiKT -1 antikt, 1 kt, 0 CA

Definition at line 183 of file MT2Analyzer.py.

MT2Analyzer.MT2Analyzer.mt2ViaKt_Xj_had
static

Definition at line 187 of file MT2Analyzer.py.

MT2Analyzer.MT2Analyzer.objects
static

get hemispheres via AntiKT -1 antikt, 1 kt, 0 CA

Definition at line 68 of file MT2Analyzer.py.