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 
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void bookMEs(DQMStore::IBooker &ibooker_)
book MEs
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * effPtPhiHighPt
MonitorElement * effCompatibleLayers
virtual TH2F * getTH2F() const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
~TrackEfficiencyClient() override
Destructor.
void beginJob(void) override
BeginJob.
Log< level::Info, false > LogInfo
void dqmEndJob(DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_) override
EndJob.
virtual TH1F * getTH1F() const
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:212
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
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(const edm::ParameterSet &ps)
Constructor.
Definition: Run.h:45
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup) override
BeginRun.
MonitorElement * effPtPhiLowPt
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:739