test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
L1Analysis::L1AnalysisRecoMuon2 Class Reference

#include <L1AnalysisRecoMuon2.h>

Public Member Functions

L1AnalysisRecoMuon2DataFormatgetData ()
 
 L1AnalysisRecoMuon2 ()
 
void Reset ()
 
void SetMuon (const edm::Event &event, const edm::EventSetup &setup, const edm::Handle< reco::MuonCollection > muons, const edm::Handle< reco::VertexCollection > vertices, double METx, double METy, unsigned maxMuon)
 
 ~L1AnalysisRecoMuon2 ()
 

Private Attributes

L1AnalysisRecoMuon2DataFormat recoMuon_
 

Detailed Description

Definition at line 39 of file L1AnalysisRecoMuon2.h.

Constructor & Destructor Documentation

L1Analysis::L1AnalysisRecoMuon2::L1AnalysisRecoMuon2 ( )

Definition at line 10 of file L1AnalysisRecoMuon2.cc.

11 {
12 }
L1Analysis::L1AnalysisRecoMuon2::~L1AnalysisRecoMuon2 ( )

Definition at line 15 of file L1AnalysisRecoMuon2.cc.

16 {
17 }

Member Function Documentation

L1AnalysisRecoMuon2DataFormat* L1Analysis::L1AnalysisRecoMuon2::getData ( void  )
inline

Definition at line 56 of file L1AnalysisRecoMuon2.h.

References recoMuon_.

56 {return &recoMuon_;}
L1AnalysisRecoMuon2DataFormat recoMuon_
void L1Analysis::L1AnalysisRecoMuon2::Reset ( void  )
inline
void L1Analysis::L1AnalysisRecoMuon2::SetMuon ( const edm::Event event,
const edm::EventSetup setup,
const edm::Handle< reco::MuonCollection muons,
const edm::Handle< reco::VertexCollection vertices,
double  METx,
double  METy,
unsigned  maxMuon 
)

Definition at line 19 of file L1AnalysisRecoMuon2.cc.

References isLooseMuonCustom(), isMediumMuonCustom(), isTightMuonCustom(), edm::HandleBase::isValid(), bookConverter::max, and configurableAnalysis::Muon.

25 {
26 
27  recoMuon_.nMuons=0;
28 
29  for(reco::MuonCollection::const_iterator it=muons->begin();
30  it!=muons->end() && recoMuon_.nMuons < maxMuon;
31  ++it) {
32 
33 
34 
35  recoMuon_.e.push_back(it->energy());
36  recoMuon_.pt.push_back(it->pt());
37  recoMuon_.et.push_back(it->et());
38  recoMuon_.eta.push_back(it->eta());
39  recoMuon_.phi.push_back(it->phi());
40  recoMuon_.charge.push_back(it->charge());
41 
42  //check isLooseMuon
43  bool flagLoose = isLooseMuonCustom(*it);
44  recoMuon_.isLooseMuon.push_back(flagLoose);
45 
46  //check isMediumMuon
47  bool flagMedium = isMediumMuonCustom(*it);
48  recoMuon_.isMediumMuon.push_back(flagMedium);
49 
50  //check isTightMuon
51  bool flagTight = false;
52  if (vertices.isValid())
53  flagTight = isTightMuonCustom(*it, (*vertices)[0]);
54  recoMuon_.isTightMuon.push_back(flagTight);
55 
56  double iso = (it->pfIsolationR04().sumChargedHadronPt + max(0.,
57  it->pfIsolationR04().sumNeutralHadronEt +
58  it->pfIsolationR04().sumPhotonEt -
59  0.5*it->pfIsolationR04().sumPUPt)) / it->pt();
60  recoMuon_.iso.push_back(iso);
61 
62  double MET_local = TMath::Sqrt (METx*METx + METy*METy);
63  recoMuon_.met.push_back(MET_local);
64 
65  TLorentzVector METP4;
66  METP4.SetPxPyPzE(METx, METy, 0, MET_local);
67 
68  TLorentzVector Muon;
69  Muon.SetPtEtaPhiE(it->pt(),it->eta(),it->phi(),it->energy());
70 
71  double scalSum = MET_local + Muon.Pt();
72  TLorentzVector vecSum (Muon);
73  vecSum += METP4;
74  double vecSumPt = vecSum.Pt();
75 
76  recoMuon_.mt.push_back(TMath::Sqrt (scalSum*scalSum - vecSumPt*vecSumPt));
77 
78  recoMuon_.nMuons++;
79 
80  }
81 }
bool isLooseMuonCustom(const reco::Muon &recoMu)
Definition: MuonID.h:20
bool isTightMuonCustom(const reco::Muon &recoMu, const reco::Vertex recoVtx)
Definition: MuonID.h:42
bool isMediumMuonCustom(const reco::Muon &recoMu)
Definition: MuonID.h:28
bool isValid() const
Definition: HandleBase.h:75
L1AnalysisRecoMuon2DataFormat recoMuon_

Member Data Documentation

L1AnalysisRecoMuon2DataFormat L1Analysis::L1AnalysisRecoMuon2::recoMuon_
private

Definition at line 60 of file L1AnalysisRecoMuon2.h.

Referenced by getData(), and Reset().