CMS 3D CMS Logo

edm::PoolOutputModule Class Reference

#include <IOPool/Output/src/PoolOutputModule.h>

Inheritance diagram for edm::PoolOutputModule:

edm::OutputModule

List of all members.

Public Types

typedef std::vector< OutputItemOutputItemList
typedef boost::array
< OutputItemList,
NumBranchTypes > 
OutputItemListArray

Public Member Functions

int const & basketSize () const
int const & compressionLevel () const
bool const & dropMetaData () const
bool const & fastCloning () const
std::string const & fileName () const
std::string const & logicalFileName () const
 PoolOutputModule (ParameterSet const &ps)
OutputItemListArray const & selectedOutputItemList () const
int const & splitLevel () const
int const & treeMaxVirtualSize () const
virtual ~PoolOutputModule ()

Private Member Functions

virtual void doOpenFile ()
void fillSelectedItemList (BranchType branchtype, TTree *theTree)
virtual void finishEndFile ()
virtual bool isFileOpen () const
virtual void openFile (FileBlock const &fb)
virtual void respondToCloseInputFile (FileBlock const &fb)
virtual void respondToOpenInputFile (FileBlock const &fb)
virtual bool shouldWeCloseFile () const
 Ask the OutputModule if we should end the current file.
virtual void startEndFile ()
virtual void write (EventPrincipal const &e)
virtual void writeEntryDescriptions ()
virtual void writeEventHistory ()
virtual void writeFileFormatVersion ()
virtual void writeFileIdentifier ()
virtual void writeFileIndex ()
virtual void writeLuminosityBlock (LuminosityBlockPrincipal const &lb)
virtual void writeModuleDescriptionRegistry ()
virtual void writeParameterSetRegistry ()
virtual void writeProcessConfigurationRegistry ()
virtual void writeProcessHistoryRegistry ()
virtual void writeProductDependencies ()
virtual void writeProductDescriptionRegistry ()
virtual void writeRun (RunPrincipal const &r)

Private Attributes

int const basketSize_
std::string const catalog_
int const compressionLevel_
bool dropMetaDataForDroppedData_
bool fastCloning_
std::string const fileName_
int inputFileCount_
std::string const logicalFileName_
unsigned int const maxFileSize_
std::string const moduleLabel_
int outputFileCount_
boost::scoped_ptr< RootOutputFilerootOutputFile_
RootServiceChecker rootServiceChecker_
OutputItemListArray selectedOutputItemList_
int const splitLevel_
int const treeMaxVirtualSize_

Friends

class RootOutputFile

Classes

struct  OutputItem


Detailed Description

Definition at line 25 of file PoolOutputModule.h.


Member Typedef Documentation

typedef std::vector<OutputItem> edm::PoolOutputModule::OutputItemList

Definition at line 66 of file PoolOutputModule.h.

typedef boost::array<OutputItemList, NumBranchTypes> edm::PoolOutputModule::OutputItemListArray

Definition at line 68 of file PoolOutputModule.h.


Constructor & Destructor Documentation

edm::PoolOutputModule::PoolOutputModule ( ParameterSet const &  ps  )  [explicit]

Definition at line 23 of file PoolOutputModule.cc.

References edm::ParameterSet::getUntrackedParameter().

00023                                                              :
00024     OutputModule(pset),
00025     rootServiceChecker_(),
00026     selectedOutputItemList_(), 
00027     fileName_(pset.getUntrackedParameter<std::string>("fileName")),
00028     logicalFileName_(pset.getUntrackedParameter<std::string>("logicalFileName", std::string())),
00029     catalog_(pset.getUntrackedParameter<std::string>("catalog", std::string())),
00030     maxFileSize_(pset.getUntrackedParameter<int>("maxSize", 0x7f000000)),
00031     compressionLevel_(pset.getUntrackedParameter<int>("compressionLevel", 7)),
00032     basketSize_(pset.getUntrackedParameter<int>("basketSize", 16384)),
00033     splitLevel_(pset.getUntrackedParameter<int>("splitLevel", 99)),
00034     treeMaxVirtualSize_(pset.getUntrackedParameter<int>("treeMaxVirtualSize", -1)),
00035     fastCloning_(pset.getUntrackedParameter<bool>("fastCloning", true) && wantAllEvents()),
00036     dropMetaDataForDroppedData_(pset.getUntrackedParameter<bool>("dropMetaDataForDroppedData", false)),
00037     moduleLabel_(pset.getParameter<std::string>("@module_label")),
00038     outputFileCount_(0),
00039     inputFileCount_(0),
00040     rootOutputFile_() {
00041     // We don't use this next parameter, but we read it anyway because it is part
00042     // of the configuration of this module.  An external parser creates the
00043     // configuration by reading this source code.
00044     pset.getUntrackedParameter<ParameterSet>("dataset", ParameterSet());
00045   }

edm::PoolOutputModule::~PoolOutputModule (  )  [virtual]

Definition at line 127 of file PoolOutputModule.cc.

00127                                       {
00128   }


Member Function Documentation

int const& edm::PoolOutputModule::basketSize (  )  const [inline]

Definition at line 33 of file PoolOutputModule.h.

References basketSize_.

Referenced by edm::RootOutputFile::RootOutputFile(), edm::RootOutputFile::writeEntryDescriptions(), edm::RootOutputFile::writeFileFormatVersion(), edm::RootOutputFile::writeFileIdentifier(), edm::RootOutputFile::writeFileIndex(), edm::RootOutputFile::writeModuleDescriptionRegistry(), edm::RootOutputFile::writeParameterSetRegistry(), edm::RootOutputFile::writeProcessHistoryRegistry(), edm::RootOutputFile::writeProductDependencies(), and edm::RootOutputFile::writeProductDescriptionRegistry().

00033 {return basketSize_;}

int const& edm::PoolOutputModule::compressionLevel (  )  const [inline]

Definition at line 32 of file PoolOutputModule.h.

References compressionLevel_.

00032 {return compressionLevel_;}

void edm::PoolOutputModule::doOpenFile (  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 168 of file PoolOutputModule.cc.

References empty, fileName(), inputFileCount_, logicalFileName(), edm::errors::LogicError, offset, outputFileCount_, RootOutputFile, rootOutputFile_, and edm::suffix().

Referenced by openFile().

00168                                     {
00169       if (inputFileCount_ == 0) {
00170         throw edm::Exception(edm::errors::LogicError)
00171           << "Attempt to open output file before input file. "
00172           << "Please report this to the core framework developers.\n";
00173       }
00174       std::string suffix(".root");
00175       std::string::size_type offset = fileName().rfind(suffix);
00176       bool ext = (offset == fileName().size() - suffix.size());
00177       if (!ext) suffix.clear();
00178       std::string fileBase(ext ? fileName().substr(0, offset) : fileName());
00179       std::ostringstream ofilename;
00180       std::ostringstream lfilename;
00181       ofilename << fileBase;
00182       lfilename << logicalFileName();
00183       if (outputFileCount_) {
00184         ofilename << std::setw(3) << std::setfill('0') << outputFileCount_;
00185         if (!logicalFileName().empty()) {
00186           lfilename << std::setw(3) << std::setfill('0') << outputFileCount_;
00187         }
00188       }
00189       ofilename << suffix;
00190       rootOutputFile_.reset(new RootOutputFile(this, ofilename.str(), lfilename.str()));
00191       ++outputFileCount_;
00192   }

bool const& edm::PoolOutputModule::dropMetaData (  )  const [inline]

Definition at line 37 of file PoolOutputModule.h.

References dropMetaDataForDroppedData_.

Referenced by edm::RootOutputFile::fillBranches().

bool const& edm::PoolOutputModule::fastCloning (  )  const [inline]

Definition at line 36 of file PoolOutputModule.h.

References fastCloning_.

Referenced by edm::RootOutputFile::beginInputFile().

00036 {return fastCloning_;}

std::string const& edm::PoolOutputModule::fileName (  )  const [inline]

Definition at line 30 of file PoolOutputModule.h.

References fileName_.

Referenced by doOpenFile().

00030 {return fileName_;}

void edm::PoolOutputModule::fillSelectedItemList ( BranchType  branchtype,
TTree *  theTree 
) [private]

Definition at line 79 of file PoolOutputModule.cc.

References Selections::begin(), Selections::end(), it, edm::OutputModule::keptProducts(), selectedOutputItemList_, and edm::sort_all().

Referenced by respondToOpenInputFile().

00079                                                                                     {
00080 
00081     Selections const& keptVector =    keptProducts()[branchType];
00082     OutputItemList&   outputItemList = selectedOutputItemList_[branchType];
00083 
00084     // Fill outputItemList with an entry for each branch.
00085     for (Selections::const_iterator it = keptVector.begin(), itEnd = keptVector.end(); it != itEnd; ++it) {
00086       BranchDescription const& prod = **it;
00087       outputItemList.push_back(OutputItem(&prod));
00088     }
00089 
00090     // Sort outputItemList to allow fast copying.
00091     // The branches in outputItemList must be in the same order as in the input tree, with all new branches at the end.
00092     sort_all(outputItemList, OutputItem::Sorter(theTree));
00093   }

void edm::PoolOutputModule::finishEndFile (  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 164 of file PoolOutputModule.cc.

References rootOutputFile_.

00164 { rootOutputFile_->finishEndFile(); rootOutputFile_.reset(); }

bool edm::PoolOutputModule::isFileOpen (  )  const [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 165 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by openFile(), and respondToOpenInputFile().

00165 { return rootOutputFile_.get() != 0; }

std::string const& edm::PoolOutputModule::logicalFileName (  )  const [inline]

Definition at line 31 of file PoolOutputModule.h.

References logicalFileName_.

Referenced by doOpenFile().

00031 {return logicalFileName_;}

void edm::PoolOutputModule::openFile ( FileBlock const &  fb  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 95 of file PoolOutputModule.cc.

References doOpenFile(), fastCloning_, edm::FileBlock::fileFormatVersion(), isFileOpen(), respondToOpenInputFile(), edm::FileBlock::tree(), and edm::FileFormatVersion::value_.

00095                                                      {
00096     if (!isFileOpen()) {
00097       if (fb.tree() == 0 || fb.fileFormatVersion().value_ < 8) {
00098         fastCloning_ = false;
00099       }
00100       doOpenFile();
00101       respondToOpenInputFile(fb);
00102     }
00103   }

void edm::PoolOutputModule::respondToCloseInputFile ( FileBlock const &  fb  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 123 of file PoolOutputModule.cc.

References rootOutputFile_.

00123                                                                     {
00124     if (rootOutputFile_) rootOutputFile_->respondToCloseInputFile(fb);
00125   }

void edm::PoolOutputModule::respondToOpenInputFile ( FileBlock const &  fb  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 105 of file PoolOutputModule.cc.

References fastCloning_, fillSelectedItemList(), i, edm::InEvent, edm::InLumi, inputFileCount_, isFileOpen(), edm::FileBlock::lumiTree(), edm::NumBranchTypes, edm::OutputModule::remainingEvents(), rootOutputFile_, edm::FileBlock::runTree(), and edm::FileBlock::tree().

Referenced by openFile().

00105                                                                    {
00106     for (int i = InEvent; i < NumBranchTypes; ++i) {
00107       BranchType branchType = static_cast<BranchType>(i);
00108       if (inputFileCount_ == 0) {
00109         TTree * theTree = (branchType == InEvent ? fb.tree() : 
00110                           (branchType == InLumi ? fb.lumiTree() :
00111                           fb.runTree()));
00112         fillSelectedItemList(branchType, theTree);
00113       }
00114     }
00115     ++inputFileCount_;
00116     if (isFileOpen()) {
00117       bool fastCloneThisOne = fb.tree() != 0 &&
00118                             (remainingEvents() < 0 || remainingEvents() >= fb.tree()->GetEntries());
00119       rootOutputFile_->beginInputFile(fb, fastCloneThisOne && fastCloning_);
00120     }
00121   }

OutputItemListArray const& edm::PoolOutputModule::selectedOutputItemList (  )  const [inline]

Definition at line 70 of file PoolOutputModule.h.

References selectedOutputItemList_.

Referenced by edm::RootOutputFile::fillBranches(), and edm::RootOutputFile::RootOutputFile().

00070 {return selectedOutputItemList_;}

bool edm::PoolOutputModule::shouldWeCloseFile (  )  const [private, virtual]

Ask the OutputModule if we should end the current file.

Reimplemented from edm::OutputModule.

Definition at line 166 of file PoolOutputModule.cc.

References rootOutputFile_.

00166 { return rootOutputFile_->shouldWeCloseFile(); }

int const& edm::PoolOutputModule::splitLevel (  )  const [inline]

Definition at line 34 of file PoolOutputModule.h.

References splitLevel_.

Referenced by edm::RootOutputFile::RootOutputFile().

00034 {return splitLevel_;}

void edm::PoolOutputModule::startEndFile (  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 150 of file PoolOutputModule.cc.

00150 { }

int const& edm::PoolOutputModule::treeMaxVirtualSize (  )  const [inline]

Definition at line 35 of file PoolOutputModule.h.

References treeMaxVirtualSize_.

00035 {return treeMaxVirtualSize_;}

void edm::PoolOutputModule::write ( EventPrincipal const &  e  )  [private, virtual]

Implements edm::OutputModule.

Definition at line 130 of file PoolOutputModule.cc.

References edm::Principal::addToProcessHistory(), edm::OutputModule::hasNewlyDroppedBranch(), edm::InEvent, and rootOutputFile_.

00130                                                       {
00131       if (hasNewlyDroppedBranch()[InEvent]) e.addToProcessHistory();
00132       rootOutputFile_->writeOne(e);
00133   }

void edm::PoolOutputModule::writeEntryDescriptions (  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 163 of file PoolOutputModule.cc.

References rootOutputFile_.

00163 { rootOutputFile_->writeEntryDescriptions(); }

void edm::PoolOutputModule::writeEventHistory (  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 156 of file PoolOutputModule.cc.

References rootOutputFile_.

00156 { rootOutputFile_->writeEventHistory(); }

void edm::PoolOutputModule::writeFileFormatVersion (  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 153 of file PoolOutputModule.cc.

References rootOutputFile_.

00153 { rootOutputFile_->writeFileFormatVersion(); }

void edm::PoolOutputModule::writeFileIdentifier (  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 154 of file PoolOutputModule.cc.

References rootOutputFile_.

00154 { rootOutputFile_->writeFileIdentifier(); }

void edm::PoolOutputModule::writeFileIndex (  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 155 of file PoolOutputModule.cc.

References rootOutputFile_.

00155 { rootOutputFile_->writeFileIndex(); }

void edm::PoolOutputModule::writeLuminosityBlock ( LuminosityBlockPrincipal const &  lb  )  [private, virtual]

Implements edm::OutputModule.

Definition at line 135 of file PoolOutputModule.cc.

References edm::Principal::addToProcessHistory(), edm::OutputModule::hasNewlyDroppedBranch(), edm::LuminosityBlockPrincipal::id(), edm::InLumi, edm::LuminosityBlockID::luminosityBlock(), rootOutputFile_, and edm::LuminosityBlockID::run().

00135                                                                                 {
00136       if (hasNewlyDroppedBranch()[InLumi]) lb.addToProcessHistory();
00137       rootOutputFile_->writeLuminosityBlock(lb);
00138       Service<JobReport> reportSvc;
00139       reportSvc->reportLumiSection(lb.id().run(), lb.id().luminosityBlock());
00140   }

void edm::PoolOutputModule::writeModuleDescriptionRegistry (  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 159 of file PoolOutputModule.cc.

References rootOutputFile_.

00159 { rootOutputFile_->writeModuleDescriptionRegistry(); }

void edm::PoolOutputModule::writeParameterSetRegistry (  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 160 of file PoolOutputModule.cc.

References rootOutputFile_.

00160 { rootOutputFile_->writeParameterSetRegistry(); }

void edm::PoolOutputModule::writeProcessConfigurationRegistry (  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 157 of file PoolOutputModule.cc.

References rootOutputFile_.

00157 { rootOutputFile_->writeProcessConfigurationRegistry(); }

void edm::PoolOutputModule::writeProcessHistoryRegistry (  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 158 of file PoolOutputModule.cc.

References rootOutputFile_.

00158 { rootOutputFile_->writeProcessHistoryRegistry(); }

void edm::PoolOutputModule::writeProductDependencies (  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 162 of file PoolOutputModule.cc.

References rootOutputFile_.

00162 { rootOutputFile_->writeProductDependencies(); }

void edm::PoolOutputModule::writeProductDescriptionRegistry (  )  [private, virtual]

Reimplemented from edm::OutputModule.

Definition at line 161 of file PoolOutputModule.cc.

References rootOutputFile_.

00161 { rootOutputFile_->writeProductDescriptionRegistry(); }

void edm::PoolOutputModule::writeRun ( RunPrincipal const &  r  )  [private, virtual]

Implements edm::OutputModule.

Definition at line 142 of file PoolOutputModule.cc.

References edm::Principal::addToProcessHistory(), edm::OutputModule::hasNewlyDroppedBranch(), edm::InRun, rootOutputFile_, and edm::RunPrincipal::run().

00142                                                        {
00143       if (hasNewlyDroppedBranch()[InRun]) r.addToProcessHistory();
00144       rootOutputFile_->writeRun(r);
00145       Service<JobReport> reportSvc;
00146       reportSvc->reportRunNumber(r.run());
00147   }


Friends And Related Function Documentation

friend class RootOutputFile [friend]

Definition at line 27 of file PoolOutputModule.h.

Referenced by doOpenFile().


Member Data Documentation

int const edm::PoolOutputModule::basketSize_ [private]

Definition at line 108 of file PoolOutputModule.h.

Referenced by basketSize().

std::string const edm::PoolOutputModule::catalog_ [private]

Definition at line 105 of file PoolOutputModule.h.

Referenced by edm::RootOutputFile::RootOutputFile().

int const edm::PoolOutputModule::compressionLevel_ [private]

Definition at line 107 of file PoolOutputModule.h.

Referenced by compressionLevel().

bool edm::PoolOutputModule::dropMetaDataForDroppedData_ [private]

Definition at line 112 of file PoolOutputModule.h.

Referenced by dropMetaData().

bool edm::PoolOutputModule::fastCloning_ [private]

Definition at line 111 of file PoolOutputModule.h.

Referenced by fastCloning(), openFile(), and respondToOpenInputFile().

std::string const edm::PoolOutputModule::fileName_ [private]

Definition at line 103 of file PoolOutputModule.h.

Referenced by fileName().

int edm::PoolOutputModule::inputFileCount_ [private]

Definition at line 115 of file PoolOutputModule.h.

Referenced by doOpenFile(), and respondToOpenInputFile().

std::string const edm::PoolOutputModule::logicalFileName_ [private]

Definition at line 104 of file PoolOutputModule.h.

Referenced by logicalFileName().

unsigned int const edm::PoolOutputModule::maxFileSize_ [private]

Definition at line 106 of file PoolOutputModule.h.

Referenced by edm::RootOutputFile::shouldWeCloseFile().

std::string const edm::PoolOutputModule::moduleLabel_ [private]

Definition at line 113 of file PoolOutputModule.h.

Referenced by edm::RootOutputFile::RootOutputFile().

int edm::PoolOutputModule::outputFileCount_ [private]

Definition at line 114 of file PoolOutputModule.h.

Referenced by doOpenFile().

boost::scoped_ptr<RootOutputFile> edm::PoolOutputModule::rootOutputFile_ [private]

Definition at line 116 of file PoolOutputModule.h.

Referenced by doOpenFile(), finishEndFile(), isFileOpen(), respondToCloseInputFile(), respondToOpenInputFile(), shouldWeCloseFile(), write(), writeEntryDescriptions(), writeEventHistory(), writeFileFormatVersion(), writeFileIdentifier(), writeFileIndex(), writeLuminosityBlock(), writeModuleDescriptionRegistry(), writeParameterSetRegistry(), writeProcessConfigurationRegistry(), writeProcessHistoryRegistry(), writeProductDependencies(), writeProductDescriptionRegistry(), and writeRun().

RootServiceChecker edm::PoolOutputModule::rootServiceChecker_ [private]

Definition at line 101 of file PoolOutputModule.h.

OutputItemListArray edm::PoolOutputModule::selectedOutputItemList_ [private]

Definition at line 102 of file PoolOutputModule.h.

Referenced by fillSelectedItemList(), and selectedOutputItemList().

int const edm::PoolOutputModule::splitLevel_ [private]

Definition at line 109 of file PoolOutputModule.h.

Referenced by splitLevel().

int const edm::PoolOutputModule::treeMaxVirtualSize_ [private]

Definition at line 110 of file PoolOutputModule.h.

Referenced by treeMaxVirtualSize().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:42:59 2009 for CMSSW by  doxygen 1.5.4