CMS 3D CMS Logo

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

#include <RootInputFileSequence.h>

Inheritance diagram for edm::RootInputFileSequence:
edm::RootEmbeddedFileSequence edm::RootPrimaryFileSequence edm::RootSecondaryFileSequence

Public Member Functions

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 ()
 

Protected Types

typedef std::shared_ptr< RootFileRootFileSharedPtr
 

Protected Member Functions

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
 
std::shared_ptr< RootFile const > rootFile () const
 
std::shared_ptr< RootFile > & rootFile ()
 
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
 

Private Member Functions

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

Private Attributes

InputFileCatalog const & catalog_
 
std::vector< FileCatalogItem >
::const_iterator 
fileIter_
 
std::vector< FileCatalogItem >
::const_iterator const 
fileIterBegin_
 
std::vector< FileCatalogItem >
::const_iterator const 
fileIterEnd_
 
std::vector< FileCatalogItem >
::const_iterator 
fileIterLastOpened_
 
edm::propagate_const
< std::unique_ptr
< std::unordered_multimap
< size_t, size_t > > > 
findFileForSpecifiedID_
 
std::vector< std::shared_ptr
< IndexIntoFile > > 
indexesIntoFiles_
 
std::string lfn_
 
size_t lfnHash_
 
edm::propagate_const
< RootFileSharedPtr
rootFile_
 
bool usedFallback_
 

Detailed Description

Definition at line 29 of file RootInputFileSequence.h.

Member Typedef Documentation

typedef std::shared_ptr<RootFile> edm::RootInputFileSequence::RootFileSharedPtr
protected

Definition at line 48 of file RootInputFileSequence.h.

Constructor & Destructor Documentation

edm::RootInputFileSequence::RootInputFileSequence ( ParameterSet const &  pset,
InputFileCatalog const &  catalog 
)
explicit

Definition at line 22 of file RootInputFileSequence.cc.

24  :
26  lfn_("unknown"),
27  lfnHash_(0U),
28  usedFallback_(false),
29  findFileForSpecifiedID_(nullptr),
34  rootFile_(),
36  }
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
std::vector< FileCatalogItem >::const_iterator const fileIterBegin_
std::vector< FileCatalogItem >::const_iterator fileIterLastOpened_
std::vector< FileCatalogItem > const & fileCatalogItems() const
#define end
Definition: vmac.h:37
std::vector< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
edm::propagate_const< RootFileSharedPtr > rootFile_
#define begin
Definition: vmac.h:30
edm::propagate_const< std::unique_ptr< std::unordered_multimap< size_t, size_t > > > findFileForSpecifiedID_
tuple size
Write out results.
InputFileCatalog const & catalog_
edm::RootInputFileSequence::~RootInputFileSequence ( )
virtual

Definition at line 55 of file RootInputFileSequence.cc.

55  {
56  }
edm::RootInputFileSequence::RootInputFileSequence ( RootInputFileSequence const &  )
delete

Member Function Documentation

bool edm::RootInputFileSequence::atFirstFile ( ) const
inlineprotected
bool edm::RootInputFileSequence::atLastFile ( ) const
inlineprotected

Definition at line 55 of file RootInputFileSequence.h.

References fileIter_, and fileIterEnd_.

Referenced by edm::RootPrimaryFileSequence::forwardState(), and edm::RootPrimaryFileSequence::getNextItemType().

55 {return fileIter_ + 1 == fileIterEnd_;}
std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
std::vector< FileCatalogItem >::const_iterator fileIter_
virtual void edm::RootInputFileSequence::closeFile_ ( )
privatepure virtual
bool edm::RootInputFileSequence::containedInCurrentFile ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
) const

Definition at line 102 of file RootInputFileSequence.cc.

References rootFile().

102  {
103  if(!rootFile()) return false;
104  return rootFile()->containsItem(run, lumi, event);
105  }
tuple lumi
Definition: fjr2json.py:35
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::shared_ptr< RootFile const > rootFile() const
std::string const& edm::RootInputFileSequence::fallbackFileName ( ) const
inlineprotected

Definition at line 69 of file RootInputFileSequence.h.

References fileIter_.

Referenced by initTheFile().

69 {return fileIter_->fallbackFileName();}
std::vector< FileCatalogItem >::const_iterator fileIter_
std::shared_ptr< BranchIDListHelper const > edm::RootInputFileSequence::fileBranchIDListHelper ( ) const

Definition at line 50 of file RootInputFileSequence.cc.

References assert(), and rootFile().

50  {
51  assert(rootFile());
52  return rootFile()->branchIDListHelper();
53  }
assert(m_qm.get())
std::shared_ptr< RootFile const > rootFile() const
std::vector< FileCatalogItem > const & edm::RootInputFileSequence::fileCatalogItems ( ) const
protected

Definition at line 39 of file RootInputFileSequence.cc.

References catalog_, and edm::InputFileCatalog::fileCatalogItems().

Referenced by edm::RootEmbeddedFileSequence::readOneRandom().

39  {
40  return catalog_.fileCatalogItems();
41  }
std::vector< FileCatalogItem > const & fileCatalogItems() const
InputFileCatalog const & catalog_
std::string const& edm::RootInputFileSequence::fileName ( ) const
inlineprotected
std::shared_ptr< ProductRegistry const > edm::RootInputFileSequence::fileProductRegistry ( ) const

Definition at line 44 of file RootInputFileSequence.cc.

References assert(), and rootFile().

44  {
45  assert(rootFile());
46  return rootFile()->productRegistry();
47  }
assert(m_qm.get())
std::shared_ptr< RootFile const > rootFile() const
std::vector<std::shared_ptr<IndexIntoFile> > const& edm::RootInputFileSequence::indexesIntoFiles ( ) const
inlineprotected
void edm::RootInputFileSequence::initFile ( bool  skipBadFiles)
inlineprotected
virtual void edm::RootInputFileSequence::initFile_ ( bool  skipBadFiles)
privatepure virtual
void edm::RootInputFileSequence::initTheFile ( bool  skipBadFiles,
bool  deleteIndexIntoFile,
InputSource input,
char const *  inputTypeName,
InputType  inputType 
)
protected

Definition at line 189 of file RootInputFileSequence.cc.

References cms::Exception::addAdditionalInfo(), cms::Exception::addContext(), cms::Exception::additionalInfo(), assert(), closeFile_(), alignCSCRings::e, relativeConstraints::empty, Exception, cms::Exception::explainSelf(), fallbackFileName(), edm::errors::FallbackFileOpenError, fileIter_, fileIterBegin_, fileIterEnd_, fileIterLastOpened_, fileName(), edm::errors::FileOpenError, indexesIntoFiles_, RPC_Client_on_RootFile::InputFile, lfn_, lfnHash_, logicalFileName(), makeRootFile(), mergeVDriftHistosByStation::name, noMoreFiles(), fileinputsource_cfi::out, edm::InputSource::postEventReadFromSourceSignal_, edm::InputSource::preEventReadFromSourceSignal_, edm::InputFile::reportFallbackAttempt(), edm::InputFile::reportSkippedFile(), rootFile_, alignCSCRings::s, setIndexIntoFile(), AlCaHLTBitMon_QueryRunRegistry::string, and usedFallback_.

Referenced by edm::RootSecondaryFileSequence::initFile_(), edm::RootEmbeddedFileSequence::initFile_(), and edm::RootPrimaryFileSequence::initFile_().

193  {
194  // We are really going to close the open file.
195 
197  size_t currentIndexIntoFile = fileIterLastOpened_ - fileIterBegin_;
198  if(deleteIndexIntoFile) {
199  indexesIntoFiles_[currentIndexIntoFile].reset();
200  } else {
201  if(indexesIntoFiles_[currentIndexIntoFile]) indexesIntoFiles_[currentIndexIntoFile]->inputFileClosed();
202  }
204  }
205  closeFile_();
206 
207  if(noMoreFiles()) {
208  // No files specified
209  return;
210  }
211 
212  // Check if the logical file name was found.
213  if(fileName().empty()) {
214  // LFN not found in catalog.
216  if(!skipBadFiles) {
217  throw cms::Exception("LogicalFileNameNotFound", "RootFileSequenceBase::initTheFile()\n")
218  << "Logical file name '" << logicalFileName() << "' was not found in the file catalog.\n"
219  << "If you wanted a local file, you forgot the 'file:' prefix\n"
220  << "before the file name in your configuration file.\n";
221  }
222  LogWarning("") << "Input logical file: " << logicalFileName() << " was not found in the catalog, and will be skipped.\n";
223  return;
224  }
225 
226  lfn_ = logicalFileName().empty() ? fileName() : logicalFileName();
227  lfnHash_ = std::hash<std::string>()(lfn_);
228  usedFallback_ = false;
229 
230  // Determine whether we have a fallback URL specified; if so, prepare it;
231  // Only valid if it is non-empty and differs from the original filename.
232  bool hasFallbackUrl = !fallbackFileName().empty() && fallbackFileName() != fileName();
233 
234  std::shared_ptr<InputFile> filePtr;
235  std::list<std::string> originalInfo;
236  try {
237  std::unique_ptr<InputSource::FileOpenSentry> sentry(input ? std::make_unique<InputSource::FileOpenSentry>(*input, lfn_, usedFallback_) : nullptr);
238  std::unique_ptr<char[]> name(gSystem->ExpandPathName(fileName().c_str()));;
239  filePtr = std::make_shared<InputFile>(name.get(), " Initiating request to open file ", inputType);
240  }
241  catch (cms::Exception const& e) {
242  if(!skipBadFiles) {
243  if(hasFallbackUrl) {
244  std::ostringstream out;
245  out << e.explainSelf();
246 
247  std::unique_ptr<char[]> name(gSystem->ExpandPathName(fallbackFileName().c_str()));
248  std::string pfn(name.get());
250  originalInfo = e.additionalInfo();
251  } else {
253  Exception ex(errors::FileOpenError, "", e);
254  ex.addContext("Calling RootFileSequenceBase::initTheFile()");
255  std::ostringstream out;
256  out << "Input file " << fileName() << " could not be opened.";
257  ex.addAdditionalInfo(out.str());
258  throw ex;
259  }
260  }
261  }
262  if(!filePtr && (hasFallbackUrl)) {
263  try {
264  usedFallback_ = true;
265  std::unique_ptr<InputSource::FileOpenSentry> sentry(input ? std::make_unique<InputSource::FileOpenSentry>(*input, lfn_, usedFallback_) : nullptr);
266  std::unique_ptr<char[]> fallbackFullName(gSystem->ExpandPathName(fallbackFileName().c_str()));
267  filePtr.reset(new InputFile(fallbackFullName.get(), " Fallback request to file ", inputType));
268  }
269  catch (cms::Exception const& e) {
270  if(!skipBadFiles) {
273  ex.addContext("Calling RootFileSequenceBase::initTheFile()");
274  std::ostringstream out;
275  out << "Input file " << fileName() << " could not be opened.\n";
276  out << "Fallback Input file " << fallbackFileName() << " also could not be opened.";
277  if (originalInfo.size()) {
278  out << std::endl << "Original exception info is above; fallback exception info is below.";
279  ex.addAdditionalInfo(out.str());
280  for (auto const & s : originalInfo) {
281  ex.addAdditionalInfo(s);
282  }
283  } else {
284  ex.addAdditionalInfo(out.str());
285  }
286  throw ex;
287  }
288  }
289  }
290  if(filePtr) {
291  size_t currentIndexIntoFile = fileIter_ - fileIterBegin_;
292  rootFile_ = makeRootFile(filePtr);
293  if(input) {
294  rootFile_->setSignals(&(input->preEventReadFromSourceSignal_), &(input->postEventReadFromSourceSignal_));
295  }
296  assert(rootFile_);
298  setIndexIntoFile(currentIndexIntoFile);
299  rootFile_->reportOpened(inputTypeName);
300  } else {
302  if(!skipBadFiles) {
304  "RootFileSequenceBase::initTheFile(): Input file " << fileName() << " was not found or could not be opened.\n";
305  }
306  LogWarning("") << "Input file: " << fileName() << " was not found or could not be opened, and will be skipped.\n";
307  }
308  }
std::string const & logicalFileName() const
std::string const & fileName() const
virtual std::string explainSelf() const
Definition: Exception.cc:146
std::vector< FileCatalogItem >::const_iterator fileIter_
std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
std::vector< FileCatalogItem >::const_iterator const fileIterBegin_
assert(m_qm.get())
std::list< std::string > const & additionalInfo() const
Definition: Exception.cc:195
tuple InputFile
Open Root file and provide MEs ############.
static void reportFallbackAttempt(std::string const &pfn, std::string const &logicalFileName, std::string const &errorMessage)
Definition: InputFile.cc:93
std::vector< FileCatalogItem >::const_iterator fileIterLastOpened_
static void reportSkippedFile(std::string const &fileName, std::string const &logicalFileName)
Definition: InputFile.cc:87
virtual RootFileSharedPtr makeRootFile(std::shared_ptr< InputFile > filePtr)=0
std::vector< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
edm::propagate_const< RootFileSharedPtr > rootFile_
virtual void closeFile_()=0
std::string const & fallbackFileName() const
std::string const& edm::RootInputFileSequence::lfn ( ) const
inlineprotected

Definition at line 70 of file RootInputFileSequence.h.

References lfn_.

Referenced by edm::RootPrimaryFileSequence::closeFile_().

70 {return lfn_;}
size_t edm::RootInputFileSequence::lfnHash ( ) const
inlineprotected
std::string const& edm::RootInputFileSequence::logicalFileName ( ) const
inlineprotected

Definition at line 68 of file RootInputFileSequence.h.

References fileIter_.

Referenced by initTheFile(), edm::RootSecondaryFileSequence::makeRootFile(), edm::RootEmbeddedFileSequence::makeRootFile(), and edm::RootPrimaryFileSequence::makeRootFile().

68 {return fileIter_->logicalFileName();}
std::vector< FileCatalogItem >::const_iterator fileIter_
virtual RootFileSharedPtr edm::RootInputFileSequence::makeRootFile ( std::shared_ptr< InputFile filePtr)
privatepure virtual
bool edm::RootInputFileSequence::noFiles ( ) const
inlineprotected

Definition at line 57 of file RootInputFileSequence.h.

References fileIterBegin_, and fileIterEnd_.

Referenced by edm::RootEmbeddedFileSequence::RootEmbeddedFileSequence().

57 {return fileIterBegin_ == fileIterEnd_;}
std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
std::vector< FileCatalogItem >::const_iterator const fileIterBegin_
bool edm::RootInputFileSequence::noMoreFiles ( ) const
inlineprotected
size_t edm::RootInputFileSequence::numberOfFiles ( ) const
inlineprotected

Definition at line 59 of file RootInputFileSequence.h.

References fileIterBegin_, and fileIterEnd_.

Referenced by edm::RootEmbeddedFileSequence::RootEmbeddedFileSequence().

59 {return fileIterEnd_ - fileIterBegin_;}
std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
std::vector< FileCatalogItem >::const_iterator const fileIterBegin_
RootInputFileSequence& edm::RootInputFileSequence::operator= ( RootInputFileSequence const &  )
delete
void edm::RootInputFileSequence::readEvent ( EventPrincipal cache)

Definition at line 96 of file RootInputFileSequence.cc.

References assert(), and rootFile().

96  {
97  assert(rootFile());
98  rootFile()->readEvent(eventPrincipal);
99  }
assert(m_qm.get())
std::shared_ptr< RootFile const > rootFile() const
void edm::RootInputFileSequence::readLuminosityBlock_ ( LuminosityBlockPrincipal lumiPrincipal)

Definition at line 77 of file RootInputFileSequence.cc.

References assert(), and rootFile().

77  {
78  assert(rootFile());
79  rootFile()->readLuminosityBlock_(lumiPrincipal);
80  }
assert(m_qm.get())
std::shared_ptr< RootFile const > rootFile() const
std::shared_ptr< LuminosityBlockAuxiliary > edm::RootInputFileSequence::readLuminosityBlockAuxiliary_ ( )

Definition at line 65 of file RootInputFileSequence.cc.

References assert(), and rootFile().

65  {
66  assert(rootFile());
67  return rootFile()->readLuminosityBlockAuxiliary_();
68  }
assert(m_qm.get())
std::shared_ptr< RootFile const > rootFile() const
void edm::RootInputFileSequence::readRun_ ( RunPrincipal runPrincipal)

Definition at line 71 of file RootInputFileSequence.cc.

References assert(), and rootFile().

71  {
72  assert(rootFile());
73  rootFile()->readRun_(runPrincipal);
74  }
assert(m_qm.get())
std::shared_ptr< RootFile const > rootFile() const
std::shared_ptr< RunAuxiliary > edm::RootInputFileSequence::readRunAuxiliary_ ( )

Definition at line 59 of file RootInputFileSequence.cc.

References assert(), and rootFile().

59  {
60  assert(rootFile());
61  return rootFile()->readRunAuxiliary_();
62  }
assert(m_qm.get())
std::shared_ptr< RootFile const > rootFile() const
std::shared_ptr<RootFile const> edm::RootInputFileSequence::rootFile ( ) const
inlineprotected

Definition at line 78 of file RootInputFileSequence.h.

References edm::get_underlying_safe(), and rootFile_.

Referenced by edm::RootSecondaryFileSequence::closeFile_(), edm::RootEmbeddedFileSequence::closeFile_(), edm::RootPrimaryFileSequence::closeFile_(), containedInCurrentFile(), fileBranchIDListHelper(), fileProductRegistry(), edm::RootPrimaryFileSequence::forwardState(), edm::RootPrimaryFileSequence::getNextItemType(), edm::RootPrimaryFileSequence::goToEvent(), edm::RootSecondaryFileSequence::initAssociationsFromSecondary(), edm::RootPrimaryFileSequence::nextFile(), edm::RootPrimaryFileSequence::previousFile(), readEvent(), edm::RootPrimaryFileSequence::readFile_(), readLuminosityBlock_(), readLuminosityBlockAuxiliary_(), edm::RootEmbeddedFileSequence::readOneRandom(), edm::RootEmbeddedFileSequence::readOneRandomWithID(), edm::RootEmbeddedFileSequence::readOneSequential(), edm::RootEmbeddedFileSequence::readOneSequentialWithID(), edm::RootEmbeddedFileSequence::readOneSpecified(), readRun_(), readRunAuxiliary_(), edm::RootPrimaryFileSequence::reverseState(), edm::RootPrimaryFileSequence::rewind_(), edm::RootPrimaryFileSequence::rewindFile(), edm::RootEmbeddedFileSequence::RootEmbeddedFileSequence(), edm::RootPrimaryFileSequence::RootPrimaryFileSequence(), edm::RootSecondaryFileSequence::RootSecondaryFileSequence(), setIndexIntoFile(), edm::RootEmbeddedFileSequence::skipEntries(), edm::RootPrimaryFileSequence::skipEvents(), skipToItem(), and skipToItemInNewFile().

std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
edm::propagate_const< RootFileSharedPtr > rootFile_
std::shared_ptr<RootFile>& edm::RootInputFileSequence::rootFile ( )
inlineprotected

Definition at line 79 of file RootInputFileSequence.h.

References edm::get_underlying_safe(), and rootFile_.

std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
edm::propagate_const< RootFileSharedPtr > rootFile_
size_t edm::RootInputFileSequence::sequenceNumberOfFile ( ) const
inlineprotected
void edm::RootInputFileSequence::setAtFileSequenceNumber ( size_t  offset)
inlineprotected
void edm::RootInputFileSequence::setAtFirstFile ( )
inlineprotected
void edm::RootInputFileSequence::setAtNextFile ( )
inlineprotected
void edm::RootInputFileSequence::setAtPreviousFile ( )
inlineprotected

Definition at line 65 of file RootInputFileSequence.h.

References fileIter_.

Referenced by edm::RootPrimaryFileSequence::previousFile().

65 {--fileIter_;}
std::vector< FileCatalogItem >::const_iterator fileIter_
void edm::RootInputFileSequence::setIndexIntoFile ( size_t  index)
protected

Definition at line 311 of file RootInputFileSequence.cc.

References cmsHarvester::index, indexesIntoFiles_, and rootFile().

Referenced by initTheFile().

311  {
312  indexesIntoFiles_[index] = rootFile()->indexIntoFileSharedPtr();
313  }
std::vector< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
std::shared_ptr< RootFile const > rootFile() const
void edm::RootInputFileSequence::setNoMoreFiles ( )
inlineprotected

Definition at line 63 of file RootInputFileSequence.h.

References fileIter_, and fileIterEnd_.

Referenced by edm::RootPrimaryFileSequence::skipEvents().

std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
std::vector< FileCatalogItem >::const_iterator fileIter_
bool edm::RootInputFileSequence::skipToItem ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event,
size_t  fileNameHash = 0U,
bool  currentFileFirst = true 
)

Definition at line 159 of file RootInputFileSequence.cc.

References assert(), fileIter_, newFWLiteAna::found, indexesIntoFiles_, initFile(), rootFile(), setAtFileSequenceNumber(), and skipToItemInNewFile().

Referenced by edm::RootEmbeddedFileSequence::readOneRandomWithID(), edm::RootEmbeddedFileSequence::readOneSequentialWithID(), and edm::RootEmbeddedFileSequence::readOneSpecified().

159  {
160  // Attempt to find item in currently open input file.
161  bool found = currentFileFirst && rootFile() && rootFile()->setEntryAtItem(run, lumi, event);
162  if(!found) {
163  // If only one input file, give up now, to save time.
164  if(currentFileFirst && rootFile() && indexesIntoFiles_.size() == 1) {
165  return false;
166  }
167  // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files.
168  for(auto it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
169  if(*it && (*it)->containsItem(run, lumi, event)) {
170  // We found it. Close the currently open file, and open the correct one.
171  std::vector<FileCatalogItem>::const_iterator currentIter = fileIter_;
173  if(fileIter_ != currentIter) {
174  initFile(false);
175  }
176  // Now get the item from the correct file.
177  assert(rootFile());
178  found = rootFile()->setEntryAtItem(run, lumi, event);
179  assert(found);
180  return true;
181  }
182  }
183  return (fileNameHash != 0U && skipToItemInNewFile(run, lumi, event, fileNameHash)) || skipToItemInNewFile(run, lumi, event);
184  }
185  return true;
186  }
void initFile(bool skipBadFiles)
void setAtFileSequenceNumber(size_t offset)
std::vector< FileCatalogItem >::const_iterator fileIter_
tuple lumi
Definition: fjr2json.py:35
assert(m_qm.get())
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::vector< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
std::shared_ptr< RootFile const > rootFile() const
bool skipToItemInNewFile(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
bool edm::RootInputFileSequence::skipToItemInNewFile ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
)
protected

Definition at line 140 of file RootInputFileSequence.cc.

References assert(), newFWLiteAna::found, indexesIntoFiles_, initFile_(), rootFile(), and setAtFileSequenceNumber().

Referenced by edm::RootEmbeddedFileSequence::readOneSequentialWithID(), and skipToItem().

140  {
141  // Look for item in files not yet opened. We do not have a valid hash of the logical file name.
142  for(auto it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) {
143  if(!*it) {
144  // File not yet opened.
146  initFile_(false);
147  assert(rootFile());
148  bool found = rootFile()->setEntryAtItem(run, lumi, event);
149  if(found) {
150  return true;
151  }
152  }
153  }
154  // Not found
155  return false;
156  }
void setAtFileSequenceNumber(size_t offset)
tuple lumi
Definition: fjr2json.py:35
assert(m_qm.get())
virtual void initFile_(bool skipBadFiles)=0
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::vector< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
std::shared_ptr< RootFile const > rootFile() const
bool edm::RootInputFileSequence::skipToItemInNewFile ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event,
size_t  fileNameHash 
)
protected

Definition at line 108 of file RootInputFileSequence.cc.

References assert(), fileIterBegin_, fileIterEnd_, findFileForSpecifiedID_, newFWLiteAna::found, indexesIntoFiles_, initFile_(), rootFile(), and setAtFileSequenceNumber().

108  {
109  // Look for item in files not yet opened. We have a hash of the logical file name
110  assert(fileNameHash != 0U);
111  // If the lookup table is not yet filled in, fill it.
113  // We use a multimap because there may be hash collisions (Two different LFNs could have the same hash).
114  // We map the hash of the LFN to the index into the list of files.
115  findFileForSpecifiedID_ = std::make_unique<std::unordered_multimap<size_t, size_t>>(); // propagate_const<T> has no reset() function
116  auto hasher = std::hash<std::string>();
117  for(auto fileIter = fileIterBegin_; fileIter != fileIterEnd_; ++fileIter) {
118  findFileForSpecifiedID_->insert(std::make_pair(hasher(fileIter->logicalFileName()), fileIter - fileIterBegin_));
119  }
120  }
121  // Look up the logical file name in the table
122  auto range = findFileForSpecifiedID_->equal_range(fileNameHash);
123  for(auto iter = range.first; iter != range.second; ++iter) {
124  // Don't look in files previously opened, because those have already been searched.
125  if(!indexesIntoFiles_[iter->second]) {
126  setAtFileSequenceNumber(iter->second);
127  initFile_(false);
128  assert(rootFile());
129  bool found = rootFile()->setEntryAtItem(run, lumi, event);
130  if(found) {
131  return true;
132  }
133  }
134  }
135  // Not found
136  return false;
137  }
void setAtFileSequenceNumber(size_t offset)
std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
tuple lumi
Definition: fjr2json.py:35
std::vector< FileCatalogItem >::const_iterator const fileIterBegin_
assert(m_qm.get())
virtual void initFile_(bool skipBadFiles)=0
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::vector< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
std::shared_ptr< RootFile const > rootFile() const
edm::propagate_const< std::unique_ptr< std::unordered_multimap< size_t, size_t > > > findFileForSpecifiedID_
bool edm::RootInputFileSequence::usedFallback ( ) const
inlineprotected

Member Data Documentation

InputFileCatalog const& edm::RootInputFileSequence::catalog_
private

Definition at line 81 of file RootInputFileSequence.h.

Referenced by fileCatalogItems().

std::vector<FileCatalogItem>::const_iterator edm::RootInputFileSequence::fileIter_
private
std::vector<FileCatalogItem>::const_iterator const edm::RootInputFileSequence::fileIterBegin_
private
std::vector<FileCatalogItem>::const_iterator const edm::RootInputFileSequence::fileIterEnd_
private
std::vector<FileCatalogItem>::const_iterator edm::RootInputFileSequence::fileIterLastOpened_
private

Definition at line 89 of file RootInputFileSequence.h.

Referenced by initTheFile().

edm::propagate_const<std::unique_ptr<std::unordered_multimap<size_t, size_t> > > edm::RootInputFileSequence::findFileForSpecifiedID_
private

Definition at line 85 of file RootInputFileSequence.h.

Referenced by skipToItemInNewFile().

std::vector<std::shared_ptr<IndexIntoFile> > edm::RootInputFileSequence::indexesIntoFiles_
private
std::string edm::RootInputFileSequence::lfn_
private

Definition at line 82 of file RootInputFileSequence.h.

Referenced by initTheFile(), and lfn().

size_t edm::RootInputFileSequence::lfnHash_
private

Definition at line 83 of file RootInputFileSequence.h.

Referenced by initTheFile(), and lfnHash().

edm::propagate_const<RootFileSharedPtr> edm::RootInputFileSequence::rootFile_
private

Definition at line 90 of file RootInputFileSequence.h.

Referenced by initTheFile(), and rootFile().

bool edm::RootInputFileSequence::usedFallback_
private

Definition at line 84 of file RootInputFileSequence.h.

Referenced by initTheFile(), and usedFallback().