CMS 3D CMS Logo

Functions
check_runcomplete.cc File Reference
#include <Riostream.h>
#include <TDirectory.h>
#include <TFile.h>
#include <TROOT.h>
#include <TStyle.h>
#include <TKey.h>
#include <TH1.h>
#include <TH2.h>
#include <TH2D.h>
#include <TCanvas.h>
#include <TGraph.h>
#include <TPaveStats.h>
#include <TText.h>
#include <TLegend.h>
#include <string>
#include <utility>
#include <vector>
#include <sstream>
#include <algorithm>
#include <TString.h>
#include <TColor.h>
#include <dirent.h>
#include "check_runcomplete.h"

Go to the source code of this file.

Functions

int check_runcomplete (std::string filename)
 
int main (int argc, char *argv[])
 
int read_runflag (std::string filename)
 

Function Documentation

int check_runcomplete ( std::string  filename)

Definition at line 47 of file check_runcomplete.cc.

References read_runflag().

Referenced by main().

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

Definition at line 28 of file check_runcomplete.cc.

References check_runcomplete(), and gather_cfg::cout.

28  {
29 
30  if(argc==2) {
31  char* cfile = argv[1];
32 
33  std::cout << "ready to check file " << cfile << std::endl;
34 
35  int returncode = check_runcomplete(cfile);
36  if(returncode==0) std::cout << "DQM file is ok" << std::endl;
37 
38  return returncode;
39 
40  }
41  else {std::cout << "Too few arguments: " << argc << std::endl; return -1; }
42 
43  return -9;
44 
45 }
int check_runcomplete(std::string filename)
int read_runflag ( std::string  filename)

Definition at line 77 of file check_runcomplete.cc.

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

Referenced by check_runcomplete().

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