CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

SiStripAnalyser Class Reference

#include <SiStripAnalyser.h>

Inheritance diagram for SiStripAnalyser:
edm::EDAnalyzer evf::ModuleWeb

List of all members.

Public Member Functions

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

Private Member Functions

void analyze (edm::Event const &e, edm::EventSetup const &eSetup)
 Analyze.
void beginJob ()
 BeginJob.
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup)
 Begin Luminosity Block.
void beginRun (edm::Run const &run, edm::EventSetup const &eSetup)
 BeginRun.
void checkTrackerFEDs (edm::Event const &e)
void endJob ()
 Endjob.
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup)
 End Luminosity Block.
void endRun (edm::Run const &run, edm::EventSetup const &eSetup)
 EndRun.

Private Attributes

SiStripActionExecutoractionExecutor_
SiStripClassToMonitorCondDatacondDataMon_
edm::ESHandle< SiStripDetCablingdetCabling_
DQMStoredqmStore_
bool endLumiAnalysisOn_
edm::ESHandle< SiStripFedCablingfedCabling_
int fileSaveFrequency_
int globalStatusFilling_
std::ostringstream html_out_
unsigned long long m_cacheID_
int nEvents_
int nLumiSecs_
std::string outputFileName_
std::string outputFilePath_
bool printFaultyModuleList_
edm::InputTag rawDataTag_
int shiftReportFrequency_
SiStripWebInterfacesistripWebInterface_
int staticUpdateFrequency_
int summaryFrequency_
int tkMapFrequency_
edm::ParameterSet tkMapPSet_
bool trackerFEDsFound_

Detailed Description

* SiStrip SiStripAnalyser

Date:
2011/05/03 06:55:39
Revision:
1.1
Author:
S. Dutta INFN-Pisa

Definition at line 33 of file SiStripAnalyser.h.


Constructor & Destructor Documentation

SiStripAnalyser::SiStripAnalyser ( const edm::ParameterSet ps)

Constructor.

Definition at line 68 of file SiStripAnalyser.cc.

References actionExecutor_, BUF_SIZE, dtNoiseDBValidation_cfg::cerr, condDataMon_, dqmStore_, endLumiAnalysisOn_, groupFilesInBlocks::fin, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), globalStatusFilling_, html_out_, recoMuon::in, cppFunctionSkipper::operator, printFaultyModuleList_, rawDataTag_, shiftReportFrequency_, sistripWebInterface_, staticUpdateFrequency_, summaryFrequency_, tkMapFrequency_, tkMapPSet_, and trackerFEDsFound_.

                                                          :
  ModuleWeb("SiStripAnalyser") {
  
  // Get TkMap ParameterSet 
  tkMapPSet_ = ps.getParameter<edm::ParameterSet>("TkmapParameters");

  std::string localPath = std::string("DQM/SiStripMonitorClient/test/loader.html");
  ifstream fin(edm::FileInPath(localPath).fullPath().c_str(), std::ios::in);
  char buf[BUF_SIZE];
  
  if (!fin) {
    std::cerr << "Input File: loader.html"<< " could not be opened!" << std::endl;
    return;
  }

  while (fin.getline(buf, BUF_SIZE, '\n')) { // pops off the newline character 
    html_out_ << buf ;
  }
  fin.close();



  edm::LogInfo("SiStripAnalyser") << " SiStripAnalyser::Creating SiStripAnalyser ";
  summaryFrequency_      = ps.getUntrackedParameter<int>("SummaryCreationFrequency",1);
  tkMapFrequency_        = ps.getUntrackedParameter<int>("TkMapCreationFrequency",1); 
  staticUpdateFrequency_ = ps.getUntrackedParameter<int>("StaticUpdateFrequency",1);
  globalStatusFilling_   = ps.getUntrackedParameter<int>("GlobalStatusFilling", 1);
  shiftReportFrequency_  = ps.getUntrackedParameter<int>("ShiftReportFrequency", 1);   
  rawDataTag_            = ps.getUntrackedParameter<edm::InputTag>("RawDataTag"); 
  printFaultyModuleList_ = ps.getUntrackedParameter<bool>("PrintFaultyModuleList", true);

  // get back-end interface
  dqmStore_ = edm::Service<DQMStore>().operator->();


  // instantiate web interface
  sistripWebInterface_ = new SiStripWebInterface(dqmStore_);
  actionExecutor_ = new SiStripActionExecutor(ps);
  condDataMon_    = new SiStripClassToMonitorCondData(ps);
  trackerFEDsFound_ = false;
  endLumiAnalysisOn_ = false;
}
SiStripAnalyser::~SiStripAnalyser ( ) [virtual]

Destructor.

Definition at line 113 of file SiStripAnalyser.cc.

                                 {

  edm::LogInfo("SiStripAnalyser") << "SiStripAnalyser::Deleting SiStripAnalyser ";
//  if (sistripWebInterface_) {
//     delete sistripWebInterface_;
//     sistripWebInterface_ = 0;
//  }
//  if (trackerMapCreator_) {
//    delete trackerMapCreator_;
//    trackerMapCreator_ = 0;
//  }

}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 171 of file SiStripAnalyser.cc.

References actionExecutor_, checkTrackerFEDs(), SiStripWebInterface::clearConDBPlotRequests(), condDataMon_, SiStripActionExecutor::createDummyShiftReport(), SiStripWebInterface::CreatePlots, SiStripActionExecutor::createShiftReport(), detCabling_, dqmStore_, SiStripActionExecutor::fillDummyStatus(), SiStripActionExecutor::fillStatus(), SiStripWebInterface::getConDBPlotParameters(), SiStripClassToMonitorCondData::getLayerMEsOnDemand(), SiStripClassToMonitorCondData::getModMEsOnDemand(), SiStripWebInterface::getNumberOfConDBPlotRequest(), globalStatusFilling_, nEvents_, SiStripWebInterface::performAction(), SiStripWebInterface::setActionFlag(), shiftReportFrequency_, sistripWebInterface_, and trackerFEDsFound_.

                                                                           {
  nEvents_++;  
  if (nEvents_ == 1 && globalStatusFilling_ > 0) {
    checkTrackerFEDs(e);
    if (!trackerFEDsFound_) {
      actionExecutor_->fillDummyStatus();
      actionExecutor_->createDummyShiftReport();
    } else {
      actionExecutor_->fillStatus(dqmStore_, detCabling_);
      if (shiftReportFrequency_ != -1) actionExecutor_->createShiftReport(dqmStore_);
    }
  }

  unsigned int nval = sistripWebInterface_->getNumberOfConDBPlotRequest();
  if (nval > 0) {
    for (unsigned int ival = 0; ival < nval; ival++) {
      uint32_t det_id;
      std::string   subdet_type;
      uint32_t subdet_side;
      uint32_t layer_number;
      sistripWebInterface_->getConDBPlotParameters(ival, det_id, subdet_type, subdet_side, layer_number);
      if (condDataMon_) {
        if (det_id == 999) condDataMon_->getLayerMEsOnDemand(eSetup,subdet_type, subdet_side,layer_number);
        else if (layer_number == 999 && subdet_side == 999) condDataMon_->getModMEsOnDemand(eSetup,det_id);
      }
    }
    sistripWebInterface_->clearConDBPlotRequests();
  }
  sistripWebInterface_->setActionFlag(SiStripWebInterface::CreatePlots);
  sistripWebInterface_->performAction();
}
void SiStripAnalyser::beginJob ( void  ) [private, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 129 of file SiStripAnalyser.cc.

References actionExecutor_, nEvents_, nLumiSecs_, SiStripActionExecutor::readConfiguration(), and summaryFrequency_.

                              {

  // Read the summary configuration file
  if (!actionExecutor_->readConfiguration()) {
     edm::LogInfo ("SiStripAnalyser") <<"SiStripAnalyser:: Error to read configuration file!! Summary will not be produced!!!";
     summaryFrequency_ = -1;
  }
  nLumiSecs_ = 0;
  nEvents_   = 0;
}
void SiStripAnalyser::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  eSetup 
) [private, virtual]

Begin Luminosity Block.

Reimplemented from edm::EDAnalyzer.

Definition at line 165 of file SiStripAnalyser.cc.

                                                                                                         {
  edm::LogInfo("SiStripAnalyser") <<"SiStripAnalyser:: Begin of LS transition";
}
void SiStripAnalyser::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
) [private, virtual]

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 142 of file SiStripAnalyser.cc.

References actionExecutor_, SiStripClassToMonitorCondData::beginRun(), condDataMon_, SiStripActionExecutor::createStatus(), detCabling_, dqmStore_, fedCabling_, edm::EventSetup::get(), globalStatusFilling_, m_cacheID_, SiStripActionExecutor::readTkMapConfiguration(), and tkMapFrequency_.

                                                                             {
  edm::LogInfo ("SiStripAnalyser") <<"SiStripAnalyser:: Begining of Run";

  // Check latest Fed cabling and create TrackerMapCreator
  unsigned long long cacheID = eSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
  if (m_cacheID_ != cacheID) {
    m_cacheID_ = cacheID;       
    edm::LogInfo("SiStripAnalyser") <<"SiStripAnalyser::beginRun: " 
                                    << " Change in Cabling, recrated TrackerMap";     
    if (!actionExecutor_->readTkMapConfiguration()) {
      edm::LogInfo ("SiStripAnalyser") <<"SiStripAnalyser:: Error to read configuration file!! TrackerMap will not be produced!!!";    
      tkMapFrequency_ = -1;

    }
    eSetup.get<SiStripFedCablingRcd>().get(fedCabling_);
    eSetup.get<SiStripDetCablingRcd>().get(detCabling_);
  } 
  if (condDataMon_) condDataMon_->beginRun(eSetup);
  if (globalStatusFilling_) actionExecutor_->createStatus(dqmStore_);
}
void SiStripAnalyser::checkTrackerFEDs ( edm::Event const &  e) [private]

Definition at line 270 of file SiStripAnalyser.cc.

References FEDRawData::data(), FEDRawDataCollection::FEDData(), edm::Event::getByLabel(), i, edm::HandleBase::isValid(), FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, rawDataTag_, FEDRawData::size(), and trackerFEDsFound_.

Referenced by analyze().

                                                        {
  edm::Handle<FEDRawDataCollection> rawDataHandle;
  e.getByLabel(rawDataTag_, rawDataHandle);
  if ( !rawDataHandle.isValid() ) return;
  
  const FEDRawDataCollection& rawDataCollection = *rawDataHandle;
  const int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
  const int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID; 
    
  unsigned int nFed = 0;
  for (int i=siStripFedIdMin; i <= siStripFedIdMax; i++) {
    if (rawDataCollection.FEDData(i).size() && rawDataCollection.FEDData(i).data()) {
      nFed++;
    }
  }
  if (nFed > 0) trackerFEDsFound_ = true;
}
void SiStripAnalyser::defaultWebPage ( xgi::Input *  in,
xgi::Output *  out 
) [virtual]

Reimplemented from evf::ModuleWeb.

Definition at line 290 of file SiStripAnalyser.cc.

References detCabling_, endLumiAnalysisOn_, SiStripWebInterface::handleAnalyserRequest(), html_out_, nEvents_, and sistripWebInterface_.

{
  bool isRequest = false;
  cgicc::Cgicc cgi(in);
  cgicc::CgiEnvironment cgie(in);
  //  edm::LogInfo("SiStripAnalyser") <<"SiStripAnalyser:: defaultWebPage "
  //             << " query string : " << cgie.getQueryString();
  //  if ( xgi::Utils::hasFormElement(cgi,"ClientRequest") ) isRequest = true;
  std::string q_string = cgie.getQueryString();
  if (q_string.find("RequestID") != std::string::npos) isRequest = true;
  if (!isRequest) {    
    *out << html_out_.str() << std::endl;
  }  else {
    // Handles all HTTP requests of the form
    int iter = -1;
    if (endLumiAnalysisOn_) {
      sistripWebInterface_->handleAnalyserRequest(in, out, detCabling_, iter); 
    } else {
      iter = nEvents_/10;
      sistripWebInterface_->handleAnalyserRequest(in, out, detCabling_, iter);
    } 
  }
}
void SiStripAnalyser::endJob ( void  ) [private, virtual]

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 259 of file SiStripAnalyser.cc.

References actionExecutor_, gather_cfg::cout, dqmStore_, SiStripActionExecutor::printFaultyModuleList(), and printFaultyModuleList_.

                            {
  edm::LogInfo("SiStripAnalyser") <<"SiStripAnalyser:: endjob called!";
  if (printFaultyModuleList_) {
    std::ostringstream str_val;
    actionExecutor_->printFaultyModuleList(dqmStore_, str_val);
    std::cout << str_val.str() << std::endl;
  }
}
void SiStripAnalyser::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  eSetup 
) [private, virtual]

End Luminosity Block.

Reimplemented from edm::EDAnalyzer.

Definition at line 205 of file SiStripAnalyser.cc.

References actionExecutor_, gather_cfg::cout, SiStripActionExecutor::createSummary(), SiStripActionExecutor::createTkMap(), detCabling_, dqmStore_, endLumiAnalysisOn_, fedCabling_, SiStripActionExecutor::fillDummyStatus(), SiStripActionExecutor::fillStatus(), SiStripWebInterface::getTkMapType(), globalStatusFilling_, edm::LuminosityBlockBase::luminosityBlock(), nLumiSecs_, SiStripWebInterface::performAction(), SiStripWebInterface::PlotHistogramFromLayout, SiStripWebInterface::setActionFlag(), sistripWebInterface_, staticUpdateFrequency_, summaryFrequency_, tkMapFrequency_, tkMapPSet_, and trackerFEDsFound_.

                                                                                                       {
  edm::LogInfo ("SiStripAnalyser") <<"SiStripAnalyser:: End of LS transition, performing the DQM client operation";

  nLumiSecs_++;

  if (!trackerFEDsFound_) {
    actionExecutor_->fillDummyStatus();
    return;
  }   
  endLumiAnalysisOn_ = true;

  //  sistripWebInterface_->setCabling(detCabling_);
 
  std::cout << "====================================================== " << std::endl;
  std::cout << " ===> Iteration # " << nLumiSecs_ << " " 
            << lumiSeg.luminosityBlock() << std::endl;
  std::cout << "====================================================== " << std::endl;
  // Create predefined plots
  if (staticUpdateFrequency_ != -1 && nLumiSecs_ > 0 && nLumiSecs_%staticUpdateFrequency_  == 0) {
    std::cout << " Creating predefined plots " << std::endl;
    sistripWebInterface_->setActionFlag(SiStripWebInterface::PlotHistogramFromLayout);
    sistripWebInterface_->performAction();
  }
  // Fill Global Status
  if (globalStatusFilling_ > 0) {
    actionExecutor_->fillStatus(dqmStore_, detCabling_);
  }
  // -- Create summary monitor elements according to the frequency
  if (summaryFrequency_ != -1 && nLumiSecs_ > 0 && nLumiSecs_%summaryFrequency_ == 0) {
    std::cout << " Creating Summary " << std::endl;
    actionExecutor_->createSummary(dqmStore_);
  }
  // -- Create TrackerMap  according to the frequency
  if (tkMapFrequency_ != -1 && nLumiSecs_ > 0 && nLumiSecs_%tkMapFrequency_ == 0) {
    std::cout << " Creating Tracker Map " << std::endl;
    std::string tkmap_type =  sistripWebInterface_->getTkMapType();
    actionExecutor_->createTkMap(tkMapPSet_, fedCabling_, dqmStore_, tkmap_type);
  }
  // Create Shift Report
  //  if (shiftReportFrequency_ != -1 && trackerFEDsFound_ && nLumiSecs_%shiftReportFrequency_  == 0) {
  //    actionExecutor_->createShiftReport(dqmStore_);
  //  }
  endLumiAnalysisOn_ = false;
}
void SiStripAnalyser::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
) [private, virtual]

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 253 of file SiStripAnalyser.cc.

                                                                          {
  edm::LogInfo ("SiStripAnalyser") <<"SiStripAnalyser:: End of Run";
}
void SiStripAnalyser::publish ( xdata::InfoSpace *  ) [inline, virtual]

Implements evf::ModuleWeb.

Definition at line 44 of file SiStripAnalyser.h.

{};

Member Data Documentation

Definition at line 75 of file SiStripAnalyser.h.

Referenced by analyze(), beginRun(), and SiStripAnalyser().

Definition at line 95 of file SiStripAnalyser.h.

Referenced by analyze(), beginRun(), defaultWebPage(), and endLuminosityBlock().

Definition at line 78 of file SiStripAnalyser.h.

Referenced by analyze(), beginRun(), endJob(), endLuminosityBlock(), and SiStripAnalyser().

Definition at line 103 of file SiStripAnalyser.h.

Referenced by defaultWebPage(), endLuminosityBlock(), and SiStripAnalyser().

Definition at line 94 of file SiStripAnalyser.h.

Referenced by beginRun(), and endLuminosityBlock().

Definition at line 82 of file SiStripAnalyser.h.

Definition at line 86 of file SiStripAnalyser.h.

Referenced by analyze(), beginRun(), endLuminosityBlock(), and SiStripAnalyser().

std::ostringstream SiStripAnalyser::html_out_ [private]

Definition at line 104 of file SiStripAnalyser.h.

Referenced by defaultWebPage(), and SiStripAnalyser().

unsigned long long SiStripAnalyser::m_cacheID_ [private]

Definition at line 98 of file SiStripAnalyser.h.

Referenced by beginRun().

Definition at line 100 of file SiStripAnalyser.h.

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

Definition at line 99 of file SiStripAnalyser.h.

Referenced by beginJob(), and endLuminosityBlock().

std::string SiStripAnalyser::outputFileName_ [private]

Definition at line 91 of file SiStripAnalyser.h.

std::string SiStripAnalyser::outputFilePath_ [private]

Definition at line 90 of file SiStripAnalyser.h.

Definition at line 102 of file SiStripAnalyser.h.

Referenced by endJob(), and SiStripAnalyser().

Definition at line 88 of file SiStripAnalyser.h.

Referenced by checkTrackerFEDs(), and SiStripAnalyser().

Definition at line 87 of file SiStripAnalyser.h.

Referenced by analyze(), and SiStripAnalyser().

Definition at line 80 of file SiStripAnalyser.h.

Referenced by analyze(), defaultWebPage(), endLuminosityBlock(), and SiStripAnalyser().

Definition at line 85 of file SiStripAnalyser.h.

Referenced by endLuminosityBlock(), and SiStripAnalyser().

Definition at line 83 of file SiStripAnalyser.h.

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

Definition at line 84 of file SiStripAnalyser.h.

Referenced by beginRun(), endLuminosityBlock(), and SiStripAnalyser().

Definition at line 93 of file SiStripAnalyser.h.

Referenced by endLuminosityBlock(), and SiStripAnalyser().

Definition at line 101 of file SiStripAnalyser.h.

Referenced by analyze(), checkTrackerFEDs(), endLuminosityBlock(), and SiStripAnalyser().