CMS 3D CMS Logo

Public Member Functions | Private Attributes | Friends

EcalEndcapMonitorClient Class Reference

#include <EcalEndcapMonitorClient.h>

Inheritance diagram for EcalEndcapMonitorClient:
edm::EDAnalyzer EcalEndcapMonitorDbClient EcalEndcapMonitorXdaqClient

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.
 EcalEndcapMonitorClient (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 ~EcalEndcapMonitorClient ()
 Destructor.

Private Attributes

bool begin_run_
std::vector< EEClient * > clients_
std::vector< std::string > clientsNames_
std::multimap< EEClient *, 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 referenceFile_
std::string resetFile_
int run_
int runType_
std::vector< std::string > runTypes_
std::string status_
int subrun_
EESummaryClientsummaryClient_
std::vector< int > superModules_
time_t updateTime_
bool verbose_

Friends

class EcalEndcapMonitorXdaqClient

Detailed Description

Definition at line 36 of file EcalEndcapMonitorClient.h.


Constructor & Destructor Documentation

EcalEndcapMonitorClient::EcalEndcapMonitorClient ( const edm::ParameterSet ps)

Constructor.

Definition at line 63 of file EcalEndcapMonitorClient.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_, EESummaryClient::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 Endcap 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 18).

  superModules_.reserve(18);
  for ( unsigned int i = 1; i <= 18; 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 EEIntegrityClient(ps) );
    clientsNames_.push_back( "Integrity" );

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

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

  }

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

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

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

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

  }

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

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

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

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

  }

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

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

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

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

  }

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

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

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

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

  }

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

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

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

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

  }

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

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

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

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

  }

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

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

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

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

  }

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

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

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

  }

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

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

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

  }

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

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

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

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

  }

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

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

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

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

  }

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

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

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

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

  }

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

    clients_.push_back( new EELedClient(ps) );
    clientsNames_.push_back( "Led" );

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

    clientsRuns_.insert(std::pair<EEClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_GLOBAL ));
    clientsRuns_.insert(std::pair<EEClient*,int>( clients_.back(), EcalDCCHeaderBlock::PHYSICS_LOCAL ));
    clientsRuns_.insert(std::pair<EEClient*,int>( clients_.back(), EcalDCCHeaderBlock::LASER_GAP ));
    clientsRuns_.insert(std::pair<EEClient*,int>( clients_.back(), EcalDCCHeaderBlock::LED_GAP ));
    clientsRuns_.insert(std::pair<EEClient*,int>( clients_.back(), EcalDCCHeaderBlock::TESTPULSE_GAP ));
    clientsRuns_.insert(std::pair<EEClient*,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 EESummaryClient(ps);

  }

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

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

}
EcalEndcapMonitorClient::~EcalEndcapMonitorClient ( ) [virtual]

Destructor.

Definition at line 627 of file EcalEndcapMonitorClient.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 EcalEndcapMonitorClient::analyze ( void  )

Analyze.

Definition at line 1448 of file EcalEndcapMonitorClient.cc.

References EESummaryClient::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 << "EcalEndcapMonitorClient: 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 << "   EE run/event number = " << ecal_run << "/" << ecal_evt << std::endl;
      std::cout << "   EE location = " << location_ << std::endl;
      std::cout << "   EE 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<EEClient*,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 EcalEndcapMonitorClient::analyze ( const edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 1752 of file EcalEndcapMonitorClient.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 EcalEndcapMonitorClient::beginJob ( void  ) [virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 639 of file EcalEndcapMonitorClient.cc.

References begin_run_, EESummaryClient::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_, i, ievt_, inputFile_, jevt_, last_run_, last_time_reset_, last_time_update_, NULL, DQMStore::open(), cmsCodeRules::cppFunctionSkipper::operator, prefixME_, DQMStore::removeElement(), run_, runType_, Numbers::sEE(), 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 << "EcalEndcapMonitorClient: 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

  MonitorElement* me;

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

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

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

  for (int i = 0; i < 18; i++) {
    me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryContents/EcalEndcap_" + Numbers::sEE(i+1) );
    if ( me ) {
      dqmStore_->removeElement(me->getName());
    }
    me = dqmStore_->bookFloat("EcalEndcap_" + Numbers::sEE(i+1));
    me->Fill(-1.0);
  }

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

  me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryMap");
  if ( me ) {
    dqmStore_->removeElement(me->getName());
  }
  me = dqmStore_->book2D("reportSummaryMap", "reportSummaryMap", 40, 0., 200., 20, 0., 100);
  for ( int jx = 1; jx <= 40; jx++ ) {
    for ( int jy = 1; jy <= 20; jy++ ) {
      me->setBinContent( jx, jy, -1.0 );
    }
  }
  me->setAxisTitle("ix / ix+100", 1);
  me->setAxisTitle("iy", 2);

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

BeginLumiBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 934 of file EcalEndcapMonitorClient.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 EcalEndcapMonitorClient::beginRun ( void  )

BeginRun.

Definition at line 726 of file EcalEndcapMonitorClient.cc.

References begin_run_, EESummaryClient::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 << "EcalEndcapMonitorClient: 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<EEClient*,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 EcalEndcapMonitorClient::beginRun ( const edm::Run r,
const edm::EventSetup c 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 760 of file EcalEndcapMonitorClient.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 EcalEndcapMonitorClient::beginRunDb ( void  )

BeginRunDB.

Definition at line 990 of file EcalEndcapMonitorClient.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 EcalEndcapMonitorClient::cleanup ( void  )

Cleanup.

Definition at line 978 of file EcalEndcapMonitorClient.cc.

References cloneME_, enableCleanup_, and h_.

Referenced by endJob(), and endRun().

                                          {

  if ( ! enableCleanup_ ) return;

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

  h_ = 0;

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

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 781 of file EcalEndcapMonitorClient.cc.

References analyze(), begin_run_, cleanup(), clients_, gather_cfg::cout, debug_, end_run_, EESummaryClient::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 << "EcalEndcapMonitorClient: endJob, ievt = " << ievt_ << std::endl;

  this->cleanup();

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

  if ( summaryClient_ ) summaryClient_->endJob();

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

EndLumiBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 944 of file EcalEndcapMonitorClient.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 EcalEndcapMonitorClient::endRun ( void  )

EndRun.

Definition at line 822 of file EcalEndcapMonitorClient.cc.

References EESummaryClient::analyze(), begin_run_, cleanup(), clients_, clientsRuns_, gather_cfg::cout, dbUpdateTime_, debug_, generateEDF::done, end_run_, EESummaryClient::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 << "EcalEndcapMonitorClient: 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<EEClient*,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<EEClient*,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 EcalEndcapMonitorClient::endRun ( const edm::Run r,
const edm::EventSetup c 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 881 of file EcalEndcapMonitorClient.cc.

References analyze(), begin_run_, gather_cfg::cout, dqmStore_, end_run_, endRun(), evt_, MonitorElement::Fill(), forced_status_, forced_update_, DQMStore::get(), i, edm::RunBase::id(), mergeRuns_, prefixME_, run_, runType_, Numbers::sEE(), 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 )  {

    MonitorElement* me;

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

    for (int i = 0; i < 18; i++) {
      me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryContents/EcalEndcap_" + Numbers::sEE(i+1));
      if ( me ) me->Fill(-1.0);
    }

    me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryMap");
    for ( int jx = 1; jx <= 40; jx++ ) {
      for ( int jy = 1; jy <= 20; jy++ ) {
        if ( me ) me->setBinContent( jx, jy, -1.0 );
      }
    }

  }

}
void EcalEndcapMonitorClient::endRunDb ( void  )

EndRunDB.

Definition at line 1355 of file EcalEndcapMonitorClient.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("EE");
        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* EcalEndcapMonitorClient::getRunType ( void  ) [inline]

Definition at line 93 of file EcalEndcapMonitorClient.h.

References runType_, and runTypes_.

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

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

Reset.

Definition at line 970 of file EcalEndcapMonitorClient.cc.

Referenced by analyze().

                                        {

}
void EcalEndcapMonitorClient::setup ( void  )

Setup.

Definition at line 974 of file EcalEndcapMonitorClient.cc.

Referenced by beginRun().

                                        {

}
void EcalEndcapMonitorClient::softReset ( bool  flag)

SoftReset.

Definition at line 1763 of file EcalEndcapMonitorClient.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(), "EE", 2)
         && strncmp((*meitr)->getName().c_str(), "EETrend", 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 EcalEndcapMonitorClient::writeDb ( void  )

WriteDB.

Definition at line 1143 of file EcalEndcapMonitorClient.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::LED_GAP, EcalDCCHeaderBlock::LED_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<EEClient*,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(), "Led") == 0 && runType_ != EcalDCCHeaderBlock::LED_STD && runType_ != EcalDCCHeaderBlock::LED_GAP && h_->GetBinContent(2+EcalDCCHeaderBlock::LED_STD) == 0 && h_->GetBinContent(2+EcalDCCHeaderBlock::LED_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("EE");
      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 EcalEndcapMonitorXdaqClient [friend]

Definition at line 38 of file EcalEndcapMonitorClient.h.


Member Data Documentation

Definition at line 165 of file EcalEndcapMonitorClient.h.

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

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

Definition at line 149 of file EcalEndcapMonitorClient.h.

Referenced by EcalEndcapMonitorClient(), and writeDb().

Definition at line 100 of file EcalEndcapMonitorClient.h.

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

Definition at line 133 of file EcalEndcapMonitorClient.h.

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

std::string EcalEndcapMonitorClient::dbHostName_ [private]

Definition at line 115 of file EcalEndcapMonitorClient.h.

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

Definition at line 116 of file EcalEndcapMonitorClient.h.

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

std::string EcalEndcapMonitorClient::dbName_ [private]

Definition at line 114 of file EcalEndcapMonitorClient.h.

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

std::string EcalEndcapMonitorClient::dbPassword_ [private]

Definition at line 118 of file EcalEndcapMonitorClient.h.

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

std::string EcalEndcapMonitorClient::dbTagName_ [private]

Definition at line 120 of file EcalEndcapMonitorClient.h.

Referenced by EcalEndcapMonitorClient(), and writeDb().

Definition at line 139 of file EcalEndcapMonitorClient.h.

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

std::string EcalEndcapMonitorClient::dbUserName_ [private]

Definition at line 117 of file EcalEndcapMonitorClient.h.

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

Definition at line 153 of file EcalEndcapMonitorClient.h.

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

Definition at line 107 of file EcalEndcapMonitorClient.h.

Referenced by cleanup(), and EcalEndcapMonitorClient().

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

Definition at line 143 of file EcalEndcapMonitorClient.h.

Referenced by EcalEndcapMonitorClient().

Definition at line 166 of file EcalEndcapMonitorClient.h.

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

Definition at line 163 of file EcalEndcapMonitorClient.h.

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

Definition at line 158 of file EcalEndcapMonitorClient.h.

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

Definition at line 168 of file EcalEndcapMonitorClient.h.

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

Definition at line 170 of file EcalEndcapMonitorClient.h.

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

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

Definition at line 111 of file EcalEndcapMonitorClient.h.

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

Definition at line 98 of file EcalEndcapMonitorClient.h.

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

Definition at line 172 of file EcalEndcapMonitorClient.h.

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

Definition at line 136 of file EcalEndcapMonitorClient.h.

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

Definition at line 135 of file EcalEndcapMonitorClient.h.

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

std::string EcalEndcapMonitorClient::location_ [private]

Definition at line 155 of file EcalEndcapMonitorClient.h.

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

Definition at line 124 of file EcalEndcapMonitorClient.h.

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

std::string EcalEndcapMonitorClient::prefixME_ [private]

Definition at line 105 of file EcalEndcapMonitorClient.h.

Referenced by analyze(), and EcalEndcapMonitorClient().

Definition at line 112 of file EcalEndcapMonitorClient.h.

std::string EcalEndcapMonitorClient::resetFile_ [private]

Definition at line 122 of file EcalEndcapMonitorClient.h.

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

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

Definition at line 160 of file EcalEndcapMonitorClient.h.

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

Definition at line 131 of file EcalEndcapMonitorClient.h.

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

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

Definition at line 141 of file EcalEndcapMonitorClient.h.

Referenced by EcalEndcapMonitorClient().

Definition at line 138 of file EcalEndcapMonitorClient.h.

Referenced by EcalEndcapMonitorClient(), and endLuminosityBlock().