CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
edmtest::ThinningDSVThingSelector Class Reference

Public Member Functions

bool choose (unsigned int iIndex, edmtest::Thing const &iItem) const
 
void preChoose (edm::Handle< edmNew::DetSetVector< Thing >> tc, edm::Event const &event, edm::EventSetup const &es)
 
void reset ()
 
 ThinningDSVThingSelector (edm::ParameterSet const &pset, edm::ConsumesCollector &&cc)
 

Static Public Member Functions

static void fillPSetDescription (edm::ParameterSetDescription &desc)
 

Private Attributes

unsigned int const expectedDetSets_
 
unsigned int const expectedDetSetSize_
 
edm::ThinnedRefSet< edmNew::DetSetVector< Thing > > keysToSave_
 
unsigned int const offsetToValue_
 
int const slimmedValueFactor_
 
edm::EDGetTokenT< TrackOfDSVThingsCollection > const trackToken_
 

Detailed Description

Definition at line 21 of file ThinningDSVThingProducer.cc.

Constructor & Destructor Documentation

◆ ThinningDSVThingSelector()

edmtest::ThinningDSVThingSelector::ThinningDSVThingSelector ( edm::ParameterSet const &  pset,
edm::ConsumesCollector &&  cc 
)

Definition at line 42 of file ThinningDSVThingProducer.cc.

43  : trackToken_(cc.consumes<TrackOfDSVThingsCollection>(pset.getParameter<edm::InputTag>("trackTag"))),
44  keysToSave_(pset.getParameter<bool>("thinnedRefSetIgnoreInvalidParentRef")
47  offsetToValue_(pset.getParameter<unsigned int>("offsetToValue")),
48  expectedDetSets_(pset.getParameter<unsigned int>("expectedDetSets")),
49  expectedDetSetSize_(pset.getParameter<unsigned int>("expectedDetSetSize")),
50  slimmedValueFactor_(pset.getParameter<int>("slimmedValueFactor")) {}
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
edm::ThinnedRefSet< edmNew::DetSetVector< Thing > > keysToSave_
edm::EDGetTokenT< TrackOfDSVThingsCollection > const trackToken_

Member Function Documentation

◆ choose()

bool edmtest::ThinningDSVThingSelector::choose ( unsigned int  iIndex,
edmtest::Thing const &  iItem 
) const

Definition at line 84 of file ThinningDSVThingProducer.cc.

References edm::ThinnedRefSet< C >::contains(), Exception, keysToSave_, offsetToValue_, and slimmedValueFactor_.

84  {
85  // Just checking to see the element in the container got passed in OK. Not really using it.
86  // Just using %10 because it coincidentally works with the arbitrary numbers I picked, no meaning really.
87  auto const expected = slimmedValueFactor_ * (iIndex + offsetToValue_);
88  if (static_cast<unsigned>(iItem.a % 10) != static_cast<unsigned>(expected % 10)) {
89  throw cms::Exception("TestFailure") << "ThinningDSVThingSelector::choose, item content = " << iItem.a
90  << " index = " << iIndex << " expected " << expected;
91  }
92 
93  // Save the Things referenced by the Tracks
94  return keysToSave_.contains(iIndex);
95  }
bool contains(unsigned int key) const
Definition: ThinnedRefSet.h:94
edm::ThinnedRefSet< edmNew::DetSetVector< Thing > > keysToSave_

◆ fillPSetDescription()

void edmtest::ThinningDSVThingSelector::fillPSetDescription ( edm::ParameterSetDescription desc)
static

Definition at line 52 of file ThinningDSVThingProducer.cc.

References submitPVResolutionJobs::desc.

52  {
53  desc.add<edm::InputTag>("trackTag");
54  desc.add<unsigned int>("offsetToValue", 0);
55  desc.add<unsigned int>("expectedDetSets");
56  desc.add<unsigned int>("expectedDetSetSize");
57  desc.add<int>("slimmedValueFactor", 1);
58  desc.add<bool>("thinnedRefSetIgnoreInvalidParentRef", false);
59  }

◆ preChoose()

void edmtest::ThinningDSVThingSelector::preChoose ( edm::Handle< edmNew::DetSetVector< Thing >>  tc,
edm::Event const &  event,
edm::EventSetup const &  es 
)

Definition at line 61 of file ThinningDSVThingProducer.cc.

References Exception, expectedDetSets_, expectedDetSetSize_, edm::ThinnedRefSet< C >::fill(), trigObjTnPSource_cfi::filler, keysToSave_, HLT_2024v10_cff::track, and trackToken_.

63  {
64  auto filler = keysToSave_.fill(edm::RefProd(tc), event.productGetter());
65  for (auto const& track : event.get(trackToken_)) {
66  filler.insert(track.ref1);
67  filler.insert(track.ref2);
68  }
69 
70  // Just checking to see if the collection got passed in. Not really using it for anything.
71  if (tc->size() != expectedDetSets_) {
72  throw cms::Exception("TestFailure") << "ThinningDSVThingSelector::preChoose, number of DetSets = " << tc->size()
73  << " expected = " << expectedDetSets_;
74  }
75  for (auto const& ds : *tc) {
76  if (ds.size() != expectedDetSetSize_) {
77  throw cms::Exception("TestFailure")
78  << "ThinningDSVThingSelector::preChoose, number of elements in DetSet with id " << ds.id() << " = "
79  << ds.size() << " expected = " << expectedDetSetSize_;
80  }
81  }
82  }
edm::ThinnedRefSet< edmNew::DetSetVector< Thing > > keysToSave_
edm::EDGetTokenT< TrackOfDSVThingsCollection > const trackToken_
Filler fill(RefProd< C > thinned, edm::EDProductGetter const &prodGetter)
Definition: ThinnedRefSet.h:88
Definition: event.py:1

◆ reset()

void edmtest::ThinningDSVThingSelector::reset ( void  )
inline

Definition at line 31 of file ThinningDSVThingProducer.cc.

References edm::ThinnedRefSet< C >::clear(), and keysToSave_.

31 { keysToSave_.clear(); }
edm::ThinnedRefSet< edmNew::DetSetVector< Thing > > keysToSave_

Member Data Documentation

◆ expectedDetSets_

unsigned int const edmtest::ThinningDSVThingSelector::expectedDetSets_
private

Definition at line 37 of file ThinningDSVThingProducer.cc.

Referenced by preChoose().

◆ expectedDetSetSize_

unsigned int const edmtest::ThinningDSVThingSelector::expectedDetSetSize_
private

Definition at line 38 of file ThinningDSVThingProducer.cc.

Referenced by preChoose().

◆ keysToSave_

edm::ThinnedRefSet<edmNew::DetSetVector<Thing> > edmtest::ThinningDSVThingSelector::keysToSave_
private

Definition at line 35 of file ThinningDSVThingProducer.cc.

Referenced by choose(), preChoose(), and reset().

◆ offsetToValue_

unsigned int const edmtest::ThinningDSVThingSelector::offsetToValue_
private

Definition at line 36 of file ThinningDSVThingProducer.cc.

Referenced by choose().

◆ slimmedValueFactor_

int const edmtest::ThinningDSVThingSelector::slimmedValueFactor_
private

Definition at line 39 of file ThinningDSVThingProducer.cc.

Referenced by choose().

◆ trackToken_

edm::EDGetTokenT<TrackOfDSVThingsCollection> const edmtest::ThinningDSVThingSelector::trackToken_
private

Definition at line 34 of file ThinningDSVThingProducer.cc.

Referenced by preChoose().