15 #ifndef TauAnalysis_MCEmbeddingTools_MuonDetCleaner_H 16 #define TauAnalysis_MCEmbeddingTools_MuonDetCleaner_H 35 template <
typename T1,
typename T2>
53 std::map<std::string, edm::EDGetTokenT<RecHitCollection > >
inputs_;
57 template <
typename T1,
typename T2>
61 std::vector<edm::InputTag> inCollections = iConfig.
getParameter<std::vector<edm::InputTag> >(
"oldCollection");
62 for (
auto inCollection : inCollections){
63 inputs_[inCollection.instance()] = consumes<RecHitCollection >(inCollection);
64 produces<RecHitCollection>(inCollection.instance());
69 template <
typename T1,
typename T2>
75 template <
typename T1,
typename T2>
78 std::map<T1, std::vector<T2> > recHits_output;
79 std::vector<uint32_t> vetoHits;
87 if( iMuon->isGlobalMuon() ) track = iMuon->outerTrack().get();
88 else if ( iMuon->isStandAloneMuon() ) track = iMuon->outerTrack().get();
89 else if ( iMuon->isRPCMuon() ) track = iMuon->innerTrack().get();
90 else if ( iMuon->isTrackerMuon() ) track = iMuon->innerTrack().get();
92 edm::LogError(
"TauEmbedding")<<
"The imput muon: "<<(*iMuon)<<
" must be either global or does or be tracker muon";
99 if(!(murechit).isValid())
continue;
110 RecHitCollectionHandle RecHitinput;
111 iEvent.
getByToken(input_.second, RecHitinput);
116 recHits_output[detId].push_back(*
recHit);
123 for (
typename std::map<T1, std::vector<T2> >::const_iterator
recHit = recHits_output.begin();
recHit != recHits_output.end(); ++
recHit ) {
126 output->post_insert();
132 template <
typename T1,
typename T2>
135 std::vector<const TrackingRecHit*> rh_components = rh.
recHits();
136 if ( rh_components.size() == 0 ) {
137 HitsList->push_back(rh.
rawId());
140 for ( std::vector<const TrackingRecHit*>::const_iterator rh_component = rh_components.begin(); rh_component != rh_components.end(); ++rh_component ) {
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
uint32_t getRawDetId(const T2 &)
bool checkrecHit(const TrackingRecHit &)
edm::RangeMap< T1, edm::OwnVector< T2 > > RecHitCollection
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
virtual std::vector< const TrackingRecHit * > recHits() const =0
Access to component RecHits (if any)
C::const_iterator const_iterator
constant access iterator type
const_iterator begin() const
std::map< std::string, edm::EDGetTokenT< RecHitCollection > > inputs_
virtual void produce(edm::Event &, const edm::EventSetup &) override
const edm::EDGetTokenT< edm::View< pat::Muon > > mu_input_
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
MuonDetCleaner(const edm::ParameterSet &)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
void fillVetoHits(const TrackingRecHit &, std::vector< uint32_t > *)
const_iterator end() const
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.