CMS 3D CMS Logo

Public Member Functions | Private Attributes | Friends

EcalBarrelMonitorClient Class Reference

#include <EcalBarrelMonitorClient.h>

Inheritance diagram for EcalBarrelMonitorClient:
edm::EDAnalyzer EcalBarrelMonitorDbClient EcalBarrelMonitorXdaqClient

List of all members.

Public Member Functions

void analyze (void)
 Analyze.
void analyze (const edm::Event &e, const edm::EventSetup &c)
void beginJob (void)
 BeginJob.
void beginLuminosityBlock (const edm::LuminosityBlock &l, const edm::EventSetup &c)
 BeginLumiBlock.
void beginRun (const edm::Run &r, const edm::EventSetup &c)
void beginRun (void)
 BeginRun.
void beginRunDb (void)
 BeginRunDB.
void cleanup (void)
 Cleanup.
 EcalBarrelMonitorClient (const edm::ParameterSet &ps)
 Constructor.
void endJob (void)
 EndJob.
void endLuminosityBlock (const edm::LuminosityBlock &l, const edm::EventSetup &c)
 EndLumiBlock.
void endRun (void)
 EndRun.
void endRun (const edm::Run &r, const edm::EventSetup &c)
void endRunDb (void)
 EndRunDB.
const char * getRunType (void)
void reset (void)
 Reset.
void setup (void)
 Setup.
void softReset (bool flag)
 SoftReset.
void writeDb (void)
 WriteDB.
virtual ~EcalBarrelMonitorClient ()
 Destructor.

Private Attributes

bool begin_run_
std::vector< EBClient * > clients_
std::vector< std::string > clientsNames_
std::multimap< EBClient *, int > clientsRuns_
std::map< std::string, int > clientsStatus_
bool cloneME_
time_t current_time_
std::string dbHostName_
int dbHostPort_
std::string dbName_
std::string dbPassword_
std::string dbTagName_
time_t dbUpdateTime_
std::string dbUserName_
bool debug_
DQMStoredqmStore_
bool enableCleanup_
std::vector< std::string > enabledClients_
bool end_run_
int evt_
int evtType_
bool forced_status_
bool forced_update_
TH1F * h_
int ievt_
std::string inputFile_
int jevt_
int last_run_
time_t last_time_reset_
time_t last_time_update_
std::string location_
bool mergeRuns_
std::string prefixME_
int prescaleFactor_
std::string resetFile_
int run_
int runType_
std::vector< std::string > runTypes_
std::string status_
int subrun_
EBSummaryClientsummaryClient_
std::vector< int > superModules_
time_t updateTime_
bool verbose_

Friends

class EcalBarrelMonitorXdaqClient

Detailed Description

Definition at line 36 of file EcalBarrelMonitorClient.h.


Constructor & Destructor Documentation

EcalBarrelMonitorClient::EcalBarrelMonitorClient ( const edm::ParameterSet ps)

Constructor.

Definition at line 62 of file EcalBarrelMonitorClient.cc.

References EcalDCCHeaderBlock::BEAMH2, EcalDCCHeaderBlock::BEAMH4, EcalDCCHeaderBlock::CALIB_LOCAL, clients_, clientsNames_, clientsRuns_, clientsStatus_, cloneME_, EcalDCCHeaderBlock::COSMIC, EcalDCCHeaderBlock::COSMICS_GLOBAL, EcalDCCHeaderBlock::COSMICS_LOCAL, gather_cfg::cout, dbHostName_, dbHostPort_, dbName_, dbPassword_, dbTagName_, dbUpdateTime_, dbUserName_, debug_, enableCleanup_, enabledClients_, spr::find(), edm::ParameterSet::getUntrackedParameter(), EcalDCCHeaderBlock::HALO_GLOBAL, EcalDCCHeaderBlock::HALO_LOCAL, i, inputFile_, EcalDCCHeaderBlock::LASER_GAP, EcalDCCHeaderBlock::LASER_STD, EcalDCCHeaderBlock::LED_GAP, EcalDCCHeaderBlock::LED_STD, location_, mergeRuns_, EcalDCCHeaderBlock::MTCC, EcalDCCHeaderBlock::PEDESTAL_GAP, EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN, EcalDCCHeaderBlock::PEDESTAL_STD, EcalDCCHeaderBlock::PHYSICS_GLOBAL, EcalDCCHeaderBlock::PHYSICS_LOCAL, prefixME_, prescaleFactor_, resetFile_, runTypes_, EBSummaryClient::setFriends(), summaryClient_, superModules_, EcalDCCHeaderBlock::TESTPULSE_GAP, EcalDCCHeaderBlock::TESTPULSE_MGPA, updateTime_, and verbose_.

                                                                          {

  // verbose switch

  verbose_ = ps.getUntrackedParameter<bool>("verbose", true);

  if ( verbose_ ) {
    std::cout << std::endl;
    std::cout << " *** Ecal Barrel Generic Monitor Client ***" << std::endl;
    std::cout << std::endl;
  }

  // DQM ROOT input file

  inputFile_ = ps.getUntrackedParameter<std::string>("inputFile", "");

  if ( verbose_ ) {
    if ( inputFile_.size() != 0 ) {
      std::cout << " Reading DQM data from inputFile '" << inputFile_ << "'" << std::endl;
    }
  }

  // Ecal Cond DB

  dbName_ = ps.getUntrackedParameter<std::string>("dbName", "");
  dbHostName_ = ps.getUntrackedParameter<std::string>("dbHostName", "");
  dbHostPort_ = ps.getUntrackedParameter<int>("dbHostPort", 1521);
  dbUserName_ = ps.getUntrackedParameter<std::string>("dbUserName", "");
  dbPassword_ = ps.getUntrackedParameter<std::string>("dbPassword", "");

  dbTagName_ = ps.getUntrackedParameter<std::string>("dbTagName", "CMSSW");

  if ( verbose_ ) {
    if ( dbName_.size() != 0 ) {
      std::cout << " Ecal Cond DB: " << std::endl;
      std::cout << "   dbName = '" << dbName_ << "'" << std::endl;
      std::cout << "   dbUserName = '" << dbUserName_ << "'" << std::endl;
      if ( dbHostName_.size() != 0 ) {
        std::cout << "   dbHostName = '" << dbHostName_ << "'" << std::endl;
        std::cout << "   dbHostPort = '" << dbHostPort_ << "'" << std::endl;
      }
      std::cout << "   dbTagName = '" << dbTagName_ << "'" << std::endl;
#ifndef WITH_ECAL_COND_DB
      std::cout << std::endl;
      std::cout << "WARNING: DB access is NOT available" << std::endl;
      std::cout << std::endl;
#endif
    } else {
      std::cout << " Ecal Cond DB is OFF" << std::endl;
    }
  }

  // mergeRuns switch

  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);

  if ( verbose_ ) {
    if ( mergeRuns_ ) {
      std::cout << " mergeRuns switch is ON" << std::endl;
    } else {
      std::cout << " mergeRuns switch is OFF" << std::endl;
    }
  }

  // resetFile

  resetFile_ = ps.getUntrackedParameter<std::string>("resetFile", "");

  if ( verbose_ ) {
    if ( resetFile_.size() != 0 ) {
      std::cout << " resetFile is '" << resetFile_ << "'" << std::endl;
    }
  }

  // updateTime

  updateTime_ = ps.getUntrackedParameter<int>("updateTime", 0);

  if ( verbose_ ) {
    std::cout << " updateTime is " << updateTime_ << " minute(s)" << std::endl;
  }

  // dbUpdateTime

  dbUpdateTime_  = ps.getUntrackedParameter<int>("dbUpdateTime", 0);

  if ( verbose_ ) {
    std::cout << " dbUpdateTime is " << dbUpdateTime_ << " minute(s)" << std::endl;
  }

  // location

  location_ =  ps.getUntrackedParameter<std::string>("location", "H4");

  if ( verbose_ ) {
    std::cout << " location is '" << location_ << "'" << std::endl;
  }

  // cloneME switch

  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);

  if ( verbose_ ) {
    if ( cloneME_ ) {
      std::cout << " cloneME switch is ON" << std::endl;
    } else {
      std::cout << " cloneME switch is OFF" << std::endl;
    }
  }

  // debug switch

  debug_ = ps.getUntrackedParameter<bool>("debug", false);

  if ( verbose_ ) {
    if ( debug_ ) {
      std::cout << " debug switch is ON" << std::endl;
    } else {
      std::cout << " debug switch is OFF" << std::endl;
    }
  }

  // prescaleFactor

  prescaleFactor_ = ps.getUntrackedParameter<int>("prescaleFactor", 1);

  if ( verbose_ ) {
    std::cout << " prescaleFactor is " << prescaleFactor_ << std::endl;
  }

  // prefixME path

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

  if ( verbose_ ) {
    std::cout << " prefixME path is '" << prefixME_ << "'" << std::endl;
  }

  // enableCleanup switch

  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);

  if ( verbose_ ) {
    if ( enableCleanup_ ) {
      std::cout << " enableCleanup switch is ON" << std::endl;
    } else {
      std::cout << " enableCleanup switch is OFF" << std::endl;
    }
  }

  // vector of selected Super Modules (Defaults to all 36).

  superModules_.reserve(36);
  for ( unsigned int i = 1; i <= 36; i++ ) superModules_.push_back(i);

  superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);

  if ( verbose_ ) {
    std::cout << " Selected SMs:" << std::endl;
    for ( unsigned int i = 0; i < superModules_.size(); i++ ) {
      std::cout << " " << std::setw(2) << std::setfill('0') << superModules_[i];
    }
    std::cout << std::endl;
  }

  // vector of enabled Clients (defaults)

  enabledClients_.push_back("Integrity");
  enabledClients_.push_back("StatusFlags");
  enabledClients_.push_back("PedestalOnline");
  enabledClients_.push_back("Summary");

  enabledClients_ = ps.getUntrackedParameter<std::vector<std::string> >("enabledClients", enabledClients_);

  if ( verbose_ ) {
    std::cout << " Enabled Clients:" << std::endl;
    for ( unsigned int i = 0; i < enabledClients_.size(); i++ ) {
      std::cout << " " << enabledClients_[i];
    }
    std::cout << std::endl;
  }

  // set runTypes (use resize() on purpose!)

  runTypes_.resize(30);
  for ( unsigned int i = 0; i < runTypes_.size(); i++ ) runTypes_[i] =  "UNKNOWN";

  runTypes_[EcalDCCHeaderBlock::COSMIC]               = "COSMIC";
  runTypes_[EcalDCCHeaderBlock::BEAMH4]               = "BEAM";
  runTypes_[EcalDCCHeaderBlock::BEAMH2]               = "BEAM";
  runTypes_[EcalDCCHeaderBlock::MTCC]                 = "MTCC";
  runTypes_[EcalDCCHeaderBlock::LASER_STD]            = "LASER";
  runTypes_[EcalDCCHeaderBlock::LED_STD]              = "LED";
  runTypes_[EcalDCCHeaderBlock::TESTPULSE_MGPA]       = "TEST_PULSE";
  runTypes_[EcalDCCHeaderBlock::PEDESTAL_STD]         = "PEDESTAL";
  runTypes_[EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN] = "PEDESTAL-OFFSET";

  runTypes_[EcalDCCHeaderBlock::COSMICS_GLOBAL]       = "COSMIC";
  runTypes_[EcalDCCHeaderBlock::PHYSICS_GLOBAL]       = "PHYSICS";
  runTypes_[EcalDCCHeaderBlock::HALO_GLOBAL]          = "HALO";
  runTypes_[EcalDCCHeaderBlock::COSMICS_LOCAL]        = "COSMIC";
  runTypes_[EcalDCCHeaderBlock::PHYSICS_LOCAL]        = "PHYSICS";
  runTypes_[EcalDCCHeaderBlock::HALO_LOCAL]           = "HALO";

  runTypes_[EcalDCCHeaderBlock::LASER_GAP]            = "LASER";
  runTypes_[EcalDCCHeaderBlock::LED_GAP]              = "LED";
  runTypes_[EcalDCCHeaderBlock::TESTPULSE_GAP]        = "TEST_PULSE";
  runTypes_[EcalDCCHeaderBlock::PEDESTAL_GAP]         = "PEDESTAL";

  runTypes_[EcalDCCHeaderBlock::CALIB_LOCAL]          = "CALIB";

  // clients' constructors

  clients_.reserve(12);
  clientsNames_.reserve(12);

  if ( find(enabledClients_.begin(), enabledClients_.end(), "Integrity" ) != enabledClients_.end() ) {

    clients_.push_back( new EBIntegrityClient(ps) );
    clientsNames_.push_back( "Integrity" );

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMIC ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_MGPA ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH4 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH2 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::MTCC ));

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_GAP ));

  }

  if ( find(enabledClients_.begin(), enabledClients_.end(), "StatusFlags" ) != enabledClients_.end() ) {

    clients_.push_back( new EBStatusFlagsClient(ps) );
    clientsNames_.push_back( "StatusFlags" );

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMIC ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_MGPA ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH4 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH2 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::MTCC ));

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_GAP ));

  }

  if ( find(enabledClients_.begin(), enabledClients_.end(), "Occupancy" ) != enabledClients_.end() ) {

    clients_.push_back( new EBOccupancyClient(ps) );
    clientsNames_.push_back( "Occupancy" );

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMIC ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_MGPA ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH4 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH2 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::MTCC ));

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_GAP ));

  }

  if ( find(enabledClients_.begin(), enabledClients_.end(), "Cosmic" ) != enabledClients_.end() ) {

    clients_.push_back( new EBCosmicClient(ps) );
    clientsNames_.push_back( "Cosmic" );

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMIC ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_MGPA ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::MTCC ));

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_GAP ));

  }

  if ( find(enabledClients_.begin(), enabledClients_.end(), "Laser" ) != enabledClients_.end() ) {

    clients_.push_back( new EBLaserClient(ps) );
    clientsNames_.push_back( "Laser" );

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMIC ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_MGPA ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH4 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH2 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::MTCC ));

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_GAP ));

  }

  if ( find(enabledClients_.begin(), enabledClients_.end(), "Pedestal" ) != enabledClients_.end() ) {

    clients_.push_back( new EBPedestalClient(ps) );
    clientsNames_.push_back( "Pedestal" );

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMIC ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_MGPA ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH4 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH2 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::MTCC ));

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_GAP ));

  }

  if ( find(enabledClients_.begin(), enabledClients_.end(), "PedestalOnline" ) != enabledClients_.end() ) {

    clients_.push_back( new EBPedestalOnlineClient(ps) );
    clientsNames_.push_back( "PedestalOnline" );

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMIC ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_MGPA ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH4 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH2 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::MTCC ));

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_GAP ));

  }

  if ( find(enabledClients_.begin(), enabledClients_.end(), "TestPulse" ) != enabledClients_.end() ) {

    clients_.push_back( new EBTestPulseClient(ps) );
    clientsNames_.push_back( "TestPulse" );

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMIC ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_MGPA ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH4 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH2 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::MTCC ));

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_GAP ));

  }

  if ( find(enabledClients_.begin(), enabledClients_.end(), "BeamCalo" ) != enabledClients_.end() ) {

    clients_.push_back( new EBBeamCaloClient(ps) );
    clientsNames_.push_back( "BeamCalo" );

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH4 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH2 ));

  }

  if ( find(enabledClients_.begin(), enabledClients_.end(), "BeamHodo" ) != enabledClients_.end() ) {

    clients_.push_back( new EBBeamHodoClient(ps) );
    clientsNames_.push_back( "BeamHodo" );

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH4 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH2 ));

  }

  if ( find(enabledClients_.begin(), enabledClients_.end(), "TriggerTower" ) != enabledClients_.end() ) {

    clients_.push_back( new EBTriggerTowerClient(ps) );
    clientsNames_.push_back( "TriggerTower" );

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMIC ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_MGPA ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH4 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH2 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::MTCC ));

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_GAP ));

  }

  if ( find(enabledClients_.begin(), enabledClients_.end(), "Cluster" ) != enabledClients_.end() ) {

    clients_.push_back( new EBClusterClient(ps) );
    clientsNames_.push_back( "Cluster" );

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMIC ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_MGPA ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH4 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH2 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::MTCC ));

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_GAP ));

  }

  if ( find(enabledClients_.begin(), enabledClients_.end(), "Timing" ) != enabledClients_.end() ) {

    clients_.push_back( new EBTimingClient(ps) );
    clientsNames_.push_back( "Timing" );

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMIC ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_STD ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_MGPA ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH4 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::BEAMH2 ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::MTCC ));

    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::COSMICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_LOCAL ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_GAP ));
    clientsRuns_.insert(std::pair<EBClient*,int>( clients_.back(), EcalDCCHeaderBlock::PEDESTAL_GAP ));

  }

  // define status bits

  clientsStatus_.insert(std::pair<std::string,int>( "Integrity",       0 ));
  clientsStatus_.insert(std::pair<std::string,int>( "Cosmic",          1 ));
  clientsStatus_.insert(std::pair<std::string,int>( "Laser",           2 ));
  clientsStatus_.insert(std::pair<std::string,int>( "Pedestal",        3 ));
  clientsStatus_.insert(std::pair<std::string,int>( "PedestalOnline",  4 ));
  clientsStatus_.insert(std::pair<std::string,int>( "TestPulse",       5 ));
  clientsStatus_.insert(std::pair<std::string,int>( "BeamCalo",        6 ));
  clientsStatus_.insert(std::pair<std::string,int>( "BeamHodo",        7 ));
  clientsStatus_.insert(std::pair<std::string,int>( "TriggerTower",    8 ));
  clientsStatus_.insert(std::pair<std::string,int>( "Cluster",         9 ));
  clientsStatus_.insert(std::pair<std::string,int>( "Timing",         10 ));
  clientsStatus_.insert(std::pair<std::string,int>( "Led",            11 ));
  clientsStatus_.insert(std::pair<std::string,int>( "StatusFlags",    12 ));
  clientsStatus_.insert(std::pair<std::string,int>( "Occupancy",      13 ));

  if ( find(enabledClients_.begin(), enabledClients_.end(), "Summary" ) != enabledClients_.end() ) {

    summaryClient_ = new EBSummaryClient(ps);

  }

  if ( summaryClient_ ) summaryClient_->setFriends(clients_);

  if ( verbose_ ) std::cout << std::endl;

}
EcalBarrelMonitorClient::~EcalBarrelMonitorClient ( ) [virtual]

Destructor.

Definition at line 581 of file EcalBarrelMonitorClient.cc.

References clients_, gather_cfg::cout, i, summaryClient_, and verbose_.

                                                  {

  if ( verbose_ ) std::cout << "Exit ..." << std::endl;

  for ( unsigned int i=0; i<clients_.size(); i++ ) {
    delete clients_[i];
  }

  if ( summaryClient_ ) delete summaryClient_;

}

Member Function Documentation

void EcalBarrelMonitorClient::analyze ( void  )

Analyze.

Definition at line 1412 of file EcalBarrelMonitorClient.cc.

References EBSummaryClient::analyze(), EcalDCCHeaderBlock::BEAMH2, EcalDCCHeaderBlock::BEAMH4, begin_run_, beginRun(), clients_, clientsRuns_, cloneME_, EcalDCCHeaderBlock::COSMIC, EcalDCCHeaderBlock::COSMICS_GLOBAL, EcalDCCHeaderBlock::COSMICS_LOCAL, gather_cfg::cout, current_time_, dbUpdateTime_, debug_, generateEDF::done, dqmStore_, end_run_, endRun(), evt_, evtType_, forced_status_, forced_update_, DQMStore::get(), getRunType(), h_, i, ievt_, inputFile_, j, jevt_, last_run_, last_time_reset_, location_, mergeRuns_, NULL, EcalDCCHeaderBlock::PHYSICS_GLOBAL, EcalDCCHeaderBlock::PHYSICS_LOCAL, prefixME_, prescaleFactor_, reset(), resetFile_, run_, runType_, runTypes_, asciidump::s, softReset(), status_, summaryClient_, cond::rpcobgas::time, update, MonitorElement::valueString(), verbose_, and writeDb().

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

                                          {

  current_time_ = time(NULL);

  ievt_++;
  jevt_++;

  if ( debug_ ) std::cout << "EcalBarrelMonitorClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;

  MonitorElement* me;
  std::string s;

  me = dqmStore_->get(prefixME_ + "/EcalInfo/STATUS");
  if ( me ) {
    status_ = "unknown";
    s = me->valueString();
    if ( strcmp(s.c_str(), "i=0") == 0 ) status_ = "begin-of-run";
    if ( strcmp(s.c_str(), "i=1") == 0 ) status_ = "running";
    if ( strcmp(s.c_str(), "i=2") == 0 ) status_ = "end-of-run";
    if ( debug_ ) std::cout << "Found '" << prefixME_ << "/EcalInfo/STATUS'" << std::endl;
  }

  if ( inputFile_.size() != 0 ) {
    if ( ievt_ == 1 ) {
      if ( verbose_ ) {
        std::cout << std::endl;
        std::cout << " Reading DQM from file, forcing 'begin-of-run'" << std::endl;
        std::cout << std::endl;
      }
      status_ = "begin-of-run";
    }
  }

  int ecal_run = -1;
  me = dqmStore_->get(prefixME_ + "/EcalInfo/RUN");
  if ( me ) {
    s = me->valueString();
    sscanf(s.c_str(), "i=%d", &ecal_run);
    if ( debug_ ) std::cout << "Found '" << prefixME_ << "/EcalInfo/RUN'" << std::endl;
  }

  int ecal_evt = -1;
  me = dqmStore_->get(prefixME_ + "/EcalInfo/EVT");
  if ( me ) {
    s = me->valueString();
    sscanf(s.c_str(), "i=%d", &ecal_evt);
    if ( debug_ ) std::cout << "Found '" << prefixME_ << "/EcalInfo/EVT'" << std::endl;
  }

  me = dqmStore_->get(prefixME_ + "/EcalInfo/EVTTYPE");
  h_ = UtilsClient::getHisto<TH1F*>( me, cloneME_, h_ );

  me = dqmStore_->get(prefixME_ + "/EcalInfo/RUNTYPE");
  if ( me ) {
    s = me->valueString();
    sscanf(s.c_str(), "i=%d", &evtType_);
    if ( runType_ == -1 ) runType_ = evtType_;
    if ( debug_ ) std::cout << "Found '" << prefixME_ << "/EcalInfo/RUNTYPE'" << std::endl;
  }

  // if the run number from the Event is less than zero,
  // use the run number from the ECAL DCC header
  if ( run_ <= 0 ) run_ = ecal_run;

  if ( run_ != -1 && evt_ != -1 && runType_ != -1 ) {
    if ( ! mergeRuns_ && run_ != last_run_ ) forced_update_ = true;
  }

  bool update = ( forced_update_                    ) ||
                ( prescaleFactor_ != 1              ) ||
                ( jevt_ <   10                      ) ||
                ( jevt_ <  100 && jevt_ %   10 == 0 ) ||
                ( jevt_ < 1000 && jevt_ %  100 == 0 ) ||
                (                 jevt_ % 1000 == 0 );

  if ( update || strcmp(status_.c_str(), "begin-of-run") == 0 || strcmp(status_.c_str(), "end-of-run") == 0 ) {

    if ( verbose_ ) {
      std::cout << " RUN status = \"" << status_ << "\"" << std::endl;
      std::cout << "   CMS run/event number = " << run_ << "/" << evt_ << std::endl;
      std::cout << "   EB run/event number = " << ecal_run << "/" << ecal_evt << std::endl;
      std::cout << "   EB location = " << location_ << std::endl;
      std::cout << "   EB run/event type = " << this->getRunType() << "/" << ( evtType_ == -1 ? "UNKNOWN" : runTypes_[evtType_] ) << std::flush;

      if ( h_ ) {
        if ( h_->GetSumOfWeights() != 0 ) {
          std::cout << " ( " << std::flush;
          for ( unsigned int i = 0; i < runTypes_.size(); i++ ) {
            if ( strcmp(runTypes_[i].c_str(), "UNKNOWN") != 0 && h_->GetBinContent(2+i) != 0 ) {
              std::string s = runTypes_[i];
              transform( s.begin(), s.end(), s.begin(), (int(*)(int))tolower );
              std::cout << s << " ";
            }
          }
          std::cout << ")" << std::flush;
        }
      }
      std::cout << std::endl;
    }

  }

  if ( strcmp(status_.c_str(), "begin-of-run") == 0 ) {

    if ( run_ != -1 && evt_ != -1 && runType_ != -1 ) {

      if ( ! begin_run_ ) {

        forced_status_ = false;
        this->beginRun();

      }

    }

  }

  if ( strcmp(status_.c_str(), "begin-of-run") == 0 || strcmp(status_.c_str(), "running") == 0 || strcmp(status_.c_str(), "end-of-run") == 0 ) {

    if ( begin_run_ && ! end_run_ ) {

      bool update = ( forced_update_                      ) ||
                    ( prescaleFactor_ != 1                ) ||
                    ( jevt_ <     3                       ) ||
                    ( jevt_ <  1000 && jevt_ %   100 == 0 ) ||
                    ( jevt_ < 10000 && jevt_ %  1000 == 0 ) ||
                    (                  jevt_ % 10000 == 0 );

      if ( update || strcmp(status_.c_str(), "begin-of-run") == 0 || strcmp(status_.c_str(), "end-of-run") == 0 ) {

        for ( int i=0; i<int(clients_.size()); i++ ) {
          bool done = false;
          for ( std::multimap<EBClient*,int>::iterator j = clientsRuns_.lower_bound(clients_[i]); j != clientsRuns_.upper_bound(clients_[i]); j++ ) {
            if ( runType_ != -1 && runType_ == (*j).second && !done ) {
              done = true;
              clients_[i]->analyze();
            }
          }
        }

        if ( summaryClient_ ) summaryClient_->analyze();

      }

      forced_update_ = false;

      bool reset = false;

      if ( resetFile_.size() != 0 ) {
        if ( access(resetFile_.c_str(), W_OK) == 0 ) {
          if ( unlink(resetFile_.c_str()) == 0 ) {
            reset |= true;
          }
        }
      }

      if ( dbUpdateTime_ > 0 ) {
        reset |= (current_time_ - last_time_reset_) > 60 * dbUpdateTime_;
      }

      if ( reset ) {
        if ( runType_ == EcalDCCHeaderBlock::COSMIC ||
             runType_ == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
             runType_ == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
             runType_ == EcalDCCHeaderBlock::COSMICS_LOCAL ||
             runType_ == EcalDCCHeaderBlock::PHYSICS_LOCAL ||
             runType_ == EcalDCCHeaderBlock::BEAMH2 ||
             runType_ == EcalDCCHeaderBlock::BEAMH4 ) this->writeDb();
        this->softReset(true);
        last_time_reset_ = current_time_;
      }

    }

  }

  if ( strcmp(status_.c_str(), "end-of-run") == 0 ) {

    if ( run_ != -1 && evt_ != -1 && runType_ != -1 ) {

      if ( begin_run_ && ! end_run_ ) {

        forced_status_ = false;
        this->endRun();

      }

    }

  }

  // BEGIN: run-time fixes for missing state transitions

  // run number transition

  if ( strcmp(status_.c_str(), "running") == 0 ) {

    if ( run_ != -1 && evt_ != -1 && runType_ != -1 ) {

      if ( ! mergeRuns_ ) {

        int new_run_ = run_;
        int old_run_ = last_run_;

        if ( new_run_ != old_run_ ) {

          if ( begin_run_ && ! end_run_ ) {

            if ( verbose_ ) {
              std::cout << std::endl;
              std::cout << " Old run has finished, issuing endRun() ... " << std::endl;
              std::cout << std::endl;
            }

            // end old_run_
            run_ = old_run_;

            forced_status_ = false;
            this->endRun();

          }

          if ( ! begin_run_ ) {

            if ( verbose_ ) {
              std::cout << std::endl;
              std::cout << " New run has started, issuing beginRun() ... " << std::endl;
              std::cout << std::endl;
            }

            // start new_run_
            run_ = new_run_;

            forced_status_ = false;
            this->beginRun();

          }

        }

      }

    }

  }

  // 'running' state without a previous 'begin-of-run' state

  if ( strcmp(status_.c_str(), "running") == 0 ) {

    if ( run_ != -1 && evt_ != -1 && runType_ != -1 ) {

      if ( ! forced_status_ ) {

        if ( ! begin_run_ ) {

          if ( verbose_ ) {
            std::cout << std::endl;
            std::cout << "Forcing beginRun() ... NOW !" << std::endl;
            std::cout << std::endl;
          }

          forced_status_ = true;
          this->beginRun();

        }

      }

    }

  }

  // 'end-of-run' state without a previous 'begin-of-run' or 'running' state

  if ( strcmp(status_.c_str(), "end-of-run") == 0 ) {

    if ( run_ != -1 && evt_ != -1 && runType_ != -1 ) {

      if ( ! forced_status_ ) {

        if ( ! begin_run_ ) {

          if ( verbose_ ) {
            std::cout << std::endl;
            std::cout << "Forcing beginRun() ... NOW !" << std::endl;
            std::cout << std::endl;
          }

          forced_status_ = true;
          this->beginRun();

        }

      }

    }

  }

  // END: run-time fixes for missing state transitions

}
void EcalBarrelMonitorClient::analyze ( const edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 1716 of file EcalBarrelMonitorClient.cc.

References analyze(), edm::EventID::event(), evt_, edm::EventBase::id(), jevt_, prescaleFactor_, edm::EventID::run(), and run_.

                                                                               {

  run_ = e.id().run();
  evt_ = e.id().event();

  if ( prescaleFactor_ > 0 ) {
    if ( jevt_ % prescaleFactor_ == 0 ) this->analyze();
  }

}
void EcalBarrelMonitorClient::beginJob ( void  ) [virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 593 of file EcalBarrelMonitorClient.cc.

References begin_run_, EBSummaryClient::beginJob(), DQMStore::book2D(), DQMStore::bookFloat(), clients_, gather_cfg::cout, current_time_, debug_, dqmStore_, end_run_, evt_, evtType_, MonitorElement::Fill(), forced_status_, forced_update_, DQMStore::get(), MonitorElement::getName(), h_, trackerHits::histo, i, ievt_, inputFile_, jevt_, last_run_, last_time_reset_, last_time_update_, NULL, DQMStore::open(), cmsCodeRules::cppFunctionSkipper::operator, prefixME_, DQMStore::removeElement(), run_, runType_, Numbers::sEB(), MonitorElement::setAxisTitle(), MonitorElement::setBinContent(), DQMStore::setCurrentFolder(), status_, subrun_, summaryClient_, and cond::rpcobgas::time.

                                           {

  begin_run_ = false;
  end_run_   = false;

  forced_status_ = false;
  forced_update_ = false;

  h_ = 0;

  status_  = "unknown";

  run_     = -1;
  evt_     = -1;

  runType_ = -1;
  evtType_ = -1;

  last_run_ = -1;

  subrun_  = -1;

  if ( debug_ ) std::cout << "EcalBarrelMonitorClient: beginJob" << std::endl;

  ievt_ = 0;
  jevt_ = 0;

  current_time_ = time(NULL);
  last_time_update_ = current_time_;
  last_time_reset_ = current_time_;

  // get hold of back-end interface

  dqmStore_ = edm::Service<DQMStore>().operator->();

  if ( inputFile_.size() != 0 ) {
    if ( dqmStore_ ) {
      dqmStore_->open(inputFile_);
    }
  }

  for ( unsigned int i=0; i<clients_.size(); i++ ) {
    clients_[i]->beginJob();
  }

  if ( summaryClient_ ) summaryClient_->beginJob();

  // summary for DQM GUI

  char histo[200];

  MonitorElement* me;

  dqmStore_->setCurrentFolder( prefixME_ + "/EventInfo" );

  sprintf(histo, "reportSummary");
  me = dqmStore_->get(prefixME_ + "/EventInfo/" + histo);
  if ( me ) {
    dqmStore_->removeElement(me->getName());
  }
  me = dqmStore_->bookFloat(histo);
  me->Fill(-1.0);

  dqmStore_->setCurrentFolder( prefixME_ + "/EventInfo/reportSummaryContents" );

  for (int i = 0; i < 36; i++) {
    sprintf(histo, "EcalBarrel_%s", Numbers::sEB(i+1).c_str());
    me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryContents/" + histo);
    if ( me ) {
      dqmStore_->removeElement(me->getName());
    }
    me = dqmStore_->bookFloat(histo);
    me->Fill(-1.0);
  }

  dqmStore_->setCurrentFolder( prefixME_ + "/EventInfo" );

  sprintf(histo, "reportSummaryMap");
  me = dqmStore_->get(prefixME_ + "/EventInfo/" + histo);
  if ( me ) {
    dqmStore_->removeElement(me->getName());
  }
  me = dqmStore_->book2D(histo, histo, 72, 0., 72., 34, 0., 34);
  for ( int iettx = 0; iettx < 34; iettx++ ) {
    for ( int ipttx = 0; ipttx < 72; ipttx++ ) {
      me->setBinContent( ipttx+1, iettx+1, -1.0 );
    }
  }
  me->setAxisTitle("jphi", 1);
  me->setAxisTitle("jeta", 2);

}
void EcalBarrelMonitorClient::beginLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup c 
) [virtual]

BeginLumiBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 899 of file EcalBarrelMonitorClient.cc.

References gather_cfg::cout, edm::LuminosityBlockBase::id(), and verbose_.

                                                                                                      {

  if ( verbose_ ) {
    std::cout << std::endl;
    std::cout << "Standard beginLuminosityBlock() for luminosity block " << l.id().luminosityBlock() << " of run " << l.id().run() << std::endl;
    std::cout << std::endl;
  }

}
void EcalBarrelMonitorClient::beginRun ( void  )

BeginRun.

Definition at line 686 of file EcalBarrelMonitorClient.cc.

References begin_run_, EBSummaryClient::beginRun(), beginRunDb(), clients_, clientsRuns_, gather_cfg::cout, current_time_, debug_, generateEDF::done, end_run_, i, j, jevt_, last_run_, last_time_reset_, last_time_update_, NULL, run_, runType_, setup(), summaryClient_, and cond::rpcobgas::time.

Referenced by analyze().

                                           {

  begin_run_ = true;
  end_run_   = false;

  last_run_  = run_;

  if ( debug_ ) std::cout << "EcalBarrelMonitorClient: beginRun" << std::endl;

  jevt_ = 0;

  current_time_ = time(NULL);
  last_time_update_ = current_time_;
  last_time_reset_ = current_time_;

  this->setup();

  this->beginRunDb();

  for ( int i=0; i<int(clients_.size()); i++ ) {
    clients_[i]->cleanup();
    bool done = false;
    for ( std::multimap<EBClient*,int>::iterator j = clientsRuns_.lower_bound(clients_[i]); j != clientsRuns_.upper_bound(clients_[i]); j++ ) {
      if ( runType_ != -1 && runType_ == (*j).second && !done ) {
        done = true;
        clients_[i]->beginRun();
      }
    }
  }

  if ( summaryClient_ ) summaryClient_->beginRun();

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

Reimplemented from edm::EDAnalyzer.

Definition at line 720 of file EcalBarrelMonitorClient.cc.

References gather_cfg::cout, evt_, edm::RunBase::id(), Numbers::initGeometry(), Masks::initMasking(), jevt_, run_, and verbose_.

                                                                              {

  Numbers::initGeometry(c, verbose_);

  if ( verbose_ ) std::cout << std::endl;

  Masks::initMasking(c, verbose_);

  if ( verbose_ ) {
    std::cout << std::endl;
    std::cout << "Standard beginRun() for run " << r.id().run() << std::endl;
    std::cout << std::endl;
  }

  run_ = r.id().run();
  evt_ = 0;

  jevt_ = 0;

}
void EcalBarrelMonitorClient::beginRunDb ( void  )

BeginRunDB.

Definition at line 955 of file EcalBarrelMonitorClient.cc.

References benchmark_cfg::cerr, gather_cfg::cout, dbHostName_, dbHostPort_, dbName_, dbPassword_, dbUserName_, EcalCondDBInterface::fetchRunIOV(), getRunType(), i, EcalCondDBInterface::insertRunIOV(), location_, run_, runType_, runTypes_, RunTag::setGeneralTag(), LocationDef::setLocation(), RunTag::setLocationDef(), RunTypeDef::setRunType(), RunTag::setRunTypeDef(), Tm::setToCurrentGMTime(), subrun_, and verbose_.

Referenced by beginRun().

                                             {

  subrun_ = 0;

#ifdef WITH_ECAL_COND_DB
  EcalCondDBInterface* econn;

  econn = 0;

  if ( dbName_.size() != 0 ) {
    try {
      if ( verbose_ ) std::cout << "Opening DB connection with TNS_ADMIN ..." << std::endl;
      econn = new EcalCondDBInterface(dbName_, dbUserName_, dbPassword_);
      if ( verbose_ ) std::cout << "done." << std::endl;
    } catch (std::runtime_error &e) {
      std::cerr << e.what() << std::endl;
      if ( dbHostName_.size() != 0 ) {
        try {
          if ( verbose_ ) std::cout << "Opening DB connection without TNS_ADMIN ..." << std::endl;
          econn = new EcalCondDBInterface(dbHostName_, dbName_, dbUserName_, dbPassword_, dbHostPort_);
          if ( verbose_ ) std::cout << "done." << std::endl;
        } catch (std::runtime_error &e) {
          std::cerr << e.what() << std::endl;
        }
      }
    }
  }

  // create the objects necessary to identify a dataset

  LocationDef locdef;

  locdef.setLocation(location_);

  RunTypeDef rundef;

  rundef.setRunType( this->getRunType() );

  RunTag runtag;

  runtag.setLocationDef(locdef);
  runtag.setRunTypeDef(rundef);

  runtag.setGeneralTag( this->getRunType() );

  // fetch the RunIOV from the DB

  bool foundRunIOV = false;

  if ( econn ) {
    try {
      if ( verbose_ ) std::cout << "Fetching RunIOV ..." << std::endl;
//      runiov_ = econn->fetchRunIOV(&runtag, run_);
      runiov_ = econn->fetchRunIOV(location_, run_);
      if ( verbose_ ) std::cout << "done." << std::endl;
      foundRunIOV = true;
    } catch (std::runtime_error &e) {
      std::cerr << e.what() << std::endl;
      foundRunIOV = false;
    }
  }

  // begin - setup the RunIOV (on behalf of the DAQ)

  if ( ! foundRunIOV ) {

    Tm startRun;

    startRun.setToCurrentGMTime();

    runiov_.setRunNumber(run_);
    runiov_.setRunStart(startRun);
    runiov_.setRunTag(runtag);

    if ( econn ) {
      try {
        if ( verbose_ ) std::cout << "Inserting RunIOV ..." << std::endl;
        econn->insertRunIOV(&runiov_);
//        runiov_ = econn->fetchRunIOV(&runtag, run_);
        runiov_ = econn->fetchRunIOV(location_, run_);
        if ( verbose_ ) std::cout << "done." << std::endl;
      } catch (std::runtime_error &e) {
        std::cerr << e.what() << std::endl;
        try {
          if ( verbose_ ) std::cout << "Fetching RunIOV (again) ..." << std::endl;
//          runiov_ = econn->fetchRunIOV(&runtag, run_);
          runiov_ = econn->fetchRunIOV(location_, run_);
          if ( verbose_ ) std::cout << "done." << std::endl;
          foundRunIOV = true;
        } catch (std::runtime_error &e) {
          std::cerr << e.what() << std::endl;
          foundRunIOV = false;
        }
      }
    }

  }

  // end - setup the RunIOV (on behalf of the DAQ)

  if ( verbose_ ) {
    std::cout << std::endl;
    std::cout << "=============RunIOV:" << std::endl;
    std::cout << "Run Number:         " << runiov_.getRunNumber() << std::endl;
    std::cout << "Run Start:          " << runiov_.getRunStart().str() << std::endl;
    std::cout << "Run End:            " << runiov_.getRunEnd().str() << std::endl;
    std::cout << "====================" << std::endl;
    std::cout << std::endl;
    std::cout << "=============RunTag:" << std::endl;
    std::cout << "GeneralTag:         " << runiov_.getRunTag().getGeneralTag() << std::endl;
    std::cout << "Location:           " << runiov_.getRunTag().getLocationDef().getLocation() << std::endl;
    std::cout << "Run Type:           " << runiov_.getRunTag().getRunTypeDef().getRunType() << std::endl;
    std::cout << "====================" << std::endl;
    std::cout << std::endl;
  }

  std::string rt = runiov_.getRunTag().getRunTypeDef().getRunType();
  if ( strcmp(rt.c_str(), "UNKNOWN") == 0 ) {
    runType_ = -1;
  } else {
    for ( unsigned int i = 0; i < runTypes_.size(); i++ ) {
      if ( strcmp(rt.c_str(), runTypes_[i].c_str()) == 0 ) {
        if ( runType_ != int(i) ) {
          if ( verbose_ ) {
            std::cout << std::endl;
            std::cout << "Fixing Run Type to: " << runTypes_[i] << std::endl;
            std::cout << std::endl;
          }
          runType_ = i;
        }
        break;
      }
    }
  }

  if ( verbose_ ) std::cout << std::endl;

  if ( econn ) {
    try {
      if ( verbose_ ) std::cout << "Closing DB connection ..." << std::endl;
      delete econn;
      econn = 0;
      if ( verbose_ ) std::cout << "done." << std::endl;
    } catch (std::runtime_error &e) {
      std::cerr << e.what() << std::endl;
    }
  }
#endif

  if ( verbose_ ) std::cout << std::endl;

}
void EcalBarrelMonitorClient::cleanup ( void  )

Cleanup.

Definition at line 943 of file EcalBarrelMonitorClient.cc.

References cloneME_, enableCleanup_, and h_.

Referenced by endJob(), and endRun().

                                          {

  if ( ! enableCleanup_ ) return;

  if ( cloneME_ ) {
    if ( h_ ) delete h_;
  }

  h_ = 0;

}
void EcalBarrelMonitorClient::endJob ( void  ) [virtual]

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 741 of file EcalBarrelMonitorClient.cc.

References analyze(), begin_run_, cleanup(), clients_, gather_cfg::cout, debug_, end_run_, EBSummaryClient::endJob(), endRun(), forced_status_, forced_update_, i, ievt_, summaryClient_, and verbose_.

                                         {

  if ( ! end_run_ ) {

    if ( verbose_ ) {
      std::cout << std::endl;
      std::cout << "Checking last event at endJob() ... " << std::endl;
      std::cout << std::endl;
    }

    forced_update_ = true;
    this->analyze();

    if ( begin_run_ && ! end_run_ ) {

      if ( verbose_ ) {
        std::cout << std::endl;
        std::cout << "Forcing endRun() ... " << std::endl;
        std::cout << std::endl;
      }

      forced_status_ = true;
      this->analyze();
      this->endRun();

    }

  }

  if ( debug_ ) std::cout << "EcalBarrelMonitorClient: endJob, ievt = " << ievt_ << std::endl;

  this->cleanup();

  for ( unsigned int i=0; i<clients_.size(); i++ ) {
    clients_[i]->endJob();
  }

  if ( summaryClient_ ) summaryClient_->endJob();

}
void EcalBarrelMonitorClient::endLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup c 
) [virtual]

EndLumiBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 909 of file EcalBarrelMonitorClient.cc.

References analyze(), gather_cfg::cout, current_time_, evt_, forced_update_, edm::LuminosityBlockBase::id(), last_time_update_, NULL, run_, runType_, cond::rpcobgas::time, updateTime_, and verbose_.

                                                                                                    {

  current_time_ = time(NULL);

  if ( verbose_ ) {
    std::cout << std::endl;
    std::cout << "Standard endLuminosityBlock() for luminosity block " << l.id().luminosityBlock() << " of run " << l.id().run() << std::endl;
    std::cout << std::endl;
  }

  if ( updateTime_ > 0 ) {
    if ( (current_time_ - last_time_update_) < 60 * updateTime_ ) {
      return;
    }
    last_time_update_ = current_time_;
  }

  if ( run_ != -1 && evt_ != -1 && runType_ != -1 ) {

    forced_update_ = true;
    this->analyze();

  }

}
void EcalBarrelMonitorClient::endRun ( void  )

EndRun.

Definition at line 782 of file EcalBarrelMonitorClient.cc.

References EBSummaryClient::analyze(), begin_run_, cleanup(), clients_, clientsRuns_, gather_cfg::cout, dbUpdateTime_, debug_, generateEDF::done, end_run_, EBSummaryClient::endRun(), endRunDb(), evt_, evtType_, i, j, jevt_, resetFile_, run_, runType_, softReset(), status_, subrun_, summaryClient_, and writeDb().

Referenced by analyze(), endJob(), and endRun().

                                         {

  begin_run_ = false;
  end_run_   = true;

  if ( debug_ ) std::cout << "EcalBarrelMonitorClient: endRun, jevt = " << jevt_ << std::endl;

  if ( subrun_ != -1 ) {

    this->writeDb();

    this->endRunDb();

  }

  if ( resetFile_.size() != 0 || dbUpdateTime_ > 0 ) {

    this->softReset(false);

    for ( int i=0; i<int(clients_.size()); i++ ) {
      bool done = false;
      for ( std::multimap<EBClient*,int>::iterator j = clientsRuns_.lower_bound(clients_[i]); j != clientsRuns_.upper_bound(clients_[i]); j++ ) {
        if ( runType_ != -1 && runType_ == (*j).second && !done ) {
          done = true;
          clients_[i]->analyze();
        }
      }
    }

    if ( summaryClient_ ) summaryClient_->analyze();

  }

  for ( int i=0; i<int(clients_.size()); i++ ) {
    bool done = false;
    for ( std::multimap<EBClient*,int>::iterator j = clientsRuns_.lower_bound(clients_[i]); j != clientsRuns_.upper_bound(clients_[i]); j++ ) {
      if ( runType_ != -1 && runType_ == (*j).second && !done ) {
        done = true;
        clients_[i]->endRun();
      }
    }
  }

  if ( summaryClient_ ) summaryClient_->endRun();

  this->cleanup();

  status_  = "unknown";

  run_     = -1;
  evt_     = -1;

  runType_ = -1;
  evtType_ = -1;

  subrun_ = -1;

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

Reimplemented from edm::EDAnalyzer.

Definition at line 841 of file EcalBarrelMonitorClient.cc.

References analyze(), begin_run_, gather_cfg::cout, dqmStore_, end_run_, endRun(), evt_, MonitorElement::Fill(), forced_status_, forced_update_, DQMStore::get(), trackerHits::histo, i, edm::RunBase::id(), mergeRuns_, prefixME_, run_, runType_, Numbers::sEB(), MonitorElement::setBinContent(), and verbose_.

                                                                            {

  if ( verbose_ ) {
    std::cout << std::endl;
    std::cout << "Standard endRun() for run " << r.id().run() << std::endl;
    std::cout << std::endl;
  }

  this->analyze();

  if ( run_ != -1 && evt_ != -1 && runType_ != -1 ) {

    forced_update_ = true;
    this->analyze();

    if ( ! mergeRuns_ ) {

      if ( begin_run_ && ! end_run_ ) {

        forced_status_ = false;
        this->endRun();

      }

    }

  }

  // summary for DQM GUI

  if ( run_ != -1 && evt_ != -1 && runType_ == -1 )  {

    char histo[200];

    MonitorElement* me;

    sprintf(histo, "reportSummary");
    me = dqmStore_->get(prefixME_ + "/EventInfo/" + histo);
    if ( me ) me->Fill(-1.0);

    for (int i = 0; i < 36; i++) {
      sprintf(histo, "EcalBarrel_%s", Numbers::sEB(i+1).c_str());
      me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryContents/" + histo);
      if ( me ) me->Fill(-1.0);
    }

    sprintf(histo, "reportSummaryMap");
    me = dqmStore_->get(prefixME_ + "/EventInfo/" + histo);
    for ( int iettx = 0; iettx < 34; iettx++ ) {
      for ( int ipttx = 0; ipttx < 72; ipttx++ ) {
        if ( me ) me->setBinContent( ipttx+1, iettx+1, -1.0 );
      }
    }

  }

}
void EcalBarrelMonitorClient::endRunDb ( void  )

EndRunDB.

Definition at line 1319 of file EcalBarrelMonitorClient.cc.

References benchmark_cfg::cerr, gather_cfg::cout, BeamSplash_cfg::dataset, dbHostName_, dbHostPort_, dbName_, dbPassword_, dbUserName_, EcalCondDBInterface::fetchDataSet(), LogicID::getEcalLogicID(), h_, EcalCondDBInterface::insertDataSet(), RunDat::setNumEvents(), and verbose_.

Referenced by endRun().

                                           {

#ifdef WITH_ECAL_COND_DB
  EcalCondDBInterface* econn;

  econn = 0;

  if ( dbName_.size() != 0 ) {
    try {
      if ( verbose_ ) std::cout << "Opening DB connection with TNS_ADMIN ..." << std::endl;
      econn = new EcalCondDBInterface(dbName_, dbUserName_, dbPassword_);
      if ( verbose_ ) std::cout << "done." << std::endl;
    } catch (std::runtime_error &e) {
      std::cerr << e.what() << std::endl;
      if ( dbHostName_.size() != 0 ) {
        try {
          if ( verbose_ ) std::cout << "Opening DB connection without TNS_ADMIN ..." << std::endl;
          econn = new EcalCondDBInterface(dbHostName_, dbName_, dbUserName_, dbPassword_, dbHostPort_);
          if ( verbose_ ) std::cout << "done." << std::endl;
        } catch (std::runtime_error &e) {
          std::cerr << e.what() << std::endl;
        }
      }
    }
  }

  EcalLogicID ecid;
  RunDat rd;
  std::map<EcalLogicID, RunDat> dataset;

  float nevt = -1.;

  if ( h_ ) nevt = h_->GetSumOfWeights();

  rd.setNumEvents(int(nevt));

  // fetch the RunDat from the DB

  bool foundRunDat = false;

  if ( econn ) {
    try {
      if ( verbose_ ) std::cout << "Fetching RunDat ..." << std::endl;
      econn->fetchDataSet(&dataset, &runiov_);
      if ( verbose_ ) std::cout << "done." << std::endl;
      foundRunDat = true;
    } catch (std::runtime_error &e) {
      std::cerr << e.what() << std::endl;
      foundRunDat = false;
    }
  }

  // begin - setup the RunDat (on behalf of the DAQ)

  if ( ! foundRunDat ) {

    if ( econn ) {
      try {
        ecid = LogicID::getEcalLogicID("EB");
        dataset[ecid] = rd;
      } catch (std::runtime_error &e) {
        std::cerr << e.what() << std::endl;
      }
    }

    if ( econn ) {
      try {
        if ( verbose_ ) std::cout << "Inserting RunDat ..." << std::endl;
        econn->insertDataSet(&dataset, &runiov_);
        if ( verbose_ ) std::cout << "done." << std::endl;
      } catch (std::runtime_error &e) {
        std::cerr << e.what() << std::endl;
      }
    }

  }

  // end - setup the RunDat (on behalf of the DAQ)

  if ( econn ) {
    try {
      if ( verbose_ ) std::cout << "Closing DB connection ..." << std::endl;
      delete econn;
      econn = 0;
      if ( verbose_ ) std::cout << "done." << std::endl;
    } catch (std::runtime_error &e) {
      std::cerr << e.what() << std::endl;
    }
  }
#endif

}
const char* EcalBarrelMonitorClient::getRunType ( void  ) [inline]

Definition at line 93 of file EcalBarrelMonitorClient.h.

References runType_, and runTypes_.

Referenced by analyze(), beginRunDb(), and EcalBarrelMonitorXdaqClient::defaultWebPage().

{ return( runType_ == -1 ? "UNKNOWN" : runTypes_[runType_].c_str() ); }
void EcalBarrelMonitorClient::reset ( void  )

Reset.

Definition at line 935 of file EcalBarrelMonitorClient.cc.

Referenced by analyze().

                                        {

}
void EcalBarrelMonitorClient::setup ( void  )

Setup.

Definition at line 939 of file EcalBarrelMonitorClient.cc.

Referenced by beginRun().

                                        {

}
void EcalBarrelMonitorClient::softReset ( bool  flag)

SoftReset.

Definition at line 1727 of file EcalBarrelMonitorClient.cc.

References DQMStore::disableSoftReset(), dqmStore_, DQMStore::get(), DQMStore::getAllContents(), prefixME_, and DQMStore::softReset().

Referenced by analyze(), and endRun().

                                                 {

  std::vector<MonitorElement*> mes = dqmStore_->getAllContents(prefixME_);
  std::vector<MonitorElement*>::const_iterator meitr;
  for ( meitr=mes.begin(); meitr!=mes.end(); meitr++ ) {
    if ( !strncmp((*meitr)->getName().c_str(), "EB", 2)
         && strncmp((*meitr)->getName().c_str(), "EBTrend", 7)
         && strncmp((*meitr)->getName().c_str(), "by lumi", 7) ) {
      if ( flag ) {
        dqmStore_->softReset(*meitr);
      } else {
        dqmStore_->disableSoftReset(*meitr);
      }
    }
  }

  MonitorElement* me = dqmStore_->get(prefixME_ + "/EcalInfo/EVTTYPE");
  if ( me ) {
    if ( flag ) {
      dqmStore_->softReset(me);
    } else {
      dqmStore_->disableSoftReset(me);
    }
  }

}
void EcalBarrelMonitorClient::writeDb ( void  )

WriteDB.

Definition at line 1108 of file EcalBarrelMonitorClient.cc.

References benchmark_cfg::cerr, clients_, clientsNames_, clientsRuns_, clientsStatus_, EcalDCCHeaderBlock::COSMIC, EcalDCCHeaderBlock::COSMICS_GLOBAL, EcalDCCHeaderBlock::COSMICS_LOCAL, gather_cfg::cout, BeamSplash_cfg::dataset, dbHostName_, dbHostPort_, dbName_, dbPassword_, dbTagName_, dbUserName_, generateEDF::done, EcalCondDBInterface::fetchMonRunIOV(), LogicID::getEcalLogicID(), h_, i, EcalCondDBInterface::insertDataSet(), EcalCondDBInterface::insertMonRunIOV(), j, EcalDCCHeaderBlock::LASER_GAP, EcalDCCHeaderBlock::LASER_STD, EcalDCCHeaderBlock::PEDESTAL_GAP, EcalDCCHeaderBlock::PEDESTAL_STD, EcalDCCHeaderBlock::PHYSICS_GLOBAL, EcalDCCHeaderBlock::PHYSICS_LOCAL, run_, runType_, MonRunTag::setGeneralTag(), MonVersionDef::setMonitoringVersion(), MonRunDat::setMonRunOutcomeDef(), MonRunTag::setMonVersionDef(), MonRunDat::setNumEvents(), MonRunOutcomeDef::setShortDesc(), MonRunDat::setTaskList(), MonRunDat::setTaskOutcome(), Tm::setToCurrentGMTime(), ntuplemaker::status, subrun_, summaryClient_, EcalDCCHeaderBlock::TESTPULSE_GAP, EcalDCCHeaderBlock::TESTPULSE_MGPA, and verbose_.

Referenced by analyze(), and endRun().

                                          {

  subrun_++;

#ifdef WITH_ECAL_COND_DB
  EcalCondDBInterface* econn;

  econn = 0;

  if ( dbName_.size() != 0 ) {
    try {
      if ( verbose_ ) std::cout << "Opening DB connection with TNS_ADMIN ..." << std::endl;
      econn = new EcalCondDBInterface(dbName_, dbUserName_, dbPassword_);
      if ( verbose_ ) std::cout << "done." << std::endl;
    } catch (std::runtime_error &e) {
      std::cerr << e.what() << std::endl;
      if ( dbHostName_.size() != 0 ) {
        try {
          if ( verbose_ ) std::cout << "Opening DB connection without TNS_ADMIN ..." << std::endl;
          econn = new EcalCondDBInterface(dbHostName_, dbName_, dbUserName_, dbPassword_, dbHostPort_);
          if ( verbose_ ) std::cout << "done." << std::endl;
        } catch (std::runtime_error &e) {
          std::cerr << e.what() << std::endl;
        }
      }
    }
  }

  MonVersionDef monverdef;

  monverdef.setMonitoringVersion("test01");

  MonRunTag montag;

  montag.setMonVersionDef(monverdef);
  montag.setGeneralTag(dbTagName_);

  Tm startSubRun;

  startSubRun.setToCurrentGMTime();

  // fetch the MonIOV from the DB

  bool foundMonIOV = false;

  if ( econn ) {
    try {
      if ( verbose_ ) std::cout << "Fetching MonIOV ..." << std::endl;
      RunTag runtag = runiov_.getRunTag();
      moniov_ = econn->fetchMonRunIOV(&runtag, &montag, run_, subrun_);
      if ( verbose_ ) std::cout << "done." << std::endl;
      foundMonIOV = true;
    } catch (std::runtime_error &e) {
      std::cerr << e.what() << std::endl;
      foundMonIOV = false;
    }
  }

  // begin - setup the MonIOV

  if ( !foundMonIOV ) {

    moniov_.setRunIOV(runiov_);
    moniov_.setSubRunNumber(subrun_);

    if ( subrun_ > 1 ) {
      moniov_.setSubRunStart(startSubRun);
    } else {
      moniov_.setSubRunStart(runiov_.getRunStart());
    }

    moniov_.setMonRunTag(montag);

    if ( econn ) {
      try {
        if ( verbose_ ) std::cout << "Inserting MonIOV ..." << std::endl;
        econn->insertMonRunIOV(&moniov_);
        RunTag runtag = runiov_.getRunTag();
        moniov_ = econn->fetchMonRunIOV(&runtag, &montag, run_, subrun_);
        if ( verbose_ ) std::cout << "done." << std::endl;
      } catch (std::runtime_error &e) {
        std::cerr << e.what() << std::endl;
        try {
          if ( verbose_ ) std::cout << "Fetching MonIOV (again) ..." << std::endl;
          RunTag runtag = runiov_.getRunTag();
          moniov_ = econn->fetchMonRunIOV(&runtag, &montag, run_, subrun_);
          if ( verbose_ ) std::cout << "done." << std::endl;
          foundMonIOV = true;
        } catch (std::runtime_error &e) {
          std::cerr << e.what() << std::endl;
          foundMonIOV = false;
        }
      }
    }

  }

  // end - setup the MonIOV

  if ( verbose_ ) {
    std::cout << std::endl;
    std::cout << "==========MonRunIOV:" << std::endl;
    std::cout << "SubRun Number:      " << moniov_.getSubRunNumber() << std::endl;
    std::cout << "SubRun Start:       " << moniov_.getSubRunStart().str() << std::endl;
    std::cout << "SubRun End:         " << moniov_.getSubRunEnd().str() << std::endl;
    std::cout << "====================" << std::endl;
    std::cout << std::endl;
    std::cout << "==========MonRunTag:" << std::endl;
    std::cout << "GeneralTag:         " << moniov_.getMonRunTag().getGeneralTag() << std::endl;
    std::cout << "Monitoring Ver:     " << moniov_.getMonRunTag().getMonVersionDef().getMonitoringVersion() << std::endl;
    std::cout << "====================" << std::endl;
    std::cout << std::endl;
  }

  int taskl = 0x0;
  int tasko = 0x0;

  for ( int i=0; i<int(clients_.size()); i++ ) {
    bool done = false;
    for ( std::multimap<EBClient*,int>::iterator j = clientsRuns_.lower_bound(clients_[i]); j != clientsRuns_.upper_bound(clients_[i]); j++ ) {
      if ( h_ && runType_ != -1 && runType_ == (*j).second && !done ) {
        if ( strcmp(clientsNames_[i].c_str(), "Cosmic") == 0 && runType_ != EcalDCCHeaderBlock::COSMIC && runType_ != EcalDCCHeaderBlock::COSMICS_LOCAL && runType_ != EcalDCCHeaderBlock::COSMICS_GLOBAL && runType_ != EcalDCCHeaderBlock::PHYSICS_GLOBAL && runType_ != EcalDCCHeaderBlock::PHYSICS_LOCAL && h_->GetBinContent(2+EcalDCCHeaderBlock::COSMIC) == 0 && h_->GetBinContent(2+EcalDCCHeaderBlock::COSMICS_LOCAL) == 0 && h_->GetBinContent(2+EcalDCCHeaderBlock::COSMICS_GLOBAL) == 0 && h_->GetBinContent(2+EcalDCCHeaderBlock::PHYSICS_GLOBAL) == 0 && h_->GetBinContent(2+EcalDCCHeaderBlock::PHYSICS_LOCAL) == 0 ) continue;
        if ( strcmp(clientsNames_[i].c_str(), "Laser") == 0 && runType_ != EcalDCCHeaderBlock::LASER_STD && runType_ != EcalDCCHeaderBlock::LASER_GAP && h_->GetBinContent(2+EcalDCCHeaderBlock::LASER_STD) == 0 && h_->GetBinContent(2+EcalDCCHeaderBlock::LASER_GAP) == 0 ) continue;
        if ( strcmp(clientsNames_[i].c_str(), "Pedestal") == 0 && runType_ != EcalDCCHeaderBlock::PEDESTAL_STD && runType_ != EcalDCCHeaderBlock::PEDESTAL_GAP && h_->GetBinContent(2+EcalDCCHeaderBlock::PEDESTAL_STD) == 0 && h_->GetBinContent(2+EcalDCCHeaderBlock::PEDESTAL_GAP) == 0 ) continue;
        if ( strcmp(clientsNames_[i].c_str(), "TestPulse") == 0 && runType_ != EcalDCCHeaderBlock::TESTPULSE_MGPA && runType_ != EcalDCCHeaderBlock::TESTPULSE_GAP && h_->GetBinContent(2+EcalDCCHeaderBlock::TESTPULSE_MGPA) == 0 && h_->GetBinContent(2+EcalDCCHeaderBlock::TESTPULSE_GAP) == 0 ) continue;
        done = true;
        if ( verbose_ ) {
          if ( econn ) {
            std::cout << " Writing " << clientsNames_[i] << " results to DB " << std::endl;
            std::cout << std::endl;
          }
        }
        bool status;
        if ( clients_[i]->writeDb(econn, &runiov_, &moniov_, status) ) {
          taskl |= 0x1 << clientsStatus_[clientsNames_[i]];
          if ( status ) {
            tasko |= 0x1 << clientsStatus_[clientsNames_[i]];
          }
        } else {
          tasko |= 0x1 << clientsStatus_[clientsNames_[i]];
        }
      }
    }
    if ( ((taskl >> clientsStatus_[clientsNames_[i]]) & 0x1) ) {
      if ( verbose_ ) {
        std::cout << " Task output for " << clientsNames_[i] << " = "
             << ((tasko >> clientsStatus_[clientsNames_[i]]) & 0x1) << std::endl;
        std::cout << std::endl;
      }
    }
  }

  bool status;
  if ( summaryClient_ ) summaryClient_->writeDb(econn, &runiov_, &moniov_, status);

  EcalLogicID ecid;
  MonRunDat md;
  std::map<EcalLogicID, MonRunDat> dataset;

  MonRunOutcomeDef monRunOutcomeDef;

  monRunOutcomeDef.setShortDesc("success");

  float nevt = -1.;

  if ( h_ ) nevt = h_->GetSumOfWeights();

  md.setNumEvents(int(nevt));
  md.setMonRunOutcomeDef(monRunOutcomeDef);

//  string fileName = "";
//  md.setRootfileName(fileName);

  md.setTaskList(taskl);
  md.setTaskOutcome(tasko);

  if ( econn ) {
    try {
      ecid = LogicID::getEcalLogicID("EB");
      dataset[ecid] = md;
    } catch (std::runtime_error &e) {
      std::cerr << e.what() << std::endl;
    }
  }

  if ( econn ) {
    try {
      if ( verbose_ ) std::cout << "Inserting MonRunDat ..." << std::endl;
      econn->insertDataSet(&dataset, &moniov_);
      if ( verbose_ ) std::cout << "done." << std::endl;
    } catch (std::runtime_error &e) {
      std::cerr << e.what() << std::endl;
    }
  }

  if ( econn ) {
    try {
      if ( verbose_ ) std::cout << "Closing DB connection ..." << std::endl;
      delete econn;
      econn = 0;
      if ( verbose_ ) std::cout << "done." << std::endl;
    } catch (std::runtime_error &e) {
      std::cerr << e.what() << std::endl;
    }
  }
#endif

  if ( verbose_ ) std::cout << std::endl;

}

Friends And Related Function Documentation

friend class EcalBarrelMonitorXdaqClient [friend]

Definition at line 38 of file EcalBarrelMonitorClient.h.


Member Data Documentation

Definition at line 164 of file EcalBarrelMonitorClient.h.

Referenced by analyze(), beginJob(), beginRun(), endJob(), and endRun().

std::vector<std::string> EcalBarrelMonitorClient::clientsNames_ [private]
std::multimap<EBClient*,int> EcalBarrelMonitorClient::clientsRuns_ [private]
std::map<std::string,int> EcalBarrelMonitorClient::clientsStatus_ [private]

Definition at line 146 of file EcalBarrelMonitorClient.h.

Referenced by EcalBarrelMonitorClient(), and writeDb().

Definition at line 100 of file EcalBarrelMonitorClient.h.

Referenced by analyze(), cleanup(), and EcalBarrelMonitorClient().

Definition at line 130 of file EcalBarrelMonitorClient.h.

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

std::string EcalBarrelMonitorClient::dbHostName_ [private]

Definition at line 112 of file EcalBarrelMonitorClient.h.

Referenced by beginRunDb(), EcalBarrelMonitorClient(), endRunDb(), and writeDb().

Definition at line 113 of file EcalBarrelMonitorClient.h.

Referenced by beginRunDb(), EcalBarrelMonitorClient(), endRunDb(), and writeDb().

std::string EcalBarrelMonitorClient::dbName_ [private]

Definition at line 111 of file EcalBarrelMonitorClient.h.

Referenced by beginRunDb(), EcalBarrelMonitorClient(), endRunDb(), and writeDb().

std::string EcalBarrelMonitorClient::dbPassword_ [private]

Definition at line 115 of file EcalBarrelMonitorClient.h.

Referenced by beginRunDb(), EcalBarrelMonitorClient(), endRunDb(), and writeDb().

std::string EcalBarrelMonitorClient::dbTagName_ [private]

Definition at line 117 of file EcalBarrelMonitorClient.h.

Referenced by EcalBarrelMonitorClient(), and writeDb().

Definition at line 136 of file EcalBarrelMonitorClient.h.

Referenced by analyze(), EcalBarrelMonitorClient(), and endRun().

std::string EcalBarrelMonitorClient::dbUserName_ [private]

Definition at line 114 of file EcalBarrelMonitorClient.h.

Referenced by beginRunDb(), EcalBarrelMonitorClient(), endRunDb(), and writeDb().

Definition at line 150 of file EcalBarrelMonitorClient.h.

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

Definition at line 107 of file EcalBarrelMonitorClient.h.

Referenced by cleanup(), and EcalBarrelMonitorClient().

std::vector<std::string> EcalBarrelMonitorClient::enabledClients_ [private]

Definition at line 140 of file EcalBarrelMonitorClient.h.

Referenced by EcalBarrelMonitorClient().

Definition at line 165 of file EcalBarrelMonitorClient.h.

Referenced by analyze(), beginJob(), beginRun(), endJob(), and endRun().

Definition at line 162 of file EcalBarrelMonitorClient.h.

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

Definition at line 157 of file EcalBarrelMonitorClient.h.

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

Definition at line 167 of file EcalBarrelMonitorClient.h.

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

Definition at line 169 of file EcalBarrelMonitorClient.h.

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

TH1F* EcalBarrelMonitorClient::h_ [private]
std::string EcalBarrelMonitorClient::inputFile_ [private]

Definition at line 109 of file EcalBarrelMonitorClient.h.

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

Definition at line 98 of file EcalBarrelMonitorClient.h.

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

Definition at line 171 of file EcalBarrelMonitorClient.h.

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

Definition at line 133 of file EcalBarrelMonitorClient.h.

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

Definition at line 132 of file EcalBarrelMonitorClient.h.

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

std::string EcalBarrelMonitorClient::location_ [private]

Definition at line 154 of file EcalBarrelMonitorClient.h.

Referenced by analyze(), beginRunDb(), and EcalBarrelMonitorClient().

Definition at line 121 of file EcalBarrelMonitorClient.h.

Referenced by analyze(), EcalBarrelMonitorClient(), and endRun().

std::string EcalBarrelMonitorClient::prefixME_ [private]

Definition at line 105 of file EcalBarrelMonitorClient.h.

Referenced by analyze(), and EcalBarrelMonitorClient().

std::string EcalBarrelMonitorClient::resetFile_ [private]

Definition at line 119 of file EcalBarrelMonitorClient.h.

Referenced by analyze(), EcalBarrelMonitorClient(), and endRun().

std::vector<std::string> EcalBarrelMonitorClient::runTypes_ [private]
std::string EcalBarrelMonitorClient::status_ [private]

Definition at line 159 of file EcalBarrelMonitorClient.h.

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

Definition at line 128 of file EcalBarrelMonitorClient.h.

Referenced by beginJob(), beginRunDb(), endRun(), and writeDb().

std::vector<int> EcalBarrelMonitorClient::superModules_ [private]

Definition at line 138 of file EcalBarrelMonitorClient.h.

Referenced by EcalBarrelMonitorClient().

Definition at line 135 of file EcalBarrelMonitorClient.h.

Referenced by EcalBarrelMonitorClient(), and endLuminosityBlock().