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 
11 
12 //-----------------------------------------------------------------------------------
14 //-----------------------------------------------------------------------------------
15 {
16  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::Deleting TrackEfficiencyClient ";
17 
18  FolderName_ = iConfig.getParameter<std::string>("FolderName");
19  algoName_ = iConfig.getParameter<std::string>("AlgoName");
20  trackEfficiency_ = iConfig.getParameter<bool>("trackEfficiency");
21 
22  conf_ = iConfig;
23 }
24 
25 //-----------------------------------------------------------------------------------
27 //-----------------------------------------------------------------------------------
28 {
29  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::Deleting TrackEfficiencyClient ";
30 }
31 
32 //-----------------------------------------------------------------------------------
34 //-----------------------------------------------------------------------------------
35 {
36  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::beginJob done";
37 }
38 
39 //-----------------------------------------------------------------------------------
41 //-----------------------------------------------------------------------------------
42 {
43  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient:: Begining of Run";
44 }
45 
46 //-----------------------------------------------------------------------------------
48 //-----------------------------------------------------------------------------------
49 {
50  ibooker_.setCurrentFolder(FolderName_);
51 
52  //
53  int effXBin = conf_.getParameter<int>("effXBin");
54  double effXMin = conf_.getParameter<double>("effXMin");
55  double effXMax = conf_.getParameter<double>("effXMax");
56 
57  histName = "effX_";
59  if (effX->getTH1F())
60  effX->enableSumw2();
61  effX->setAxisTitle("");
62 
63  //
64  int effYBin = conf_.getParameter<int>("effYBin");
65  double effYMin = conf_.getParameter<double>("effYMin");
66  double effYMax = conf_.getParameter<double>("effYMax");
67 
68  histName = "effY_";
70  if (effY->getTH1F())
71  effY->enableSumw2();
72  effY->setAxisTitle("");
73 
74  //
75  int effZBin = conf_.getParameter<int>("effZBin");
76  double effZMin = conf_.getParameter<double>("effZMin");
77  double effZMax = conf_.getParameter<double>("effZMax");
78 
79  histName = "effZ_";
81  if (effZ->getTH1F())
82  effZ->enableSumw2();
83  effZ->setAxisTitle("");
84 
85  //
86  int effEtaBin = conf_.getParameter<int>("effEtaBin");
87  double effEtaMin = conf_.getParameter<double>("effEtaMin");
88  double effEtaMax = conf_.getParameter<double>("effEtaMax");
89 
90  histName = "effEta_";
92  if (effEta->getTH1F())
94  effEta->setAxisTitle("");
95 
96  //
97  int effPhiBin = conf_.getParameter<int>("effPhiBin");
98  double effPhiMin = conf_.getParameter<double>("effPhiMin");
99  double effPhiMax = conf_.getParameter<double>("effPhiMax");
100 
101  histName = "effPhi_";
103  if (effPhi->getTH1F())
104  effPhi->enableSumw2();
105  effPhi->setAxisTitle("");
106 
107  //
108  int effD0Bin = conf_.getParameter<int>("effD0Bin");
109  double effD0Min = conf_.getParameter<double>("effD0Min");
110  double effD0Max = conf_.getParameter<double>("effD0Max");
111 
112  histName = "effD0_";
114  if (effD0->getTH1F())
115  effD0->enableSumw2();
116  effD0->setAxisTitle("");
117 
118  //
119  int effCompatibleLayersBin = conf_.getParameter<int>("effCompatibleLayersBin");
120  double effCompatibleLayersMin = conf_.getParameter<double>("effCompatibleLayersMin");
121  double effCompatibleLayersMax = conf_.getParameter<double>("effCompatibleLayersMax");
122 
123  histName = "effCompatibleLayers_";
132 
133  histName = "MuonEffPtPhi_LowPt";
134  effPtPhiLowPt = ibooker_.book2D(histName + algoName_, histName + algoName_, 20, -2.4, 2.4, 20, -3.25, 3.25);
135  if (effPtPhiLowPt->getTH2F())
138 
139  histName = "MuonEffPtPhi_HighPt";
140  effPtPhiHighPt = ibooker_.book2D(histName + algoName_, histName + algoName_, 20, -2.4, 2.4, 20, -3.25, 3.25);
141  if (effPtPhiHighPt->getTH2F())
144 }
145 
146 //-----------------------------------------------------------------------------------
148 //-----------------------------------------------------------------------------------
149 {
150  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::endLuminosityBlock";
151 
152  bookMEs(ibooker_);
153  FolderName_ = "Tracking/TrackParameters/TrackEfficiency";
154  std::vector<std::string> s1 = igetter_.getSubdirs();
155 
156  igetter_.cd("Tracking");
157 
158  histName = "/trackX_";
159  MonitorElement* trackX = igetter_.get(FolderName_ + histName + algoName_);
160 
161  histName = "/muonX_";
162  MonitorElement* muonX = igetter_.get(FolderName_ + histName + algoName_);
163 
164  histName = "/trackY_";
165  MonitorElement* trackY = igetter_.get(FolderName_ + histName + algoName_);
166  histName = "/muonY_";
167  MonitorElement* muonY = igetter_.get(FolderName_ + histName + algoName_);
168 
169  histName = "/trackZ_";
170  MonitorElement* trackZ = igetter_.get(FolderName_ + histName + algoName_);
171  histName = "/muonZ_";
172  MonitorElement* muonZ = igetter_.get(FolderName_ + histName + algoName_);
173 
174  histName = "/trackEta_";
176  histName = "/muonEta_";
178 
179  histName = "/trackPhi_";
181  histName = "/muonPhi_";
183 
184  histName = "/trackD0_";
185  MonitorElement* trackD0 = igetter_.get(FolderName_ + histName + algoName_);
186  histName = "/muonD0_";
187  MonitorElement* muonD0 = igetter_.get(FolderName_ + histName + algoName_);
188 
189  histName = "/trackCompatibleLayers_";
190  MonitorElement* trackCompatibleLayers = igetter_.get(FolderName_ + histName + algoName_);
191  histName = "/muonCompatibleLayers_";
192  MonitorElement* muonCompatibleLayers = igetter_.get(FolderName_ + histName + algoName_);
193 
194  histName = "/StandaloneMuonPtEtaPhi_LowPt_";
195  MonitorElement* StandAloneMuonPtEtaPhiLowPt = igetter_.get(FolderName_ + histName + algoName_);
196  histName = "/GlobalMuonPtEtaPhi_LowPt_";
197  MonitorElement* GlobalMuonPtEtaPhiLowPt = igetter_.get(FolderName_ + histName + algoName_);
198 
199  histName = "/StandaloneMuonPtEtaPhi_HighPt_";
200  MonitorElement* StandAloneMuonPtEtaPhiHighPt = igetter_.get(FolderName_ + histName + algoName_);
201  histName = "/GlobalMuonPtEtaPhi_HighPt_";
202  MonitorElement* GlobalMuonPtEtaPhiHighPt = igetter_.get(FolderName_ + histName + algoName_);
203 
204  if (StandAloneMuonPtEtaPhiLowPt && GlobalMuonPtEtaPhiLowPt && effPtPhiLowPt) {
205  if (StandAloneMuonPtEtaPhiLowPt->getTH2F() && GlobalMuonPtEtaPhiLowPt->getTH2F() && effPtPhiLowPt->getTH2F()) {
206  effPtPhiLowPt->getTH2F()->Divide(
207  GlobalMuonPtEtaPhiLowPt->getTH2F(), StandAloneMuonPtEtaPhiLowPt->getTH2F(), 1., 1., "");
208  }
209  }
210  if (StandAloneMuonPtEtaPhiHighPt && GlobalMuonPtEtaPhiHighPt && effPtPhiHighPt) {
211  if (StandAloneMuonPtEtaPhiHighPt->getTH2F() && GlobalMuonPtEtaPhiHighPt->getTH2F() && effPtPhiHighPt->getTH2F()) {
212  effPtPhiHighPt->getTH2F()->Divide(
213  GlobalMuonPtEtaPhiHighPt->getTH2F(), StandAloneMuonPtEtaPhiHighPt->getTH2F(), 1., 1., "");
214  }
215  }
216  if (trackX && muonX && trackY && muonY && trackZ && muonZ && trackEta && muonEta && trackPhi && muonPhi && trackD0 &&
217  muonD0 && trackCompatibleLayers && muonCompatibleLayers) { // && StandAloneMuonPtEtaPhi && GlobalMuonPtEtaPhi){
218 
219  if (trackEfficiency_) {
220  if (effX->getTH1F() && trackX->getTH1F() && muonX->getTH1F()) {
221  effX->getTH1F()->Divide(trackX->getTH1F(), muonX->getTH1F(), 1., 1., "");
222  }
223  if (effY->getTH1F() && trackY->getTH1F() && muonY->getTH1F()) {
224  effY->getTH1F()->Divide(trackY->getTH1F(), muonY->getTH1F(), 1., 1., "");
225  }
226  if (effZ->getTH1F() && trackZ->getTH1F() && muonZ->getTH1F()) {
227  effZ->getTH1F()->Divide(trackZ->getTH1F(), muonZ->getTH1F(), 1., 1., "");
228  }
229  if (effEta->getTH1F() && trackEta->getTH1F() && muonEta->getTH1F()) {
230  effEta->getTH1F()->Divide(trackEta->getTH1F(), muonEta->getTH1F(), 1., 1., "");
231  }
232  if (effPhi->getTH1F() && trackPhi->getTH1F() && muonPhi->getTH1F()) {
233  effPhi->getTH1F()->Divide(trackPhi->getTH1F(), muonPhi->getTH1F(), 1., 1., "");
234  }
235  if (effD0->getTH1F() && trackD0->getTH1F() && muonD0->getTH1F()) {
236  effD0->getTH1F()->Divide(trackD0->getTH1F(), muonD0->getTH1F(), 1., 1., "");
237  }
238  if (effCompatibleLayers->getTH1F() && trackCompatibleLayers->getTH1F() && muonCompatibleLayers->getTH1F()) {
239  effCompatibleLayers->getTH1F()->Divide(
240  trackCompatibleLayers->getTH1F(), muonCompatibleLayers->getTH1F(), 1., 1., "");
241  }
242  } else {
243  if (effX->getTH1F() && trackX->getTH1F() && muonX->getTH1F()) {
244  effX->getTH1F()->Divide(muonX->getTH1F(), trackX->getTH1F(), 1., 1., "");
245  }
246  if (effY->getTH1F() && trackY->getTH1F() && muonY->getTH1F()) {
247  effY->getTH1F()->Divide(muonY->getTH1F(), trackY->getTH1F(), 1., 1., "");
248  }
249  if (effZ->getTH1F() && trackZ->getTH1F() && muonZ->getTH1F()) {
250  effZ->getTH1F()->Divide(muonZ->getTH1F(), trackZ->getTH1F(), 1., 1., "");
251  }
252  if (effEta->getTH1F() && trackEta->getTH1F() && muonEta->getTH1F()) {
253  effEta->getTH1F()->Divide(muonEta->getTH1F(), trackEta->getTH1F(), 1., 1., "");
254  }
255  if (effPhi->getTH1F() && trackPhi->getTH1F() && muonPhi->getTH1F()) {
256  effPhi->getTH1F()->Divide(muonPhi->getTH1F(), trackPhi->getTH1F(), 1., 1., "");
257  }
258  if (effD0->getTH1F() && trackD0->getTH1F() && muonD0->getTH1F()) {
259  effD0->getTH1F()->Divide(muonD0->getTH1F(), trackD0->getTH1F(), 1., 1., "");
260  }
261  }
262  }
263 }
264 
TrackEfficiencyClient_cfi.effPhiMin
effPhiMin
Definition: TrackEfficiencyClient_cfi.py:32
TrackEfficiencyClient::histName
std::string histName
Definition: TrackEfficiencyClient.h:55
TrackEfficiencyClient::TrackEfficiencyClient
TrackEfficiencyClient(const edm::ParameterSet &ps)
Constructor.
Definition: TrackEfficiencyClient.cc:13
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:66
TrackEfficiencyClient::effZ
MonitorElement * effZ
Definition: TrackEfficiencyClient.h:61
MessageLogger.h
TrackEfficiencyClient_cfi.effD0Min
effD0Min
Definition: TrackEfficiencyClient_cfi.py:36
TrackEfficiencyClient::FolderName_
std::string FolderName_
Definition: TrackEfficiencyClient.h:57
HLTObjectMonitor_cfi.muonEta
muonEta
Definition: HLTObjectMonitor_cfi.py:92
TrackEfficiencyClient_cfi.effYBin
effYBin
Definition: TrackEfficiencyClient_cfi.py:19
edm::Run
Definition: Run.h:45
TrackEfficiencyClient::bookMEs
void bookMEs(DQMStore::IBooker &ibooker_)
book MEs
Definition: TrackEfficiencyClient.cc:47
TrackEfficiencyClient_cfi.effPhiBin
effPhiBin
Definition: TrackEfficiencyClient_cfi.py:31
TrackEfficiencyClient::effD0
MonitorElement * effD0
Definition: TrackEfficiencyClient.h:64
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
dqm::implementation::IGetter::getSubdirs
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:700
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
reco::btau::trackEta
Definition: TaggingVariable.h:42
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
TrackEfficiencyClient::effCompatibleLayers
MonitorElement * effCompatibleLayers
Definition: TrackEfficiencyClient.h:65
dqm::legacy::MonitorElement::getTH1F
virtual TH1F * getTH1F() const
Definition: MonitorElement.h:479
TrackEfficiencyClient::dqmEndJob
void dqmEndJob(DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_) override
EndJob.
Definition: TrackEfficiencyClient.cc:147
TrackEfficiencyClient::trackEfficiency_
bool trackEfficiency_
Definition: TrackEfficiencyClient.h:52
TrackEfficiencyClient
Definition: TrackEfficiencyClient.h:28
TrackEfficiencyClient::beginRun
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup) override
BeginRun.
Definition: TrackEfficiencyClient.cc:40
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
FileInPath.h
TrackEfficiencyClient_cfi.effZBin
effZBin
Definition: TrackEfficiencyClient_cfi.py:23
TrackEfficiencyClient_cfi.effCompatibleLayersMin
effCompatibleLayersMin
Definition: TrackEfficiencyClient_cfi.py:40
edm::ParameterSet
Definition: ParameterSet.h:47
reco::btau::trackPhi
Definition: TaggingVariable.h:43
TrackEfficiencyClient::effPhi
MonitorElement * effPhi
Definition: TrackEfficiencyClient.h:63
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:59
edm::EventSetup
Definition: EventSetup.h:58
TrackEfficiencyClient::beginJob
void beginJob(void) override
BeginJob.
Definition: TrackEfficiencyClient.cc:33
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackEfficiencyClient_cfi.effD0Max
effD0Max
Definition: TrackEfficiencyClient_cfi.py:37
TrackEfficiencyClient::effPtPhiHighPt
MonitorElement * effPtPhiHighPt
Definition: TrackEfficiencyClient.h:66
TrackEfficiencyClient::effY
MonitorElement * effY
Definition: TrackEfficiencyClient.h:60
writedatasetfile.run
run
Definition: writedatasetfile.py:27
TrackEfficiencyClient::effEta
MonitorElement * effEta
Definition: TrackEfficiencyClient.h:62
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:673
TrackEfficiencyClient::conf_
edm::ParameterSet conf_
Definition: TrackEfficiencyClient.h:50
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm::implementation::IBooker
Definition: DQMStore.h:43
TrackEfficiencyClient_cfi.effYMax
effYMax
Definition: TrackEfficiencyClient_cfi.py:21
dqm::impl::MonitorElement::enableSumw2
virtual void enableSumw2()
Definition: MonitorElement.cc:863
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:791
TrackEfficiencyClient::~TrackEfficiencyClient
~TrackEfficiencyClient() override
Destructor.
Definition: TrackEfficiencyClient.cc:26
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:56
TrackEfficiencyClient_cfi.effEtaMin
effEtaMin
Definition: TrackEfficiencyClient_cfi.py:28
dqm::legacy::MonitorElement::getTH2F
virtual TH2F * getTH2F() const
Definition: MonitorElement.h:491