15 #ifndef TauAnalysis_MCEmbeddingTools_MuonDetCleaner_H 16 #define TauAnalysis_MCEmbeddingTools_MuonDetCleaner_H 34 template <
typename T1,
typename T2>
51 std::map<std::string, edm::EDGetTokenT<RecHitCollection> >
inputs_;
54 template <
typename T1,
typename T2>
57 std::vector<edm::InputTag> inCollections = iConfig.
getParameter<std::vector<edm::InputTag> >(
"oldCollection");
58 for (
const auto& inCollection : inCollections) {
59 inputs_[inCollection.instance()] = consumes<RecHitCollection>(inCollection);
60 produces<RecHitCollection>(inCollection.instance());
64 template <
typename T1,
typename T2>
69 template <
typename T1,
typename T2>
71 std::map<T1, std::vector<T2> > recHits_output;
72 std::vector<uint32_t> vetoHits;
76 iEvent.getByToken(mu_input_, muonHandle);
80 if (iMuon->isGlobalMuon())
81 track = iMuon->outerTrack().get();
82 else if (iMuon->isStandAloneMuon())
83 track = iMuon->outerTrack().get();
84 else if (iMuon->isRPCMuon())
85 track = iMuon->innerTrack().get();
86 else if (iMuon->isTrackerMuon())
87 track = iMuon->innerTrack().get();
89 edm::LogError(
"TauEmbedding") <<
"The imput muon: " << (*iMuon)
90 <<
" must be either global or does or be tracker muon";
96 if (!(murechit).isValid())
98 if (!checkrecHit(murechit))
100 fillVetoHits(murechit, &vetoHits);
105 for (
auto input_ : inputs_) {
108 RecHitCollectionHandle RecHitinput;
109 iEvent.getByToken(input_.second, RecHitinput);
113 if (
find(vetoHits.begin(), vetoHits.end(), getRawDetId(*
recHit)) != vetoHits.end())
121 for (
typename std::map<T1, std::vector<T2> >::const_iterator
recHit = recHits_output.begin();
122 recHit != recHits_output.end();
131 template <
typename T1,
typename T2>
133 std::vector<const TrackingRecHit*> rh_components = rh.
recHits();
134 if (rh_components.empty()) {
135 HitsList->push_back(rh.
rawId());
137 for (std::vector<const TrackingRecHit*>::const_iterator rh_component = rh_components.begin();
138 rh_component != rh_components.end();
140 fillVetoHits(**rh_component, HitsList);
T getParameter(std::string const &) const
uint32_t getRawDetId(const T2 &)
bool checkrecHit(const TrackingRecHit &)
edm::RangeMap< T1, edm::OwnVector< T2 > > RecHitCollection
~MuonDetCleaner() override
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
C::const_iterator const_iterator
constant access iterator type
virtual std::vector< const TrackingRecHit * > recHits() const =0
Access to component RecHits (if any)
void produce(edm::Event &, const edm::EventSetup &) override
const edm::EDGetTokenT< edm::View< pat::Muon > > mu_input_
MuonDetCleaner(const edm::ParameterSet &)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
void fillVetoHits(const TrackingRecHit &, std::vector< uint32_t > *)
std::map< std::string, edm::EDGetTokenT< RecHitCollection > > inputs_