00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010
00011 #include "FWCore/Framework/interface/LuminosityBlock.h"
00012 #include "FWCore/ServiceRegistry/interface/Service.h"
00013 #include "FWCore/ParameterSet/interface/FileInPath.h"
00014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00015
00016 #include "DQMServices/Core/interface/DQMStore.h"
00017
00018 #include "DQM/TrackingMonitor/plugins/TrackEfficiencyClient.h"
00019 #include "DQMServices/Core/interface/MonitorElement.h"
00020
00021 #include <iostream>
00022 #include <iomanip>
00023 #include <stdio.h>
00024 #include <string>
00025 #include <sstream>
00026 #include <math.h>
00027
00028
00029 TrackEfficiencyClient::TrackEfficiencyClient(edm::ParameterSet const& iConfig)
00030
00031 {
00032 edm::LogInfo( "TrackEfficiencyClient") << "TrackEfficiencyClient::Deleting TrackEfficiencyClient ";
00033
00034
00035 dqmStore_ = edm::Service<DQMStore>().operator->();
00036
00037 FolderName_ = iConfig.getParameter<std::string>("FolderName");
00038 algoName_ = iConfig.getParameter<std::string>("AlgoName");
00039 trackEfficiency_ = iConfig.getParameter<bool>("trackEfficiency");
00040
00041 conf_ = iConfig;
00042 }
00043
00044
00045
00046 TrackEfficiencyClient::~TrackEfficiencyClient()
00047
00048 {
00049 edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::Deleting TrackEfficiencyClient ";
00050 }
00051
00052
00053
00054 void TrackEfficiencyClient::beginJob(void)
00055
00056 {
00057
00058 dqmStore_->setCurrentFolder(FolderName_);
00059
00060
00061 int effXBin = conf_.getParameter<int> ("effXBin");
00062 double effXMin = conf_.getParameter<double>("effXMin");
00063 double effXMax = conf_.getParameter<double>("effXMax");
00064
00065 histName = "effX_";
00066 effX = dqmStore_->book1D(histName+algoName_, histName+algoName_, effXBin, effXMin, effXMax);
00067 if (effX->getTH1F()) effX->getTH1F()->Sumw2();
00068 effX->setAxisTitle("");
00069
00070
00071
00072 int effYBin = conf_.getParameter<int> ("effYBin");
00073 double effYMin = conf_.getParameter<double>("effYMin");
00074 double effYMax = conf_.getParameter<double>("effYMax");
00075
00076 histName = "effY_";
00077 effY = dqmStore_->book1D(histName+algoName_, histName+algoName_, effYBin, effYMin, effYMax);
00078 if (effY->getTH1F()) effY->getTH1F()->Sumw2();
00079 effY->setAxisTitle("");
00080
00081
00082 int effZBin = conf_.getParameter<int> ("effZBin");
00083 double effZMin = conf_.getParameter<double>("effZMin");
00084 double effZMax = conf_.getParameter<double>("effZMax");
00085
00086 histName = "effZ_";
00087 effZ = dqmStore_->book1D(histName+algoName_, histName+algoName_, effZBin, effZMin, effZMax);
00088 if (effZ->getTH1F()) effZ->getTH1F()->Sumw2();
00089 effZ->setAxisTitle("");
00090
00091
00092 int effEtaBin = conf_.getParameter<int> ("effEtaBin");
00093 double effEtaMin = conf_.getParameter<double>("effEtaMin");
00094 double effEtaMax = conf_.getParameter<double>("effEtaMax");
00095
00096 histName = "effEta_";
00097 effEta = dqmStore_->book1D(histName+algoName_, histName+algoName_, effEtaBin, effEtaMin, effEtaMax);
00098 if (effEta->getTH1F()) effEta->getTH1F()->Sumw2();
00099 effEta->setAxisTitle("");
00100
00101
00102 int effPhiBin = conf_.getParameter<int> ("effPhiBin");
00103 double effPhiMin = conf_.getParameter<double>("effPhiMin");
00104 double effPhiMax = conf_.getParameter<double>("effPhiMax");
00105
00106 histName = "effPhi_";
00107 effPhi = dqmStore_->book1D(histName+algoName_, histName+algoName_, effPhiBin, effPhiMin, effPhiMax);
00108 if (effPhi->getTH1F()) effPhi->getTH1F()->Sumw2();
00109 effPhi->setAxisTitle("");
00110
00111
00112 int effD0Bin = conf_.getParameter<int> ("effD0Bin");
00113 double effD0Min = conf_.getParameter<double>("effD0Min");
00114 double effD0Max = conf_.getParameter<double>("effD0Max");
00115
00116 histName = "effD0_";
00117 effD0 = dqmStore_->book1D(histName+algoName_, histName+algoName_, effD0Bin, effD0Min, effD0Max);
00118 if (effD0->getTH1F()) effD0->getTH1F()->Sumw2();
00119 effD0->setAxisTitle("");
00120
00121
00122
00123 int effCompatibleLayersBin = conf_.getParameter<int> ("effCompatibleLayersBin");
00124 double effCompatibleLayersMin = conf_.getParameter<double>("effCompatibleLayersMin");
00125 double effCompatibleLayersMax = conf_.getParameter<double>("effCompatibleLayersMax");
00126
00127 histName = "effCompatibleLayers_";
00128 effCompatibleLayers = dqmStore_->book1D(histName+algoName_, histName+algoName_, effCompatibleLayersBin, effCompatibleLayersMin, effCompatibleLayersMax);
00129 if (effCompatibleLayers->getTH1F()) effCompatibleLayers->getTH1F()->Sumw2();
00130 effCompatibleLayers->setAxisTitle("");
00131
00132 edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::beginJob done";
00133 }
00134
00135
00136
00137 void TrackEfficiencyClient::beginRun(edm::Run const& run, edm::EventSetup const& eSetup)
00138
00139 {
00140 edm::LogInfo ("TrackEfficiencyClient") <<"TrackEfficiencyClient:: Begining of Run";
00141 }
00142
00143
00144
00145 void TrackEfficiencyClient::analyze(edm::Event const& e, edm::EventSetup const& eSetup)
00146
00147 {
00148 edm::LogInfo( "TrackEfficiencyClient") << "TrackEfficiencyClient::analyze";
00149 }
00150
00151
00152 void TrackEfficiencyClient::endJob()
00153
00154 {
00155 }
00156
00157
00158 void TrackEfficiencyClient::endRun()
00159
00160 {
00161 }
00162
00163
00164
00165 void TrackEfficiencyClient::endLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& eSetup)
00166
00167 {
00168 edm::LogInfo( "TrackEfficiencyClient") << "TrackEfficiencyClient::endLuminosityBlock";
00169
00170 histName = "/trackX_";
00171 MonitorElement* trackX = dqmStore_->get(FolderName_+histName+algoName_);
00172
00173 histName = "/muonX_";
00174 MonitorElement* muonX = dqmStore_->get(FolderName_+histName+algoName_);
00175
00176 histName = "/trackY_";
00177 MonitorElement* trackY = dqmStore_->get(FolderName_+histName+algoName_);
00178 histName = "/muonY_";
00179 MonitorElement* muonY = dqmStore_->get(FolderName_+histName+algoName_);
00180
00181 histName = "/trackZ_";
00182 MonitorElement* trackZ = dqmStore_->get(FolderName_+histName+algoName_);
00183 histName = "/muonZ_";
00184 MonitorElement* muonZ = dqmStore_->get(FolderName_+histName+algoName_);
00185
00186 histName = "/trackEta_";
00187 MonitorElement* trackEta = dqmStore_->get(FolderName_+histName+algoName_);
00188 histName = "/muonEta_";
00189 MonitorElement* muonEta = dqmStore_->get(FolderName_+histName+algoName_);
00190
00191 histName = "/trackPhi_";
00192 MonitorElement* trackPhi = dqmStore_->get(FolderName_+histName+algoName_);
00193 histName = "/muonPhi_";
00194 MonitorElement* muonPhi = dqmStore_->get(FolderName_+histName+algoName_);
00195
00196 histName = "/trackD0_";
00197 MonitorElement* trackD0 = dqmStore_->get(FolderName_+histName+algoName_);
00198 histName = "/muonD0_";
00199 MonitorElement* muonD0 = dqmStore_->get(FolderName_+histName+algoName_);
00200
00201 histName = "/trackCompatibleLayers_";
00202 MonitorElement* trackCompatibleLayers = dqmStore_->get(FolderName_+histName+algoName_);
00203 histName = "/muonCompatibleLayers_";
00204 MonitorElement* muonCompatibleLayers = dqmStore_->get(FolderName_+histName+algoName_);
00205
00206 if(trackX && muonX && trackY && muonY && trackZ && muonZ && trackEta && muonEta && trackPhi && muonPhi && trackD0 && muonD0 && trackCompatibleLayers && muonCompatibleLayers){
00207 if (trackEfficiency_)
00208 {
00209 if (effX ->getTH1F() && trackX ->getTH1F() && muonX ->getTH1F()) { effX -> getTH1F()->Divide(trackX->getTH1F(),muonX->getTH1F(),1.,1.,"");}
00210 if (effY ->getTH1F() && trackY ->getTH1F() && muonY ->getTH1F()) { effY -> getTH1F()->Divide(trackY->getTH1F(),muonY->getTH1F(),1.,1.,"");}
00211 if (effZ ->getTH1F() && trackZ ->getTH1F() && muonZ ->getTH1F()) { effZ -> getTH1F()->Divide(trackZ->getTH1F(),muonZ->getTH1F(),1.,1.,"");}
00212 if (effEta->getTH1F() && trackEta->getTH1F() && muonEta->getTH1F()) { effEta -> getTH1F()->Divide(trackEta->getTH1F(),muonEta->getTH1F(),1.,1.,"");}
00213 if (effPhi->getTH1F() && trackPhi->getTH1F() && muonPhi->getTH1F()) { effPhi -> getTH1F()->Divide(trackPhi->getTH1F(),muonPhi->getTH1F(),1.,1.,"");}
00214 if (effD0 ->getTH1F() && trackD0 ->getTH1F() && muonD0 ->getTH1F()) { effD0 -> getTH1F()->Divide(trackD0->getTH1F(),muonD0->getTH1F(),1.,1.,"");}
00215 if (effCompatibleLayers->getTH1F() && trackCompatibleLayers->getTH1F() && muonCompatibleLayers->getTH1F()) { effCompatibleLayers -> getTH1F()->Divide(trackCompatibleLayers->getTH1F(),muonCompatibleLayers->getTH1F(),1.,1.,"");}
00216 }
00217 else {
00218 if (effX ->getTH1F() && trackX ->getTH1F() && muonX ->getTH1F()) { effX -> getTH1F()->Divide(muonX->getTH1F(),trackX->getTH1F(),1.,1.,"");}
00219 if (effY ->getTH1F() && trackY ->getTH1F() && muonY ->getTH1F()) { effY -> getTH1F()->Divide(muonY->getTH1F(),trackY->getTH1F(),1.,1.,"");}
00220 if (effZ ->getTH1F() && trackZ ->getTH1F() && muonZ ->getTH1F()) { effZ -> getTH1F()->Divide(muonZ->getTH1F(),trackZ->getTH1F(),1.,1.,"");}
00221 if (effEta->getTH1F() && trackEta->getTH1F() && muonEta->getTH1F()) { effEta -> getTH1F()->Divide(muonEta->getTH1F(),trackEta->getTH1F(),1.,1.,"");}
00222 if (effPhi->getTH1F() && trackPhi->getTH1F() && muonPhi->getTH1F()) { effPhi -> getTH1F()->Divide(muonPhi->getTH1F(),trackPhi->getTH1F(),1.,1.,"");}
00223 if (effD0 ->getTH1F() && trackD0 ->getTH1F() && muonD0 ->getTH1F()) { effD0 -> getTH1F()->Divide(muonD0->getTH1F(),trackD0->getTH1F(),1.,1.,"");}
00224 }
00225 }
00226
00227 }
00228
00229
00230 DEFINE_FWK_MODULE(TrackEfficiencyClient);