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
82
|
#ifndef HLTReco_TriggerFilterObjectWithRefs_h
#define HLTReco_TriggerFilterObjectWithRefs_h
/** \class trigger::TriggerFilterObjectWithRefs
*
* If HLT cuts of intermediate or final HLT filters are satisfied,
* instances of this class hold the combination of reconstructed
* physics objects (e/gamma/mu/jet/MMet...) satisfying the cuts.
*
* This implementation is not completely space-efficient as some
* physics object containers may stay empty. However, the big
* advantage is that the solution is generic, i.e., works for all
* possible HLT filters. Hence we accept the reasonably small
* overhead of empty containers.
*
*
* \author Martin Grunewald
*
*/
#include "DataFormats/HLTReco/interface/TriggerRefsCollections.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include <string>
#include <vector>
#include <algorithm>
namespace trigger {
/// Transient book-keeping EDProduct filled by HLTFilter module to
/// record physics objects firing the filter (never persistet in
/// production; same functionality but different implementation
/// compared to the old HLT data model's HLTFilterObjectWithRefs
/// class)
class TriggerFilterObjectWithRefs : public TriggerRefsCollections {
/// data members
private:
int path_;
int module_;
std::vector<std::string> collectionTags_;
/// methods
public:
/// constructors
TriggerFilterObjectWithRefs() : TriggerRefsCollections(), path_(-9), module_(-9), collectionTags_() {}
TriggerFilterObjectWithRefs(int path, int module)
: TriggerRefsCollections(), path_(path), module_(module), collectionTags_() {}
/// accessors
int path() const { return path_; }
int module() const { return module_; }
/// collectionTags
void addCollectionTag(const edm::InputTag& collectionTag) { collectionTags_.push_back(collectionTag.encode()); }
void getCollectionTags(std::vector<edm::InputTag>& collectionTags) const {
const trigger::size_type n(collectionTags_.size());
collectionTags.resize(n);
for (trigger::size_type i = 0; i != n; ++i) {
collectionTags[i] = edm::InputTag(collectionTags_[i]);
}
}
/// low-level technical accessor
const std::vector<std::string>& getCollectionTagsAsStrings() const { return collectionTags_; }
/// utility
void swap(TriggerFilterObjectWithRefs& other) {
TriggerRefsCollections::swap(other); // swap base instance
std::swap(path_, other.path_);
std::swap(module_, other.module_);
std::swap(collectionTags_, other.collectionTags_); // use specialized version for STL containers
}
};
// picked up via argument dependent lookup, e-g- by boost::swap()
inline void swap(TriggerFilterObjectWithRefs& first, TriggerFilterObjectWithRefs& second) { first.swap(second); }
} // namespace trigger
#endif
|