19 template <
typename T1,
typename T2,
typename T3,
typename T4>
21 std::vector<edm::InputTag> inCollections = iConfig.
getParameter<std::vector<edm::InputTag>>(
"mergCollections");
22 for (
auto const &inCollection : inCollections) {
23 inputs1_[inCollection.instance()].push_back(consumes<MergeCollection1>(inCollection));
24 inputs2_[inCollection.instance()].push_back(consumes<MergeCollection2>(inCollection));
26 for (
const auto &toproduce : inputs1_) {
27 produces<MergeCollection1>(toproduce.first);
29 for (
const auto &toproduce : inputs2_) {
30 produces<MergeCollection2>(toproduce.first);
34 template <
typename T1,
typename T2,
typename T3,
typename T4>
39 template <
typename T1,
typename T2,
typename T3,
typename T4>
41 for (
auto input_ : inputs1_) {
43 std::vector<edm::Handle<MergeCollection1>> inputCollections;
44 inputCollections.resize(input_.second.size());
45 for (
unsigned id = 0;
id < input_.second.size();
id++) {
46 iEvent.getByToken(input_.second[
id], inputCollections[
id]);
48 fill_output_obj(
output, inputCollections);
52 for (
auto input_ : inputs2_) {
54 std::vector<edm::Handle<MergeCollection2>> inputCollections;
55 inputCollections.resize(input_.second.size());
56 for (
unsigned id = 0;
id < input_.second.size();
id++) {
57 iEvent.getByToken(input_.second[
id], inputCollections[
id]);
59 fill_output_obj(
output, inputCollections);
64 template <
typename T1,
typename T2,
typename T3,
typename T4>
70 template <
typename T1,
typename T2,
typename T3,
typename T4>
76 template <
typename T1,
typename T2,
typename T3,
typename T4>
79 std::map<uint32_t, BaseHit1> output_map;
85 DetId detIdObject(
obj->id().rawId());
87 std::map<uint32_t, EESrFlag>::iterator
it = output_map.find(detIdObject.rawId());
88 if (
it == output_map.end()) {
89 BaseHit1 *akt_flag_obj = &output_map[detIdObject.rawId()];
90 const T2 &newSrFlag(*
obj);
91 *akt_flag_obj = newSrFlag;
95 BaseHit1 *akt_flag_obj = &output_map[detIdObject.rawId()];
98 newSrFlag.setValue(
std::max(
obj->value(), preFlag.value()));
99 if (preFlag.value() == 3
or obj->value() == 3)
100 newSrFlag.setValue(3);
101 if (preFlag.value() == 7
or obj->value() == 7)
102 newSrFlag.setValue(7);
104 *akt_flag_obj = newSrFlag;
110 for (
typename std::map<uint32_t, BaseHit1>::const_iterator outFlags = output_map.begin();
111 outFlags != output_map.end();
113 BaseHit1 currFlag = outFlags->second;
114 output->push_back(outFlags->second);
119 template <
typename T1,
typename T2,
typename T3,
typename T4>
122 std::map<uint32_t, BaseHit2> output_map;
128 DetId detIdObject(
obj->id().rawId());
130 std::map<uint32_t, EBSrFlag>::iterator
it = output_map.find(detIdObject.rawId());
131 if (
it == output_map.end()) {
132 BaseHit2 *akt_flag_obj = &output_map[detIdObject.rawId()];
133 const T4 &newSrFlag(*
obj);
134 *akt_flag_obj = newSrFlag;
138 BaseHit2 *akt_flag_obj = &output_map[detIdObject.rawId()];
141 newSrFlag.setValue(
std::max(
obj->value(), preFlag.value()));
142 if (preFlag.value() == 3
or obj->value() == 3)
143 newSrFlag.setValue(3);
144 if (preFlag.value() == 7
or obj->value() == 7)
145 newSrFlag.setValue(7);
147 *akt_flag_obj = newSrFlag;
153 for (
typename std::map<uint32_t, BaseHit2>::const_iterator outFlags = output_map.begin();
154 outFlags != output_map.end();
156 BaseHit2 currFlag = outFlags->second;
157 output->push_back(outFlags->second);
162 template <
typename T1,
typename T2,
typename T3,
typename T4>
169 template <
typename T1,
typename T2,
typename T3,
typename T4>
178 fill_output_obj(std::unique_ptr<MergeCollection1> &
output,
180 fill_output_obj_digiflag(
output, inputCollections);
185 fill_output_obj(std::unique_ptr<MergeCollection2> &
output,
187 fill_output_obj_digiflag(
output, inputCollections);
194 fill_output_obj_hcaldigi(
output, inputCollections);
201 fill_output_obj_hcaldigi(
output, inputCollections);
~DoubleCollectionMerger() override
void fill_output_obj(std::unique_ptr< MergeCollection1 > &output1, std::vector< edm::Handle< MergeCollection1 >> &inputCollections1)
T getParameter(std::string const &) const
void produce(edm::Event &, const edm::EventSetup &) override
DoubleCollectionMerger< HBHEDigiCollection, HBHEDataFrame, HcalCalibDigiCollection, HcalCalibDataFrame > HcalDigiColMerger
DoubleCollectionMerger< edm::SortedCollection< EESrFlag >, EESrFlag, edm::SortedCollection< EBSrFlag >, EBSrFlag > EcalSrFlagColMerger
void fill_output_obj_digiflag(std::unique_ptr< MergeCollection1 > &output, std::vector< edm::Handle< MergeCollection1 >> &inputCollections)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
#define DEFINE_FWK_MODULE(type)
DoubleCollectionMerger(const edm::ParameterSet &)
void fill_output_obj_hcaldigi(std::unique_ptr< MergeCollection1 > &output, std::vector< edm::Handle< MergeCollection1 >> &inputCollections)