CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 33 of file MT2Analyzer.py.

Constructor & Destructor Documentation

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

Definition at line 34 of file MT2Analyzer.py.

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

Member Function Documentation

def MT2Analyzer.MT2Analyzer.beginLoop (   self,
  setup 
)

Definition at line 44 of file MT2Analyzer.py.

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

Definition at line 50 of file MT2Analyzer.py.

Referenced by MT2Analyzer.MT2Analyzer.getMT2Hemi().

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

Definition at line 38 of file MT2Analyzer.py.

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

38 
39  def declareHandles(self):
40  super(MT2Analyzer, self).declareHandles()
41  #genJets
42  self.handles['genJets'] = AutoHandle( 'slimmedGenJets','std::vector<reco::GenJet>')
43  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 64 of file MT2Analyzer.py.

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

Definition at line 92 of file MT2Analyzer.py.

References MT2Analyzer.MT2Analyzer.computeMT2(), if(), and sistrip::SpyUtilities.range().

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

Definition at line 155 of file MT2Analyzer.py.

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

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

Definition at line 74 of file MT2Analyzer.py.

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

Definition at line 83 of file MT2Analyzer.py.

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

Definition at line 73 of file MT2Analyzer.py.

MT2Analyzer.MT2Analyzer.jetPt

Definition at line 36 of file MT2Analyzer.py.

MT2Analyzer.MT2Analyzer.met

Definition at line 159 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 69 of file MT2Analyzer.py.