File indexing completed on 2024-04-06 12:19:05
0001 #ifndef DataFormats_Provenance_DuplicateChecker_h
0002 #define DataFormats_Provenance_DuplicateChecker_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "DataFormats/Provenance/interface/EventID.h"
0017 #include "DataFormats/Provenance/interface/RunID.h"
0018 #include "DataFormats/Provenance/interface/IndexIntoFile.h"
0019
0020 #include <memory>
0021 #include <set>
0022 #include <string>
0023 #include <vector>
0024
0025 namespace edm {
0026
0027 class ParameterSet;
0028 class ParameterSetDescription;
0029
0030 class DuplicateChecker {
0031 public:
0032 DuplicateChecker(ParameterSet const& pset);
0033
0034 void disable();
0035
0036 void inputFileOpened(bool realData,
0037 IndexIntoFile const& indexIntoFile,
0038 std::vector<std::shared_ptr<IndexIntoFile> > const& indexesIntoFiles,
0039 std::vector<std::shared_ptr<IndexIntoFile> >::size_type currentIndexIntoFile);
0040
0041 void inputFileClosed();
0042
0043 bool noDuplicatesInFile() const { return itIsKnownTheFileHasNoDuplicates_; }
0044
0045 bool checkDisabled() const {
0046 return duplicateCheckMode_ == noDuplicateCheck ||
0047 (duplicateCheckMode_ == checkEachRealDataFile && dataType_ == isSimulation) || disabled_;
0048 }
0049
0050
0051
0052 bool isDuplicateAndCheckActive(
0053 int index, RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, std::string const& fileName);
0054
0055 bool checkingAllFiles() const { return checkAllFilesOpened == duplicateCheckMode_; }
0056
0057 static void fillDescription(ParameterSetDescription& desc);
0058
0059 private:
0060 enum DuplicateCheckMode { noDuplicateCheck, checkEachFile, checkEachRealDataFile, checkAllFilesOpened };
0061
0062 DuplicateCheckMode duplicateCheckMode_;
0063
0064 enum DataType { isRealData, isSimulation, unknown };
0065
0066 DataType dataType_;
0067
0068
0069
0070
0071
0072
0073 std::set<IndexIntoFile::IndexRunLumiEventKey> relevantPreviousEvents_;
0074
0075 bool itIsKnownTheFileHasNoDuplicates_;
0076
0077 bool disabled_;
0078 };
0079 }
0080 #endif