CMS 3D CMS Logo

Classes | Typedefs | Functions | Variables
edm::detail Namespace Reference

Classes

struct  doIsProductEqual
 
struct  doIsProductEqual< T, false >
 
struct  doIsProductEqual< T, true >
 
struct  doMergeProduct
 
struct  doMergeProduct< T, false >
 
struct  doMergeProduct< T, true >
 
struct  doSwapProduct
 
struct  doSwapProduct< T, false >
 
struct  doSwapProduct< T, true >
 
struct  ElementType
 
struct  ElementType< edmNew::DetSetVector< T > >
 
struct  getHasIsProductEqual
 
struct  getHasIsProductEqual< T, false >
 
struct  getHasIsProductEqual< T, true >
 
struct  getHasMergeFunction
 
struct  getHasMergeFunction< T, false >
 
struct  getHasMergeFunction< T, true >
 
struct  getHasSwapFunction
 
struct  getHasSwapFunction< T, false >
 
struct  getHasSwapFunction< T, true >
 
struct  getMemberType
 
struct  getMemberType< std::vector< edm::Ptr< T > >, true >
 
struct  getMemberType< std::vector< std::unique_ptr< T, Deleter > >, true >
 
struct  getMemberType< T, false >
 
struct  getMemberType< T, true >
 
struct  GetProduct
 
struct  GetProduct< RefVector< C, T, F > >
 
struct  GetProduct< std::vector< std::unique_ptr< T, D >, A > >
 
struct  getValueType
 
struct  getValueType< T, false >
 
struct  getValueType< T, true >
 
struct  has_isProductEqual_function
 
struct  has_mergeProduct_function
 
struct  has_postinsert
 
struct  has_swap_function
 
struct  has_typedef_member_type
 
struct  has_typedef_member_type< std::vector< edm::Ptr< T > > >
 
struct  has_typedef_member_type< std::vector< std::unique_ptr< T, Deleter > > >
 
struct  has_typedef_value_type
 
struct  isProductEqual_function
 
struct  IsStdOptional
 
struct  IsStdOptional< std::optional< T > >
 
struct  mergeProduct_function
 
class  NamedEventSelector
 
struct  postinsert_function
 
struct  swap_function
 
class  ThinnedOrSlimmedProduct
 
class  ThreadSafeRegistry
 
class  TriggerResultsBasedEventSelector
 

Typedefs

using GetThinnedKeyFromExceptionFactory = std::function< edm::Exception()>
 
typedef edm::Handle< edm::TriggerResultshandle_t
 
using no_tag = std::false_type
 
using yes_tag = std::true_type
 

Functions

void _throw_range (det_id_type i)
 
bool configureEventSelector (edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector, ConsumesCollector &&iC)
 
void doTheOffset (int bunchSpace, int bcr, std::vector< PCaloHit > &calohits, unsigned int evtNr, int vertexOffset, bool wrap)
 
void doTheOffset (int bunchSpace, int bcr, std::vector< PSimHit > &simhits, unsigned int evtNr, int vertexOffset, bool wrap)
 
void doTheOffset (int bunchSpace, int bcr, std::vector< SimTrack > &simtracks, unsigned int evtNr, int vertexOffset, bool wrap)
 
void doTheOffset (int bunchSpace, int bcr, std::vector< SimVertex > &simvertices, unsigned int evtNr, int vertexOffset, bool wrap)
 
void doTheOffset (int bunchSpace, int bcr, TrackingRecHitCollection &trackingrechits, unsigned int evtNr, int vertexOffset, bool wrap)
 
template<typename Item , typename Selector , typename Collection >
void fillCollectionForThinning (Item const &item, Selector &selector, unsigned int iIndex, Collection &output, ThinnedAssociation &association)
 
template<typename F >
std::variant< unsigned int, GetThinnedKeyFromExceptionFactory, std::monostate > getThinnedKeyFrom_implementation (ProductID const &parentID, BranchID const &parent, unsigned int key, ProductID const &thinnedID, BranchID thinned, ThinnedAssociationsHelper const &thinnedAssociationsHelper, F &&getThinnedAssociation)
 
template<typename F1 , typename F2 , typename F3 >
std::optional< std::tuple< WrapperBase const *, unsigned int > > getThinnedProduct (ProductID const &pid, unsigned int key, ThinnedAssociationsHelper const &thinnedAssociationsHelper, F1 pidToBid, F2 getThinnedAssociation, F3 getByProductID)
 
template<typename F1 , typename F2 , typename F3 >
ThinnedOrSlimmedProduct getThinnedProductOnSlimmingDepth (ProductID const &pid, unsigned int key, ThinnedAssociationsHelper const &thinnedAssociationsHelper, F1 pidToBid, F2 getThinnedAssociation, F3 getByProductID)
 
template<typename F1 , typename F2 , typename F3 >
void getThinnedProducts (ProductID const &pid, ThinnedAssociationsHelper const &thinnedAssociationsHelper, F1 pidToBid, F2 getThinnedAssociation, F3 getByProductID, std::vector< WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys)
 
template<typename F1 , typename F2 , typename F3 >
std::optional< std::tuple< ThinnedAssociation const *, std::vector< unsigned int > > > getThinnedProductsOnSlimmingDepth (ProductID const &pid, ThinnedAssociationsHelper const &thinnedAssociationsHelper, F1 pidToBid, F2 getThinnedAssociation, F3 getByProductID, std::vector< WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys)
 
template<typename T >
static no_tag has_isProductEqual (...)
 
template<typename T >
static yes_tag has_isProductEqual (isProductEqual_function< T, &T::isProductEqual > *dummy)
 
template<typename T >
static no_tag has_member_type (...)
 
template<typename T >
static yes_tag has_member_type (typename T::member_type *)
 
template<typename T >
static no_tag has_mergeProduct (...)
 
template<typename T >
static yes_tag has_mergeProduct (mergeProduct_function< T, &T::mergeProduct > *dummy)
 
template<typename T >
no_tag has_postinsert_helper (...)
 
template<typename T >
yes_tag has_postinsert_helper (postinsert_function< T, &T::post_insert > *p)
 
template<typename T >
static no_tag has_swap (...)
 
template<typename T >
static yes_tag has_swap (swap_function< T, &T::swap > *dummy)
 
template<typename T >
static no_tag has_value_type (...)
 
template<typename T >
static yes_tag has_value_type (typename T::value_type *)
 
std::string const & InvalidHash ()
 
auto makeThinnedIndexes (std::vector< unsigned int > const &keys, std::vector< WrapperBase const * > const &foundContainers, ThinnedAssociation const *thinnedAssociation)
 
template<typename KEY , typename T , typename E >
std::ostream & operator<< (std::ostream &os, ThreadSafeRegistry< KEY, T > const &reg)
 
template<typename COLLECTION >
void reallyfillPtrVector (COLLECTION const &coll, std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr)
 
template<class COLLECTION >
void reallyFillView (COLLECTION const &coll, ProductID const &id, std::vector< void const * > &ptrs, FillViewHelperVector &helpers)
 
template<typename COLLECTION >
void reallySetPtr (COLLECTION const &coll, std::type_info const &iToType, unsigned long iIndex, void const *&oPtr)
 
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)
 

Variables

constexpr unsigned int kThinningDoNotLookForThisIndex = std::numeric_limits<unsigned int>::max()
 

Typedef Documentation

◆ GetThinnedKeyFromExceptionFactory

Definition at line 37 of file EDProductGetter.h.

◆ handle_t

Definition at line 28 of file TriggerResultsBasedEventSelector.h.

◆ no_tag

typedef std::false_type edm::detail::no_tag

Definition at line 22 of file WrapperDetail.h.

◆ yes_tag

typedef std::true_type edm::detail::yes_tag

Definition at line 23 of file WrapperDetail.h.

Function Documentation

◆ _throw_range()

void edm::detail::_throw_range ( det_id_type  i)
inline

Definition at line 69 of file DetSetVector.h.

69  {
70  Exception::throwThis(
71  errors::InvalidReference, "DetSetVector::operator[] called with index not in collection;\nindex value: ", i);
72  }

References mps_fire::i, edm::errors::InvalidReference, and edm::Exception::throwThis().

Referenced by edm::DetSetVector< TotemRPLocalTrack::FittedRecHit >::operator[]().

◆ configureEventSelector()

bool edm::detail::configureEventSelector ( edm::ParameterSet const &  iPSet,
std::string const &  iProcessName,
std::vector< std::string > const &  iAllTriggerNames,
edm::detail::TriggerResultsBasedEventSelector oSelector,
edm::ConsumesCollector &&  iC 
)

Handles the final initialization of the TriggerResutsBasedEventSelector

Returns
true if all events will be selected

Definition at line 80 of file TriggerResultsBasedEventSelector.cc.

84  {
85  // If selectevents is an emtpy ParameterSet, then we are to write
86  // all events, or one which contains a vstrig 'SelectEvents' that
87  // is empty, we are to write all events. We have no need for any
88  // EventSelectors.
89  if (iPSet.empty()) {
90  oSelector.setupDefault();
91  return true;
92  }
93 
94  std::vector<std::string> path_specs = iPSet.getParameter<std::vector<std::string> >("SelectEvents");
95 
96  if (path_specs.empty()) {
97  oSelector.setupDefault();
98  return true;
99  }
100 
101  // If we get here, we have the possibility of having to deal with
102  // path_specs that look at more than one process.
103  std::vector<parsed_path_spec_t> parsed_paths(path_specs.size());
104  for (size_t i = 0; i < path_specs.size(); ++i) {
105  parse_path_spec(path_specs[i], parsed_paths[i]);
106  }
107  oSelector.setup(parsed_paths, iAllTriggerNames, iProcessName, std::move(iC));
108 
109  return false;
110  }

References edm::ParameterSet::empty(), edm::ParameterSet::getParameter(), mps_fire::i, eostools::move(), edm::detail::TriggerResultsBasedEventSelector::setup(), and edm::detail::TriggerResultsBasedEventSelector::setupDefault().

Referenced by edm::global::OutputModuleBase::doPreallocate(), edm::limited::OutputModuleBase::doPreallocate(), edm::one::OutputModuleBase::doPreallocate(), edm::global::OutputModuleBase::OutputModuleBase(), edm::limited::OutputModuleBase::OutputModuleBase(), edm::one::OutputModuleBase::OutputModuleBase(), and edm::SubProcess::SubProcess().

◆ doTheOffset() [1/5]

void edm::detail::doTheOffset ( int  bunchSpace,
int  bcr,
std::vector< PCaloHit > &  calohits,
unsigned int  evtNr,
int  vertexOffset,
bool  wrap 
)

Definition at line 49 of file Adjuster.cc.

50  {
51  int timeOffset = bcr * bunchSpace;
52  EncodedEventId id(bcr, evtNr);
53  for (auto& item : calohits) {
54  item.setEventId(id);
55  item.setTime(item.time() + timeOffset);
56  }
57  }

References triggerObjects_cff::id, B2GTnPMonitor_cfi::item, and CalibratedDigis_cfi::timeOffset.

◆ doTheOffset() [2/5]

void edm::detail::doTheOffset ( int  bunchSpace,
int  bcr,
std::vector< PSimHit > &  simhits,
unsigned int  evtNr,
int  vertexOffset,
bool  wrap 
)

Definition at line 28 of file Adjuster.cc.

29  {
30  int timeOffset = bcr * bunchSpace;
31  EncodedEventId id(bcr, evtNr);
32  if (wrap) { // wrap time for long-lived hits into one beam crossing
33  for (auto& item : simhits) {
34  item.setEventId(id);
35 
36  float Tfloor = floor(item.timeOfFlight());
37  float digits = item.timeOfFlight() - Tfloor;
38  int remainder = int(Tfloor) % bunchSpace;
39  item.setTof(float(remainder) + digits + timeOffset);
40  }
41  } else {
42  for (auto& item : simhits) {
43  item.setEventId(id);
44  item.setTof(item.timeOfFlight() + timeOffset);
45  }
46  }
47  }

References triggerObjects_cff::id, createfilelist::int, B2GTnPMonitor_cfi::item, HLTBitAnalyser_cfi::simhits, CalibratedDigis_cfi::timeOffset, and edm::convertException::wrap().

◆ doTheOffset() [3/5]

void edm::detail::doTheOffset ( int  bunchSpace,
int  bcr,
std::vector< SimTrack > &  simtracks,
unsigned int  evtNr,
int  vertexOffset,
bool  wrap 
)

Definition at line 7 of file Adjuster.cc.

8  {
9  EncodedEventId id(bcr, evtNr);
10  for (auto& item : simtracks) {
11  item.setEventId(id);
12  if (!item.noVertex()) {
13  item.setVertexIndex(item.vertIndex() + vertexOffset);
14  }
15  }
16  }

References triggerObjects_cff::id, and B2GTnPMonitor_cfi::item.

Referenced by edm::Adjuster< T >::doOffset().

◆ doTheOffset() [4/5]

void edm::detail::doTheOffset ( int  bunchSpace,
int  bcr,
std::vector< SimVertex > &  simvertices,
unsigned int  evtNr,
int  vertexOffset,
bool  wrap 
)

Definition at line 18 of file Adjuster.cc.

19  {
20  int timeOffset = bcr * bunchSpace;
21  EncodedEventId id(bcr, evtNr);
22  for (auto& item : simvertices) {
23  item.setEventId(id);
24  item.setTof(item.position().t() + timeOffset);
25  }
26  }

References triggerObjects_cff::id, B2GTnPMonitor_cfi::item, and CalibratedDigis_cfi::timeOffset.

◆ doTheOffset() [5/5]

void edm::detail::doTheOffset ( int  bunchSpace,
int  bcr,
TrackingRecHitCollection trackingrechits,
unsigned int  evtNr,
int  vertexOffset,
bool  wrap 
)

Definition at line 59 of file Adjuster.cc.

64  {
65  EncodedEventId id(bcr, evtNr);
66  for (auto it = trackingrechits.begin(); it != trackingrechits.end(); ++it) {
67  if (trackerHitRTTI::isFast(*it)) {
68  FastTrackerRecHit* rechit = static_cast<FastTrackerRecHit*>(&(*it));
69  rechit->setEventId(id.rawId());
70  }
71  }
72  }

References edm::OwnVector< T, P >::begin(), edm::OwnVector< T, P >::end(), triggerObjects_cff::id, trackerHitRTTI::isFast(), and FastTrackerRecHit::setEventId().

◆ fillCollectionForThinning()

template<typename Item , typename Selector , typename Collection >
void edm::detail::fillCollectionForThinning ( Item const &  item,
Selector selector,
unsigned int  iIndex,
Collection &  output,
ThinnedAssociation association 
)

Definition at line 43 of file ThinningProducer.h.

47  {
48  using SelectorChooseReturnType = decltype(selector.choose(0U, std::declval<Item const&>()));
50  if constexpr (isSlimming) {
51  std::optional<typename SelectorChooseReturnType::value_type> obj = selector.choose(iIndex, item);
52  if (obj.has_value()) {
53  // move to support std::unique_ptr<T> with edm::OwnVector<T> or std::vector<unique_ptr<T>>
54  output.push_back(std::move(*obj));
55  association.push_back(iIndex);
56  }
57  } else {
58  if (selector.choose(iIndex, item)) {
59  output.push_back(item);
60  association.push_back(iIndex);
61  }
62  }
63  }

References B2GTnPMonitor_cfi::item, eostools::move(), getGTfromDQMFile::obj, convertSQLitetoXML_cfg::output, and mitigatedMETSequence_cff::U.

Referenced by edmNew::fillCollectionForThinning(), and edm::ThinningProducer< Collection, Selector >::produce().

◆ getThinnedKeyFrom_implementation()

template<typename F >
std::variant<unsigned int, GetThinnedKeyFromExceptionFactory, std::monostate> edm::detail::getThinnedKeyFrom_implementation ( ProductID const &  parentID,
BranchID const &  parent,
unsigned int  key,
ProductID const &  thinnedID,
BranchID  thinned,
ThinnedAssociationsHelper const &  thinnedAssociationsHelper,
F &&  getThinnedAssociation 
)

Definition at line 394 of file getThinned_implementation.h.

401  {
402  // need to explicitly check for equality of parent BranchID,
403  // because ThinnedAssociationsHelper::parentBegin() uses
404  // std::lower_bound() that returns a valid iterator in case the
405  // parent is not found
406  if (auto iParent = thinnedAssociationsHelper.parentBegin(parent);
407  iParent == thinnedAssociationsHelper.parentEnd(parent) or iParent->parent() != parent) {
408  return [parentID]() {
410  << "Parent collection with ProductID " << parentID << " has not been thinned";
411  };
412  }
413 
414  bool foundParent = false;
415  std::vector<ThinnedAssociation const*> thinnedAssociationParentage;
416  while (not foundParent) {
417  // TODO: be smarter than linear search every time?
418  auto branchesToThinned = std::find_if(
419  thinnedAssociationsHelper.begin(), thinnedAssociationsHelper.end(), [&thinned](auto& associatedBranches) {
420  return associatedBranches.thinned() == thinned;
421  });
422  if (branchesToThinned == thinnedAssociationsHelper.end()) {
423  return [parentID, thinnedID, thinnedIsThinned = not thinnedAssociationParentage.empty()]() {
425  ex << "Requested thinned collection with ProductID " << thinnedID
426  << " is not thinned from the parent collection with ProductID " << parentID
427  << " or from any collection thinned from it.";
428  if (not thinnedIsThinned) {
429  ex << " In fact, the collection " << thinnedID
430  << " passed in as a 'thinned' collection has not been thinned at all.";
431  }
432  return ex;
433  };
434  }
435 
436  ThinnedAssociation const* thinnedAssociation = getThinnedAssociation(branchesToThinned->association());
437  if (thinnedAssociation == nullptr) {
439  if (thinnedAssociationParentage.empty()) {
440  ex << "ThinnedAssociation corresponding to thinned collection with ProductID " << thinnedID
441  << " not found.";
442  } else {
443  ex << "Intermediate ThinnedAssociation between the requested thinned ProductID " << thinnedID
444  << " and parent " << parentID << " not found.";
445  }
446  ex << " This should not happen.\nPlease contact the core framework developers.";
447  throw ex;
448  }
449 
450  thinnedAssociationParentage.push_back(thinnedAssociation);
451  if (branchesToThinned->parent() == parent) {
452  foundParent = true;
453  } else {
454  // next iteration with current parent as the thinned collection
455  thinned = branchesToThinned->parent();
456  }
457  }
458 
459  // found the parent, now need to rewind the parentage chain to
460  // find the index in the requested thinned collection
461  unsigned int thinnedIndex = key;
462  for (auto iAssociation = thinnedAssociationParentage.rbegin(), iEnd = thinnedAssociationParentage.rend();
463  iAssociation != iEnd;
464  ++iAssociation) {
465  auto optIndex = (*iAssociation)->getThinnedIndex(thinnedIndex);
466  if (optIndex) {
467  thinnedIndex = *optIndex;
468  } else {
469  return std::monostate{};
470  }
471  }
472  return thinnedIndex;
473  }

References edm::ThinnedAssociationsHelper::begin(), edm::ThinnedAssociationsHelper::end(), Exception, edm::errors::InvalidReference, crabWrapper::key, edm::errors::LogicError, or, class-composition::parent, edm::ThinnedAssociationsHelper::parentBegin(), and edm::ThinnedAssociationsHelper::parentEnd().

Referenced by fwlite::DataGetterHelper::getThinnedKeyFrom(), BareRootProductGetter::getThinnedKeyFrom(), and edm::EventPrincipal::getThinnedKeyFrom().

◆ getThinnedProduct()

template<typename F1 , typename F2 , typename F3 >
std::optional<std::tuple<WrapperBase const*, unsigned int> > edm::detail::getThinnedProduct ( ProductID const &  pid,
unsigned int  key,
ThinnedAssociationsHelper const &  thinnedAssociationsHelper,
F1  pidToBid,
F2  getThinnedAssociation,
F3  getByProductID 
)

Definition at line 287 of file getThinned_implementation.h.

293  {
294  auto thinnedOrSlimmed = getThinnedProductOnSlimmingDepth(
295  pid, key, thinnedAssociationsHelper, pidToBid, getThinnedAssociation, getByProductID);
296 
297  if (thinnedOrSlimmed.hasThinned()) {
298  return thinnedOrSlimmed.thinnedProduct();
299  } else if (thinnedOrSlimmed.hasSlimmed()) {
300  auto [slimmedAssociation, slimmedIndex] = thinnedOrSlimmed.slimmedAssociation();
301  ProductID const& slimmedCollectionPID = slimmedAssociation->thinnedCollectionID();
302  WrapperBase const* slimmedCollection = getByProductID(slimmedCollectionPID);
303  if (slimmedCollection == nullptr) {
304  // Slimmed container is not found, try looking recursively in thinned containers
305  // which were made by selecting elements from this thinned container.
306  return getThinnedProduct(slimmedCollectionPID,
307  slimmedIndex,
308  thinnedAssociationsHelper,
309  pidToBid,
310  getThinnedAssociation,
311  getByProductID);
312  }
313  return std::tuple(slimmedCollection, slimmedIndex);
314  }
315  return std::nullopt;
316  }

References getThinnedProductOnSlimmingDepth(), and crabWrapper::key.

Referenced by BareRootProductGetter::getThinnedProduct(), fwlite::DataGetterHelper::getThinnedProduct(), and edm::EventPrincipal::getThinnedProduct().

◆ getThinnedProductOnSlimmingDepth()

template<typename F1 , typename F2 , typename F3 >
ThinnedOrSlimmedProduct edm::detail::getThinnedProductOnSlimmingDepth ( ProductID const &  pid,
unsigned int  key,
ThinnedAssociationsHelper const &  thinnedAssociationsHelper,
F1  pidToBid,
F2  getThinnedAssociation,
F3  getByProductID 
)

Definition at line 67 of file getThinned_implementation.h.

72  {
73  BranchID parent = pidToBid(pid);
74 
75  auto associatedBranches = thinnedAssociationsHelper.parentBegin(parent);
76  auto const iEnd = thinnedAssociationsHelper.parentEnd(parent);
77 
78  if (associatedBranches == iEnd) {
79  return ThinnedOrSlimmedProduct();
80  }
81  bool const slimmedAllowed = (associatedBranches + 1 == iEnd);
82  if (slimmedAllowed and associatedBranches->isSlimmed()) {
83  // Slimmed container can be considered only if it has no (thinned) siblings
84  ThinnedAssociation const* slimmedAssociation = getThinnedAssociation(associatedBranches->association());
85  if (slimmedAssociation == nullptr or
86  associatedBranches->parent() != pidToBid(slimmedAssociation->parentCollectionID())) {
87  return ThinnedOrSlimmedProduct();
88  }
89 
90  // Does this slimmed container have the element referenced by key?
91  auto slimmedIndex = slimmedAssociation->getThinnedIndex(key);
92  if (slimmedIndex.has_value()) {
93  return ThinnedOrSlimmedProduct(slimmedAssociation, *slimmedIndex);
94  } else {
95  return ThinnedOrSlimmedProduct();
96  }
97  }
98 
99  // Loop over thinned containers which were made by selecting elements from the parent container
100  for (; associatedBranches != iEnd; ++associatedBranches) {
101  if (associatedBranches->isSlimmed()) {
102  continue;
103  }
104 
105  ThinnedAssociation const* thinnedAssociation = getThinnedAssociation(associatedBranches->association());
106  if (thinnedAssociation == nullptr)
107  continue;
108 
109  if (associatedBranches->parent() != pidToBid(thinnedAssociation->parentCollectionID())) {
110  continue;
111  }
112 
113  // Does this thinned container have the element referenced by key?
114  auto thinnedIndex = thinnedAssociation->getThinnedIndex(key);
115  if (not thinnedIndex.has_value()) {
116  continue;
117  }
118 
119  // Return a pointer to thinned container if we can find it
120  ProductID const& thinnedCollectionPID = thinnedAssociation->thinnedCollectionID();
121  WrapperBase const* thinnedCollection = getByProductID(thinnedCollectionPID);
122  if (thinnedCollection != nullptr) {
123  return ThinnedOrSlimmedProduct(thinnedCollection, *thinnedIndex);
124  }
125 
126  // Thinned container is not found, try looking recursively in thinned containers
127  // which were made by selecting elements from this thinned container.
128  auto thinnedOrSlimmed = getThinnedProductOnSlimmingDepth(thinnedCollectionPID,
129  *thinnedIndex,
130  thinnedAssociationsHelper,
131  pidToBid,
132  getThinnedAssociation,
133  getByProductID);
134  if (thinnedOrSlimmed.hasThinned() or (slimmedAllowed and thinnedOrSlimmed.hasSlimmed())) {
135  return thinnedOrSlimmed;
136  }
137  }
138 
139  return ThinnedOrSlimmedProduct();
140  }

References edm::ThinnedAssociation::getThinnedIndex(), crabWrapper::key, or, class-composition::parent, edm::ThinnedAssociationsHelper::parentBegin(), edm::ThinnedAssociation::parentCollectionID(), edm::ThinnedAssociationsHelper::parentEnd(), and edm::ThinnedAssociation::thinnedCollectionID().

Referenced by getThinnedProduct().

◆ getThinnedProducts()

template<typename F1 , typename F2 , typename F3 >
void edm::detail::getThinnedProducts ( ProductID const &  pid,
ThinnedAssociationsHelper const &  thinnedAssociationsHelper,
F1  pidToBid,
F2  getThinnedAssociation,
F3  getByProductID,
std::vector< WrapperBase const * > &  foundContainers,
std::vector< unsigned int > &  keys 
)

Definition at line 334 of file getThinned_implementation.h.

340  {
341  auto slimmed = getThinnedProductsOnSlimmingDepth(
342  pid, thinnedAssociationsHelper, pidToBid, getThinnedAssociation, getByProductID, foundContainers, keys);
343  if (slimmed.has_value()) {
344  // no thinned procucts found, try out slimmed next if one is available
345  auto [slimmedAssociation, slimmedIndexes] = std::move(*slimmed);
346  ProductID const& slimmedCollectionPID = slimmedAssociation->thinnedCollectionID();
347  WrapperBase const* slimmedCollection = getByProductID(slimmedCollectionPID);
348  unsigned const nKeys = keys.size();
349  if (slimmedCollection == nullptr) {
350  getThinnedProducts(slimmedCollectionPID,
351  thinnedAssociationsHelper,
352  pidToBid,
353  getThinnedAssociation,
354  getByProductID,
355  foundContainers,
356  slimmedIndexes);
357  for (unsigned k = 0; k < nKeys; ++k) {
358  if (foundContainers[k] == nullptr)
359  continue;
360  if (slimmedIndexes[k] == kThinningDoNotLookForThisIndex)
361  continue;
362  keys[k] = slimmedIndexes[k];
363  }
364  } else {
365  for (unsigned k = 0; k < nKeys; ++k) {
366  if (slimmedIndexes[k] == kThinningDoNotLookForThisIndex)
367  continue;
368  keys[k] = slimmedIndexes[k];
369  foundContainers[k] = slimmedCollection;
370  }
371  }
372  }
373  }

References getThinnedProductsOnSlimmingDepth(), dqmdumpme::k, relativeConstraints::keys, kThinningDoNotLookForThisIndex, and eostools::move().

Referenced by BareRootProductGetter::getThinnedProducts(), fwlite::DataGetterHelper::getThinnedProducts(), and edm::EventPrincipal::getThinnedProducts().

◆ getThinnedProductsOnSlimmingDepth()

template<typename F1 , typename F2 , typename F3 >
std::optional<std::tuple<ThinnedAssociation const*, std::vector<unsigned int> > > edm::detail::getThinnedProductsOnSlimmingDepth ( ProductID const &  pid,
ThinnedAssociationsHelper const &  thinnedAssociationsHelper,
F1  pidToBid,
F2  getThinnedAssociation,
F3  getByProductID,
std::vector< WrapperBase const * > &  foundContainers,
std::vector< unsigned int > &  keys 
)

Definition at line 187 of file getThinned_implementation.h.

194  {
195  BranchID parent = pidToBid(pid);
196 
197  auto associatedBranches = thinnedAssociationsHelper.parentBegin(parent);
198  auto const iEnd = thinnedAssociationsHelper.parentEnd(parent);
199 
200  if (associatedBranches == iEnd) {
201  return std::nullopt;
202  }
203  bool const slimmedAllowed = associatedBranches + 1 == iEnd;
204  if (slimmedAllowed and associatedBranches->isSlimmed()) {
205  // Slimmed container can be considered only if it has no (thinned) siblings
206  ThinnedAssociation const* slimmedAssociation = getThinnedAssociation(associatedBranches->association());
207  if (slimmedAssociation == nullptr or
208  associatedBranches->parent() != pidToBid(slimmedAssociation->parentCollectionID())) {
209  return std::nullopt;
210  }
211 
212  auto [slimmedIndexes, hasAny] = makeThinnedIndexes(keys, foundContainers, slimmedAssociation);
213  // Does this slimmed container have any of the elements referenced by keys?
214  if (hasAny) {
215  return std::tuple(slimmedAssociation, std::move(slimmedIndexes));
216  } else {
217  return std::nullopt;
218  }
219  }
220 
221  // Loop over thinned containers which were made by selecting elements from the parent container
222  for (; associatedBranches != iEnd; ++associatedBranches) {
223  if (associatedBranches->isSlimmed()) {
224  continue;
225  }
226 
227  ThinnedAssociation const* thinnedAssociation = getThinnedAssociation(associatedBranches->association());
228  if (thinnedAssociation == nullptr)
229  continue;
230 
231  if (associatedBranches->parent() != pidToBid(thinnedAssociation->parentCollectionID())) {
232  continue;
233  }
234 
235  auto [thinnedIndexes, hasAny] = makeThinnedIndexes(keys, foundContainers, thinnedAssociation);
236  if (!hasAny) {
237  continue;
238  }
239 
240  // Set the pointers and indexes into the thinned container (if we can find it)
241  ProductID thinnedCollectionPID = thinnedAssociation->thinnedCollectionID();
242  WrapperBase const* thinnedCollection = getByProductID(thinnedCollectionPID);
243  unsigned const nKeys = keys.size();
244  if (thinnedCollection == nullptr) {
245  // Thinned container is not found, try looking recursively in thinned containers
246  // which were made by selecting elements from this thinned container.
247  auto slimmed = getThinnedProductsOnSlimmingDepth(thinnedCollectionPID,
248  thinnedAssociationsHelper,
249  pidToBid,
250  getThinnedAssociation,
251  getByProductID,
252  foundContainers,
253  thinnedIndexes);
254  if (slimmedAllowed and slimmed.has_value()) {
255  return slimmed;
256  }
257  for (unsigned k = 0; k < nKeys; ++k) {
258  if (foundContainers[k] == nullptr)
259  continue;
260  if (thinnedIndexes[k] == kThinningDoNotLookForThisIndex)
261  continue;
262  keys[k] = thinnedIndexes[k];
263  }
264  } else {
265  for (unsigned k = 0; k < nKeys; ++k) {
266  if (thinnedIndexes[k] == kThinningDoNotLookForThisIndex)
267  continue;
268  keys[k] = thinnedIndexes[k];
269  foundContainers[k] = thinnedCollection;
270  }
271  }
272  }
273  return std::nullopt;
274  }

References dqmdumpme::k, relativeConstraints::keys, kThinningDoNotLookForThisIndex, makeThinnedIndexes(), eostools::move(), or, class-composition::parent, edm::ThinnedAssociationsHelper::parentBegin(), edm::ThinnedAssociation::parentCollectionID(), edm::ThinnedAssociationsHelper::parentEnd(), and edm::ThinnedAssociation::thinnedCollectionID().

Referenced by getThinnedProducts().

◆ has_isProductEqual() [1/2]

template<typename T >
static no_tag edm::detail::has_isProductEqual (   ...)
static

◆ has_isProductEqual() [2/2]

template<typename T >
static yes_tag edm::detail::has_isProductEqual ( isProductEqual_function< T, &T::isProductEqual > *  dummy)
static

◆ has_member_type() [1/2]

template<typename T >
static no_tag edm::detail::has_member_type (   ...)
static

◆ has_member_type() [2/2]

template<typename T >
static yes_tag edm::detail::has_member_type ( typename T::member_type *  )
static

◆ has_mergeProduct() [1/2]

template<typename T >
static no_tag edm::detail::has_mergeProduct (   ...)
static

◆ has_mergeProduct() [2/2]

template<typename T >
static yes_tag edm::detail::has_mergeProduct ( mergeProduct_function< T, &T::mergeProduct > *  dummy)
static

◆ has_postinsert_helper() [1/2]

template<typename T >
no_tag edm::detail::has_postinsert_helper (   ...)

◆ has_postinsert_helper() [2/2]

template<typename T >
yes_tag edm::detail::has_postinsert_helper ( postinsert_function< T, &T::post_insert > *  p)

◆ has_swap() [1/2]

template<typename T >
static no_tag edm::detail::has_swap (   ...)
static

◆ has_swap() [2/2]

template<typename T >
static yes_tag edm::detail::has_swap ( swap_function< T, &T::swap > *  dummy)
static

◆ has_value_type() [1/2]

template<typename T >
static no_tag edm::detail::has_value_type (   ...)
static

◆ has_value_type() [2/2]

template<typename T >
static yes_tag edm::detail::has_value_type ( typename T::value_type *  )
static

◆ InvalidHash()

std::string const & edm::detail::InvalidHash ( )

◆ makeThinnedIndexes()

auto edm::detail::makeThinnedIndexes ( std::vector< unsigned int > const &  keys,
std::vector< WrapperBase const * > const &  foundContainers,
ThinnedAssociation const *  thinnedAssociation 
)

Definition at line 142 of file getThinned_implementation.h.

144  {
145  unsigned const nKeys = keys.size();
146  std::vector<unsigned int> thinnedIndexes(nKeys, kThinningDoNotLookForThisIndex);
147  bool hasAny = false;
148  for (unsigned k = 0; k < nKeys; ++k) {
149  // Already found this one
150  if (foundContainers[k] != nullptr) {
151  continue;
152  }
153  // Already know this one is not in this thinned container
155  continue;
156  }
157  // Does the thinned container hold the entry of interest?
158  if (auto thinnedIndex = thinnedAssociation->getThinnedIndex(keys[k]); thinnedIndex.has_value()) {
159  thinnedIndexes[k] = *thinnedIndex;
160  hasAny = true;
161  }
162  }
163  return std::tuple(std::move(thinnedIndexes), hasAny);
164  }

References edm::ThinnedAssociation::getThinnedIndex(), dqmdumpme::k, relativeConstraints::keys, kThinningDoNotLookForThisIndex, and eostools::move().

Referenced by getThinnedProductsOnSlimmingDepth().

◆ operator<<()

template<typename KEY , typename T , typename E >
std::ostream& edm::detail::operator<< ( std::ostream &  os,
ThreadSafeRegistry< KEY, T > const &  reg 
)
inline

Definition at line 97 of file ThreadSafeRegistry.h.

97  {
98  reg.print(os);
99  return os;
100  }

References edm::detail::ThreadSafeRegistry< KEY, T >::print().

◆ reallyfillPtrVector()

template<typename COLLECTION >
void edm::detail::reallyfillPtrVector ( COLLECTION const &  coll,
std::type_info const &  iToType,
std::vector< unsigned long > const &  iIndicies,
std::vector< void const * > &  oPtr 
)

Definition at line 37 of file fillPtrVector.h.

40  {
41  typedef COLLECTION product_type;
42  typedef typename GetProduct<product_type>::element_type element_type;
43  typedef typename product_type::const_iterator iter;
44 
45  oPtr.reserve(iIndicies.size());
46  if (iToType == typeid(element_type)) {
47  for (std::vector<unsigned long>::const_iterator itIndex = iIndicies.begin(), itEnd = iIndicies.end();
48  itIndex != itEnd;
49  ++itIndex) {
50  iter it = coll.begin();
51  std::advance(it, *itIndex);
52  element_type const* address = GetProduct<product_type>::address(it);
53  oPtr.push_back(address);
54  }
55  } else {
56  for (std::vector<unsigned long>::const_iterator itIndex = iIndicies.begin(), itEnd = iIndicies.end();
57  itIndex != itEnd;
58  ++itIndex) {
59  iter it = coll.begin();
60  std::advance(it, *itIndex);
61  element_type const* address = GetProduct<product_type>::address(it);
62  void const* ptr = pointerToBase(iToType, address);
63  if (nullptr != ptr) {
64  oPtr.push_back(ptr);
65  } else {
66  Exception::throwThis(errors::LogicError,
67  "TypeConversionError "
68  "edm::PtrVector<> : unable to convert type ",
69  typeid(element_type).name(),
70  " to ",
71  iToType.name(),
72  "\n");
73  }
74  }
75  }
76  }

References edm::detail::GetProduct< COLLECTION >::address(), edm::errors::LogicError, Skims_PA_cff::name, edm::pointerToBase(), and edm::Exception::throwThis().

Referenced by edm::fillPtrVector(), edm::OwnArray< T, MAX_SIZE, P >::fillPtrVector(), edm::SortedCollection< EcalRecHit >::fillPtrVector(), and edm::OwnVector< TrackingRegion >::fillPtrVector().

◆ reallyFillView()

template<class COLLECTION >
void edm::detail::reallyFillView ( COLLECTION const &  coll,
ProductID const &  id,
std::vector< void const * > &  ptrs,
FillViewHelperVector helpers 
)

Definition at line 25 of file FillView.h.

28  {
29  typedef COLLECTION product_type;
30  typedef typename GetProduct<product_type>::element_type element_type;
31  typedef typename product_type::const_iterator iter;
32  typedef typename product_type::size_type size_type;
33 
34  ptrs.reserve(ptrs.size() + coll.size());
35  helpers.reserve(ptrs.size() + coll.size());
36  size_type key = 0;
37  for (iter i = coll.begin(), e = coll.end(); i != e; ++i, ++key) {
38  element_type const* address = GetProduct<product_type>::address(i);
39  ptrs.push_back(address);
40  helpers.emplace_back(id, key);
41  }
42  }

References edm::detail::GetProduct< COLLECTION >::address(), MillePedeFileConverter_cfg::e, mps_fire::i, and crabWrapper::key.

Referenced by edm::fillView(), edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::fillView(), edm::SortedCollection< EcalRecHit >::fillView(), and edm::DetSetVector< TotemRPLocalTrack::FittedRecHit >::fillView().

◆ reallySetPtr()

template<typename COLLECTION >
void edm::detail::reallySetPtr ( COLLECTION const &  coll,
std::type_info const &  iToType,
unsigned long  iIndex,
void const *&  oPtr 
)

Definition at line 36 of file setPtr.h.

36  {
37  typedef COLLECTION product_type;
38  typedef typename GetProduct<product_type>::element_type element_type;
39  typedef typename product_type::const_iterator iter;
40 
41  if (iToType == typeid(element_type)) {
42  iter it = coll.begin();
43  std::advance(it, iIndex);
44  element_type const* address = GetProduct<product_type>::address(it);
45  oPtr = address;
46  } else {
47  iter it = coll.begin();
48  std::advance(it, iIndex);
49  element_type const* address = GetProduct<product_type>::address(it);
50 
51  oPtr = pointerToBase(iToType, address);
52 
53  if (nullptr == oPtr) {
54  Exception::throwThis(errors::LogicError,
55  "TypeConversionError"
56  "edm::Ptr<> : unable to convert type ",
57  typeid(element_type).name(),
58  " to ",
59  iToType.name(),
60  "\n");
61  }
62  }
63  }

References edm::detail::GetProduct< COLLECTION >::address(), edm::errors::LogicError, Skims_PA_cff::name, edm::pointerToBase(), and edm::Exception::throwThis().

Referenced by edm::setPtr(), and edm::SortedCollection< EcalRecHit >::setPtr().

◆ registerProperSelectionInfo()

ParameterSetID edm::detail::registerProperSelectionInfo ( edm::ParameterSet const &  iInitial,
std::string const &  iLabel,
std::map< std::string, std::vector< std::pair< std::string, int > > > const &  outputModulePathPositions,
bool  anyProductProduced 
)

Takes the user specified SelectEvents PSet and creates a new one which conforms to the canonical format required for provenance

Definition at line 163 of file TriggerResultsBasedEventSelector.cc.

167  {
168  ParameterSet selectEventsInfo;
169  selectEventsInfo.copyForModify(iInitial);
170  selectEventsInfo.addParameter<bool>("InProcessHistory", anyProductProduced);
171  std::vector<std::string> endPaths;
172  std::vector<int> endPathPositions;
173 
174  // The label will be empty if and only if this is a SubProcess
175  // SubProcess's do not appear on any end path
176  if (!iLabel.empty()) {
177  std::map<std::string, std::vector<std::pair<std::string, int> > >::const_iterator iter =
178  outputModulePathPositions.find(iLabel);
179  assert(iter != outputModulePathPositions.end());
180  for (auto const& item : iter->second) {
181  endPaths.push_back(item.first);
182  endPathPositions.push_back(item.second);
183  }
184  }
185  selectEventsInfo.addParameter<std::vector<std::string> >("EndPaths", endPaths);
186  selectEventsInfo.addParameter<std::vector<int> >("EndPathPositions", endPathPositions);
187  if (!selectEventsInfo.exists("SelectEvents")) {
188  selectEventsInfo.addParameter<std::vector<std::string> >("SelectEvents", std::vector<std::string>());
189  }
190  selectEventsInfo.registerIt();
191 
192  return selectEventsInfo.id();
193  }

References edm::ParameterSet::addParameter(), cms::cuda::assert(), edm::ParameterSet::copyForModify(), edm::ParameterSet::exists(), edm::ParameterSet::id(), B2GTnPMonitor_cfi::item, and edm::ParameterSet::registerIt().

Referenced by edm::one::OutputModuleBase::setEventSelectionInfo(), and edm::SubProcess::SubProcess().

Variable Documentation

◆ kThinningDoNotLookForThisIndex

constexpr unsigned int edm::detail::kThinningDoNotLookForThisIndex = std::numeric_limits<unsigned int>::max()
constexpr
edm::detail::getThinnedProduct
std::optional< std::tuple< WrapperBase const *, unsigned int > > getThinnedProduct(ProductID const &pid, unsigned int key, ThinnedAssociationsHelper const &thinnedAssociationsHelper, F1 pidToBid, F2 getThinnedAssociation, F3 getByProductID)
Definition: getThinned_implementation.h:287
mps_fire.i
i
Definition: mps_fire.py:428
edm::errors::InvalidReference
Definition: EDMException.h:39
edm::OwnVector::end
iterator end()
Definition: OwnVector.h:285
edm::errors::LogicError
Definition: EDMException.h:37
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
GetProduct
cms::cuda::assert
assert(be >=bs)
FastTrackerRecHit
Definition: FastTrackerRecHit.h:40
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
edm::pointerToBase
void const * pointerToBase(std::type_info const &baseTypeInfo, T const *address)
Definition: OffsetToBase.h:47
EncodedEventId
Definition: EncodedEventId.h:11
FastTrackerRecHit::setEventId
virtual void setEventId(int32_t eventId)
Definition: FastTrackerRecHit.h:108
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
edm::convertException::wrap
auto wrap(F iFunc) -> decltype(iFunc())
Definition: ConvertException.h:19
edm::detail::TriggerResultsBasedEventSelector::setupDefault
void setupDefault()
Definition: TriggerResultsBasedEventSelector.cc:116
dqmdumpme.k
k
Definition: dqmdumpme.py:60
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::detail::getThinnedProductOnSlimmingDepth
ThinnedOrSlimmedProduct getThinnedProductOnSlimmingDepth(ProductID const &pid, unsigned int key, ThinnedAssociationsHelper const &thinnedAssociationsHelper, F1 pidToBid, F2 getThinnedAssociation, F3 getByProductID)
Definition: getThinned_implementation.h:67
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::MD5Result
Definition: Digest.h:11
HLTBitAnalyser_cfi.simhits
simhits
SIM objects.
Definition: HLTBitAnalyser_cfi.py:21
ParameterSet
Definition: Functions.h:16
align::invalid
Definition: StructureType.h:18
helpers
Definition: makeCompositeCandidate.h:8
edm::detail::getThinnedProductsOnSlimmingDepth
std::optional< std::tuple< ThinnedAssociation const *, std::vector< unsigned int > > > getThinnedProductsOnSlimmingDepth(ProductID const &pid, ThinnedAssociationsHelper const &thinnedAssociationsHelper, F1 pidToBid, F2 getThinnedAssociation, F3 getByProductID, std::vector< WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys)
Definition: getThinned_implementation.h:187
Exception
createfilelist.int
int
Definition: createfilelist.py:10
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
edm::detail::TriggerResultsBasedEventSelector::setup
void setup(std::vector< parsed_path_spec_t > const &path_specs, std::vector< std::string > const &triggernames, std::string const &process_name, ConsumesCollector &&iC)
Definition: TriggerResultsBasedEventSelector.cc:118
eostools.move
def move(src, dest)
Definition: eostools.py:511
hgcal::association
std::tuple< layerClusterToCaloParticle, caloParticleToLayerCluster > association
Definition: LayerClusterAssociatorByEnergyScoreImpl.h:44
edm::detail::makeThinnedIndexes
auto makeThinnedIndexes(std::vector< unsigned int > const &keys, std::vector< WrapperBase const * > const &foundContainers, ThinnedAssociation const *thinnedAssociation)
Definition: getThinned_implementation.h:142
CalibratedDigis_cfi.timeOffset
timeOffset
Definition: CalibratedDigis_cfi.py:23
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:245
cms::MD5Result::compactForm
std::string compactForm() const
Definition: Digest.cc:109
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
or
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::detail::kThinningDoNotLookForThisIndex
constexpr unsigned int kThinningDoNotLookForThisIndex
Definition: getThinned_implementation.h:21
edm::detail::getThinnedProducts
void getThinnedProducts(ProductID const &pid, ThinnedAssociationsHelper const &thinnedAssociationsHelper, F1 pidToBid, F2 getThinnedAssociation, F3 getByProductID, std::vector< WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys)
Definition: getThinned_implementation.h:334
edm::OwnVector::begin
iterator begin()
Definition: OwnVector.h:280
crabWrapper.key
key
Definition: crabWrapper.py:19
class-composition.parent
parent
Definition: class-composition.py:88
trackerHitRTTI::isFast
bool isFast(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:37
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37