77 hPtRec = fileService->
make<TH1F>(
"pT",
"p_{T}^{rec}", 250, 0, 120);
78 hPtReso = fileService->
make<TH2F>(
"pT_Reso",
"(p_{T}^{rec}-p_{T}^{sim})/p_{T}^{sim}", 250, 0, 120, 100, -0.2, 0.2);
79 hNMuons = fileService->
make<TH1I>(
"NMuons",
"Number of muons per event", 20, 0, 20);
81 hEHcal = fileService->
make<TH1F>(
"EHCal",
"Energy deposit in HCAL", 100, 0, 10);
84 hMuonType = fileService->
make<TH1I>(
"MuonType",
"Type of Muons", 5, 1, 6);
85 hPtSTATKDiff = fileService->
make<TH1F>(
"DiffPt_STA_TK",
"p^{TK}_{T}-p^{STA}_T", 200, -50, 50);
86 hMuCaloCompatibility = fileService->
make<TH1F>(
"CaloCompatibility",
"Muon HP using Calorimeters only", 100, 0, 1);
87 hMuSegCompatibility = fileService->
make<TH1F>(
"SegmentCompatibility",
"Muon HP using segments only", 100, 0, 1);
88 hChamberMatched = fileService->
make<TH1I>(
"NumMatchedChamber",
"Number of matched chambers", 7, 0, 7);
89 hMuIdAlgo = fileService->
make<TH1I>(
"MuonIDSelectors",
"Results of muon id selectors", 13, 0, 13);
92 hMuIso03SumPt = fileService->
make<TH1F>(
"MuIso03SumPt",
"Isolation #Delta(R)=0.3: SumPt", 200, 0, 10);
94 fileService->
make<TH1F>(
"MuIso03CaloComb",
"Isolation #Delta(R)=0.3: 1.2*ECAL+0.8HCAL", 200, 0, 10);
97 h4MuInvMass = fileService->
make<TH1F>(
"InvMass4MuSystem",
"Invariant mass of the 4 muons system", 200, 0, 500);
105 event.getByToken(theMuonToken, muons);
108 hNMuons->Fill(muons->size());
113 for (pat::MuonCollection::const_iterator
muon = muons->begin();
muon != muons->end(); ++
muon) {
115 hPtRec->Fill(
muon->pt());
119 if (
muon->genLepton() !=
nullptr) {
120 double reso = (
muon->pt() -
muon->genLepton()->pt()) /
muon->genLepton()->pt();
121 hPtReso->Fill(
muon->genLepton()->pt(), reso);
125 if (
muon->isEnergyValid())
126 hEHcal->Fill(
muon->calEnergy().had);
129 if (
muon->isStandAloneMuon())
130 if (
muon->isGlobalMuon())
131 if (
muon->isTrackerMuon())
135 else if (
muon->isTrackerMuon())
139 else if (
muon->isTrackerMuon())
144 if (
muon->isGlobalMuon()) {
145 double diff =
muon->innerTrack()->pt() -
muon->standAloneMuon()->pt();
146 hPtSTATKDiff->Fill(diff);
152 if (
muon->isCaloCompatibilityValid())
153 hMuCaloCompatibility->Fill(
muon->caloCompatibility());
159 hChamberMatched->Fill(
muon->numberOfChambers());
198 if (
muon->isIsolationValid()) {
199 hMuIso03CaloComb->Fill(1.2 *
muon->isolationR03().emEt + 0.8 *
muon->isolationR03().hadEt);
200 hMuIso03SumPt->Fill(
muon->isolationR03().sumPt);
209 if (
muon->isolationR03().sumPt < 0.2) {
212 selectedMuons.push_back(*
muon);
217 if (selectedMuons.size() == 4) {
219 for (pat::MuonCollection::const_iterator
muon = selectedMuons.begin();
muon != selectedMuons.end(); ++
muon) {
220 p4CM = p4CM +
muon->p4();
222 h4MuInvMass->Fill(p4CM.mass());
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
static const std::string kSharedResource
#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