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,
41  std::string const& logicalFileName,
42  std::string const& errorMessage);
43  // reportReadBranches is a per job report, rather than per file report.
44  // Nevertheless, it is defined here for convenience.
45  static void reportReadBranches();
46  static void reportReadBranch(InputType inputType, std::string const& branchname);
47 
48  TObject* Get(char const* name) { return file_->Get(name); }
49  TFileCacheRead* GetCacheRead() const { return file_->GetCacheRead(); }
50  void SetCacheRead(TFileCacheRead* tfcr) { file_->SetCacheRead(tfcr, nullptr, TFile::kDoNotDisconnect); }
51  void logFileAction(char const* msg, char const* fileName) const;
52 
53  private:
58  };
59 } // namespace edm
60 #endif
void Close()
Definition: InputFile.cc:86
InputType
Definition: InputType.h:5
InputFile & operator=(InputFile const &)=delete
TFileCacheRead * GetCacheRead() const
Definition: InputFile.h:49
JobReport::Token reportToken_
Definition: InputFile.h:56
void logFileAction(char const *msg, char const *fileName) const
Definition: InputFile.cc:100
InputType inputType_
Definition: InputFile.h:57
void eventReadFromFile() const
Definition: InputFile.cc:59
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:48
static void reportReadBranch(InputType inputType, std::string const &branchname)
Definition: InputFile.cc:110
char const * label
static void reportFallbackAttempt(std::string const &pfn, std::string const &logicalFileName, std::string const &errorMessage)
Definition: InputFile.cc:79
static void reportReadBranches()
Definition: InputFile.cc:105
static void reportSkippedFile(std::string const &fileName, std::string const &logicalFileName)
Definition: InputFile.cc:74
edm::propagate_const< std::unique_ptr< TFile > > file_
Definition: InputFile.h:54
std::size_t Token
Definition: JobReport.h:106
std::string fileName_
Definition: InputFile.h:55
void reportInputLumiSection(unsigned int run, unsigned int lumi) const
Definition: InputFile.cc:69
tuple msg
Definition: mps_check.py:286
void reportInputRunNumber(unsigned int run) const
Definition: InputFile.cc:64
std::string moduleName(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:27
HLT enums.
TObject * Get(char const *name)
Definition: InputFile.h:48
InputFile(char const *fileName, char const *msg, InputType inputType)
Definition: InputFile.cc:18
branchNames
Definition: haddnano.py:54
void SetCacheRead(TFileCacheRead *tfcr)
Definition: InputFile.h:50