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)
 
void annotateResolverMakerExceptionAndRethrow (cms::Exception &except, std::string const &modtype, ModuleTypeResolverBase const *resolver)
 
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< 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, std::vector< PSimHit > &simhits, unsigned int evtNr, int vertexOffset, bool wrap)
 
void doTheOffset (int bunchSpace, int bcr, std::vector< PCaloHit > &calohits, 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 yes_tag has_isProductEqual (isProductEqual_function< T, &T::isProductEqual > *dummy)
 
template<typename T >
static no_tag has_isProductEqual (...)
 
template<typename T >
static yes_tag has_member_type (typename T::member_type *)
 
template<typename T >
static no_tag has_member_type (...)
 
template<typename T >
static yes_tag has_mergeProduct (mergeProduct_function< T, &T::mergeProduct > *dummy)
 
template<typename T >
static no_tag has_mergeProduct (...)
 
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 yes_tag has_swap (swap_function< T, &T::swap > *dummy)
 
template<typename T >
static no_tag has_swap (...)
 
template<typename T >
static yes_tag has_value_type (typename T::value_type *)
 
template<typename T >
static no_tag has_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)
 
void processEDAliases (std::vector< std::string > const &aliasNamesToProcess, std::unordered_set< std::string > const &aliasModulesToProcess, ParameterSet const &proc_pset, std::string const &processName, ProductRegistry &preg)
 
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)
 
template<typename TFactory , typename TCache >
auto resolveMaker (std::string const &moduleType, ModuleTypeResolverMaker const *resolverMaker, edm::ParameterSet const &modulePSet, TCache &makerCache) -> typename TCache::mapped_type::element_type const *
 

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.

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

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

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

◆ annotateResolverMakerExceptionAndRethrow()

void edm::detail::annotateResolverMakerExceptionAndRethrow ( cms::Exception except,
std::string const &  modtype,
ModuleTypeResolverBase const *  resolver 
)

Definition at line 4 of file resolverMaker.cc.

References cms::Exception::addAdditionalInfo(), eostools::move(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by resolveMaker().

6  {
7  if (not resolver) {
8  throw except;
9  }
10  //if needed, create list of alternative types that were tried
11  std::string alternativeTypes;
12  auto index = resolver->kInitialIndex;
13  auto newType = modtype;
14  int tries = 0;
15  do {
16  ++tries;
17  if (not alternativeTypes.empty()) {
18  alternativeTypes.append(", ");
19  }
20  auto [ttype, tindex] = resolver->resolveType(std::move(newType), index);
21  newType = std::move(ttype);
22  index = tindex;
23  alternativeTypes.append(newType);
24  } while (index != resolver->kLastIndex);
25  if (tries == 1 and alternativeTypes == modtype) {
26  throw except;
27  }
28  alternativeTypes.insert(0, "These alternative types were tried: ");
29  except.addAdditionalInfo(alternativeTypes);
30  throw except;
31  }
void addAdditionalInfo(std::string const &info)
Definition: Exception.cc:173
def move(src, dest)
Definition: eostools.py:511

◆ 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.

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

Referenced by edm::core::OutputModuleCore::doPreallocate_(), edm::core::OutputModuleCore::OutputModuleCore(), and edm::SubProcess::SubProcess().

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  }
void setup(std::vector< parsed_path_spec_t > const &path_specs, std::vector< std::string > const &triggernames, std::string const &process_name, ConsumesCollector &&iC)
def move(src, dest)
Definition: eostools.py:511

◆ doTheOffset() [1/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.

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

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

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  }

◆ doTheOffset() [2/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.

References l1ctLayer2EG_cff::id, B2GTnPMonitor_cfi::item, and simBeamSpotPI::timeOffset.

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  }

◆ doTheOffset() [3/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.

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

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  }
auto wrap(F iFunc) -> decltype(iFunc())

◆ doTheOffset() [4/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.

References l1ctLayer2EG_cff::id, B2GTnPMonitor_cfi::item, and simBeamSpotPI::timeOffset.

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  }

◆ 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.

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

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  }
virtual void setEventId(int32_t eventId)
iterator begin()
Definition: OwnVector.h:280
bool isFast(TrackingRecHit const &hit)
iterator end()
Definition: OwnVector.h:285

◆ 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.

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().

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  }
std::tuple< layerClusterToCaloParticle, caloParticleToLayerCluster > association
def move(src, dest)
Definition: eostools.py:511

◆ 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 395 of file getThinned_implementation.h.

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().

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

◆ 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 288 of file getThinned_implementation.h.

References getThinnedProductOnSlimmingDepth(), crabWrapper::key, and mkLumiAveragedPlots::tuple.

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

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

◆ 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 68 of file getThinned_implementation.h.

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().

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

◆ 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 335 of file getThinned_implementation.h.

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

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

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

◆ 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 188 of file getThinned_implementation.h.

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

Referenced by getThinnedProducts().

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

◆ has_isProductEqual() [1/2]

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

◆ has_isProductEqual() [2/2]

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

◆ has_member_type() [1/2]

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

◆ has_member_type() [2/2]

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

◆ has_mergeProduct() [1/2]

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

◆ has_mergeProduct() [2/2]

template<typename T >
static no_tag edm::detail::has_mergeProduct (   ...)
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 yes_tag edm::detail::has_swap ( swap_function< T, &T::swap > *  dummy)
static

◆ has_swap() [2/2]

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

◆ has_value_type() [1/2]

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

◆ has_value_type() [2/2]

template<typename T >
static no_tag edm::detail::has_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 
)
inline

Definition at line 143 of file getThinned_implementation.h.

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

Referenced by getThinnedProductsOnSlimmingDepth().

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

◆ 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  }

◆ processEDAliases()

void edm::detail::processEDAliases ( std::vector< std::string > const &  aliasNamesToProcess,
std::unordered_set< std::string > const &  aliasModulesToProcess,
ParameterSet const &  proc_pset,
std::string const &  processName,
ProductRegistry preg 
)

Process and insert EDAliases to ProductRegistry

Processes only those EDAliases whose names are given in aliasNamesToProcess. If aliasModulesToProcess is not empty, only those alias branches that point to modules named in aliasModulesToProcess are processed.

Definition at line 90 of file processEDAliases.cc.

References edm::ProductRegistry::addLabelAlias(), SiStripOfflineCRack_cfg::alias, cms::cuda::assert(), edm::errors::Configuration, submitPVResolutionJobs::desc, relativeConstraints::empty, Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), edm::ParameterSet::getParameterSet(), HerwigMaxPtPartonFilter_cfi::moduleLabel, SimL1EmulatorRepack_CalouGT_cff::processName, dumpMFGeometry_cfg::prod, edm::ProductRegistry::productList(), muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::Schedule::finishSetup(), and edm::ConditionalTaskHelper::processSwitchEDAliases().

94  {
95  if (aliasNamesToProcess.empty()) {
96  return;
97  }
98  std::string const star("*");
99  std::string const empty("");
101  desc.add<std::string>("type");
102  desc.add<std::string>("fromProductInstance", star);
103  desc.add<std::string>("toProductInstance", star);
104 
105  std::multimap<BranchKey, BranchKey> aliasMap;
106 
107  std::map<BranchKey, BranchKey> aliasKeys; // Used to search for duplicates or clashes.
108 
109  // Auxiliary search structure to support wildcard for friendlyClassName
110  std::multimap<std::string, BranchKey> moduleLabelToBranches;
111  for (auto const& prod : preg.productList()) {
112  if (processName == prod.second.processName()) {
113  moduleLabelToBranches.emplace(prod.first.moduleLabel(), prod.first);
114  }
115  }
116 
117  // Now, loop over the alias information and store it in aliasMap.
118  for (std::string const& alias : aliasNamesToProcess) {
119  ParameterSet const& aliasPSet = proc_pset.getParameterSet(alias);
120  std::vector<std::string> vPSetNames = aliasPSet.getParameterNamesForType<VParameterSet>();
121  for (std::string const& moduleLabel : vPSetNames) {
122  if (not aliasModulesToProcess.empty() and
123  aliasModulesToProcess.find(moduleLabel) == aliasModulesToProcess.end()) {
124  continue;
125  }
126 
127  VParameterSet vPSet = aliasPSet.getParameter<VParameterSet>(moduleLabel);
128  for (ParameterSet& pset : vPSet) {
129  desc.validate(pset);
130  std::string friendlyClassName = pset.getParameter<std::string>("type");
131  std::string productInstanceName = pset.getParameter<std::string>("fromProductInstance");
132  std::string instanceAlias = pset.getParameter<std::string>("toProductInstance");
133 
134  if (friendlyClassName == star) {
135  bool processHasLabel = false;
136  bool match = false;
137  for (auto it = moduleLabelToBranches.lower_bound(moduleLabel);
138  it != moduleLabelToBranches.end() && it->first == moduleLabel;
139  ++it) {
140  processHasLabel = true;
141  if (productInstanceName != star and productInstanceName != it->second.productInstanceName()) {
142  continue;
143  }
144  match = true;
145 
146  checkAndInsertAlias(it->second.friendlyClassName(),
147  moduleLabel,
148  it->second.productInstanceName(),
149  processName,
150  alias,
151  instanceAlias,
152  preg,
153  aliasMap,
154  aliasKeys);
155  }
156  if (not match and processHasLabel) {
157  // No product was found matching the alias.
158  // We throw an exception only if a module with the specified module label was created in this process.
159  // Note that if that condition is ever relatex, it might be best to throw an exception with different
160  // message (omitting productInstanceName) in case 'productInstanceName == start'
161  throw Exception(errors::Configuration, "EDAlias parameter set mismatch\n")
162  << "There are no products with module label '" << moduleLabel << "' and product instance name '"
163  << productInstanceName << "'.\n";
164  }
165  } else if (productInstanceName == star) {
166  bool match = false;
167  BranchKey lowerBound(friendlyClassName, moduleLabel, empty, empty);
168  for (ProductRegistry::ProductList::const_iterator it = preg.productList().lower_bound(lowerBound);
169  it != preg.productList().end() && it->first.friendlyClassName() == friendlyClassName &&
170  it->first.moduleLabel() == moduleLabel;
171  ++it) {
172  if (it->first.processName() != processName) {
173  continue;
174  }
175  match = true;
176 
177  checkAndInsertAlias(friendlyClassName,
178  moduleLabel,
179  it->first.productInstanceName(),
180  processName,
181  alias,
182  instanceAlias,
183  preg,
184  aliasMap,
185  aliasKeys);
186  }
187  if (!match) {
188  // No product was found matching the alias.
189  // We throw an exception only if a module with the specified module label was created in this process.
190  for (auto const& product : preg.productList()) {
191  if (moduleLabel == product.first.moduleLabel() && processName == product.first.processName()) {
192  throw Exception(errors::Configuration, "EDAlias parameter set mismatch\n")
193  << "There are no products of type '" << friendlyClassName << "'\n"
194  << "with module label '" << moduleLabel << "'.\n";
195  }
196  }
197  }
198  } else {
199  checkAndInsertAlias(friendlyClassName,
200  moduleLabel,
201  productInstanceName,
202  processName,
203  alias,
204  instanceAlias,
205  preg,
206  aliasMap,
207  aliasKeys);
208  }
209  }
210  }
211  }
212 
213  // Now add the new alias entries to the product registry.
214  for (auto const& aliasEntry : aliasMap) {
215  // Then check that the alias-for product exists
216  ProductRegistry::ProductList::const_iterator it = preg.productList().find(aliasEntry.first);
217  assert(it != preg.productList().end());
218  preg.addLabelAlias(it->second, aliasEntry.second.moduleLabel(), aliasEntry.second.productInstanceName());
219  }
220  }
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:34
assert(be >=bs)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10

◆ 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.

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

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

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  }
void const * pointerToBase(std::type_info const &baseTypeInfo, T const *address)
Definition: OffsetToBase.h:47

◆ 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.

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().

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  }
uint16_t size_type

◆ 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.

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().

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  }
void const * pointerToBase(std::type_info const &baseTypeInfo, T const *address)
Definition: OffsetToBase.h:47

◆ 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.

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::core::OutputModuleCore::setEventSelectionInfo(), and edm::SubProcess::SubProcess().

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  }
assert(be >=bs)

◆ resolveMaker()

template<typename TFactory , typename TCache >
auto edm::detail::resolveMaker ( std::string const &  moduleType,
ModuleTypeResolverMaker const *  resolverMaker,
edm::ParameterSet const &  modulePSet,
TCache &  makerCache 
) -> typename TCache::mapped_type::element_type const*

Definition at line 20 of file resolveMaker.h.

References annotateResolverMakerExceptionAndRethrow(), beamerCreator::create(), newFWLiteAna::found, get, visualization-live-secondInstance_cfg::m, eostools::move(), and summarizeEdmComparisonLogfiles::succeeded.

23  {
24  if (resolverMaker) {
25  auto resolver = resolverMaker->makeResolver(modulePSet);
26  auto index = resolver->kInitialIndex;
27  auto newType = moduleType;
28  do {
29  auto [ttype, tindex] = resolver->resolveType(std::move(newType), index);
30  newType = std::move(ttype);
31  index = tindex;
32  // try the maker cache first
33  auto found = makerCache.find(newType);
34  if (found != makerCache.end()) {
35  return found->second.get();
36  }
37 
38  // if not in cache, then try to create
39  auto m = TFactory::get()->tryToCreate(newType);
40  if (m) {
41  //FDEBUG(1) << "Factory: created worker of type " << newType << std::endl;
42  auto [it, succeeded] = makerCache.emplace(newType, std::move(m));
43  if (not succeeded) {
44  return nullptr;
45  }
46  return it->second.get();
47  }
48  // not found, try next one
49  } while (index != resolver->kLastIndex);
50  try {
51  //failed to find a plugin
52  auto m = TFactory::get()->create(moduleType);
53  return nullptr; // dummy return, the create() call throws an exception
54  } catch (cms::Exception& iExcept) {
55  detail::annotateResolverMakerExceptionAndRethrow(iExcept, moduleType, resolver.get());
56  }
57  }
58  auto [it, succeeded] = makerCache.emplace(moduleType, TFactory::get()->create(moduleType));
59  //FDEBUG(1) << "Factory: created worker of type " << moduleType << std::endl;
60  if (not succeeded) {
61  return nullptr;
62  }
63  return it->second.get();
64  }
void annotateResolverMakerExceptionAndRethrow(cms::Exception &except, std::string const &modtype, ModuleTypeResolverBase const *resolver)
Definition: resolverMaker.cc:4
def create(alignables, pedeDump, additionalData, outputFile, config)
#define get
def move(src, dest)
Definition: eostools.py:511

Variable Documentation

◆ kThinningDoNotLookForThisIndex

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