CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
L1Analysis::L1AnalysisRecoMuon2 Class Reference

#include <L1AnalysisRecoMuon2.h>

Public Member Functions

L1AnalysisRecoMuon2DataFormatgetData ()
 
void init (const edm::EventSetup &eventSetup)
 
 L1AnalysisRecoMuon2 (const edm::ParameterSet &pset)
 
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

PropagateToMuon muPropagator1st_
 
PropagateToMuon muPropagator2nd_
 
L1AnalysisRecoMuon2DataFormat recoMuon_
 

Detailed Description

Definition at line 42 of file L1AnalysisRecoMuon2.h.

Constructor & Destructor Documentation

L1Analysis::L1AnalysisRecoMuon2::L1AnalysisRecoMuon2 ( const edm::ParameterSet pset)

Definition at line 10 of file L1AnalysisRecoMuon2.cc.

10  :
13 {
14 }
T getParameter(std::string const &) const
L1Analysis::L1AnalysisRecoMuon2::~L1AnalysisRecoMuon2 ( )

Definition at line 17 of file L1AnalysisRecoMuon2.cc.

18 {
19 }

Member Function Documentation

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

Definition at line 61 of file L1AnalysisRecoMuon2.h.

References recoMuon_.

61 {return &recoMuon_;}
L1AnalysisRecoMuon2DataFormat recoMuon_
void L1Analysis::L1AnalysisRecoMuon2::init ( const edm::EventSetup eventSetup)

Definition at line 101 of file L1AnalysisRecoMuon2.cc.

References PropagateToMuon::init(), muPropagator1st_, and muPropagator2nd_.

102 {
103  muPropagator1st_.init(eventSetup);
104  muPropagator2nd_.init(eventSetup);
105 }
void init(const edm::EventSetup &iSetup)
void L1Analysis::L1AnalysisRecoMuon2::Reset ( )
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 21 of file L1AnalysisRecoMuon2.cc.

References L1Analysis::L1AnalysisRecoMuon2DataFormat::charge, L1Analysis::L1AnalysisRecoMuon2DataFormat::e, L1Analysis::L1AnalysisRecoMuon2DataFormat::et, L1Analysis::L1AnalysisRecoMuon2DataFormat::eta, PV3DBase< T, PVType, FrameType >::eta(), L1Analysis::L1AnalysisRecoMuon2DataFormat::etaSt1, L1Analysis::L1AnalysisRecoMuon2DataFormat::etaSt2, PropagateToMuon::extrapolate(), TrajectoryStateOnSurface::globalPosition(), L1Analysis::L1AnalysisRecoMuon2DataFormat::isLooseMuon, isLooseMuonCustom(), L1Analysis::L1AnalysisRecoMuon2DataFormat::isMediumMuon, isMediumMuonCustom(), L1Analysis::L1AnalysisRecoMuon2DataFormat::iso, L1Analysis::L1AnalysisRecoMuon2DataFormat::isTightMuon, isTightMuonCustom(), TrajectoryStateOnSurface::isValid(), edm::HandleBase::isValid(), SiStripPI::max, L1Analysis::L1AnalysisRecoMuon2DataFormat::met, L1Analysis::L1AnalysisRecoMuon2DataFormat::mt, nanoDQM_cfi::Muon, muPropagator1st_, muPropagator2nd_, L1Analysis::L1AnalysisRecoMuon2DataFormat::nMuons, L1Analysis::L1AnalysisRecoMuon2DataFormat::phi, PV3DBase< T, PVType, FrameType >::phi(), L1Analysis::L1AnalysisRecoMuon2DataFormat::phiSt1, L1Analysis::L1AnalysisRecoMuon2DataFormat::phiSt2, L1Analysis::L1AnalysisRecoMuon2DataFormat::pt, and recoMuon_.

27 {
28 
29  recoMuon_.nMuons=0;
30 
31  for(reco::MuonCollection::const_iterator it=muons->begin();
32  it!=muons->end() && recoMuon_.nMuons < maxMuon;
33  ++it) {
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  // extrapolation of track coordinates
82  if (stateAtMuSt1.isValid()) {
83  recoMuon_.etaSt1.push_back(stateAtMuSt1.globalPosition().eta());
84  recoMuon_.phiSt1.push_back(stateAtMuSt1.globalPosition().phi());
85  } else {
86  recoMuon_.etaSt1.push_back(-9999);
87  recoMuon_.phiSt1.push_back(-9999);
88  }
89 
91  if (stateAtMuSt2.isValid()) {
92  recoMuon_.etaSt2.push_back(stateAtMuSt2.globalPosition().eta());
93  recoMuon_.phiSt2.push_back(stateAtMuSt2.globalPosition().phi());
94  } else {
95  recoMuon_.etaSt2.push_back(-9999);
96  recoMuon_.phiSt2.push_back(-9999);
97  }
98  }
99 }
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalPoint globalPosition() const
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:74
T eta() const
Definition: PV3DBase.h:76
L1AnalysisRecoMuon2DataFormat recoMuon_

Member Data Documentation

PropagateToMuon L1Analysis::L1AnalysisRecoMuon2::muPropagator1st_
private

Definition at line 67 of file L1AnalysisRecoMuon2.h.

Referenced by init(), and SetMuon().

PropagateToMuon L1Analysis::L1AnalysisRecoMuon2::muPropagator2nd_
private

Definition at line 68 of file L1AnalysisRecoMuon2.h.

Referenced by init(), and SetMuon().

L1AnalysisRecoMuon2DataFormat L1Analysis::L1AnalysisRecoMuon2::recoMuon_
private

Definition at line 65 of file L1AnalysisRecoMuon2.h.

Referenced by getData(), Reset(), and SetMuon().