Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modified x-label (title & unit) #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions Validation/plugins/QC8TrackValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ void QC8TrackValidation::bookHistograms(DQMStore::IBooker& booker,
Form("rechit_occ_ch%d", ch),
6, 0, 6,
16, 1, 17);
setBinLabelAndTitle(track_ch_occ_[ch]->getTH2F());
setBinLabelAndTitle(rechit_ch_occ_[ch]->getTH2F());
setBinLabelAndTitle2D(track_ch_occ_[ch]->getTH2F());
setBinLabelAndTitle2D(rechit_ch_occ_[ch]->getTH2F());
for (int idx_mod = 0; idx_mod < 4; idx_mod++) {
int module = idx_mod + (2 -ly) * 4 + 1;
Key2 key(ch, module);
Expand All @@ -52,8 +52,8 @@ void QC8TrackValidation::bookHistograms(DQMStore::IBooker& booker,
Form("rechit_occ_ch%d_module%d", ch, module),
6, 0, 6,
4, 0, 4);
setBinLabelAndTitle(track_occ_[key]->getTH2F(), module);
setBinLabelAndTitle(rechit_occ_[key]->getTH2F(), module);
setBinLabelAndTitle2D(track_occ_[key]->getTH2F(), module);
setBinLabelAndTitle2D(rechit_occ_[key]->getTH2F(), module);

}
for (int ieta = 1; ieta < 17; ieta++) {
Expand All @@ -66,17 +66,20 @@ void QC8TrackValidation::bookHistograms(DQMStore::IBooker& booker,
booker.setCurrentFolder("GEM/QC8Track/track");
track_occ_ieta_[key] = booker.book1D(Form("track_occ_ch%d_ieta%d", ch, ieta),
Form("track_occ_ch%d_ieta%d", ch, ieta),
16, 0, 16);
16, 1, 385);
booker.setCurrentFolder("GEM/QC8Track/rechit");
rechit_occ_ieta_[key] = booker.book1D(Form("rechit_occ_ch%d_ieta%d", ch, ieta),
Form("rechit_occ_ch%d_ieta%d", ch, ieta),
16, 0, 16);
16, 1, 385);
setBinLabelAndTitle1D(residual_[key]->getTH1F(), "x [cm]");
setBinLabelAndTitle1D(track_occ_ieta_[key]->getTH1F(), "strip");
setBinLabelAndTitle1D(rechit_occ_ieta_[key]->getTH1F(), "strip");
}
}
}

void QC8TrackValidation::setBinLabelAndTitle(TH2F* hist, int module) {
hist->GetXaxis()->SetTitle("ix");
void QC8TrackValidation::setBinLabelAndTitle2D(TH2F* hist, int module) {
hist->GetXaxis()->SetTitle("i#phi");
hist->GetYaxis()->SetTitle("i#eta");

int nBinsx = hist->GetXaxis()->GetNbins();
Expand All @@ -93,6 +96,15 @@ void QC8TrackValidation::setBinLabelAndTitle(TH2F* hist, int module) {
}
}

void QC8TrackValidation::setBinLabelAndTitle1D(TH1F* hist, std::string xlabel) {
hist->GetXaxis()->SetTitle(xlabel.c_str());

//int nBinsx = hist->GetXaxis()->GetNbins();
//for (int i = 1; i <= nBinsx; i++) {
// hist->GetXaxis()->SetBinLabel(i, Form("%d", i));
//}
}

void QC8TrackValidation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
{
/* GEM Geometry */
Expand Down Expand Up @@ -120,7 +132,6 @@ void QC8TrackValidation::analyze(const edm::Event& iEvent, const edm::EventSetup
auto gemId = GEMDetId(rechit->geographicalId());
tsosMap[gemId] = tsos;
}

for (auto hit : track->recHits()) {
auto etaPart = GEMGeometry_->etaPartition(hit->geographicalId());
auto etaPartId = etaPart->id();
Expand All @@ -142,13 +153,13 @@ void QC8TrackValidation::analyze(const edm::Event& iEvent, const edm::EventSetup

track_occ_[key]->Fill(strip / 64, sector);
track_ch_occ_[ch]->Fill(strip / 64, ieta);
track_occ_ieta_[etaKey]->Fill(strip / 32);
track_occ_ieta_[etaKey]->Fill(strip);

if (!hit->isValid()) continue;

rechit_occ_[key]->Fill(strip / 64, sector);
rechit_ch_occ_[ch]->Fill(strip / 64, ieta);
rechit_occ_ieta_[etaKey]->Fill(strip / 32);
rechit_occ_ieta_[etaKey]->Fill(strip);

auto range = gemRecHits->get(etaPartId);
float residual = FLT_MAX;
Expand Down
3 changes: 2 additions & 1 deletion Validation/plugins/QC8TrackValidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class QC8TrackValidation : public DQMEDAnalyzer {
virtual void analyze(const edm::Event&, const edm::EventSetup&);
virtual void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;

void setBinLabelAndTitle(TH2F* hist, int module = 0);
void setBinLabelAndTitle2D(TH2F* hist, int module = 0);
void setBinLabelAndTitle1D(TH1F* hist, std::string xlabel);

std::pair<int, int> getModuleVfat(int ieta, int strip);

Expand Down