CMS 3D CMS Logo

HLTCollectionProducer.h
Go to the documentation of this file.
1 #ifndef HLTCollectionProducer_h
2 #define HLTCollectionProducer_h
3 
4 //
5 // Package: HLTCollectionProducer
6 // Class: HLTCollectionProducer
7 //
14 //
15 // Original Author: Ian Tomalin
16 //
17 
18 #include <string>
19 #include <vector>
20 
21 // user include files
30 
31 //
32 // class declaration
33 //
34 
35 template <typename T>
37 public:
39  ~HLTCollectionProducer() override;
40  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
41  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
42 
43 private:
46  const std::vector<int> triggerTypes_;
47 };
48 
49 //
50 // constructors and destructor
51 //
52 template <typename T>
54  : hltObjectTag_(iConfig.getParameter<edm::InputTag>("HLTObject")),
55  hltObjectToken_(consumes<trigger::TriggerFilterObjectWithRefs>(hltObjectTag_)),
56  triggerTypes_(iConfig.getParameter<std::vector<int>>("TriggerTypes")) {
57  produces<std::vector<T>>();
58 }
59 
60 template <typename T>
62 
63 template <typename T>
66  desc.add<edm::InputTag>("HLTObject", edm::InputTag("TriggerFilterObjectWithRefs"));
67  std::vector<int> triggerTypes;
68  desc.add<std::vector<int>>("TriggerTypes", triggerTypes);
70 }
71 
72 //
73 // member functions
74 //
75 
76 // ------------ method called to produce the data ------------
77 template <typename T>
80  const edm::EventSetup& iSetup) const {
81  std::unique_ptr<std::vector<T>> collection(new std::vector<T>());
82 
83  // get hold of collection of TriggerFilterObjectsWithRefs
85  iEvent.getByToken(hltObjectToken_, hltObject);
86  std::vector<edm::Ref<std::vector<T>>> objectRefs;
87 
88  for (size_t t = 0; t < triggerTypes_.size(); ++t) {
89  objectRefs.clear();
90  hltObject->getObjects(triggerTypes_[t], objectRefs);
91  for (size_t i = 0; i < objectRefs.size(); ++i) {
92  collection->push_back(*objectRefs[i]);
93  }
94  }
95 
97 }
98 
99 #endif // HLTCollectionProducer_h
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
std::string defaultModuleLabel()
HLTCollectionProducer(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:224
const std::vector< int > triggerTypes_
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > hltObjectToken_
const edm::InputTag hltObjectTag_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
HLT enums.
def move(src, dest)
Definition: eostools.py:511