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 40 of file L1AnalysisRecoMuon2.h.

Constructor & Destructor Documentation

◆ L1AnalysisRecoMuon2()

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

Definition at line 10 of file L1AnalysisRecoMuon2.cc.

11  : muPropagator1st_(pset.getParameter<edm::ParameterSet>("muProp1st")),
12  muPropagator2nd_(pset.getParameter<edm::ParameterSet>("muProp2nd")) {}

◆ ~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 59 of file L1AnalysisRecoMuon2.h.

59 { return &recoMuon_; }

References recoMuon_.

◆ init()

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

Definition at line 94 of file L1AnalysisRecoMuon2.cc.

94  {
95  muPropagator1st_.init(eventSetup);
96  muPropagator2nd_.init(eventSetup);
97 }

◆ 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.

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 }

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 pwdgSkimBPark_cfi::vertices.

Member Data Documentation

◆ muPropagator1st_

PropagateToMuon L1Analysis::L1AnalysisRecoMuon2::muPropagator1st_
private

Definition at line 65 of file L1AnalysisRecoMuon2.h.

◆ muPropagator2nd_

PropagateToMuon L1Analysis::L1AnalysisRecoMuon2::muPropagator2nd_
private

Definition at line 66 of file L1AnalysisRecoMuon2.h.

◆ recoMuon_

L1AnalysisRecoMuon2DataFormat L1Analysis::L1AnalysisRecoMuon2::recoMuon_
private

Definition at line 63 of file L1AnalysisRecoMuon2.h.

Referenced by getData(), and Reset().

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
L1Analysis::L1AnalysisRecoMuon2DataFormat::iso
std::vector< float > iso
Definition: L1AnalysisRecoMuon2DataFormat.h:53
isTightMuonCustom
bool isTightMuonCustom(const reco::Muon &recoMu, const reco::Vertex recoVtx)
Definition: MuonID.h:36
isMediumMuonCustom
bool isMediumMuonCustom(const reco::Muon &recoMu)
Definition: MuonID.h:27
L1Analysis::L1AnalysisRecoMuon2::muPropagator1st_
PropagateToMuon muPropagator1st_
Definition: L1AnalysisRecoMuon2.h:65
PropagateToMuon::init
void init(const edm::EventSetup &iSetup)
Definition: PropagateToMuon.cc:56
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
L1Analysis::L1AnalysisRecoMuon2DataFormat::met
std::vector< double > met
Definition: L1AnalysisRecoMuon2DataFormat.h:60
L1Analysis::L1AnalysisRecoMuon2DataFormat::isMediumMuon
std::vector< bool > isMediumMuon
Definition: L1AnalysisRecoMuon2DataFormat.h:51
L1Analysis::L1AnalysisRecoMuon2DataFormat::Reset
void Reset()
Definition: L1AnalysisRecoMuon2DataFormat.h:18
L1Analysis::L1AnalysisRecoMuon2DataFormat::etaSt1
std::vector< float > etaSt1
Definition: L1AnalysisRecoMuon2DataFormat.h:62
L1Analysis::L1AnalysisRecoMuon2DataFormat::mt
std::vector< double > mt
Definition: L1AnalysisRecoMuon2DataFormat.h:61
L1Analysis::L1AnalysisRecoMuon2DataFormat::pt
std::vector< float > pt
Definition: L1AnalysisRecoMuon2DataFormat.h:47
L1Analysis::L1AnalysisRecoMuon2DataFormat::phi
std::vector< float > phi
Definition: L1AnalysisRecoMuon2DataFormat.h:49
Muon
Definition: Muon.py:1
L1Analysis::L1AnalysisRecoMuon2DataFormat::eta
std::vector< float > eta
Definition: L1AnalysisRecoMuon2DataFormat.h:48
l1MuonRecoTree_cfi.maxMuon
maxMuon
Definition: l1MuonRecoTree_cfi.py:4
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
L1Analysis::L1AnalysisRecoMuon2DataFormat::isTightMuon
std::vector< bool > isTightMuon
Definition: L1AnalysisRecoMuon2DataFormat.h:52
L1Analysis::L1AnalysisRecoMuon2::recoMuon_
L1AnalysisRecoMuon2DataFormat recoMuon_
Definition: L1AnalysisRecoMuon2.h:63
L1Analysis::L1AnalysisRecoMuon2DataFormat::e
std::vector< float > e
Definition: L1AnalysisRecoMuon2DataFormat.h:45
L1Analysis::L1AnalysisRecoMuon2DataFormat::et
std::vector< float > et
Definition: L1AnalysisRecoMuon2DataFormat.h:46
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
dumpRecoGeometry_cfg.Muon
Muon
Definition: dumpRecoGeometry_cfg.py:190
isLooseMuonCustom
bool isLooseMuonCustom(const reco::Muon &recoMu)
Definition: MuonID.h:19
L1Analysis::L1AnalysisRecoMuon2DataFormat::etaSt2
std::vector< float > etaSt2
Definition: L1AnalysisRecoMuon2DataFormat.h:64
L1Analysis::L1AnalysisRecoMuon2DataFormat::phiSt1
std::vector< float > phiSt1
Definition: L1AnalysisRecoMuon2DataFormat.h:63
L1Analysis::L1AnalysisRecoMuon2DataFormat::phiSt2
std::vector< float > phiSt2
Definition: L1AnalysisRecoMuon2DataFormat.h:65
L1Analysis::L1AnalysisRecoMuon2DataFormat::charge
std::vector< int > charge
Definition: L1AnalysisRecoMuon2DataFormat.h:59
L1Analysis::L1AnalysisRecoMuon2::muPropagator2nd_
PropagateToMuon muPropagator2nd_
Definition: L1AnalysisRecoMuon2.h:66
L1Analysis::L1AnalysisRecoMuon2DataFormat::isLooseMuon
std::vector< bool > isLooseMuon
Definition: L1AnalysisRecoMuon2DataFormat.h:50
PropagateToMuon::extrapolate
TrajectoryStateOnSurface extrapolate(const reco::Track &tk) const
Definition: PropagateToMuon.h:40
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
L1Analysis::L1AnalysisRecoMuon2DataFormat::nMuons
unsigned short nMuons
Definition: L1AnalysisRecoMuon2DataFormat.h:44
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7