76 hPtRec = fileService->
make<TH1F>(
"pT",
"p_{T}^{rec}", 250, 0, 120);
77 hPtReso = fileService->
make<TH2F>(
"pT_Reso",
"(p_{T}^{rec}-p_{T}^{sim})/p_{T}^{sim}", 250, 0, 120, 100, -0.2, 0.2);
78 hNMuons = fileService->
make<TH1I>(
"NMuons",
"Number of muons per event", 20, 0, 20);
80 hEHcal = fileService->
make<TH1F>(
"EHCal",
"Energy deposit in HCAL", 100, 0, 10);
83 hMuonType = fileService->
make<TH1I>(
"MuonType",
"Type of Muons", 5, 1, 6);
84 hPtSTATKDiff = fileService->
make<TH1F>(
"DiffPt_STA_TK",
"p^{TK}_{T}-p^{STA}_T", 200, -50, 50);
85 hMuCaloCompatibility = fileService->
make<TH1F>(
"CaloCompatibility",
"Muon HP using Calorimeters only", 100, 0, 1);
86 hMuSegCompatibility = fileService->
make<TH1F>(
"SegmentCompatibility",
"Muon HP using segments only", 100, 0, 1);
87 hChamberMatched = fileService->
make<TH1I>(
"NumMatchedChamber",
"Number of matched chambers", 7, 0, 7);
88 hMuIdAlgo = fileService->
make<TH1I>(
"MuonIDSelectors",
"Results of muon id selectors", 13, 0, 13);
91 hMuIso03SumPt = fileService->
make<TH1F>(
"MuIso03SumPt",
"Isolation #Delta(R)=0.3: SumPt", 200, 0, 10);
93 fileService->
make<TH1F>(
"MuIso03CaloComb",
"Isolation #Delta(R)=0.3: 1.2*ECAL+0.8HCAL", 200, 0, 10);
96 h4MuInvMass = fileService->
make<TH1F>(
"InvMass4MuSystem",
"Invariant mass of the 4 muons system", 200, 0, 500);
104 event.getByToken(theMuonToken, muons);
107 hNMuons->Fill(muons->size());
112 for (pat::MuonCollection::const_iterator
muon = muons->begin();
muon != muons->end(); ++
muon) {
114 hPtRec->Fill(
muon->pt());
118 if (
muon->genLepton() !=
nullptr) {
119 double reso = (
muon->pt() -
muon->genLepton()->pt()) /
muon->genLepton()->pt();
120 hPtReso->Fill(
muon->genLepton()->pt(), reso);
124 if (
muon->isEnergyValid())
125 hEHcal->Fill(
muon->calEnergy().had);
128 if (
muon->isStandAloneMuon())
129 if (
muon->isGlobalMuon())
130 if (
muon->isTrackerMuon())
134 else if (
muon->isTrackerMuon())
138 else if (
muon->isTrackerMuon())
143 if (
muon->isGlobalMuon()) {
144 double diff =
muon->innerTrack()->pt() -
muon->standAloneMuon()->pt();
145 hPtSTATKDiff->Fill(diff);
151 if (
muon->isCaloCompatibilityValid())
152 hMuCaloCompatibility->Fill(
muon->caloCompatibility());
158 hChamberMatched->Fill(
muon->numberOfChambers());
197 if (
muon->isIsolationValid()) {
198 hMuIso03CaloComb->Fill(1.2 *
muon->isolationR03().emEt + 0.8 *
muon->isolationR03().hadEt);
199 hMuIso03SumPt->Fill(
muon->isolationR03().sumPt);
208 if (
muon->isolationR03().sumPt < 0.2) {
211 selectedMuons.push_back(*
muon);
216 if (selectedMuons.size() == 4) {
218 for (pat::MuonCollection::const_iterator
muon = selectedMuons.begin();
muon != selectedMuons.end(); ++
muon) {
219 p4CM = p4CM +
muon->p4();
221 h4MuInvMass->Fill(p4CM.mass());
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
#define DEFINE_FWK_MODULE(type)
T * make(const Args &...args) const
make new ROOT object
TH1F * hMuSegCompatibility
TH1F * hMuCaloCompatibility
~ExampleMuonAnalyzer() override
Destructor.
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
T getParameter(std::string const &) const
ExampleMuonAnalyzer(const edm::ParameterSet &pset)
Constructor.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::vector< Muon > MuonCollection
edm::EDGetTokenT< pat::MuonCollection > theMuonToken