13 #ifndef TauAnalysis_MCEmbeddingTools_CaloCleaner_H
14 #define TauAnalysis_MCEmbeddingTools_CaloCleaner_H
48 std::map<std::string, edm::EDGetTokenT<RecHitCollection> >
inputs_;
60 : mu_input_(consumes<edm::
View<pat::
Muon> >(iConfig.getParameter<edm::
InputTag>(
"MuonCollection"))),
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());
89 std::map<uint32_t, float> correction_map;
96 if (iMuon->track().isNonnull())
97 track = iMuon->track().get();
98 else if (iMuon->standAloneMuon().isNonnull())
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()];
121 T newRecHit(*recHit);
122 newRecHit.setEnergy(new_energy);
123 recHitCollection_output->push_back(newRecHit);
125 recHitCollection_output->push_back(*recHit);
137 recHitCollection_output->sort();
138 iEvent.
put(
std::move(recHitCollection_output), input_.first);
T getUntrackedParameter(std::string const &, T const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void fill_correction_map(TrackDetMatchInfo *, std::map< uint32_t, float > *)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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
bool getData(T &iHolder) const
edm::SortedCollection< T > RecHitCollection
const_iterator begin() const
edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
T getParameter(std::string const &) const
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_
const_iterator end() const