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 | Protected Member Functions | Private Member Functions | Private Attributes | Friends
edm::global::OutputModuleBase Class Referenceabstract

#include <OutputModuleBase.h>

Inheritance diagram for edm::global::OutputModuleBase:
edm::EDConsumerBase edm::global::OutputModule< T > edm::global::outputmodule::InputFileWatcher edm::global::OutputModule<> edm::AsciiOutputModule

Public Types

typedef OutputModuleBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

BranchIDLists const * branchIDLists ()
 
std::array< bool,
NumBranchTypes > const & 
hasNewlyDroppedBranch () const
 
SelectedProductsForBranchType
const & 
keptProducts () const
 
int maxEvents () const
 
const ModuleDescriptionmoduleDescription () const
 
OutputModuleBaseoperator= (OutputModuleBase const &)=delete
 
 OutputModuleBase (ParameterSet const &pset)
 
 OutputModuleBase (OutputModuleBase const &)=delete
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg, ThinnedAssociationsHelper const &)
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
virtual ~OutputModuleBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc)
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Protected Member Functions

void configure (OutputModuleDescription const &desc)
 
ModuleDescription const & description () const
 
void doBeginJob ()
 
bool doBeginLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
 
bool doBeginRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
void doBeginStream (StreamID id)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
 
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
void doEndStream (StreamID id)
 
bool doEvent (EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
void doStreamBeginLuminosityBlock (StreamID id, LuminosityBlockPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
 
void doStreamBeginRun (StreamID id, RunPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
 
void doStreamEndLuminosityBlock (StreamID id, LuminosityBlockPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
 
void doStreamEndRun (StreamID id, RunPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
 
std::map< BranchID::value_type,
BranchID::value_type > const & 
droppedBranchIDToKeptBranchID ()
 
ParameterSetID selectorConfig () const
 
void setEventSelectionInfo (std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

virtual void beginJob ()
 
virtual void doBeginLuminosityBlock_ (LuminosityBlockPrincipal const &, ModuleCallingContext const *)
 
virtual void doBeginLuminosityBlockSummary_ (LuminosityBlock const &, EventSetup const &)
 
virtual void doBeginRun_ (RunPrincipal const &, ModuleCallingContext const *)
 
virtual void doBeginRunSummary_ (Run const &, EventSetup const &)
 
virtual void doBeginStream_ (StreamID)
 
void doCloseFile ()
 Tell the OutputModule that is must end the current file. More...
 
virtual void doEndLuminosityBlock_ (LuminosityBlockPrincipal const &, ModuleCallingContext const *)
 
virtual void doEndLuminosityBlockSummary_ (LuminosityBlock const &, EventSetup const &)
 
virtual void doEndRun_ (RunPrincipal const &, ModuleCallingContext const *)
 
virtual void doEndRunSummary_ (Run const &, EventSetup const &)
 
virtual void doEndStream_ (StreamID)
 
void doOpenFile (FileBlock const &fb)
 
void doPostForkReacquireResources (unsigned int iChildIndex, unsigned int iNumberOfChildren)
 
void doPreForkReleaseResources ()
 
void doRegisterThinnedAssociations (ProductRegistry const &, ThinnedAssociationsHelper &)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
virtual void doRespondToCloseInputFile_ (FileBlock const &)
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
virtual void doRespondToOpenInputFile_ (FileBlock const &)
 
virtual void doStreamBeginLuminosityBlock_ (StreamID, LuminosityBlock const &, EventSetup const &)
 
virtual void doStreamBeginRun_ (StreamID, Run const &, EventSetup const &)
 
virtual void doStreamEndLuminosityBlock_ (StreamID, LuminosityBlock const &, EventSetup const &)
 
virtual void doStreamEndLuminosityBlockSummary_ (StreamID, LuminosityBlock const &, EventSetup const &)
 
virtual void doStreamEndRun_ (StreamID, Run const &, EventSetup const &)
 
virtual void doStreamEndRunSummary_ (StreamID, Run const &, EventSetup const &)
 
void doWriteLuminosityBlock (LuminosityBlockPrincipal const &lbp, ModuleCallingContext const *)
 
void doWriteRun (RunPrincipal const &rp, ModuleCallingContext const *)
 
virtual void endJob ()
 
virtual bool isFileOpen () const
 
void keepThisBranch (BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc, std::set< BranchID > &keptProductsInEvent)
 
bool limitReached () const
 
void maybeOpenFile ()
 
virtual void openFile (FileBlock const &)
 
virtual void postForkReacquireResources (unsigned int, unsigned int)
 
virtual void preallocStreams (unsigned int)
 
virtual void preForkReleaseResources ()
 
bool prePrefetchSelection (StreamID id, EventPrincipal const &, ModuleCallingContext const *)
 
virtual void reallyCloseFile ()
 
virtual void reallyOpenFile ()
 
void registerProductsAndCallbacks (OutputModuleBase const *, ProductRegistry const *)
 
void setModuleDescription (ModuleDescription const &md)
 
virtual bool shouldWeCloseFile () const
 Ask the OutputModule if we should end the current file. More...
 
std::string workerType () const
 
virtual void write (EventPrincipal const &e, ModuleCallingContext const *)=0
 
virtual void writeLuminosityBlock (LuminosityBlockPrincipal const &, ModuleCallingContext const *)=0
 
virtual void writeRun (RunPrincipal const &, ModuleCallingContext const *)=0
 

Private Attributes

edm::propagate_const
< std::unique_ptr
< BranchIDLists > > 
branchIDLists_
 
std::map< BranchID::value_type,
BranchID::value_type
droppedBranchIDToKeptBranchID_
 
std::array< bool, NumBranchTypeshasNewlyDroppedBranch_
 
std::map< BranchID, bool > keepAssociation_
 
SelectedProductsForBranchType keptProducts_
 
int maxEvents_
 
ModuleDescription moduleDescription_
 
BranchIDLists const * origBranchIDLists_
 
std::string process_name_
 
ProductSelector productSelector_
 
ProductSelectorRules productSelectorRules_
 
std::atomic< int > remainingEvents_
 
ParameterSet selectEvents_
 
ParameterSetID selector_config_id_
 
std::vector
< detail::TriggerResultsBasedEventSelector
selectors_
 
edm::propagate_const
< std::unique_ptr
< ThinnedAssociationsHelper > > 
thinnedAssociationsHelper_
 
bool wantAllEvents_
 

Friends

template<typename T >
class ::edm::OutputModuleCommunicatorT
 
template<typename T >
class ::edm::WorkerT
 
template<typename U >
class edm::maker::ModuleHolderT
 

Detailed Description

Definition at line 60 of file OutputModuleBase.h.

Member Typedef Documentation

Definition at line 65 of file OutputModuleBase.h.

Constructor & Destructor Documentation

OutputModuleBase::OutputModuleBase ( ParameterSet const &  pset)
explicit

Definition at line 40 of file OutputModuleBase.cc.

References edm::detail::configureEventSelector(), edm::getAllTriggerNames(), edm::ParameterSet::getUntrackedParameterSet(), hasNewlyDroppedBranch_, edm::ParameterSet::id(), process_name_, edm::ParameterSet::registerIt(), selectEvents_, selector_config_id_, selectors_, and wantAllEvents_.

40  :
41  maxEvents_(-1),
43  keptProducts_(),
45  process_name_(),
46  productSelectorRules_(pset, "outputCommands", "OutputModule"),
49  wantAllEvents_(false),
50  selectors_(),
54  origBranchIDLists_(nullptr),
55  thinnedAssociationsHelper_(new ThinnedAssociationsHelper) {
56 
57  hasNewlyDroppedBranch_.fill(false);
58 
60  process_name_ = tns->getProcessName();
61 
63  pset.getUntrackedParameterSet("SelectEvents", ParameterSet());
64 
65  selectEvents_.registerIt(); // Just in case this PSet is not registered
66 
68 
69  //need to set wantAllEvents_ in constructor
70  // we will make the remaining selectors once we know how many streams
71  selectors_.resize(1);
75  selectors_[0]);
76 
77  }
BranchIDLists const * origBranchIDLists_
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
ParameterSetID id() const
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
SelectedProductsForBranchType keptProducts_
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
ModuleDescription moduleDescription_
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
edm::propagate_const< std::unique_ptr< BranchIDLists > > branchIDLists_
ProductSelectorRules productSelectorRules_
std::atomic< int > remainingEvents_
std::vector< std::string > const & getAllTriggerNames()
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector)
ParameterSet const & registerIt()
OutputModuleBase::~OutputModuleBase ( )
virtual

Definition at line 178 of file OutputModuleBase.cc.

178 { }
edm::global::OutputModuleBase::OutputModuleBase ( OutputModuleBase const &  )
delete

Member Function Documentation

const std::string & OutputModuleBase::baseType ( )
static

Definition at line 376 of file OutputModuleBase.cc.

References edm::global::kBaseType().

376  {
377  return kBaseType;
378  }
static const std::string kBaseType("EDAnalyzer")
virtual void edm::global::OutputModuleBase::beginJob ( void  )
inlineprivatevirtual

Definition at line 233 of file OutputModuleBase.h.

Referenced by doBeginJob().

233 {}
BranchIDLists const * OutputModuleBase::branchIDLists ( )

Definition at line 322 of file OutputModuleBase.cc.

References branchIDLists_, droppedBranchIDToKeptBranchID_, and origBranchIDLists_.

322  {
323  if(!droppedBranchIDToKeptBranchID_.empty()) {
324  // Make a private copy of the BranchIDLists.
326  // Check for branches dropped while an EDAlias was kept.
327  for(BranchIDList& branchIDList : *branchIDLists_) {
328  for(BranchID::value_type& branchID : branchIDList) {
329  // Replace BranchID of each dropped branch with that of the kept alias, so the alias branch will have the product ID of the original branch.
330  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID_.find(branchID);
331  if(iter != droppedBranchIDToKeptBranchID_.end()) {
332  branchID = iter->second;
333  }
334  }
335  }
336  return branchIDLists_.get();
337  }
338  return origBranchIDLists_;
339  }
BranchIDLists const * origBranchIDLists_
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
unsigned int value_type
Definition: BranchID.h:16
edm::propagate_const< std::unique_ptr< BranchIDLists > > branchIDLists_
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
void OutputModuleBase::configure ( OutputModuleDescription const &  desc)
protected
ModuleDescription const & OutputModuleBase::description ( ) const
protected

Definition at line 347 of file OutputModuleBase.cc.

References moduleDescription_.

Referenced by setEventSelectionInfo().

347  {
348  return moduleDescription_;
349  }
ModuleDescription moduleDescription_
void OutputModuleBase::doBeginJob ( )
protected

Definition at line 197 of file OutputModuleBase.cc.

References beginJob().

197  {
198  this->beginJob();
199  }
bool OutputModuleBase::doBeginLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 259 of file OutputModuleBase.cc.

References doBeginLuminosityBlock_().

261  {
262  doBeginLuminosityBlock_(lbp, mcc);
263  return true;
264  }
virtual void doBeginLuminosityBlock_(LuminosityBlockPrincipal const &, ModuleCallingContext const *)
virtual void edm::global::OutputModuleBase::doBeginLuminosityBlock_ ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual

Definition at line 258 of file OutputModuleBase.h.

Referenced by doBeginLuminosityBlock().

258 {}
virtual void edm::global::OutputModuleBase::doBeginLuminosityBlockSummary_ ( LuminosityBlock const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 259 of file OutputModuleBase.h.

259 {}
bool OutputModuleBase::doBeginRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 237 of file OutputModuleBase.cc.

References doBeginRun_().

239  {
240  doBeginRun_(rp, mcc);
241  return true;
242  }
virtual void doBeginRun_(RunPrincipal const &, ModuleCallingContext const *)
virtual void edm::global::OutputModuleBase::doBeginRun_ ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual

Definition at line 254 of file OutputModuleBase.h.

Referenced by doBeginRun().

254 {}
virtual void edm::global::OutputModuleBase::doBeginRunSummary_ ( Run const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 255 of file OutputModuleBase.h.

255 {}
void edm::global::OutputModuleBase::doBeginStream ( StreamID  id)
protected
virtual void edm::global::OutputModuleBase::doBeginStream_ ( StreamID  )
inlineprivatevirtual

Definition at line 245 of file OutputModuleBase.h.

245 {}
void OutputModuleBase::doCloseFile ( )
private

Tell the OutputModule that is must end the current file.

Definition at line 312 of file OutputModuleBase.cc.

References isFileOpen(), and reallyCloseFile().

312  {
313  if(isFileOpen()) {
314  reallyCloseFile();
315  }
316  }
virtual bool isFileOpen() const
void OutputModuleBase::doEndJob ( )
protected

Definition at line 201 of file OutputModuleBase.cc.

References endJob().

201  {
202  endJob();
203  }
bool OutputModuleBase::doEndLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 267 of file OutputModuleBase.cc.

References doEndLuminosityBlock_().

269  {
270  doEndLuminosityBlock_(lbp, mcc);
271  return true;
272  }
virtual void doEndLuminosityBlock_(LuminosityBlockPrincipal const &, ModuleCallingContext const *)
virtual void edm::global::OutputModuleBase::doEndLuminosityBlock_ ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual

Definition at line 260 of file OutputModuleBase.h.

Referenced by doEndLuminosityBlock().

260 {}
virtual void edm::global::OutputModuleBase::doEndLuminosityBlockSummary_ ( LuminosityBlock const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 261 of file OutputModuleBase.h.

261 {}
bool OutputModuleBase::doEndRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 245 of file OutputModuleBase.cc.

References doEndRun_().

247  {
248  doEndRun_(rp, mcc);
249  return true;
250  }
virtual void doEndRun_(RunPrincipal const &, ModuleCallingContext const *)
virtual void edm::global::OutputModuleBase::doEndRun_ ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual

Definition at line 256 of file OutputModuleBase.h.

Referenced by doEndRun().

256 {}
virtual void edm::global::OutputModuleBase::doEndRunSummary_ ( Run const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 257 of file OutputModuleBase.h.

257 {}
void edm::global::OutputModuleBase::doEndStream ( StreamID  id)
protected
virtual void edm::global::OutputModuleBase::doEndStream_ ( StreamID  )
inlineprivatevirtual

Definition at line 246 of file OutputModuleBase.h.

246 {}
bool OutputModuleBase::doEvent ( EventPrincipal const &  ep,
EventSetup const &  c,
ActivityRegistry act,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 212 of file OutputModuleBase.cc.

References remainingEvents(), remainingEvents_, and write().

215  {
216 
217  {
218  EventSignalsSentry sentry(act,mcc);
219  write(ep, mcc);
220  }
221 
222  auto remainingEvents = remainingEvents_.load();
223  bool keepTrying = remainingEvents > 0;
224  while(keepTrying) {
225  auto newValue = remainingEvents - 1;
226  keepTrying = !remainingEvents_.compare_exchange_strong(remainingEvents, newValue);
227  if(keepTrying) {
228  // the exchange failed because the value was changed by another thread.
229  // remainingEvents was changed to be the new value of remainingEvents_;
230  keepTrying = remainingEvents > 0;
231  }
232  }
233  return true;
234  }
std::atomic< int > remainingEvents_
virtual void write(EventPrincipal const &e, ModuleCallingContext const *)=0
void OutputModuleBase::doOpenFile ( FileBlock const &  fb)
private

Definition at line 279 of file OutputModuleBase.cc.

References openFile().

279  {
280  openFile(fb);
281  }
virtual void openFile(FileBlock const &)
void OutputModuleBase::doPostForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
private

Definition at line 297 of file OutputModuleBase.cc.

References postForkReacquireResources().

297  {
298  postForkReacquireResources(iChildIndex, iNumberOfChildren);
299  }
virtual void postForkReacquireResources(unsigned int, unsigned int)
void OutputModuleBase::doPreallocate ( PreallocationConfiguration const &  iPC)
protected

Definition at line 180 of file OutputModuleBase.cc.

References edm::detail::configureEventSelector(), edm::getAllTriggerNames(), edm::PreallocationConfiguration::numberOfStreams(), process_name_, alignCSCRings::s, selectEvents_, and selectors_.

180  {
181  auto nstreams = iPC.numberOfStreams();
182  selectors_.resize(nstreams);
183 
184  bool seenFirst = false;
185  for(auto& s : selectors_) {
186  if(seenFirst) {
190  s);
191  } else {
192  seenFirst = true;
193  }
194  }
195  }
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
std::vector< std::string > const & getAllTriggerNames()
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector)
void OutputModuleBase::doPreForkReleaseResources ( )
private

Definition at line 292 of file OutputModuleBase.cc.

References preForkReleaseResources().

292  {
294  }
void edm::global::OutputModuleBase::doRegisterThinnedAssociations ( ProductRegistry const &  ,
ThinnedAssociationsHelper  
)
inlineprivate

Definition at line 208 of file OutputModuleBase.h.

209  { }
void OutputModuleBase::doRespondToCloseInputFile ( FileBlock const &  fb)
private

Definition at line 287 of file OutputModuleBase.cc.

References doRespondToCloseInputFile_().

287  {
289  }
virtual void doRespondToCloseInputFile_(FileBlock const &)
virtual void edm::global::OutputModuleBase::doRespondToCloseInputFile_ ( FileBlock const &  )
inlineprivatevirtual

Reimplemented in edm::global::outputmodule::InputFileWatcher.

Definition at line 263 of file OutputModuleBase.h.

Referenced by doRespondToCloseInputFile().

263 {}
void OutputModuleBase::doRespondToOpenInputFile ( FileBlock const &  fb)
private

Definition at line 283 of file OutputModuleBase.cc.

References doRespondToOpenInputFile_().

283  {
285  }
virtual void doRespondToOpenInputFile_(FileBlock const &)
virtual void edm::global::OutputModuleBase::doRespondToOpenInputFile_ ( FileBlock const &  )
inlineprivatevirtual

Reimplemented in edm::global::outputmodule::InputFileWatcher.

Definition at line 262 of file OutputModuleBase.h.

Referenced by doRespondToOpenInputFile().

262 {}
void edm::global::OutputModuleBase::doStreamBeginLuminosityBlock ( StreamID  id,
LuminosityBlockPrincipal ep,
EventSetup const &  c,
ModuleCallingContext const *   
)
protected
virtual void edm::global::OutputModuleBase::doStreamBeginLuminosityBlock_ ( StreamID  ,
LuminosityBlock const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 250 of file OutputModuleBase.h.

250 {}
void edm::global::OutputModuleBase::doStreamBeginRun ( StreamID  id,
RunPrincipal ep,
EventSetup const &  c,
ModuleCallingContext const *   
)
protected
virtual void edm::global::OutputModuleBase::doStreamBeginRun_ ( StreamID  ,
Run const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 247 of file OutputModuleBase.h.

247 {}
void edm::global::OutputModuleBase::doStreamEndLuminosityBlock ( StreamID  id,
LuminosityBlockPrincipal ep,
EventSetup const &  c,
ModuleCallingContext const *   
)
protected
virtual void edm::global::OutputModuleBase::doStreamEndLuminosityBlock_ ( StreamID  ,
LuminosityBlock const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 251 of file OutputModuleBase.h.

251 {}
virtual void edm::global::OutputModuleBase::doStreamEndLuminosityBlockSummary_ ( StreamID  ,
LuminosityBlock const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 252 of file OutputModuleBase.h.

252 {}
void edm::global::OutputModuleBase::doStreamEndRun ( StreamID  id,
RunPrincipal ep,
EventSetup const &  c,
ModuleCallingContext const *   
)
protected
virtual void edm::global::OutputModuleBase::doStreamEndRun_ ( StreamID  ,
Run const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 248 of file OutputModuleBase.h.

248 {}
virtual void edm::global::OutputModuleBase::doStreamEndRunSummary_ ( StreamID  ,
Run const &  ,
EventSetup const &   
)
inlineprivatevirtual

Definition at line 249 of file OutputModuleBase.h.

249 {}
void OutputModuleBase::doWriteLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
ModuleCallingContext const *  mcc 
)
private

Definition at line 274 of file OutputModuleBase.cc.

References writeLuminosityBlock().

275  {
276  writeLuminosityBlock(lbp, mcc);
277  }
virtual void writeLuminosityBlock(LuminosityBlockPrincipal const &, ModuleCallingContext const *)=0
void OutputModuleBase::doWriteRun ( RunPrincipal const &  rp,
ModuleCallingContext const *  mcc 
)
private

Definition at line 253 of file OutputModuleBase.cc.

References writeRun().

254  {
255  writeRun(rp, mcc);
256  }
virtual void writeRun(RunPrincipal const &, ModuleCallingContext const *)=0
std::map<BranchID::value_type, BranchID::value_type> const& edm::global::OutputModuleBase::droppedBranchIDToKeptBranchID ( )
inlineprotected

Definition at line 149 of file OutputModuleBase.h.

References droppedBranchIDToKeptBranchID_.

149  {
151  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
virtual void edm::global::OutputModuleBase::endJob ( void  )
inlineprivatevirtual

Definition at line 234 of file OutputModuleBase.h.

Referenced by doEndJob().

234 {}
void OutputModuleBase::fillDescription ( ParameterSetDescription desc)
static

Definition at line 364 of file OutputModuleBase.cc.

References edm::ProductSelectorRules::fillDescription(), and edm::EventSelector::fillDescription().

364  {
365  ProductSelectorRules::fillDescription(desc, "outputCommands");
367  }
static void fillDescription(ParameterSetDescription &desc, char const *parameterName)
static void fillDescription(ParameterSetDescription &desc)
void OutputModuleBase::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 357 of file OutputModuleBase.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

357  {
359  desc.setUnknown();
360  descriptions.addDefault(desc);
361  }
std::array<bool, NumBranchTypes> const& edm::global::OutputModuleBase::hasNewlyDroppedBranch ( ) const
inline

Definition at line 86 of file OutputModuleBase.h.

References hasNewlyDroppedBranch_.

86 {return hasNewlyDroppedBranch_;}
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
virtual bool edm::global::OutputModuleBase::isFileOpen ( ) const
inlineprivatevirtual

Definition at line 238 of file OutputModuleBase.h.

Referenced by doCloseFile(), and maybeOpenFile().

238 { return true; }
void OutputModuleBase::keepThisBranch ( BranchDescription const &  desc,
std::map< BranchID, BranchDescription const * > &  trueBranchIDToKeptBranchDesc,
std::set< BranchID > &  keptProductsInEvent 
)
private

Definition at line 133 of file OutputModuleBase.cc.

References assert(), edm::BranchDescription::branchID(), edm::BranchDescription::branchType(), edm::ProductSelector::checkForDuplicateKeptBranch(), edm::EDConsumerBase::consumes(), edm::InEvent, edm::InLumi, HLT_25ns10e33_v2_cff::InputTag, edm::InRun, keptProducts_, edm::BranchDescription::moduleLabel(), edm::BranchDescription::originalBranchID(), edm::BranchDescription::processName(), edm::BranchDescription::produced(), edm::PRODUCT_TYPE, edm::BranchDescription::productInstanceName(), and edm::BranchDescription::unwrappedTypeID().

Referenced by selectProducts().

135  {
136 
138  trueBranchIDToKeptBranchDesc);
139 
140  switch (desc.branchType()) {
141  case InEvent:
142  {
143  if(desc.produced()) {
144  keptProductsInEvent.insert(desc.originalBranchID());
145  } else {
146  keptProductsInEvent.insert(desc.branchID());
147  }
148  consumes(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
149  InputTag{desc.moduleLabel(),
150  desc.productInstanceName(),
151  desc.processName()});
152  break;
153  }
154  case InLumi:
155  {
156  consumes<InLumi>(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
157  InputTag(desc.moduleLabel(),
158  desc.productInstanceName(),
159  desc.processName()));
160  break;
161  }
162  case InRun:
163  {
164  consumes<InRun>(TypeToGet{desc.unwrappedTypeID(),PRODUCT_TYPE},
165  InputTag(desc.moduleLabel(),
166  desc.productInstanceName(),
167  desc.processName()));
168  break;
169  }
170  default:
171  assert(false);
172  break;
173  }
174  // Now put it in the list of selected branches.
175  keptProducts_[desc.branchType()].push_back(&desc);
176  }
assert(m_qm.get())
SelectedProductsForBranchType keptProducts_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
static void checkForDuplicateKeptBranch(BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc)
SelectedProductsForBranchType const& edm::global::OutputModuleBase::keptProducts ( ) const
inline

Definition at line 85 of file OutputModuleBase.h.

References keptProducts_.

85 {return keptProducts_;}
SelectedProductsForBranchType keptProducts_
bool edm::global::OutputModuleBase::limitReached ( ) const
inlineprivate

Definition at line 273 of file OutputModuleBase.h.

References remainingEvents_.

273 {return remainingEvents_ == 0;}
std::atomic< int > remainingEvents_
int edm::global::OutputModuleBase::maxEvents ( ) const
inline

Accessor for maximum number of events to be written. -1 is used for unlimited.

Definition at line 75 of file OutputModuleBase.h.

References maxEvents_.

void OutputModuleBase::maybeOpenFile ( )
private

Tell the OutputModule to open an output file, if one is not already open.

Definition at line 308 of file OutputModuleBase.cc.

References isFileOpen(), and reallyOpenFile().

308  {
309  if(!isFileOpen()) reallyOpenFile();
310  }
virtual bool isFileOpen() const
const ModuleDescription& edm::global::OutputModuleBase::moduleDescription ( ) const
inline

Definition at line 99 of file OutputModuleBase.h.

References moduleDescription_.

99  {
100  return moduleDescription_;
101  }
ModuleDescription moduleDescription_
virtual void edm::global::OutputModuleBase::openFile ( FileBlock const &  )
inlineprivatevirtual
OutputModuleBase& edm::global::OutputModuleBase::operator= ( OutputModuleBase const &  )
delete
void OutputModuleBase::postForkReacquireResources ( unsigned  int,
unsigned  int 
)
privatevirtual

Definition at line 305 of file OutputModuleBase.cc.

Referenced by doPostForkReacquireResources().

305 {}
virtual void edm::global::OutputModuleBase::preallocStreams ( unsigned  int)
inlineprivatevirtual

Definition at line 244 of file OutputModuleBase.h.

244 {}
void OutputModuleBase::preForkReleaseResources ( )
privatevirtual

Definition at line 302 of file OutputModuleBase.cc.

Referenced by doPreForkReleaseResources().

302 {}
bool OutputModuleBase::prePrefetchSelection ( StreamID  id,
EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
)
private

Definition at line 205 of file OutputModuleBase.cc.

References or, alignCSCRings::s, selectors_, and wantAllEvents_.

205  {
206 
207  auto& s = selectors_[id.value()];
208  return wantAllEvents_ or s.wantEvent(ep,mcc);
209  }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
void OutputModuleBase::prevalidate ( ConfigurationDescriptions )
static

Definition at line 370 of file OutputModuleBase.cc.

370  {
371  }
std::string const& edm::global::OutputModuleBase::processName ( ) const
inline

Definition at line 84 of file OutputModuleBase.h.

References process_name_.

84 {return process_name_;}
void OutputModuleBase::reallyCloseFile ( )
privatevirtual

Definition at line 318 of file OutputModuleBase.cc.

Referenced by doCloseFile().

318  {
319  }
virtual void edm::global::OutputModuleBase::reallyOpenFile ( )
inlineprivatevirtual

Definition at line 239 of file OutputModuleBase.h.

Referenced by maybeOpenFile().

239 {}
void edm::global::OutputModuleBase::registerProductsAndCallbacks ( OutputModuleBase const *  ,
ProductRegistry const *   
)
inlineprivate

Definition at line 220 of file OutputModuleBase.h.

220 {}
int edm::global::OutputModuleBase::remainingEvents ( ) const
inline

Accessor for remaining number of events to be written. -1 is used for unlimited.

Definition at line 79 of file OutputModuleBase.h.

References remainingEvents_.

Referenced by doEvent().

79 {return remainingEvents_;}
std::atomic< int > remainingEvents_
bool OutputModuleBase::selected ( BranchDescription const &  desc) const

Definition at line 352 of file OutputModuleBase.cc.

References productSelector_, and edm::ProductSelector::selected().

Referenced by selectProducts(), and edm::AsciiOutputModule::write().

352  {
353  return productSelector_.selected(desc);
354  }
bool selected(BranchDescription const &desc) const
ParameterSetID edm::global::OutputModuleBase::selectorConfig ( ) const
inlineprotected

Definition at line 106 of file OutputModuleBase.h.

References selector_config_id_.

106 { return selector_config_id_; }
void OutputModuleBase::selectProducts ( ProductRegistry const &  preg,
ThinnedAssociationsHelper const &  thinnedAssociationsHelper 
)

Definition at line 84 of file OutputModuleBase.cc.

References edm::ProductRegistry::allBranchDescriptions(), edm::BranchDescription::branchType(), droppedBranchIDToKeptBranchID_, edm::ProductSelector::fillDroppedToKept(), hasNewlyDroppedBranch_, edm::ProductSelector::initialize(), edm::ProductSelector::initialized(), keepAssociation_, keepThisBranch(), edm::BranchDescription::present(), edm::BranchDescription::produced(), edm::ProductRegistry::productList(), productSelector_, productSelectorRules_, edm::ThinnedAssociationsHelper::selectAssociationProducts(), selected(), thinnedAssociationsHelper_, edm::BranchDescription::transient(), and edm::BranchDescription::unwrappedType().

85  {
86  if(productSelector_.initialized()) return;
87  productSelector_.initialize(productSelectorRules_, preg.allBranchDescriptions());
88 
89  // TODO: See if we can collapse keptProducts_ and productSelector_ into a
90  // single object. See the notes in the header for ProductSelector
91  // for more information.
92 
93  std::map<BranchID, BranchDescription const*> trueBranchIDToKeptBranchDesc;
94  std::vector<BranchDescription const*> associationDescriptions;
95  std::set<BranchID> keptProductsInEvent;
96 
97  for(auto const& it : preg.productList()) {
98  BranchDescription const& desc = it.second;
99  if(desc.transient()) {
100  // if the class of the branch is marked transient, output nothing
101  } else if(!desc.present() && !desc.produced()) {
102  // else if the branch containing the product has been previously dropped,
103  // output nothing
104  } else if(desc.unwrappedType() == typeid(ThinnedAssociation)) {
105  associationDescriptions.push_back(&desc);
106  } else if(selected(desc)) {
107  keepThisBranch(desc, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
108  } else {
109  // otherwise, output nothing,
110  // and mark the fact that there is a newly dropped branch of this type.
111  hasNewlyDroppedBranch_[desc.branchType()] = true;
112  }
113  }
114 
116  keptProductsInEvent,
118 
119  for(auto association : associationDescriptions) {
120  if(keepAssociation_[association->branchID()]) {
121  keepThisBranch(*association, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
122  } else {
123  hasNewlyDroppedBranch_[association->branchType()] = true;
124  }
125  }
126 
127  // Now fill in a mapping needed in the case that a branch was dropped while its EDAlias was kept.
129 
131  }
void keepThisBranch(BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc, std::set< BranchID > &keptProductsInEvent)
static void fillDroppedToKept(ProductRegistry const &preg, std::map< BranchID, BranchDescription const * > const &trueBranchIDToKeptBranchDesc, std::map< BranchID::value_type, BranchID::value_type > &droppedBranchIDToKeptBranchID_)
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
ThinnedAssociationsHelper const * thinnedAssociationsHelper() const
void selectAssociationProducts(std::vector< BranchDescription const * > const &associationDescriptions, std::set< BranchID > const &keptProductsInEvent, std::map< BranchID, bool > &keepAssociation) const
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
std::map< BranchID, bool > keepAssociation_
bool selected(BranchDescription const &desc) const
ProductSelectorRules productSelectorRules_
bool initialized() const
void initialize(ProductSelectorRules const &rules, std::vector< BranchDescription const * > const &branchDescriptions)
preg
Definition: Schedule.cc:374
void OutputModuleBase::setEventSelectionInfo ( std::map< std::string, std::vector< std::pair< std::string, int > > > const &  outputModulePathPositions,
bool  anyProductProduced 
)
protected

Definition at line 381 of file OutputModuleBase.cc.

References description(), edm::getParameterSet(), edm::detail::registerProperSelectionInfo(), and selector_config_id_.

382  {
384  description().moduleLabel(),
385  outputModulePathPositions,
386  anyProductProduced);
387  }
ModuleDescription const & description() const
ParameterSet const & getParameterSet(ParameterSetID const &id)
ParameterSetID registerProperSelectionInfo(edm::ParameterSet const &iInitial, std::string const &iLabel, std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced)
void edm::global::OutputModuleBase::setModuleDescription ( ModuleDescription const &  md)
inlineprivate

Definition at line 269 of file OutputModuleBase.h.

References moduleDescription_.

269  {
270  moduleDescription_ = md;
271  }
ModuleDescription moduleDescription_
virtual bool edm::global::OutputModuleBase::shouldWeCloseFile ( ) const
inlineprivatevirtual

Ask the OutputModule if we should end the current file.

Definition at line 230 of file OutputModuleBase.h.

230 {return false;}
ThinnedAssociationsHelper const * OutputModuleBase::thinnedAssociationsHelper ( ) const

Definition at line 342 of file OutputModuleBase.cc.

References thinnedAssociationsHelper_.

342  {
343  return thinnedAssociationsHelper_.get();
344  }
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
bool edm::global::OutputModuleBase::wantAllEvents ( ) const
inline

Definition at line 93 of file OutputModuleBase.h.

References wantAllEvents_.

std::string edm::global::OutputModuleBase::workerType ( ) const
inlineprivate

Definition at line 211 of file OutputModuleBase.h.

211 {return "WorkerT<edm::global::OutputModuleBase>";}
virtual void edm::global::OutputModuleBase::write ( EventPrincipal const &  e,
ModuleCallingContext const *   
)
privatepure virtual

Implemented in edm::AsciiOutputModule.

Referenced by doEvent(), and pkg.AbstractPkg::generate().

virtual void edm::global::OutputModuleBase::writeLuminosityBlock ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
privatepure virtual

Implemented in edm::AsciiOutputModule.

Referenced by doWriteLuminosityBlock().

virtual void edm::global::OutputModuleBase::writeRun ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
privatepure virtual

Implemented in edm::AsciiOutputModule.

Referenced by doWriteRun().

Friends And Related Function Documentation

template<typename T >
friend class ::edm::OutputModuleCommunicatorT
friend

Definition at line 64 of file OutputModuleBase.h.

template<typename T >
friend class ::edm::WorkerT
friend

Definition at line 63 of file OutputModuleBase.h.

template<typename U >
friend class edm::maker::ModuleHolderT
friend

Definition at line 62 of file OutputModuleBase.h.

Member Data Documentation

edm::propagate_const<std::unique_ptr<BranchIDLists> > edm::global::OutputModuleBase::branchIDLists_
private

Definition at line 191 of file OutputModuleBase.h.

Referenced by branchIDLists().

std::map<BranchID::value_type, BranchID::value_type> edm::global::OutputModuleBase::droppedBranchIDToKeptBranchID_
private
std::array<bool, NumBranchTypes> edm::global::OutputModuleBase::hasNewlyDroppedBranch_
private

Definition at line 174 of file OutputModuleBase.h.

Referenced by hasNewlyDroppedBranch(), OutputModuleBase(), and selectProducts().

std::map<BranchID, bool> edm::global::OutputModuleBase::keepAssociation_
private

Definition at line 195 of file OutputModuleBase.h.

Referenced by selectProducts().

SelectedProductsForBranchType edm::global::OutputModuleBase::keptProducts_
private

Definition at line 173 of file OutputModuleBase.h.

Referenced by keepThisBranch(), and keptProducts().

int edm::global::OutputModuleBase::maxEvents_
private

Definition at line 155 of file OutputModuleBase.h.

Referenced by configure(), and maxEvents().

ModuleDescription edm::global::OutputModuleBase::moduleDescription_
private

Definition at line 179 of file OutputModuleBase.h.

Referenced by description(), moduleDescription(), and setModuleDescription().

BranchIDLists const* edm::global::OutputModuleBase::origBranchIDLists_
private

Definition at line 192 of file OutputModuleBase.h.

Referenced by branchIDLists(), and configure().

std::string edm::global::OutputModuleBase::process_name_
private

Definition at line 176 of file OutputModuleBase.h.

Referenced by doPreallocate(), OutputModuleBase(), and processName().

ProductSelector edm::global::OutputModuleBase::productSelector_
private

Definition at line 178 of file OutputModuleBase.h.

Referenced by selected(), and selectProducts().

ProductSelectorRules edm::global::OutputModuleBase::productSelectorRules_
private

Definition at line 177 of file OutputModuleBase.h.

Referenced by selectProducts().

std::atomic<int> edm::global::OutputModuleBase::remainingEvents_
private

Definition at line 156 of file OutputModuleBase.h.

Referenced by configure(), doEvent(), limitReached(), and remainingEvents().

ParameterSet edm::global::OutputModuleBase::selectEvents_
private

Definition at line 183 of file OutputModuleBase.h.

Referenced by doPreallocate(), and OutputModuleBase().

ParameterSetID edm::global::OutputModuleBase::selector_config_id_
private

Definition at line 186 of file OutputModuleBase.h.

Referenced by OutputModuleBase(), selectorConfig(), and setEventSelectionInfo().

std::vector<detail::TriggerResultsBasedEventSelector> edm::global::OutputModuleBase::selectors_
private

Definition at line 182 of file OutputModuleBase.h.

Referenced by doPreallocate(), OutputModuleBase(), and prePrefetchSelection().

edm::propagate_const<std::unique_ptr<ThinnedAssociationsHelper> > edm::global::OutputModuleBase::thinnedAssociationsHelper_
private

Definition at line 194 of file OutputModuleBase.h.

Referenced by selectProducts(), and thinnedAssociationsHelper().

bool edm::global::OutputModuleBase::wantAllEvents_
private

Definition at line 181 of file OutputModuleBase.h.

Referenced by OutputModuleBase(), prePrefetchSelection(), and wantAllEvents().