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>(
18  ps.getUntrackedParameter<std::string>("DCSStatus", "scalersRawToDigi"));
19 }
20 
21 // ----------------------------------------------------------
23  const EventSetup& iSetup ) {
24  int nthlumi = iEvent.luminosityBlock();
25  if (nthlumi > lastlumi_) { // check every LS
26  lastlumi_ = nthlumi;
27  // Checking TK status
29  iEvent.getByToken(dcsStatus_, dcsStatus);
30 
31  std::array<bool,6> dcsTk;
32  for (auto& e: dcsTk) {e=true;}
33 
34  for (auto const& status: *dcsStatus) {
35  if (!status.ready(DcsStatus::BPIX)) dcsTk[0]=false;
36  if (!status.ready(DcsStatus::FPIX)) dcsTk[1]=false;
37  if (!status.ready(DcsStatus::TIBTID)) dcsTk[2]=false;
38  if (!status.ready(DcsStatus::TOB)) dcsTk[3]=false;
39  if (!status.ready(DcsStatus::TECp)) dcsTk[4]=false;
40  if (!status.ready(DcsStatus::TECm)) dcsTk[5]=false;
41  }
42  dumpTkDcsStatus(dcsTkFileName_,iEvent.run(), dcsTk );
43  }
44 }
45 
46 //--------------------------------------------------------
47 void TKStatus::dumpTkDcsStatus(std::string const & fileName, edm::RunNumber_t runnum, std::array<bool,6> const& dcsTk){
48  std::ofstream outFile;
49 
50  outFile.open(fileName.c_str());
51  outFile << "BPIX " << (dcsTk[0]?"On":"Off") << std::endl;
52  outFile << "FPIX " << (dcsTk[1]?"On":"Off") << std::endl;
53  outFile << "TIBTID " << (dcsTk[2]?"On":"Off") << std::endl;
54  outFile << "TOB " << (dcsTk[3]?"On":"Off") << std::endl;
55  outFile << "TECp " << (dcsTk[4]?"On":"Off") << std::endl;
56  outFile << "TECm " << (dcsTk[5]?"On":"Off") << std::endl;
57  bool AllTkOn = true;
58  for (auto status: dcsTk) {
59  if (!status) {
60  AllTkOn = false;
61  break;
62  }
63  }
64  outFile << "WholeTrackerOn " << (AllTkOn?"Yes":"No") << std::endl;
65  outFile << "Runnumber " << runnum << std::endl;
66 
67  outFile.close();
68 }
69 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:61
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
RunNumber_t run() const
Definition: Event.h:101
TKStatus(const edm::ParameterSet &)
Definition: TKStatus.cc:10
HLT enums.
unsigned int RunNumber_t
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: TKStatus.cc:22
void dumpTkDcsStatus(std::string const &, edm::RunNumber_t, std::array< bool, 6 > const &)
Definition: TKStatus.cc:47
def move(src, dest)
Definition: eostools.py:511