CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/IOPool/Input/src/InputFile.h

Go to the documentation of this file.
00001 #ifndef IOPool_Input_InputFile_h
00002 #define IOPool_Input_InputFile_h
00003 
00004 /*----------------------------------------------------------------------
00005 
00006 Holder for an input TFile.
00007 ----------------------------------------------------------------------*/
00008 #include "FWCore/MessageLogger/interface/JobReport.h"
00009 
00010 #include "TFile.h"
00011 
00012 #include <map>
00013 #include <string>
00014 #include <vector>
00015 
00016 class TObject;
00017 
00018 namespace edm {
00019   class InputFile {
00020   public:  
00021     explicit InputFile(char const* fileName, char const* msg);
00022     ~InputFile();
00023 
00024     InputFile(InputFile const&) = delete; // Disallow copying and moving
00025     InputFile& operator=(InputFile const&) = delete; // Disallow copying and moving
00026 
00027     void Close();
00028     void inputFileOpened(std::string const& logicalFileName,
00029                          std::string const& inputType,
00030                          std::string const& moduleName,
00031                          std::string const& label,
00032                          std::string const& fid,
00033                          std::vector<std::string> const& branchNames);    
00034     void eventReadFromFile(unsigned int run, unsigned int event) const;
00035     void reportInputRunNumber(unsigned int run) const;
00036     void reportInputLumiSection(unsigned int run, unsigned int lumi) const;
00037     static void reportSkippedFile(std::string const& fileName, std::string const& logicalFileName);
00038     static void reportFallbackAttempt(std::string const& pfn, std::string const& logicalFileName, std::string const& errorMessage);
00039     // reportReadBranches is a per job report, rather than per file report.
00040     // Nevertheless, it is defined here for convenience.
00041     static void reportReadBranches();
00042     static void reportReadBranch(std::string const& branchname);
00043 
00044     TObject* Get(char const* name) {return file_->Get(name);}
00045     TFileCacheRead* GetCacheRead() const {return file_->GetCacheRead();}
00046     void SetCacheRead(TFileCacheRead* tfcr) {file_->SetCacheRead(tfcr);}
00047     void logFileAction(char const* msg, char const* fileName) const;
00048   private:
00049     std::unique_ptr<TFile> file_;
00050     std::string fileName_;
00051     JobReport::Token reportToken_;
00052   }; 
00053 }
00054 #endif