CMS 3D CMS Logo

SiPixelEDAClient Class Reference

#include <DQM/SiPixelMonitorClient/interface/SiPixelEDAClient.h>

Inheritance diagram for SiPixelEDAClient:

edm::EDAnalyzer evf::ModuleWeb

List of all members.

Public Member Functions

void defaultWebPage (xgi::Input *in, xgi::Output *out)
void publish (xdata::InfoSpace *)
 SiPixelEDAClient (const edm::ParameterSet &ps)
virtual ~SiPixelEDAClient ()

Protected Member Functions

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

Private Attributes

bool actionOnLumiSec_
bool actionOnRunEnd_
DQMStorebei_
int evtOffsetForInit_
bool hiRes_
std::ostringstream html_out_
unsigned long long m_cacheID_
int nEvents_
int nFEDs_
int nLumiSecs_
double noiseRate_
int noiseRateDenominator_
bool offlineXMLfile_
SiPixelActionExecutorsipixelActionExecutor_
SiPixelInformationExtractorsipixelInformationExtractor_
SiPixelWebInterfacesipixelWebInterface_
unsigned int staticUpdateFrequency_
int summaryFrequency_
std::string summaryXMLfile_
bool Tier0Flag_
int tkMapFrequency_
SiPixelTrackerMapCreatortrackerMapCreator_


Detailed Description

Definition at line 24 of file SiPixelEDAClient.h.


Constructor & Destructor Documentation

SiPixelEDAClient::SiPixelEDAClient ( const edm::ParameterSet ps  ) 

Definition at line 60 of file SiPixelEDAClient.cc.

References actionOnLumiSec_, actionOnRunEnd_, bei_, BUF_SIZE, TestMuL1L2Filter_cff::cerr, lat::endl(), evtOffsetForInit_, edm::ParameterSet::getUntrackedParameter(), hiRes_, html_out_, in, noiseRate_, noiseRateDenominator_, offlineXMLfile_, sipixelActionExecutor_, sipixelInformationExtractor_, sipixelWebInterface_, staticUpdateFrequency_, summaryFrequency_, Tier0Flag_, and tkMapFrequency_.

00060                                                             :
00061   ModuleWeb("SiPixelEDAClient"){
00062 // cout<<"Entering  SiPixelEDAClient::SiPixelEDAClient: "<<endl;
00063  
00064   edm::LogInfo("SiPixelEDAClient") <<  " Creating SiPixelEDAClient " << "\n" ;
00065   
00066   bei_ = Service<DQMStore>().operator->();
00067 
00068   summaryFrequency_      = ps.getUntrackedParameter<int>("SummaryCreationFrequency",20);
00069   tkMapFrequency_        = ps.getUntrackedParameter<int>("TkMapCreationFrequency",50); 
00070   staticUpdateFrequency_ = ps.getUntrackedParameter<int>("StaticUpdateFrequency",10);
00071   actionOnLumiSec_       = ps.getUntrackedParameter<bool>("ActionOnLumiSection",false);
00072   actionOnRunEnd_        = ps.getUntrackedParameter<bool>("ActionOnRunEnd",true);
00073   evtOffsetForInit_      = ps.getUntrackedParameter<int>("EventOffsetForInit",10);
00074   offlineXMLfile_        = ps.getUntrackedParameter<bool>("UseOfflineXMLFile",false);
00075   hiRes_                 = ps.getUntrackedParameter<bool>("HighResolutionOccupancy",false);
00076   noiseRate_             = ps.getUntrackedParameter<double>("NoiseRateCutValue",0.001);
00077   noiseRateDenominator_  = ps.getUntrackedParameter<int>("NEventsForNoiseCalculation",100000);
00078   Tier0Flag_             = ps.getUntrackedParameter<bool>("Tier0Flag",false);
00079   
00080   if(!Tier0Flag_){
00081     string localPath = string("DQM/SiPixelMonitorClient/test/loader.html");
00082     ifstream fin(edm::FileInPath(localPath).fullPath().c_str(), ios::in);
00083     char buf[BUF_SIZE];
00084   
00085     if (!fin) {
00086       cerr << "Input File: loader.html"<< " could not be opened!" << endl;
00087       return;
00088     }
00089 
00090     while (fin.getline(buf, BUF_SIZE, '\n')) { // pops off the newline character 
00091       html_out_ << buf ;
00092     }
00093     fin.close();
00094 
00095   }
00096   
00097   // instantiate web interface
00098   sipixelWebInterface_ = new SiPixelWebInterface(bei_,offlineXMLfile_);
00099   //instantiate the two work horses of the client:
00100   sipixelInformationExtractor_ = new SiPixelInformationExtractor(offlineXMLfile_);
00101   sipixelActionExecutor_ = new SiPixelActionExecutor(offlineXMLfile_);
00102   
00103 // cout<<"...leaving  SiPixelEDAClient::SiPixelEDAClient. "<<endl;
00104 }
//

SiPixelEDAClient::~SiPixelEDAClient (  )  [virtual]

Definition at line 108 of file SiPixelEDAClient.cc.

00108                                    {
00109 //  cout<<"Entering SiPixelEDAClient::~SiPixelEDAClient: "<<endl;
00110   
00111   edm::LogInfo("SiPixelEDAClient") <<  " Deleting SiPixelEDAClient " << "\n" ;
00112 //  if (sipixelWebInterface_) {
00113 //     delete sipixelWebInterface_;
00114 //     sipixelWebInterface_ = 0;
00115 //  }
00116 //  if (trackerMapCreator_) {
00117 //    delete trackerMapCreator_;
00118 //    trackerMapCreator_ = 0;
00119 //  }
00120 
00121 //  cout<<"...leaving SiPixelEDAClient::~SiPixelEDAClient. "<<endl;
00122 }


Member Function Documentation

void SiPixelEDAClient::analyze ( edm::Event const &  e,
edm::EventSetup const &  eSetup 
) [protected, virtual]

Implements edm::EDAnalyzer.

Definition at line 175 of file SiPixelEDAClient.cc.

References SiPixelWebInterface::CreatePlots, FEDRawData::data(), FEDRawDataCollection::FEDData(), edm::Event::getByLabel(), i, nEvents_, nFEDs_, SiPixelWebInterface::performAction(), SiPixelWebInterface::setActionFlag(), sipixelWebInterface_, FEDRawData::size(), and Tier0Flag_.

00175                                                                             {
00176 //  cout<<"[SiPixelEDAClient::analyze()] "<<endl;
00177   nEvents_++;  
00178   if(!Tier0Flag_){
00179    
00180     if(nEvents_==1){
00181       // check if any Pixel FED is in readout:
00182       edm::Handle<FEDRawDataCollection> rawDataHandle;
00183       e.getByLabel("source", rawDataHandle);
00184       const FEDRawDataCollection& rawDataCollection = *rawDataHandle;
00185       nFEDs_ = 0;
00186       for(int i = 0; i != 40; i++){
00187         if(rawDataCollection.FEDData(i).size() && rawDataCollection.FEDData(i).data()) nFEDs_++;
00188       }
00189     }
00190     
00191     sipixelWebInterface_->setActionFlag(SiPixelWebInterface::CreatePlots);
00192     sipixelWebInterface_->performAction();
00193   }
00194   
00195 }

void SiPixelEDAClient::beginJob ( edm::EventSetup const &  eSetup  )  [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 126 of file SiPixelEDAClient.cc.

References actionOnLumiSec_, actionOnRunEnd_, bei_, SiPixelInformationExtractor::bookGlobalQualityFlag(), SiPixelActionExecutor::bookOccupancyPlots(), SiPixelActionExecutor::createSummary(), evtOffsetForInit_, hiRes_, nEvents_, nFEDs_, nLumiSecs_, noiseRate_, SiPixelWebInterface::readConfiguration(), DQMStore::setCurrentFolder(), SiPixelActionExecutor::setupQTests(), sipixelActionExecutor_, sipixelInformationExtractor_, sipixelWebInterface_, summaryFrequency_, Tier0Flag_, and tkMapFrequency_.

00126                                                           {
00127 //  cout<<"Entering SiPixelEDAClient::beginJob: "<<endl;
00128 
00129   // Read the summary configuration file
00130   if (!sipixelWebInterface_->readConfiguration(tkMapFrequency_,summaryFrequency_)) {
00131      edm::LogInfo ("SiPixelEDAClient") <<"[SiPixelEDAClient]: Error to read configuration file!! Summary will not be produced!!!";
00132      summaryFrequency_ = -1;
00133      tkMapFrequency_ = -1;
00134      actionOnLumiSec_ = false;
00135      actionOnRunEnd_ = true;
00136      evtOffsetForInit_ = -1;
00137   }
00138   nLumiSecs_ = 0;
00139   nEvents_   = 0;
00140   
00141   bei_->setCurrentFolder("Pixel/");
00142   // Setting up QTests:
00143   sipixelActionExecutor_->setupQTests(bei_);
00144   // Creating Summary Histos:
00145   sipixelActionExecutor_->createSummary(bei_);
00146   // Creating occupancy plots:
00147   sipixelActionExecutor_->bookOccupancyPlots(bei_, hiRes_);
00148   // Booking summary report ME's:
00149   sipixelInformationExtractor_->bookGlobalQualityFlag(bei_, noiseRate_,Tier0Flag_);
00150   if(!Tier0Flag_) nFEDs_ = 40;
00151 
00152 //  cout<<"...leaving SiPixelEDAClient::beginJob. "<<endl;
00153 }

void SiPixelEDAClient::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 164 of file SiPixelEDAClient.cc.

00165                                                                           {
00166 //  cout<<"Entering SiPixelEDAClient::beginLuminosityBlock: "<<endl;
00167   
00168   edm::LogInfo ("SiPixelEDAClient") <<"[SiPixelEDAClient]: Begin of LS transition";
00169 
00170 //  cout<<"...leaving SiPixelEDAClient::beginLuminosityBlock. "<<endl;
00171 }

void SiPixelEDAClient::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 157 of file SiPixelEDAClient.cc.

00157                                                                            {
00158   edm::LogInfo ("SiPixelEDAClient") <<"[SiPixelEDAClient]: Begining of Run";
00159 
00160 }

void SiPixelEDAClient::defaultWebPage ( xgi::Input *  in,
xgi::Output *  out 
) [virtual]

Reimplemented from evf::ModuleWeb.

Definition at line 292 of file SiPixelEDAClient.cc.

References lat::endl(), SiPixelWebInterface::handleEDARequest(), html_out_, iter, nEvents_, and sipixelWebInterface_.

00293 {
00294 //  cout<<"Entering SiPixelEDAClient::defaultWebPage: "<<endl;
00295       
00296   bool isRequest = false;
00297   cgicc::Cgicc cgi(in);
00298   cgicc::CgiEnvironment cgie(in);
00299   //  edm::LogInfo("SiPixelEDAClient") <<"[SiPixelEDAClient]: defaultWebPage "
00300   //             << " query string : " << cgie.getQueryString();
00301   //  if ( xgi::Utils::hasFormElement(cgi,"ClientRequest") ) isRequest = true;
00302   string q_string = cgie.getQueryString();
00303   if (q_string.find("RequestID") != string::npos) isRequest = true;
00304   if (!isRequest) {    
00305     *out << html_out_.str() << std::endl;
00306   }  else {
00307     // Handles all HTTP requests of the form
00308     int iter = nEvents_/100;
00309     sipixelWebInterface_->handleEDARequest(in, out, iter);
00310   }
00311 
00312 //  cout<<"...leaving SiPixelEDAClient::defaultWebPage. "<<endl;
00313 }

void SiPixelEDAClient::endJob ( void   )  [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 284 of file SiPixelEDAClient.cc.

00284                              {
00285 //  cout<<"In SiPixelEDAClient::endJob "<<endl;
00286   edm::LogInfo("SiPixelEDAClient") <<"[SiPixelEDAClient]: endjob called!";
00287 
00288 }

void SiPixelEDAClient::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 199 of file SiPixelEDAClient.cc.

References actionOnLumiSec_, bei_, SiPixelActionExecutor::bookOccupancyPlots(), DQMStore::cd(), SiPixelInformationExtractor::computeGlobalQualityFlag(), lat::endl(), SiPixelInformationExtractor::fillGlobalQualityPlot(), SiPixelInformationExtractor::findNoisyPixels(), hiRes_, init, edm::LuminosityBlock::luminosityBlock(), nFEDs_, nLumiSecs_, noiseRate_, noiseRateDenominator_, SiPixelWebInterface::Occupancy, SiPixelWebInterface::performAction(), SiPixelWebInterface::QTestResult, SiPixelWebInterface::setActionFlag(), sipixelActionExecutor_, sipixelInformationExtractor_, sipixelWebInterface_, SiPixelWebInterface::Summary, and Tier0Flag_.

00199                                                                                                         {
00200   //cout<<"Entering SiPixelEDAClient::endLuminosityBlock: "<<endl;
00201 
00202   edm::LogInfo ("SiPixelEDAClient") <<"[SiPixelEDAClient]: End of LS transition, performing the DQM client operation";
00203 
00204   nLumiSecs_++;
00205 
00206   edm::LogInfo("SiPixelEDAClient") << "====================================================== " << endl << " ===> Iteration # " << nLumiSecs_ << " " << lumiSeg.luminosityBlock() << endl  << "====================================================== " << endl;
00207 
00208   if(actionOnLumiSec_){
00209     //cout << " Updating Summary " << endl;
00210     sipixelWebInterface_->setActionFlag(SiPixelWebInterface::Summary);
00211     sipixelWebInterface_->performAction();
00212     //cout << " Checking QTest results " << endl;
00213     sipixelWebInterface_->setActionFlag(SiPixelWebInterface::QTestResult);
00214     sipixelWebInterface_->performAction();
00215      //cout << " Updating occupancy plots" << endl;
00216     sipixelActionExecutor_->bookOccupancyPlots(bei_, hiRes_);
00217     sipixelWebInterface_->setActionFlag(SiPixelWebInterface::Occupancy);
00218     sipixelWebInterface_->performAction();
00219     //cout  << " Checking Pixel quality flags " << endl;;
00220     bei_->cd();
00221     bool init=true;
00222     sipixelInformationExtractor_->computeGlobalQualityFlag(bei_,init,nFEDs_,Tier0Flag_);
00223     init=true;
00224     sipixelInformationExtractor_->fillGlobalQualityPlot(bei_,init,eSetup,nFEDs_,Tier0Flag_);
00225     //cout << " Checking for new noisy pixels " << endl;
00226     init=true;
00227     if(noiseRate_>=0.) sipixelInformationExtractor_->findNoisyPixels(bei_, init, noiseRate_, noiseRateDenominator_, eSetup);
00228   }   
00229          
00230   // -- Create TrackerMap  according to the frequency
00231 //  if (tkMapFrequency_ != -1 && nLumiBlock%tkMapFrequency_ == 1) {
00232 //    cout << " Creating Tracker Map " << endl;
00233 //    trackerMapCreator_->create(bei_);
00234 //    //sipixelWebInterface_->setTkMapFlag(true);
00235 //
00236 //  }
00237   // Create predefined plots
00238 //  if (nLumiBlock%staticUpdateFrequency_  == 1) {
00239 //    cout << " Creating predefined plots " << endl;
00240 //    sipixelWebInterface_->setActionFlag(SiPixelWebInterface::PlotHistogramFromLayout);
00241 //    sipixelWebInterface_->performAction();
00242 //  }
00243 
00244 
00245   //cout<<"...leaving SiPixelEDAClient::endLuminosityBlock. "<<endl;
00246 }

void SiPixelEDAClient::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 250 of file SiPixelEDAClient.cc.

References actionOnRunEnd_, bei_, SiPixelActionExecutor::bookOccupancyPlots(), DQMStore::cd(), SiPixelInformationExtractor::computeGlobalQualityFlag(), SiPixelInformationExtractor::fillGlobalQualityPlot(), SiPixelInformationExtractor::findNoisyPixels(), hiRes_, init, nFEDs_, noiseRate_, noiseRateDenominator_, SiPixelWebInterface::Occupancy, SiPixelWebInterface::performAction(), SiPixelWebInterface::QTestResult, SiPixelWebInterface::setActionFlag(), sipixelActionExecutor_, sipixelInformationExtractor_, sipixelWebInterface_, SiPixelWebInterface::Summary, and Tier0Flag_.

00250                                                                            {
00251   //cout<<"Entering SiPixelEDAClient::endRun: "<<endl;
00252 
00253   //edm::LogVerbatim ("SiPixelEDAClient") <<"[SiPixelEDAClient]: End of Run, saving  DQM output ";
00254   //int iRun = run.run();
00255   
00256   if(actionOnRunEnd_){
00257     //cout << " Updating Summary " << endl;
00258     sipixelWebInterface_->setActionFlag(SiPixelWebInterface::Summary);
00259     sipixelWebInterface_->performAction();
00260     //cout << " Checking QTest results " << endl;
00261     sipixelWebInterface_->setActionFlag(SiPixelWebInterface::QTestResult);
00262     sipixelWebInterface_->performAction();
00263     //cout << " Updating occupancy plots" << endl;
00264     sipixelActionExecutor_->bookOccupancyPlots(bei_, hiRes_);
00265     sipixelWebInterface_->setActionFlag(SiPixelWebInterface::Occupancy);
00266     sipixelWebInterface_->performAction();
00267     //cout  << " Checking Pixel quality flags " << endl;;
00268     bei_->cd();
00269     bool init=true;
00270     sipixelInformationExtractor_->computeGlobalQualityFlag(bei_,init,nFEDs_,Tier0Flag_);
00271     init=true;
00272     sipixelInformationExtractor_->fillGlobalQualityPlot(bei_,init,eSetup,nFEDs_,Tier0Flag_);
00273     //cout << " Checking for new noisy pixels " << endl;
00274     init=true;
00275     if(noiseRate_>=0.) sipixelInformationExtractor_->findNoisyPixels(bei_, init, noiseRate_, noiseRateDenominator_, eSetup);
00276   }
00277   
00278   //cout<<"...leaving SiPixelEDAClient::endRun. "<<endl;
00279 }

void SiPixelEDAClient::publish ( xdata::InfoSpace *   )  [inline, virtual]

Implements evf::ModuleWeb.

Definition at line 33 of file SiPixelEDAClient.h.

00033 {};


Member Data Documentation

bool SiPixelEDAClient::actionOnLumiSec_ [private]

Definition at line 66 of file SiPixelEDAClient.h.

Referenced by beginJob(), endLuminosityBlock(), and SiPixelEDAClient().

bool SiPixelEDAClient::actionOnRunEnd_ [private]

Definition at line 67 of file SiPixelEDAClient.h.

Referenced by beginJob(), endRun(), and SiPixelEDAClient().

DQMStore* SiPixelEDAClient::bei_ [private]

Definition at line 56 of file SiPixelEDAClient.h.

Referenced by beginJob(), endLuminosityBlock(), endRun(), and SiPixelEDAClient().

int SiPixelEDAClient::evtOffsetForInit_ [private]

Definition at line 68 of file SiPixelEDAClient.h.

Referenced by beginJob(), and SiPixelEDAClient().

bool SiPixelEDAClient::hiRes_ [private]

Definition at line 70 of file SiPixelEDAClient.h.

Referenced by beginJob(), endLuminosityBlock(), endRun(), and SiPixelEDAClient().

std::ostringstream SiPixelEDAClient::html_out_ [private]

Definition at line 77 of file SiPixelEDAClient.h.

Referenced by defaultWebPage(), and SiPixelEDAClient().

unsigned long long SiPixelEDAClient::m_cacheID_ [private]

Definition at line 52 of file SiPixelEDAClient.h.

int SiPixelEDAClient::nEvents_ [private]

Definition at line 54 of file SiPixelEDAClient.h.

Referenced by analyze(), beginJob(), and defaultWebPage().

int SiPixelEDAClient::nFEDs_ [private]

Definition at line 74 of file SiPixelEDAClient.h.

Referenced by analyze(), beginJob(), endLuminosityBlock(), and endRun().

int SiPixelEDAClient::nLumiSecs_ [private]

Definition at line 53 of file SiPixelEDAClient.h.

Referenced by beginJob(), and endLuminosityBlock().

double SiPixelEDAClient::noiseRate_ [private]

Definition at line 71 of file SiPixelEDAClient.h.

Referenced by beginJob(), endLuminosityBlock(), endRun(), and SiPixelEDAClient().

int SiPixelEDAClient::noiseRateDenominator_ [private]

Definition at line 72 of file SiPixelEDAClient.h.

Referenced by endLuminosityBlock(), endRun(), and SiPixelEDAClient().

bool SiPixelEDAClient::offlineXMLfile_ [private]

Definition at line 73 of file SiPixelEDAClient.h.

Referenced by SiPixelEDAClient().

SiPixelActionExecutor* SiPixelEDAClient::sipixelActionExecutor_ [private]

Definition at line 60 of file SiPixelEDAClient.h.

Referenced by beginJob(), endLuminosityBlock(), endRun(), and SiPixelEDAClient().

SiPixelInformationExtractor* SiPixelEDAClient::sipixelInformationExtractor_ [private]

Definition at line 59 of file SiPixelEDAClient.h.

Referenced by beginJob(), endLuminosityBlock(), endRun(), and SiPixelEDAClient().

SiPixelWebInterface* SiPixelEDAClient::sipixelWebInterface_ [private]

Definition at line 58 of file SiPixelEDAClient.h.

Referenced by analyze(), beginJob(), defaultWebPage(), endLuminosityBlock(), endRun(), and SiPixelEDAClient().

unsigned int SiPixelEDAClient::staticUpdateFrequency_ [private]

Definition at line 65 of file SiPixelEDAClient.h.

Referenced by SiPixelEDAClient().

int SiPixelEDAClient::summaryFrequency_ [private]

Definition at line 64 of file SiPixelEDAClient.h.

Referenced by beginJob(), and SiPixelEDAClient().

std::string SiPixelEDAClient::summaryXMLfile_ [private]

Definition at line 69 of file SiPixelEDAClient.h.

bool SiPixelEDAClient::Tier0Flag_ [private]

Definition at line 75 of file SiPixelEDAClient.h.

Referenced by analyze(), beginJob(), endLuminosityBlock(), endRun(), and SiPixelEDAClient().

int SiPixelEDAClient::tkMapFrequency_ [private]

Definition at line 63 of file SiPixelEDAClient.h.

Referenced by beginJob(), and SiPixelEDAClient().

SiPixelTrackerMapCreator* SiPixelEDAClient::trackerMapCreator_ [private]

Definition at line 61 of file SiPixelEDAClient.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:31:55 2009 for CMSSW by  doxygen 1.5.4