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 
15 
18 
19 #include <iostream>
20 #include <iomanip>
21 #include <stdio.h>
22 #include <string>
23 #include <sstream>
24 #include <math.h>
25 
26 //-----------------------------------------------------------------------------------
28 //-----------------------------------------------------------------------------------
29 {
30  edm::LogInfo( "TrackEfficiencyClient") << "TrackEfficiencyClient::Deleting TrackEfficiencyClient ";
31 
32  // get back-end interface
34 
35  FolderName_ = iConfig.getParameter<std::string>("FolderName");
36  algoName_ = iConfig.getParameter<std::string>("AlgoName");
37  trackEfficiency_ = iConfig.getParameter<bool>("trackEfficiency");
38 
39  conf_ = iConfig;
40 }
41 
42 
43 //-----------------------------------------------------------------------------------
45 //-----------------------------------------------------------------------------------
46 {
47  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::Deleting TrackEfficiencyClient ";
48 }
49 
50 
51 //-----------------------------------------------------------------------------------
53 //-----------------------------------------------------------------------------------
54 {
55 
57 
58  //
59  int effXBin = conf_.getParameter<int> ("effXBin");
60  double effXMin = conf_.getParameter<double>("effXMin");
61  double effXMax = conf_.getParameter<double>("effXMax");
62 
63  histName = "effX_";
64  effX = dqmStore_->book1D(histName+algoName_, histName+algoName_, effXBin, effXMin, effXMax);
65  if (effX->getTH1F()) effX->getTH1F()->Sumw2();
66  effX->setAxisTitle("");
67 
68 
69  //
70  int effYBin = conf_.getParameter<int> ("effYBin");
71  double effYMin = conf_.getParameter<double>("effYMin");
72  double effYMax = conf_.getParameter<double>("effYMax");
73 
74  histName = "effY_";
75  effY = dqmStore_->book1D(histName+algoName_, histName+algoName_, effYBin, effYMin, effYMax);
76  if (effY->getTH1F()) effY->getTH1F()->Sumw2();
77  effY->setAxisTitle("");
78 
79  //
80  int effZBin = conf_.getParameter<int> ("effZBin");
81  double effZMin = conf_.getParameter<double>("effZMin");
82  double effZMax = conf_.getParameter<double>("effZMax");
83 
84  histName = "effZ_";
85  effZ = dqmStore_->book1D(histName+algoName_, histName+algoName_, effZBin, effZMin, effZMax);
86  if (effZ->getTH1F()) effZ->getTH1F()->Sumw2();
87  effZ->setAxisTitle("");
88 
89  //
90  int effEtaBin = conf_.getParameter<int> ("effEtaBin");
91  double effEtaMin = conf_.getParameter<double>("effEtaMin");
92  double effEtaMax = conf_.getParameter<double>("effEtaMax");
93 
94  histName = "effEta_";
95  effEta = dqmStore_->book1D(histName+algoName_, histName+algoName_, effEtaBin, effEtaMin, effEtaMax);
96  if (effEta->getTH1F()) effEta->getTH1F()->Sumw2();
97  effEta->setAxisTitle("");
98 
99  //
100  int effPhiBin = conf_.getParameter<int> ("effPhiBin");
101  double effPhiMin = conf_.getParameter<double>("effPhiMin");
102  double effPhiMax = conf_.getParameter<double>("effPhiMax");
103 
104  histName = "effPhi_";
105  effPhi = dqmStore_->book1D(histName+algoName_, histName+algoName_, effPhiBin, effPhiMin, effPhiMax);
106  if (effPhi->getTH1F()) effPhi->getTH1F()->Sumw2();
107  effPhi->setAxisTitle("");
108 
109  //
110  int effD0Bin = conf_.getParameter<int> ("effD0Bin");
111  double effD0Min = conf_.getParameter<double>("effD0Min");
112  double effD0Max = conf_.getParameter<double>("effD0Max");
113 
114  histName = "effD0_";
115  effD0 = dqmStore_->book1D(histName+algoName_, histName+algoName_, effD0Bin, effD0Min, effD0Max);
116  if (effD0->getTH1F()) effD0->getTH1F()->Sumw2();
117  effD0->setAxisTitle("");
118 
119 
120  //
121  int effCompatibleLayersBin = conf_.getParameter<int> ("effCompatibleLayersBin");
122  double effCompatibleLayersMin = conf_.getParameter<double>("effCompatibleLayersMin");
123  double effCompatibleLayersMax = conf_.getParameter<double>("effCompatibleLayersMax");
124 
125  histName = "effCompatibleLayers_";
126  effCompatibleLayers = dqmStore_->book1D(histName+algoName_, histName+algoName_, effCompatibleLayersBin, effCompatibleLayersMin, effCompatibleLayersMax);
129 
130  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::beginJob done";
131 }
132 
133 
134 //-----------------------------------------------------------------------------------
136 //-----------------------------------------------------------------------------------
137 {
138  edm::LogInfo ("TrackEfficiencyClient") <<"TrackEfficiencyClient:: Begining of Run";
139 }
140 
141 
142 //-----------------------------------------------------------------------------------
144 //-----------------------------------------------------------------------------------
145 {
146  edm::LogInfo( "TrackEfficiencyClient") << "TrackEfficiencyClient::analyze";
147 }
148 
149 //-----------------------------------------------------------------------------------
151 //-----------------------------------------------------------------------------------
152 {
153 }
154 
155 //-----------------------------------------------------------------------------------
157 //-----------------------------------------------------------------------------------
158 {
159 }
160 
161 
162 //-----------------------------------------------------------------------------------
164 //-----------------------------------------------------------------------------------
165 {
166  edm::LogInfo( "TrackEfficiencyClient") << "TrackEfficiencyClient::endLuminosityBlock";
167 
168  histName = "/trackX_";
170 
171  histName = "/muonX_";
173 
174  histName = "/trackY_";
176  histName = "/muonY_";
178 
179  histName = "/trackZ_";
181  histName = "/muonZ_";
183 
184  histName = "/trackEta_";
186  histName = "/muonEta_";
188 
189  histName = "/trackPhi_";
191  histName = "/muonPhi_";
193 
194  histName = "/trackD0_";
196  histName = "/muonD0_";
198 
199  histName = "/trackCompatibleLayers_";
200  MonitorElement* trackCompatibleLayers = dqmStore_->get(FolderName_+histName+algoName_);
201  histName = "/muonCompatibleLayers_";
202  MonitorElement* muonCompatibleLayers = dqmStore_->get(FolderName_+histName+algoName_);
203 
204  if(trackX && muonX && trackY && muonY && trackZ && muonZ && trackEta && muonEta && trackPhi && muonPhi && trackD0 && muonD0 && trackCompatibleLayers && muonCompatibleLayers){
205  if (trackEfficiency_)
206  {
207  if (effX ->getTH1F() && trackX ->getTH1F() && muonX ->getTH1F()) { effX -> getTH1F()->Divide(trackX->getTH1F(),muonX->getTH1F(),1.,1.,"");}
208  if (effY ->getTH1F() && trackY ->getTH1F() && muonY ->getTH1F()) { effY -> getTH1F()->Divide(trackY->getTH1F(),muonY->getTH1F(),1.,1.,"");}
209  if (effZ ->getTH1F() && trackZ ->getTH1F() && muonZ ->getTH1F()) { effZ -> getTH1F()->Divide(trackZ->getTH1F(),muonZ->getTH1F(),1.,1.,"");}
210  if (effEta->getTH1F() && trackEta->getTH1F() && muonEta->getTH1F()) { effEta -> getTH1F()->Divide(trackEta->getTH1F(),muonEta->getTH1F(),1.,1.,"");}
211  if (effPhi->getTH1F() && trackPhi->getTH1F() && muonPhi->getTH1F()) { effPhi -> getTH1F()->Divide(trackPhi->getTH1F(),muonPhi->getTH1F(),1.,1.,"");}
212  if (effD0 ->getTH1F() && trackD0 ->getTH1F() && muonD0 ->getTH1F()) { effD0 -> getTH1F()->Divide(trackD0->getTH1F(),muonD0->getTH1F(),1.,1.,"");}
213  if (effCompatibleLayers->getTH1F() && trackCompatibleLayers->getTH1F() && muonCompatibleLayers->getTH1F()) { effCompatibleLayers -> getTH1F()->Divide(trackCompatibleLayers->getTH1F(),muonCompatibleLayers->getTH1F(),1.,1.,"");}
214  }
215  else {
216  if (effX ->getTH1F() && trackX ->getTH1F() && muonX ->getTH1F()) { effX -> getTH1F()->Divide(muonX->getTH1F(),trackX->getTH1F(),1.,1.,"");}
217  if (effY ->getTH1F() && trackY ->getTH1F() && muonY ->getTH1F()) { effY -> getTH1F()->Divide(muonY->getTH1F(),trackY->getTH1F(),1.,1.,"");}
218  if (effZ ->getTH1F() && trackZ ->getTH1F() && muonZ ->getTH1F()) { effZ -> getTH1F()->Divide(muonZ->getTH1F(),trackZ->getTH1F(),1.,1.,"");}
219  if (effEta->getTH1F() && trackEta->getTH1F() && muonEta->getTH1F()) { effEta -> getTH1F()->Divide(muonEta->getTH1F(),trackEta->getTH1F(),1.,1.,"");}
220  if (effPhi->getTH1F() && trackPhi->getTH1F() && muonPhi->getTH1F()) { effPhi -> getTH1F()->Divide(muonPhi->getTH1F(),trackPhi->getTH1F(),1.,1.,"");}
221  if (effD0 ->getTH1F() && trackD0 ->getTH1F() && muonD0 ->getTH1F()) { effD0 -> getTH1F()->Divide(muonD0->getTH1F(),trackD0->getTH1F(),1.,1.,"");}
222  }
223  }
224 
225 }
226 
void beginRun(edm::Run const &run, edm::EventSetup const &eSetup)
BeginRun.
T getParameter(std::string const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup)
End Luminosity Block.
MonitorElement * effCompatibleLayers
void beginJob(void)
BeginJob.
virtual ~TrackEfficiencyClient()
Destructor.
void analyze(edm::Event const &e, edm::EventSetup const &eSetup)
Analyze.
TH1F * getTH1F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
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.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
Definition: Run.h:41