13 #ifndef TauAnalysis_MCEmbeddingTools_CaloCleaner_H 14 #define TauAnalysis_MCEmbeddingTools_CaloCleaner_H 48 std::map<std::string, edm::EDGetTokenT<RecHitCollection> >
inputs_;
62 std::vector<edm::InputTag> inCollections = iConfig.
getParameter<std::vector<edm::InputTag> >(
"oldCollection");
63 for (
const auto& inCollection : inCollections) {
64 inputs_[inCollection.instance()] = consumes<RecHitCollection>(inCollection);
65 produces<RecHitCollection>(inCollection.instance());
86 iEvent.getByToken(mu_input_, muonHandle);
89 std::map<uint32_t, float> correction_map;
96 if (iMuon->track().isNonnull())
97 track = iMuon->track().get();
98 else if (iMuon->standAloneMuon().isNonnull())
99 track = iMuon->standAloneMuon().get();
102 <<
"Failed to fill muon id information for a muon with undefined references to tracks";
105 fill_correction_map(&
info, &correction_map);
109 for (
auto input_ : inputs_) {
110 std::unique_ptr<RecHitCollection> recHitCollection_output(
new RecHitCollection());
113 iEvent.getByToken(input_.second, recHitCollection);
115 recHit != recHitCollection->end();
117 if (correction_map[
recHit->detid().rawId()] > 0) {
118 float new_energy =
recHit->energy() - correction_map[
recHit->detid().rawId()];
122 newRecHit.setEnergy(new_energy);
123 recHitCollection_output->push_back(newRecHit);
125 recHitCollection_output->push_back(*
recHit);
137 recHitCollection_output->sort();
T getParameter(std::string const &) const
void fill_correction_map(TrackDetMatchInfo *, std::map< uint32_t, float > *)
std::vector< T >::const_iterator const_iterator
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
const edm::EDGetTokenT< edm::View< pat::Muon > > mu_input_
void produce(edm::Event &, const edm::EventSetup &) override
T getUntrackedParameter(std::string const &, T const &) const
edm::SortedCollection< T > RecHitCollection
bool getData(T &iHolder) const
edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
TrackDetectorAssociator trackAssociator_
CaloCleaner(const edm::ParameterSet &)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
TrackAssociatorParameters parameters_
std::map< std::string, edm::EDGetTokenT< RecHitCollection > > inputs_