Go to the documentation of this file.00001 #ifndef DataFormats_Provenance_DuplicateChecker_h
00002 #define DataFormats_Provenance_DuplicateChecker_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "DataFormats/Provenance/interface/EventID.h"
00018 #include "DataFormats/Provenance/interface/RunID.h"
00019 #include "DataFormats/Provenance/interface/IndexIntoFile.h"
00020
00021 #include <memory>
00022 #include <set>
00023 #include <string>
00024 #include <vector>
00025
00026
00027 namespace edm {
00028
00029 class ParameterSet;
00030 class ParameterSetDescription;
00031
00032 class DuplicateChecker {
00033 public:
00034
00035 DuplicateChecker(ParameterSet const& pset);
00036
00037 void disable();
00038
00039 void inputFileOpened(
00040 bool realData,
00041 IndexIntoFile const& indexIntoFile,
00042 std::vector<boost::shared_ptr<IndexIntoFile> > const& indexesIntoFiles,
00043 std::vector<boost::shared_ptr<IndexIntoFile> >::size_type currentIndexIntoFile);
00044
00045 void inputFileClosed();
00046
00047 bool noDuplicatesInFile() const { return itIsKnownTheFileHasNoDuplicates_; }
00048
00049 bool checkDisabled() const {
00050 return duplicateCheckMode_ == noDuplicateCheck ||
00051 (duplicateCheckMode_ == checkEachRealDataFile && dataType_ == isSimulation) ||
00052 disabled_;
00053 }
00054
00055
00056
00057 bool isDuplicateAndCheckActive(int index,
00058 RunNumber_t run,
00059 LuminosityBlockNumber_t lumi,
00060 EventNumber_t event,
00061 std::string const& fileName);
00062
00063 bool checkingAllFiles() const {return checkAllFilesOpened == duplicateCheckMode_;}
00064
00065 static void fillDescription(ParameterSetDescription & desc);
00066
00067 private:
00068
00069 enum DuplicateCheckMode { noDuplicateCheck, checkEachFile, checkEachRealDataFile, checkAllFilesOpened };
00070
00071 DuplicateCheckMode duplicateCheckMode_;
00072
00073 enum DataType { isRealData, isSimulation, unknown };
00074
00075 DataType dataType_;
00076
00077
00078
00079
00080
00081
00082 std::set<IndexIntoFile::IndexRunLumiEventKey> relevantPreviousEvents_;
00083
00084 bool itIsKnownTheFileHasNoDuplicates_;
00085
00086 bool disabled_;
00087 };
00088 }
00089 #endif