CMS 3D CMS Logo

TKStatus.cc
Go to the documentation of this file.
6 #include <iostream>
7 
8 using namespace edm;
9 
11  dcsTkFileName_ = ps.getParameter<ParameterSet>("BeamFitter").getUntrackedParameter<std::string>("DIPFileName");
12  {
13  std::string tmpname = dcsTkFileName_;
14  tmpname.insert(dcsTkFileName_.length() - 4, "_TkStatus");
15  dcsTkFileName_ = std::move(tmpname);
16  }
17  dcsStatus_ = consumes<DcsStatusCollection>(ps.getUntrackedParameter<std::string>("DCSStatus", "scalersRawToDigi"));
18 }
19 
20 // ----------------------------------------------------------
21 void TKStatus::analyze(const Event& iEvent, const EventSetup& iSetup) {
22  int nthlumi = iEvent.luminosityBlock();
23  if (nthlumi > lastlumi_) { // check every LS
24  lastlumi_ = nthlumi;
25  // Checking TK status
27  iEvent.getByToken(dcsStatus_, dcsStatus);
28 
29  std::array<bool, 6> dcsTk;
30  for (auto& e : dcsTk) {
31  e = true;
32  }
33 
34  for (auto const& status : *dcsStatus) {
35  if (!status.ready(DcsStatus::BPIX))
36  dcsTk[0] = false;
37  if (!status.ready(DcsStatus::FPIX))
38  dcsTk[1] = false;
39  if (!status.ready(DcsStatus::TIBTID))
40  dcsTk[2] = false;
41  if (!status.ready(DcsStatus::TOB))
42  dcsTk[3] = false;
43  if (!status.ready(DcsStatus::TECp))
44  dcsTk[4] = false;
45  if (!status.ready(DcsStatus::TECm))
46  dcsTk[5] = false;
47  }
48  dumpTkDcsStatus(dcsTkFileName_, iEvent.run(), dcsTk);
49  }
50 }
51 
52 //--------------------------------------------------------
53 void TKStatus::dumpTkDcsStatus(std::string const& fileName, edm::RunNumber_t runnum, std::array<bool, 6> const& dcsTk) {
54  std::ofstream outFile;
55 
56  outFile.open(fileName.c_str());
57  outFile << "BPIX " << (dcsTk[0] ? "On" : "Off") << std::endl;
58  outFile << "FPIX " << (dcsTk[1] ? "On" : "Off") << std::endl;
59  outFile << "TIBTID " << (dcsTk[2] ? "On" : "Off") << std::endl;
60  outFile << "TOB " << (dcsTk[3] ? "On" : "Off") << std::endl;
61  outFile << "TECp " << (dcsTk[4] ? "On" : "Off") << std::endl;
62  outFile << "TECm " << (dcsTk[5] ? "On" : "Off") << std::endl;
63  bool AllTkOn = true;
64  for (auto status : dcsTk) {
65  if (!status) {
66  AllTkOn = false;
67  break;
68  }
69  }
70  outFile << "WholeTrackerOn " << (AllTkOn ? "Yes" : "No") << std::endl;
71  outFile << "Runnumber " << runnum << std::endl;
72 
73  outFile.close();
74 }
75 
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
DcsStatus::BPIX
Definition: DcsStatus.h:55
mps_update.status
status
Definition: mps_update.py:69
LuminosityBlock.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
TKStatus::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: TKStatus.cc:21
edm::Handle
Definition: AssociativeIterator.h:50
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
Run.h
L1TdeCSCTF_cfi.outFile
outFile
Definition: L1TdeCSCTF_cfi.py:5
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DcsStatus::TECm
Definition: DcsStatus.h:54
DcsStatus::TOB
Definition: DcsStatus.h:52
DcsStatus::TIBTID
Definition: DcsStatus.h:51
edm::ParameterSet
Definition: ParameterSet.h:47
DcsStatus::TECp
Definition: DcsStatus.h:53
iEvent
int iEvent
Definition: GenABIO.cc:224
TKStatus::dumpTkDcsStatus
void dumpTkDcsStatus(std::string const &, edm::RunNumber_t, std::array< bool, 6 > const &)
Definition: TKStatus.cc:53
TKStatus
Definition: TKStatus.h:26
TKStatus::TKStatus
TKStatus(const edm::ParameterSet &)
Definition: TKStatus.cc:10
edm::EventSetup
Definition: EventSetup.h:58
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DcsStatus::FPIX
Definition: DcsStatus.h:56
edm::Event
Definition: Event.h:73
TKStatus.h
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37