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  * $Date: 2012/10/16 10:07:41 $
5  * $Revision: 1.3 $
6  * \author Anne-Catherine Le Bihan
7  */
8 
10 
15 
17 
20 
21 #include <iostream>
22 #include <iomanip>
23 #include <stdio.h>
24 #include <string>
25 #include <sstream>
26 #include <math.h>
27 
28 //-----------------------------------------------------------------------------------
30 //-----------------------------------------------------------------------------------
31 {
32  edm::LogInfo( "TrackEfficiencyClient") << "TrackEfficiencyClient::Deleting TrackEfficiencyClient ";
33 
34  // get back-end interface
36 
37  FolderName_ = iConfig.getParameter<std::string>("FolderName");
38  algoName_ = iConfig.getParameter<std::string>("AlgoName");
39  trackEfficiency_ = iConfig.getParameter<bool>("trackEfficiency");
40 
41  conf_ = iConfig;
42 }
43 
44 
45 //-----------------------------------------------------------------------------------
47 //-----------------------------------------------------------------------------------
48 {
49  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::Deleting TrackEfficiencyClient ";
50 }
51 
52 
53 //-----------------------------------------------------------------------------------
55 //-----------------------------------------------------------------------------------
56 {
57 
59 
60  //
61  int effXBin = conf_.getParameter<int> ("effXBin");
62  double effXMin = conf_.getParameter<double>("effXMin");
63  double effXMax = conf_.getParameter<double>("effXMax");
64 
65  histName = "effX_";
66  effX = dqmStore_->book1D(histName+algoName_, histName+algoName_, effXBin, effXMin, effXMax);
67  if (effX->getTH1F()) effX->getTH1F()->Sumw2();
68  effX->setAxisTitle("");
69 
70 
71  //
72  int effYBin = conf_.getParameter<int> ("effYBin");
73  double effYMin = conf_.getParameter<double>("effYMin");
74  double effYMax = conf_.getParameter<double>("effYMax");
75 
76  histName = "effY_";
77  effY = dqmStore_->book1D(histName+algoName_, histName+algoName_, effYBin, effYMin, effYMax);
78  if (effY->getTH1F()) effY->getTH1F()->Sumw2();
79  effY->setAxisTitle("");
80 
81  //
82  int effZBin = conf_.getParameter<int> ("effZBin");
83  double effZMin = conf_.getParameter<double>("effZMin");
84  double effZMax = conf_.getParameter<double>("effZMax");
85 
86  histName = "effZ_";
87  effZ = dqmStore_->book1D(histName+algoName_, histName+algoName_, effZBin, effZMin, effZMax);
88  if (effZ->getTH1F()) effZ->getTH1F()->Sumw2();
89  effZ->setAxisTitle("");
90 
91  //
92  int effEtaBin = conf_.getParameter<int> ("effEtaBin");
93  double effEtaMin = conf_.getParameter<double>("effEtaMin");
94  double effEtaMax = conf_.getParameter<double>("effEtaMax");
95 
96  histName = "effEta_";
97  effEta = dqmStore_->book1D(histName+algoName_, histName+algoName_, effEtaBin, effEtaMin, effEtaMax);
98  if (effEta->getTH1F()) effEta->getTH1F()->Sumw2();
99  effEta->setAxisTitle("");
100 
101  //
102  int effPhiBin = conf_.getParameter<int> ("effPhiBin");
103  double effPhiMin = conf_.getParameter<double>("effPhiMin");
104  double effPhiMax = conf_.getParameter<double>("effPhiMax");
105 
106  histName = "effPhi_";
107  effPhi = dqmStore_->book1D(histName+algoName_, histName+algoName_, effPhiBin, effPhiMin, effPhiMax);
108  if (effPhi->getTH1F()) effPhi->getTH1F()->Sumw2();
109  effPhi->setAxisTitle("");
110 
111  //
112  int effD0Bin = conf_.getParameter<int> ("effD0Bin");
113  double effD0Min = conf_.getParameter<double>("effD0Min");
114  double effD0Max = conf_.getParameter<double>("effD0Max");
115 
116  histName = "effD0_";
117  effD0 = dqmStore_->book1D(histName+algoName_, histName+algoName_, effD0Bin, effD0Min, effD0Max);
118  if (effD0->getTH1F()) effD0->getTH1F()->Sumw2();
119  effD0->setAxisTitle("");
120 
121 
122  //
123  int effCompatibleLayersBin = conf_.getParameter<int> ("effCompatibleLayersBin");
124  double effCompatibleLayersMin = conf_.getParameter<double>("effCompatibleLayersMin");
125  double effCompatibleLayersMax = conf_.getParameter<double>("effCompatibleLayersMax");
126 
127  histName = "effCompatibleLayers_";
128  effCompatibleLayers = dqmStore_->book1D(histName+algoName_, histName+algoName_, effCompatibleLayersBin, effCompatibleLayersMin, effCompatibleLayersMax);
131 
132  edm::LogInfo("TrackEfficiencyClient") << "TrackEfficiencyClient::beginJob done";
133 }
134 
135 
136 //-----------------------------------------------------------------------------------
138 //-----------------------------------------------------------------------------------
139 {
140  edm::LogInfo ("TrackEfficiencyClient") <<"TrackEfficiencyClient:: Begining of Run";
141 }
142 
143 
144 //-----------------------------------------------------------------------------------
146 //-----------------------------------------------------------------------------------
147 {
148  edm::LogInfo( "TrackEfficiencyClient") << "TrackEfficiencyClient::analyze";
149 }
150 
151 //-----------------------------------------------------------------------------------
153 //-----------------------------------------------------------------------------------
154 {
155 }
156 
157 //-----------------------------------------------------------------------------------
159 //-----------------------------------------------------------------------------------
160 {
161 }
162 
163 
164 //-----------------------------------------------------------------------------------
166 //-----------------------------------------------------------------------------------
167 {
168  edm::LogInfo( "TrackEfficiencyClient") << "TrackEfficiencyClient::endLuminosityBlock";
169 
170  histName = "/trackX_";
172 
173  histName = "/muonX_";
175 
176  histName = "/trackY_";
178  histName = "/muonY_";
180 
181  histName = "/trackZ_";
183  histName = "/muonZ_";
185 
186  histName = "/trackEta_";
188  histName = "/muonEta_";
190 
191  histName = "/trackPhi_";
193  histName = "/muonPhi_";
195 
196  histName = "/trackD0_";
198  histName = "/muonD0_";
200 
201  histName = "/trackCompatibleLayers_";
202  MonitorElement* trackCompatibleLayers = dqmStore_->get(FolderName_+histName+algoName_);
203  histName = "/muonCompatibleLayers_";
204  MonitorElement* muonCompatibleLayers = dqmStore_->get(FolderName_+histName+algoName_);
205 
206  if(trackX && muonX && trackY && muonY && trackZ && muonZ && trackEta && muonEta && trackPhi && muonPhi && trackD0 && muonD0 && trackCompatibleLayers && muonCompatibleLayers){
207  if (trackEfficiency_)
208  {
209  if (effX ->getTH1F() && trackX ->getTH1F() && muonX ->getTH1F()) { effX -> getTH1F()->Divide(trackX->getTH1F(),muonX->getTH1F(),1.,1.,"");}
210  if (effY ->getTH1F() && trackY ->getTH1F() && muonY ->getTH1F()) { effY -> getTH1F()->Divide(trackY->getTH1F(),muonY->getTH1F(),1.,1.,"");}
211  if (effZ ->getTH1F() && trackZ ->getTH1F() && muonZ ->getTH1F()) { effZ -> getTH1F()->Divide(trackZ->getTH1F(),muonZ->getTH1F(),1.,1.,"");}
212  if (effEta->getTH1F() && trackEta->getTH1F() && muonEta->getTH1F()) { effEta -> getTH1F()->Divide(trackEta->getTH1F(),muonEta->getTH1F(),1.,1.,"");}
213  if (effPhi->getTH1F() && trackPhi->getTH1F() && muonPhi->getTH1F()) { effPhi -> getTH1F()->Divide(trackPhi->getTH1F(),muonPhi->getTH1F(),1.,1.,"");}
214  if (effD0 ->getTH1F() && trackD0 ->getTH1F() && muonD0 ->getTH1F()) { effD0 -> getTH1F()->Divide(trackD0->getTH1F(),muonD0->getTH1F(),1.,1.,"");}
215  if (effCompatibleLayers->getTH1F() && trackCompatibleLayers->getTH1F() && muonCompatibleLayers->getTH1F()) { effCompatibleLayers -> getTH1F()->Divide(trackCompatibleLayers->getTH1F(),muonCompatibleLayers->getTH1F(),1.,1.,"");}
216  }
217  else {
218  if (effX ->getTH1F() && trackX ->getTH1F() && muonX ->getTH1F()) { effX -> getTH1F()->Divide(muonX->getTH1F(),trackX->getTH1F(),1.,1.,"");}
219  if (effY ->getTH1F() && trackY ->getTH1F() && muonY ->getTH1F()) { effY -> getTH1F()->Divide(muonY->getTH1F(),trackY->getTH1F(),1.,1.,"");}
220  if (effZ ->getTH1F() && trackZ ->getTH1F() && muonZ ->getTH1F()) { effZ -> getTH1F()->Divide(muonZ->getTH1F(),trackZ->getTH1F(),1.,1.,"");}
221  if (effEta->getTH1F() && trackEta->getTH1F() && muonEta->getTH1F()) { effEta -> getTH1F()->Divide(muonEta->getTH1F(),trackEta->getTH1F(),1.,1.,"");}
222  if (effPhi->getTH1F() && trackPhi->getTH1F() && muonPhi->getTH1F()) { effPhi -> getTH1F()->Divide(muonPhi->getTH1F(),trackPhi->getTH1F(),1.,1.,"");}
223  if (effD0 ->getTH1F() && trackD0 ->getTH1F() && muonD0 ->getTH1F()) { effD0 -> getTH1F()->Divide(muonD0->getTH1F(),trackD0->getTH1F(),1.,1.,"");}
224  }
225  }
226 
227 }
228 
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:722
#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:1473
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:434
Definition: Run.h:36