#include <LuminosityBlock.h>
Public Member Functions | |
virtual bool | atEnd () const |
std::vector < edm::BranchDescription > const & | getBranchDescriptions () const |
virtual std::string const | getBranchNameFor (std::type_info const &, char const *, char const *, char const *) const |
virtual bool | getByLabel (std::type_info const &, char const *, char const *, char const *, void *) const |
virtual bool | getByLabel (std::type_info const &, char const *, char const *, char const *, edm::WrapperHolder &) const |
edm::WrapperHolder | getByProductID (edm::ProductID const &) const |
fwlite::Run const & | getRun () const |
bool | isValid () const |
LuminosityBlock (boost::shared_ptr< BranchMapReader > branchMap, boost::shared_ptr< RunFactory > runFactory) | |
LuminosityBlock (TFile *iFile) | |
virtual edm::LuminosityBlockAuxiliary const & | luminosityBlockAuxiliary () const |
operator bool () const | |
const LuminosityBlock & | operator++ () |
Long64_t | size () const |
bool | to (edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi) |
Go to event by Run & LuminosityBlock number. | |
const LuminosityBlock & | toBegin () |
virtual | ~LuminosityBlock () |
Static Public Member Functions | |
static void | throwProductNotFoundException (std::type_info const &, char const *, char const *, char const *) |
Private Member Functions | |
const edm::ProcessHistory & | history () const |
LuminosityBlock (const LuminosityBlock &) | |
const LuminosityBlock & | operator= (const LuminosityBlock &) |
void | updateAux (Long_t lumiIndex) const |
Private Attributes | |
edm::LuminosityBlockAuxiliary | aux_ |
TBranch * | auxBranch_ |
boost::shared_ptr < BranchMapReader > | branchMap_ |
DataGetterHelper | dataHelper_ |
EntryFinder | entryFinder_ |
int | fileVersion_ |
edm::ProcessHistoryMap | historyMap_ |
std::vector< char const * > | labels_ |
edm::LuminosityBlockAuxiliary * | pAux_ |
edm::LuminosityBlockAux * | pOldAux_ |
std::vector< std::string > | procHistoryNames_ |
boost::shared_ptr< fwlite::Run > | run_ |
boost::shared_ptr< RunFactory > | runFactory_ |
Friends | |
class | internal::ProductGetter |
class | LumiHistoryGetter |
Definition at line 58 of file LuminosityBlock.h.
LuminosityBlock::LuminosityBlock | ( | TFile * | iFile | ) |
Definition at line 45 of file LuminosityBlock.cc.
References auxBranch_, branchMap_, edm::BranchTypeToAuxiliaryBranchName(), Exception, fileVersion_, edm::InLumi, edm::poolNames::luminosityBlockTreeName(), pAux_, and runFactory_.
: branchMap_(new BranchMapReader(iFile)), pAux_(&aux_), pOldAux_(0), fileVersion_(-1), dataHelper_(branchMap_->getLuminosityBlockTree(), boost::shared_ptr<HistoryGetterBase>(new LumiHistoryGetter(this)), branchMap_) { if(0==iFile) { throw cms::Exception("NoFile")<<"The TFile pointer passed to the constructor was null"; } if(0==branchMap_->getLuminosityBlockTree()) { throw cms::Exception("NoLumiTree")<<"The TFile contains no TTree named " <<edm::poolNames::luminosityBlockTreeName(); } //need to know file version in order to determine how to read the basic product info fileVersion_ = branchMap_->getFileVersion(iFile); //got this logic from IOPool/Input/src/RootFile.cc TTree* luminosityBlockTree = branchMap_->getLuminosityBlockTree(); if(fileVersion_ >= 3) { auxBranch_ = luminosityBlockTree->GetBranch(edm::BranchTypeToAuxiliaryBranchName(edm::InLumi).c_str()); if(0==auxBranch_) { throw cms::Exception("NoLuminosityBlockAuxilliary")<<"The TTree " <<edm::poolNames::luminosityBlockTreeName() <<" does not contain a branch named 'LuminosityBlockAuxiliary'"; } auxBranch_->SetAddress(&pAux_); } else { throw cms::Exception("OldFileVersion")<<"The FWLite Luminosity Block code des not support old file versions"; // This code commented from fwlite::Event. May be portable if needed. // pOldAux_ = new edm::EventAux(); // auxBranch_ = luminosityBlockTree->GetBranch(edm::BranchTypeToAuxBranchName(edm::InLuminosityBlock).c_str()); // if(0==auxBranch_) { // throw cms::Exception("NoLuminosityBlockAux")<<"The TTree " // <<edm::poolNames::luminosityBlockTreeName() // <<" does not contain a branch named 'LuminosityBlockAux'"; // } // auxBranch_->SetAddress(&pOldAux_); } branchMap_->updateLuminosityBlock(0); runFactory_ = boost::shared_ptr<RunFactory>(new RunFactory()); }
LuminosityBlock::LuminosityBlock | ( | boost::shared_ptr< BranchMapReader > | branchMap, |
boost::shared_ptr< RunFactory > | runFactory | ||
) |
Definition at line 91 of file LuminosityBlock.cc.
References auxBranch_, branchMap_, edm::BranchTypeToAuxiliaryBranchName(), Exception, fileVersion_, edm::InLumi, edm::poolNames::luminosityBlockTreeName(), and pAux_.
: branchMap_(branchMap), pAux_(&aux_), pOldAux_(0), fileVersion_(-1), dataHelper_(branchMap_->getLuminosityBlockTree(), boost::shared_ptr<HistoryGetterBase>(new LumiHistoryGetter(this)), branchMap_), runFactory_(runFactory) { if(0==branchMap_->getLuminosityBlockTree()) { throw cms::Exception("NoLumiTree")<<"The TFile contains no TTree named " <<edm::poolNames::luminosityBlockTreeName(); } //need to know file version in order to determine how to read the basic event info fileVersion_ = branchMap_->getFileVersion(); //got this logic from IOPool/Input/src/RootFile.cc TTree* luminosityBlockTree = branchMap_->getLuminosityBlockTree(); if(fileVersion_ >= 3) { auxBranch_ = luminosityBlockTree->GetBranch(edm::BranchTypeToAuxiliaryBranchName(edm::InLumi).c_str()); if(0==auxBranch_) { throw cms::Exception("NoLuminosityBlockAuxilliary")<<"The TTree " <<edm::poolNames::luminosityBlockTreeName() <<" does not contain a branch named 'LuminosityBlockAuxiliary'"; } auxBranch_->SetAddress(&pAux_); } else { throw cms::Exception("OldFileVersion")<<"The FWLite Luminosity Block code des not support old file versions"; /* pOldAux_ = new edm::EventAux(); auxBranch_ = luminosityBlockTree->GetBranch(edm::BranchTypeToAuxBranchName(edm::InLuminosityBlock).c_str()); if(0==auxBranch_) { throw cms::Exception("NoLuminosityBlockAux")<<"The TTree " <<edm::poolNames::luminosityBlockTreeName() <<" does not contain a branch named 'LuminosityBlockAux'"; } auxBranch_->SetAddress(&pOldAux_);*/ } branchMap_->updateLuminosityBlock(0); // if(fileVersion_ >= 7) { // eventHistoryTree_ = dynamic_cast<TTree*>(iFile->Get(edm::poolNames::eventHistoryTreeName().c_str())); // } }
LuminosityBlock::~LuminosityBlock | ( | ) | [virtual] |
fwlite::LuminosityBlock::LuminosityBlock | ( | const LuminosityBlock & | ) | [private] |
bool LuminosityBlock::atEnd | ( | ) | const [virtual] |
Implements fwlite::LuminosityBlockBase.
Definition at line 204 of file LuminosityBlock.cc.
References branchMap_, and size().
Referenced by getByLabel(), and main().
{ Long_t luminosityBlockIndex = branchMap_->getLuminosityBlockEntry(); return luminosityBlockIndex==-1 or luminosityBlockIndex == size(); }
std::vector<edm::BranchDescription> const& fwlite::LuminosityBlock::getBranchDescriptions | ( | ) | const [inline] |
Definition at line 96 of file LuminosityBlock.h.
References branchMap_.
{ return branchMap_->getBranchDescriptions(); }
std::string const LuminosityBlock::getBranchNameFor | ( | std::type_info const & | iInfo, |
char const * | iModuleLabel, | ||
char const * | iProductInstanceLabel, | ||
char const * | iProcessLabel | ||
) | const [virtual] |
Definition at line 212 of file LuminosityBlock.cc.
References dataHelper_, and fwlite::DataGetterHelper::getBranchNameFor().
{ return dataHelper_.getBranchNameFor(iInfo, iModuleLabel, iProductInstanceLabel, iProcessLabel); }
bool LuminosityBlock::getByLabel | ( | std::type_info const & | iInfo, |
char const * | iModuleLabel, | ||
char const * | iProductInstanceLabel, | ||
char const * | iProcessLabel, | ||
void * | oData | ||
) | const [virtual] |
Implements fwlite::LuminosityBlockBase.
Definition at line 222 of file LuminosityBlock.cc.
References atEnd(), branchMap_, dataHelper_, Exception, and fwlite::DataGetterHelper::getByLabel().
{ if(atEnd()) { throw cms::Exception("OffEnd")<<"You have requested data past the last lumi"; } Long_t lumiIndex = branchMap_->getLuminosityBlockEntry(); return dataHelper_.getByLabel(iInfo, iModuleLabel, iProductInstanceLabel, iProcessLabel, oData, lumiIndex); }
bool LuminosityBlock::getByLabel | ( | std::type_info const & | iInfo, |
char const * | iModuleLabel, | ||
char const * | iProductInstanceLabel, | ||
char const * | iProcessLabel, | ||
edm::WrapperHolder & | holder | ||
) | const [virtual] |
Implements fwlite::LuminosityBlockBase.
Definition at line 236 of file LuminosityBlock.cc.
References atEnd(), branchMap_, dataHelper_, Exception, and fwlite::DataGetterHelper::getByLabel().
{ if(atEnd()) { throw cms::Exception("OffEnd") << "You have requested data past the last lumi"; } Long_t lumiIndex = branchMap_->getLuminosityBlockEntry(); return dataHelper_.getByLabel(iInfo, iModuleLabel, iProductInstanceLabel, iProcessLabel, holder, lumiIndex); }
edm::WrapperHolder LuminosityBlock::getByProductID | ( | edm::ProductID const & | iID | ) | const |
Definition at line 334 of file LuminosityBlock.cc.
References branchMap_, dataHelper_, and fwlite::DataGetterHelper::getByProductID().
{ Long_t luminosityBlockIndex = branchMap_->getLuminosityBlockEntry(); return dataHelper_.getByProductID(iID, luminosityBlockIndex); }
fwlite::Run const & LuminosityBlock::getRun | ( | ) | const |
Definition at line 359 of file LuminosityBlock.cc.
References branchMap_, luminosityBlockAuxiliary(), edm::LuminosityBlockBase::run(), edm::LuminosityBlockAuxiliary::run(), run_, and runFactory_.
Referenced by main().
{ run_ = runFactory_->makeRun(boost::shared_ptr<BranchMapReader>(&*branchMap_,NoDelete())); edm::RunNumber_t run = luminosityBlockAuxiliary().run(); run_->to(run); return *run_; }
const edm::ProcessHistory & LuminosityBlock::history | ( | ) | const [private] |
Definition at line 270 of file LuminosityBlock.cc.
References aux_, b, branchMap_, alignCSCRings::e, Exception, fileVersion_, historyMap_, i, edm::poolNames::metaDataTreeName(), edm::poolNames::processHistoryBranchName(), edm::LuminosityBlockAuxiliary::processHistoryID(), edm::poolNames::processHistoryMapBranchName(), procHistoryNames_, and updateAux().
Referenced by fwlite::LumiHistoryGetter::history().
{ edm::ProcessHistoryID processHistoryID; bool newFormat = false;//(fileVersion_ >= 5); Long_t lumiIndex = branchMap_->getLuminosityBlockEntry(); updateAux(lumiIndex); if (!newFormat) { processHistoryID = aux_.processHistoryID(); } if(historyMap_.empty() || newFormat) { procHistoryNames_.clear(); TTree *meta = dynamic_cast<TTree*>(branchMap_->getFile()->Get(edm::poolNames::metaDataTreeName().c_str())); if(0==meta) { throw cms::Exception("NoMetaTree")<<"The TFile does not appear to contain a TTree named " <<edm::poolNames::metaDataTreeName(); } if (historyMap_.empty()) { if (fileVersion_ < 11) { edm::ProcessHistoryMap* pPhm=&historyMap_; TBranch* b = meta->GetBranch(edm::poolNames::processHistoryMapBranchName().c_str()); b->SetAddress(&pPhm); b->GetEntry(0); } else { edm::ProcessHistoryVector historyVector; edm::ProcessHistoryVector* pPhv=&historyVector; TBranch* b = meta->GetBranch(edm::poolNames::processHistoryBranchName().c_str()); b->SetAddress(&pPhv); b->GetEntry(0); for (edm::ProcessHistoryVector::const_iterator i = historyVector.begin(), e = historyVector.end(); i != e; ++i) { historyMap_.insert(std::make_pair(i->id(), *i)); } } } // if (newFormat) { // if (fileVersion_ >= 7) { // edm::History history; // edm::History* pHistory = &history; // TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(edm::poolNames::eventHistoryBranchName().c_str()); // if (!eventHistoryBranch) // throw edm::Exception(edm::errors::FatalRootError) // << "Failed to find history branch in event history tree"; // eventHistoryBranch->SetAddress(&pHistory); // eventHistoryTree_->GetEntry(lumiIndex); // processHistoryID = history.processHistoryID(); // } else { // std::vector<edm::EventProcessHistoryID> *pEventProcessHistoryIDs = &eventProcessHistoryIDs_; // TBranch* b = meta->GetBranch(edm::poolNames::eventHistoryBranchName().c_str()); // b->SetAddress(&pEventProcessHistoryIDs); // b->GetEntry(0); // edm::EventProcessHistoryID target(aux_.id(), edm::ProcessHistoryID()); // processHistoryID = std::lower_bound(eventProcessHistoryIDs_.begin(), eventProcessHistoryIDs_.end(), target)->processHistoryID_; // } // } } return historyMap_[processHistoryID]; }
bool LuminosityBlock::isValid | ( | void | ) | const |
Definition at line 191 of file LuminosityBlock.cc.
References branchMap_, and size().
Referenced by operator bool().
{ Long_t luminosityBlockIndex = branchMap_->getLuminosityBlockEntry(); return luminosityBlockIndex!=-1 and luminosityBlockIndex < size(); }
edm::LuminosityBlockAuxiliary const & LuminosityBlock::luminosityBlockAuxiliary | ( | ) | const [virtual] |
Implements edm::LuminosityBlockBase.
Definition at line 249 of file LuminosityBlock.cc.
References aux_, branchMap_, and updateAux().
Referenced by getRun().
{ Long_t luminosityBlockIndex = branchMap_->getLuminosityBlockEntry(); updateAux(luminosityBlockIndex); return aux_; }
LuminosityBlock::operator bool | ( | ) | const |
const LuminosityBlock & LuminosityBlock::operator++ | ( | ) | [virtual] |
Implements fwlite::LuminosityBlockBase.
Definition at line 152 of file LuminosityBlock.cc.
References branchMap_, and size().
{ Long_t luminosityBlockIndex = branchMap_->getLuminosityBlockEntry(); if(luminosityBlockIndex < size()) { branchMap_->updateLuminosityBlock(++luminosityBlockIndex); } return *this; }
const LuminosityBlock& fwlite::LuminosityBlock::operator= | ( | const LuminosityBlock & | ) | [private] |
Long64_t LuminosityBlock::size | ( | void | ) | const |
Definition at line 185 of file LuminosityBlock.cc.
References branchMap_.
Referenced by atEnd(), isValid(), and operator++().
{ return branchMap_->getLuminosityBlockTree()->GetEntries(); }
void LuminosityBlock::throwProductNotFoundException | ( | std::type_info const & | iType, |
char const * | iModule, | ||
char const * | iProduct, | ||
char const * | iProcess | ||
) | [static] |
Definition at line 344 of file LuminosityBlock.cc.
References edm::TypeID::className(), Exception, and edm::errors::ProductNotFound.
{ edm::TypeID type(iType); throw edm::Exception(edm::errors::ProductNotFound)<<"A branch was found for \n type ='"<<type.className()<<"'\n module='"<<iModule <<"'\n productInstance='"<<((0!=iProduct)?iProduct:"")<<"'\n process='"<<((0!=iProcess)?iProcess:"")<<"'\n" "but no data is available for this LuminosityBlock"; }
bool LuminosityBlock::to | ( | edm::RunNumber_t | run, |
edm::LuminosityBlockNumber_t | lumi | ||
) |
Go to event by Run & LuminosityBlock number.
Definition at line 164 of file LuminosityBlock.cc.
References branchMap_, entryFinder_, fwlite::EntryFinder::fillIndex(), fwlite::EntryFinder::findLumi(), and fwlite::EntryFinder::invalidEntry.
{ entryFinder_.fillIndex(*branchMap_); EntryFinder::EntryNumber_t entry = entryFinder_.findLumi(run, luminosityBlock); if (entry == EntryFinder::invalidEntry) { return false; } return branchMap_->updateLuminosityBlock(entry); }
const LuminosityBlock & LuminosityBlock::toBegin | ( | ) | [virtual] |
Implements fwlite::LuminosityBlockBase.
Definition at line 175 of file LuminosityBlock.cc.
References branchMap_.
Referenced by main().
{ branchMap_->updateLuminosityBlock(0); return *this; }
void LuminosityBlock::updateAux | ( | Long_t | lumiIndex | ) | const [private] |
Definition at line 257 of file LuminosityBlock.cc.
References aux_, auxBranch_, edm::conversion(), and pOldAux_.
Referenced by history(), and luminosityBlockAuxiliary().
{ if(auxBranch_->GetEntryNumber() != luminosityBlockIndex) { auxBranch_->GetEntry(luminosityBlockIndex); //handling dealing with old version if(0 != pOldAux_) { conversion(*pOldAux_,aux_); } } }
friend class internal::ProductGetter [friend] |
Definition at line 111 of file LuminosityBlock.h.
friend class LumiHistoryGetter [friend] |
Definition at line 112 of file LuminosityBlock.h.
edm::LuminosityBlockAuxiliary fwlite::LuminosityBlock::aux_ [mutable, private] |
Definition at line 131 of file LuminosityBlock.h.
Referenced by history(), luminosityBlockAuxiliary(), and updateAux().
TBranch* fwlite::LuminosityBlock::auxBranch_ [private] |
Definition at line 135 of file LuminosityBlock.h.
Referenced by LuminosityBlock(), and updateAux().
boost::shared_ptr<BranchMapReader> fwlite::LuminosityBlock::branchMap_ [mutable, private] |
Definition at line 123 of file LuminosityBlock.h.
Referenced by atEnd(), getBranchDescriptions(), getByLabel(), getByProductID(), getRun(), history(), isValid(), LuminosityBlock(), luminosityBlockAuxiliary(), operator++(), size(), to(), and toBegin().
Definition at line 138 of file LuminosityBlock.h.
Referenced by getBranchNameFor(), getByLabel(), and getByProductID().
EntryFinder fwlite::LuminosityBlock::entryFinder_ [mutable, private] |
Definition at line 132 of file LuminosityBlock.h.
Referenced by to().
int fwlite::LuminosityBlock::fileVersion_ [private] |
Definition at line 136 of file LuminosityBlock.h.
Referenced by history(), and LuminosityBlock().
edm::ProcessHistoryMap fwlite::LuminosityBlock::historyMap_ [mutable, private] |
Definition at line 129 of file LuminosityBlock.h.
Referenced by history().
std::vector<char const*> fwlite::LuminosityBlock::labels_ [mutable, private] |
Definition at line 128 of file LuminosityBlock.h.
Referenced by ~LuminosityBlock().
Definition at line 133 of file LuminosityBlock.h.
Referenced by LuminosityBlock().
Definition at line 134 of file LuminosityBlock.h.
Referenced by updateAux(), and ~LuminosityBlock().
std::vector<std::string> fwlite::LuminosityBlock::procHistoryNames_ [mutable, private] |
Definition at line 130 of file LuminosityBlock.h.
Referenced by history().
boost::shared_ptr<fwlite::Run> fwlite::LuminosityBlock::run_ [mutable, private] |
Definition at line 125 of file LuminosityBlock.h.
Referenced by getRun().
boost::shared_ptr<RunFactory> fwlite::LuminosityBlock::runFactory_ [mutable, private] |
Definition at line 139 of file LuminosityBlock.h.
Referenced by getRun(), and LuminosityBlock().