CMS 3D CMS Logo

Functions

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/DQM/SiStripMonitorClient/bin/check_runcomplete.h File Reference

#include <string>

Go to the source code of this file.

Functions

void check_runcomplete (int run, std::string repro_type)
int get_filename (int, std::string, std::string &)
int read_runflag (int, std::string)

Function Documentation

void check_runcomplete ( int  run,
std::string  repro_type 
)

Definition at line 47 of file check_runcomplete.cc.

References read_runflag().

Referenced by main().

{
  int runflag = read_runflag ( run , repro_type );
  if ( runflag == 0 )
    {
      printf("************************************\n");
      printf("**\n");
      printf("** W A R N I N G: the DQM file with run %i (%s) is not fully archived yet on /afs,\n" , run , repro_type.c_str() );
      printf("** it is strongly recommended that you analyze it later.\n" );
      printf("**\n");
      printf("************************************\n");
    }
}
int get_filename ( int  ,
std::string  ,
std::string &   
)

Definition at line 100 of file check_runcomplete.cc.

References linker::DIR, NULL, and DTTTrigCorrFirst::run.

Referenced by read_badmodlist(), read_runflag(), and search_closest_run().

{
  std::stringstream runstr;
  runstr << run;
  
  std::stringstream rundirprefix;
  rundirprefix << "000" << run / 100 << "xx/";

  std::stringstream thisdir;
  thisdir << "/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/data/OfflineData/Run2011/" << repro_type.c_str() << "/" << rundirprefix.str();
  
  std::string thisdir2 = thisdir.str();
  DIR *dp;
  
  if ( ( dp = opendir( thisdir2.c_str() ) ) == NULL )
    {
      //cout << "dir " << thisdir2.c_str() << " not found" << endl;
      return -1;
    }

  struct dirent *dirp;

  std::string dqmfile;

  while ( ( dirp = readdir ( dp ) ) != NULL )
    {
      std::string dirfile = std::string ( dirp->d_name );
      if ( 
          dirfile.find ( "__DQM" ) != std::string::npos &&
          dirfile.find ( runstr.str() ) != std::string::npos
          )
        {
          dqmfile = dirfile;
          break;
        }
    }

  closedir( dp );

  if ( dqmfile.size() < 10 )
    {
      //cout << "file " << dqmfile << " not found" << endl;
      return -1;
    }
  
  filename = thisdir.str() + dqmfile;
  
  return 0;
}
int read_runflag ( int  ,
std::string   
)

Definition at line 61 of file check_runcomplete.cc.

References lut2db_cfg::filename, get_filename(), and combine::key.

Referenced by check_runcomplete().

{
  std::string filename;
  int flag = get_filename ( run , repro_type , filename );
  
  if ( flag < 0 )
    {
      //cout << "reading problem" << endl;
      return -1; 
    }

  std::string nrun = filename.substr ( filename.find( "_R000" ) + 5 , 6 );

  TFile *dqmfile = TFile::Open ( filename.c_str() , "READ" );
  std::string infodir = "DQMData/Run " + nrun + "/Info/Run summary/ProvInfo";
  gDirectory->cd(infodir.c_str());

  TIter next ( gDirectory->GetListOfKeys() );
  TKey *key;

  int isruncomplete = -1;

  while  ( ( key = dynamic_cast<TKey*> ( next() ) ) ) 
    {
      std::string svar = key->GetName();
      if ( svar.size() == 0 ) continue;
      
      if ( svar.find( "runIsComplete" ) != std::string::npos )
        {
          std::string statusflag = svar.substr ( svar.rfind ( "<" ) -1 , 1 );
          isruncomplete = atoi ( statusflag.c_str() );
        }
    }

  dqmfile->Close();
  return isruncomplete;
}