CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
InputFile.cc
Go to the documentation of this file.
1 /*----------------------------------------------------------------------
2 
3 Holder for an input TFile.
4 ----------------------------------------------------------------------*/
5 #include "InputFile.h"
6 
10 
11 #include <iomanip>
12 
13 namespace edm {
14  InputFile::InputFile(char const* fileName, char const* msg) : file_(), fileName_(fileName), reportToken_(0) {
15  logFileAction(msg, fileName);
16  file_.reset(TFile::Open(fileName));
17  if(!file_) {
18  return;
19  }
20  if(file_->IsZombie()) {
21  file_.reset();
22  return;
23  }
24  logFileAction(" Successfully opened file ", fileName);
25  }
26 
28  Close();
29  }
30 
31  void
32  InputFile::inputFileOpened(std::string const& logicalFileName,
33  std::string const& inputType,
34  std::string const& moduleName,
35  std::string const& label,
36  std::string const& fid,
37  std::vector<std::string> const& branchNames) {
38  Service<JobReport> reportSvc;
39  reportToken_ = reportSvc->inputFileOpened(fileName_,
40  logicalFileName,
41  std::string(),
42  inputType,
43  moduleName,
44  label,
45  fid,
46  branchNames);
47  }
48 
49  void
50  InputFile::eventReadFromFile(unsigned int run, unsigned int event) const {
51  Service<JobReport> reportSvc;
52  reportSvc->eventReadFromFile(reportToken_, run, event);
53  }
54 
55  void
56  InputFile::reportInputRunNumber(unsigned int run) const {
57  Service<JobReport> reportSvc;
58  reportSvc->reportInputRunNumber(run);
59  }
60 
61  void
62  InputFile::reportInputLumiSection(unsigned int run, unsigned int lumi) const {
63  Service<JobReport> reportSvc;
64  reportSvc->reportInputLumiSection(run, lumi);
65  }
66 
67  void
69  if(file_->IsOpen()) {
70  file_->Close();
71  try {
72  logFileAction(" Closed file ", fileName_.c_str());
73  Service<JobReport> reportSvc;
74  reportSvc->inputFileClosed(reportToken_);
75  } catch(...) {
76  // If Close() called in a destructor after an exception throw, the services may no longer be active.
77  // Therefore, we catch any new exception.
78  }
79  }
80  }
81 
82  void
83  InputFile::logFileAction(char const* msg, char const* fileName) const {
84  LogAbsolute("fileAction") << std::setprecision(0) << TimeOfDay() << msg << fileName;
86  }
87 }
void reportInputLumiSection(unsigned int run, unsigned int lumi) const
Definition: InputFile.cc:62
const std::string & label
Definition: MVAComputer.cc:186
void FlushMessageLog()
JobReport::Token reportToken_
Definition: InputFile.h:43
tuple lumi
Definition: fjr2json.py:41
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:32
void logFileAction(char const *msg, char const *fileName) const
Definition: InputFile.cc:83
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
std::string fileName_
Definition: InputFile.h:42
boost::scoped_ptr< TFile > file_
Definition: InputFile.h:41
void Close()
Definition: InputFile.cc:68
InputFile(char const *fileName, char const *msg)
Definition: InputFile.cc:14
list fid
Definition: NewTree.py:51
void eventReadFromFile(unsigned int run, unsigned int event) const
Definition: InputFile.cc:50
void reportInputRunNumber(unsigned int run) const
Definition: InputFile.cc:56