CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
TKStatus Class Reference

#include <TKStatus.h>

Inheritance diagram for TKStatus:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 TKStatus (const edm::ParameterSet &)
 
 ~TKStatus () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void beginJob () override
 
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
 
void beginRun (const edm::Run &r, const edm::EventSetup &c) override
 
void endJob (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
 
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
 
void endRun (const edm::Run &r, const edm::EventSetup &c) override
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

void dumpTkDcsStatus (std::string &)
 

Private Attributes

int beginLumi_
 
bool checkStatus_
 
int countEvt_
 
int countLumi_
 
edm::EDGetTokenT< DcsStatusCollectiondcsStatus_
 
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
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 25 of file TKStatus.h.

Constructor & Destructor Documentation

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

Definition at line 10 of file TKStatus.cc.

References countLumi_, dcsStatus_, dcsTk, dcsTkFileName_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, lastlumi_, parameters_, runnum, and AlCaHLTBitMon_QueryRunRegistry::string.

10  :
11  checkStatus_(true) {
12  parameters_ = ps;
13  dcsTkFileName_ = parameters_.getParameter<ParameterSet>("BeamFitter").getUntrackedParameter<std::string>("DIPFileName");
14  dcsStatus_ = consumes<DcsStatusCollection>(
15  parameters_.getUntrackedParameter<std::string>("DCSStatus", "scalersRawToDigi"));
16  for (int i=0;i<6;i++) dcsTk[i]=true;
17  countLumi_ = lastlumi_ = 0;
18  runnum = -1;
19 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet parameters_
Definition: TKStatus.h:54
bool dcsTk[6]
Definition: TKStatus.h:66
int countLumi_
Definition: TKStatus.h:62
bool checkStatus_
Definition: TKStatus.h:60
edm::EDGetTokenT< DcsStatusCollection > dcsStatus_
Definition: TKStatus.h:57
std::string dcsTkFileName_
Definition: TKStatus.h:55
int runnum
Definition: TKStatus.h:73
int lastlumi_
Definition: TKStatus.h:65
TKStatus::~TKStatus ( )
override

Definition at line 21 of file TKStatus.cc.

21  {
22 
23 }

Member Function Documentation

void TKStatus::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotected

Definition at line 44 of file TKStatus.cc.

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

45  {
46  if (checkStatus_) { // check every LS
47  // Checking TK status
49  iEvent.getByToken(dcsStatus_, dcsStatus);
50  for (int i=0;i<6;i++) dcsTk[i]=true;
51  for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin();
52  dcsStatusItr != dcsStatus->end(); ++dcsStatusItr) {
53  if (!dcsStatusItr->ready(DcsStatus::BPIX)) dcsTk[0]=false;
54  if (!dcsStatusItr->ready(DcsStatus::FPIX)) dcsTk[1]=false;
55  if (!dcsStatusItr->ready(DcsStatus::TIBTID)) dcsTk[2]=false;
56  if (!dcsStatusItr->ready(DcsStatus::TOB)) dcsTk[3]=false;
57  if (!dcsStatusItr->ready(DcsStatus::TECp)) dcsTk[4]=false;
58  if (!dcsStatusItr->ready(DcsStatus::TECm)) dcsTk[5]=false;
59  }
61  checkStatus_ = false;
62  }
63 }
void dumpTkDcsStatus(std::string &)
Definition: TKStatus.cc:85
bool dcsTk[6]
Definition: TKStatus.h:66
int iEvent
Definition: GenABIO.cc:230
bool checkStatus_
Definition: TKStatus.h:60
edm::EDGetTokenT< DcsStatusCollection > dcsStatus_
Definition: TKStatus.h:57
std::string dcsTkFileName_
Definition: TKStatus.h:55
void TKStatus::beginJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 26 of file TKStatus.cc.

26  {
27 }
void TKStatus::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
overrideprotected

Definition at line 35 of file TKStatus.cc.

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

36  {
37  int nthlumi = lumiSeg.luminosityBlock();
38  if (nthlumi <= lastlumi_) return;
39  checkStatus_ = true;
40  lastlumi_ = nthlumi;
41 }
LuminosityBlockNumber_t luminosityBlock() const
bool checkStatus_
Definition: TKStatus.h:60
int lastlumi_
Definition: TKStatus.h:65
void TKStatus::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
overrideprotected

Definition at line 30 of file TKStatus.cc.

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

30  {
31  runnum = r.run();
32 }
RunNumber_t run() const
Definition: RunBase.h:40
int runnum
Definition: TKStatus.h:73
void TKStatus::dumpTkDcsStatus ( std::string &  fileName)
private

Definition at line 85 of file TKStatus.cc.

References dcsTk, DEFINE_FWK_MODULE, MillePedeFileConverter_cfg::fileName, mps_fire::i, diffTreeTool::index, GetRecoTauVFromDQM_MC_cff::outFile, runnum, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze().

85  {
86  std::ofstream outFile;
87  std::string tmpname = fileName;
88  char index[10];
89  sprintf(index,"%s","_TkStatus");
90  tmpname.insert(fileName.length()-4,index);
91 
92  outFile.open(tmpname.c_str());
93  outFile << "BPIX " << (dcsTk[0]?"On":"Off") << std::endl;
94  outFile << "FPIX " << (dcsTk[1]?"On":"Off") << std::endl;
95  outFile << "TIBTID " << (dcsTk[2]?"On":"Off") << std::endl;
96  outFile << "TOB " << (dcsTk[3]?"On":"Off") << std::endl;
97  outFile << "TECp " << (dcsTk[4]?"On":"Off") << std::endl;
98  outFile << "TECm " << (dcsTk[5]?"On":"Off") << std::endl;
99  bool AllTkOn = true;
100  for (int i=0; i<5; i++) {
101  if (!dcsTk[i]) {
102  AllTkOn = false;
103  break;
104  }
105  }
106  outFile << "WholeTrackerOn " << (AllTkOn?"Yes":"No") << std::endl;
107  outFile << "Runnumber " << runnum << std::endl;
108 
109  outFile.close();
110 }
bool dcsTk[6]
Definition: TKStatus.h:66
int runnum
Definition: TKStatus.h:73
void TKStatus::endJob ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
)
protected

Definition at line 79 of file TKStatus.cc.

80  {
81 
82 }
void TKStatus::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
)
overrideprotected

Definition at line 66 of file TKStatus.cc.

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

67  {
68  int nlumi = lumiSeg.id().luminosityBlock();
69  if (nlumi <= lastlumi_ ) return;
70 
71 }
LuminosityBlockID id() const
LuminosityBlockNumber_t luminosityBlock() const
int lastlumi_
Definition: TKStatus.h:65
void TKStatus::endRun ( const edm::Run r,
const edm::EventSetup c 
)
overrideprotected

Definition at line 74 of file TKStatus.cc.

74  {
75 
76 }

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().

edm::EDGetTokenT<DcsStatusCollection> TKStatus::dcsStatus_
private

Definition at line 57 of file TKStatus.h.

Referenced by analyze(), and 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 55 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 56 of file TKStatus.h.

edm::TimeValue_t TKStatus::ftimestamp
private

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().

edm::ParameterSet TKStatus::parameters_
private
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.