19 std::vector<edm::InputTag> inCollections = iConfig.
getParameter<std::vector<edm::InputTag>>(
"oldCollection");
20 for (
const auto &inCollection : inCollections) {
21 inputs_[inCollection.instance()] = consumes<RecHitCollection>(inCollection);
22 produces<RecHitCollection>(inCollection.instance());
42 iEvent.getByToken(mu_input_, muonHandle);
45 std::map<uint32_t, float> correction_map;
50 if (iMuon->track().isNonnull())
51 track = iMuon->track().get();
52 else if (iMuon->standAloneMuon().isNonnull())
53 track = iMuon->standAloneMuon().get();
56 <<
"Failed to fill muon id information for a muon with undefined references to tracks";
59 fill_correction_map(&
info, &correction_map);
63 for (
auto input_ : inputs_) {
64 std::unique_ptr<RecHitCollection> recHitCollection_output(
new RecHitCollection());
66 iEvent.getByToken(input_.second, recHitCollection);
68 recHit != recHitCollection->end();
70 if (correction_map[
recHit->detid().rawId()] > 0) {
71 float new_energy =
recHit->energy() - correction_map[
recHit->detid().rawId()];
75 newRecHit.setEnergy(new_energy);
76 recHitCollection_output->push_back(newRecHit);
78 recHitCollection_output->push_back(*
recHit);
82 recHitCollection_output->sort();
99 for (std::vector<DetId>::const_iterator
detId =
info->crossedPreshowerIds.begin();
100 detId !=
info->crossedPreshowerIds.end();
102 (*cor_map)[
detId->rawId()] = 9999999;
105 for (std::vector<const EcalRecHit *>::const_iterator
hit =
info->crossedEcalRecHits.begin();
106 hit !=
info->crossedEcalRecHits.end();
108 (*cor_map)[(*hit)->detid().rawId()] = (*hit)->energy();
115 for (std::vector<const HBHERecHit *>::const_iterator
hit =
info->crossedHcalRecHits.begin();
116 hit !=
info->crossedHcalRecHits.end();
118 (*cor_map)[(*hit)->detid().rawId()] = (*hit)->energy();
124 for (std::vector<const HORecHit *>::const_iterator
hit =
info->crossedHORecHits.begin();
125 hit !=
info->crossedHORecHits.end();
127 (*cor_map)[(*hit)->detid().rawId()] = (*hit)->energy();
T getParameter(std::string const &) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void fill_correction_map(TrackDetMatchInfo *, std::map< uint32_t, float > *)
CaloCleaner< HORecHit > HORecHitColCleaner
std::vector< T >::const_iterator const_iterator
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
CaloCleaner< HBHERecHit > HBHERecHitColCleaner
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
CaloCleaner< EcalRecHit > EcalRecHitColCleaner
CaloCleaner< ZDCRecHit > ZDCRecHitColCleaner
void produce(edm::Event &, const edm::EventSetup &) override
T getUntrackedParameter(std::string const &, T const &) const
CaloCleaner< HFRecHit > HFRecHitColCleaner
#define DEFINE_FWK_MODULE(type)
CaloCleaner(const edm::ParameterSet &)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
TrackAssociatorParameters parameters_
std::map< std::string, edm::EDGetTokenT< RecHitCollection > > inputs_