CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::RootSecondaryFileSequence Class Reference

#include <RootSecondaryFileSequence.h>

Inheritance diagram for edm::RootSecondaryFileSequence:
edm::RootInputFileSequence

Public Types

typedef std::shared_ptr< RootFileRootFileSharedPtr
 

Public Member Functions

virtual void closeFile_ () override
 
void endJob ()
 
void initAssociationsFromSecondary (std::set< BranchID > const &)
 
RootSecondaryFileSequenceoperator= (RootSecondaryFileSequence const &)=delete
 
 RootSecondaryFileSequence (ParameterSet const &pset, PoolSource &input, InputFileCatalog const &catalog, unsigned int nStreams)
 
 RootSecondaryFileSequence (RootSecondaryFileSequence const &)=delete
 
virtual ~RootSecondaryFileSequence ()
 
- Public Member Functions inherited from edm::RootInputFileSequence
bool containedInCurrentFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
 
std::shared_ptr
< BranchIDListHelper const > 
fileBranchIDListHelper () const
 
std::shared_ptr
< ProductRegistry const > 
fileProductRegistry () const
 
RootInputFileSequenceoperator= (RootInputFileSequence const &)=delete
 
void readEvent (EventPrincipal &cache)
 
void readLuminosityBlock_ (LuminosityBlockPrincipal &lumiPrincipal)
 
std::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary_ ()
 
void readRun_ (RunPrincipal &runPrincipal)
 
std::shared_ptr< RunAuxiliaryreadRunAuxiliary_ ()
 
 RootInputFileSequence (ParameterSet const &pset, InputFileCatalog const &catalog)
 
 RootInputFileSequence (RootInputFileSequence const &)=delete
 
bool skipToItem (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash=0U, bool currentFileFirst=true)
 
virtual ~RootInputFileSequence ()
 

Static Public Member Functions

static void fillDescription (ParameterSetDescription &desc)
 

Private Member Functions

virtual void initFile_ (bool skipBadFiles) override
 
virtual RootFileSharedPtr makeRootFile (std::shared_ptr< InputFile > filePtr) override
 

Private Attributes

std::vector< BranchIDassociationsFromSecondary_
 
bool bypassVersionCheck_
 
bool dropDescendants_
 
bool enablePrefetching_
 
bool firstFile_
 
PoolSourceinput_
 
bool labelRawDataLikeMC_
 
unsigned int nStreams_
 
std::vector< ProcessHistoryIDorderedProcessHistoryIDs_
 
ProductSelectorRules productSelectorRules_
 
RunNumber_t setRun_
 
bool skipBadFiles_
 
int const treeMaxVirtualSize_
 

Additional Inherited Members

- Protected Types inherited from edm::RootInputFileSequence
typedef std::shared_ptr< RootFileRootFileSharedPtr
 
- Protected Member Functions inherited from edm::RootInputFileSequence
bool atFirstFile () const
 
bool atLastFile () const
 
std::string const & fallbackFileName () const
 
std::vector< FileCatalogItem >
const & 
fileCatalogItems () const
 
std::string const & fileName () const
 
std::vector< std::shared_ptr
< IndexIntoFile > > const & 
indexesIntoFiles () const
 
void initFile (bool skipBadFiles)
 
void initTheFile (bool skipBadFiles, bool deleteIndexIntoFile, InputSource *input, char const *inputTypeName, InputType inputType)
 
std::string const & lfn () const
 
size_t lfnHash () const
 
std::string const & logicalFileName () const
 
bool noFiles () const
 
bool noMoreFiles () const
 
size_t numberOfFiles () const
 
RootFileSharedPtr const & rootFile () const
 
RootFileSharedPtrrootFile ()
 
size_t sequenceNumberOfFile () const
 
void setAtFileSequenceNumber (size_t offset)
 
void setAtFirstFile ()
 
void setAtNextFile ()
 
void setAtPreviousFile ()
 
void setIndexIntoFile (size_t index)
 
void setNoMoreFiles ()
 
bool skipToItemInNewFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
 
bool skipToItemInNewFile (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash)
 
bool usedFallback () const
 

Detailed Description

Definition at line 29 of file RootSecondaryFileSequence.h.

Member Typedef Documentation

Definition at line 40 of file RootSecondaryFileSequence.h.

Constructor & Destructor Documentation

edm::RootSecondaryFileSequence::RootSecondaryFileSequence ( ParameterSet const &  pset,
PoolSource input,
InputFileCatalog const &  catalog,
unsigned int  nStreams 
)
explicit

Definition at line 21 of file RootSecondaryFileSequence.cc.

References enablePrefetching_, edm::RootInputFileSequence::fileName(), StorageFactory::get(), edm::RootInputFileSequence::initFile(), input_, edm::Service< T >::isAvailable(), edm::RootInputFileSequence::noMoreFiles(), edm::InputSource::productRegistryUpdate(), edm::RootInputFileSequence::rootFile(), edm::RootInputFileSequence::setAtFirstFile(), edm::RootInputFileSequence::setAtNextFile(), skipBadFiles_, StorageFactory::stagein(), and edm::ProductRegistry::updateFromInput().

25  :
27  input_(input),
28  firstFile_(true),
30  nStreams_(nStreams),
31  // The default value provided as the second argument to the getUntrackedParameter function call
32  // is not used when the ParameterSet has been validated and the parameters are not optional
33  // in the description. This is currently true when PoolSource is the primary input source.
34  // The modules that use PoolSource as a SecSource have not defined their fillDescriptions function
35  // yet, so the ParameterSet does not get validated yet. As soon as all the modules with a SecSource
36  // have defined descriptions, the defaults in the getUntrackedParameterSet function calls can
37  // and should be deleted from the code.
38  skipBadFiles_(pset.getUntrackedParameter<bool>("skipBadFiles", false)),
39  bypassVersionCheck_(pset.getUntrackedParameter<bool>("bypassVersionCheck", false)),
40  treeMaxVirtualSize_(pset.getUntrackedParameter<int>("treeMaxVirtualSize", -1)),
41  setRun_(pset.getUntrackedParameter<unsigned int>("setRunNumber", 0U)),
42  productSelectorRules_(pset, "inputCommands", "InputSource"),
43  dropDescendants_(pset.getUntrackedParameter<bool>("dropDescendantsOfDroppedBranches", true)),
44  labelRawDataLikeMC_(pset.getUntrackedParameter<bool>("labelRawDataLikeMC", true)),
45  enablePrefetching_(false) {
46 
47  // The SiteLocalConfig controls the TTreeCache size and the prefetching settings.
49  if(pSLC.isAvailable()) {
50  enablePrefetching_ = pSLC->enablePrefetching();
51  }
52 
53  // Prestage the files
54  //NOTE: we do not want to stage in all secondary files since we can be given a list of
55  // thousands of files and prestaging all those files can cause a site to fail.
56  // So, we stage in the first secondary file only.
59 
60  // Open the first file.
63  if(rootFile()) break;
64  }
65  if(rootFile()) {
66  input_.productRegistryUpdate().updateFromInput(rootFile()->productRegistry()->productList());
67  }
68  }
void initFile(bool skipBadFiles)
std::string const & fileName() const
static std::string const input
Definition: EdmProvDump.cc:43
static const StorageFactory * get(void)
void stagein(const std::string &url) const
RootFileSharedPtr const & rootFile() const
ProductRegistry & productRegistryUpdate() const
Definition: InputSource.h:345
void updateFromInput(ProductList const &other)
RootInputFileSequence(ParameterSet const &pset, InputFileCatalog const &catalog)
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
edm::RootSecondaryFileSequence::~RootSecondaryFileSequence ( )
virtual

Definition at line 70 of file RootSecondaryFileSequence.cc.

70  {
71  }
edm::RootSecondaryFileSequence::RootSecondaryFileSequence ( RootSecondaryFileSequence const &  )
delete

Member Function Documentation

void edm::RootSecondaryFileSequence::closeFile_ ( )
overridevirtual

Implements edm::RootInputFileSequence.

Definition at line 79 of file RootSecondaryFileSequence.cc.

References edm::RootInputFileSequence::rootFile().

Referenced by endJob().

79  {
80  // close the currently open file, if any, and delete the RootFile object.
81  if(rootFile()) {
82  rootFile()->close();
83  rootFile().reset();
84  }
85  }
RootFileSharedPtr const & rootFile() const
void edm::RootSecondaryFileSequence::endJob ( void  )

Definition at line 74 of file RootSecondaryFileSequence.cc.

References closeFile_().

74  {
75  closeFile_();
76  }
static void edm::RootSecondaryFileSequence::fillDescription ( ParameterSetDescription desc)
static
void edm::RootSecondaryFileSequence::initAssociationsFromSecondary ( std::set< BranchID > const &  associationsFromSecondary)

Definition at line 127 of file RootSecondaryFileSequence.cc.

References associationsFromSecondary_, and edm::RootInputFileSequence::rootFile().

127  {
128  for(auto const& branchID : associationsFromSecondary) {
129  associationsFromSecondary_.push_back(branchID);
130  }
131  rootFile()->initAssociationsFromSecondary(associationsFromSecondary_);
132  }
std::vector< BranchID > associationsFromSecondary_
RootFileSharedPtr const & rootFile() const
void edm::RootSecondaryFileSequence::initFile_ ( bool  skipBadFiles)
overrideprivatevirtual

Implements edm::RootInputFileSequence.

Definition at line 87 of file RootSecondaryFileSequence.cc.

References edm::RootInputFileSequence::initTheFile(), and edm::SecondaryFile.

87  {
88  initTheFile(skipBadFiles, false, nullptr, "secondaryFiles", InputType::SecondaryFile);
89  }
void initTheFile(bool skipBadFiles, bool deleteIndexIntoFile, InputSource *input, char const *inputTypeName, InputType inputType)
tuple skipBadFiles
Definition: example_cfg.py:64
RootSecondaryFileSequence::RootFileSharedPtr edm::RootSecondaryFileSequence::makeRootFile ( std::shared_ptr< InputFile filePtr)
overrideprivatevirtual

Implements edm::RootInputFileSequence.

Definition at line 92 of file RootSecondaryFileSequence.cc.

References associationsFromSecondary_, edm::InputSource::branchIDListHelper(), bypassVersionCheck_, dropDescendants_, enablePrefetching_, edm::RootInputFileSequence::fileName(), edm::RootInputFileSequence::indexesIntoFiles(), input_, labelRawDataLikeMC_, edm::RootInputFileSequence::logicalFileName(), nStreams_, orderedProcessHistoryIDs_, edm::InputSource::processConfiguration(), edm::InputSource::processHistoryRegistryForUpdate(), edm::InputSource::processingMode(), productSelectorRules_, edm::SecondaryFile, edm::RootInputFileSequence::sequenceNumberOfFile(), setRun_, edm::InputSource::thinnedAssociationsHelper(), and treeMaxVirtualSize_.

92  {
93  size_t currentIndexIntoFile = sequenceNumberOfFile();
94  return std::make_shared<RootFile>(
95  fileName(),
98  filePtr,
99  nullptr, // eventSkipperByID_
100  false, // initialNumberOfEventsToSkip_ != 0
101  -1, // remainingEvents()
102  -1, // remainingLuminosityBlocks()
103  nStreams_,
104  0U, // treeCacheSize_
107  setRun_,
108  false, // noEventSort_
114  nullptr, //duplicateChecker_
118  currentIndexIntoFile,
122  false, // usingGoToEvent_
124  }
std::string const & logicalFileName() const
std::string const & fileName() const
std::shared_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper() const
Accessor for thinnedAssociationsHelper.
Definition: InputSource.h:178
std::vector< std::shared_ptr< IndexIntoFile > > const & indexesIntoFiles() const
ProcessingMode processingMode() const
RunsLumisAndEvents (default), RunsAndLumis, or Runs.
Definition: InputSource.h:251
std::vector< BranchID > associationsFromSecondary_
std::shared_ptr< BranchIDListHelper > branchIDListHelper() const
Accessor for branchIDListHelper.
Definition: InputSource.h:175
ProcessHistoryRegistry & processHistoryRegistryForUpdate() const
Definition: InputSource.h:346
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
ProcessConfiguration const & processConfiguration() const
Accessor for Process Configuration.
Definition: InputSource.h:209
RootSecondaryFileSequence& edm::RootSecondaryFileSequence::operator= ( RootSecondaryFileSequence const &  )
delete

Member Data Documentation

std::vector<BranchID> edm::RootSecondaryFileSequence::associationsFromSecondary_
private

Definition at line 51 of file RootSecondaryFileSequence.h.

Referenced by initAssociationsFromSecondary(), and makeRootFile().

bool edm::RootSecondaryFileSequence::bypassVersionCheck_
private

Definition at line 56 of file RootSecondaryFileSequence.h.

Referenced by makeRootFile().

bool edm::RootSecondaryFileSequence::dropDescendants_
private

Definition at line 60 of file RootSecondaryFileSequence.h.

Referenced by makeRootFile().

bool edm::RootSecondaryFileSequence::enablePrefetching_
private

Definition at line 62 of file RootSecondaryFileSequence.h.

Referenced by makeRootFile(), and RootSecondaryFileSequence().

bool edm::RootSecondaryFileSequence::firstFile_
private

Definition at line 50 of file RootSecondaryFileSequence.h.

PoolSource& edm::RootSecondaryFileSequence::input_
private

Definition at line 49 of file RootSecondaryFileSequence.h.

Referenced by makeRootFile(), and RootSecondaryFileSequence().

bool edm::RootSecondaryFileSequence::labelRawDataLikeMC_
private

Definition at line 61 of file RootSecondaryFileSequence.h.

Referenced by makeRootFile().

unsigned int edm::RootSecondaryFileSequence::nStreams_
private

Definition at line 54 of file RootSecondaryFileSequence.h.

Referenced by makeRootFile().

std::vector<ProcessHistoryID> edm::RootSecondaryFileSequence::orderedProcessHistoryIDs_
private

Definition at line 52 of file RootSecondaryFileSequence.h.

Referenced by makeRootFile().

ProductSelectorRules edm::RootSecondaryFileSequence::productSelectorRules_
private

Definition at line 59 of file RootSecondaryFileSequence.h.

Referenced by makeRootFile().

RunNumber_t edm::RootSecondaryFileSequence::setRun_
private

Definition at line 58 of file RootSecondaryFileSequence.h.

Referenced by makeRootFile().

bool edm::RootSecondaryFileSequence::skipBadFiles_
private

Definition at line 55 of file RootSecondaryFileSequence.h.

Referenced by RootSecondaryFileSequence().

int const edm::RootSecondaryFileSequence::treeMaxVirtualSize_
private

Definition at line 57 of file RootSecondaryFileSequence.h.

Referenced by makeRootFile().