CMS 3D CMS Logo

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

TKStatus Class Reference

#include <TKStatus.h>

Inheritance diagram for TKStatus:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Protected Member Functions

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

Private Member Functions

void dumpTkDcsStatus (std::string &)

Private Attributes

int beginLumi_
bool checkStatus_
int countEvt_
int countLumi_
bool dcsTk [6]
std::string dcsTkFileName_
bool debug_
int endLumi_
std::ofstream fasciiDcsTkFile
edm::TimeValue_t ftimestamp
int lastlumi_
edm::ParameterSet parameters_
std::time_t refTime
int runnum
std::time_t tmpTime

Detailed Description

*

Date:
2010/06/03 21:03:51
Revision:
1.2
Author:
Geng-yuan Jeng/UC Riverside Francisco Yumiceva/FNAL

Definition at line 26 of file TKStatus.h.


Constructor & Destructor Documentation

TKStatus::TKStatus ( const edm::ParameterSet ps)

Definition at line 11 of file TKStatus.cc.

References countLumi_, dcsTk, dcsTkFileName_, edm::ParameterSet::getParameter(), i, lastlumi_, parameters_, and runnum.

                                           : 
  checkStatus_(true) {
  parameters_     = ps;
  dcsTkFileName_  = parameters_.getParameter<ParameterSet>("BeamFitter").getUntrackedParameter<std::string>("DIPFileName");
  for (int i=0;i<6;i++) dcsTk[i]=true;
  countLumi_ = lastlumi_ = 0;
  runnum = -1;
}
TKStatus::~TKStatus ( )

Definition at line 20 of file TKStatus.cc.

                    {

}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 43 of file TKStatus.cc.

References DcsStatus::BPIX, checkStatus_, dcsTk, dcsTkFileName_, dumpTkDcsStatus(), DcsStatus::FPIX, edm::Event::getByLabel(), i, DcsStatus::TECm, DcsStatus::TECp, DcsStatus::TIBTID, and DcsStatus::TOB.

                                                  {
  if (checkStatus_) { // check every LS
    // Checking TK status
    Handle<DcsStatusCollection> dcsStatus;
    iEvent.getByLabel("scalersRawToDigi", dcsStatus);
    for (int i=0;i<6;i++) dcsTk[i]=true;
    for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin(); 
         dcsStatusItr != dcsStatus->end(); ++dcsStatusItr) {
      if (!dcsStatusItr->ready(DcsStatus::BPIX))   dcsTk[0]=false;
      if (!dcsStatusItr->ready(DcsStatus::FPIX))   dcsTk[1]=false;
      if (!dcsStatusItr->ready(DcsStatus::TIBTID)) dcsTk[2]=false;
      if (!dcsStatusItr->ready(DcsStatus::TOB))    dcsTk[3]=false;
      if (!dcsStatusItr->ready(DcsStatus::TECp))   dcsTk[4]=false;
      if (!dcsStatusItr->ready(DcsStatus::TECm))   dcsTk[5]=false;
    }
    dumpTkDcsStatus(dcsTkFileName_);
    checkStatus_ = false;
  }
}
void TKStatus::beginJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 25 of file TKStatus.cc.

                        {
}
void TKStatus::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 34 of file TKStatus.cc.

References checkStatus_, lastlumi_, and edm::LuminosityBlockBase::luminosityBlock().

                                                               {
  int nthlumi = lumiSeg.luminosityBlock();
  if (nthlumi <= lastlumi_) return;
  checkStatus_ = true;
  lastlumi_ = nthlumi;
}
void TKStatus::beginRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 29 of file TKStatus.cc.

References edm::RunBase::run(), and runnum.

                                                                  {
  runnum = r.run();
}
void TKStatus::dumpTkDcsStatus ( std::string &  fileName) [private]

Definition at line 84 of file TKStatus.cc.

References dcsTk, convertXMLtoSQLite_cfg::fileName, i, getHLTprescales::index, cmsMakeMELists::outFile, runnum, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze().

                                                  {
  std::ofstream outFile;
  std::string tmpname = fileName;
  char index[10];
  sprintf(index,"%s","_TkStatus");
  tmpname.insert(fileName.length()-4,index);

  outFile.open(tmpname.c_str());
  outFile << "BPIX " << (dcsTk[0]?"On":"Off") << std::endl;
  outFile << "FPIX " << (dcsTk[1]?"On":"Off") << std::endl;
  outFile << "TIBTID " << (dcsTk[2]?"On":"Off") << std::endl;
  outFile << "TOB " << (dcsTk[3]?"On":"Off") << std::endl;
  outFile << "TECp " << (dcsTk[4]?"On":"Off") << std::endl;
  outFile << "TECm " << (dcsTk[5]?"On":"Off") << std::endl;
  bool AllTkOn = true;
  for (int i=0; i<5; i++) {
    if (!dcsTk[i]) {
      AllTkOn = false;
      break;
    }
  }
  outFile << "WholeTrackerOn " << (AllTkOn?"Yes":"No") << std::endl;
  outFile << "Runnumber " << runnum << std::endl;
 
  outFile.close();
}
void TKStatus::endJob ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
) [protected]

Definition at line 78 of file TKStatus.cc.

                                               {

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

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file TKStatus.cc.

References edm::LuminosityBlockBase::id(), lastlumi_, and edm::LuminosityBlockID::luminosityBlock().

                                                            {
  int nlumi = lumiSeg.id().luminosityBlock();
  if (nlumi <= lastlumi_ ) return;

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

Reimplemented from edm::EDAnalyzer.

Definition at line 73 of file TKStatus.cc.

                                                            {

}

Member Data Documentation

int TKStatus::beginLumi_ [private]

Definition at line 63 of file TKStatus.h.

bool TKStatus::checkStatus_ [private]

Definition at line 60 of file TKStatus.h.

Referenced by analyze(), and beginLuminosityBlock().

int TKStatus::countEvt_ [private]

Definition at line 61 of file TKStatus.h.

int TKStatus::countLumi_ [private]

Definition at line 62 of file TKStatus.h.

Referenced by TKStatus().

bool TKStatus::dcsTk[6] [private]

Definition at line 66 of file TKStatus.h.

Referenced by analyze(), dumpTkDcsStatus(), and TKStatus().

std::string TKStatus::dcsTkFileName_ [private]

Definition at line 56 of file TKStatus.h.

Referenced by analyze(), and TKStatus().

bool TKStatus::debug_ [private]

Definition at line 59 of file TKStatus.h.

int TKStatus::endLumi_ [private]

Definition at line 64 of file TKStatus.h.

std::ofstream TKStatus::fasciiDcsTkFile [private]

Definition at line 57 of file TKStatus.h.

Definition at line 72 of file TKStatus.h.

int TKStatus::lastlumi_ [private]

Definition at line 65 of file TKStatus.h.

Referenced by beginLuminosityBlock(), endLuminosityBlock(), and TKStatus().

Definition at line 55 of file TKStatus.h.

Referenced by TKStatus().

std::time_t TKStatus::refTime [private]

Definition at line 71 of file TKStatus.h.

int TKStatus::runnum [private]

Definition at line 73 of file TKStatus.h.

Referenced by beginRun(), dumpTkDcsStatus(), and TKStatus().

std::time_t TKStatus::tmpTime [private]

Definition at line 70 of file TKStatus.h.