CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

EcalZmassClient Class Reference

Inheritance diagram for EcalZmassClient:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EcalZmassClient (const edm::ParameterSet &)
 ~EcalZmassClient ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
virtual void endJob ()
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
virtual void endRun (edm::Run const &, edm::EventSetup const &)

Private Attributes

MonitorElementh_95_ee_invMass_BB
MonitorElementh_95_ee_invMass_EB
MonitorElementh_95_ee_invMass_EE
MonitorElementh_e1_et
MonitorElementh_e1_eta
MonitorElementh_e1_phi
MonitorElementh_e2_et
MonitorElementh_e2_eta
MonitorElementh_e2_phi
MonitorElementh_ee_invMass
MonitorElementh_ee_invMass_BB
MonitorElementh_ee_invMass_EB
MonitorElementh_ee_invMass_EE
MonitorElementh_fitres1
MonitorElementh_fitres1bis
MonitorElementh_fitres1Chi2
MonitorElementh_fitres2
MonitorElementh_fitres2bis
MonitorElementh_fitres2Chi2
MonitorElementh_fitres3
MonitorElementh_fitres3bis
MonitorElementh_fitres3Chi2
std::string prefixME_

Detailed Description

Definition at line 50 of file EcalZmassClient.cc.


Constructor & Destructor Documentation

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

Definition at line 133 of file EcalZmassClient.cc.

References edm::ParameterSet::getUntrackedParameter(), and prefixME_.

{
  prefixME_ = iConfig.getUntrackedParameter < std::string > ("prefixME", "");

}
EcalZmassClient::~EcalZmassClient ( )

Definition at line 140 of file EcalZmassClient.cc.

{

  // do anything here that needs to be done at desctruction time
  // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void EcalZmassClient::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 155 of file EcalZmassClient.cc.

{

}
void EcalZmassClient::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 164 of file EcalZmassClient.cc.

{
}
void EcalZmassClient::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 803 of file EcalZmassClient.cc.

{
}
void EcalZmassClient::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 176 of file EcalZmassClient.cc.

References DQMStore::book1D(), h_fitres1, h_fitres1bis, h_fitres1Chi2, h_fitres2, h_fitres2bis, h_fitres2Chi2, h_fitres3, h_fitres3bis, h_fitres3Chi2, cppFunctionSkipper::operator, prefixME_, and DQMStore::setCurrentFolder().

{
  DQMStore *theDbe = edm::Service < DQMStore > ().operator-> ();

  theDbe->setCurrentFolder (prefixME_ + "/Zmass");
  h_fitres1 =
    theDbe->book1D ("Gaussian mean WP80 EB-EB",
                    "Gaussian mean WP80 EB-EB", 1, 0, 1);
  h_fitres1bis =
    theDbe->book1D ("Gaussian sigma WP80 EB-EB",
                    "Gaussian sigma WP80 EB-EB", 1, 0, 1);
  h_fitres1Chi2 =
    theDbe->book1D ("Gaussian Chi2 result over NDF  WP80 EB-EB",
                    "Gaussian Chi2 result over NDF  WP80 EB-EB", 1, 0, 1);

  h_fitres3 =
    theDbe->book1D ("Gaussian mean WP80 EB-EE",
                    "Gaussian mean result WP80 EB-EE", 1, 0, 1);
  h_fitres3bis =
    theDbe->book1D ("Gaussian sigma WP80 EB-EE",
                    "Gaussian sigma WP80 EB-EE", 1, 0, 1);
  h_fitres3Chi2 =
    theDbe->book1D ("Gaussian Chi2 result over NDF WP80 EB-EE",
                    "Gaussian Chi2 result over NDF WP80 EB-EE", 1, 0, 1);

  h_fitres2 =
    theDbe->book1D ("Gaussian mean WP80 EE-EE",
                    "Gaussian mean WP80 EE-EE", 1, 0, 1);
  h_fitres2bis =
    theDbe->book1D ("Gaussian sigma WP80 EE-EE",
                    "Gaussian sigma WP80 EE-EE", 1, 0, 1);
  h_fitres2Chi2 =
    theDbe->book1D ("Gaussian Chi2 result over NDF WP80 EE-EE",
                    "Gaussian Chi2 result over NDF WP80 EE-EE", 1, 0, 1);
}
void EcalZmassClient::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 170 of file EcalZmassClient.cc.

{
}
void EcalZmassClient::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 810 of file EcalZmassClient.cc.

{
}
void EcalZmassClient::endRun ( edm::Run const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 243 of file EcalZmassClient.cc.

References DQMStore::get(), MonitorElement::getTH1F(), h_fitres1, h_fitres1bis, h_fitres1Chi2, h_fitres2, h_fitres2bis, h_fitres2Chi2, h_fitres3, h_fitres3bis, h_fitres3Chi2, LogTrace, timingPdfMaker::mean, mygauss(), N, cppFunctionSkipper::operator, prefixME_, and plotscripts::rms().

{
  DQMStore *theDbe = edm::Service < DQMStore > ().operator-> ();

  LogTrace ("EwkAnalyzer") << "Parameters initialization";

  MonitorElement *me1 = theDbe->get (prefixME_ + "/Zmass/Z peak - WP80 EB-EB");
  MonitorElement *me2 = theDbe->get (prefixME_ + "/Zmass/Z peak - WP80 EE-EE");
  MonitorElement *me3 = theDbe->get (prefixME_ + "/Zmass/Z peak - WP80 EB-EE");


  if (me1 != 0)
    {
      TH1F *B = me1->getTH1F ();
      TH1F *R1 = h_fitres1->getTH1F ();
      int division = B->GetNbinsX ();
      float massMIN = B->GetBinLowEdge (1);
      float massMAX = B->GetBinLowEdge (division + 1);
      //float BIN_SIZE = B->GetBinWidth(1);

      TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
      func->SetParameter (0, 1.0);
      func->SetParName (0, "const");
      func->SetParameter (1, 95.0);
      func->SetParName (1, "mean");
      func->SetParameter (2, 5.0);
      func->SetParName (2, "sigma");

      double stats[4];
      R1->GetStats (stats);
      float N = 0;
      float mean = 0;
      float sigma = 0;
      N = B->GetEntries ();

      try
      {
        if (N != 0)
          {

            B->Fit ("mygauss", "QR");
            mean = fabs (func->GetParameter (1));
            sigma = fabs (func->GetParError (1));
          }

        if (N == 0 || mean < 50 || mean > 100 || sigma <= 0 || sigma > 20)
          {
            N = 1;
            mean = 0;
            sigma = 0;
          }

      }
      catch (...)
      {
        edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
        N = 1;
        mean = 40;
        sigma = 0;
      }

      stats[0] = N;
      stats[1] = N;
      stats[2] = mean * N;
      stats[3] = sigma * sigma * N + mean * mean * N;

      R1->SetEntries (N);
      R1->PutStats (stats);
    }
/*******************************************************/
  if (me1 != 0)
    {
      TH1F *Bbis = me1->getTH1F ();
      TH1F *R1bis = h_fitres1bis->getTH1F ();
      int division = Bbis->GetNbinsX ();
      float massMIN = Bbis->GetBinLowEdge (1);
      float massMAX = Bbis->GetBinLowEdge (division + 1);
      //float BIN_SIZE = B->GetBinWidth(1);

      TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
      func->SetParameter (0, 1.0);
      func->SetParName (0, "const");
      func->SetParameter (1, 95.0);
      func->SetParName (1, "mean");
      func->SetParameter (2, 5.0);
      func->SetParName (2, "sigma");

      double stats[4];
      R1bis->GetStats (stats);
      float N = 0;
      float rms = 0;
      float rmsErr = 0;
      N = Bbis->GetEntries ();

      try
      {
        if (N != 0)
          {

            Bbis->Fit ("mygauss", "QR");
            rms = fabs (func->GetParameter (2));
            rmsErr = fabs (func->GetParError (2));
          }

        if (N == 0 || rms < 0 || rms > 50 || rmsErr <= 0 || rmsErr > 50)
          {
            N = 1;
            rms = 0;
            rmsErr = 0;
          }

      }
      catch (...)
      {
        edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
        N = 1;
        rms = 40;
        rmsErr = 0;
      }

      stats[0] = N;
      stats[1] = N;
      stats[2] = rms * N;
      stats[3] = rmsErr * rmsErr * N + rms * rms * N;

      R1bis->SetEntries (N);
      R1bis->PutStats (stats);
    }
/****************************************/

  if (me2 != 0)
    {
      TH1F *E = me2->getTH1F ();
      TH1F *R2 = h_fitres2->getTH1F ();
      int division = E->GetNbinsX ();
      float massMIN = E->GetBinLowEdge (1);
      float massMAX = E->GetBinLowEdge (division + 1);
      //float BIN_SIZE = E->GetBinWidth(1);

      TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
      func->SetParameter (0, 1.0);
      func->SetParName (0, "const");
      func->SetParameter (1, 95.0);
      func->SetParName (1, "mean");
      func->SetParameter (2, 5.0);
      func->SetParName (2, "sigma");

      double stats[4];
      R2->GetStats (stats);
      float N = 0;
      float mean = 0;
      float sigma = 0;
      N = E->GetEntries ();

      try
      {
        if (N != 0)
          {
            E->Fit ("mygauss", "QR");
            mean = fabs (func->GetParameter (1));
            sigma = fabs (func->GetParError (1));
          }

        if (N == 0 || mean < 50 || mean > 100 || sigma <= 0 || sigma > 20)
          {
            N = 1;
            mean = 0;
            sigma = 0;

          }

      }
      catch (...)
      {
        edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
        N = 1;
        mean = 40;
        sigma = 0;
      }

      stats[0] = N;
      stats[1] = N;
      stats[2] = mean * N;
      stats[3] = sigma * sigma * N + mean * mean * N;

      R2->SetEntries (N);
      R2->PutStats (stats);
    }
/**************************************************************************/

  if (me2 != 0)
    {
      TH1F *Ebis = me2->getTH1F ();
      TH1F *R2bis = h_fitres2bis->getTH1F ();
      int division = Ebis->GetNbinsX ();
      float massMIN = Ebis->GetBinLowEdge (1);
      float massMAX = Ebis->GetBinLowEdge (division + 1);
      //float BIN_SIZE = B->GetBinWidth(1);

      TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
      func->SetParameter (0, 1.0);
      func->SetParName (0, "const");
      func->SetParameter (1, 95.0);
      func->SetParName (1, "mean");
      func->SetParameter (2, 5.0);
      func->SetParName (2, "sigma");

      double stats[4];
      R2bis->GetStats (stats);
      float N = 0;
      float rms = 0;
      float rmsErr = 0;
      N = Ebis->GetEntries ();

      try
      {
        if (N != 0)
          {

            Ebis->Fit ("mygauss", "QR");
            rms = fabs (func->GetParameter (2));
            rmsErr = fabs (func->GetParError (2));
          }

        if (N == 0 || rms < 0 || rms > 50 || rmsErr <= 0 || rmsErr > 50)
          {
            N = 1;
            rms = 0;
            rmsErr = 0;
          }

      }
      catch (...)
      {
        edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
        N = 1;
        rms = 40;
        rmsErr = 0;
      }

      stats[0] = N;
      stats[1] = N;
      stats[2] = rms * N;
      stats[3] = rmsErr * rmsErr * N + rms * rms * N;

      R2bis->SetEntries (N);
      R2bis->PutStats (stats);
    }
/*********************************************************************************************/

  if (me3 != 0)
    {
      TH1F *R3 = h_fitres3->getTH1F ();
      TH1F *M = me3->getTH1F ();
      int division = M->GetNbinsX ();
      float massMIN = M->GetBinLowEdge (1);
      float massMAX = M->GetBinLowEdge (division + 1);
      //float BIN_SIZE = M->GetBinWidth(1);

      TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
      func->SetParameter (0, 1.0);
      func->SetParName (0, "const");
      func->SetParameter (1, 95.0);
      func->SetParName (1, "mean");
      func->SetParameter (2, 5.0);
      func->SetParName (2, "sigma");

      double stats[4];
      R3->GetStats (stats);
      float N = 0;
      float mean = 0;
      float sigma = 0;
      N = M->GetEntries ();


      try
      {
        if (N != 0)
          {

            M->Fit ("mygauss", "QR");
            mean = fabs (func->GetParameter (1));
            sigma = fabs (func->GetParError (1));
          }
        if (N == 0 || mean < 50 || mean > 100 || sigma <= 0 || sigma > 20)
          {
            N = 1;
            mean = 0;
            sigma = 0;
          }

      }
      catch (...)
      {
        edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
        N = 1;
        mean = 40;
        sigma = 0;
      }

      stats[0] = N;
      stats[1] = N;
      stats[2] = mean * N;
      stats[3] = sigma * sigma * N + mean * mean * N;

      R3->SetEntries (N);
      R3->PutStats (stats);
    }
  /********************************************************************************/

  if (me3 != 0)
    {
      TH1F *Mbis = me3->getTH1F ();
      TH1F *R3bis = h_fitres3bis->getTH1F ();
      int division = Mbis->GetNbinsX ();
      float massMIN = Mbis->GetBinLowEdge (1);
      float massMAX = Mbis->GetBinLowEdge (division + 1);
      //float BIN_SIZE = B->GetBinWidth(1);

      TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
      func->SetParameter (0, 1.0);
      func->SetParName (0, "const");
      func->SetParameter (1, 95.0);
      func->SetParName (1, "mean");
      func->SetParameter (2, 5.0);
      func->SetParName (2, "sigma");

      double stats[4];
      R3bis->GetStats (stats);
      float N = 0;
      float rms = 0;
      float rmsErr = 0;
      N = Mbis->GetEntries ();

      try
      {
        if (N != 0)
          {

            Mbis->Fit ("mygauss", "QR");
            rms = fabs (func->GetParameter (2));
            rmsErr = fabs (func->GetParError (2));
          }

        if (N == 0 || rms < 0 || rms > 50 || rmsErr <= 0 || rmsErr > 50)
          {
            N = 1;
            rms = 0;
            rmsErr = 0;
          }

      }
      catch (...)
      {
        edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
        N = 1;
        rms = 40;
        rmsErr = 0;
      }

      stats[0] = N;
      stats[1] = N;
      stats[2] = rms * N;
      stats[3] = rmsErr * rmsErr * N + rms * rms * N;

      R3bis->SetEntries (N);
      R3bis->PutStats (stats);
    }

  /*Chi2 */

  if (me1 != 0)
    {
      TH1F *C1 = me1->getTH1F ();
      TH1F *S1 = h_fitres1Chi2->getTH1F ();
      int division = C1->GetNbinsX ();
      float massMIN = C1->GetBinLowEdge (1);
      float massMAX = C1->GetBinLowEdge (division + 1);
      //float BIN_SIZE = B->GetBinWidth(1);

      TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
      func->SetParameter (0, 1.0);
      func->SetParName (0, "const");
      func->SetParameter (1, 95.0);
      func->SetParName (1, "mean");
      func->SetParameter (2, 5.0);
      func->SetParName (2, "sigma");

      double stats[4];
      S1->GetStats (stats);
      float N = 0;
      float Chi2 = 0;
      float NDF = 0;
      N = C1->GetEntries ();

      try
      {
        if (N != 0)
          {

            C1->Fit ("mygauss", "QR");
            if ((func->GetNDF () != 0))
              {
                Chi2 = fabs (func->GetChisquare ()) / fabs (func->GetNDF ());
                NDF = 0.1;
              }
          }

        if (N == 0 || Chi2 < 0 || NDF < 0)
          {
            N = 1;
            Chi2 = 0;
            NDF = 0;
          }

      }
      catch (...)
      {
        edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
        N = 1;
        Chi2 = 40;
        NDF = 0;
      }

      stats[0] = N;
      stats[1] = N;
      stats[2] = Chi2 * N;
      stats[3] = NDF * NDF * N + Chi2 * Chi2 * N;

      S1->SetEntries (N);
      S1->PutStats (stats);
    }
  /**********************************************/

  if (me2 != 0)
    {
      TH1F *C2 = me2->getTH1F ();
      TH1F *S2 = h_fitres2Chi2->getTH1F ();
      int division = C2->GetNbinsX ();
      float massMIN = C2->GetBinLowEdge (1);
      float massMAX = C2->GetBinLowEdge (division + 1);
      //float BIN_SIZE = B->GetBinWidth(1);

      TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
      func->SetParameter (0, 1.0);
      func->SetParName (0, "const");
      func->SetParameter (1, 95.0);
      func->SetParName (1, "mean");
      func->SetParameter (2, 5.0);
      func->SetParName (2, "sigma");

      double stats[4];
      S2->GetStats (stats);
      float N = 0;
      float Chi2 = 0;
      float NDF = 0;
      N = C2->GetEntries ();

      try
      {
        if (N != 0)
          {
            C2->Fit ("mygauss", "QR");
            if (func->GetNDF () != 0)
              {
                Chi2 = fabs (func->GetChisquare ()) / fabs (func->GetNDF ());
                NDF = 0.1;
              }
          }

        if (N == 0 || Chi2 < 0 || NDF < 0)
          {
            N = 1;
            Chi2 = 0;
            NDF = 0;
          }

      }
      catch (...)
      {
        edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
        N = 1;
        Chi2 = 40;
        NDF = 0;
      }

      stats[0] = N;
      stats[1] = N;
      stats[2] = Chi2 * N;
      stats[3] = NDF * NDF * N + Chi2 * Chi2 * N;

      S2->SetEntries (N);
      S2->PutStats (stats);
    }
  /**************************************************************************/
  if (me3 != 0)
    {
      TH1F *C3 = me3->getTH1F ();
      TH1F *S3 = h_fitres3Chi2->getTH1F ();
      int division = C3->GetNbinsX ();
      float massMIN = C3->GetBinLowEdge (1);
      float massMAX = C3->GetBinLowEdge (division + 1);
      //float BIN_SIZE = B->GetBinWidth(1);

      TF1 *func = new TF1 ("mygauss", mygauss, massMIN, massMAX, 3);
      func->SetParameter (0, 1.0);
      func->SetParName (0, "const");
      func->SetParameter (1, 95.0);
      func->SetParName (1, "mean");
      func->SetParameter (2, 5.0);
      func->SetParName (2, "sigma");

      double stats[4];
      S3->GetStats (stats);
      float N = 0;
      float Chi2 = 0;
      float NDF = 0;
      N = C3->GetEntries ();

      try
      {
        if (N != 0)
          {
            C3->Fit ("mygauss", "QR");
            if ((func->GetNDF () != 0))
              {
                Chi2 = fabs (func->GetChisquare ()) / fabs (func->GetNDF ());
                NDF = 0.1;
              }
          }


        if (N == 0 || Chi2 < 0 || NDF < 0)
          {
            N = 1;
            Chi2 = 0;
            NDF = 0;
          }

      }
      catch (...)
      {
        edm::LogError ("ZFitter") << "[Zfitter]: Exception when fitting...";
        N = 1;
        Chi2 = 40;
        NDF = 0;
      }

      stats[0] = N;
      stats[1] = N;
      stats[2] = Chi2 * N;
      stats[3] = NDF * NDF * N + Chi2 * Chi2 * N;

      S3->SetEntries (N);
      S3->PutStats (stats);
    }
}
void EcalZmassClient::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDAnalyzer.

Definition at line 817 of file EcalZmassClient.cc.

References edm::ParameterSetDescription::setUnknown().

{
  //The following says we do not know what parameters are allowed so do no validation
  // Please change this to state exactly what you do use, even if it is no parameters
  edm::ParameterSetDescription desc;
  desc.setUnknown ();
  descriptions.addDefault (desc);
}

Member Data Documentation

Definition at line 96 of file EcalZmassClient.cc.

Definition at line 92 of file EcalZmassClient.cc.

Definition at line 94 of file EcalZmassClient.cc.

Definition at line 100 of file EcalZmassClient.cc.

Definition at line 104 of file EcalZmassClient.cc.

Definition at line 108 of file EcalZmassClient.cc.

Definition at line 102 of file EcalZmassClient.cc.

Definition at line 106 of file EcalZmassClient.cc.

Definition at line 110 of file EcalZmassClient.cc.

Definition at line 98 of file EcalZmassClient.cc.

Definition at line 90 of file EcalZmassClient.cc.

Definition at line 86 of file EcalZmassClient.cc.

Definition at line 88 of file EcalZmassClient.cc.

Definition at line 112 of file EcalZmassClient.cc.

Referenced by beginRun(), and endRun().

Definition at line 114 of file EcalZmassClient.cc.

Referenced by beginRun(), and endRun().

Definition at line 116 of file EcalZmassClient.cc.

Referenced by beginRun(), and endRun().

Definition at line 118 of file EcalZmassClient.cc.

Referenced by beginRun(), and endRun().

Definition at line 120 of file EcalZmassClient.cc.

Referenced by beginRun(), and endRun().

Definition at line 122 of file EcalZmassClient.cc.

Referenced by beginRun(), and endRun().

Definition at line 124 of file EcalZmassClient.cc.

Referenced by beginRun(), and endRun().

Definition at line 126 of file EcalZmassClient.cc.

Referenced by beginRun(), and endRun().

Definition at line 128 of file EcalZmassClient.cc.

Referenced by beginRun(), and endRun().

std::string EcalZmassClient::prefixME_ [private]

Definition at line 83 of file EcalZmassClient.cc.

Referenced by beginRun(), EcalZmassClient(), and endRun().