CMS 3D CMS Logo

TrackEfficiencyClient.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Anne-Catherine Le Bihan
5  */
6 
8 
13 
16 
17 #include <iostream>
18 #include <iomanip>
19 #include <cstdio>
20 #include <string>
21 #include <sstream>
22 #include <cmath>
23 
24 //-----------------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------------
27 {
28  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::Deleting TrackEfficiencyClient ";
29 
30  FolderName_ = iConfig.getParameter<std::string>("FolderName");
31  algoName_ = iConfig.getParameter<std::string>("AlgoName");
32  trackEfficiency_ = iConfig.getParameter<bool>("trackEfficiency");
33 
34  conf_ = iConfig;
35 }
36 
37 //-----------------------------------------------------------------------------------
39 //-----------------------------------------------------------------------------------
40 {
41  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::Deleting TrackEfficiencyClient ";
42 }
43 
44 //-----------------------------------------------------------------------------------
46 //-----------------------------------------------------------------------------------
47 {
48  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::beginJob done";
49 }
50 
51 //-----------------------------------------------------------------------------------
53 //-----------------------------------------------------------------------------------
54 {
55  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient:: Begining of Run";
56 }
57 
58 //-----------------------------------------------------------------------------------
60 //-----------------------------------------------------------------------------------
61 {
62  ibooker_.setCurrentFolder(FolderName_);
63 
64  //
65  int effXBin = conf_.getParameter<int>("effXBin");
66  double effXMin = conf_.getParameter<double>("effXMin");
67  double effXMax = conf_.getParameter<double>("effXMax");
68 
69  histName = "effX_";
71  if (effX->getTH1F())
72  effX->enableSumw2();
73  effX->setAxisTitle("");
74 
75  //
76  int effYBin = conf_.getParameter<int>("effYBin");
77  double effYMin = conf_.getParameter<double>("effYMin");
78  double effYMax = conf_.getParameter<double>("effYMax");
79 
80  histName = "effY_";
82  if (effY->getTH1F())
83  effY->enableSumw2();
84  effY->setAxisTitle("");
85 
86  //
87  int effZBin = conf_.getParameter<int>("effZBin");
88  double effZMin = conf_.getParameter<double>("effZMin");
89  double effZMax = conf_.getParameter<double>("effZMax");
90 
91  histName = "effZ_";
93  if (effZ->getTH1F())
94  effZ->enableSumw2();
95  effZ->setAxisTitle("");
96 
97  //
98  int effEtaBin = conf_.getParameter<int>("effEtaBin");
99  double effEtaMin = conf_.getParameter<double>("effEtaMin");
100  double effEtaMax = conf_.getParameter<double>("effEtaMax");
101 
102  histName = "effEta_";
104  if (effEta->getTH1F())
105  effEta->enableSumw2();
106  effEta->setAxisTitle("");
107 
108  //
109  int effPhiBin = conf_.getParameter<int>("effPhiBin");
110  double effPhiMin = conf_.getParameter<double>("effPhiMin");
111  double effPhiMax = conf_.getParameter<double>("effPhiMax");
112 
113  histName = "effPhi_";
115  if (effPhi->getTH1F())
116  effPhi->enableSumw2();
117  effPhi->setAxisTitle("");
118 
119  //
120  int effD0Bin = conf_.getParameter<int>("effD0Bin");
121  double effD0Min = conf_.getParameter<double>("effD0Min");
122  double effD0Max = conf_.getParameter<double>("effD0Max");
123 
124  histName = "effD0_";
126  if (effD0->getTH1F())
127  effD0->enableSumw2();
128  effD0->setAxisTitle("");
129 
130  //
131  int effCompatibleLayersBin = conf_.getParameter<int>("effCompatibleLayersBin");
132  double effCompatibleLayersMin = conf_.getParameter<double>("effCompatibleLayersMin");
133  double effCompatibleLayersMax = conf_.getParameter<double>("effCompatibleLayersMax");
134 
135  histName = "effCompatibleLayers_";
144 
145  histName = "MuonEffPtPhi_LowPt";
146  effPtPhiLowPt = ibooker_.book2D(histName + algoName_, histName + algoName_, 20, -2.4, 2.4, 20, -3.25, 3.25);
147  if (effPtPhiLowPt->getTH2F())
150 
151  histName = "MuonEffPtPhi_HighPt";
152  effPtPhiHighPt = ibooker_.book2D(histName + algoName_, histName + algoName_, 20, -2.4, 2.4, 20, -3.25, 3.25);
153  if (effPtPhiHighPt->getTH2F())
156 }
157 
158 //-----------------------------------------------------------------------------------
160 //-----------------------------------------------------------------------------------
161 {
162  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::endLuminosityBlock";
163 
164  bookMEs(ibooker_);
165  FolderName_ = "Tracking/TrackParameters/TrackEfficiency";
166  std::vector<std::string> s1 = igetter_.getSubdirs();
167 
168  igetter_.cd("Tracking");
169 
170  histName = "/trackX_";
171  MonitorElement* trackX = igetter_.get(FolderName_ + histName + algoName_);
172 
173  histName = "/muonX_";
174  MonitorElement* muonX = igetter_.get(FolderName_ + histName + algoName_);
175 
176  histName = "/trackY_";
177  MonitorElement* trackY = igetter_.get(FolderName_ + histName + algoName_);
178  histName = "/muonY_";
179  MonitorElement* muonY = igetter_.get(FolderName_ + histName + algoName_);
180 
181  histName = "/trackZ_";
182  MonitorElement* trackZ = igetter_.get(FolderName_ + histName + algoName_);
183  histName = "/muonZ_";
184  MonitorElement* muonZ = igetter_.get(FolderName_ + histName + algoName_);
185 
186  histName = "/trackEta_";
188  histName = "/muonEta_";
190 
191  histName = "/trackPhi_";
193  histName = "/muonPhi_";
195 
196  histName = "/trackD0_";
197  MonitorElement* trackD0 = igetter_.get(FolderName_ + histName + algoName_);
198  histName = "/muonD0_";
199  MonitorElement* muonD0 = igetter_.get(FolderName_ + histName + algoName_);
200 
201  histName = "/trackCompatibleLayers_";
202  MonitorElement* trackCompatibleLayers = igetter_.get(FolderName_ + histName + algoName_);
203  histName = "/muonCompatibleLayers_";
204  MonitorElement* muonCompatibleLayers = igetter_.get(FolderName_ + histName + algoName_);
205 
206  histName = "/StandaloneMuonPtEtaPhi_LowPt_";
207  MonitorElement* StandAloneMuonPtEtaPhiLowPt = igetter_.get(FolderName_ + histName + algoName_);
208  histName = "/GlobalMuonPtEtaPhi_LowPt_";
209  MonitorElement* GlobalMuonPtEtaPhiLowPt = igetter_.get(FolderName_ + histName + algoName_);
210 
211  histName = "/StandaloneMuonPtEtaPhi_HighPt_";
212  MonitorElement* StandAloneMuonPtEtaPhiHighPt = igetter_.get(FolderName_ + histName + algoName_);
213  histName = "/GlobalMuonPtEtaPhi_HighPt_";
214  MonitorElement* GlobalMuonPtEtaPhiHighPt = igetter_.get(FolderName_ + histName + algoName_);
215 
216  if (StandAloneMuonPtEtaPhiLowPt && GlobalMuonPtEtaPhiLowPt && effPtPhiLowPt) {
217  if (StandAloneMuonPtEtaPhiLowPt->getTH2F() && GlobalMuonPtEtaPhiLowPt->getTH2F() && effPtPhiLowPt->getTH2F()) {
218  effPtPhiLowPt->getTH2F()->Divide(
219  GlobalMuonPtEtaPhiLowPt->getTH2F(), StandAloneMuonPtEtaPhiLowPt->getTH2F(), 1., 1., "");
220  }
221  }
222  if (StandAloneMuonPtEtaPhiHighPt && GlobalMuonPtEtaPhiHighPt && effPtPhiHighPt) {
223  if (StandAloneMuonPtEtaPhiHighPt->getTH2F() && GlobalMuonPtEtaPhiHighPt->getTH2F() && effPtPhiHighPt->getTH2F()) {
224  effPtPhiHighPt->getTH2F()->Divide(
225  GlobalMuonPtEtaPhiHighPt->getTH2F(), StandAloneMuonPtEtaPhiHighPt->getTH2F(), 1., 1., "");
226  }
227  }
228  if (trackX && muonX && trackY && muonY && trackZ && muonZ && trackEta && muonEta && trackPhi && muonPhi && trackD0 &&
229  muonD0 && trackCompatibleLayers && muonCompatibleLayers) { // && StandAloneMuonPtEtaPhi && GlobalMuonPtEtaPhi){
230 
231  if (trackEfficiency_) {
232  if (effX->getTH1F() && trackX->getTH1F() && muonX->getTH1F()) {
233  effX->getTH1F()->Divide(trackX->getTH1F(), muonX->getTH1F(), 1., 1., "");
234  }
235  if (effY->getTH1F() && trackY->getTH1F() && muonY->getTH1F()) {
236  effY->getTH1F()->Divide(trackY->getTH1F(), muonY->getTH1F(), 1., 1., "");
237  }
238  if (effZ->getTH1F() && trackZ->getTH1F() && muonZ->getTH1F()) {
239  effZ->getTH1F()->Divide(trackZ->getTH1F(), muonZ->getTH1F(), 1., 1., "");
240  }
241  if (effEta->getTH1F() && trackEta->getTH1F() && muonEta->getTH1F()) {
242  effEta->getTH1F()->Divide(trackEta->getTH1F(), muonEta->getTH1F(), 1., 1., "");
243  }
244  if (effPhi->getTH1F() && trackPhi->getTH1F() && muonPhi->getTH1F()) {
245  effPhi->getTH1F()->Divide(trackPhi->getTH1F(), muonPhi->getTH1F(), 1., 1., "");
246  }
247  if (effD0->getTH1F() && trackD0->getTH1F() && muonD0->getTH1F()) {
248  effD0->getTH1F()->Divide(trackD0->getTH1F(), muonD0->getTH1F(), 1., 1., "");
249  }
250  if (effCompatibleLayers->getTH1F() && trackCompatibleLayers->getTH1F() && muonCompatibleLayers->getTH1F()) {
251  effCompatibleLayers->getTH1F()->Divide(
252  trackCompatibleLayers->getTH1F(), muonCompatibleLayers->getTH1F(), 1., 1., "");
253  }
254  } else {
255  if (effX->getTH1F() && trackX->getTH1F() && muonX->getTH1F()) {
256  effX->getTH1F()->Divide(muonX->getTH1F(), trackX->getTH1F(), 1., 1., "");
257  }
258  if (effY->getTH1F() && trackY->getTH1F() && muonY->getTH1F()) {
259  effY->getTH1F()->Divide(muonY->getTH1F(), trackY->getTH1F(), 1., 1., "");
260  }
261  if (effZ->getTH1F() && trackZ->getTH1F() && muonZ->getTH1F()) {
262  effZ->getTH1F()->Divide(muonZ->getTH1F(), trackZ->getTH1F(), 1., 1., "");
263  }
264  if (effEta->getTH1F() && trackEta->getTH1F() && muonEta->getTH1F()) {
265  effEta->getTH1F()->Divide(muonEta->getTH1F(), trackEta->getTH1F(), 1., 1., "");
266  }
267  if (effPhi->getTH1F() && trackPhi->getTH1F() && muonPhi->getTH1F()) {
268  effPhi->getTH1F()->Divide(muonPhi->getTH1F(), trackPhi->getTH1F(), 1., 1., "");
269  }
270  if (effD0->getTH1F() && trackD0->getTH1F() && muonD0->getTH1F()) {
271  effD0->getTH1F()->Divide(muonD0->getTH1F(), trackD0->getTH1F(), 1., 1., "");
272  }
273  }
274  }
275 }
276 
TrackEfficiencyClient_cfi.effPhiMin
effPhiMin
Definition: TrackEfficiencyClient_cfi.py:32
TrackEfficiencyClient::histName
std::string histName
Definition: TrackEfficiencyClient.h:59
TrackEfficiencyClient::TrackEfficiencyClient
TrackEfficiencyClient(const edm::ParameterSet &ps)
Constructor.
Definition: TrackEfficiencyClient.cc:25
TrackEfficiencyClient_cfi.effCompatibleLayersBin
effCompatibleLayersBin
Definition: TrackEfficiencyClient_cfi.py:39
TrackEfficiencyClient_cfi.effXMin
effXMin
Definition: TrackEfficiencyClient_cfi.py:16
TrackEfficiencyClient::effPtPhiLowPt
MonitorElement * effPtPhiLowPt
Definition: TrackEfficiencyClient.h:70
TrackEfficiencyClient::effZ
MonitorElement * effZ
Definition: TrackEfficiencyClient.h:65
MessageLogger.h
TrackEfficiencyClient_cfi.effD0Min
effD0Min
Definition: TrackEfficiencyClient_cfi.py:36
TrackEfficiencyClient::FolderName_
std::string FolderName_
Definition: TrackEfficiencyClient.h:61
HLTObjectMonitor_cfi.muonEta
muonEta
Definition: HLTObjectMonitor_cfi.py:92
TrackEfficiencyClient_cfi.effYBin
effYBin
Definition: TrackEfficiencyClient_cfi.py:19
edm::Run
Definition: Run.h:45
LuminosityBlock.h
TrackEfficiencyClient::bookMEs
void bookMEs(DQMStore::IBooker &ibooker_)
book MEs
Definition: TrackEfficiencyClient.cc:59
TrackEfficiencyClient_cfi.effPhiBin
effPhiBin
Definition: TrackEfficiencyClient_cfi.py:31
TrackEfficiencyClient::effD0
MonitorElement * effD0
Definition: TrackEfficiencyClient.h:68
edm::LogInfo
Definition: MessageLogger.h:254
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DQMStore.h
dqm::implementation::IGetter::getSubdirs
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:678
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
reco::btau::trackEta
Definition: TaggingVariable.h:42
TrackEfficiencyClient::effCompatibleLayers
MonitorElement * effCompatibleLayers
Definition: TrackEfficiencyClient.h:69
dqm::legacy::MonitorElement::getTH1F
virtual TH1F * getTH1F() const
Definition: MonitorElement.h:478
TrackEfficiencyClient::dqmEndJob
void dqmEndJob(DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_) override
EndJob.
Definition: TrackEfficiencyClient.cc:159
FileInPath.h
TrackEfficiencyClient::trackEfficiency_
bool trackEfficiency_
Definition: TrackEfficiencyClient.h:56
TrackEfficiencyClient
Definition: TrackEfficiencyClient.h:32
TrackEfficiencyClient::beginRun
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup) override
BeginRun.
Definition: TrackEfficiencyClient.cc:52
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
TrackEfficiencyClient_cfi.effXMax
effXMax
Definition: TrackEfficiencyClient_cfi.py:17
Service.h
TrackEfficiencyClient_cfi.effCompatibleLayersMax
effCompatibleLayersMax
Definition: TrackEfficiencyClient_cfi.py:41
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
TrackEfficiencyClient_cfi.effZMax
effZMax
Definition: TrackEfficiencyClient_cfi.py:25
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackEfficiencyClient_cfi.effZBin
effZBin
Definition: TrackEfficiencyClient_cfi.py:23
TrackEfficiencyClient_cfi.effCompatibleLayersMin
effCompatibleLayersMin
Definition: TrackEfficiencyClient_cfi.py:40
edm::ParameterSet
Definition: ParameterSet.h:36
reco::btau::trackPhi
Definition: TaggingVariable.h:43
TrackEfficiencyClient::effPhi
MonitorElement * effPhi
Definition: TrackEfficiencyClient.h:67
HLTObjectMonitor_cfi.muonPhi
muonPhi
Definition: HLTObjectMonitor_cfi.py:102
TrackEfficiencyClient_cfi.effXBin
effXBin
Definition: TrackEfficiencyClient_cfi.py:15
TrackEfficiencyClient.h
TrackEfficiencyClient::effX
MonitorElement * effX
Definition: TrackEfficiencyClient.h:63
edm::EventSetup
Definition: EventSetup.h:57
TrackEfficiencyClient::beginJob
void beginJob(void) override
BeginJob.
Definition: TrackEfficiencyClient.cc:45
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TrackEfficiencyClient_cfi.effD0Max
effD0Max
Definition: TrackEfficiencyClient_cfi.py:37
TrackEfficiencyClient::effPtPhiHighPt
MonitorElement * effPtPhiHighPt
Definition: TrackEfficiencyClient.h:70
TrackEfficiencyClient::effY
MonitorElement * effY
Definition: TrackEfficiencyClient.h:64
writedatasetfile.run
run
Definition: writedatasetfile.py:27
TrackEfficiencyClient::effEta
MonitorElement * effEta
Definition: TrackEfficiencyClient.h:66
TrackEfficiencyClient_cfi.effEtaMax
effEtaMax
Definition: TrackEfficiencyClient_cfi.py:29
TrackEfficiencyClient_cfi.effZMin
effZMin
Definition: TrackEfficiencyClient_cfi.py:24
dqm::implementation::IGetter
Definition: DQMStore.h:484
TrackEfficiencyClient_cfi.effEtaBin
effEtaBin
Definition: TrackEfficiencyClient_cfi.py:27
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
TrackEfficiencyClient_cfi.effPhiMax
effPhiMax
Definition: TrackEfficiencyClient_cfi.py:33
TrackEfficiencyClient_cfi.effYMin
effYMin
Definition: TrackEfficiencyClient_cfi.py:20
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
TrackEfficiencyClient::conf_
edm::ParameterSet conf_
Definition: TrackEfficiencyClient.h:54
dqm::implementation::IBooker
Definition: DQMStore.h:43
TrackEfficiencyClient_cfi.effYMax
effYMax
Definition: TrackEfficiencyClient_cfi.py:21
ParameterSet.h
dqm::impl::MonitorElement::enableSumw2
virtual void enableSumw2()
Definition: MonitorElement.cc:872
TrackEfficiencyClient_cfi.effD0Bin
effD0Bin
Definition: TrackEfficiencyClient_cfi.py:35
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
TrackEfficiencyClient::~TrackEfficiencyClient
~TrackEfficiencyClient() override
Destructor.
Definition: TrackEfficiencyClient.cc:38
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
TrackEfficiencyClient::algoName_
std::string algoName_
Definition: TrackEfficiencyClient.h:60
TrackEfficiencyClient_cfi.effEtaMin
effEtaMin
Definition: TrackEfficiencyClient_cfi.py:28
dqm::legacy::MonitorElement::getTH2F
virtual TH2F * getTH2F() const
Definition: MonitorElement.h:490