CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TKStatus.cc
Go to the documentation of this file.
7 #include <iostream>
8 
9 using namespace edm;
10 
12  checkStatus_(true) {
13  parameters_ = ps;
14  dcsTkFileName_ = parameters_.getParameter<ParameterSet>("BeamFitter").getUntrackedParameter<std::string>("DIPFileName");
15  for (int i=0;i<6;i++) dcsTk[i]=true;
16  countLumi_ = lastlumi_ = 0;
17  runnum = -1;
18 }
19 
21 
22 }
23 
24 //--------------------------------------------------------
26 }
27 
28 //--------------------------------------------------------
29 void TKStatus::beginRun(const edm::Run& r, const EventSetup& context) {
30  runnum = r.run();
31 }
32 
33 //--------------------------------------------------------
35  const EventSetup& context) {
36  int nthlumi = lumiSeg.luminosityBlock();
37  if (nthlumi <= lastlumi_) return;
38  checkStatus_ = true;
39  lastlumi_ = nthlumi;
40 }
41 
42 // ----------------------------------------------------------
44  const EventSetup& iSetup ) {
45  if (checkStatus_) { // check every LS
46  // Checking TK status
48  iEvent.getByLabel("scalersRawToDigi", dcsStatus);
49  for (int i=0;i<6;i++) dcsTk[i]=true;
50  for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin();
51  dcsStatusItr != dcsStatus->end(); ++dcsStatusItr) {
52  if (!dcsStatusItr->ready(DcsStatus::BPIX)) dcsTk[0]=false;
53  if (!dcsStatusItr->ready(DcsStatus::FPIX)) dcsTk[1]=false;
54  if (!dcsStatusItr->ready(DcsStatus::TIBTID)) dcsTk[2]=false;
55  if (!dcsStatusItr->ready(DcsStatus::TOB)) dcsTk[3]=false;
56  if (!dcsStatusItr->ready(DcsStatus::TECp)) dcsTk[4]=false;
57  if (!dcsStatusItr->ready(DcsStatus::TECm)) dcsTk[5]=false;
58  }
60  checkStatus_ = false;
61  }
62 }
63 
64 //--------------------------------------------------------
66  const EventSetup& iSetup) {
67  int nlumi = lumiSeg.id().luminosityBlock();
68  if (nlumi <= lastlumi_ ) return;
69 
70 }
71 
72 //--------------------------------------------------------
73 void TKStatus::endRun(const Run& r, const EventSetup& context){
74 
75 }
76 
77 //--------------------------------------------------------
78 void TKStatus::endJob(const LuminosityBlock& lumiSeg,
79  const EventSetup& iSetup){
80 
81 }
82 
83 //--------------------------------------------------------
84 void TKStatus::dumpTkDcsStatus(std::string & fileName){
85  std::ofstream outFile;
86  std::string tmpname = fileName;
87  char index[10];
88  sprintf(index,"%s","_TkStatus");
89  tmpname.insert(fileName.length()-4,index);
90 
91  outFile.open(tmpname.c_str());
92  outFile << "BPIX " << (dcsTk[0]?"On":"Off") << std::endl;
93  outFile << "FPIX " << (dcsTk[1]?"On":"Off") << std::endl;
94  outFile << "TIBTID " << (dcsTk[2]?"On":"Off") << std::endl;
95  outFile << "TOB " << (dcsTk[3]?"On":"Off") << std::endl;
96  outFile << "TECp " << (dcsTk[4]?"On":"Off") << std::endl;
97  outFile << "TECm " << (dcsTk[5]?"On":"Off") << std::endl;
98  bool AllTkOn = true;
99  for (int i=0; i<5; i++) {
100  if (!dcsTk[i]) {
101  AllTkOn = false;
102  break;
103  }
104  }
105  outFile << "WholeTrackerOn " << (AllTkOn?"Yes":"No") << std::endl;
106  outFile << "Runnumber " << runnum << std::endl;
107 
108  outFile.close();
109 }
110 
LuminosityBlockID id() const
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
void dumpTkDcsStatus(std::string &)
Definition: TKStatus.cc:84
edm::ParameterSet parameters_
Definition: TKStatus.h:55
void beginJob()
Definition: TKStatus.cc:25
RunNumber_t run() const
Definition: RunBase.h:42
~TKStatus()
Definition: TKStatus.cc:20
void analyze(const edm::Event &e, const edm::EventSetup &c)
Definition: TKStatus.cc:43
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
bool dcsTk[6]
Definition: TKStatus.h:66
void endRun(const edm::Run &r, const edm::EventSetup &c)
Definition: TKStatus.cc:73
LuminosityBlockNumber_t luminosityBlock() const
int countLumi_
Definition: TKStatus.h:62
int iEvent
Definition: GenABIO.cc:243
void beginRun(const edm::Run &r, const edm::EventSetup &c)
Definition: TKStatus.cc:29
bool checkStatus_
Definition: TKStatus.h:60
std::string dcsTkFileName_
Definition: TKStatus.h:56
virtual void endJob()
Definition: EDAnalyzer.h:59
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
Definition: TKStatus.cc:34
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
int runnum
Definition: TKStatus.h:73
LuminosityBlockNumber_t luminosityBlock() const
TKStatus(const edm::ParameterSet &)
Definition: TKStatus.cc:11
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
Definition: TKStatus.cc:65
int lastlumi_
Definition: TKStatus.h:65
Definition: Run.h:33