CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
edm::InputFile Class Reference

#include <InputFile.h>

Public Member Functions

void Close ()
 
void eventReadFromFile (unsigned int run, unsigned int event) const
 
TObject * Get (char const *name)
 
TFileCacheRead * GetCacheRead () const
 
 InputFile (char const *fileName, char const *msg)
 
 InputFile (InputFile const &)=delete
 
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)
 
void logFileAction (char const *msg, char const *fileName) const
 
InputFileoperator= (InputFile const &)=delete
 
void reportInputLumiSection (unsigned int run, unsigned int lumi) const
 
void reportInputRunNumber (unsigned int run) const
 
void SetCacheRead (TFileCacheRead *tfcr)
 
 ~InputFile ()
 

Static Public Member Functions

static void reportFallbackAttempt (std::string const &pfn, std::string const &logicalFileName, std::string const &errorMessage)
 
static void reportReadBranch (std::string const &branchname)
 
static void reportReadBranches ()
 
static void reportSkippedFile (std::string const &fileName, std::string const &logicalFileName)
 

Private Attributes

std::unique_ptr< TFile > file_
 
std::string fileName_
 
JobReport::Token reportToken_
 

Detailed Description

Definition at line 19 of file InputFile.h.

Constructor & Destructor Documentation

edm::InputFile::InputFile ( char const *  fileName,
char const *  msg 
)
explicit

Definition at line 13 of file InputFile.cc.

References file_, and logFileAction().

15  file_.reset(TFile::Open(fileName));
16  if(!file_) {
17  return;
18  }
19  if(file_->IsZombie()) {
20  file_.reset();
21  return;
22  }
23  logFileAction(" Successfully opened file ", fileName);
24  }
JobReport::Token reportToken_
Definition: InputFile.h:51
void logFileAction(char const *msg, char const *fileName) const
Definition: InputFile.cc:94
std::unique_ptr< TFile > file_
Definition: InputFile.h:49
std::string fileName_
Definition: InputFile.h:50
edm::InputFile::~InputFile ( )

Definition at line 26 of file InputFile.cc.

References Close().

26  {
27  Close();
28  }
void Close()
Definition: InputFile.cc:79
edm::InputFile::InputFile ( InputFile const &  )
delete

Member Function Documentation

void edm::InputFile::Close ( )

Definition at line 79 of file InputFile.cc.

References cppFunctionSkipper::exception, file_, fileName_, logFileAction(), and reportToken_.

Referenced by ~InputFile().

79  {
80  if(file_->IsOpen()) {
81  file_->Close();
82  try {
83  logFileAction(" Closed file ", fileName_.c_str());
84  Service<JobReport> reportSvc;
85  reportSvc->inputFileClosed(reportToken_);
86  } catch(std::exception) {
87  // If Close() called in a destructor after an exception throw, the services may no longer be active.
88  // Therefore, we catch any reasonable new exception.
89  }
90  }
91  }
JobReport::Token reportToken_
Definition: InputFile.h:51
void logFileAction(char const *msg, char const *fileName) const
Definition: InputFile.cc:94
std::unique_ptr< TFile > file_
Definition: InputFile.h:49
std::string fileName_
Definition: InputFile.h:50
void edm::InputFile::eventReadFromFile ( unsigned int  run,
unsigned int  event 
) const

Definition at line 49 of file InputFile.cc.

References reportToken_.

49  {
50  Service<JobReport> reportSvc;
51  reportSvc->eventReadFromFile(reportToken_, run, event);
52  }
JobReport::Token reportToken_
Definition: InputFile.h:51
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
TObject* edm::InputFile::Get ( char const *  name)
inline

Definition at line 44 of file InputFile.h.

References file_.

44 {return file_->Get(name);}
std::unique_ptr< TFile > file_
Definition: InputFile.h:49
TFileCacheRead* edm::InputFile::GetCacheRead ( ) const
inline

Definition at line 45 of file InputFile.h.

References file_.

Referenced by edm::roottree::trainCache().

45 {return file_->GetCacheRead();}
std::unique_ptr< TFile > file_
Definition: InputFile.h:49
void edm::InputFile::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 at line 31 of file InputFile.cc.

References fileName_, and reportToken_.

36  {
37  Service<JobReport> reportSvc;
38  reportToken_ = reportSvc->inputFileOpened(fileName_,
39  logicalFileName,
40  std::string(),
41  inputType,
42  moduleName,
43  label,
44  fid,
45  branchNames);
46  }
JobReport::Token reportToken_
Definition: InputFile.h:51
std::string fileName_
Definition: InputFile.h:50
list fid
Definition: NewTree.py:51
void edm::InputFile::logFileAction ( char const *  msg,
char const *  fileName 
) const

Definition at line 94 of file InputFile.cc.

References convertXMLtoSQLite_cfg::fileName, and edm::FlushMessageLog().

Referenced by Close(), and InputFile().

94  {
95  LogAbsolute("fileAction") << std::setprecision(0) << TimeOfDay() << msg << fileName;
97  }
void FlushMessageLog()
InputFile& edm::InputFile::operator= ( InputFile const &  )
delete
void edm::InputFile::reportFallbackAttempt ( std::string const &  pfn,
std::string const &  logicalFileName,
std::string const &  errorMessage 
)
static

Definition at line 73 of file InputFile.cc.

Referenced by edm::RootInputFileSequence::initFile().

73  {
74  Service<JobReport> reportSvc;
75  reportSvc->reportFallbackAttempt(pfn, logicalFileName, errorMessage);
76  }
list pfn
Definition: dbtoconf.py:76
void edm::InputFile::reportInputLumiSection ( unsigned int  run,
unsigned int  lumi 
) const

Definition at line 61 of file InputFile.cc.

61  {
62  Service<JobReport> reportSvc;
63  reportSvc->reportInputLumiSection(run, lumi);
64  }
tuple lumi
Definition: fjr2json.py:35
void edm::InputFile::reportInputRunNumber ( unsigned int  run) const

Definition at line 55 of file InputFile.cc.

55  {
56  Service<JobReport> reportSvc;
57  reportSvc->reportInputRunNumber(run);
58  }
void edm::InputFile::reportReadBranch ( std::string const &  branchname)
static

Definition at line 106 of file InputFile.cc.

Referenced by edm::RootDelayedReader::getProduct_().

106  {
107  Service<JobReport> reportSvc;
108  reportSvc->reportReadBranch(branchName);
109  }
void edm::InputFile::reportReadBranches ( )
static

Definition at line 100 of file InputFile.cc.

Referenced by edm::PoolSource::endJob().

100  {
101  Service<JobReport> reportSvc;
102  reportSvc->reportReadBranches();
103  }
void edm::InputFile::reportSkippedFile ( std::string const &  fileName,
std::string const &  logicalFileName 
)
static

Definition at line 67 of file InputFile.cc.

Referenced by edm::RootInputFileSequence::initFile().

67  {
68  Service<JobReport> reportSvc;
69  reportSvc->reportSkippedFile(fileName, logicalFileName);
70  }
void edm::InputFile::SetCacheRead ( TFileCacheRead *  tfcr)
inline

Definition at line 46 of file InputFile.h.

References file_.

Referenced by edm::roottree::trainCache().

46 {file_->SetCacheRead(tfcr);}
std::unique_ptr< TFile > file_
Definition: InputFile.h:49

Member Data Documentation

std::unique_ptr<TFile> edm::InputFile::file_
private

Definition at line 49 of file InputFile.h.

Referenced by Close(), Get(), GetCacheRead(), InputFile(), and SetCacheRead().

std::string edm::InputFile::fileName_
private

Definition at line 50 of file InputFile.h.

Referenced by Close(), and inputFileOpened().

JobReport::Token edm::InputFile::reportToken_
private

Definition at line 51 of file InputFile.h.

Referenced by Close(), eventReadFromFile(), and inputFileOpened().