test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <stdio.h>
20 #include <string>
21 #include <sstream>
22 #include <math.h>
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 
38 //-----------------------------------------------------------------------------------
40 //-----------------------------------------------------------------------------------
41 {
42  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::Deleting TrackEfficiencyClient ";
43 }
44 
45 
46 //-----------------------------------------------------------------------------------
48 //-----------------------------------------------------------------------------------
49 {
50 
51  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::beginJob done";
52 }
53 
54 
55 //-----------------------------------------------------------------------------------
57 //-----------------------------------------------------------------------------------
58 {
59  edm::LogInfo ("TrackEfficiencyClient") <<"TrackEfficiencyClient:: Begining of Run";
60 }
61 
62 //-----------------------------------------------------------------------------------
64 //-----------------------------------------------------------------------------------
65 {
66 
67  ibooker_.setCurrentFolder(FolderName_);
68 
69  //
70  int effXBin = conf_.getParameter<int> ("effXBin");
71  double effXMin = conf_.getParameter<double>("effXMin");
72  double effXMax = conf_.getParameter<double>("effXMax");
73 
74  histName = "effX_";
75  effX = ibooker_.book1D(histName+algoName_, histName+algoName_, effXBin, effXMin, effXMax);
76  if (effX->getTH1F()) effX->getTH1F()->Sumw2();
77  effX->setAxisTitle("");
78 
79 
80  //
81  int effYBin = conf_.getParameter<int> ("effYBin");
82  double effYMin = conf_.getParameter<double>("effYMin");
83  double effYMax = conf_.getParameter<double>("effYMax");
84 
85  histName = "effY_";
86  effY = ibooker_.book1D(histName+algoName_, histName+algoName_, effYBin, effYMin, effYMax);
87  if (effY->getTH1F()) effY->getTH1F()->Sumw2();
88  effY->setAxisTitle("");
89 
90  //
91  int effZBin = conf_.getParameter<int> ("effZBin");
92  double effZMin = conf_.getParameter<double>("effZMin");
93  double effZMax = conf_.getParameter<double>("effZMax");
94 
95  histName = "effZ_";
96  effZ = ibooker_.book1D(histName+algoName_, histName+algoName_, effZBin, effZMin, effZMax);
97  if (effZ->getTH1F()) effZ->getTH1F()->Sumw2();
98  effZ->setAxisTitle("");
99 
100  //
101  int effEtaBin = conf_.getParameter<int> ("effEtaBin");
102  double effEtaMin = conf_.getParameter<double>("effEtaMin");
103  double effEtaMax = conf_.getParameter<double>("effEtaMax");
104 
105  histName = "effEta_";
106  effEta = ibooker_.book1D(histName+algoName_, histName+algoName_, effEtaBin, effEtaMin, effEtaMax);
107  if (effEta->getTH1F()) effEta->getTH1F()->Sumw2();
108  effEta->setAxisTitle("");
109 
110  //
111  int effPhiBin = conf_.getParameter<int> ("effPhiBin");
112  double effPhiMin = conf_.getParameter<double>("effPhiMin");
113  double effPhiMax = conf_.getParameter<double>("effPhiMax");
114 
115  histName = "effPhi_";
116  effPhi = ibooker_.book1D(histName+algoName_, histName+algoName_, effPhiBin, effPhiMin, effPhiMax);
117  if (effPhi->getTH1F()) effPhi->getTH1F()->Sumw2();
118  effPhi->setAxisTitle("");
119 
120  //
121  int effD0Bin = conf_.getParameter<int> ("effD0Bin");
122  double effD0Min = conf_.getParameter<double>("effD0Min");
123  double effD0Max = conf_.getParameter<double>("effD0Max");
124 
125  histName = "effD0_";
126  effD0 = ibooker_.book1D(histName+algoName_, histName+algoName_, effD0Bin, effD0Min, effD0Max);
127  if (effD0->getTH1F()) effD0->getTH1F()->Sumw2();
128  effD0->setAxisTitle("");
129 
130 
131  //
132  int effCompatibleLayersBin = conf_.getParameter<int> ("effCompatibleLayersBin");
133  double effCompatibleLayersMin = conf_.getParameter<double>("effCompatibleLayersMin");
134  double effCompatibleLayersMax = conf_.getParameter<double>("effCompatibleLayersMax");
135 
136  histName = "effCompatibleLayers_";
137  effCompatibleLayers = ibooker_.book1D(histName+algoName_, histName+algoName_, effCompatibleLayersBin, effCompatibleLayersMin, effCompatibleLayersMax);
140 
141 }
142 
143 //-----------------------------------------------------------------------------------
145 //-----------------------------------------------------------------------------------
146 {
147  edm::LogInfo( "TrackEfficiencyClient") << "TrackEfficiencyClient::endLuminosityBlock";
148 
149  bookMEs(ibooker_);
150 
151  histName = "/trackX_";
152  MonitorElement* trackX = igetter_.get(FolderName_+histName+algoName_);
153 
154  histName = "/muonX_";
155  MonitorElement* muonX = igetter_.get(FolderName_+histName+algoName_);
156 
157  histName = "/trackY_";
158  MonitorElement* trackY = igetter_.get(FolderName_+histName+algoName_);
159  histName = "/muonY_";
160  MonitorElement* muonY = igetter_.get(FolderName_+histName+algoName_);
161 
162  histName = "/trackZ_";
163  MonitorElement* trackZ = igetter_.get(FolderName_+histName+algoName_);
164  histName = "/muonZ_";
165  MonitorElement* muonZ = igetter_.get(FolderName_+histName+algoName_);
166 
167  histName = "/trackEta_";
169  histName = "/muonEta_";
171 
172  histName = "/trackPhi_";
174  histName = "/muonPhi_";
176 
177  histName = "/trackD0_";
178  MonitorElement* trackD0 = igetter_.get(FolderName_+histName+algoName_);
179  histName = "/muonD0_";
180  MonitorElement* muonD0 = igetter_.get(FolderName_+histName+algoName_);
181 
182  histName = "/trackCompatibleLayers_";
183  MonitorElement* trackCompatibleLayers = igetter_.get(FolderName_+histName+algoName_);
184  histName = "/muonCompatibleLayers_";
185  MonitorElement* muonCompatibleLayers = igetter_.get(FolderName_+histName+algoName_);
186 
187  if(trackX && muonX && trackY && muonY && trackZ && muonZ && trackEta && muonEta && trackPhi && muonPhi && trackD0 && muonD0 && trackCompatibleLayers && muonCompatibleLayers){
188  if (trackEfficiency_)
189  {
190  if (effX ->getTH1F() && trackX ->getTH1F() && muonX ->getTH1F()) { effX -> getTH1F()->Divide(trackX->getTH1F(),muonX->getTH1F(),1.,1.,"");}
191  if (effY ->getTH1F() && trackY ->getTH1F() && muonY ->getTH1F()) { effY -> getTH1F()->Divide(trackY->getTH1F(),muonY->getTH1F(),1.,1.,"");}
192  if (effZ ->getTH1F() && trackZ ->getTH1F() && muonZ ->getTH1F()) { effZ -> getTH1F()->Divide(trackZ->getTH1F(),muonZ->getTH1F(),1.,1.,"");}
193  if (effEta->getTH1F() && trackEta->getTH1F() && muonEta->getTH1F()) { effEta -> getTH1F()->Divide(trackEta->getTH1F(),muonEta->getTH1F(),1.,1.,"");}
194  if (effPhi->getTH1F() && trackPhi->getTH1F() && muonPhi->getTH1F()) { effPhi -> getTH1F()->Divide(trackPhi->getTH1F(),muonPhi->getTH1F(),1.,1.,"");}
195  if (effD0 ->getTH1F() && trackD0 ->getTH1F() && muonD0 ->getTH1F()) { effD0 -> getTH1F()->Divide(trackD0->getTH1F(),muonD0->getTH1F(),1.,1.,"");}
196  if (effCompatibleLayers->getTH1F() && trackCompatibleLayers->getTH1F() && muonCompatibleLayers->getTH1F()) { effCompatibleLayers -> getTH1F()->Divide(trackCompatibleLayers->getTH1F(),muonCompatibleLayers->getTH1F(),1.,1.,"");}
197  }
198  else {
199  if (effX ->getTH1F() && trackX ->getTH1F() && muonX ->getTH1F()) { effX -> getTH1F()->Divide(muonX->getTH1F(),trackX->getTH1F(),1.,1.,"");}
200  if (effY ->getTH1F() && trackY ->getTH1F() && muonY ->getTH1F()) { effY -> getTH1F()->Divide(muonY->getTH1F(),trackY->getTH1F(),1.,1.,"");}
201  if (effZ ->getTH1F() && trackZ ->getTH1F() && muonZ ->getTH1F()) { effZ -> getTH1F()->Divide(muonZ->getTH1F(),trackZ->getTH1F(),1.,1.,"");}
202  if (effEta->getTH1F() && trackEta->getTH1F() && muonEta->getTH1F()) { effEta -> getTH1F()->Divide(muonEta->getTH1F(),trackEta->getTH1F(),1.,1.,"");}
203  if (effPhi->getTH1F() && trackPhi->getTH1F() && muonPhi->getTH1F()) { effPhi -> getTH1F()->Divide(muonPhi->getTH1F(),trackPhi->getTH1F(),1.,1.,"");}
204  if (effD0 ->getTH1F() && trackD0 ->getTH1F() && muonD0 ->getTH1F()) { effD0 -> getTH1F()->Divide(muonD0->getTH1F(),trackD0->getTH1F(),1.,1.,"");}
205  }
206  }
207 
208 }
209 
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup)
BeginRun.
T getParameter(std::string const &) const
void bookMEs(DQMStore::IBooker &ibooker_)
book MEs
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
MonitorElement * effCompatibleLayers
void beginJob(void)
BeginJob.
virtual ~TrackEfficiencyClient()
Destructor.
void dqmEndJob(DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_)
EndJob.
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
TH1F * getTH1F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
TH1F * getTH1F(void) const
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
TrackEfficiencyClient(const edm::ParameterSet &ps)
Constructor.
Definition: Run.h:43