CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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, edm::ConsumesCollector)
 
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_
 
const PropagateToMuonSetup muPropagatorSetup1st_
 
const PropagateToMuonSetup muPropagatorSetup2nd_
 
L1AnalysisRecoMuon2DataFormat recoMuon_
 

Detailed Description

Definition at line 41 of file L1AnalysisRecoMuon2.h.

Constructor & Destructor Documentation

◆ L1AnalysisRecoMuon2()

L1Analysis::L1AnalysisRecoMuon2::L1AnalysisRecoMuon2 ( const edm::ParameterSet pset,
edm::ConsumesCollector  iC 
)

Definition at line 10 of file L1AnalysisRecoMuon2.cc.

11  : muPropagatorSetup1st_(pset.getParameter<edm::ParameterSet>("muProp1st"), iC),
12  muPropagatorSetup2nd_(pset.getParameter<edm::ParameterSet>("muProp2nd"), iC) {}
const PropagateToMuonSetup muPropagatorSetup1st_
const PropagateToMuonSetup muPropagatorSetup2nd_

◆ ~L1AnalysisRecoMuon2()

L1Analysis::L1AnalysisRecoMuon2::~L1AnalysisRecoMuon2 ( )

Definition at line 14 of file L1AnalysisRecoMuon2.cc.

14 {}

Member Function Documentation

◆ getData()

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

Definition at line 60 of file L1AnalysisRecoMuon2.h.

References recoMuon_.

60 { return &recoMuon_; }
L1AnalysisRecoMuon2DataFormat recoMuon_

◆ init()

void L1Analysis::L1AnalysisRecoMuon2::init ( const edm::EventSetup eventSetup)

Definition at line 94 of file L1AnalysisRecoMuon2.cc.

References options_cfi::eventSetup.

◆ Reset()

void L1Analysis::L1AnalysisRecoMuon2::Reset ( )
inline

◆ SetMuon()

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 16 of file L1AnalysisRecoMuon2.cc.

References PV3DBase< T, PVType, FrameType >::eta(), TrajectoryStateOnSurface::globalPosition(), isLooseMuonCustom(), isMediumMuonCustom(), isTightMuonCustom(), TrajectoryStateOnSurface::isValid(), SiStripPI::max, l1MuonRecoTree_cfi::maxMuon, dumpRecoGeometry_cfg::Muon, PDWG_BPHSkim_cff::muons, PV3DBase< T, PVType, FrameType >::phi(), and AlignmentTracksFromVertexSelector_cfi::vertices.

22  {
23  recoMuon_.nMuons = 0;
24 
25  for (reco::MuonCollection::const_iterator it = muons->begin(); it != muons->end() && recoMuon_.nMuons < maxMuon;
26  ++it) {
27  recoMuon_.e.push_back(it->energy());
28  recoMuon_.pt.push_back(it->pt());
29  recoMuon_.et.push_back(it->et());
30  recoMuon_.eta.push_back(it->eta());
31  recoMuon_.phi.push_back(it->phi());
32  recoMuon_.charge.push_back(it->charge());
33 
34  //check isLooseMuon
35  bool flagLoose = isLooseMuonCustom(*it);
36  recoMuon_.isLooseMuon.push_back(flagLoose);
37 
38  //check isMediumMuon
39  bool flagMedium = isMediumMuonCustom(*it);
40  recoMuon_.isMediumMuon.push_back(flagMedium);
41 
42  //check isTightMuon
43  bool flagTight = false;
44  if (vertices.isValid())
45  flagTight = isTightMuonCustom(*it, (*vertices)[0]);
46  recoMuon_.isTightMuon.push_back(flagTight);
47 
48  double iso = (it->pfIsolationR04().sumChargedHadronPt +
49  max(0.,
50  it->pfIsolationR04().sumNeutralHadronEt + it->pfIsolationR04().sumPhotonEt -
51  0.5 * it->pfIsolationR04().sumPUPt)) /
52  it->pt();
53  recoMuon_.iso.push_back(iso);
54 
55  double MET_local = TMath::Sqrt(METx * METx + METy * METy);
56  recoMuon_.met.push_back(MET_local);
57 
58  TLorentzVector METP4;
59  METP4.SetPxPyPzE(METx, METy, 0, MET_local);
60 
61  TLorentzVector Muon;
62  Muon.SetPtEtaPhiE(it->pt(), it->eta(), it->phi(), it->energy());
63 
64  double scalSum = MET_local + Muon.Pt();
65  TLorentzVector vecSum(Muon);
66  vecSum += METP4;
67  double vecSumPt = vecSum.Pt();
68 
69  recoMuon_.mt.push_back(TMath::Sqrt(scalSum * scalSum - vecSumPt * vecSumPt));
70 
71  recoMuon_.nMuons++;
72 
73  // extrapolation of track coordinates
75  if (stateAtMuSt1.isValid()) {
76  recoMuon_.etaSt1.push_back(stateAtMuSt1.globalPosition().eta());
77  recoMuon_.phiSt1.push_back(stateAtMuSt1.globalPosition().phi());
78  } else {
79  recoMuon_.etaSt1.push_back(-9999);
80  recoMuon_.phiSt1.push_back(-9999);
81  }
82 
84  if (stateAtMuSt2.isValid()) {
85  recoMuon_.etaSt2.push_back(stateAtMuSt2.globalPosition().eta());
86  recoMuon_.phiSt2.push_back(stateAtMuSt2.globalPosition().phi());
87  } else {
88  recoMuon_.etaSt2.push_back(-9999);
89  recoMuon_.phiSt2.push_back(-9999);
90  }
91  }
92 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T eta() const
Definition: PV3DBase.h:73
bool isLooseMuonCustom(const reco::Muon &recoMu)
Definition: MuonID.h:19
GlobalPoint globalPosition() const
Definition: Muon.py:1
bool isTightMuonCustom(const reco::Muon &recoMu, const reco::Vertex recoVtx)
Definition: MuonID.h:36
bool isMediumMuonCustom(const reco::Muon &recoMu)
Definition: MuonID.h:27
L1AnalysisRecoMuon2DataFormat recoMuon_
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Extrapolate reco::Track to the muon station 2, return an invalid TSOS if it fails.

Member Data Documentation

◆ muPropagator1st_

PropagateToMuon L1Analysis::L1AnalysisRecoMuon2::muPropagator1st_
private

Definition at line 69 of file L1AnalysisRecoMuon2.h.

◆ muPropagator2nd_

PropagateToMuon L1Analysis::L1AnalysisRecoMuon2::muPropagator2nd_
private

Definition at line 70 of file L1AnalysisRecoMuon2.h.

◆ muPropagatorSetup1st_

const PropagateToMuonSetup L1Analysis::L1AnalysisRecoMuon2::muPropagatorSetup1st_
private

Definition at line 66 of file L1AnalysisRecoMuon2.h.

◆ muPropagatorSetup2nd_

const PropagateToMuonSetup L1Analysis::L1AnalysisRecoMuon2::muPropagatorSetup2nd_
private

Definition at line 67 of file L1AnalysisRecoMuon2.h.

◆ recoMuon_

L1AnalysisRecoMuon2DataFormat L1Analysis::L1AnalysisRecoMuon2::recoMuon_
private

Definition at line 64 of file L1AnalysisRecoMuon2.h.

Referenced by getData(), and Reset().