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 "boost/shared_ptr.hpp"
00022
00023 #include <vector>
00024 #include <set>
00025 #include <string>
00026
00027
00028 namespace edm {
00029
00030 class ParameterSet;
00031 class ParameterSetDescription;
00032
00033 class DuplicateChecker {
00034 public:
00035
00036 DuplicateChecker(ParameterSet const& pset);
00037
00038 void disable();
00039
00040 void inputFileOpened(
00041 bool realData,
00042 IndexIntoFile const& indexIntoFile,
00043 std::vector<boost::shared_ptr<IndexIntoFile> > const& indexesIntoFiles,
00044 std::vector<boost::shared_ptr<IndexIntoFile> >::size_type currentIndexIntoFile);
00045
00046 void inputFileClosed();
00047
00048 bool noDuplicatesInFile() const { return itIsKnownTheFileHasNoDuplicates_; }
00049
00050 bool checkDisabled() const {
00051 return duplicateCheckMode_ == noDuplicateCheck ||
00052 (duplicateCheckMode_ == checkEachRealDataFile && dataType_ == isSimulation) ||
00053 disabled_;
00054 }
00055
00056 bool isDuplicateAndCheckActive(int index,
00057 RunNumber_t run,
00058 LuminosityBlockNumber_t lumi,
00059 EventNumber_t event,
00060 std::string const& fileName);
00061
00062 bool checkingAllFiles() const {return checkAllFilesOpened == duplicateCheckMode_;}
00063
00064 static void fillDescription(ParameterSetDescription & desc);
00065
00066 private:
00067
00068 enum DuplicateCheckMode { noDuplicateCheck, checkEachFile, checkEachRealDataFile, checkAllFilesOpened };
00069
00070 DuplicateCheckMode duplicateCheckMode_;
00071
00072 enum DataType { isRealData, isSimulation, unknown };
00073
00074 DataType dataType_;
00075
00076
00077
00078
00079
00080
00081 std::set<IndexIntoFile::IndexRunLumiEventKey> relevantPreviousEvents_;
00082
00083 bool itIsKnownTheFileHasNoDuplicates_;
00084
00085 bool disabled_;
00086 };
00087 }
00088 #endif