CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/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 "FWCore/Framework/interface/Frameworkfwd.h"
00011 #include "FWCore/Framework/interface/GroupSelectorRules.h"
00012 #include "FWCore/Framework/interface/ProcessingController.h"
00013 #include "FWCore/Sources/interface/EventSkipperByID.h"
00014 #include "FWCore/Sources/interface/VectorInputSource.h"
00015 #include "DataFormats/Provenance/interface/BranchDescription.h"
00016 #include "DataFormats/Provenance/interface/ProcessHistoryID.h"
00017 #include "DataFormats/Provenance/interface/IndexIntoFile.h"
00018 
00019 #include "boost/shared_ptr.hpp"
00020 #include "boost/utility.hpp"
00021 
00022 #include <memory>
00023 #include <string>
00024 #include <vector>
00025 
00026 namespace CLHEP {
00027   class RandFlat;
00028 }
00029 
00030 namespace edm {
00031 
00032   class DuplicateChecker;
00033   class FileCatalogItem;
00034   class InputFileCatalog;
00035   class ParameterSetDescription;
00036   class PoolSource;
00037   class RootFile;
00038 
00039   class RootInputFileSequence : private boost::noncopyable {
00040   public:
00041     explicit RootInputFileSequence(ParameterSet const& pset, PoolSource const& input, InputFileCatalog const& catalog, PrincipalCache& cache, bool primaryFiles);
00042     virtual ~RootInputFileSequence();
00043 
00044     typedef VectorInputSource::EventPrincipalVector EventPrincipalVector;
00045     typedef boost::shared_ptr<RootFile> RootFileSharedPtr;
00046     EventPrincipal* readEvent(EventPrincipal& cache, boost::shared_ptr<LuminosityBlockPrincipal> lb);
00047     boost::shared_ptr<LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_();
00048     boost::shared_ptr<LuminosityBlockPrincipal> readLuminosityBlock_(boost::shared_ptr<LuminosityBlockPrincipal> lbCache);
00049     boost::shared_ptr<RunAuxiliary> readRunAuxiliary_();
00050     boost::shared_ptr<RunPrincipal> readRun_(boost::shared_ptr<RunPrincipal> rpCache);
00051     boost::shared_ptr<FileBlock> readFile_(PrincipalCache& cache);
00052     void closeFile_();
00053     void endJob();
00054     InputSource::ItemType getNextItemType();
00055     bool skipEvents(int offset, PrincipalCache& cache);
00056     bool goToEvent(EventID const& eventID, PrincipalCache& cache);
00057     bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event);
00058     void rewind_();
00059     void reset(PrincipalCache& cache);
00060     void readMany(int number, EventPrincipalVector& result);
00061     void readManyRandom(int number, EventPrincipalVector& result, unsigned int& fileSeqNumber);
00062     void readManySequential(int number, EventPrincipalVector& result, unsigned int& fileSeqNumber);
00063     void readManySpecified(std::vector<EventID> const& events, EventPrincipalVector& result); 
00064     void dropUnwantedBranches_(std::vector<std::string> const& wantedBranches);
00065     boost::shared_ptr<ProductRegistry const> fileProductRegistry() const;
00066     static void fillDescription(ParameterSetDescription & desc);
00067     ProcessingController::ForwardState forwardState() const;
00068     ProcessingController::ReverseState reverseState() const;
00069   private:
00070     void initFile(bool skipBadFiles);
00071     bool nextFile(PrincipalCache& cache);
00072     bool previousFile(PrincipalCache& cache);
00073     void rewindFile();
00074     std::vector<FileCatalogItem> const& fileCatalogItems() const;
00075 
00076     boost::shared_ptr<ProductRegistry const> productRegistry() const;
00077     ProcessConfiguration const& processConfiguration() const;
00078     ProductRegistry & productRegistryUpdate() const;
00079     int remainingEvents() const;
00080     int remainingLuminosityBlocks() const;
00081     bool const primary() const;
00082 
00083     PoolSource const& input_;
00084     InputFileCatalog const& catalog_;
00085     bool firstFile_;
00086     std::vector<FileCatalogItem>::const_iterator fileIterBegin_;
00087     std::vector<FileCatalogItem>::const_iterator fileIterEnd_;
00088     std::vector<FileCatalogItem>::const_iterator fileIter_;
00089     std::vector<FileCatalogItem>::const_iterator fileIterLastOpened_;
00090     RootFileSharedPtr rootFile_;
00091     BranchDescription::MatchMode parametersMustMatch_;
00092     BranchDescription::MatchMode branchesMustMatch_;
00093 
00094     boost::scoped_ptr<CLHEP::RandFlat> flatDistribution_;
00095     std::vector<boost::shared_ptr<IndexIntoFile> > indexesIntoFiles_;
00096     std::vector<ProcessHistoryID> orderedProcessHistoryIDs_;
00097 
00098     boost::shared_ptr<EventSkipperByID> eventSkipperByID_;
00099     int eventsRemainingInFile_;
00100     int numberOfEventsToSkip_;
00101     bool noEventSort_;
00102     bool skipBadFiles_;
00103     unsigned int treeCacheSize_;
00104     int const treeMaxVirtualSize_;
00105     RunNumber_t setRun_;
00106     GroupSelectorRules groupSelectorRules_;
00107     bool primaryFiles_;
00108     boost::shared_ptr<DuplicateChecker> duplicateChecker_;
00109     bool dropDescendants_;
00110     bool usingGoToEvent_;
00111   }; // class RootInputFileSequence
00112 }
00113 #endif