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

Enumerator
isRealData 
isSimulation 
unknown 

Definition at line 64 of file DuplicateChecker.h.

◆ DuplicateCheckMode

Enumerator
noDuplicateCheck 
checkEachFile 
checkEachRealDataFile 
checkAllFilesOpened 

Definition at line 60 of file DuplicateChecker.h.

Constructor & Destructor Documentation

◆ DuplicateChecker()

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

Definition at line 13 of file DuplicateChecker.cc.

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  }

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

Member Function Documentation

◆ checkDisabled()

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

◆ checkingAllFiles()

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

Definition at line 55 of file DuplicateChecker.h.

References checkAllFilesOpened, and duplicateCheckMode_.

◆ disable()

void edm::DuplicateChecker::disable ( )

Definition at line 41 of file DuplicateChecker.cc.

41  {
42  disabled_ = true;
46  }

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

◆ fillDescription()

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

Definition at line 109 of file DuplicateChecker.cc.

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  }

References edm::ParameterSetDescription::addUntracked(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

◆ inputFileClosed()

void edm::DuplicateChecker::inputFileClosed ( )

◆ 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.

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  }

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

◆ 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.

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  }

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

◆ 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
mps_fire.i
i
Definition: mps_fire.py:355
edm::DuplicateChecker::duplicateCheckMode_
DuplicateCheckMode duplicateCheckMode_
Definition: DuplicateChecker.h:62
edm::DuplicateChecker::itIsKnownTheFileHasNoDuplicates_
bool itIsKnownTheFileHasNoDuplicates_
Definition: DuplicateChecker.h:75
edm::DuplicateChecker::isRealData
Definition: DuplicateChecker.h:64
edm::DuplicateChecker::checkEachRealDataFile
Definition: DuplicateChecker.h:60
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.duplicateCheckMode
duplicateCheckMode
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:23
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
edm::DuplicateChecker::checkEachFile
Definition: DuplicateChecker.h:60
edm::DuplicateChecker::disabled_
bool disabled_
Definition: DuplicateChecker.h:77
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
edm::DuplicateChecker::checkDisabled
bool checkDisabled() const
Definition: DuplicateChecker.h:45
edm::DuplicateChecker::checkAllFilesOpened
Definition: DuplicateChecker.h:60
edm::DuplicateChecker::dataType_
DataType dataType_
Definition: DuplicateChecker.h:66
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::get
T const & get(Event const &event, InputTag const &tag) noexcept(false)
Definition: Event.h:669
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::DuplicateChecker::unknown
Definition: DuplicateChecker.h:64
edm::DuplicateChecker::isSimulation
Definition: DuplicateChecker.h:64
Exception
Definition: hltDiff.cc:246
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::DuplicateChecker::relevantPreviousEvents_
std::set< IndexIntoFile::IndexRunLumiEventKey > relevantPreviousEvents_
Definition: DuplicateChecker.h:73
event
Definition: event.py:1
lumi
Definition: LumiSectionData.h:20
edm::DuplicateChecker::noDuplicateCheck
Definition: DuplicateChecker.h:60
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27