13 #ifndef TauAnalysis_MCEmbeddingTools_CaloCleaner_H
14 #define TauAnalysis_MCEmbeddingTools_CaloCleaner_H
48 std::map<std::string, edm::EDGetTokenT<RecHitCollection> >
inputs_;
60 std::vector<edm::InputTag> inCollections = iConfig.
getParameter<std::vector<edm::InputTag> >(
"oldCollection");
61 for (
auto inCollection : inCollections) {
62 inputs_[inCollection.instance()] = consumes<RecHitCollection>(inCollection);
63 produces<RecHitCollection>(inCollection.instance());
82 trackAssociator_.setPropagator(
propagator.product());
85 iEvent.getByToken(mu_input_, muonHandle);
88 std::map<uint32_t, float> correction_map;
95 if (iMuon->track().isNonnull())
96 track = iMuon->track().get();
97 else if (iMuon->standAloneMuon().isNonnull())
98 track = iMuon->standAloneMuon().get();
101 <<
"Failed to fill muon id information for a muon with undefined references to tracks";
104 fill_correction_map(&
info, &correction_map);
108 for (
auto input_ : inputs_) {
109 std::unique_ptr<RecHitCollection> recHitCollection_output(
new RecHitCollection());
112 iEvent.getByToken(input_.second, recHitCollection);
114 recHit != recHitCollection->end();
116 if (correction_map[
recHit->detid().rawId()] > 0) {
117 float new_energy =
recHit->energy() - correction_map[
recHit->detid().rawId()];
121 newRecHit.setEnergy(new_energy);
122 recHitCollection_output->push_back(newRecHit);
124 recHitCollection_output->push_back(*
recHit);
136 recHitCollection_output->sort();