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 33 of file MT2Analyzer.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 34 of file MT2Analyzer.py.

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
37 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ beginLoop()

def MT2Analyzer.MT2Analyzer.beginLoop (   self,
  setup 
)

Definition at line 44 of file MT2Analyzer.py.

References CSCSPEvent.counters(), cms::cuda::AtomicPairCounter::Atomic2.counters, NMaxPerLumi.counters, analyzer.Analyzer.counters, HistogramManager.counters, counter.Counters.counters, and cscdqm::ChamberCounterKeyType.counters.

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')
49 

◆ computeMT2()

def MT2Analyzer.MT2Analyzer.computeMT2 (   self,
  visaVec,
  visbVec,
  metVec 
)

Definition at line 50 of file MT2Analyzer.py.

Referenced by MT2Analyzer.MT2Analyzer.getMT2Hemi().

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()
63 

◆ declareHandles()

def MT2Analyzer.MT2Analyzer.declareHandles (   self)

Definition at line 38 of file MT2Analyzer.py.

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

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>' )
43 

◆ getMT2AKT()

def MT2Analyzer.MT2Analyzer.getMT2AKT (   self,
  event,
  TMPobjects40jc,
  met,
  collectionPostFix,
  postFix 
)

Definition at line 64 of file MT2Analyzer.py.

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

◆ getMT2Hemi()

def MT2Analyzer.MT2Analyzer.getMT2Hemi (   self,
  event,
  TMPobjects40jc,
  met,
  collectionPostFix,
  postFix 
)

Definition at line 92 of file MT2Analyzer.py.

References MT2Analyzer.MT2Analyzer.computeMT2(), caHitNtupletGeneratorKernels.if(), and FastTimerService_cff.range.

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 
154 

◆ makeMT2()

def MT2Analyzer.MT2Analyzer.makeMT2 (   self,
  event 
)

Definition at line 155 of file MT2Analyzer.py.

155  def makeMT2(self, event):
156 # print '==> INSIDE THE PRINT MT2'
157 # print 'MET=',event.met.pt()
158 
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 ))
180 
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

◆ groupingViaAKt

MT2Analyzer.MT2Analyzer.groupingViaAKt
static

Definition at line 84 of file MT2Analyzer.py.

◆ groupingViaKt

MT2Analyzer.MT2Analyzer.groupingViaKt
static

Definition at line 74 of file MT2Analyzer.py.

◆ hemisphereViaAKt

MT2Analyzer.MT2Analyzer.hemisphereViaAKt
static

Definition at line 83 of file MT2Analyzer.py.

◆ hemisphereViaKt

MT2Analyzer.MT2Analyzer.hemisphereViaKt
static

Definition at line 73 of file MT2Analyzer.py.

◆ jetPt

MT2Analyzer.MT2Analyzer.jetPt

Definition at line 36 of file MT2Analyzer.py.

◆ met

MT2Analyzer.MT2Analyzer.met

Definition at line 159 of file MT2Analyzer.py.

Referenced by objects.METAnalyzer.METAnalyzer.applyDeltaMet().

◆ mt2ViaKt_had

MT2Analyzer.MT2Analyzer.mt2ViaKt_had
static

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

Definition at line 184 of file MT2Analyzer.py.

◆ mt2ViaKt_Xj_had

MT2Analyzer.MT2Analyzer.mt2ViaKt_Xj_had
static

Definition at line 188 of file MT2Analyzer.py.

◆ objects

MT2Analyzer.MT2Analyzer.objects
static

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

Definition at line 69 of file MT2Analyzer.py.