File indexing completed on 2024-04-06 12:09:42
0001
0002
0003
0004
0005
0006
0007
0008 #include <DQMOffline/Muon/interface/MuonTrackResidualsTest.h>
0009
0010
0011 #include <FWCore/Framework/interface/Event.h>
0012 #include "DataFormats/Common/interface/Handle.h"
0013 #include <FWCore/Framework/interface/ESHandle.h>
0014 #include <FWCore/Framework/interface/MakerMacros.h>
0015 #include <FWCore/Framework/interface/EventSetup.h>
0016 #include <FWCore/ParameterSet/interface/ParameterSet.h>
0017
0018 #include "DQMServices/Core/interface/DQMStore.h"
0019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0020 #include "FWCore/Framework/interface/Run.h"
0021
0022 #include <iostream>
0023 #include <cstdio>
0024 #include <string>
0025 #include <cmath>
0026 #include "TF1.h"
0027
0028 using namespace edm;
0029 using namespace std;
0030
0031 MuonTrackResidualsTest::MuonTrackResidualsTest(const edm::ParameterSet& ps) {
0032 parameters = ps;
0033
0034 prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1);
0035
0036 GaussianCriterionName =
0037 parameters.getUntrackedParameter<string>("resDistributionTestName", "ResidualsDistributionGaussianTest");
0038 SigmaCriterionName = parameters.getUntrackedParameter<string>("sigmaTestName", "ResidualsSigmaInRange");
0039 MeanCriterionName = parameters.getUntrackedParameter<string>("meanTestName", "ResidualsMeanInRange");
0040 }
0041 void MuonTrackResidualsTest::dqmEndRun(DQMStore::IBooker& ibooker,
0042 DQMStore::IGetter& igetter,
0043 edm::Run const&,
0044 edm::EventSetup const&) {
0045
0046
0047
0048 ibooker.setCurrentFolder("Muons/Tests/trackResidualsTest");
0049
0050 string histName, MeanHistoName, SigmaHistoName, MeanHistoTitle, SigmaHistoTitle;
0051 vector<string> type;
0052 type.push_back("eta");
0053 type.push_back("theta");
0054 type.push_back("phi");
0055
0056 for (unsigned int c = 0; c < type.size(); c++) {
0057 MeanHistoName = "MeanTest_" + type[c];
0058 SigmaHistoName = "SigmaTest_" + type[c];
0059
0060 MeanHistoTitle = "Mean of the #" + type[c] + " residuals distribution";
0061 SigmaHistoTitle = "Sigma of the #" + type[c] + " residuals distribution";
0062
0063 histName = "Res_GlbSta_" + type[c];
0064 histoNames[type[c]].push_back(histName);
0065 histName = "Res_TkGlb_" + type[c];
0066 histoNames[type[c]].push_back(histName);
0067 histName = "Res_TkSta_" + type[c];
0068 histoNames[type[c]].push_back(histName);
0069
0070 MeanHistos[type[c]] = ibooker.book1D(MeanHistoName.c_str(), MeanHistoTitle.c_str(), 3, 0.5, 3.5);
0071 (MeanHistos[type[c]])->setBinLabel(1, "Res_StaGlb", 1);
0072 (MeanHistos[type[c]])->setBinLabel(2, "Res_TkGlb", 1);
0073 (MeanHistos[type[c]])->setBinLabel(3, "Res_TkSta", 1);
0074
0075 SigmaHistos[type[c]] = ibooker.book1D(SigmaHistoName.c_str(), SigmaHistoTitle.c_str(), 3, 0.5, 3.5);
0076 (SigmaHistos[type[c]])->setBinLabel(1, "Res_StaGlb", 1);
0077 (SigmaHistos[type[c]])->setBinLabel(2, "Res_TkGlb", 1);
0078 (SigmaHistos[type[c]])->setBinLabel(3, "Res_TkSta", 1);
0079 }
0080
0081
0082
0083
0084 for (map<string, vector<string> >::const_iterator histo = histoNames.begin(); histo != histoNames.end(); histo++) {
0085 for (unsigned int type = 0; type < (*histo).second.size(); type++) {
0086 string path = "Muons/MuonRecoAnalyzer/" + (*histo).second[type];
0087 MonitorElement* res_histo = igetter.get(path);
0088 if (res_histo) {
0089
0090
0091 int BinNumber = type + 1;
0092 float mean = (*res_histo).getMean(1);
0093 float sigma = (*res_histo).getRMS(1);
0094 MeanHistos.find((*histo).first)->second->setBinContent(BinNumber, mean);
0095 SigmaHistos.find((*histo).first)->second->setBinContent(BinNumber, sigma);
0096 }
0097 }
0098 }
0099 }