CMS 3D CMS Logo

List of all members | Public Member Functions
edmtest::ViewAnalyzer Class Reference
Inheritance diagram for edmtest::ViewAnalyzer:
edm::global::EDAnalyzer<> edm::global::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::StreamID, edm::Event const &e, edm::EventSetup const &) const override
 
void testAVProduct (edm::Event const &e, std::string const &moduleLabel) const
 
void testDSVProduct (edm::Event const &e, std::string const &moduleLabel) const
 
template<typename P , typename V >
void testProduct (edm::Event const &e, std::string const &moduleLabel) const
 
void testProductWithBaseClass (edm::Event const &e, std::string const &moduleLabel) const
 
void testPtrVector (edm::Event const &e, std::string const &moduleLabel) const
 
void testRefToBaseVector (edm::Event const &e, std::string const &moduleLabel) const
 
void testRefVector (edm::Event const &e, std::string const &moduleLabel) const
 
void testStdVectorPtr (edm::Event const &e, std::string const &moduleLabel) const
 
void testStdVectorUniquePtr (edm::Event const &e, std::string const &moduleLabel) const
 
 ViewAnalyzer (edm::ParameterSet const &)
 
- Public Member Functions inherited from edm::global::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept final
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~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)
 

Additional Inherited Members

- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 29 of file ViewAnalyzer.cc.

Constructor & Destructor Documentation

◆ ViewAnalyzer()

edmtest::ViewAnalyzer::ViewAnalyzer ( edm::ParameterSet const &  )
explicit

Definition at line 54 of file ViewAnalyzer.cc.

54  {
55  consumes<edm::View<int>>(edm::InputTag{"intvec", "", "TEST"});
56  consumes<edm::View<int>>(edm::InputTag{"intvec", ""});
57  consumes<std::vector<int>>(edm::InputTag{"intvec"});
58  consumes<edm::View<int>>(edm::InputTag{"intvec"});
59  consumes<std::list<int>>(edm::InputTag{"intlist"});
60  consumes<edm::View<int>>(edm::InputTag{"intlist"});
61  consumes<std::deque<int>>(edm::InputTag{"intdeque"});
62  consumes<edm::View<int>>(edm::InputTag{"intdeque"});
63  consumes<std::set<int>>(edm::InputTag{"intset"});
64  consumes<edm::View<int>>(edm::InputTag{"intset"});
65  consumes<SCSimpleProduct>(edm::InputTag{"simple"});
66  consumes<edm::View<SCSimpleProduct::value_type>>(edm::InputTag{"simple"});
67  consumes<OVSimpleProduct>(edm::InputTag{"ovsimple"});
68  consumes<edm::View<OVSimpleProduct::value_type>>(edm::InputTag{"ovsimple"});
69  consumes<AVSimpleProduct>(edm::InputTag{"avsimple"});
70  consumes<edm::View<AVSimpleProduct::value_type>>(edm::InputTag{"avsimple"});
71  consumes<edmtest::DSVSimpleProduct>(edm::InputTag{"dsvsimple"});
72  consumes<edm::View<edmtest::DSVSimpleProduct::value_type>>(edm::InputTag{"dsvsimple"});
73 
74  consumes<OVSimpleDerivedProduct>(edm::InputTag{"ovsimple", "derived"});
75  consumes<edm::View<Simple>>(edm::InputTag{"ovsimple", "derived"});
76 
77  consumes<RefVector<std::vector<int>>>(edm::InputTag{"intvecrefvec"});
78  consumes<edm::View<int>>(edm::InputTag{"intvecrefvec"});
79 
80  consumes<RefToBaseVector<int>>(edm::InputTag{"intvecreftbvec"});
81  consumes<edm::View<int>>(edm::InputTag{"intvecreftbvec"});
82 
83  consumes<PtrVector<int>>(edm::InputTag{"intvecptrvec"});
84  consumes<edm::View<int>>(edm::InputTag{"intvecptrvec"});
85 
86  consumes<std::vector<edm::Ptr<int>>>(edm::InputTag{"intvecstdvecptr"});
87  consumes<edm::View<int>>(edm::InputTag{"intvecstdvecptr"});
88 
89  consumes<std::vector<std::unique_ptr<int>>>(edm::InputTag{"intvecstdvecuniqptr"});
90  consumes<edm::View<int>>(edm::InputTag{"intvecstdvecuniqptr"});
91  consumes<std::vector<std::unique_ptr<IntProduct>>>(edm::InputTag{"intvecstdvecuniqptr"});
92  consumes<edm::View<IntProduct>>(edm::InputTag{"intvecstdvecuniqptr"});
93 
94  mayConsume<edm::View<int>>(edm::InputTag{"intvecptrvecdoesNotExist"});
95  }

Member Function Documentation

◆ analyze()

void edmtest::ViewAnalyzer::analyze ( edm::StreamID  ,
edm::Event const &  e,
edm::EventSetup const &   
) const
overridevirtual

Implements edm::global::EDAnalyzerBase.

Definition at line 104 of file ViewAnalyzer.cc.

References cms::cuda::assert(), MillePedeFileConverter_cfg::e, edm::HandleBase::isValid(), and makeGlobalPositionRcd_cfg::tag.

104  {
105  tester<std::vector<int>>::call(this, e, "intvec");
106  tester<std::list<int>>::call(this, e, "intlist");
107  tester<std::deque<int>>::call(this, e, "intdeque");
108  tester<std::set<int>>::call(this, e, "intset");
109 
110  tester<SCSimpleProduct>::call(this, e, "simple");
111  tester<OVSimpleProduct>::call(this, e, "ovsimple");
112  tester<AVSimpleProduct>::call(this, e, "avsimple");
113 
114  testDSVProduct(e, "dsvsimple");
115  testAVProduct(e, "avsimple");
116  testProductWithBaseClass(e, "ovsimple");
117  testRefVector(e, "intvecrefvec");
118  testRefToBaseVector(e, "intvecreftbvec");
119  testPtrVector(e, "intvecptrvec");
120  testStdVectorPtr(e, "intvecstdvecptr");
121  testStdVectorUniquePtr(e, "intvecstdvecuniqptr");
122 
123  //See if InputTag works
124  {
125  edm::InputTag tag("intvec", "");
127  e.getByLabel(tag, hInt);
128  assert(hInt.isValid());
129  }
130  {
131  edm::InputTag tag("intvec", "", "TEST");
133  e.getByLabel(tag, hInt);
134  assert(hInt.isValid());
135  }
136  }
void testStdVectorPtr(edm::Event const &e, std::string const &moduleLabel) const
void testProductWithBaseClass(edm::Event const &e, std::string const &moduleLabel) const
assert(be >=bs)
void testDSVProduct(edm::Event const &e, std::string const &moduleLabel) const
void testAVProduct(edm::Event const &e, std::string const &moduleLabel) const
void testRefToBaseVector(edm::Event const &e, std::string const &moduleLabel) const
static void call(ViewAnalyzer const *va, Event const &e, char const *moduleLabel)
Definition: ViewAnalyzer.cc:99
void testPtrVector(edm::Event const &e, std::string const &moduleLabel) const
bool isValid() const
Definition: HandleBase.h:70
void testStdVectorUniquePtr(edm::Event const &e, std::string const &moduleLabel) const
void testRefVector(edm::Event const &e, std::string const &moduleLabel) const

◆ testAVProduct()

void edmtest::ViewAnalyzer::testAVProduct ( edm::Event const &  e,
std::string const &  moduleLabel 
) const

Definition at line 221 of file ViewAnalyzer.cc.

References cms::cuda::assert(), MillePedeFileConverter_cfg::e, edm::ProductID::id(), edm::HandleBase::id(), edm::HandleBase::isValid(), HerwigMaxPtPartonFilter_cfi::moduleLabel, copyEcalPFRecHitThresholds_cfg::prod, and edm::HandleBase::provenance().

221  {
222  typedef edmtest::AVSimpleProduct sequence_t;
223  typedef sequence_t::value_type value_t;
224  typedef View<value_t> view_t;
225 
226  Handle<sequence_t> hprod;
227  e.getByLabel(moduleLabel, hprod);
228  assert(hprod.isValid());
229 
230  Handle<view_t> hview;
231  e.getByLabel(moduleLabel, hview);
232  assert(hview.isValid());
233 
234  assert(hprod.id() == hview.id());
235  assert(*hprod.provenance() == *hview.provenance());
236 
237  assert(hprod->size() == hview->size());
238 
239  sequence_t::const_iterator i_prod = hprod->begin();
240  sequence_t::const_iterator e_prod = hprod->end();
241  view_t::const_iterator i_view = hview->begin();
242  view_t::const_iterator e_view = hview->end();
243 
244  while (i_prod != e_prod && i_view != e_view) {
245  value_t const& prod = *i_prod;
246  value_t const& view = *i_view;
247  assert(prod == view);
248  assert((*hprod)[prod.first] == prod.second);
249  edm::Ptr<sequence_t::key_type> ptr(prod.first.id(), prod.first.key(), &e.productGetter());
250  assert((*hprod)[ptr] == prod.second);
252  assert((*hprod)[refToBase] == prod.second);
253  ++i_prod;
254  ++i_view;
255  }
256  }
ProductID id() const
Definition: HandleBase.cc:29
assert(be >=bs)
Provenance const * provenance() const
Definition: HandleBase.h:74
ProductIndex id() const
Definition: ProductID.h:35
bool isValid() const
Definition: HandleBase.h:70

◆ testDSVProduct()

void edmtest::ViewAnalyzer::testDSVProduct ( edm::Event const &  e,
std::string const &  moduleLabel 
) const

Definition at line 187 of file ViewAnalyzer.cc.

References cms::cuda::assert(), MillePedeFileConverter_cfg::e, edm::ProductID::id(), edm::HandleBase::id(), edm::HandleBase::isValid(), HerwigMaxPtPartonFilter_cfi::moduleLabel, copyEcalPFRecHitThresholds_cfg::prod, and edm::HandleBase::provenance().

187  {
188  typedef edmtest::DSVSimpleProduct sequence_t;
189  typedef sequence_t::value_type value_t;
190  typedef View<value_t> view_t;
191 
192  Handle<sequence_t> hprod;
193  e.getByLabel(moduleLabel, hprod);
194  assert(hprod.isValid());
195 
196  Handle<view_t> hview;
197  e.getByLabel(moduleLabel, hview);
198  assert(hview.isValid());
199 
200  assert(hprod.id() == hview.id());
201  assert(*hprod.provenance() == *hview.provenance());
202 
203  assert(hprod->size() == hview->size());
204 
205  sequence_t::const_iterator i_prod = hprod->begin();
206  sequence_t::const_iterator e_prod = hprod->end();
207  view_t::const_iterator i_view = hview->begin();
208  view_t::const_iterator e_view = hview->end();
209 
210  while (i_prod != e_prod && i_view != e_view) {
211  value_t const& prod = *i_prod;
212  value_t const& view = *i_view;
213  assert(prod.detId() == view.detId());
214  assert(prod.data == view.data);
215 
216  ++i_prod;
217  ++i_view;
218  }
219  }
ProductID id() const
Definition: HandleBase.cc:29
assert(be >=bs)
Provenance const * provenance() const
Definition: HandleBase.h:74
ProductIndex id() const
Definition: ProductID.h:35
bool isValid() const
Definition: HandleBase.h:70

◆ testProduct()

template<typename P , typename V >
void edmtest::ViewAnalyzer::testProduct ( edm::Event const &  e,
std::string const &  moduleLabel 
) const

Definition at line 139 of file ViewAnalyzer.cc.

References cms::cuda::assert(), MillePedeFileConverter_cfg::e, mps_fire::i, edm::ProductID::id(), edm::HandleBase::id(), edm::RefToBase< T >::isNonnull(), edm::HandleBase::isValid(), HerwigMaxPtPartonFilter_cfi::moduleLabel, gpuClustering::numElements, edm::HandleBase::provenance(), FCDTask_cfi::slot, and cms::cuda::V.

139  {
140  typedef P sequence_t;
141  typedef V value_t;
142  typedef View<value_t> view_t;
143 
144  Handle<sequence_t> hproduct;
145  e.getByLabel(moduleLabel, hproduct);
146  assert(hproduct.isValid());
147 
148  Handle<view_t> hview;
149  e.getByLabel(moduleLabel, hview);
150  assert(hview.isValid());
151 
152  assert(hproduct.id() == hview.id());
153  assert(*hproduct.provenance() == *hview.provenance());
154 
155  assert(hproduct->size() == hview->size());
156 
157  typename sequence_t::const_iterator i_product = hproduct->begin();
158  typename sequence_t::const_iterator e_product = hproduct->end();
159  typename view_t::const_iterator i_view = hview->begin();
160  typename view_t::const_iterator e_view = hview->end();
161  size_t slot = 0;
162  while (i_product != e_product && i_view != e_view) {
163  value_t const& product_item = *i_product;
164  value_t const& view_item = *i_view;
165  assert(product_item == view_item);
166 
167  edm::Ref<sequence_t> ref3(hproduct, slot);
168  assert(*ref3 == product_item);
169 
170  edm::RefProd<sequence_t> refProd4(hproduct);
171  edm::Ref<sequence_t> ref4(refProd4, slot);
172  assert(*ref4 == product_item);
173 
174  ++i_product;
175  ++i_view;
176  ++slot;
177  }
178 
179  // Make sure the references are right.
180  size_t numElements = hview->size();
181  for (size_t i = 0; i < numElements; ++i) {
182  RefToBase<value_t> ref = hview->refAt(i);
183  assert(ref.isNonnull());
184  }
185  }
ProductID id() const
Definition: HandleBase.cc:29
bool isNonnull() const
Checks for non-null.
Definition: RefToBase.h:290
assert(be >=bs)
Provenance const * provenance() const
Definition: HandleBase.h:74
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t V
ProductIndex id() const
Definition: ProductID.h:35
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t const *__restrict__ int32_t *__restrict__ uint32_t numElements
std::pair< OmniClusterRef, TrackingParticleRef > P
bool isValid() const
Definition: HandleBase.h:70

◆ testProductWithBaseClass()

void edmtest::ViewAnalyzer::testProductWithBaseClass ( edm::Event const &  e,
std::string const &  moduleLabel 
) const

Definition at line 262 of file ViewAnalyzer.cc.

References cms::cuda::assert(), edm::RefToBase< T >::castTo(), MillePedeFileConverter_cfg::e, edm::ProductID::id(), edm::HandleBase::id(), edm::HandleBase::isValid(), HerwigMaxPtPartonFilter_cfi::moduleLabel, copyEcalPFRecHitThresholds_cfg::prod, edm::HandleBase::provenance(), and FCDTask_cfi::slot.

262  {
263  typedef OVSimpleDerivedProduct sequence_t;
264  typedef Simple value_t;
265  typedef View<value_t> view_t;
266 
267  Handle<sequence_t> hprod;
268  e.getByLabel(moduleLabel, "derived", hprod);
269  assert(hprod.isValid());
270 
271  Handle<view_t> hview;
272  e.getByLabel(moduleLabel, "derived", hview);
273  assert(hview.isValid());
274 
275  assert(hprod.id() == hview.id());
276  assert(*hprod.provenance() == *hview.provenance());
277 
278  assert(hprod->size() == hview->size());
279 
280  unsigned slot = 0;
281 
282  sequence_t::const_iterator i_prod = hprod->begin();
283  sequence_t::const_iterator e_prod = hprod->end();
284  view_t::const_iterator i_view = hview->begin();
285  view_t::const_iterator e_view = hview->end();
286 
287  while (i_prod != e_prod && i_view != e_view) {
288  SimpleDerived const& prod = *i_prod;
289  Simple const& view = *i_view;
290  assert(prod == view);
291 
292  // Tack on a test of RefToBase::castTo here
293 
294  edm::RefToBaseProd<Simple> refToBaseProd(hview);
295  edm::RefToBase<Simple> refToBase(refToBaseProd, slot);
296 
297  edm::Ptr<SimpleDerived> ptr = refToBase.castTo<edm::Ptr<SimpleDerived>>();
298  SimpleDerived const& valueFromPtr = *ptr;
299  assert(valueFromPtr == view);
300 
302  SimpleDerived const& valueFromRef = *ref;
303  assert(valueFromRef == view);
304 
305  ++i_prod;
306  ++i_view;
307  ++slot;
308  }
309  }
ProductID id() const
Definition: HandleBase.cc:29
assert(be >=bs)
Provenance const * provenance() const
Definition: HandleBase.h:74
ProductIndex id() const
Definition: ProductID.h:35
bool isValid() const
Definition: HandleBase.h:70

◆ testPtrVector()

void edmtest::ViewAnalyzer::testPtrVector ( edm::Event const &  e,
std::string const &  moduleLabel 
) const

Definition at line 391 of file ViewAnalyzer.cc.

References cms::cuda::assert(), MillePedeFileConverter_cfg::e, edm::ProductID::id(), edm::HandleBase::id(), edm::HandleBase::isValid(), HerwigMaxPtPartonFilter_cfi::moduleLabel, edm::HandleBase::provenance(), and makeGlobalPositionRcd_cfg::tag.

391  {
392  typedef PtrVector<int> sequence_t;
393  typedef int value_t;
394  typedef View<value_t> view_t;
395 
396  Handle<sequence_t> hproduct;
397  e.getByLabel(moduleLabel, hproduct);
398  assert(hproduct.isValid());
399 
400  Handle<view_t> hview;
401 
402  InputTag tag(moduleLabel + "doesNotExist");
403  e.getByLabel(tag, hview);
404  assert(!hview.isValid());
405 
406  e.getByLabel(moduleLabel + "doesNotExist", hview);
407  assert(!hview.isValid());
408 
409  InputTag tag2(moduleLabel);
410  e.getByLabel(tag2, hview);
411  assert(hview.isValid());
412 
413  assert(hproduct.id() == hview.id());
414  assert(*hproduct.provenance() == *hview.provenance());
415 
416  assert(hproduct->size() == hview->size());
417 
418  sequence_t::const_iterator i_product = hproduct->begin();
419  sequence_t::const_iterator e_product = hproduct->end();
420  view_t::const_iterator i_view = hview->begin();
421  view_t::const_iterator e_view = hview->end();
422  while (i_product != e_product && i_view != e_view) {
423  value_t const& product_item = **i_product;
424  value_t const& view_item = *i_view;
425  assert(product_item == view_item);
426  ++i_product;
427  ++i_view;
428  }
429  }
ProductID id() const
Definition: HandleBase.cc:29
assert(be >=bs)
Provenance const * provenance() const
Definition: HandleBase.h:74
ProductIndex id() const
Definition: ProductID.h:35
bool isValid() const
Definition: HandleBase.h:70

◆ testRefToBaseVector()

void edmtest::ViewAnalyzer::testRefToBaseVector ( edm::Event const &  e,
std::string const &  moduleLabel 
) const

Definition at line 360 of file ViewAnalyzer.cc.

References cms::cuda::assert(), MillePedeFileConverter_cfg::e, edm::ProductID::id(), edm::HandleBase::id(), edm::HandleBase::isValid(), HerwigMaxPtPartonFilter_cfi::moduleLabel, and edm::HandleBase::provenance().

360  {
361  typedef RefToBaseVector<int> sequence_t;
362  typedef int value_t;
363  typedef View<value_t> view_t;
364 
365  Handle<sequence_t> hproduct;
366  e.getByLabel(moduleLabel, hproduct);
367  assert(hproduct.isValid());
368 
369  Handle<view_t> hview;
370  e.getByLabel(moduleLabel, hview);
371  assert(hview.isValid());
372 
373  assert(hproduct.id() == hview.id());
374  assert(*hproduct.provenance() == *hview.provenance());
375 
376  assert(hproduct->size() == hview->size());
377 
378  sequence_t::const_iterator i_product = hproduct->begin();
379  sequence_t::const_iterator e_product = hproduct->end();
380  view_t::const_iterator i_view = hview->begin();
381  view_t::const_iterator e_view = hview->end();
382  while (i_product != e_product && i_view != e_view) {
383  value_t const& product_item = **i_product;
384  value_t const& view_item = *i_view;
385  assert(product_item == view_item);
386  ++i_product;
387  ++i_view;
388  }
389  }
ProductID id() const
Definition: HandleBase.cc:29
assert(be >=bs)
Provenance const * provenance() const
Definition: HandleBase.h:74
ProductIndex id() const
Definition: ProductID.h:35
bool isValid() const
Definition: HandleBase.h:70

◆ testRefVector()

void edmtest::ViewAnalyzer::testRefVector ( edm::Event const &  e,
std::string const &  moduleLabel 
) const

Definition at line 311 of file ViewAnalyzer.cc.

References cms::cuda::assert(), edm::RefToBase< T >::castTo(), MillePedeFileConverter_cfg::e, edm::ProductID::id(), edm::HandleBase::id(), edm::HandleBase::isValid(), HerwigMaxPtPartonFilter_cfi::moduleLabel, edm::HandleBase::provenance(), and FCDTask_cfi::slot.

311  {
312  typedef RefVector<std::vector<int>> sequence_t;
313  typedef int value_t;
314  typedef View<value_t> view_t;
315 
316  Handle<sequence_t> hproduct;
317  e.getByLabel(moduleLabel, hproduct);
318  assert(hproduct.isValid());
319 
320  Handle<view_t> hview;
321  e.getByLabel(moduleLabel, hview);
322  assert(hview.isValid());
323 
324  assert(hproduct.id() == hview.id());
325  assert(*hproduct.provenance() == *hview.provenance());
326 
327  assert(hproduct->size() == hview->size());
328 
329  sequence_t::const_iterator i_product = hproduct->begin();
330  sequence_t::const_iterator e_product = hproduct->end();
331  view_t::const_iterator i_view = hview->begin();
332  view_t::const_iterator e_view = hview->end();
333  size_t slot = 0;
334  while (i_product != e_product && i_view != e_view) {
335  value_t const& product_item = **i_product;
336  value_t const& view_item = *i_view;
337  assert(product_item == view_item);
338 
339  // Tack on a test of RefToBase::castTo here
340  edm::RefToBaseProd<int> refToBaseProd(hview);
341  edm::RefToBase<int> refToBase(refToBaseProd, slot);
342 
343  edm::Ptr<int> ref = refToBase.castTo<edm::Ptr<int>>();
344  int item_other = *ref;
345  assert(item_other == product_item);
346 
347  edm::Ref<std::vector<int>> ref2 = refToBase.castTo<edm::Ref<std::vector<int>>>();
348  int item_other2 = *ref2;
349  assert(item_other2 == product_item);
350 
351  edm::Ref<sequence_t> ref3(hproduct, slot);
352  assert(*ref3 == product_item);
353 
354  ++i_product;
355  ++i_view;
356  ++slot;
357  }
358  }
ProductID id() const
Definition: HandleBase.cc:29
assert(be >=bs)
Provenance const * provenance() const
Definition: HandleBase.h:74
ProductIndex id() const
Definition: ProductID.h:35
bool isValid() const
Definition: HandleBase.h:70

◆ testStdVectorPtr()

void edmtest::ViewAnalyzer::testStdVectorPtr ( edm::Event const &  e,
std::string const &  moduleLabel 
) const

◆ testStdVectorUniquePtr()

void edmtest::ViewAnalyzer::testStdVectorUniquePtr ( edm::Event const &  e,
std::string const &  moduleLabel 
) const

Definition at line 489 of file ViewAnalyzer.cc.

References MillePedeFileConverter_cfg::e, and HerwigMaxPtPartonFilter_cfi::moduleLabel.

489  {
490  testStdVectorPtrT<std::unique_ptr<int>>(e, moduleLabel);
491  testStdVectorPtrT<std::unique_ptr<IntProduct>>(e, moduleLabel);
492  }