60 template <
typename T1,
typename T2>
62 std::vector<edm::InputTag> inCollections = iConfig.
getParameter<std::vector<edm::InputTag>>(
"mergCollections");
63 for (
auto const &inCollection : inCollections) {
64 inputs_[inCollection.instance()].push_back(consumes<MergeCollection>(inCollection));
67 for (
const auto &toproduce : inputs_) {
69 willproduce(toproduce.first,
alias);
73 template <
typename T1,
typename T2>
78 template <
typename T1,
typename T2>
80 for (
auto input_ : inputs_) {
82 std::vector<edm::Handle<MergeCollection>> inputCollections;
83 inputCollections.resize(input_.second.size());
84 for (
unsigned id = 0;
id < input_.second.size();
id++) {
85 iEvent.getByToken(input_.second[
id], inputCollections[
id]);
92 template <
typename T1,
typename T2>
95 template <
typename T1,
typename T2>
101 template <
typename T1,
typename T2>
105 std::map<uint32_t, std::vector<BaseHit>> output_map;
108 for (
typename MergeCollection::const_iterator clustSet =
inputCollection->begin();
111 DetId detIdObject(clustSet->detId());
114 output_map[detIdObject.rawId()].push_back(*clustIt);
119 for (
typename std::map<uint32_t, std::vector<BaseHit>>::const_iterator outHits = output_map.begin();
120 outHits != output_map.end();
122 DetId detIdObject(outHits->first);
123 typename MergeCollection::FastFiller spc(*
output, detIdObject);
124 for (
const auto &
Hit : outHits->second) {
130 template <
typename T1,
typename T2>
133 std::map<uint32_t, BaseHit> output_map;
139 T2 *akt_calo_obj = &output_map[detIdObject.rawId()];
140 float new_energy = akt_calo_obj->energy() +
recHit->energy();
142 newRecHit.setEnergy(new_energy);
143 *akt_calo_obj = newRecHit;
147 for (
typename std::map<uint32_t, BaseHit>::const_iterator outHits = output_map.begin(); outHits != output_map.end();
149 output->push_back(outHits->second);
155 template <
typename T1,
typename T2>
158 std::map<uint32_t, std::vector<BaseHit>> output_map;
164 output_map[detIdObject].push_back(*
recHit);
168 for (
typename std::map<uint32_t, std::vector<BaseHit>>::const_iterator outHits = output_map.begin();
169 outHits != output_map.end();
172 outHits->second.begin(),
173 outHits->second.end());
183 inputs_fixtrackrefs_ = consumes<TrackToTrackMapnew>(
edm::InputTag(
"generalTracks"));
184 inputs_fixtrackcol_ = consumes<reco::TrackCollection>(
edm::InputTag(
"generalTracks"));
187 inputs_scEB_ = consumes<reco::SuperClusterCollection>(
188 edm::InputTag(
"particleFlowSuperClusterECAL:particleFlowSuperClusterECALBarrel"));
189 inputs_scEE_ = consumes<reco::SuperClusterCollection>(
190 edm::InputTag(
"particleFlowSuperClusterECAL:particleFlowSuperClusterECALEndcapWithPreshower"));
196 produces<MergeCollection>(
instance);
199 template <
typename T1,
typename T2>
201 std::unique_ptr<MergeCollection> &
output,
205 iEvent.getByToken(inputs_fixtrackrefs_, track_ref_map);
208 iEvent.getByToken(inputs_fixtrackcol_, track_new_col);
209 std::map<reco::TrackRef, reco::TrackRef> simple_track_to_track_map;
210 for (
unsigned abc = 0; abc < track_new_col->size(); ++abc) {
212 simple_track_to_track_map[((*track_ref_map)[trackRef])[0]] = trackRef;
217 iEvent.getByToken(inputs_scEB_, scEB);
218 auto bScEB = scEB->cbegin();
219 auto eScEB = scEB->cend();
223 iEvent.getByToken(inputs_scEE_, scEE);
224 auto bScEE = scEE->cbegin();
225 auto eScEE = scEE->cend();
234 if (
seed->isEcalDriven()) {
236 if (seedCcRef.isNonnull()) {
241 for (
auto sc = bScEB; sc != eScEB; ++sc) {
243 dx = fabs(scRef->x() - seedCcRef->x());
244 dy = fabs(scRef->y() - seedCcRef->y());
245 dz = fabs(scRef->z() - seedCcRef->z());
252 for (
auto sc = bScEE; sc != eScEE; ++sc) {
254 dx = fabs(scRef->x() - seedCcRef->x());
255 dy = fabs(scRef->y() - seedCcRef->y());
256 dz = fabs(scRef->z() - seedCcRef->z());
265 newSeed.setCaloCluster(ccRefMin);
269 if (
seed->isTrackerDriven()) {
271 if (ctfTrackRef.isNonnull()) {
272 newSeed.setCtfTrack(simple_track_to_track_map[ctfTrackRef]);
275 output->push_back(newSeed);
281 template <
typename T1,
typename T2>
283 std::unique_ptr<MergeCollection> &
output,
292 std::unique_ptr<MergeCollection> &
output,
294 fill_output_obj_tracker(
output, inputCollections,
true);
300 std::unique_ptr<MergeCollection> &
output,
302 fill_output_obj_tracker(
output, inputCollections);
308 std::unique_ptr<MergeCollection> &
output,
310 fill_output_obj_calo(
output, inputCollections);
316 std::unique_ptr<MergeCollection> &
output,
318 fill_output_obj_calo(
output, inputCollections);
324 std::unique_ptr<MergeCollection> &
output,
326 fill_output_obj_calo(
output, inputCollections);
332 std::unique_ptr<MergeCollection> &
output,
334 fill_output_obj_calo(
output, inputCollections);
340 std::unique_ptr<MergeCollection> &
output,
342 fill_output_obj_calo(
output, inputCollections);
348 std::unique_ptr<MergeCollection> &
output,
350 fill_output_obj_muonchamber(
output, inputCollections);
356 std::unique_ptr<MergeCollection> &
output,
358 fill_output_obj_muonchamber(
output, inputCollections);
364 std::unique_ptr<MergeCollection> &
output,
366 fill_output_obj_muonchamber(
output, inputCollections);
372 std::unique_ptr<MergeCollection> &
output,
CollectionMerger< edm::SortedCollection< HORecHit >, HORecHit > HORecHitColMerger
T getParameter(std::string const &) const
~CollectionMerger() override
void fill_output_obj_muonchamber(std::unique_ptr< MergeCollection > &output, std::vector< edm::Handle< MergeCollection >> &inputCollections)
CollectionMerger< std::vector< reco::ElectronSeed >, reco::ElectronSeed > EcalDrivenElectronSeedColMerger
static PFTauRenderPlugin instance
void fill_output_obj_calo(std::unique_ptr< MergeCollection > &output, std::vector< edm::Handle< MergeCollection >> &inputCollections)
data_type const * const_iterator
void willproduce(std::string instance, std::string alias)
Container::value_type value_type
#define DEFINE_FWK_MODULE(type)
CollectionMerger< edmNew::DetSetVector< SiPixelCluster >, SiPixelCluster > PixelColMerger
void fill_output_obj(edm::Event &, std::unique_ptr< MergeCollection > &output, std::vector< edm::Handle< MergeCollection >> &inputCollections)
void produce(edm::Event &, const edm::EventSetup &) override
CollectionMerger< edm::SortedCollection< ZDCRecHit >, ZDCRecHit > ZDCRecHitColMerger
edm::RefToBase< CaloCluster > CaloClusterRef
void fill_output_obj_seed(edm::Event &, std::unique_ptr< MergeCollection > &output, std::vector< edm::Handle< MergeCollection >> &inputCollections)
void willconsume(const edm::ParameterSet &iConfig)
Pixel cluster – collection of neighboring pixels above threshold.
void fill_output_obj_tracker(std::unique_ptr< MergeCollection > &output, std::vector< edm::Handle< MergeCollection >> &inputCollections, bool print_pixel=false)
CollectionMerger< std::vector< reco::ElectronSeed >, reco::ElectronSeed > ElectronSeedColMerger
CollectionMerger< edmNew::DetSetVector< SiStripCluster >, SiStripCluster > StripColMerger
CollectionMerger< edm::RangeMap< DTLayerId, edm::OwnVector< DTRecHit1DPair > >, DTRecHit1DPair > DTRecHitColMerger
CollectionMerger< edm::RangeMap< CSCDetId, edm::OwnVector< CSCRecHit2D > >, CSCRecHit2D > CSCRecHitColMerger
CollectionMerger< edm::SortedCollection< HFRecHit >, HFRecHit > HFRecHitColMerger
CollectionMerger(const edm::ParameterSet &)
CollectionMerger< edm::RangeMap< RPCDetId, edm::OwnVector< RPCRecHit > >, RPCRecHit > RPCRecHitColMerger
CollectionMerger< edm::SortedCollection< HBHERecHit >, HBHERecHit > HBHERecHitColMerger
CollectionMerger< edm::SortedCollection< EcalRecHit >, EcalRecHit > EcalRecHitColMerger