SingleObjectSelectorBase

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
#ifndef UtilAlgos_SingleObjectSelector_h
#define UtilAlgos_SingleObjectSelector_h
/* \class SingleObjectSelector
 *
 * \author Luca Lista, INFN
 */
#include "CommonTools/UtilAlgos/interface/ObjectSelectorBase.h"
#include "CommonTools/UtilAlgos/interface/NonNullNumberSelector.h"
#include "CommonTools/UtilAlgos/interface/StoreManagerTrait.h"
#include "CommonTools/UtilAlgos/interface/SelectedOutputCollectionTrait.h"
#include "CommonTools/UtilAlgos/interface/NullPostProcessor.h"
#include "CommonTools/UtilAlgos/interface/EventSetupInitTrait.h"
#include "CommonTools/UtilAlgos/interface/StoreContainerTrait.h"
#include "CommonTools/UtilAlgos/interface/SelectionAdderTrait.h"
#include "CommonTools/UtilAlgos/interface/SingleElementCollectionSelector.h"

/* the following is just to ease transition
 *    grep -r SingleObjectSelector * | wc 
 *      209     540   22532
 */

template <typename InputCollection,
          typename Selector,
          typename EdmFilter,
          typename OutputCollection = typename ::helper::SelectedOutputCollectionTrait<InputCollection>::type,
          typename StoreContainer = typename ::helper::StoreContainerTrait<OutputCollection>::type,
          typename PostProcessor = ::helper::NullPostProcessor<OutputCollection>,
          typename StoreManager = typename ::helper::StoreManagerTrait<OutputCollection, EdmFilter>::type,
          typename Base = typename ::helper::StoreManagerTrait<OutputCollection, EdmFilter>::base,
          typename RefAdder = typename ::helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
class SingleObjectSelectorBase
    : public ObjectSelectorBase<
          SingleElementCollectionSelector<InputCollection, Selector, OutputCollection, StoreContainer, RefAdder>,
          OutputCollection,
          NonNullNumberSelector,
          PostProcessor,
          StoreManager,
          Base,
          typename ::reco::modules::EventSetupInit<
              SingleElementCollectionSelector<InputCollection, Selector, OutputCollection, StoreContainer, RefAdder>>::
              type> {
  using Init = typename ::reco::modules::EventSetupInit<
      SingleElementCollectionSelector<InputCollection, Selector, OutputCollection, StoreContainer, RefAdder>>::type;

public:
  // SingleObjectSelectorBase() = default;
  explicit SingleObjectSelectorBase(const edm::ParameterSet& cfg)
      : ObjectSelectorBase<
            SingleElementCollectionSelector<InputCollection, Selector, OutputCollection, StoreContainer, RefAdder>,
            OutputCollection,
            NonNullNumberSelector,
            PostProcessor,
            StoreManager,
            Base,
            Init>(cfg) {}
  ~SingleObjectSelectorBase() override {}
};

#include "FWCore/Framework/interface/stream/EDFilter.h"

template <typename InputCollection,
          typename Selector,
          typename OutputCollection = typename ::helper::SelectedOutputCollectionTrait<InputCollection>::type,
          typename StoreContainer = typename ::helper::StoreContainerTrait<OutputCollection>::type,
          typename PostProcessor = ::helper::NullPostProcessor<OutputCollection>>
using SingleObjectSelectorStream = SingleObjectSelectorBase<InputCollection,
                                                            Selector,
                                                            edm::stream::EDFilter<>,
                                                            OutputCollection,
                                                            StoreContainer,
                                                            PostProcessor>;

template <typename InputCollection,
          typename Selector,
          typename OutputCollection = typename ::helper::SelectedOutputCollectionTrait<InputCollection>::type,
          typename StoreContainer = typename ::helper::StoreContainerTrait<OutputCollection>::type,
          typename PostProcessor = ::helper::NullPostProcessor<OutputCollection>>
using SingleObjectSelector =
    SingleObjectSelectorStream<InputCollection, Selector, OutputCollection, StoreContainer, PostProcessor>;

#endif