CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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__
 
def beginLoop
 
def computeMT2
 
def declareHandles
 
def getMT2AKT
 
def getMT2Hemi
 
def makeMT2
 

Public Attributes

 jetPt
 
 met
 

Static Public Attributes

tuple groupingViaAKt = hemisphereViaAKt.getGroupingExclusive(2)
 
tuple groupingViaKt = hemisphereViaKt.getGroupingExclusive(2)
 
tuple hemisphereViaAKt = ReclusterJets(objects, -1.,50.0)
 
tuple hemisphereViaKt = ReclusterJets(objects, 1.,50.0)
 
tuple objects = ROOT.std.vector(ROOT.reco.Particle.LorentzVector)
 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 
34  def __init__(self, cfg_ana, cfg_comp, looperName ):
35  super(MT2Analyzer,self).__init__(cfg_ana,cfg_comp,looperName)
36  self.jetPt = cfg_ana.jetPt

Member Function Documentation

def MT2Analyzer.MT2Analyzer.beginLoop (   self,
  setup 
)

Definition at line 43 of file MT2Analyzer.py.

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

Definition at line 49 of file MT2Analyzer.py.

Referenced by MT2Analyzer.MT2Analyzer.getMT2Hemi().

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

Definition at line 37 of file MT2Analyzer.py.

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

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

Definition at line 63 of file MT2Analyzer.py.

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

Definition at line 91 of file MT2Analyzer.py.

References MT2Analyzer.MT2Analyzer.computeMT2(), and reco.if().

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

Definition at line 154 of file MT2Analyzer.py.

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

Member Data Documentation

tuple MT2Analyzer.MT2Analyzer.groupingViaAKt = hemisphereViaAKt.getGroupingExclusive(2)
static

Definition at line 83 of file MT2Analyzer.py.

tuple MT2Analyzer.MT2Analyzer.groupingViaKt = hemisphereViaKt.getGroupingExclusive(2)
static

Definition at line 73 of file MT2Analyzer.py.

tuple MT2Analyzer.MT2Analyzer.hemisphereViaAKt = ReclusterJets(objects, -1.,50.0)
static

Definition at line 82 of file MT2Analyzer.py.

tuple MT2Analyzer.MT2Analyzer.hemisphereViaKt = ReclusterJets(objects, 1.,50.0)
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.

tuple MT2Analyzer.MT2Analyzer.objects = ROOT.std.vector(ROOT.reco.Particle.LorentzVector)
static

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

Definition at line 68 of file MT2Analyzer.py.