ATLAS Offline Software
GridReportingModule.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
9 //
10 // includes
11 //
12 
14 
15 #include <EventLoop/ModuleData.h>
16 #include <algorithm>
17 #include <fstream>
18 
19 //
20 // method implementations
21 //
22 
23 namespace EL
24 {
25  namespace Detail
26  {
29  {
30  if (std::find (m_files.begin(), m_files.end(), data.m_inputFileUrl) == m_files.end())
31  m_files.push_back (data.m_inputFileUrl);
32  return StatusCode::SUCCESS;
33  }
34 
35 
36 
38  onExecute (ModuleData& /*data*/)
39  {
41  return StatusCode::SUCCESS;
42  }
43 
44 
45 
47  postFileClose (ModuleData& /*data*/)
48  {
49  // createJobSummary
50  std::ofstream summaryfile("../AthSummary.txt");
51  if (summaryfile.is_open()) {
52  unsigned int nFiles = m_files.size();
53  summaryfile << "Files read: " << nFiles << std::endl;
54  for (auto& file : m_files)
55  summaryfile << " " << file << std::endl;
56  summaryfile << "Events Read: " << m_eventsProcessed << std::endl;
57  summaryfile.close();
58  }
59  else {
60  ANA_MSG_WARNING ("Failed to write summary file.");
61  }
62  return StatusCode::SUCCESS;
63  }
64 
65 
66 
69  {
70  ANA_MSG_FATAL ("encountered input error");
71  exit (EC_BADINPUT);
72  }
73  }
74 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
EL::Detail::ModuleData
the data the EventLoop core classes are sharing with the Module implementation
Definition: ModuleData.h:64
GridReportingModule.h
EL::Detail::GridReportingModule::m_eventsProcessed
unsigned m_eventsProcessed
the number of events we processed
Definition: GridReportingModule.h:31
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ANA_MSG_WARNING
#define ANA_MSG_WARNING(xmsg)
Macro printing warning messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:292
file
TFile * file
Definition: tile_monitor.h:29
EL::Detail::GridReportingModule::onExecute
virtual StatusCode onExecute(ModuleData &data) override
actions just before execute is called on algorithms
Definition: GridReportingModule.cxx:38
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
EL::Detail::GridReportingModule::reportInputFailure
virtual void reportInputFailure(ModuleData &data) override
report that we failed to open our input file
Definition: GridReportingModule.cxx:68
calibdata.exit
exit
Definition: calibdata.py:236
ANA_MSG_FATAL
#define ANA_MSG_FATAL(xmsg)
Macro printing fatal messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:296
xAOD::DiTauJetParameters::Detail
Detail
Definition: DiTauDefs.h:38
EL::Detail::GridReportingModule::m_files
std::vector< std::string > m_files
the list of files we processed
Definition: GridReportingModule.h:28
EL::Detail::GridReportingModule::EC_BADINPUT
static constexpr int EC_BADINPUT
the panda error code for bad input files
Definition: GridReportingModule.h:25
EL::Detail::GridReportingModule::postFileClose
virtual StatusCode postFileClose(ModuleData &data) override
action at end of the worker job
Definition: GridReportingModule.cxx:47
ModuleData.h
EL::Detail::GridReportingModule::onNewInputFile
virtual StatusCode onNewInputFile(ModuleData &data) override
actions after opening a new input file
Definition: GridReportingModule.cxx:28
CscCalibQuery.nFiles
int nFiles
Definition: CscCalibQuery.py:332