ATLAS Offline Software
DuplicateChecker.h
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 #ifndef EVENT_LOOP_ALGS__DUPLICATE_CHECKER_H
9 #define EVENT_LOOP_ALGS__DUPLICATE_CHECKER_H
10 
11 #include <EventLoopAlgs/Global.h>
12 
13 #include <EventLoop/Algorithm.h>
14 #include <SampleHandler/Global.h>
15 #include <map>
16 #include <set>
17 
18 namespace xAOD
19 {
20  class TEvent;
21 }
22 
23 class TObjString;
24 class TTree;
25 
26 namespace EL
27 {
29 
30  class DuplicateChecker : public Algorithm
31  {
32  //
33  // public interface
34  //
35 
37  private:
39 
40 
44  public:
45  void testInvariant () const;
46 
47 
53  public:
55 
56 
63  public:
64  const std::string& eventInfoName () const;
65 
71  public:
72  void setEventInfoName (const std::string& val_eventInfoName);
73 
74 
84  public:
85  const std::string& outputTreeName () const;
86 
92  public:
93  void setOutputTreeName (const std::string& val_outputTreeName);
94 
95 
101  public:
102  void addKnownDuplicate (const std::string& sampleName,
103  const std::string& fileName,
104  Long64_t entry, number_type runNumber,
106 
113  public:
114  void addKnownDuplicatesFile (const std::string& duplicatesFile);
115 
116 
129  public:
130  static bool
131  processSummary (const std::string& submitdir, const std::string& treeName);
132 
133 
140  public:
141  static bool
142  processSummary (const SH::SampleHandler& sh, const std::string& outputFile);
143 
144 
145 
146  //
147  // inherited interface
148  //
149 
150  private:
151  virtual StatusCode setupJob (Job& job) override;
152 
153  private:
154  virtual StatusCode changeInput (bool firstFile) override;
155 
156  private:
157  virtual StatusCode initialize () override;
158 
159  private:
160  virtual StatusCode execute () override;
161 
162 
163 
164  //
165  // private interface
166  //
167 
169  private:
170  std::string m_eventInfoName;
171 
173  private:
174  std::string m_outputTreeName;
175 
177  private:
178  std::map<std::pair<std::string,std::string>,std::map<Long64_t,std::pair<number_type,number_type> > > m_duplicates;
179 
182  private:
183  std::map<Long64_t,std::pair<number_type,number_type> > *m_currentDuplicates = nullptr;
184 
185 
187  private:
188  std::set<std::pair<number_type,number_type> > m_processed;
189 
191  private:
192  xAOD::TEvent *m_event = nullptr;
193 
194 
196  private:
197  TTree *m_outputTree = nullptr;
198 
201  private:
202  std::string m_inputFileName;
203 
206  private:
207  Long64_t m_inputFileIndex;
208 
211  private:
213 
216  private:
218 
221  private:
222  Bool_t m_processEvent;
223 
225  private:
227 
228 #pragma GCC diagnostic push
229 #pragma GCC diagnostic ignored "-Wpragmas"
230 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
231 #pragma GCC diagnostic ignored "-Winconsistent-missing-override"
233 #pragma GCC diagnostic pop
234  };
235 }
236 
237 #endif
EL::DuplicateChecker::number_type
uint32_t number_type
the integer type to use for run and event numbers
Definition: DuplicateChecker.h:38
EL::DuplicateChecker::setOutputTreeName
void setOutputTreeName(const std::string &val_outputTreeName)
set the value of outputTreeName
EL::DuplicateChecker::eventInfoName
const std::string & eventInfoName() const
the name of the EventInfo structure to use
EL::DuplicateChecker::m_processed
std::set< std::pair< number_type, number_type > > m_processed
the list of run-event numbers already encountered
Definition: DuplicateChecker.h:188
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
EL::DuplicateChecker::m_inputFileName
std::string m_inputFileName
the name of the input file (connected to m_outputTree, if present)
Definition: DuplicateChecker.h:202
EL::DuplicateChecker::changeInput
virtual StatusCode changeInput(bool firstFile) override
effects: do all changes to work with a new input file, e.g.
EL::DuplicateChecker::addKnownDuplicatesFile
void addKnownDuplicatesFile(const std::string &duplicatesFile)
add a file with known duplicates
EL::DuplicateChecker::m_eventNumber
number_type m_eventNumber
the event number of the current event (connected to m_outputTree, if present)
Definition: DuplicateChecker.h:217
EL::DuplicateChecker::execute
virtual StatusCode execute() override
effects: process the next event guarantee: basic failures: algorithm dependent
EL::DuplicateChecker::m_inputFileIndex
Long64_t m_inputFileIndex
the index in the input file (connected to m_outputTree, if present)
Definition: DuplicateChecker.h:207
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
Global.h
EL::DuplicateChecker::processSummary
static bool processSummary(const std::string &submitdir, const std::string &treeName)
process the summary tree from the given submission
compareGeometries.outputFile
string outputFile
Definition: compareGeometries.py:25
EL::DuplicateChecker::m_runNumber
number_type m_runNumber
the run number of the current event (connected to m_outputTree, if present)
Definition: DuplicateChecker.h:212
EL::DuplicateChecker::m_processEvent
Bool_t m_processEvent
whether the current event is/should be processed (connected to m_outputTree, if present)
Definition: DuplicateChecker.h:222
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
EL::Algorithm
Definition: Algorithm.h:22
EL::DuplicateChecker::outputTreeName
const std::string & outputTreeName() const
the name of the output tree to create, or the empty string if none is created
RCU::Shell
Definition: ShellExec.cxx:28
EL::DuplicateChecker::m_duplicates
std::map< std::pair< std::string, std::string >, std::map< Long64_t, std::pair< number_type, number_type > > > m_duplicates
the list of known duplicates to skip
Definition: DuplicateChecker.h:178
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Algorithm.h
EL::DuplicateChecker::testInvariant
void testInvariant() const
test the invariant of this object
EL::DuplicateChecker::ClassDef
ClassDef(DuplicateChecker, 1)
dumpFileToPlots.treeName
string treeName
Definition: dumpFileToPlots.py:20
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
xAOD::eventNumber
eventNumber
Definition: EventInfo_v1.cxx:124
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
EL::DuplicateChecker::m_outputTree
TTree * m_outputTree
the output tree, if we are creating one
Definition: DuplicateChecker.h:197
EL::DuplicateChecker::m_event
xAOD::TEvent * m_event
the event we are reading from
Definition: DuplicateChecker.h:192
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
EL::DuplicateChecker::processSummary
static bool processSummary(const SH::SampleHandler &sh, const std::string &outputFile)
process the summary tree from the given submission
EL::DuplicateChecker::m_eventInfoName
std::string m_eventInfoName
the value returned by eventInfoName
Definition: DuplicateChecker.h:170
EL::DuplicateChecker::DuplicateChecker
DuplicateChecker()
standard constructor
EL::DuplicateChecker::setEventInfoName
void setEventInfoName(const std::string &val_eventInfoName)
set the value of eventInfoName
EL::DuplicateChecker
Definition: DuplicateChecker.h:31
SH::SampleHandler
A class that manages a list of Sample objects.
Definition: SampleHandler.h:60
EL::DuplicateChecker::m_currentDuplicates
std::map< Long64_t, std::pair< number_type, number_type > > * m_currentDuplicates
the list of the duplicates in the current file to skip, or the null pointer if there are none
Definition: DuplicateChecker.h:183
EL::DuplicateChecker::read_run_event_number
void read_run_event_number()
get the run and event number for the current event
EL::DuplicateChecker::initialize
virtual StatusCode initialize() override
effects: do everything that needs to be done before running the algorithm, e.g.
EL::Job
Definition: Job.h:51
EL::DuplicateChecker::addKnownDuplicate
void addKnownDuplicate(const std::string &sampleName, const std::string &fileName, Long64_t entry, number_type runNumber, number_type eventNumber)
add a known duplicate event
test_interactive_athena.job
job
Definition: test_interactive_athena.py:6
EL::DuplicateChecker::m_outputTreeName
std::string m_outputTreeName
the value returned by outputTreeName
Definition: DuplicateChecker.h:174
Global.h
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:81
EL::DuplicateChecker::setupJob
virtual StatusCode setupJob(Job &job) override
effects: give the algorithm a chance to intialize the job with anything this algorithm needs.