CMS 3D CMS Logo

PATTriggerObjectStandAloneSlimmer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: PatAlgos
4 // Class: pat::PATTriggerObjectStandAloneSlimmer
5 //
6 //
20 
22 #include <set>
23 
24 namespace pat {
25 
27 
28  public:
29 
30  explicit PATTriggerObjectStandAloneSlimmer( const edm::ParameterSet & iConfig );
32 
33  private:
34 
35  void produce(edm::StreamID, edm::Event & iEvent, const edm::EventSetup& iSetup) const override;
36 
39 
41 
42  };
43 
44 }
45 
46 
47 using namespace pat;
48 
49 
51  srcToken_( consumes<TriggerObjectStandAloneCollection>( iConfig.getParameter<edm::InputTag>( "src" ) ) ),
52  triggerResultsToken_( consumes< edm::TriggerResults >( iConfig.getParameter< edm::InputTag >( "triggerResults" ) ) ),
53  packFilterLabels_( iConfig.getParameter<bool>("packFilterLabels") ),
54  packP4_( iConfig.getParameter<bool>("packP4") )
55 {
56  produces<TriggerObjectStandAloneCollection>();
57  if (packFilterLabels_) {
58  produces<std::vector<std::string>>("filterLabels");
59  }
60 }
61 
63 {
65  iEvent.getByToken( srcToken_, src );
67  iEvent.getByToken( triggerResultsToken_, triggerResults );
68 
69  auto slimmed = std::make_unique<TriggerObjectStandAloneCollection>(*src);
70 
71  if (packFilterLabels_) {
72  std::set<std::string> allLabels;
73  for (auto & obj : *slimmed) {
74  obj.packFilterLabels(iEvent,*triggerResults);
75  }
76 
77  }
78  if (packP4_) {
79  for (TriggerObjectStandAlone & obj : *slimmed) {
80  obj.packP4();
81  }
82  }
83  iEvent.put(std::move(slimmed) );
84 }
85 
86 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: HeavyIon.h:7
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Packs filter labels and/or 4-vectors of a pat::TriggerObjectStandAloneCollection. ...
static std::string const triggerResults
Definition: EdmProvDump.cc:45
const edm::EDGetTokenT< TriggerObjectStandAloneCollection > srcToken_
PATTriggerObjectStandAloneSlimmer(const edm::ParameterSet &iConfig)
HLT enums.
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
def move(src, dest)
Definition: eostools.py:511
Analysis-level trigger object class (stand-alone)