CMS 3D CMS Logo

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 ----------------------------------------------------------------------*/
11 
12 #include "TFile.h"
13 
14 #include <map>
15 #include <string>
16 #include <vector>
17 
18 class TObject;
19 
20 namespace edm {
21  class InputFile {
22  public:
23  explicit InputFile(char const* fileName, char const* msg, InputType inputType);
24  ~InputFile();
25 
26  InputFile(InputFile const&) = delete; // Disallow copying and moving
27  InputFile& operator=(InputFile const&) = delete; // Disallow copying and moving
28 
29  void Close();
30  void inputFileOpened(std::string const& logicalFileName,
31  std::string const& inputType,
32  std::string const& moduleName,
33  std::string const& label,
34  std::string const& fid,
35  std::vector<std::string> const& branchNames);
36  void eventReadFromFile() const;
37  void reportInputRunNumber(unsigned int run) const;
38  void reportInputLumiSection(unsigned int run, unsigned int lumi) const;
39  static void reportSkippedFile(std::string const& fileName, std::string const& logicalFileName);
40  static void reportFallbackAttempt(std::string const& pfn, std::string const& logicalFileName, std::string const& errorMessage);
41  // reportReadBranches is a per job report, rather than per file report.
42  // Nevertheless, it is defined here for convenience.
43  static void reportReadBranches();
44  static void reportReadBranch(InputType inputType, std::string const& branchname);
45 
46  TObject* Get(char const* name) {return file_->Get(name);}
47  TFileCacheRead* GetCacheRead() const {return file_->GetCacheRead();}
48  void SetCacheRead(TFileCacheRead* tfcr) {file_->SetCacheRead(tfcr, nullptr, TFile::kDoNotDisconnect);}
49  void logFileAction(char const* msg, char const* fileName) const;
50  private:
55  };
56 }
57 #endif
InputType
Definition: InputType.h:5
InputFile & operator=(InputFile const &)=delete
JobReport::Token reportToken_
Definition: InputFile.h:53
InputType inputType_
Definition: InputFile.h:54
TFileCacheRead * GetCacheRead() const
Definition: InputFile.h:47
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:53
static void reportReadBranch(InputType inputType, std::string const &branchname)
Definition: InputFile.cc:128
void reportInputRunNumber(unsigned int run) const
Definition: InputFile.cc:77
void logFileAction(char const *msg, char const *fileName) const
Definition: InputFile.cc:116
static void reportFallbackAttempt(std::string const &pfn, std::string const &logicalFileName, std::string const &errorMessage)
Definition: InputFile.cc:95
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
static void reportReadBranches()
Definition: InputFile.cc:122
void reportInputLumiSection(unsigned int run, unsigned int lumi) const
Definition: InputFile.cc:83
static void reportSkippedFile(std::string const &fileName, std::string const &logicalFileName)
Definition: InputFile.cc:89
edm::propagate_const< std::unique_ptr< TFile > > file_
Definition: InputFile.h:51
std::size_t Token
Definition: JobReport.h:107
std::string fileName_
Definition: InputFile.h:52
tuple msg
Definition: mps_check.py:278
HLT enums.
TObject * Get(char const *name)
Definition: InputFile.h:46
InputFile(char const *fileName, char const *msg, InputType inputType)
Definition: InputFile.cc:18
void SetCacheRead(TFileCacheRead *tfcr)
Definition: InputFile.h:48
void eventReadFromFile() const
Definition: InputFile.cc:71