CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes
edm::DuplicateChecker Class Reference

#include <DuplicateChecker.h>

Public Member Functions

bool checkDisabled () const
 
bool checkingAllFiles () const
 
void disable ()
 
 DuplicateChecker (ParameterSet const &pset)
 
void inputFileClosed ()
 
void inputFileOpened (bool realData, IndexIntoFile const &indexIntoFile, std::vector< std::shared_ptr< IndexIntoFile > > const &indexesIntoFiles, std::vector< std::shared_ptr< IndexIntoFile > >::size_type currentIndexIntoFile)
 
bool isDuplicateAndCheckActive (int index, RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, std::string const &fileName)
 
bool noDuplicatesInFile () const
 

Static Public Member Functions

static void fillDescription (ParameterSetDescription &desc)
 

Private Types

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

Private Attributes

DataType dataType_
 
bool disabled_
 
DuplicateCheckMode duplicateCheckMode_
 
bool itIsKnownTheFileHasNoDuplicates_
 
std::set< IndexIntoFile::IndexRunLumiEventKeyrelevantPreviousEvents_
 

Detailed Description

Definition at line 30 of file DuplicateChecker.h.

Member Enumeration Documentation

◆ DataType

◆ DuplicateCheckMode

Constructor & Destructor Documentation

◆ DuplicateChecker()

edm::DuplicateChecker::DuplicateChecker ( ParameterSet const &  pset)

Definition at line 13 of file DuplicateChecker.cc.

References checkAllFilesOpened, checkEachFile, checkEachRealDataFile, EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::duplicateCheckMode, duplicateCheckMode_, Exception, noDuplicateCheck, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

15  // The default value provided as the second argument to the getUntrackedParameter function call
16  // is not used when the ParameterSet has been validated and the parameters are not optional
17  // in the description. This is currently true when PoolSource is the primary input source.
18  // The modules that use PoolSource as a SecSource have not defined their fillDescriptions function
19  // yet, so the ParameterSet does not get validated yet. As soon as all the modules with a SecSource
20  // have defined descriptions, the defaults in the getUntrackedParameterSet function calls can
21  // and should be deleted from the code.
23  pset.getUntrackedParameter<std::string>("duplicateCheckMode", std::string("checkAllFilesOpened"));
24 
25  if (duplicateCheckMode == std::string("noDuplicateCheck"))
27  else if (duplicateCheckMode == std::string("checkEachFile"))
29  else if (duplicateCheckMode == std::string("checkEachRealDataFile"))
31  else if (duplicateCheckMode == std::string("checkAllFilesOpened"))
33  else {
34  throw cms::Exception("Configuration")
35  << "Illegal configuration parameter value passed to PoolSource for\n"
36  << "the \"duplicateCheckMode\" parameter, legal values are:\n"
37  << "\"noDuplicateCheck\", \"checkEachFile\", \"checkEachRealDataFile\", \"checkAllFilesOpened\"\n";
38  }
39  }
DuplicateCheckMode duplicateCheckMode_

Member Function Documentation

◆ checkDisabled()

bool edm::DuplicateChecker::checkDisabled ( ) const
inline

◆ checkingAllFiles()

bool edm::DuplicateChecker::checkingAllFiles ( ) const
inline

◆ disable()

void edm::DuplicateChecker::disable ( )

Definition at line 41 of file DuplicateChecker.cc.

References dataType_, disabled_, itIsKnownTheFileHasNoDuplicates_, relevantPreviousEvents_, and unknown.

41  {
42  disabled_ = true;
46  }
std::set< IndexIntoFile::IndexRunLumiEventKey > relevantPreviousEvents_

◆ fillDescription()

void edm::DuplicateChecker::fillDescription ( ParameterSetDescription desc)
static

Definition at line 109 of file DuplicateChecker.cc.

References submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::RootPrimaryFileSequence::fillDescription().

109  {
110  std::string defaultString("checkAllFilesOpened");
111  desc.addUntracked<std::string>("duplicateCheckMode", defaultString)
112  ->setComment(
113  "'checkAllFilesOpened': check across all input files\n"
114  "'checkEachFile': check each input file independently\n"
115  "'checkEachRealDataFile': check each real data input file independently\n"
116  "'noDuplicateCheck': no duplicate checking\n");
117  }

◆ inputFileClosed()

void edm::DuplicateChecker::inputFileClosed ( )

Definition at line 75 of file DuplicateChecker.cc.

References dataType_, itIsKnownTheFileHasNoDuplicates_, relevantPreviousEvents_, and unknown.

75  {
79  }
std::set< IndexIntoFile::IndexRunLumiEventKey > relevantPreviousEvents_

◆ inputFileOpened()

void edm::DuplicateChecker::inputFileOpened ( bool  realData,
IndexIntoFile const &  indexIntoFile,
std::vector< std::shared_ptr< IndexIntoFile > > const &  indexesIntoFiles,
std::vector< std::shared_ptr< IndexIntoFile > >::size_type  currentIndexIntoFile 
)

Definition at line 48 of file DuplicateChecker.cc.

References checkAllFilesOpened, checkDisabled(), edm::IndexIntoFile::containsDuplicateEvents(), dataType_, duplicateCheckMode_, mps_fire::i, isRealData, isSimulation, itIsKnownTheFileHasNoDuplicates_, relevantPreviousEvents_, edm::IndexIntoFile::set_intersection(), and trackerHitRTTI::vector.

51  {
52  dataType_ = realData ? isRealData : isSimulation;
53  if (checkDisabled())
54  return;
55 
58 
60  // Compares the current IndexIntoFile to all the previous ones and saves any duplicates.
61  // One unintended thing, it also saves the duplicate runs and lumis.
62  for (std::vector<std::shared_ptr<IndexIntoFile> >::size_type i = 0; i < currentIndexIntoFile; ++i) {
63  if (indexesIntoFiles[i].get() != nullptr) {
64  indexIntoFile.set_intersection(*indexesIntoFiles[i], relevantPreviousEvents_);
65  }
66  }
67  }
68  if (relevantPreviousEvents_.empty()) {
69  if (!indexIntoFile.containsDuplicateEvents()) {
71  }
72  }
73  }
uint16_t size_type
bool checkDisabled() const
std::set< IndexIntoFile::IndexRunLumiEventKey > relevantPreviousEvents_
DuplicateCheckMode duplicateCheckMode_

◆ isDuplicateAndCheckActive()

bool edm::DuplicateChecker::isDuplicateAndCheckActive ( int  index,
RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event,
std::string const &  fileName 
)

Definition at line 81 of file DuplicateChecker.cc.

References checkAllFilesOpened, checkDisabled(), duplicateCheckMode_, MillePedeFileConverter_cfg::fileName, itIsKnownTheFileHasNoDuplicates_, relevantPreviousEvents_, and writedatasetfile::run.

82  {
84  return false;
85  if (checkDisabled())
86  return false;
87 
88  IndexIntoFile::IndexRunLumiEventKey newEvent(index, run, lumi, event);
89  bool duplicate = !relevantPreviousEvents_.insert(newEvent).second;
90 
91  if (duplicate) {
93  LogWarning("DuplicateEvent") << "Duplicate Events found in entire set of input files.\n"
94  << "Both events were from run " << run << " and luminosity block " << lumi
95  << " with event number " << event << ".\n"
96  << "The duplicate was from file " << fileName << ".\n"
97  << "The duplicate will be skipped.\n";
98  } else {
99  LogWarning("DuplicateEvent") << "Duplicate Events found in file " << fileName << ".\n"
100  << "Both events were from run " << run << " and luminosity block " << lumi
101  << " with event number " << event << ".\n"
102  << "The duplicate will be skipped.\n";
103  }
104  return true;
105  }
106  return false;
107  }
bool checkDisabled() const
std::set< IndexIntoFile::IndexRunLumiEventKey > relevantPreviousEvents_
Log< level::Warning, false > LogWarning
DuplicateCheckMode duplicateCheckMode_
Definition: event.py:1

◆ noDuplicatesInFile()

bool edm::DuplicateChecker::noDuplicatesInFile ( ) const
inline

Definition at line 43 of file DuplicateChecker.h.

References itIsKnownTheFileHasNoDuplicates_.

Member Data Documentation

◆ dataType_

DataType edm::DuplicateChecker::dataType_
private

Definition at line 66 of file DuplicateChecker.h.

Referenced by checkDisabled(), disable(), inputFileClosed(), and inputFileOpened().

◆ disabled_

bool edm::DuplicateChecker::disabled_
private

Definition at line 77 of file DuplicateChecker.h.

Referenced by checkDisabled(), and disable().

◆ duplicateCheckMode_

DuplicateCheckMode edm::DuplicateChecker::duplicateCheckMode_
private

◆ itIsKnownTheFileHasNoDuplicates_

bool edm::DuplicateChecker::itIsKnownTheFileHasNoDuplicates_
private

◆ relevantPreviousEvents_

std::set<IndexIntoFile::IndexRunLumiEventKey> edm::DuplicateChecker::relevantPreviousEvents_
private