test
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::OutputModule Class Referenceabstract

#include <OutputModule.h>

Inheritance diagram for edm::OutputModule:
edm::EDConsumerBase edm::GetProductCheckerOutputModule edm::ProvenanceCheckerOutputModule RawEventOutputModuleForBU< Consumer >

Public Types

typedef OutputModule 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
 
OutputModuleoperator= (OutputModule const &)=delete
 
 OutputModule (ParameterSet const &pset)
 
 OutputModule (OutputModule 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 ~OutputModule ()
 
- 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 *mcc)
 
bool doBeginRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
 
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
 
bool doEvent (EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *act, ModuleCallingContext const *mcc)
 
void doPreallocate (PreallocationConfiguration const &)
 
std::map< BranchID::value_type,
BranchID::value_type > const & 
droppedBranchIDToKeptBranchID ()
 
Trig getTriggerResults (EDGetTokenT< TriggerResults > const &token, EventPrincipal const &ep, ModuleCallingContext const *) const
 
ModuleDescription const & moduleDescription () const
 
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 beginLuminosityBlock (LuminosityBlockPrincipal const &, ModuleCallingContext const *)
 
virtual void beginRun (RunPrincipal const &, ModuleCallingContext const *)
 
void doCloseFile ()
 Tell the OutputModule that is must end the current file. More...
 
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)
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doWriteLuminosityBlock (LuminosityBlockPrincipal const &lbp, ModuleCallingContext const *mcc)
 
void doWriteRun (RunPrincipal const &rp, ModuleCallingContext const *mcc)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (LuminosityBlockPrincipal const &, ModuleCallingContext const *)
 
virtual void endRun (RunPrincipal const &, ModuleCallingContext const *)
 
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 preForkReleaseResources ()
 
bool prePrefetchSelection (StreamID id, EventPrincipal const &, ModuleCallingContext const *)
 
virtual void reallyCloseFile ()
 
virtual void reallyOpenFile ()
 
void registerProductsAndCallbacks (OutputModule const *, ProductRegistry const *)
 
virtual void respondToCloseInputFile (FileBlock const &)
 
virtual void respondToOpenInputFile (FileBlock 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_
 
std::mutex mutex_
 
BranchIDLists const * origBranchIDLists_
 
std::string process_name_
 
ProductSelector productSelector_
 
ProductSelectorRules productSelectorRules_
 
std::atomic< int > remainingEvents_
 
SharedResourcesAcquirer resourceAcquirer_
 
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 maker::ModuleHolderT
 
template<typename T >
class OutputModuleCommunicatorT
 
template<typename T >
class WorkerT
 

Detailed Description

Definition at line 51 of file OutputModule.h.

Member Typedef Documentation

Definition at line 56 of file OutputModule.h.

Constructor & Destructor Documentation

edm::OutputModule::OutputModule ( ParameterSet const &  pset)
explicit

Definition at line 34 of file OutputModule.cc.

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

34  :
35  maxEvents_(-1),
37  keptProducts_(),
39  process_name_(),
40  productSelectorRules_(pset, "outputCommands", "OutputModule"),
43  wantAllEvents_(false),
44  selectors_(),
48  origBranchIDLists_(nullptr),
49  thinnedAssociationsHelper_(new ThinnedAssociationsHelper) {
50 
51  hasNewlyDroppedBranch_.fill(false);
52 
54  process_name_ = tns->getProcessName();
55 
57  pset.getUntrackedParameterSet("SelectEvents", ParameterSet());
58 
59  selectEvents_.registerIt(); // Just in case this PSet is not registered
60 
62  selectors_.resize(1);
63  //need to set wantAllEvents_ in constructor
64  // we will make the remaining selectors once we know how many streams
68  selectors_[0]);
69 
72 
73  }
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:150
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:166
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
ParameterSet selectEvents_
Definition: OutputModule.h:161
ModuleDescription moduleDescription_
Definition: OutputModule.h:155
ParameterSetID id() const
edm::propagate_const< std::unique_ptr< BranchIDLists > > branchIDLists_
Definition: OutputModule.h:167
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
Definition: OutputModule.h:170
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:168
std::string process_name_
Definition: OutputModule.h:152
static SharedResourcesRegistry * instance()
void registerSharedResource(const std::string &)
A resource name must be registered before it can be used in the createAcquirer call.
static const std::string kLegacyModuleResourceName
All legacy modules share this resource.
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
Definition: OutputModule.h:158
SelectedProductsForBranchType keptProducts_
Definition: OutputModule.h:149
ProductSelector productSelector_
Definition: OutputModule.h:154
std::vector< std::string > const & getAllTriggerNames()
ProductSelectorRules productSelectorRules_
Definition: OutputModule.h:153
std::atomic< int > remainingEvents_
Definition: OutputModule.h:132
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector)
ParameterSet const & registerIt()
ParameterSetID selector_config_id_
Definition: OutputModule.h:162
edm::OutputModule::~OutputModule ( )
virtual

Definition at line 174 of file OutputModule.cc.

174 { }
edm::OutputModule::OutputModule ( OutputModule const &  )
delete

Member Function Documentation

const std::string & edm::OutputModule::baseType ( )
static

Definition at line 399 of file OutputModule.cc.

References edm::kBaseType().

399  {
400  return kBaseType;
401  }
static const std::string kBaseType("EDAnalyzer")
virtual void edm::OutputModule::beginJob ( void  )
inlineprivatevirtual

Definition at line 211 of file OutputModule.h.

Referenced by doBeginJob().

211 {}
virtual void edm::OutputModule::beginLuminosityBlock ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual

Reimplemented in RawEventOutputModuleForBU< Consumer >.

Definition at line 216 of file OutputModule.h.

Referenced by doBeginLuminosityBlock().

216 {}
virtual void edm::OutputModule::beginRun ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual

Reimplemented in RawEventOutputModuleForBU< Consumer >.

Definition at line 213 of file OutputModule.h.

Referenced by doBeginRun().

213 {}
BranchIDLists const * edm::OutputModule::branchIDLists ( )

Definition at line 345 of file OutputModule.cc.

References branchIDLists_, droppedBranchIDToKeptBranchID_, and origBranchIDLists_.

345  {
346  if(!droppedBranchIDToKeptBranchID_.empty()) {
347  // Make a private copy of the BranchIDLists.
349  // Check for branches dropped while an EDAlias was kept.
350  for(BranchIDList& branchIDList : *branchIDLists_) {
351  for(BranchID::value_type& branchID : branchIDList) {
352  // 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.
353  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID_.find(branchID);
354  if(iter != droppedBranchIDToKeptBranchID_.end()) {
355  branchID = iter->second;
356  }
357  }
358  }
359  return branchIDLists_.get();
360  }
361  return origBranchIDLists_;
362  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:166
edm::propagate_const< std::unique_ptr< BranchIDLists > > branchIDLists_
Definition: OutputModule.h:167
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:168
unsigned int value_type
Definition: BranchID.h:16
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
void edm::OutputModule::configure ( OutputModuleDescription const &  desc)
protected

Definition at line 75 of file OutputModule.cc.

References edm::OutputModuleDescription::branchIDLists_, edm::OutputModuleDescription::maxEvents_, maxEvents_, origBranchIDLists_, and remainingEvents_.

75  {
76  remainingEvents_ = maxEvents_ = desc.maxEvents_;
77  origBranchIDLists_ = desc.branchIDLists_;
78  }
BranchIDLists const * origBranchIDLists_
Definition: OutputModule.h:168
std::atomic< int > remainingEvents_
Definition: OutputModule.h:132
ModuleDescription const & edm::OutputModule::description ( ) const
protected

Definition at line 370 of file OutputModule.cc.

References moduleDescription_.

Referenced by setEventSelectionInfo().

370  {
371  return moduleDescription_;
372  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:155
void edm::OutputModule::doBeginJob ( )
protected

Definition at line 193 of file OutputModule.cc.

References beginJob(), edm::SharedResourcesRegistry::createAcquirer(), edm::SharedResourcesRegistry::instance(), edm::SharedResourcesRegistry::kLegacyModuleResourceName, and resourceAcquirer_.

193  {
194  std::vector<std::string> res = {SharedResourcesRegistry::kLegacyModuleResourceName};
196 
197  this->beginJob();
198  }
SharedResourcesAcquirer resourceAcquirer_
Definition: OutputModule.h:173
SharedResourcesAcquirer createAcquirer(std::vector< std::string > const &) const
static SharedResourcesRegistry * instance()
static const std::string kLegacyModuleResourceName
All legacy modules share this resource.
virtual void beginJob()
Definition: OutputModule.h:211
bool edm::OutputModule::doBeginLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 286 of file OutputModule.cc.

References beginLuminosityBlock(), and FDEBUG.

288  {
289  FDEBUG(2) << "beginLuminosityBlock called\n";
290  beginLuminosityBlock(lbp, mcc);
291  return true;
292  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void beginLuminosityBlock(LuminosityBlockPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:216
bool edm::OutputModule::doBeginRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 261 of file OutputModule.cc.

References beginRun(), and FDEBUG.

263  {
264  FDEBUG(2) << "beginRun called\n";
265  beginRun(rp, mcc);
266  return true;
267  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void beginRun(RunPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:213
void edm::OutputModule::doCloseFile ( )
private

Tell the OutputModule that is must end the current file.

Definition at line 335 of file OutputModule.cc.

References isFileOpen(), and reallyCloseFile().

335  {
336  if(isFileOpen()) {
337  reallyCloseFile();
338  }
339  }
virtual void reallyCloseFile()
virtual bool isFileOpen() const
Definition: OutputModule.h:225
void edm::OutputModule::doEndJob ( )
protected

Definition at line 200 of file OutputModule.cc.

References endJob().

200  {
201  endJob();
202  }
virtual void endJob()
Definition: OutputModule.h:212
bool edm::OutputModule::doEndLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 295 of file OutputModule.cc.

References endLuminosityBlock(), and FDEBUG.

297  {
298  FDEBUG(2) << "endLuminosityBlock called\n";
299  endLuminosityBlock(lbp, mcc);
300  return true;
301  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void endLuminosityBlock(LuminosityBlockPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:217
bool edm::OutputModule::doEndRun ( RunPrincipal const &  rp,
EventSetup const &  c,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 270 of file OutputModule.cc.

References endRun(), and FDEBUG.

272  {
273  FDEBUG(2) << "endRun called\n";
274  endRun(rp, mcc);
275  return true;
276  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void endRun(RunPrincipal const &, ModuleCallingContext const *)
Definition: OutputModule.h:214
bool edm::OutputModule::doEvent ( EventPrincipal const &  ep,
EventSetup const &  c,
ActivityRegistry act,
ModuleCallingContext const *  mcc 
)
protected

Definition at line 222 of file OutputModule.cc.

References FDEBUG, mutex_, remainingEvents_, resourceAcquirer_, and write().

225  {
226 
227  FDEBUG(2) << "writeEvent called\n";
228 
229  {
230  std::lock_guard<std::mutex> guard(mutex_);
231 
232  {
233  std::lock_guard<SharedResourcesAcquirer> guardAcq(resourceAcquirer_);
234  EventSignalsSentry signals(act,mcc);
235  write(ep, mcc);
236  }
237  }
238  if(remainingEvents_ > 0) {
240  }
241  return true;
242  }
virtual void write(EventPrincipal const &e, ModuleCallingContext const *)=0
SharedResourcesAcquirer resourceAcquirer_
Definition: OutputModule.h:173
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::mutex mutex_
Definition: OutputModule.h:174
std::atomic< int > remainingEvents_
Definition: OutputModule.h:132
void edm::OutputModule::doOpenFile ( FileBlock const &  fb)
private

Definition at line 309 of file OutputModule.cc.

References openFile().

309  {
310  openFile(fb);
311  }
virtual void openFile(FileBlock const &)
Definition: OutputModule.h:219
void edm::OutputModule::doPostForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
private

Definition at line 327 of file OutputModule.cc.

References postForkReacquireResources().

327  {
328  postForkReacquireResources(iChildIndex, iNumberOfChildren);
329  }
virtual void postForkReacquireResources(unsigned int, unsigned int)
Definition: OutputModule.h:223
void edm::OutputModule::doPreallocate ( PreallocationConfiguration const &  iPC)
protected

Definition at line 176 of file OutputModule.cc.

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

176  {
177  auto nstreams = iPC.numberOfStreams();
178  selectors_.resize(nstreams);
179 
180  bool seenFirst = false;
181  for(auto& s : selectors_) {
182  if(seenFirst) {
186  s);
187  }
188  seenFirst = true;
189  }
190  }
ParameterSet selectEvents_
Definition: OutputModule.h:161
std::string process_name_
Definition: OutputModule.h:152
std::vector< detail::TriggerResultsBasedEventSelector > selectors_
Definition: OutputModule.h:158
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 edm::OutputModule::doPreForkReleaseResources ( )
private

Definition at line 322 of file OutputModule.cc.

References preForkReleaseResources().

322  {
324  }
virtual void preForkReleaseResources()
Definition: OutputModule.h:222
void edm::OutputModule::doRegisterThinnedAssociations ( ProductRegistry const &  ,
ThinnedAssociationsHelper  
)
inlineprivate

Definition at line 186 of file OutputModule.h.

187  { }
void edm::OutputModule::doRespondToCloseInputFile ( FileBlock const &  fb)
private

Definition at line 317 of file OutputModule.cc.

References respondToCloseInputFile().

317  {
319  }
virtual void respondToCloseInputFile(FileBlock const &)
Definition: OutputModule.h:221
void edm::OutputModule::doRespondToOpenInputFile ( FileBlock const &  fb)
private

Definition at line 313 of file OutputModule.cc.

References respondToOpenInputFile().

313  {
315  }
virtual void respondToOpenInputFile(FileBlock const &)
Definition: OutputModule.h:220
void edm::OutputModule::doWriteLuminosityBlock ( LuminosityBlockPrincipal const &  lbp,
ModuleCallingContext const *  mcc 
)
private

Definition at line 303 of file OutputModule.cc.

References FDEBUG, and writeLuminosityBlock().

304  {
305  FDEBUG(2) << "writeLuminosityBlock called\n";
306  writeLuminosityBlock(lbp, mcc);
307  }
virtual void writeLuminosityBlock(LuminosityBlockPrincipal const &, ModuleCallingContext const *)=0
#define FDEBUG(lev)
Definition: DebugMacros.h:18
void edm::OutputModule::doWriteRun ( RunPrincipal const &  rp,
ModuleCallingContext const *  mcc 
)
private

Definition at line 279 of file OutputModule.cc.

References FDEBUG, and writeRun().

280  {
281  FDEBUG(2) << "writeRun called\n";
282  writeRun(rp, mcc);
283  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
virtual void writeRun(RunPrincipal const &, ModuleCallingContext const *)=0
std::map<BranchID::value_type, BranchID::value_type> const& edm::OutputModule::droppedBranchIDToKeptBranchID ( )
inlineprotected

Definition at line 125 of file OutputModule.h.

References droppedBranchIDToKeptBranchID_.

125  {
127  }
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: OutputModule.h:166
virtual void edm::OutputModule::endJob ( void  )
inlineprivatevirtual

Definition at line 212 of file OutputModule.h.

Referenced by doEndJob().

212 {}
virtual void edm::OutputModule::endLuminosityBlock ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual

Reimplemented in RawEventOutputModuleForBU< Consumer >.

Definition at line 217 of file OutputModule.h.

Referenced by doEndLuminosityBlock().

217 {}
virtual void edm::OutputModule::endRun ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
inlineprivatevirtual

Reimplemented in RawEventOutputModuleForBU< Consumer >.

Definition at line 214 of file OutputModule.h.

Referenced by doEndRun().

214 {}
void edm::OutputModule::fillDescription ( ParameterSetDescription desc)
static
void edm::OutputModule::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 380 of file OutputModule.cc.

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

380  {
382  desc.setUnknown();
383  descriptions.addDefault(desc);
384  }
Trig edm::OutputModule::getTriggerResults ( EDGetTokenT< TriggerResults > const &  token,
EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
) const
protected

Definition at line 205 of file OutputModule.cc.

References edm::convert_handle(), edm::PrincipalGetAdapter::getByToken_(), moduleDescription_, eostools::move(), edm::PRODUCT_TYPE, mps_fire::result, and edm::PrincipalGetAdapter::setConsumer().

205  {
206  //This cast is safe since we only call const functions of the EventPrincipal after this point
208  adapter.setConsumer(this);
209  Trig result;
210  auto bh = adapter.getByToken_(TypeID(typeid(TriggerResults)),PRODUCT_TYPE, token, mcc);
211  convert_handle(std::move(bh), result);
212  return result;
213  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:155
detail::TriggerResultsBasedEventSelector::handle_t Trig
Definition: OutputModule.h:49
tuple result
Definition: mps_fire.py:84
def move
Definition: eostools.py:510
void convert_handle(BasicHandle &&bh, Handle< T > &result)
Definition: ConvertHandle.h:19
std::array<bool, NumBranchTypes> const& edm::OutputModule::hasNewlyDroppedBranch ( ) const
inline

Definition at line 77 of file OutputModule.h.

References hasNewlyDroppedBranch_.

77 {return hasNewlyDroppedBranch_;}
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:150
virtual bool edm::OutputModule::isFileOpen ( ) const
inlineprivatevirtual

Definition at line 225 of file OutputModule.h.

Referenced by doCloseFile(), and maybeOpenFile().

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

Definition at line 129 of file OutputModule.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().

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

Definition at line 76 of file OutputModule.h.

References keptProducts_.

76 {return keptProducts_;}
SelectedProductsForBranchType keptProducts_
Definition: OutputModule.h:149
bool edm::OutputModule::limitReached ( ) const
inlineprivate

Definition at line 237 of file OutputModule.h.

References remainingEvents_.

237 {return remainingEvents_ == 0;}
std::atomic< int > remainingEvents_
Definition: OutputModule.h:132
int edm::OutputModule::maxEvents ( ) const
inline

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

Definition at line 66 of file OutputModule.h.

References maxEvents_.

66 {return maxEvents_;}
void edm::OutputModule::maybeOpenFile ( )
private

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

Definition at line 331 of file OutputModule.cc.

References isFileOpen(), and reallyOpenFile().

331  {
332  if(!isFileOpen()) reallyOpenFile();
333  }
virtual void reallyOpenFile()
Definition: OutputModule.h:227
virtual bool isFileOpen() const
Definition: OutputModule.h:225
ModuleDescription const& edm::OutputModule::moduleDescription ( ) const
inlineprotected

Definition at line 99 of file OutputModule.h.

References moduleDescription_.

99  { return moduleDescription_;
100  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:155
virtual void edm::OutputModule::openFile ( FileBlock const &  )
inlineprivatevirtual
OutputModule& edm::OutputModule::operator= ( OutputModule const &  )
delete
virtual void edm::OutputModule::postForkReacquireResources ( unsigned  int,
unsigned  int 
)
inlineprivatevirtual

Definition at line 223 of file OutputModule.h.

Referenced by doPostForkReacquireResources().

223 {}
virtual void edm::OutputModule::preForkReleaseResources ( )
inlineprivatevirtual

Definition at line 222 of file OutputModule.h.

Referenced by doPreForkReleaseResources().

222 {}
bool edm::OutputModule::prePrefetchSelection ( StreamID  id,
EventPrincipal const &  ep,
ModuleCallingContext const *  mcc 
)
private

Definition at line 215 of file OutputModule.cc.

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

215  {
216 
217  auto& s = selectors_[id.value()];
218  return wantAllEvents_ or s.wantEvent(ep,mcc);
219  }
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_
Definition: OutputModule.h:158
void edm::OutputModule::prevalidate ( ConfigurationDescriptions )
static

Definition at line 393 of file OutputModule.cc.

393  {
394  }
std::string const& edm::OutputModule::processName ( ) const
inline

Definition at line 75 of file OutputModule.h.

References process_name_.

Referenced by edm::StreamerOutputModuleBase::serializeRegistry().

75 {return process_name_;}
std::string process_name_
Definition: OutputModule.h:152
void edm::OutputModule::reallyCloseFile ( )
privatevirtual

Definition at line 341 of file OutputModule.cc.

Referenced by doCloseFile().

341  {
342  }
virtual void edm::OutputModule::reallyOpenFile ( )
inlineprivatevirtual

Definition at line 227 of file OutputModule.h.

Referenced by maybeOpenFile().

227 {}
void edm::OutputModule::registerProductsAndCallbacks ( OutputModule const *  ,
ProductRegistry const *   
)
inlineprivate

Definition at line 203 of file OutputModule.h.

203 {}
int edm::OutputModule::remainingEvents ( ) const
inline

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

Definition at line 70 of file OutputModule.h.

References remainingEvents_.

70 {return remainingEvents_;}
std::atomic< int > remainingEvents_
Definition: OutputModule.h:132
virtual void edm::OutputModule::respondToCloseInputFile ( FileBlock const &  )
inlineprivatevirtual

Definition at line 221 of file OutputModule.h.

Referenced by doRespondToCloseInputFile().

221 {}
virtual void edm::OutputModule::respondToOpenInputFile ( FileBlock const &  )
inlineprivatevirtual

Definition at line 220 of file OutputModule.h.

Referenced by doRespondToOpenInputFile().

220 {}
bool edm::OutputModule::selected ( BranchDescription const &  desc) const

Definition at line 375 of file OutputModule.cc.

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

Referenced by selectProducts().

375  {
376  return productSelector_.selected(desc);
377  }
bool selected(BranchDescription const &desc) const
ProductSelector productSelector_
Definition: OutputModule.h:154
ParameterSetID edm::OutputModule::selectorConfig ( ) const
inlineprotected

Definition at line 102 of file OutputModule.h.

References selector_config_id_.

102 { return selector_config_id_; }
ParameterSetID selector_config_id_
Definition: OutputModule.h:162
void edm::OutputModule::selectProducts ( ProductRegistry const &  preg,
ThinnedAssociationsHelper const &  thinnedAssociationsHelper 
)

Definition at line 80 of file OutputModule.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().

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

Definition at line 404 of file OutputModule.cc.

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

405  {
407  description().moduleLabel(),
408  outputModulePathPositions,
409  anyProductProduced);
410  }
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)
ModuleDescription const & description() const
ParameterSetID selector_config_id_
Definition: OutputModule.h:162
void edm::OutputModule::setModuleDescription ( ModuleDescription const &  md)
inlineprivate

Definition at line 233 of file OutputModule.h.

References moduleDescription_.

233  {
234  moduleDescription_ = md;
235  }
ModuleDescription moduleDescription_
Definition: OutputModule.h:155
virtual bool edm::OutputModule::shouldWeCloseFile ( ) const
inlineprivatevirtual

Ask the OutputModule if we should end the current file.

Definition at line 208 of file OutputModule.h.

208 {return false;}
ThinnedAssociationsHelper const * edm::OutputModule::thinnedAssociationsHelper ( ) const

Definition at line 365 of file OutputModule.cc.

References thinnedAssociationsHelper_.

365  {
366  return thinnedAssociationsHelper_.get();
367  }
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
Definition: OutputModule.h:170
bool edm::OutputModule::wantAllEvents ( ) const
inline

Definition at line 84 of file OutputModule.h.

References wantAllEvents_.

84 {return wantAllEvents_;}
std::string edm::OutputModule::workerType ( ) const
inlineprivate

Definition at line 189 of file OutputModule.h.

189 {return "WorkerT<OutputModule>";}
virtual void edm::OutputModule::write ( EventPrincipal const &  e,
ModuleCallingContext const *   
)
privatepure virtual
virtual void edm::OutputModule::writeLuminosityBlock ( LuminosityBlockPrincipal const &  ,
ModuleCallingContext const *   
)
privatepure virtual
virtual void edm::OutputModule::writeRun ( RunPrincipal const &  ,
ModuleCallingContext const *   
)
privatepure virtual

Friends And Related Function Documentation

template<typename T >
friend class maker::ModuleHolderT
friend

Definition at line 53 of file OutputModule.h.

template<typename T >
friend class OutputModuleCommunicatorT
friend

Definition at line 55 of file OutputModule.h.

template<typename T >
friend class WorkerT
friend

Definition at line 54 of file OutputModule.h.

Member Data Documentation

edm::propagate_const<std::unique_ptr<BranchIDLists> > edm::OutputModule::branchIDLists_
private

Definition at line 167 of file OutputModule.h.

Referenced by branchIDLists().

std::map<BranchID::value_type, BranchID::value_type> edm::OutputModule::droppedBranchIDToKeptBranchID_
private

Definition at line 166 of file OutputModule.h.

Referenced by branchIDLists(), droppedBranchIDToKeptBranchID(), and selectProducts().

std::array<bool, NumBranchTypes> edm::OutputModule::hasNewlyDroppedBranch_
private

Definition at line 150 of file OutputModule.h.

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

std::map<BranchID, bool> edm::OutputModule::keepAssociation_
private

Definition at line 171 of file OutputModule.h.

Referenced by selectProducts().

SelectedProductsForBranchType edm::OutputModule::keptProducts_
private

Definition at line 149 of file OutputModule.h.

Referenced by keepThisBranch(), and keptProducts().

int edm::OutputModule::maxEvents_
private

Definition at line 131 of file OutputModule.h.

Referenced by configure(), and maxEvents().

ModuleDescription edm::OutputModule::moduleDescription_
private
std::mutex edm::OutputModule::mutex_
private

Definition at line 174 of file OutputModule.h.

Referenced by doEvent().

BranchIDLists const* edm::OutputModule::origBranchIDLists_
private

Definition at line 168 of file OutputModule.h.

Referenced by branchIDLists(), and configure().

std::string edm::OutputModule::process_name_
private

Definition at line 152 of file OutputModule.h.

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

ProductSelector edm::OutputModule::productSelector_
private

Definition at line 154 of file OutputModule.h.

Referenced by selected(), and selectProducts().

ProductSelectorRules edm::OutputModule::productSelectorRules_
private

Definition at line 153 of file OutputModule.h.

Referenced by selectProducts().

std::atomic<int> edm::OutputModule::remainingEvents_
private

Definition at line 132 of file OutputModule.h.

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

SharedResourcesAcquirer edm::OutputModule::resourceAcquirer_
private

Definition at line 173 of file OutputModule.h.

Referenced by doBeginJob(), and doEvent().

ParameterSet edm::OutputModule::selectEvents_
private

Definition at line 161 of file OutputModule.h.

Referenced by doPreallocate(), and OutputModule().

ParameterSetID edm::OutputModule::selector_config_id_
private

Definition at line 162 of file OutputModule.h.

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

std::vector<detail::TriggerResultsBasedEventSelector> edm::OutputModule::selectors_
private

Definition at line 158 of file OutputModule.h.

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

edm::propagate_const<std::unique_ptr<ThinnedAssociationsHelper> > edm::OutputModule::thinnedAssociationsHelper_
private

Definition at line 170 of file OutputModule.h.

Referenced by selectProducts(), and thinnedAssociationsHelper().

bool edm::OutputModule::wantAllEvents_
private

Definition at line 157 of file OutputModule.h.

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