CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
TestPortableAnalyzer Class Reference
Inheritance diagram for TestPortableAnalyzer:
edm::stream::EDAnalyzer<> edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::Event const &event, edm::EventSetup const &) override
 
 TestPortableAnalyzer (edm::ParameterSet const &config)
 
- Public Member Functions inherited from edm::stream::EDAnalyzer<>
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
 EDAnalyzerBase (const EDAnalyzerBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDAnalyzerBaseoperator= (const EDAnalyzerBase &)=delete
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

const edm::InputTag source_
 
const edm::EDGetTokenT< cudatest::TestHostCollectiontoken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 53 of file TestPortableAnalyzer.cc.

Constructor & Destructor Documentation

◆ TestPortableAnalyzer()

TestPortableAnalyzer::TestPortableAnalyzer ( edm::ParameterSet const &  config)
inline

Definition at line 55 of file TestPortableAnalyzer.cc.

56  : source_{config.getParameter<edm::InputTag>("source")}, token_{consumes(source_)} {}
const edm::EDGetTokenT< cudatest::TestHostCollection > token_
const edm::InputTag source_
Definition: config.py:1
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)

Member Function Documentation

◆ analyze()

void TestPortableAnalyzer::analyze ( edm::Event const &  event,
edm::EventSetup const &   
)
inlineoverridevirtual

Implements edm::stream::EDAnalyzerBase.

Definition at line 58 of file TestPortableAnalyzer.cc.

References python.cmstools::all(), cms::cuda::assert(), cms::cuda::PortableHostCollection< T >::buffer(), cms::cuda::PortableHostCollection< T >::const_view(), edm::InputTag::encode(), HLT_2023v12_cff::flags, mps_fire::i, makeMuonMisalignmentScenario::matrix, mps_check::msg, source_, and token_.

58  {
59  cudatest::TestHostCollection const& product = event.get(token_);
60 
61  auto const& view = product.const_view();
62  for (int32_t i = 0; i < view.metadata().size(); ++i) {
63  assert(view[i].id() == i);
64  }
65 
66  edm::LogInfo msg("TestPortableAnalyzer");
67  msg << source_.encode() << ".size() = " << view.metadata().size() << '\n';
68  msg << " data @ " << product.buffer().get() << ",\n"
69  << " x @ " << view.metadata().addressOf_x() << " = " << Column(view.x(), view.metadata().size()) << ",\n"
70  << " y @ " << view.metadata().addressOf_y() << " = " << Column(view.y(), view.metadata().size()) << ",\n"
71  << " z @ " << view.metadata().addressOf_z() << " = " << Column(view.z(), view.metadata().size()) << ",\n"
72  << " id @ " << view.metadata().addressOf_id() << " = " << Column(view.id(), view.metadata().size()) << ",\n"
73  << " r @ " << view.metadata().addressOf_r() << " = " << view.r() << '\n'
74  << " flags @ " << view.metadata().addressOf_flags() << " = " << Column(view.flags(), view.metadata().size())
75  << ",\n"
76  << " m @ " << view.metadata().addressOf_m() << " = { ... {" << view[1].m()(1, Eigen::indexing::all)
77  << " } ... } \n";
78  msg << std::hex << " [y - x] = 0x"
79  << reinterpret_cast<intptr_t>(view.metadata().addressOf_y()) -
80  reinterpret_cast<intptr_t>(view.metadata().addressOf_x())
81  << " [z - y] = 0x"
82  << reinterpret_cast<intptr_t>(view.metadata().addressOf_z()) -
83  reinterpret_cast<intptr_t>(view.metadata().addressOf_y())
84  << " [id - z] = 0x"
85  << reinterpret_cast<intptr_t>(view.metadata().addressOf_id()) -
86  reinterpret_cast<intptr_t>(view.metadata().addressOf_z())
87  << " [r - id] = 0x"
88  << reinterpret_cast<intptr_t>(view.metadata().addressOf_r()) -
89  reinterpret_cast<intptr_t>(view.metadata().addressOf_id())
90  << " [flags - r] = 0x"
91  << reinterpret_cast<intptr_t>(view.metadata().addressOf_flags()) -
92  reinterpret_cast<intptr_t>(view.metadata().addressOf_r())
93  << " [m - flags] = 0x"
94  << reinterpret_cast<intptr_t>(view.metadata().addressOf_m()) -
95  reinterpret_cast<intptr_t>(view.metadata().addressOf_flags());
96 
97  const portabletest::Matrix matrix{{1, 2, 3, 4, 5, 6}, {2, 4, 6, 8, 10, 12}, {3, 6, 9, 12, 15, 18}};
98  const portabletest::Array flags = {{6, 4, 2, 0}};
99 
100  assert(view.r() == 1.);
101  for (int32_t i = 0; i < view.metadata().size(); ++i) {
102  auto vi = view[i];
103  assert(vi.x() == 0.);
104  assert(vi.y() == 0.);
105  assert(vi.z() == 0.);
106  assert(vi.id() == i);
107  assert(vi.flags() == flags);
108  assert(vi.m() == matrix * i);
109  }
110  }
const edm::EDGetTokenT< cudatest::TestHostCollection > token_
const edm::InputTag source_
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
std::string encode() const
Definition: InputTag.cc:159
Eigen::Matrix< double, 3, 6 > Matrix
Definition: TestSoA.h:19
assert(be >=bs)
ConstView const & const_view() const
tuple msg
Definition: mps_check.py:286

◆ fillDescriptions()

static void TestPortableAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Member Data Documentation

◆ source_

const edm::InputTag TestPortableAnalyzer::source_
private

◆ token_

const edm::EDGetTokenT<cudatest::TestHostCollection> TestPortableAnalyzer::token_
private

Definition at line 120 of file TestPortableAnalyzer.cc.

Referenced by analyze().