CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalZmassClient Class Reference
Inheritance diagram for EcalZmassClient:
DQMEDHarvester edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalZmassClient (const edm::ParameterSet &)
 
 ~EcalZmassClient () override
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester ()
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
void endJob () final
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 

Private Attributes

std::string prefixME_
 

Additional Inherited Members

- Public Types inherited from DQMEDHarvester
typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Attributes inherited from DQMEDHarvester
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 39 of file EcalZmassClient.cc.

Constructor & Destructor Documentation

EcalZmassClient::EcalZmassClient ( const edm::ParameterSet iConfig)
explicit

Definition at line 52 of file EcalZmassClient.cc.

53  : prefixME_(iConfig.getUntrackedParameter<std::string>("prefixME", "")) {}
T getUntrackedParameter(std::string const &, T const &) const
std::string prefixME_
EcalZmassClient::~EcalZmassClient ( )
override

Definition at line 55 of file EcalZmassClient.cc.

55 {}

Member Function Documentation

void EcalZmassClient::dqmEndJob ( DQMStore::IBooker _ibooker,
DQMStore::IGetter _igetter 
)
overrideprivatevirtual

Implements DQMEDHarvester.

Definition at line 57 of file EcalZmassClient.cc.

References funct::abs(), TtFullHadDaughter::B, dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), MillePedeFileConverter_cfg::e, TrackCollections2monitor_cff::func, dqm::dqmstoreimpl::DQMStore::IGetter::get(), dqm::legacy::MonitorElement::getTH1F(), LogTrace, hlt_dqm_clientPB-live_cfg::me1, hlt_dqm_clientPB-live_cfg::me2, SiStripPI::mean, mygauss(), N, prefixME_, SiStripPI::rms, dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder(), dqmMemoryStats::stats, and cms::Exception::what().

57  {
58  MonitorElement *h_fitres1;
59  MonitorElement *h_fitres1bis;
60  MonitorElement *h_fitres1Chi2;
61  MonitorElement *h_fitres2;
62  MonitorElement *h_fitres2bis;
63  MonitorElement *h_fitres2Chi2;
64  MonitorElement *h_fitres3;
65  MonitorElement *h_fitres3bis;
66  MonitorElement *h_fitres3Chi2;
67 
68  _ibooker.setCurrentFolder(prefixME_ + "/Zmass");
69  h_fitres1 = _ibooker.book1D("Gaussian mean WP80 EB-EB", "Gaussian mean WP80 EB-EB", 1, 0, 1);
70  h_fitres1bis = _ibooker.book1D("Gaussian sigma WP80 EB-EB", "Gaussian sigma WP80 EB-EB", 1, 0, 1);
71  h_fitres1Chi2 = _ibooker.book1D(
72  "Gaussian Chi2 result over NDF WP80 EB-EB", "Gaussian Chi2 result over NDF WP80 EB-EB", 1, 0, 1);
73 
74  h_fitres3 = _ibooker.book1D("Gaussian mean WP80 EB-EE", "Gaussian mean result WP80 EB-EE", 1, 0, 1);
75  h_fitres3bis = _ibooker.book1D("Gaussian sigma WP80 EB-EE", "Gaussian sigma WP80 EB-EE", 1, 0, 1);
76  h_fitres3Chi2 =
77  _ibooker.book1D("Gaussian Chi2 result over NDF WP80 EB-EE", "Gaussian Chi2 result over NDF WP80 EB-EE", 1, 0, 1);
78 
79  h_fitres2 = _ibooker.book1D("Gaussian mean WP80 EE-EE", "Gaussian mean WP80 EE-EE", 1, 0, 1);
80  h_fitres2bis = _ibooker.book1D("Gaussian sigma WP80 EE-EE", "Gaussian sigma WP80 EE-EE", 1, 0, 1);
81  h_fitres2Chi2 =
82  _ibooker.book1D("Gaussian Chi2 result over NDF WP80 EE-EE", "Gaussian Chi2 result over NDF WP80 EE-EE", 1, 0, 1);
83 
84  LogTrace("EwkAnalyzer") << "Parameters initialization";
85 
86  MonitorElement *me1 = _igetter.get(prefixME_ + "/Zmass/Z peak - WP80 EB-EB");
87  MonitorElement *me2 = _igetter.get(prefixME_ + "/Zmass/Z peak - WP80 EE-EE");
88  MonitorElement *me3 = _igetter.get(prefixME_ + "/Zmass/Z peak - WP80 EB-EE");
89 
90  if (me1 != nullptr) {
91  TH1F *B = me1->getTH1F();
92  TH1F *R1 = h_fitres1->getTH1F();
93  int division = B->GetNbinsX();
94  float massMIN = B->GetBinLowEdge(1);
95  float massMAX = B->GetBinLowEdge(division + 1);
96  // float BIN_SIZE = B->GetBinWidth(1);
97 
98  TF1 *func = new TF1("mygauss", mygauss, massMIN, massMAX, 3);
99  func->SetParameter(0, 1.0);
100  func->SetParName(0, "const");
101  func->SetParameter(1, 95.0);
102  func->SetParName(1, "mean");
103  func->SetParameter(2, 5.0);
104  func->SetParName(2, "sigma");
105 
106  double stats[4];
107  R1->GetStats(stats);
108  float N = 0;
109  float mean = 0;
110  float sigma = 0;
111  N = B->GetEntries();
112 
113  try {
114  if (N != 0) {
115  B->Fit("mygauss", "QR");
116  mean = std::abs(func->GetParameter(1));
117  sigma = std::abs(func->GetParError(1));
118  }
119 
120  if (N == 0 || mean < 50 || mean > 100 || sigma <= 0 || sigma > 20) {
121  N = 1;
122  mean = 0;
123  sigma = 0;
124  }
125 
126  } catch (cms::Exception &e) {
127  edm::LogError("ZFitter") << "[Zfitter]: Exception when fitting..." << e.what();
128  N = 1;
129  mean = 40;
130  sigma = 0;
131  }
132 
133  stats[0] = N;
134  stats[1] = N;
135  stats[2] = mean * N;
136  stats[3] = sigma * sigma * N + mean * mean * N;
137 
138  R1->SetEntries(N);
139  R1->PutStats(stats);
140  }
141  /*******************************************************/
142  if (me1 != nullptr) {
143  TH1F *Bbis = me1->getTH1F();
144  TH1F *R1bis = h_fitres1bis->getTH1F();
145  int division = Bbis->GetNbinsX();
146  float massMIN = Bbis->GetBinLowEdge(1);
147  float massMAX = Bbis->GetBinLowEdge(division + 1);
148  // float BIN_SIZE = B->GetBinWidth(1);
149 
150  TF1 *func = new TF1("mygauss", mygauss, massMIN, massMAX, 3);
151  func->SetParameter(0, 1.0);
152  func->SetParName(0, "const");
153  func->SetParameter(1, 95.0);
154  func->SetParName(1, "mean");
155  func->SetParameter(2, 5.0);
156  func->SetParName(2, "sigma");
157 
158  double stats[4];
159  R1bis->GetStats(stats);
160  float N = 0;
161  float rms = 0;
162  float rmsErr = 0;
163  N = Bbis->GetEntries();
164 
165  try {
166  if (N != 0) {
167  Bbis->Fit("mygauss", "QR");
168  rms = std::abs(func->GetParameter(2));
169  rmsErr = std::abs(func->GetParError(2));
170  }
171 
172  if (N == 0 || rms < 0 || rms > 50 || rmsErr <= 0 || rmsErr > 50) {
173  N = 1;
174  rms = 0;
175  rmsErr = 0;
176  }
177 
178  } catch (cms::Exception &e) {
179  edm::LogError("ZFitter") << "[Zfitter]: Exception when fitting..." << e.what();
180  N = 1;
181  rms = 40;
182  rmsErr = 0;
183  }
184 
185  stats[0] = N;
186  stats[1] = N;
187  stats[2] = rms * N;
188  stats[3] = rmsErr * rmsErr * N + rms * rms * N;
189 
190  R1bis->SetEntries(N);
191  R1bis->PutStats(stats);
192  }
193  /****************************************/
194 
195  if (me2 != nullptr) {
196  TH1F *E = me2->getTH1F();
197  TH1F *R2 = h_fitres2->getTH1F();
198  int division = E->GetNbinsX();
199  float massMIN = E->GetBinLowEdge(1);
200  float massMAX = E->GetBinLowEdge(division + 1);
201  // float BIN_SIZE = E->GetBinWidth(1);
202 
203  TF1 *func = new TF1("mygauss", mygauss, massMIN, massMAX, 3);
204  func->SetParameter(0, 1.0);
205  func->SetParName(0, "const");
206  func->SetParameter(1, 95.0);
207  func->SetParName(1, "mean");
208  func->SetParameter(2, 5.0);
209  func->SetParName(2, "sigma");
210 
211  double stats[4];
212  R2->GetStats(stats);
213  float N = 0;
214  float mean = 0;
215  float sigma = 0;
216  N = E->GetEntries();
217 
218  try {
219  if (N != 0) {
220  E->Fit("mygauss", "QR");
221  mean = std::abs(func->GetParameter(1));
222  sigma = std::abs(func->GetParError(1));
223  }
224 
225  if (N == 0 || mean < 50 || mean > 100 || sigma <= 0 || sigma > 20) {
226  N = 1;
227  mean = 0;
228  sigma = 0;
229  }
230 
231  } catch (cms::Exception &e) {
232  edm::LogError("ZFitter") << "[Zfitter]: Exception when fitting..." << e.what();
233  N = 1;
234  mean = 40;
235  sigma = 0;
236  }
237 
238  stats[0] = N;
239  stats[1] = N;
240  stats[2] = mean * N;
241  stats[3] = sigma * sigma * N + mean * mean * N;
242 
243  R2->SetEntries(N);
244  R2->PutStats(stats);
245  }
246  /**************************************************************************/
247 
248  if (me2 != nullptr) {
249  TH1F *Ebis = me2->getTH1F();
250  TH1F *R2bis = h_fitres2bis->getTH1F();
251  int division = Ebis->GetNbinsX();
252  float massMIN = Ebis->GetBinLowEdge(1);
253  float massMAX = Ebis->GetBinLowEdge(division + 1);
254  // float BIN_SIZE = B->GetBinWidth(1);
255 
256  TF1 *func = new TF1("mygauss", mygauss, massMIN, massMAX, 3);
257  func->SetParameter(0, 1.0);
258  func->SetParName(0, "const");
259  func->SetParameter(1, 95.0);
260  func->SetParName(1, "mean");
261  func->SetParameter(2, 5.0);
262  func->SetParName(2, "sigma");
263 
264  double stats[4];
265  R2bis->GetStats(stats);
266  float N = 0;
267  float rms = 0;
268  float rmsErr = 0;
269  N = Ebis->GetEntries();
270 
271  try {
272  if (N != 0) {
273  Ebis->Fit("mygauss", "QR");
274  rms = std::abs(func->GetParameter(2));
275  rmsErr = std::abs(func->GetParError(2));
276  }
277 
278  if (N == 0 || rms < 0 || rms > 50 || rmsErr <= 0 || rmsErr > 50) {
279  N = 1;
280  rms = 0;
281  rmsErr = 0;
282  }
283 
284  } catch (cms::Exception &e) {
285  edm::LogError("ZFitter") << "[Zfitter]: Exception when fitting..." << e.what();
286  N = 1;
287  rms = 40;
288  rmsErr = 0;
289  }
290 
291  stats[0] = N;
292  stats[1] = N;
293  stats[2] = rms * N;
294  stats[3] = rmsErr * rmsErr * N + rms * rms * N;
295 
296  R2bis->SetEntries(N);
297  R2bis->PutStats(stats);
298  }
299  /*********************************************************************************************/
300 
301  if (me3 != nullptr) {
302  TH1F *R3 = h_fitres3->getTH1F();
303  TH1F *M = me3->getTH1F();
304  int division = M->GetNbinsX();
305  float massMIN = M->GetBinLowEdge(1);
306  float massMAX = M->GetBinLowEdge(division + 1);
307  // float BIN_SIZE = M->GetBinWidth(1);
308 
309  TF1 *func = new TF1("mygauss", mygauss, massMIN, massMAX, 3);
310  func->SetParameter(0, 1.0);
311  func->SetParName(0, "const");
312  func->SetParameter(1, 95.0);
313  func->SetParName(1, "mean");
314  func->SetParameter(2, 5.0);
315  func->SetParName(2, "sigma");
316 
317  double stats[4];
318  R3->GetStats(stats);
319  float N = 0;
320  float mean = 0;
321  float sigma = 0;
322  N = M->GetEntries();
323 
324  try {
325  if (N != 0) {
326  M->Fit("mygauss", "QR");
327  mean = std::abs(func->GetParameter(1));
328  sigma = std::abs(func->GetParError(1));
329  }
330  if (N == 0 || mean < 50 || mean > 100 || sigma <= 0 || sigma > 20) {
331  N = 1;
332  mean = 0;
333  sigma = 0;
334  }
335 
336  } catch (cms::Exception &e) {
337  edm::LogError("ZFitter") << "[Zfitter]: Exception when fitting..." << e.what();
338  N = 1;
339  mean = 40;
340  sigma = 0;
341  }
342 
343  stats[0] = N;
344  stats[1] = N;
345  stats[2] = mean * N;
346  stats[3] = sigma * sigma * N + mean * mean * N;
347 
348  R3->SetEntries(N);
349  R3->PutStats(stats);
350  }
351  /********************************************************************************/
352 
353  if (me3 != nullptr) {
354  TH1F *Mbis = me3->getTH1F();
355  TH1F *R3bis = h_fitres3bis->getTH1F();
356  int division = Mbis->GetNbinsX();
357  float massMIN = Mbis->GetBinLowEdge(1);
358  float massMAX = Mbis->GetBinLowEdge(division + 1);
359  // float BIN_SIZE = B->GetBinWidth(1);
360 
361  TF1 *func = new TF1("mygauss", mygauss, massMIN, massMAX, 3);
362  func->SetParameter(0, 1.0);
363  func->SetParName(0, "const");
364  func->SetParameter(1, 95.0);
365  func->SetParName(1, "mean");
366  func->SetParameter(2, 5.0);
367  func->SetParName(2, "sigma");
368 
369  double stats[4];
370  R3bis->GetStats(stats);
371  float N = 0;
372  float rms = 0;
373  float rmsErr = 0;
374  N = Mbis->GetEntries();
375 
376  try {
377  if (N != 0) {
378  Mbis->Fit("mygauss", "QR");
379  rms = std::abs(func->GetParameter(2));
380  rmsErr = std::abs(func->GetParError(2));
381  }
382 
383  if (N == 0 || rms < 0 || rms > 50 || rmsErr <= 0 || rmsErr > 50) {
384  N = 1;
385  rms = 0;
386  rmsErr = 0;
387  }
388 
389  } catch (cms::Exception &e) {
390  edm::LogError("ZFitter") << "[Zfitter]: Exception when fitting..." << e.what();
391  N = 1;
392  rms = 40;
393  rmsErr = 0;
394  }
395 
396  stats[0] = N;
397  stats[1] = N;
398  stats[2] = rms * N;
399  stats[3] = rmsErr * rmsErr * N + rms * rms * N;
400 
401  R3bis->SetEntries(N);
402  R3bis->PutStats(stats);
403  }
404 
405  /*Chi2 */
406 
407  if (me1 != nullptr) {
408  TH1F *C1 = me1->getTH1F();
409  TH1F *S1 = h_fitres1Chi2->getTH1F();
410  int division = C1->GetNbinsX();
411  float massMIN = C1->GetBinLowEdge(1);
412  float massMAX = C1->GetBinLowEdge(division + 1);
413  // float BIN_SIZE = B->GetBinWidth(1);
414 
415  TF1 *func = new TF1("mygauss", mygauss, massMIN, massMAX, 3);
416  func->SetParameter(0, 1.0);
417  func->SetParName(0, "const");
418  func->SetParameter(1, 95.0);
419  func->SetParName(1, "mean");
420  func->SetParameter(2, 5.0);
421  func->SetParName(2, "sigma");
422 
423  double stats[4];
424  S1->GetStats(stats);
425  float N = 0;
426  float Chi2 = 0;
427  float NDF = 0;
428  N = C1->GetEntries();
429 
430  try {
431  if (N != 0) {
432  C1->Fit("mygauss", "QR");
433  if ((func->GetNDF() != 0)) {
434  Chi2 = std::abs(func->GetChisquare()) / std::abs(func->GetNDF());
435  NDF = 0.1;
436  }
437  }
438 
439  if (N == 0 || Chi2 < 0 || NDF < 0) {
440  N = 1;
441  Chi2 = 0;
442  NDF = 0;
443  }
444 
445  } catch (cms::Exception &e) {
446  edm::LogError("ZFitter") << "[Zfitter]: Exception when fitting..." << e.what();
447  N = 1;
448  Chi2 = 40;
449  NDF = 0;
450  }
451 
452  stats[0] = N;
453  stats[1] = N;
454  stats[2] = Chi2 * N;
455  stats[3] = NDF * NDF * N + Chi2 * Chi2 * N;
456 
457  S1->SetEntries(N);
458  S1->PutStats(stats);
459  }
460  /**********************************************/
461 
462  if (me2 != nullptr) {
463  TH1F *C2 = me2->getTH1F();
464  TH1F *S2 = h_fitres2Chi2->getTH1F();
465  int division = C2->GetNbinsX();
466  float massMIN = C2->GetBinLowEdge(1);
467  float massMAX = C2->GetBinLowEdge(division + 1);
468  // float BIN_SIZE = B->GetBinWidth(1);
469 
470  TF1 *func = new TF1("mygauss", mygauss, massMIN, massMAX, 3);
471  func->SetParameter(0, 1.0);
472  func->SetParName(0, "const");
473  func->SetParameter(1, 95.0);
474  func->SetParName(1, "mean");
475  func->SetParameter(2, 5.0);
476  func->SetParName(2, "sigma");
477 
478  double stats[4];
479  S2->GetStats(stats);
480  float N = 0;
481  float Chi2 = 0;
482  float NDF = 0;
483  N = C2->GetEntries();
484 
485  try {
486  if (N != 0) {
487  C2->Fit("mygauss", "QR");
488  if (func->GetNDF() != 0) {
489  Chi2 = std::abs(func->GetChisquare()) / std::abs(func->GetNDF());
490  NDF = 0.1;
491  }
492  }
493 
494  if (N == 0 || Chi2 < 0 || NDF < 0) {
495  N = 1;
496  Chi2 = 0;
497  NDF = 0;
498  }
499 
500  } catch (cms::Exception &e) {
501  edm::LogError("ZFitter") << "[Zfitter]: Exception when fitting..." << e.what();
502  N = 1;
503  Chi2 = 40;
504  NDF = 0;
505  }
506 
507  stats[0] = N;
508  stats[1] = N;
509  stats[2] = Chi2 * N;
510  stats[3] = NDF * NDF * N + Chi2 * Chi2 * N;
511 
512  S2->SetEntries(N);
513  S2->PutStats(stats);
514  }
515  /**************************************************************************/
516  if (me3 != nullptr) {
517  TH1F *C3 = me3->getTH1F();
518  TH1F *S3 = h_fitres3Chi2->getTH1F();
519  int division = C3->GetNbinsX();
520  float massMIN = C3->GetBinLowEdge(1);
521  float massMAX = C3->GetBinLowEdge(division + 1);
522  // float BIN_SIZE = B->GetBinWidth(1);
523 
524  TF1 *func = new TF1("mygauss", mygauss, massMIN, massMAX, 3);
525  func->SetParameter(0, 1.0);
526  func->SetParName(0, "const");
527  func->SetParameter(1, 95.0);
528  func->SetParName(1, "mean");
529  func->SetParameter(2, 5.0);
530  func->SetParName(2, "sigma");
531 
532  double stats[4];
533  S3->GetStats(stats);
534  float N = 0;
535  float Chi2 = 0;
536  float NDF = 0;
537  N = C3->GetEntries();
538 
539  try {
540  if (N != 0) {
541  C3->Fit("mygauss", "QR");
542  if ((func->GetNDF() != 0)) {
543  Chi2 = std::abs(func->GetChisquare()) / std::abs(func->GetNDF());
544  NDF = 0.1;
545  }
546  }
547 
548  if (N == 0 || Chi2 < 0 || NDF < 0) {
549  N = 1;
550  Chi2 = 0;
551  NDF = 0;
552  }
553 
554  } catch (cms::Exception &e) {
555  edm::LogError("ZFitter") << "[Zfitter]: Exception when fitting..." << e.what();
556  N = 1;
557  Chi2 = 40;
558  NDF = 0;
559  }
560 
561  stats[0] = N;
562  stats[1] = N;
563  stats[2] = Chi2 * N;
564  stats[3] = NDF * NDF * N + Chi2 * Chi2 * N;
565 
566  S3->SetEntries(N);
567  S3->PutStats(stats);
568  }
569 }
virtual TH1F * getTH1F() const
char const * what() const override
Definition: Exception.cc:103
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const std::string B
#define LogTrace(id)
#define N
Definition: blowfish.cc:9
Double_t mygauss(Double_t *, Double_t *)
Definition: Chi2.h:15
std::string prefixME_

Member Data Documentation

std::string EcalZmassClient::prefixME_
private

Definition at line 49 of file EcalZmassClient.cc.

Referenced by dqmEndJob().