CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
InputFile.h
Go to the documentation of this file.
1 #ifndef IOPool_Input_InputFile_h
2 #define IOPool_Input_InputFile_h
3 
4 /*----------------------------------------------------------------------
5 
6 Holder for an input TFile.
7 ----------------------------------------------------------------------*/
10 
11 #include "TFile.h"
12 
13 #include <map>
14 #include <string>
15 #include <vector>
16 
17 class TObject;
18 
19 namespace edm {
20  class InputFile {
21  public:
22  explicit InputFile(char const* fileName, char const* msg, InputType inputType);
23  ~InputFile();
24 
25  InputFile(InputFile const&) = delete; // Disallow copying and moving
26  InputFile& operator=(InputFile const&) = delete; // Disallow copying and moving
27 
28  void Close();
29  void inputFileOpened(std::string const& logicalFileName,
30  std::string const& inputType,
31  std::string const& moduleName,
32  std::string const& label,
33  std::string const& fid,
34  std::vector<std::string> const& branchNames);
35  void eventReadFromFile() const;
36  void reportInputRunNumber(unsigned int run) const;
37  void reportInputLumiSection(unsigned int run, unsigned int lumi) const;
38  static void reportSkippedFile(std::string const& fileName, std::string const& logicalFileName);
39  static void reportFallbackAttempt(std::string const& pfn, std::string const& logicalFileName, std::string const& errorMessage);
40  // reportReadBranches is a per job report, rather than per file report.
41  // Nevertheless, it is defined here for convenience.
42  static void reportReadBranches();
43  static void reportReadBranch(InputType inputType, std::string const& branchname);
44 
45  TObject* Get(char const* name) {return file_->Get(name);}
46  TFileCacheRead* GetCacheRead() const {return file_->GetCacheRead();}
47  void SetCacheRead(TFileCacheRead* tfcr) {file_->SetCacheRead(tfcr, NULL, TFile::kDoNotDisconnect);}
48  void logFileAction(char const* msg, char const* fileName) const;
49  private:
50  std::unique_ptr<TFile> file_;
54  };
55 }
56 #endif
void Close()
Definition: InputFile.cc:85
InputType
Definition: InputType.h:5
InputFile & operator=(InputFile const &)=delete
list pfn
Definition: dbtoconf.py:76
JobReport::Token reportToken_
Definition: InputFile.h:52
InputType inputType_
Definition: InputFile.h:53
tuple lumi
Definition: fjr2json.py:35
TFileCacheRead * GetCacheRead() const
Definition: InputFile.h:46
#define NULL
Definition: scimark2.h:8
void inputFileOpened(std::string const &logicalFileName, std::string const &inputType, std::string const &moduleName, std::string const &label, std::string const &fid, std::vector< std::string > const &branchNames)
Definition: InputFile.cc:37
static void reportReadBranch(InputType inputType, std::string const &branchname)
Definition: InputFile.cc:112
void reportInputRunNumber(unsigned int run) const
Definition: InputFile.cc:61
void logFileAction(char const *msg, char const *fileName) const
Definition: InputFile.cc:100
static void reportFallbackAttempt(std::string const &pfn, std::string const &logicalFileName, std::string const &errorMessage)
Definition: InputFile.cc:79
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
static void reportReadBranches()
Definition: InputFile.cc:106
void reportInputLumiSection(unsigned int run, unsigned int lumi) const
Definition: InputFile.cc:67
static void reportSkippedFile(std::string const &fileName, std::string const &logicalFileName)
Definition: InputFile.cc:73
std::unique_ptr< TFile > file_
Definition: InputFile.h:50
std::size_t Token
Definition: JobReport.h:106
std::string fileName_
Definition: InputFile.h:51
TObject * Get(char const *name)
Definition: InputFile.h:45
InputFile(char const *fileName, char const *msg, InputType inputType)
Definition: InputFile.cc:16
void SetCacheRead(TFileCacheRead *tfcr)
Definition: InputFile.h:47
list fid
Definition: NewTree.py:51
void eventReadFromFile() const
Definition: InputFile.cc:55