LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::DuplicateChecker Class Reference

#include "DuplicateChecker.h"

Classes

struct  Config
 

Public Member Functions

 DuplicateChecker (fhicl::TableFragment< Config > const &config)
 
void init (bool realData, FileIndex const &fileIndex)
 
void inputFileClosed ()
 
void rewind ()
 
bool isDuplicateAndCheckActive (EventID const &eventID, std::string const &fileName)
 

Private Types

enum  DuplicateCheckMode { noDuplicateCheck, checkEachFile, checkEachRealDataFile, checkAllFilesOpened }
 
enum  DataType { isRealData, isSimulation, unknown }
 

Private Attributes

DuplicateCheckMode duplicateCheckMode_
 
DataType dataType_
 
std::set< EventIDeventIDs_
 
bool itIsKnownTheFileHasNoDuplicates_
 

Detailed Description

Definition at line 29 of file DuplicateChecker.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

art::DuplicateChecker::DuplicateChecker ( fhicl::TableFragment< Config > const &  config)

Definition at line 12 of file DuplicateChecker.cc.

References checkAllFilesOpened, checkEachFile, checkEachRealDataFile, duplicateCheckMode_, and noDuplicateCheck.

14  :
15 
18  , eventIDs_()
20  {
21  std::string const& duplicateCheckMode = config().duplicateCheckMode();
22 
23  if (duplicateCheckMode == std::string("noDuplicateCheck"))
25  else if (duplicateCheckMode == std::string("checkEachFile"))
27  else if (duplicateCheckMode == std::string("checkEachRealDataFile"))
29  else if (duplicateCheckMode == std::string("checkAllFilesOpened"))
31  else {
32  throw cet::exception("Configuration")
33  << "Illegal configuration parameter value passed to RootInput for\n"
34  << "the \"duplicateCheckMode\" parameter, legal values are:\n"
35  << "\"noDuplicateCheck\", \"checkEachFile\", "
36  "\"checkEachRealDataFile\", \"checkAllFilesOpened\"\n";
37  }
38  }
DuplicateCheckMode duplicateCheckMode_
std::set< EventID > eventIDs_
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Function Documentation

void art::DuplicateChecker::init ( bool  realData,
FileIndex const &  fileIndex 
)

Definition at line 41 of file DuplicateChecker.cc.

References checkAllFilesOpened, checkEachFile, checkEachRealDataFile, dataType_, duplicateCheckMode_, art::FileIndex::eventsUniqueAndOrdered(), isRealData, isSimulation, itIsKnownTheFileHasNoDuplicates_, noDuplicateCheck, and unknown.

bool art::DuplicateChecker::isDuplicateAndCheckActive ( EventID const &  eventID,
std::string const &  fileName 
)

Definition at line 78 of file DuplicateChecker.cc.

References checkAllFilesOpened, checkEachFile, checkEachRealDataFile, dataType_, duplicateCheckMode_, eventIDs_, isSimulation, itIsKnownTheFileHasNoDuplicates_, noDuplicateCheck, and unknown.

80  {
82  return false;
85  return false;
86 
89  assert(dataType_ != unknown);
91  return false;
92  }
93 
94  bool duplicate = !eventIDs_.insert(eventID).second;
95 
96  if (duplicate) {
98  LogWarning("DuplicateEvent")
99  << "Duplicate Events found in entire set of input files.\n"
100  << "Both events were from " << eventID << ".\n"
101  << "The duplicate was from file " << fileName << ".\n"
102  << "The duplicate will be skipped.\n";
103  } else {
104  LogWarning("DuplicateEvent")
105  << "Duplicate Events found in file " << fileName << ".\n"
106  << "Both events were " << eventID << ".\n"
107  << "The duplicate will be skipped.\n";
108  }
109  return true;
110  }
111  return false;
112  }
DuplicateCheckMode duplicateCheckMode_
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::set< EventID > eventIDs_
void art::DuplicateChecker::rewind ( )

Definition at line 72 of file DuplicateChecker.cc.

References eventIDs_.

73  {
74  eventIDs_.clear();
75  }
std::set< EventID > eventIDs_

Member Data Documentation

DataType art::DuplicateChecker::dataType_
private

Definition at line 60 of file DuplicateChecker.h.

Referenced by init(), inputFileClosed(), and isDuplicateAndCheckActive().

DuplicateCheckMode art::DuplicateChecker::duplicateCheckMode_
private
std::set<EventID> art::DuplicateChecker::eventIDs_
private

Definition at line 62 of file DuplicateChecker.h.

Referenced by inputFileClosed(), isDuplicateAndCheckActive(), and rewind().

bool art::DuplicateChecker::itIsKnownTheFileHasNoDuplicates_
private

Definition at line 64 of file DuplicateChecker.h.

Referenced by init(), inputFileClosed(), and isDuplicateAndCheckActive().


The documentation for this class was generated from the following files: