CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

DQMSourceExample Class Reference

#include <DQMSourceExample.h>

Inheritance diagram for DQMSourceExample:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
void beginJob ()
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
void beginRun (const edm::Run &r, const edm::EventSetup &c)
void endJob ()
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
void endRun (const edm::Run &r, const edm::EventSetup &c)

Private Member Functions

void initialize ()

Private Attributes

int counterEvt_
int counterLS_
DQMStoredbe_
MonitorElementdeadFalse
MonitorElementdeadTrue
MonitorElementf1
MonitorElementh1
MonitorElementh1hist
MonitorElementh2
MonitorElementh3
MonitorElementh4
MonitorElementi1
MonitorElementmeanFalse
MonitorElementmeanTrue
std::string monitorName_
int NBINS
MonitorElementnoisyFalse
MonitorElementnoisyTrue
MonitorElementp1
MonitorElementp2
edm::ParameterSet parameters_
int prescaleEvt_
int prescaleLS_
MonitorElements1
MonitorElementsumm
MonitorElementwExpFalse
MonitorElementwExpTrue
MonitorElementxFalse
float XMAX
float XMIN
MonitorElementxTrue
MonitorElementyFalse
MonitorElementyTrue

Detailed Description

* DQM Test Client

Date:
2009/12/14 22:22:21
Revision:
1.13
Author:
M. Zanetti CERN

Definition at line 23 of file DQMSourceExample.h.


Constructor & Destructor Documentation

DQMSourceExample::DQMSourceExample ( const edm::ParameterSet ps)

Definition at line 25 of file DQMSourceExample.cc.

                                                             {
  parameters_ = ps;
  initialize();
}
DQMSourceExample::~DQMSourceExample ( )

Definition at line 30 of file DQMSourceExample.cc.

                                   {
}

Member Function Documentation

void DQMSourceExample::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

Implements edm::EDAnalyzer.

Definition at line 163 of file DQMSourceExample.cc.

References gather_cfg::cout, validate-o2o-wbm::f1, i, funct::log(), p1, p2, x, detailsBasic3DVector::y, and z.

                                                                            {
  counterEvt_++;
  if (prescaleEvt_<1)  return;
  if (prescaleEvt_ > 0 && counterEvt_%prescaleEvt_!=0)  return;
  //  cout << " processing conterEvt_: " << counterEvt_ <<endl;

  // fill integer and float
// number exceeding 32 bits
  i1->Fill(400000000000000LL); // FIXME use double
  f1->Fill(-3.14);
 
  //----------------------------------------
  // Filling the histograms with random data
  //----------------------------------------

  srand( 0 );
  // fill summ histo
  if(counterEvt_%1000 == 0) {
    cout << " # of events = " << counterEvt_ << endl;
    summ->Fill(counterEvt_/1000., counterEvt_);
  }
  // fill summ histo
  if(counterEvt_%100 == 0) {
    h1hist->ShiftFillLast(gRandom->Gaus(12,1.),1.,5);
  }

  float z  = gRandom->Uniform(XMAX);
  xTrue->Fill(  z, 1./log(z+1.) );
  xFalse->Fill( z+(XMAX/2.),  z );
  yTrue->Fill(  z, 1./log(z+1.) );
  yFalse->Fill( z, z );
  meanTrue->Fill(  gRandom->Gaus(10,  2), 1.);
  meanFalse->Fill( gRandom->Gaus(12,  3), 1.);
  wExpTrue->Fill(  gRandom->Gaus(12,  1), gRandom->Gaus(12, 1), 1.);
  wExpFalse->Fill( gRandom->Gaus(20,  2), gRandom->Gaus(20, 2), 1.);
  deadTrue->Fill(  gRandom->Gaus(20, 10), 2.);
  deadFalse->Fill( gRandom->Gaus(20,  4), 1.);
  h2->Fill(  gRandom->Gaus(20,  4), 1.);
//  h3->Fill(  XMIN, 0xffff00000000LL);
//  h4->Fill(  XMIN, XMIN, 0xffff00000000LL); 
  
  //h1hist->Print();
  //h1hist->Print();

  for ( int i = 0; i != 10; ++i ) {
    float w = gRandom->Uniform(XMAX);
    noisyTrue->Fill(  w, 1.);
    noisyFalse->Fill( z, 1.);
    float x = gRandom->Gaus(12, 1);
    float y = gRandom->Gaus(20, 2);
    p1->Fill(x, y);
    p2->Fill(x, y, (x+y)/2.);
    h1->Fill(y, 1.);
  }

  // usleep(100);

}
void DQMSourceExample::beginJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 63 of file DQMSourceExample.cc.

References DQMStore::book1D(), DQMStore::book1S(), DQMStore::book2D(), DQMStore::bookFloat(), DQMStore::bookInt(), DQMStore::bookProfile(), DQMStore::bookProfile2D(), DQMStore::bookString(), dbe_, validate-o2o-wbm::f1, i, NBINS, cmsCodeRules::cppFunctionSkipper::operator, p1, p2, DQMStore::setCurrentFolder(), DQMStore::showDirStructure(), DQMStore::tag(), DQMStore::tagContents(), and cond::rpcobtemp::temp.

                                {
  dbe_ = Service<DQMStore>().operator->();

  dbe_->setCurrentFolder(monitorName_+"DQMsource/Summary");
  summ = dbe_->book1D("summary", "Run Summary", 100, 0, 100); 

  //-------------------------------------
  // testing of Quality Tests 
  //-------------------------------------

   dbe_->setCurrentFolder(monitorName_+"DQMsource/QTests");

   NBINS = 40 ; XMIN  =  0.; XMAX  = 40.;

  xTrue     = dbe_->book1D("XTrue",       "X Range QTest",                  NBINS, XMIN, XMAX);
  xFalse    = dbe_->book1D("XFalse",      "X Range QTest",                  NBINS, XMIN, XMAX);
  yTrue     = dbe_->book1D("YTrue",       "Y Range QTest",                  NBINS, XMIN, XMAX);
  yFalse    = dbe_->book1D("YFalse",      "Y Range QTest",                  NBINS, XMIN, XMAX);
  wExpTrue  = dbe_->book2D("WExpTrue",    "Contents Within Expected QTest", NBINS, XMIN, XMAX, NBINS, XMIN, XMAX);
  wExpFalse = dbe_->book2D("WExpFalse",   "Contents Within Expected QTest", NBINS, XMIN, XMAX, NBINS, XMIN, XMAX);
  meanTrue  = dbe_->book1D("MeanTrue",    "Mean Within Expected QTest",     NBINS, XMIN, XMAX);
  meanFalse = dbe_->book1D("MeanFalse",   "Mean Within Expected QTest",     NBINS, XMIN, XMAX);
  deadTrue  = dbe_->book1D("DeadTrue",    "Dead Channel QTest",             NBINS, XMIN, XMAX);
  deadFalse = dbe_->book1D("DeadFalse",   "Dead Channel QTest",             NBINS, XMIN, XMAX);
  noisyTrue  = dbe_->book1D("NoisyTrue",  "Noisy Channel QTest",            NBINS, XMIN, XMAX);
  noisyFalse = dbe_->book1D("NoisyFalse", "Noisy Channel QTest",            NBINS, XMIN, XMAX);


  //-------------------------------------
  // book several ME more  
  //-------------------------------------

  dbe_->setCurrentFolder(monitorName_+"DQMsource/C1");
  const int NBINS2 = 10;
 
  i1        = dbe_->bookInt("int1");
  f1        = dbe_->bookFloat("float1");
  s1        = dbe_->bookString("s1", "My string");
  h1        = dbe_->book1D("h1f", "Example TH1F 1D histogram.", NBINS2, XMIN, XMAX);
  h2        = dbe_->book1S("h1s", "Example TH1S histogram.", NBINS, XMIN, XMAX);
//  h3        = dbe_->book1DD("h1d", "Example TH1D histogram.", NBINS, XMIN, XMAX);
//  h4        = dbe_->book2DD("h2d", "Example TH2D histogram.", NBINS, XMIN, XMAX,NBINS, XMIN, XMAX);
  p1        = dbe_->bookProfile(  "prof1", "My profile 1D", NBINS,XMIN,XMAX,NBINS,XMIN,XMAX,"");
  p2        = dbe_->bookProfile2D("prof2", "My profile 2D", NBINS,XMIN,XMAX,NBINS,XMIN,XMAX,NBINS,XMIN,XMAX,"");
  h1hist    = dbe_->book1D("history 1D","Example 1 1D history plot", 30, 0.,30.);
 
  // set labels for h1
  char temp[1024];
  for(int i = 1; i <= NBINS2; ++i) {
    sprintf(temp, " bin no. %d", i);
    h1->setBinLabel(i, temp);
  }

  // assign tag to MEs h1
  const unsigned int detector_id = 17;
  dbe_->tag(h1, detector_id);

  // tag full directory
  dbe_->tagContents(monitorName_+"DQMsource/C1", detector_id);

  /*
  // contents of h5 & h6 will be reset at end of monitoring cycle
  h5->setResetMe(true);
  h6->setResetMe(true);
  dbe_->showDirStructure();
  std::vector<std::string> tags;
  dbe_->getAllTags(tags);
  for (size_t i = 0, e = tags.size(); i < e; ++i)
    std::cout << "TAGS [" << i << "] = " << tags[i] << std::endl;
  */

    dbe_->showDirStructure ();
}
void DQMSourceExample::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 155 of file DQMSourceExample.cc.

                                                                       {
}
void DQMSourceExample::beginRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 148 of file DQMSourceExample.cc.

                                                                          {
}
void DQMSourceExample::endJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 240 of file DQMSourceExample.cc.

References gather_cfg::cout.

                              {
   std::cout << "DQMSourceExample::endJob()" << std::endl;
}
void DQMSourceExample::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 225 of file DQMSourceExample.cc.

                                                                     {

}
void DQMSourceExample::endRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 233 of file DQMSourceExample.cc.

                                                                     {

}
void DQMSourceExample::initialize ( ) [private]

Definition at line 36 of file DQMSourceExample.cc.

References gather_cfg::cout, dbe_, and cmsCodeRules::cppFunctionSkipper::operator.

                                  {

  counterEvt_ = 0; counterLS_  = 0;

  dbe_ = Service<DQMStore>().operator->();

  monitorName_ = parameters_.getUntrackedParameter<string>("monitorName","YourSubsystemName");
  cout << "DQMSourceExample: Monitor name = " << monitorName_ << endl;
  if (monitorName_ != "" ) monitorName_ = monitorName_+"/" ;
  
  prescaleLS_  = parameters_.getUntrackedParameter<int>("prescaleLS",  -1);
  cout << "DQMSourceExample: DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)"<< endl;
  prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
  cout << "DQMSourceExample: DQM event prescale = " << prescaleEvt_ << " events(s)"<< endl;

// read in files (use DQMStore.collateHistograms = True for summing
//  dbe_->load("ref.root");
//  dbe_->load("ref.root");
}

Member Data Documentation

Definition at line 61 of file DQMSourceExample.h.

Definition at line 62 of file DQMSourceExample.h.

Definition at line 58 of file DQMSourceExample.h.

Definition at line 84 of file DQMSourceExample.h.

Definition at line 83 of file DQMSourceExample.h.

Definition at line 90 of file DQMSourceExample.h.

Definition at line 94 of file DQMSourceExample.h.

Definition at line 95 of file DQMSourceExample.h.

Definition at line 96 of file DQMSourceExample.h.

Definition at line 97 of file DQMSourceExample.h.

Definition at line 98 of file DQMSourceExample.h.

Definition at line 89 of file DQMSourceExample.h.

Definition at line 81 of file DQMSourceExample.h.

Definition at line 80 of file DQMSourceExample.h.

std::string DQMSourceExample::monitorName_ [private]

Definition at line 59 of file DQMSourceExample.h.

int DQMSourceExample::NBINS [private]

Definition at line 69 of file DQMSourceExample.h.

Definition at line 86 of file DQMSourceExample.h.

Definition at line 85 of file DQMSourceExample.h.

Definition at line 92 of file DQMSourceExample.h.

Definition at line 93 of file DQMSourceExample.h.

Definition at line 56 of file DQMSourceExample.h.

Definition at line 64 of file DQMSourceExample.h.

Definition at line 65 of file DQMSourceExample.h.

Definition at line 91 of file DQMSourceExample.h.

Definition at line 99 of file DQMSourceExample.h.

Definition at line 79 of file DQMSourceExample.h.

Definition at line 78 of file DQMSourceExample.h.

Definition at line 74 of file DQMSourceExample.h.

float DQMSourceExample::XMAX [private]

Definition at line 70 of file DQMSourceExample.h.

float DQMSourceExample::XMIN [private]

Definition at line 70 of file DQMSourceExample.h.

Definition at line 73 of file DQMSourceExample.h.

Definition at line 76 of file DQMSourceExample.h.

Definition at line 75 of file DQMSourceExample.h.