File indexing completed on 2024-04-06 12:09:08
0001
0002
0003
0004
0005
0006
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 #include "FWCore/ServiceRegistry/interface/Service.h"
0009 #include "FWCore/ParameterSet/interface/FileInPath.h"
0010 #include "DQM/TrackingMonitor/interface/TrackEfficiencyClient.h"
0011
0012
0013 TrackEfficiencyClient::TrackEfficiencyClient(edm::ParameterSet const& iConfig)
0014
0015 {
0016 edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::Deleting TrackEfficiencyClient ";
0017
0018 FolderName_ = iConfig.getParameter<std::string>("FolderName");
0019 algoName_ = iConfig.getParameter<std::string>("AlgoName");
0020 trackEfficiency_ = iConfig.getParameter<bool>("trackEfficiency");
0021
0022 conf_ = iConfig;
0023 }
0024
0025
0026 TrackEfficiencyClient::~TrackEfficiencyClient()
0027
0028 {
0029 edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::Deleting TrackEfficiencyClient ";
0030 }
0031
0032
0033 void TrackEfficiencyClient::beginJob(void)
0034
0035 {
0036 edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::beginJob done";
0037 }
0038
0039
0040 void TrackEfficiencyClient::beginRun(edm::Run const& run, edm::EventSetup const& eSetup)
0041
0042 {
0043 edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient:: Begining of Run";
0044 }
0045
0046
0047 void TrackEfficiencyClient::bookMEs(DQMStore::IBooker& ibooker_)
0048
0049 {
0050 ibooker_.setCurrentFolder(FolderName_);
0051
0052
0053 int effXBin = conf_.getParameter<int>("effXBin");
0054 double effXMin = conf_.getParameter<double>("effXMin");
0055 double effXMax = conf_.getParameter<double>("effXMax");
0056
0057 histName = "effX_";
0058 effX = ibooker_.book1D(histName + algoName_, histName + algoName_, effXBin, effXMin, effXMax);
0059 if (effX->getTH1F())
0060 effX->enableSumw2();
0061 effX->setAxisTitle("");
0062
0063
0064 int effYBin = conf_.getParameter<int>("effYBin");
0065 double effYMin = conf_.getParameter<double>("effYMin");
0066 double effYMax = conf_.getParameter<double>("effYMax");
0067
0068 histName = "effY_";
0069 effY = ibooker_.book1D(histName + algoName_, histName + algoName_, effYBin, effYMin, effYMax);
0070 if (effY->getTH1F())
0071 effY->enableSumw2();
0072 effY->setAxisTitle("");
0073
0074
0075 int effZBin = conf_.getParameter<int>("effZBin");
0076 double effZMin = conf_.getParameter<double>("effZMin");
0077 double effZMax = conf_.getParameter<double>("effZMax");
0078
0079 histName = "effZ_";
0080 effZ = ibooker_.book1D(histName + algoName_, histName + algoName_, effZBin, effZMin, effZMax);
0081 if (effZ->getTH1F())
0082 effZ->enableSumw2();
0083 effZ->setAxisTitle("");
0084
0085
0086 int effEtaBin = conf_.getParameter<int>("effEtaBin");
0087 double effEtaMin = conf_.getParameter<double>("effEtaMin");
0088 double effEtaMax = conf_.getParameter<double>("effEtaMax");
0089
0090 histName = "effEta_";
0091 effEta = ibooker_.book1D(histName + algoName_, histName + algoName_, effEtaBin, effEtaMin, effEtaMax);
0092 if (effEta->getTH1F())
0093 effEta->enableSumw2();
0094 effEta->setAxisTitle("");
0095
0096
0097 int effPhiBin = conf_.getParameter<int>("effPhiBin");
0098 double effPhiMin = conf_.getParameter<double>("effPhiMin");
0099 double effPhiMax = conf_.getParameter<double>("effPhiMax");
0100
0101 histName = "effPhi_";
0102 effPhi = ibooker_.book1D(histName + algoName_, histName + algoName_, effPhiBin, effPhiMin, effPhiMax);
0103 if (effPhi->getTH1F())
0104 effPhi->enableSumw2();
0105 effPhi->setAxisTitle("");
0106
0107
0108 int effD0Bin = conf_.getParameter<int>("effD0Bin");
0109 double effD0Min = conf_.getParameter<double>("effD0Min");
0110 double effD0Max = conf_.getParameter<double>("effD0Max");
0111
0112 histName = "effD0_";
0113 effD0 = ibooker_.book1D(histName + algoName_, histName + algoName_, effD0Bin, effD0Min, effD0Max);
0114 if (effD0->getTH1F())
0115 effD0->enableSumw2();
0116 effD0->setAxisTitle("");
0117
0118
0119 int effCompatibleLayersBin = conf_.getParameter<int>("effCompatibleLayersBin");
0120 double effCompatibleLayersMin = conf_.getParameter<double>("effCompatibleLayersMin");
0121 double effCompatibleLayersMax = conf_.getParameter<double>("effCompatibleLayersMax");
0122
0123 histName = "effCompatibleLayers_";
0124 effCompatibleLayers = ibooker_.book1D(histName + algoName_,
0125 histName + algoName_,
0126 effCompatibleLayersBin,
0127 effCompatibleLayersMin,
0128 effCompatibleLayersMax);
0129 if (effCompatibleLayers->getTH1F())
0130 effCompatibleLayers->enableSumw2();
0131 effCompatibleLayers->setAxisTitle("");
0132
0133 histName = "MuonEffPtPhi_LowPt";
0134 effPtPhiLowPt = ibooker_.book2D(histName + algoName_, histName + algoName_, 20, -2.4, 2.4, 20, -3.25, 3.25);
0135 if (effPtPhiLowPt->getTH2F())
0136 effPtPhiLowPt->enableSumw2();
0137 effPtPhiLowPt->setAxisTitle("");
0138
0139 histName = "MuonEffPtPhi_HighPt";
0140 effPtPhiHighPt = ibooker_.book2D(histName + algoName_, histName + algoName_, 20, -2.4, 2.4, 20, -3.25, 3.25);
0141 if (effPtPhiHighPt->getTH2F())
0142 effPtPhiHighPt->enableSumw2();
0143 effPtPhiHighPt->setAxisTitle("");
0144 }
0145
0146
0147 void TrackEfficiencyClient::dqmEndJob(DQMStore::IBooker& ibooker_, DQMStore::IGetter& igetter_)
0148
0149 {
0150 edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::endLuminosityBlock";
0151
0152 bookMEs(ibooker_);
0153 FolderName_ = "Tracking/TrackParameters/TrackEfficiency";
0154 std::vector<std::string> s1 = igetter_.getSubdirs();
0155
0156 igetter_.cd("Tracking");
0157
0158 histName = "/trackX_";
0159 MonitorElement* trackX = igetter_.get(FolderName_ + histName + algoName_);
0160
0161 histName = "/muonX_";
0162 MonitorElement* muonX = igetter_.get(FolderName_ + histName + algoName_);
0163
0164 histName = "/trackY_";
0165 MonitorElement* trackY = igetter_.get(FolderName_ + histName + algoName_);
0166 histName = "/muonY_";
0167 MonitorElement* muonY = igetter_.get(FolderName_ + histName + algoName_);
0168
0169 histName = "/trackZ_";
0170 MonitorElement* trackZ = igetter_.get(FolderName_ + histName + algoName_);
0171 histName = "/muonZ_";
0172 MonitorElement* muonZ = igetter_.get(FolderName_ + histName + algoName_);
0173
0174 histName = "/trackEta_";
0175 MonitorElement* trackEta = igetter_.get(FolderName_ + histName + algoName_);
0176 histName = "/muonEta_";
0177 MonitorElement* muonEta = igetter_.get(FolderName_ + histName + algoName_);
0178
0179 histName = "/trackPhi_";
0180 MonitorElement* trackPhi = igetter_.get(FolderName_ + histName + algoName_);
0181 histName = "/muonPhi_";
0182 MonitorElement* muonPhi = igetter_.get(FolderName_ + histName + algoName_);
0183
0184 histName = "/trackD0_";
0185 MonitorElement* trackD0 = igetter_.get(FolderName_ + histName + algoName_);
0186 histName = "/muonD0_";
0187 MonitorElement* muonD0 = igetter_.get(FolderName_ + histName + algoName_);
0188
0189 histName = "/trackCompatibleLayers_";
0190 MonitorElement* trackCompatibleLayers = igetter_.get(FolderName_ + histName + algoName_);
0191 histName = "/muonCompatibleLayers_";
0192 MonitorElement* muonCompatibleLayers = igetter_.get(FolderName_ + histName + algoName_);
0193
0194 histName = "/StandaloneMuonPtEtaPhi_LowPt_";
0195 MonitorElement* StandAloneMuonPtEtaPhiLowPt = igetter_.get(FolderName_ + histName + algoName_);
0196 histName = "/GlobalMuonPtEtaPhi_LowPt_";
0197 MonitorElement* GlobalMuonPtEtaPhiLowPt = igetter_.get(FolderName_ + histName + algoName_);
0198
0199 histName = "/StandaloneMuonPtEtaPhi_HighPt_";
0200 MonitorElement* StandAloneMuonPtEtaPhiHighPt = igetter_.get(FolderName_ + histName + algoName_);
0201 histName = "/GlobalMuonPtEtaPhi_HighPt_";
0202 MonitorElement* GlobalMuonPtEtaPhiHighPt = igetter_.get(FolderName_ + histName + algoName_);
0203
0204 if (StandAloneMuonPtEtaPhiLowPt && GlobalMuonPtEtaPhiLowPt && effPtPhiLowPt) {
0205 if (StandAloneMuonPtEtaPhiLowPt->getTH2F() && GlobalMuonPtEtaPhiLowPt->getTH2F() && effPtPhiLowPt->getTH2F()) {
0206 effPtPhiLowPt->getTH2F()->Divide(
0207 GlobalMuonPtEtaPhiLowPt->getTH2F(), StandAloneMuonPtEtaPhiLowPt->getTH2F(), 1., 1., "");
0208 }
0209 }
0210 if (StandAloneMuonPtEtaPhiHighPt && GlobalMuonPtEtaPhiHighPt && effPtPhiHighPt) {
0211 if (StandAloneMuonPtEtaPhiHighPt->getTH2F() && GlobalMuonPtEtaPhiHighPt->getTH2F() && effPtPhiHighPt->getTH2F()) {
0212 effPtPhiHighPt->getTH2F()->Divide(
0213 GlobalMuonPtEtaPhiHighPt->getTH2F(), StandAloneMuonPtEtaPhiHighPt->getTH2F(), 1., 1., "");
0214 }
0215 }
0216 if (trackX && muonX && trackY && muonY && trackZ && muonZ && trackEta && muonEta && trackPhi && muonPhi && trackD0 &&
0217 muonD0 && trackCompatibleLayers && muonCompatibleLayers) {
0218
0219 if (trackEfficiency_) {
0220 if (effX->getTH1F() && trackX->getTH1F() && muonX->getTH1F()) {
0221 effX->getTH1F()->Divide(trackX->getTH1F(), muonX->getTH1F(), 1., 1., "");
0222 }
0223 if (effY->getTH1F() && trackY->getTH1F() && muonY->getTH1F()) {
0224 effY->getTH1F()->Divide(trackY->getTH1F(), muonY->getTH1F(), 1., 1., "");
0225 }
0226 if (effZ->getTH1F() && trackZ->getTH1F() && muonZ->getTH1F()) {
0227 effZ->getTH1F()->Divide(trackZ->getTH1F(), muonZ->getTH1F(), 1., 1., "");
0228 }
0229 if (effEta->getTH1F() && trackEta->getTH1F() && muonEta->getTH1F()) {
0230 effEta->getTH1F()->Divide(trackEta->getTH1F(), muonEta->getTH1F(), 1., 1., "");
0231 }
0232 if (effPhi->getTH1F() && trackPhi->getTH1F() && muonPhi->getTH1F()) {
0233 effPhi->getTH1F()->Divide(trackPhi->getTH1F(), muonPhi->getTH1F(), 1., 1., "");
0234 }
0235 if (effD0->getTH1F() && trackD0->getTH1F() && muonD0->getTH1F()) {
0236 effD0->getTH1F()->Divide(trackD0->getTH1F(), muonD0->getTH1F(), 1., 1., "");
0237 }
0238 if (effCompatibleLayers->getTH1F() && trackCompatibleLayers->getTH1F() && muonCompatibleLayers->getTH1F()) {
0239 effCompatibleLayers->getTH1F()->Divide(
0240 trackCompatibleLayers->getTH1F(), muonCompatibleLayers->getTH1F(), 1., 1., "");
0241 }
0242 } else {
0243 if (effX->getTH1F() && trackX->getTH1F() && muonX->getTH1F()) {
0244 effX->getTH1F()->Divide(muonX->getTH1F(), trackX->getTH1F(), 1., 1., "");
0245 }
0246 if (effY->getTH1F() && trackY->getTH1F() && muonY->getTH1F()) {
0247 effY->getTH1F()->Divide(muonY->getTH1F(), trackY->getTH1F(), 1., 1., "");
0248 }
0249 if (effZ->getTH1F() && trackZ->getTH1F() && muonZ->getTH1F()) {
0250 effZ->getTH1F()->Divide(muonZ->getTH1F(), trackZ->getTH1F(), 1., 1., "");
0251 }
0252 if (effEta->getTH1F() && trackEta->getTH1F() && muonEta->getTH1F()) {
0253 effEta->getTH1F()->Divide(muonEta->getTH1F(), trackEta->getTH1F(), 1., 1., "");
0254 }
0255 if (effPhi->getTH1F() && trackPhi->getTH1F() && muonPhi->getTH1F()) {
0256 effPhi->getTH1F()->Divide(muonPhi->getTH1F(), trackPhi->getTH1F(), 1., 1., "");
0257 }
0258 if (effD0->getTH1F() && trackD0->getTH1F() && muonD0->getTH1F()) {
0259 effD0->getTH1F()->Divide(muonD0->getTH1F(), trackD0->getTH1F(), 1., 1., "");
0260 }
0261 }
0262 }
0263 }
0264
0265 DEFINE_FWK_MODULE(TrackEfficiencyClient);