CMS 3D CMS Logo

TKStatus.cc
Go to the documentation of this file.
6 #include <iostream>
7 
8 using namespace edm;
9 
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 }
20 
22 
23 }
24 
25 //--------------------------------------------------------
27 }
28 
29 //--------------------------------------------------------
30 void TKStatus::beginRun(const edm::Run& r, const EventSetup& context) {
31  runnum = r.run();
32 }
33 
34 //--------------------------------------------------------
36  const EventSetup& context) {
37  int nthlumi = lumiSeg.luminosityBlock();
38  if (nthlumi <= lastlumi_) return;
39  checkStatus_ = true;
40  lastlumi_ = nthlumi;
41 }
42 
43 // ----------------------------------------------------------
45  const EventSetup& iSetup ) {
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 }
64 
65 //--------------------------------------------------------
67  const EventSetup& iSetup) {
68  int nlumi = lumiSeg.id().luminosityBlock();
69  if (nlumi <= lastlumi_ ) return;
70 
71 }
72 
73 //--------------------------------------------------------
74 void TKStatus::endRun(const Run& r, const EventSetup& context){
75 
76 }
77 
78 //--------------------------------------------------------
79 void TKStatus::endJob(const LuminosityBlock& lumiSeg,
80  const EventSetup& iSetup){
81 
82 }
83 
84 //--------------------------------------------------------
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 }
111 
LuminosityBlockID id() const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
Definition: TKStatus.cc:66
void dumpTkDcsStatus(std::string &)
Definition: TKStatus.cc:85
edm::ParameterSet parameters_
Definition: TKStatus.h:54
void beginJob() override
Definition: TKStatus.cc:26
RunNumber_t run() const
Definition: RunBase.h:40
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
Definition: TKStatus.cc:30
bool dcsTk[6]
Definition: TKStatus.h:66
LuminosityBlockNumber_t luminosityBlock() const
int countLumi_
Definition: TKStatus.h:62
void endRun(const edm::Run &r, const edm::EventSetup &c) override
Definition: TKStatus.cc:74
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
virtual void endJob()
Definition: EDAnalyzer.h:83
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
Definition: TKStatus.cc:35
int runnum
Definition: TKStatus.h:73
~TKStatus() override
Definition: TKStatus.cc:21
LuminosityBlockNumber_t luminosityBlock() const
TKStatus(const edm::ParameterSet &)
Definition: TKStatus.cc:10
HLT enums.
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: TKStatus.cc:44
int lastlumi_
Definition: TKStatus.h:65
Definition: Run.h:43