CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
TrackerCleaner< T > Class Template Reference

#include <TrackerCleaner.h>

Inheritance diagram for TrackerCleaner< T >:
edm::stream::EDProducer<>

Public Member Functions

 TrackerCleaner (const edm::ParameterSet &)
 
 ~TrackerCleaner () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Types

typedef edmNew::DetSetVector< TTrackClusterCollection
 

Private Member Functions

template<>
bool match_rechit_type (const TrackingRecHit &murechit)
 
template<>
bool match_rechit_type (const TrackingRecHit &murechit)
 
bool match_rechit_type (const TrackingRecHit &murechit)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::map< std::string, edm::EDGetTokenT< TrackClusterCollection > > inputs_
 
const edm::EDGetTokenT< edm::View< pat::Muon > > mu_input_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

template<typename T>
class TrackerCleaner< T >

Author
Stefan Wayand; Christian Veelken, LLR

Definition at line 40 of file TrackerCleaner.h.

Member Typedef Documentation

template<typename T >
typedef edmNew::DetSetVector<T> TrackerCleaner< T >::TrackClusterCollection
private

Definition at line 50 of file TrackerCleaner.h.

Constructor & Destructor Documentation

template<typename T >
TrackerCleaner< T >::TrackerCleaner ( const edm::ParameterSet iConfig)
explicit

Definition at line 60 of file TrackerCleaner.h.

References edm::ParameterSet::getParameter(), and TrackerCleaner< T >::inputs_.

60  :
61  mu_input_(consumes<edm::View<pat::Muon> >(iConfig.getParameter<edm::InputTag>("MuonCollection")))
62 
63 {
64  std::vector<edm::InputTag> inCollections = iConfig.getParameter<std::vector<edm::InputTag> >("oldCollection");
65  for (auto inCollection : inCollections){
66  inputs_[inCollection.instance()] = consumes<TrackClusterCollection >(inCollection);
67  produces<TrackClusterCollection>(inCollection.instance());
68  }
69 
70 
71 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< edm::View< pat::Muon > > mu_input_
std::map< std::string, edm::EDGetTokenT< TrackClusterCollection > > inputs_
template<typename T >
TrackerCleaner< T >::~TrackerCleaner ( )
override

Definition at line 75 of file TrackerCleaner.h.

76 {
77 // nothing to be done yet...
78 }

Member Function Documentation

template<>
bool TrackerCleaner< SiStripCluster >::match_rechit_type ( const TrackingRecHit murechit)
private

Definition at line 34 of file TrackerCleaner.cc.

34  {
35 
36  const std::type_info &hit_type = typeid(murechit);
37  if (hit_type == typeid(SiStripRecHit2D)) return true;
38  else if (hit_type == typeid(SiStripRecHit1D)) return true;
39  else if (hit_type == typeid(SiStripMatchedRecHit2D)) return true;
40  else if (hit_type == typeid(ProjectedSiStripRecHit2D)) return true;
41 
42 
43 
44  return false;
45 
46  }
template<>
bool TrackerCleaner< SiPixelCluster >::match_rechit_type ( const TrackingRecHit murechit)
private

Definition at line 49 of file TrackerCleaner.cc.

References DEFINE_FWK_MODULE.

49  {
50 
51 
52  const std::type_info &hit_type = typeid(murechit);
53  if (hit_type == typeid(SiPixelRecHit)) return true;
54 
55  return false;
56 
57  }
Our base class.
Definition: SiPixelRecHit.h:23
template<typename T >
bool TrackerCleaner< T >::match_rechit_type ( const TrackingRecHit murechit)
private

Definition at line 24 of file TrackerCleaner.cc.

Referenced by TrackerCleaner< T >::produce().

24  {
25 
26  assert(0); // CV: make sure general function never gets called;
27  // always use template specializations
28  return false;
29 
30  }
template<typename T >
void TrackerCleaner< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 82 of file TrackerCleaner.h.

References edm::View< T >::begin(), edm::View< T >::end(), BaseTrackerRecHit::firstClusterRef(), edm::Event::getByToken(), training_settings::idx, TrackerCleaner< T >::inputs_, TrackerCleaner< T >::match_rechit_type(), eostools::move(), TrackerCleaner< T >::mu_input_, extraflags_cff::muons, convertSQLitetoXML_cfg::output, edm::Event::put(), reco::Track::recHitsBegin(), and reco::Track::recHitsEnd().

83 {
84 
85  using namespace edm;
86 
88  iEvent.getByToken(mu_input_, muonHandle);
89  edm::View<pat::Muon> muons = *muonHandle;
90 
91  for (auto input_ : inputs_){
92 
94  iEvent.getByToken(input_.second, inputClusters);
95 
96  std::vector<bool> vetodClusters;
97 
98  vetodClusters.resize(inputClusters->dataSize(), false);
99 
100  for (edm::View<pat::Muon>::const_iterator iMuon = muons.begin(); iMuon != muons.end(); ++iMuon) {
101  if(!iMuon->isGlobalMuon() ) continue;
102  const reco::Track* mutrack = iMuon->globalTrack().get();
103  // reco::Track *mutrack = new reco::Track(*(iMuon->innerTrack() ));
104  for (trackingRecHit_iterator hitIt = mutrack->recHitsBegin(); hitIt != mutrack->recHitsEnd(); ++hitIt) {
105  const TrackingRecHit &murechit = **hitIt;
106  if(!(murechit).isValid()) continue;
107 
108  if (match_rechit_type(murechit)){
109  auto & thit = reinterpret_cast<BaseTrackerRecHit const&>(murechit);
110  auto const & cluster = thit.firstClusterRef();
111  vetodClusters[cluster.key()]=true;
112  }
113 
114 
115  }
116  }
117  std::unique_ptr<TrackClusterCollection > output(new TrackClusterCollection());
118 
119  int idx = 0;
120  for ( typename TrackClusterCollection::const_iterator clustSet = inputClusters->begin(); clustSet != inputClusters->end(); ++clustSet ) {
121  DetId detIdObject( clustSet->detId() );
122  typename TrackClusterCollection::FastFiller spc(*output, detIdObject);
123  for (typename edmNew::DetSet<T>::const_iterator clustIt = clustSet->begin(); clustIt != clustSet->end(); ++clustIt ) {
124  idx++;
125  if (vetodClusters[idx-1]) continue;
126  //if (!vetodClusters[idx-1]) continue; for inverted selction
127  spc.push_back(*clustIt);
128  }
129  }
130  iEvent.put(std::move(output),input_.first);
131  }
132 
133 }
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
const edm::EDGetTokenT< edm::View< pat::Muon > > mu_input_
data_type const * const_iterator
Definition: DetSetNew.h:30
const_iterator begin() const
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:109
Definition: DetId.h:18
std::map< std::string, edm::EDGetTokenT< TrackClusterCollection > > inputs_
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
virtual OmniClusterRef const & firstClusterRef() const =0
const_iterator end() const
bool match_rechit_type(const TrackingRecHit &murechit)
def move(src, dest)
Definition: eostools.py:511
edmNew::DetSetVector< T > TrackClusterCollection
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:114

Member Data Documentation

template<typename T >
std::map<std::string, edm::EDGetTokenT<TrackClusterCollection > > TrackerCleaner< T >::inputs_
private
template<typename T >
const edm::EDGetTokenT<edm::View<pat::Muon> > TrackerCleaner< T >::mu_input_
private

Definition at line 49 of file TrackerCleaner.h.

Referenced by TrackerCleaner< T >::produce().