CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/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, PrincipalCache& cache, 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, boost::shared_ptr<LuminosityBlockPrincipal> lb);
00048     boost::shared_ptr<LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_();
00049     boost::shared_ptr<LuminosityBlockPrincipal> readLuminosityBlock_(boost::shared_ptr<LuminosityBlockPrincipal> lbCache);
00050     boost::shared_ptr<RunAuxiliary> readRunAuxiliary_();
00051     boost::shared_ptr<RunPrincipal> readRun_(boost::shared_ptr<RunPrincipal> rpCache);
00052     boost::shared_ptr<FileBlock> readFile_(PrincipalCache& cache);
00053     void closeFile_();
00054     void endJob();
00055     InputSource::ItemType getNextItemType();
00056     bool skipEvents(int offset, PrincipalCache& cache);
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     void reset(PrincipalCache& cache);
00062     EventPrincipal* readOneRandom();
00063     EventPrincipal* readOneRandomWithID(LuminosityBlockID const& id);
00064     EventPrincipal* readOneSequential();
00065     EventPrincipal* readOneSequentialWithID(LuminosityBlockID const& id);
00066     EventPrincipal* readOneSpecified(EventID const& id);
00067 
00068     void dropUnwantedBranches_(std::vector<std::string> const& wantedBranches);
00069     boost::shared_ptr<ProductRegistry const> fileProductRegistry() 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(PrincipalCache& cache);
00076     bool previousFile(PrincipalCache& cache);
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::vector<FileCatalogItem>::const_iterator fileIterBegin_;
00091     std::vector<FileCatalogItem>::const_iterator fileIterEnd_;
00092     std::vector<FileCatalogItem>::const_iterator fileIter_;
00093     std::vector<FileCatalogItem>::const_iterator fileIterLastOpened_;
00094     RootFileSharedPtr rootFile_;
00095     BranchDescription::MatchMode parametersMustMatch_;
00096     BranchDescription::MatchMode branchesMustMatch_;
00097 
00098     std::unique_ptr<CLHEP::RandFlat> flatDistribution_;
00099     std::vector<boost::shared_ptr<IndexIntoFile> > indexesIntoFiles_;
00100     std::vector<ProcessHistoryID> orderedProcessHistoryIDs_;
00101 
00102     boost::shared_ptr<EventSkipperByID> eventSkipperByID_;
00103     int eventsRemainingInFile_;
00104     int numberOfEventsToSkip_;
00105     bool noEventSort_;
00106     bool skipBadFiles_;
00107     unsigned int treeCacheSize_;
00108     int const treeMaxVirtualSize_;
00109     RunNumber_t setRun_;
00110     GroupSelectorRules groupSelectorRules_;
00111     boost::shared_ptr<DuplicateChecker> duplicateChecker_;
00112     bool dropDescendants_;
00113     bool labelRawDataLikeMC_;
00114     bool usingGoToEvent_;
00115   }; // class RootInputFileSequence
00116 }
00117 #endif