Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:10:28

0001 int filechk(string fname)
0002 {
0003   //TFile f("DQM_V0001_SiStrip_R000062940.root");
0004   TFile f(fname.c_str());
0005 
0006   if (f.IsZombie()){
0007     //cout << "File corrupted" << endl;
0008   return -1;
0009   }
0010   else
0011   {
0012     if ( fname.find("_SiStrip_") != string::npos ){
0013       TString rnStr = fname.substr(fname.find("_R") + 2, 9);
0014       TString runDirStr("Run ");
0015       runDirStr += rnStr.Atoi();
0016       TDirectoryFile* runDir = (TDirectoryFile*)f.FindObjectAny(runDirStr);
0017       if ( runDir == 0 )
0018         return 0; 
0019       
0020       TDirectoryFile* tracking = (TDirectoryFile*)runDir->FindObjectAny("Tracking");
0021       if ( tracking == 0 )
0022         return 0;
0023       
0024       TDirectoryFile* sistrip = (TDirectoryFile*)runDir->FindObjectAny("SiStrip");
0025       if ( sistrip == 0 )
0026         return 0;  
0027        
0028       TDirectoryFile* hist = (TDirectoryFile*)tracking->FindObjectAny("reportSummaryMap");
0029       if ( hist == 0 )
0030         return 0;
0031        
0032       hist = (TDirectoryFile*)sistrip->FindObjectAny("reportSummaryMap");
0033       if ( hist == 0 )
0034         return 0; 
0035       
0036       return 1;
0037     }
0038     
0039     //TH2F* hist;
0040     //hist = (TH2F*)f.FindObjectAny("reportSummaryMap");
0041     TDirectoryFile* hist;   
0042     //hist = (TDirectoryFile*)f.FindObjectAny("reportSummaryContents");
0043     hist = (TDirectoryFile*)f.FindObjectAny("reportSummaryMap");
0044     if (0 == hist) 
0045     {
0046       TDirectoryFile* hist2;
0047       hist2 = (TDirectoryFile*)f.FindObjectAny("EventInfo");
0048       if (0 != hist2)
0049         return 1;
0050 
0051       //cout << "File is incomplete" << endl;
0052       return 0;
0053     }
0054     else
0055     {
0056       //cout << "File is OK" << endl;
0057       return 1;
0058     }
0059   }
0060 }