00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <memory>
00023
00024
00025 #include "FWCore/Framework/interface/Frameworkfwd.h"
00026 #include "FWCore/Framework/interface/EDAnalyzer.h"
00027 #include "FWCore/ServiceRegistry/interface/Service.h"
00028 #include "FWCore/Framework/interface/Event.h"
00029 #include "FWCore/Framework/interface/MakerMacros.h"
00030 #include "DQM/Physics/src/EwkDQM.h"
00031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00032 #include "TMath.h"
00033 #include <string>
00034 #include <cmath>
00035 #include "TH1.h"
00036 #include "DQMServices/Core/interface/DQMStore.h"
00037 #include "DQMServices/Core/interface/MonitorElement.h"
00038 #include "FWCore/Framework/interface/MakerMacros.h"
00039 #include "FWCore/Framework/interface/EventSetup.h"
00040 #include <iostream>
00041 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00042
00043 using namespace std;
00044 using namespace edm;
00045 using namespace reco;
00046
00047 class DQMStore;
00048 class MonitorElement;
00049
00050
00051
00052
00053
00054
00055 class EcalZmassClient:public
00056 edm::EDAnalyzer
00057 {
00058 public:
00059 explicit
00060 EcalZmassClient (const edm::ParameterSet &);
00061 ~
00062 EcalZmassClient ();
00063
00064 static void
00065 fillDescriptions (edm::ConfigurationDescriptions & descriptions);
00066
00067
00068 private:
00069 virtual void
00070 beginJob ();
00071 virtual void
00072 analyze (const edm::Event &, const edm::EventSetup &);
00073 virtual void
00074 endJob ();
00075
00076 virtual void
00077 beginRun (edm::Run const &, edm::EventSetup const &);
00078 virtual void
00079 endRun (edm::Run const &, edm::EventSetup const &);
00080 virtual void
00081 beginLuminosityBlock (edm::LuminosityBlock const &,
00082 edm::EventSetup const &);
00083 virtual void
00084 endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &);
00085
00086
00087
00088 std::string
00089 prefixME_;
00090
00091 MonitorElement *
00092 h_ee_invMass_EB;
00093 MonitorElement *
00094 h_ee_invMass_EE;
00095 MonitorElement *
00096 h_ee_invMass_BB;
00097 MonitorElement *
00098 h_95_ee_invMass_EB;
00099 MonitorElement *
00100 h_95_ee_invMass_EE;
00101 MonitorElement *
00102 h_95_ee_invMass_BB;
00103 MonitorElement *
00104 h_ee_invMass;
00105 MonitorElement *
00106 h_e1_et;
00107 MonitorElement *
00108 h_e2_et;
00109 MonitorElement *
00110 h_e1_eta;
00111 MonitorElement *
00112 h_e2_eta;
00113 MonitorElement *
00114 h_e1_phi;
00115 MonitorElement *
00116 h_e2_phi;
00117 MonitorElement *
00118 h_fitres1;
00119 MonitorElement *
00120 h_fitres1bis;
00121 MonitorElement *
00122 h_fitres1Chi2;
00123 MonitorElement *
00124 h_fitres2;
00125 MonitorElement *
00126 h_fitres2bis;
00127 MonitorElement *
00128 h_fitres2Chi2;
00129 MonitorElement *
00130 h_fitres3;
00131 MonitorElement *
00132 h_fitres3bis;
00133 MonitorElement *
00134 h_fitres3Chi2;
00135
00136
00137 };
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153 EcalZmassClient::EcalZmassClient (const edm::ParameterSet & iConfig)
00154 {
00155 prefixME_ = iConfig.getUntrackedParameter < string > ("prefixME", "");
00156
00157 }
00158
00159
00160 EcalZmassClient::~EcalZmassClient ()
00161 {
00162
00163
00164
00165
00166 }
00167
00168
00169
00170
00171
00172
00173
00174 void
00175 EcalZmassClient::analyze (const edm::Event & iEvent,
00176 const edm::EventSetup & iSetup)
00177 {
00178 using namespace edm;
00179
00180
00181
00182 #ifdef THIS_IS_AN_EVENT_EXAMPLE
00183 Handle < ExampleData > pIn;
00184 iEvent.getByLabel ("example", pIn);
00185 #endif
00186
00187 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
00188 ESHandle < SetupData > pSetup;
00189 iSetup.get < SetupRecord > ().get (pSetup);
00190 #endif
00191 }
00192
00193
00194
00195 void
00196 EcalZmassClient::beginJob ()
00197 {
00198 }
00199
00200
00201 void
00202 EcalZmassClient::endJob ()
00203 {
00204 }
00205
00206
00207 void
00208 EcalZmassClient::beginRun (edm::Run const &, edm::EventSetup const &)
00209 {
00210 DQMStore *theDbe = Service < DQMStore > ().operator-> ();
00211
00212 theDbe->setCurrentFolder (prefixME_ + "/Zmass");
00213 h_fitres1 =
00214 theDbe->book1D ("Gaussian mean WP80 EB-EB",
00215 "Gaussian mean WP80 EB-EB", 1, 0, 1);
00216 h_fitres1bis =
00217 theDbe->book1D ("Gaussian sigma WP80 EB-EB",
00218 "Gaussian sigma WP80 EB-EB", 1, 0, 1);
00219 h_fitres1Chi2 =
00220 theDbe->book1D ("Gaussian Chi2 result over NDF WP80 EB-EB",
00221 "Gaussian Chi2 result over NDF WP80 EB-EB", 1, 0, 1);
00222
00223 h_fitres3 =
00224 theDbe->book1D ("Gaussian mean WP80 EB-EE",
00225 "Gaussian mean result WP80 EB-EE", 1, 0, 1);
00226 h_fitres3bis =
00227 theDbe->book1D ("Gaussian sigma WP80 EB-EE",
00228 "Gaussian sigma WP80 EB-EE", 1, 0, 1);
00229 h_fitres3Chi2 =
00230 theDbe->book1D ("Gaussian Chi2 result over NDF WP80 EB-EE",
00231 "Gaussian Chi2 result over NDF WP80 EB-EE", 1, 0, 1);
00232
00233 h_fitres2 =
00234 theDbe->book1D ("Gaussian mean WP80 EE-EE",
00235 "Gaussian mean WP80 EE-EE", 1, 0, 1);
00236 h_fitres2bis =
00237 theDbe->book1D ("Gaussian sigma WP80 EE-EE",
00238 "Gaussian sigma WP80 EE-EE", 1, 0, 1);
00239 h_fitres2Chi2 =
00240 theDbe->book1D ("Gaussian Chi2 result over NDF WP80 EE-EE",
00241 "Gaussian Chi2 result over NDF WP80 EE-EE", 1, 0, 1);
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266 }
00267
00268
00269
00270 Double_t
00271 mybw (Double_t * x, Double_t * par)
00272 {
00273 Double_t arg1 = 14.0 / 22.0;
00274 Double_t arg2 = par[1] * par[1] * par[2] * par[2];
00275 Double_t arg3 =
00276 ((x[0] * x[0]) - (par[1] * par[1])) * ((x[0] * x[0]) - (par[1] * par[1]));
00277 Double_t arg4 =
00278 x[0] * x[0] * x[0] * x[0] * ((par[2] * par[2]) / (par[1] * par[1]));
00279 return par[0] * arg1 * arg2 / (arg3 + arg4);
00280 }
00281
00282
00283 Double_t
00284 mygauss (Double_t * x, Double_t * par)
00285 {
00286 Double_t arg = 0;
00287 if (par[2] < 0)
00288 par[2] = -par[2];
00289 if (par[2] != 0)
00290 arg = (x[0] - par[1]) / par[2];
00291 return par[0] * TMath::Exp (-0.5 * arg * arg) / (TMath::Sqrt (2 * TMath::Pi ()) * par[2]);
00292
00293 }
00294
00295
00296
00297
00298 void
00299 EcalZmassClient::endRun (edm::Run const &, edm::EventSetup const &)
00300 {
00301 DQMStore *theDbe = Service < DQMStore > ().operator-> ();
00302 std::string logTraceName;
00303 logTraceName = "EwkAnalyzer";
00304
00305 LogTrace (logTraceName) << "Parameters initialization";
00306
00307 MonitorElement *me1 = theDbe->get (prefixME_ + "/Zmass/Z peak - WP80 EB-EB");
00308 MonitorElement *me2 = theDbe->get (prefixME_ + "/Zmass/Z peak - WP80 EE-EE");
00309 MonitorElement *me3 = theDbe->get (prefixME_ + "/Zmass/Z peak - WP80 EB-EE");
00310
00311
00312 if (me1 != 0)
00313 {
00314 TH1F *B = me1->getTH1F ();
00315 TH1F *R1 = h_fitres1->getTH1F ();
00316 int division = B->GetNbinsX ();
00317 float massMIN = B->GetBinLowEdge (1);
00318 float massMAX = B->GetBinLowEdge (division + 1);
00319
00320
00321 TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
00322 func->SetParameter (0, 1.0);
00323 func->SetParName (0, "const");
00324 func->SetParameter (1, 95.0);
00325 func->SetParName (1, "mean");
00326 func->SetParameter (2, 5.0);
00327 func->SetParName (2, "sigma");
00328
00329 double stats[4];
00330 R1->GetStats (stats);
00331 float N = 0;
00332 float mean = 0;
00333 float sigma = 0;
00334 N = B->GetEntries ();
00335
00336 try
00337 {
00338 if (N != 0)
00339 {
00340
00341 B->Fit ("mygauss", "QR");
00342 mean = fabs (func->GetParameter (1));
00343 sigma = fabs (func->GetParError (1));
00344 }
00345
00346 if (N == 0 || mean < 50 || mean > 100 || sigma <= 0 || sigma > 20)
00347 {
00348 N = 1;
00349 mean = 0;
00350 sigma = 0;
00351 }
00352
00353 }
00354 catch (...)
00355 {
00356 edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
00357 N = 1;
00358 mean = 40;
00359 sigma = 0;
00360 }
00361
00362 stats[0] = N;
00363 stats[1] = N;
00364 stats[2] = mean * N;
00365 stats[3] = sigma * sigma * N + mean * mean * N;
00366
00367 R1->SetEntries (N);
00368 R1->PutStats (stats);
00369 }
00370
00371 if (me1 != 0)
00372 {
00373 TH1F *Bbis = me1->getTH1F ();
00374 TH1F *R1bis = h_fitres1bis->getTH1F ();
00375 int division = Bbis->GetNbinsX ();
00376 float massMIN = Bbis->GetBinLowEdge (1);
00377 float massMAX = Bbis->GetBinLowEdge (division + 1);
00378
00379
00380 TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
00381 func->SetParameter (0, 1.0);
00382 func->SetParName (0, "const");
00383 func->SetParameter (1, 95.0);
00384 func->SetParName (1, "mean");
00385 func->SetParameter (2, 5.0);
00386 func->SetParName (2, "sigma");
00387
00388 double stats[4];
00389 R1bis->GetStats (stats);
00390 float N = 0;
00391 float rms = 0;
00392 float rmsErr = 0;
00393 N = Bbis->GetEntries ();
00394
00395 try
00396 {
00397 if (N != 0)
00398 {
00399
00400 Bbis->Fit ("mygauss", "QR");
00401 rms = fabs (func->GetParameter (2));
00402 rmsErr = fabs (func->GetParError (2));
00403 }
00404
00405 if (N == 0 || rms < 0 || rms > 50 || rmsErr <= 0 || rmsErr > 50)
00406 {
00407 N = 1;
00408 rms = 0;
00409 rmsErr = 0;
00410 }
00411
00412 }
00413 catch (...)
00414 {
00415 edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
00416 N = 1;
00417 rms = 40;
00418 rmsErr = 0;
00419 }
00420
00421 stats[0] = N;
00422 stats[1] = N;
00423 stats[2] = rms * N;
00424 stats[3] = rmsErr * rmsErr * N + rms * rms * N;
00425
00426 R1bis->SetEntries (N);
00427 R1bis->PutStats (stats);
00428 }
00429
00430
00431 if (me2 != 0)
00432 {
00433 TH1F *E = me2->getTH1F ();
00434 TH1F *R2 = h_fitres2->getTH1F ();
00435 int division = E->GetNbinsX ();
00436 float massMIN = E->GetBinLowEdge (1);
00437 float massMAX = E->GetBinLowEdge (division + 1);
00438
00439
00440 TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
00441 func->SetParameter (0, 1.0);
00442 func->SetParName (0, "const");
00443 func->SetParameter (1, 95.0);
00444 func->SetParName (1, "mean");
00445 func->SetParameter (2, 5.0);
00446 func->SetParName (2, "sigma");
00447
00448 double stats[4];
00449 R2->GetStats (stats);
00450 float N = 0;
00451 float mean = 0;
00452 float sigma = 0;
00453 N = E->GetEntries ();
00454
00455 try
00456 {
00457 if (N != 0)
00458 {
00459 E->Fit ("mygauss", "QR");
00460 mean = fabs (func->GetParameter (1));
00461 sigma = fabs (func->GetParError (1));
00462 }
00463
00464 if (N == 0 || mean < 50 || mean > 100 || sigma <= 0 || sigma > 20)
00465 {
00466 N = 1;
00467 mean = 0;
00468 sigma = 0;
00469
00470 }
00471
00472 }
00473 catch (...)
00474 {
00475 edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
00476 N = 1;
00477 mean = 40;
00478 sigma = 0;
00479 }
00480
00481 stats[0] = N;
00482 stats[1] = N;
00483 stats[2] = mean * N;
00484 stats[3] = sigma * sigma * N + mean * mean * N;
00485
00486 R2->SetEntries (N);
00487 R2->PutStats (stats);
00488 }
00489
00490
00491 if (me2 != 0)
00492 {
00493 TH1F *Ebis = me2->getTH1F ();
00494 TH1F *R2bis = h_fitres2bis->getTH1F ();
00495 int division = Ebis->GetNbinsX ();
00496 float massMIN = Ebis->GetBinLowEdge (1);
00497 float massMAX = Ebis->GetBinLowEdge (division + 1);
00498
00499
00500 TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
00501 func->SetParameter (0, 1.0);
00502 func->SetParName (0, "const");
00503 func->SetParameter (1, 95.0);
00504 func->SetParName (1, "mean");
00505 func->SetParameter (2, 5.0);
00506 func->SetParName (2, "sigma");
00507
00508 double stats[4];
00509 R2bis->GetStats (stats);
00510 float N = 0;
00511 float rms = 0;
00512 float rmsErr = 0;
00513 N = Ebis->GetEntries ();
00514
00515 try
00516 {
00517 if (N != 0)
00518 {
00519
00520 Ebis->Fit ("mygauss", "QR");
00521 rms = fabs (func->GetParameter (2));
00522 rmsErr = fabs (func->GetParError (2));
00523 }
00524
00525 if (N == 0 || rms < 0 || rms > 50 || rmsErr <= 0 || rmsErr > 50)
00526 {
00527 N = 1;
00528 rms = 0;
00529 rmsErr = 0;
00530 }
00531
00532 }
00533 catch (...)
00534 {
00535 edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
00536 N = 1;
00537 rms = 40;
00538 rmsErr = 0;
00539 }
00540
00541 stats[0] = N;
00542 stats[1] = N;
00543 stats[2] = rms * N;
00544 stats[3] = rmsErr * rmsErr * N + rms * rms * N;
00545
00546 R2bis->SetEntries (N);
00547 R2bis->PutStats (stats);
00548 }
00549
00550
00551 if (me3 != 0)
00552 {
00553 TH1F *R3 = h_fitres3->getTH1F ();
00554 TH1F *M = me3->getTH1F ();
00555 int division = M->GetNbinsX ();
00556 float massMIN = M->GetBinLowEdge (1);
00557 float massMAX = M->GetBinLowEdge (division + 1);
00558
00559
00560 TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
00561 func->SetParameter (0, 1.0);
00562 func->SetParName (0, "const");
00563 func->SetParameter (1, 95.0);
00564 func->SetParName (1, "mean");
00565 func->SetParameter (2, 5.0);
00566 func->SetParName (2, "sigma");
00567
00568 double stats[4];
00569 R3->GetStats (stats);
00570 float N = 0;
00571 float mean = 0;
00572 float sigma = 0;
00573 N = M->GetEntries ();
00574
00575
00576 try
00577 {
00578 if (N != 0)
00579 {
00580
00581 M->Fit ("mygauss", "QR");
00582 mean = fabs (func->GetParameter (1));
00583 sigma = fabs (func->GetParError (1));
00584 }
00585 if (N == 0 || mean < 50 || mean > 100 || sigma <= 0 || sigma > 20)
00586 {
00587 N = 1;
00588 mean = 0;
00589 sigma = 0;
00590 }
00591
00592 }
00593 catch (...)
00594 {
00595 edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
00596 N = 1;
00597 mean = 40;
00598 sigma = 0;
00599 }
00600
00601 stats[0] = N;
00602 stats[1] = N;
00603 stats[2] = mean * N;
00604 stats[3] = sigma * sigma * N + mean * mean * N;
00605
00606 R3->SetEntries (N);
00607 R3->PutStats (stats);
00608 }
00609
00610
00611 if (me3 != 0)
00612 {
00613 TH1F *Mbis = me3->getTH1F ();
00614 TH1F *R3bis = h_fitres3bis->getTH1F ();
00615 int division = Mbis->GetNbinsX ();
00616 float massMIN = Mbis->GetBinLowEdge (1);
00617 float massMAX = Mbis->GetBinLowEdge (division + 1);
00618
00619
00620 TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
00621 func->SetParameter (0, 1.0);
00622 func->SetParName (0, "const");
00623 func->SetParameter (1, 95.0);
00624 func->SetParName (1, "mean");
00625 func->SetParameter (2, 5.0);
00626 func->SetParName (2, "sigma");
00627
00628 double stats[4];
00629 R3bis->GetStats (stats);
00630 float N = 0;
00631 float rms = 0;
00632 float rmsErr = 0;
00633 N = Mbis->GetEntries ();
00634
00635 try
00636 {
00637 if (N != 0)
00638 {
00639
00640 Mbis->Fit ("mygauss", "QR");
00641 rms = fabs (func->GetParameter (2));
00642 rmsErr = fabs (func->GetParError (2));
00643 }
00644
00645 if (N == 0 || rms < 0 || rms > 50 || rmsErr <= 0 || rmsErr > 50)
00646 {
00647 N = 1;
00648 rms = 0;
00649 rmsErr = 0;
00650 }
00651
00652 }
00653 catch (...)
00654 {
00655 edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
00656 N = 1;
00657 rms = 40;
00658 rmsErr = 0;
00659 }
00660
00661 stats[0] = N;
00662 stats[1] = N;
00663 stats[2] = rms * N;
00664 stats[3] = rmsErr * rmsErr * N + rms * rms * N;
00665
00666 R3bis->SetEntries (N);
00667 R3bis->PutStats (stats);
00668 }
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017 if (me1 != 0)
01018 {
01019 TH1F *C1 = me1->getTH1F ();
01020 TH1F *S1 = h_fitres1Chi2->getTH1F ();
01021 int division = C1->GetNbinsX ();
01022 float massMIN = C1->GetBinLowEdge (1);
01023 float massMAX = C1->GetBinLowEdge (division + 1);
01024
01025
01026 TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
01027 func->SetParameter (0, 1.0);
01028 func->SetParName (0, "const");
01029 func->SetParameter (1, 95.0);
01030 func->SetParName (1, "mean");
01031 func->SetParameter (2, 5.0);
01032 func->SetParName (2, "sigma");
01033
01034 double stats[4];
01035 S1->GetStats (stats);
01036 float N = 0;
01037 float Chi2 = 0;
01038 float NDF = 0;
01039 N = C1->GetEntries ();
01040
01041 try
01042 {
01043 if (N != 0)
01044 {
01045
01046 C1->Fit ("mygauss", "QR");
01047 if ((func->GetNDF () != 0))
01048 {
01049 Chi2 = fabs (func->GetChisquare ()) / fabs (func->GetNDF ());
01050 NDF = 0.1;
01051 }
01052 }
01053
01054 if (N == 0 || Chi2 < 0 || NDF < 0)
01055 {
01056 N = 1;
01057 Chi2 = 0;
01058 NDF = 0;
01059 }
01060
01061 }
01062 catch (...)
01063 {
01064 edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
01065 N = 1;
01066 Chi2 = 40;
01067 NDF = 0;
01068 }
01069
01070 stats[0] = N;
01071 stats[1] = N;
01072 stats[2] = Chi2 * N;
01073 stats[3] = NDF * NDF * N + Chi2 * Chi2 * N;
01074
01075 S1->SetEntries (N);
01076 S1->PutStats (stats);
01077 }
01078
01079
01080 if (me2 != 0)
01081 {
01082 TH1F *C2 = me2->getTH1F ();
01083 TH1F *S2 = h_fitres2Chi2->getTH1F ();
01084 int division = C2->GetNbinsX ();
01085 float massMIN = C2->GetBinLowEdge (1);
01086 float massMAX = C2->GetBinLowEdge (division + 1);
01087
01088
01089 TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
01090 func->SetParameter (0, 1.0);
01091 func->SetParName (0, "const");
01092 func->SetParameter (1, 95.0);
01093 func->SetParName (1, "mean");
01094 func->SetParameter (2, 5.0);
01095 func->SetParName (2, "sigma");
01096
01097 double stats[4];
01098 S2->GetStats (stats);
01099 float N = 0;
01100 float Chi2 = 0;
01101 float NDF = 0;
01102 N = C2->GetEntries ();
01103
01104 try
01105 {
01106 if (N != 0)
01107 {
01108 C2->Fit ("mygauss", "QR");
01109 if (func->GetNDF () != 0)
01110 {
01111 Chi2 = fabs (func->GetChisquare ()) / fabs (func->GetNDF ());
01112 NDF = 0.1;
01113 }
01114 }
01115
01116 if (N == 0 || Chi2 < 0 || NDF < 0)
01117 {
01118 N = 1;
01119 Chi2 = 0;
01120 NDF = 0;
01121 }
01122
01123 }
01124 catch (...)
01125 {
01126 edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
01127 N = 1;
01128 Chi2 = 40;
01129 NDF = 0;
01130 }
01131
01132 stats[0] = N;
01133 stats[1] = N;
01134 stats[2] = Chi2 * N;
01135 stats[3] = NDF * NDF * N + Chi2 * Chi2 * N;
01136
01137 S2->SetEntries (N);
01138 S2->PutStats (stats);
01139 }
01140
01141 if (me3 != 0)
01142 {
01143 TH1F *C3 = me3->getTH1F ();
01144 TH1F *S3 = h_fitres3Chi2->getTH1F ();
01145 int division = C3->GetNbinsX ();
01146 float massMIN = C3->GetBinLowEdge (1);
01147 float massMAX = C3->GetBinLowEdge (division + 1);
01148
01149
01150 TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
01151 func->SetParameter (0, 1.0);
01152 func->SetParName (0, "const");
01153 func->SetParameter (1, 95.0);
01154 func->SetParName (1, "mean");
01155 func->SetParameter (2, 5.0);
01156 func->SetParName (2, "sigma");
01157
01158 double stats[4];
01159 S3->GetStats (stats);
01160 float N = 0;
01161 float Chi2 = 0;
01162 float NDF = 0;
01163 N = C3->GetEntries ();
01164
01165 try
01166 {
01167 if (N != 0)
01168 {
01169 C3->Fit ("mygauss", "QR");
01170 if ((func->GetNDF () != 0))
01171 {
01172 Chi2 = fabs (func->GetChisquare ()) / fabs (func->GetNDF ());
01173 NDF = 0.1;
01174 }
01175 }
01176
01177
01178 if (N == 0 || Chi2 < 0 || NDF < 0)
01179 {
01180 N = 1;
01181 Chi2 = 0;
01182 NDF = 0;
01183 }
01184
01185 }
01186 catch (...)
01187 {
01188 edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
01189 N = 1;
01190 Chi2 = 40;
01191 NDF = 0;
01192 }
01193
01194 stats[0] = N;
01195 stats[1] = N;
01196 stats[2] = Chi2 * N;
01197 stats[3] = NDF * NDF * N + Chi2 * Chi2 * N;
01198
01199 S3->SetEntries (N);
01200 S3->PutStats (stats);
01201 }
01202 }
01203
01204
01205 void
01206 EcalZmassClient::beginLuminosityBlock (edm::LuminosityBlock const &,
01207 edm::EventSetup const &)
01208 {
01209 }
01210
01211
01212 void
01213 EcalZmassClient::endLuminosityBlock (edm::LuminosityBlock const &,
01214 edm::EventSetup const &)
01215 {
01216 }
01217
01218
01219 void
01220 EcalZmassClient::fillDescriptions (edm::
01221 ConfigurationDescriptions & descriptions)
01222 {
01223
01224
01225 edm::ParameterSetDescription desc;
01226 desc.setUnknown ();
01227 descriptions.addDefault (desc);
01228 }
01229
01230
01231 DEFINE_FWK_MODULE (EcalZmassClient);