Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
arttest::TestBitsOutput Class Reference
Inheritance diagram for arttest::TestBitsOutput:
art::OutputModule art::Observer art::detail::SharedModule art::ModuleBase

Classes

struct  Config
 

Public Types

using Parameters = fhicl::WrappedTable< Config, art::OutputModule::Config::KeysToIgnore >
 
- Public Types inherited from art::OutputModule
using ModuleType = OutputModule
 
using WorkerType = OutputWorker
 
using PluginCollection_t = std::vector< std::unique_ptr< FileCatalogMetadataPlugin >>
 

Public Member Functions

 TestBitsOutput (Parameters const &)
 
- Public Member Functions inherited from art::OutputModule
virtual ~OutputModule () noexcept
 
 OutputModule (fhicl::ParameterSet const &pset)
 
 OutputModule (fhicl::TableFragment< Config > const &pset, fhicl::ParameterSet const &containing_pset)
 
 OutputModule (OutputModule const &)=delete
 
 OutputModule (OutputModule &&)=delete
 
OutputModuleoperator= (OutputModule const &)=delete
 
OutputModuleoperator= (OutputModule &&)=delete
 
int maxEvents () const
 
int remainingEvents () const
 
bool fileIsOpen () const
 
OutputFileStatus fileStatus () const
 
virtual std::string const & lastClosedFileName () const
 
SelectionsArray const & keptProducts () const
 
bool selected (BranchDescription const &) const
 
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch () const
 
void selectProducts (ProductTables const &)
 
void doSelectProducts (ProductTables const &)
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
BranchChildren const & branchChildren () const
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 
- Public Member Functions inherited from art::detail::SharedModule
 SharedModule ()
 
 SharedModule (std::string const &moduleLabel)
 
 ~SharedModule () noexcept
 
hep::concurrency::SerialTaskQueueChain * serialTaskQueueChain () const
 
void createQueues ()
 
template<BranchType BT = InEvent, typename... T>
void serialize (T const &...)
 
template<BranchType BT = InEvent>
void async ()
 
template<BranchType , typename... T>
void serialize (T const &...resources)
 

Private Member Functions

void write (art::EventPrincipal &e) override
 
void writeSubRun (art::SubRunPrincipal &) override
 
void writeRun (art::RunPrincipal &) override
 
void endJob () override
 

Private Attributes

std::string name_ {}
 
std::vector< unsigned char > hltbits_ {}
 
art::ModuleDescription moduleDescription_ {}
 
int bitMask_
 
bool expectTriggerResults_
 

Additional Inherited Members

- Protected Member Functions inherited from art::OutputModule
virtual void doRegisterProducts (ProductDescriptions &, ModuleDescription const &)
 
- Protected Member Functions inherited from art::Observer
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &paths, fhicl::ParameterSet const &config)
 
detail::ProcessAndEventSelectorsprocessAndEventSelectors ()
 

Detailed Description

Definition at line 61 of file TestBitsOutput_module.cc.

Member Typedef Documentation

Definition at line 71 of file TestBitsOutput_module.cc.

Constructor & Destructor Documentation

arttest::TestBitsOutput::TestBitsOutput ( Parameters const &  ps)
explicit

Definition at line 94 of file TestBitsOutput_module.cc.

96  : art::OutputModule{ps().omConfig, ps.get_PSet()}
97  , bitMask_{ps().bitMask()}
98  , expectTriggerResults_{ps().expectTriggerResults()}
99 {}
static const double ps
Definition: Units.h:103

Member Function Documentation

void arttest::TestBitsOutput::endJob ( )
overrideprivatevirtual

Reimplemented from art::OutputModule.

Definition at line 175 of file TestBitsOutput_module.cc.

176 {}
void arttest::TestBitsOutput::write ( art::EventPrincipal e)
overrideprivatevirtual

Implements art::OutputModule.

Definition at line 102 of file TestBitsOutput_module.cc.

103 {
105  Event const ev{ep, mc};
106  // There should not be a TriggerResults object in the event if all
107  // three of the following requirements are met:
108  //
109  // 1. MakeTriggerResults has not been explicitly set true
110  // 2. There are no filter modules in any path
111  // 3. The input file of the job does not have a TriggerResults object
112  //
113  // The user of this test module is expected to know whether these
114  // conditions are met and let the module know if no TriggerResults
115  // object is expected using the configuration file. In this case,
116  // the next few lines of code will abort if a TriggerResults object
117  // is found.
118  if (!expectTriggerResults_) {
119  try {
121  // throw doesn't happen until we dereference
122  *prod;
123  }
124  catch (cet::exception const&) {
125  // We did not find one as expected, nothing else to test.
126  return;
127  }
128  std::cerr
129  << "\narttest::TestBitsOutput::write\n"
130  << "Expected there to be no TriggerResults object but we found one"
131  << std::endl;
132  abort();
133  }
134 
135  // Now deal with the other case where we expect the object to be
136  // present.
138  // TriggerResults objects should have no parents.
139  assert(prod.provenance()->parents().empty());
140  std::vector<unsigned char> vHltState;
141  // std::vector<std::string> const& hlts = ServiceHandle<TriggerNamesService
142  // const>{}->getTrigPaths();
143  std::vector<std::string> const& hlts =
145  unsigned int hltSize = hlts.size();
146  for (unsigned int i = 0; i != hltSize; ++i) {
147  vHltState.push_back(prod->at(i).state());
148  }
149  // Pack into member hltbits_
150  packIntoString(vHltState, hltbits_);
151  std::cout << "Size of hltbits:" << hltbits_.size() << std::endl;
152  auto intp = reinterpret_cast<char*>(&bitMask_);
153  bool matched{false};
154  for (int i = hltbits_.size() - 1; i != -1; --i) {
155  std::cout << std::endl << "Current Bits Mask byte:";
156  printBits(hltbits_[i]);
157  auto tmp = static_cast<unsigned char>(*(intp + i));
158  std::cout << std::endl << "Original Byte:";
159  printBits(tmp);
160  std::cout << std::endl;
161  if (tmp == hltbits_[i]) {
162  matched = true;
163  }
164  }
165  std::cout << "\n";
166  if (!matched && hltSize > 0) {
167  std::cerr << "\ncfg bitMask is different from event..aborting."
168  << std::endl;
169  abort();
170  }
171  std::cout << "\nSUCCESS: Found Matching Bits" << std::endl;
172 }
art::ModuleDescription moduleDescription_
Handle< TriggerResults > getTriggerResults(Event const &e) const
Definition: Observer.cc:90
static Globals * instance()
Definition: Globals.cc:26
std::vector< unsigned char > hltbits_
std::vector< std::string > const & triggerPathNames() const
Definition: Globals.cc:81
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void arttest::TestBitsOutput::writeRun ( art::RunPrincipal )
inlineoverrideprivatevirtual

Implements art::OutputModule.

Definition at line 80 of file TestBitsOutput_module.cc.

81  {}
void arttest::TestBitsOutput::writeSubRun ( art::SubRunPrincipal )
inlineoverrideprivatevirtual

Implements art::OutputModule.

Definition at line 77 of file TestBitsOutput_module.cc.

78  {}

Member Data Documentation

int arttest::TestBitsOutput::bitMask_
private

Definition at line 88 of file TestBitsOutput_module.cc.

bool arttest::TestBitsOutput::expectTriggerResults_
private

Definition at line 89 of file TestBitsOutput_module.cc.

std::vector<unsigned char> arttest::TestBitsOutput::hltbits_ {}
private

Definition at line 86 of file TestBitsOutput_module.cc.

art::ModuleDescription arttest::TestBitsOutput::moduleDescription_ {}
private

Definition at line 87 of file TestBitsOutput_module.cc.

std::string arttest::TestBitsOutput::name_ {}
private

Definition at line 85 of file TestBitsOutput_module.cc.


The documentation for this class was generated from the following file: