Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-15 01:25:02

0001 #ifndef UtilAlgos_SingleObjectSelector_h
0002 #define UtilAlgos_SingleObjectSelector_h
0003 /* \class SingleObjectSelector
0004  *
0005  * \author Luca Lista, INFN
0006  */
0007 #include "CommonTools/UtilAlgos/interface/ObjectSelectorBase.h"
0008 #include "CommonTools/UtilAlgos/interface/NonNullNumberSelector.h"
0009 #include "CommonTools/UtilAlgos/interface/StoreManagerTrait.h"
0010 #include "CommonTools/UtilAlgos/interface/SelectedOutputCollectionTrait.h"
0011 #include "CommonTools/UtilAlgos/interface/NullPostProcessor.h"
0012 #include "CommonTools/UtilAlgos/interface/EventSetupInitTrait.h"
0013 #include "CommonTools/UtilAlgos/interface/StoreContainerTrait.h"
0014 #include "CommonTools/UtilAlgos/interface/SelectionAdderTrait.h"
0015 #include "CommonTools/UtilAlgos/interface/SingleElementCollectionSelector.h"
0016 
0017 /* the following is just to ease transition
0018  *    grep -r SingleObjectSelector * | wc 
0019  *      209     540   22532
0020  */
0021 
0022 template <typename InputCollection,
0023           typename Selector,
0024           typename EdmFilter,
0025           typename OutputCollection = typename ::helper::SelectedOutputCollectionTrait<InputCollection>::type,
0026           typename StoreContainer = typename ::helper::StoreContainerTrait<OutputCollection>::type,
0027           typename PostProcessor = ::helper::NullPostProcessor<OutputCollection>,
0028           typename StoreManager = typename ::helper::StoreManagerTrait<OutputCollection, EdmFilter>::type,
0029           typename Base = typename ::helper::StoreManagerTrait<OutputCollection, EdmFilter>::base,
0030           typename RefAdder = typename ::helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
0031 class SingleObjectSelectorBase
0032     : public ObjectSelectorBase<
0033           SingleElementCollectionSelector<InputCollection, Selector, OutputCollection, StoreContainer, RefAdder>,
0034           OutputCollection,
0035           NonNullNumberSelector,
0036           PostProcessor,
0037           StoreManager,
0038           Base,
0039           typename ::reco::modules::EventSetupInit<
0040               SingleElementCollectionSelector<InputCollection, Selector, OutputCollection, StoreContainer, RefAdder>>::
0041               type> {
0042   using Init = typename ::reco::modules::EventSetupInit<
0043       SingleElementCollectionSelector<InputCollection, Selector, OutputCollection, StoreContainer, RefAdder>>::type;
0044 
0045 public:
0046   // SingleObjectSelectorBase() = default;
0047   explicit SingleObjectSelectorBase(const edm::ParameterSet& cfg)
0048       : ObjectSelectorBase<
0049             SingleElementCollectionSelector<InputCollection, Selector, OutputCollection, StoreContainer, RefAdder>,
0050             OutputCollection,
0051             NonNullNumberSelector,
0052             PostProcessor,
0053             StoreManager,
0054             Base,
0055             Init>(cfg) {}
0056   ~SingleObjectSelectorBase() override {}
0057 };
0058 
0059 #include "FWCore/Framework/interface/stream/EDFilter.h"
0060 
0061 template <typename InputCollection,
0062           typename Selector,
0063           typename OutputCollection = typename ::helper::SelectedOutputCollectionTrait<InputCollection>::type,
0064           typename StoreContainer = typename ::helper::StoreContainerTrait<OutputCollection>::type,
0065           typename PostProcessor = ::helper::NullPostProcessor<OutputCollection>>
0066 using SingleObjectSelectorStream = SingleObjectSelectorBase<InputCollection,
0067                                                             Selector,
0068                                                             edm::stream::EDFilter<>,
0069                                                             OutputCollection,
0070                                                             StoreContainer,
0071                                                             PostProcessor>;
0072 
0073 template <typename InputCollection,
0074           typename Selector,
0075           typename OutputCollection = typename ::helper::SelectedOutputCollectionTrait<InputCollection>::type,
0076           typename StoreContainer = typename ::helper::StoreContainerTrait<OutputCollection>::type,
0077           typename PostProcessor = ::helper::NullPostProcessor<OutputCollection>>
0078 using SingleObjectSelector =
0079     SingleObjectSelectorStream<InputCollection, Selector, OutputCollection, StoreContainer, PostProcessor>;
0080 
0081 #endif