CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/IOPool/Input/src/RootInputFileSequence.h

Go to the documentation of this file.
00001 #ifndef IOPool_Input_RootInputFileSequence_h
00002 #define IOPool_Input_RootInputFileSequence_h
00003 
00004 /*----------------------------------------------------------------------
00005 
00006 RootInputFileSequence: This is an InputSource
00007 
00008 ----------------------------------------------------------------------*/
00009 
00010 #include "InputType.h"
00011 
00012 #include "FWCore/Framework/interface/Frameworkfwd.h"
00013 #include "FWCore/Framework/interface/GroupSelectorRules.h"
00014 #include "FWCore/Framework/interface/ProcessingController.h"
00015 #include "FWCore/Sources/interface/EventSkipperByID.h"
00016 #include "FWCore/Sources/interface/VectorInputSource.h"
00017 #include "DataFormats/Provenance/interface/BranchDescription.h"
00018 #include "DataFormats/Provenance/interface/ProcessHistoryID.h"
00019 #include "DataFormats/Provenance/interface/IndexIntoFile.h"
00020 
00021 #include <memory>
00022 #include <string>
00023 #include <vector>
00024 
00025 namespace CLHEP {
00026   class RandFlat;
00027 }
00028 
00029 namespace edm {
00030 
00031   class DuplicateChecker;
00032   class FileCatalogItem;
00033   class InputFileCatalog;
00034   class ParameterSetDescription;
00035   class PoolSource;
00036   class RootFile;
00037 
00038   class RootInputFileSequence {
00039   public:
00040     explicit RootInputFileSequence(ParameterSet const& pset, PoolSource const& input, InputFileCatalog const& catalog, InputType::InputType inputType);
00041     virtual ~RootInputFileSequence();
00042 
00043     RootInputFileSequence(RootInputFileSequence const&) = delete; // Disallow copying and moving
00044     RootInputFileSequence& operator=(RootInputFileSequence const&) = delete; // Disallow copying and moving
00045 
00046     typedef boost::shared_ptr<RootFile> RootFileSharedPtr;
00047     EventPrincipal* readEvent(EventPrincipal& cache);
00048     boost::shared_ptr<LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_();
00049     boost::shared_ptr<LuminosityBlockPrincipal> readLuminosityBlock_(boost::shared_ptr<LuminosityBlockPrincipal> lumiPrincipal);
00050     boost::shared_ptr<RunAuxiliary> readRunAuxiliary_();
00051     boost::shared_ptr<RunPrincipal> readRun_(boost::shared_ptr<RunPrincipal> runPrincipal);
00052     boost::shared_ptr<FileBlock> readFile_();
00053     void closeFile_();
00054     void endJob();
00055     InputSource::ItemType getNextItemType();
00056     bool skipEvents(int offset);
00057     bool goToEvent(EventID const& eventID);
00058     bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, bool currentFileFirst = true);
00059     bool skipToItemInNewFile(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event);
00060     void rewind_();
00061     EventPrincipal* readOneRandom();
00062     EventPrincipal* readOneRandomWithID(LuminosityBlockID const& id);
00063     EventPrincipal* readOneSequential();
00064     EventPrincipal* readOneSequentialWithID(LuminosityBlockID const& id);
00065     EventPrincipal* readOneSpecified(EventID const& id);
00066 
00067     void dropUnwantedBranches_(std::vector<std::string> const& wantedBranches);
00068     boost::shared_ptr<ProductRegistry const> fileProductRegistry() const;
00069     boost::shared_ptr<BranchIDListHelper const> fileBranchIDListHelper() const;
00070     static void fillDescription(ParameterSetDescription & desc);
00071     ProcessingController::ForwardState forwardState() const;
00072     ProcessingController::ReverseState reverseState() const;
00073   private:
00074     void initFile(bool skipBadFiles);
00075     bool nextFile();
00076     bool previousFile();
00077     void rewindFile();
00078     std::vector<FileCatalogItem> const& fileCatalogItems() const;
00079 
00080     boost::shared_ptr<ProductRegistry const> productRegistry() const;
00081     ProcessConfiguration const& processConfiguration() const;
00082     ProductRegistry & productRegistryUpdate() const;
00083     int remainingEvents() const;
00084     int remainingLuminosityBlocks() const;
00085 
00086     PoolSource const& input_;
00087     InputType::InputType inputType_;
00088     InputFileCatalog const& catalog_;
00089     bool firstFile_;
00090     std::string lfn_;
00091     std::vector<FileCatalogItem>::const_iterator fileIterBegin_;
00092     std::vector<FileCatalogItem>::const_iterator fileIterEnd_;
00093     std::vector<FileCatalogItem>::const_iterator fileIter_;
00094     std::vector<FileCatalogItem>::const_iterator fileIterLastOpened_;
00095     RootFileSharedPtr rootFile_;
00096     BranchDescription::MatchMode parametersMustMatch_;
00097     BranchDescription::MatchMode branchesMustMatch_;
00098 
00099     std::unique_ptr<CLHEP::RandFlat> flatDistribution_;
00100     std::vector<boost::shared_ptr<IndexIntoFile> > indexesIntoFiles_;
00101     std::vector<ProcessHistoryID> orderedProcessHistoryIDs_;
00102 
00103     boost::shared_ptr<EventSkipperByID> eventSkipperByID_;
00104     int eventsRemainingInFile_;
00105     int initialNumberOfEventsToSkip_;
00106     bool noEventSort_;
00107     bool skipBadFiles_;
00108     unsigned int treeCacheSize_;
00109     int const treeMaxVirtualSize_;
00110     RunNumber_t setRun_;
00111     GroupSelectorRules groupSelectorRules_;
00112     boost::shared_ptr<DuplicateChecker> duplicateChecker_;
00113     bool dropDescendants_;
00114     bool labelRawDataLikeMC_;
00115     bool usingGoToEvent_;
00116     bool enablePrefetching_;
00117     bool usedFallback_;
00118   }; // class RootInputFileSequence
00119 }
00120 #endif