CMS 3D CMS Logo

Functions
check_runcomplete.h File Reference
#include <string>

Go to the source code of this file.

Functions

int check_runcomplete (std::string)
 
int read_runflag (std::string)
 

Function Documentation

int check_runcomplete ( std::string  )

Definition at line 48 of file check_runcomplete.cc.

References read_runflag().

Referenced by main().

48  {
49  int runflag = read_runflag(filename);
50  if (runflag == 1) {
51  printf("************************************\n");
52  printf("**\n");
53  printf("** W A R N I N G: the DQM file %s does not exist", filename.c_str());
54  printf("**\n");
55  printf("************************************\n");
56  } else if (runflag == 2) {
57  printf("************************************\n");
58  printf("**\n");
59  printf("** W A R N I N G: the DQM file %s is incomplete", filename.c_str());
60  printf("**\n");
61  printf("************************************\n");
62  } else if (runflag != 0) {
63  printf("************************************\n");
64  printf("**\n");
65  printf("** W A R N I N G: problems found in the DQM file %s", filename.c_str());
66  printf("**\n");
67  printf("************************************\n");
68  }
69  return runflag;
70 }
int read_runflag(std::string filename)
int read_runflag ( std::string  )

Definition at line 72 of file check_runcomplete.cc.

References fileCollector::dqmfile, crabWrapper::key, GetRecoTauVFromDQM_MC_cff::next, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by check_runcomplete().

72  {
73  std::string nrun = filename.substr(filename.find("_R000") + 5, 6);
74 
75  TFile *dqmfile = TFile::Open(filename.c_str(), "READ");
76 
77  if (dqmfile == nullptr)
78  return 1;
79 
80  std::string infodir = "DQMData/Run " + nrun + "/Info/Run summary/ProvInfo";
81  gDirectory->cd(infodir.c_str());
82 
83  TIter next(gDirectory->GetListOfKeys());
84  TKey *key;
85 
86  int isruncomplete = -1;
87 
88  while ((key = dynamic_cast<TKey *>(next()))) {
89  std::string svar = key->GetName();
90  if (svar.empty())
91  continue;
92 
93  if (svar.find("runIsComplete") != std::string::npos) {
94  std::string statusflag = svar.substr(svar.rfind("<") - 1, 1);
95  isruncomplete = atoi(statusflag.c_str());
96  }
97  }
98 
99  dqmfile->Close();
100 
101  if (isruncomplete == -1)
102  return 3;
103  if (isruncomplete == 0)
104  return 2;
105  if (isruncomplete == 1)
106  return 0;
107 
108  return -8;
109 }