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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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 38 of file TrackerCleaner.h.

Member Typedef Documentation

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

Definition at line 47 of file TrackerCleaner.h.

Constructor & Destructor Documentation

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

Definition at line 55 of file TrackerCleaner.h.

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

56  : mu_input_(consumes<edm::View<pat::Muon> >(iConfig.getParameter<edm::InputTag>("MuonCollection")))
57 
58 {
59  std::vector<edm::InputTag> inCollections = iConfig.getParameter<std::vector<edm::InputTag> >("oldCollection");
60  for (auto inCollection : inCollections) {
61  inputs_[inCollection.instance()] = consumes<TrackClusterCollection>(inCollection);
62  produces<TrackClusterCollection>(inCollection.instance());
63  }
64 }
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 67 of file TrackerCleaner.h.

67  {
68  // nothing to be done yet...
69 }

Member Function Documentation

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

Definition at line 26 of file TrackerCleaner.cc.

26  {
27  const std::type_info &hit_type = typeid(murechit);
28  if (hit_type == typeid(SiStripRecHit2D))
29  return true;
30  else if (hit_type == typeid(SiStripRecHit1D))
31  return true;
32  else if (hit_type == typeid(SiStripMatchedRecHit2D))
33  return true;
34  else if (hit_type == typeid(ProjectedSiStripRecHit2D))
35  return true;
36 
37  return false;
38 }
template<>
bool TrackerCleaner< SiPixelCluster >::match_rechit_type ( const TrackingRecHit murechit)
private

Definition at line 41 of file TrackerCleaner.cc.

References DEFINE_FWK_MODULE.

41  {
42  const std::type_info &hit_type = typeid(murechit);
43  if (hit_type == typeid(SiPixelRecHit))
44  return true;
45 
46  return false;
47 }
Our base class.
Definition: SiPixelRecHit.h:23
template<typename T >
bool TrackerCleaner< T >::match_rechit_type ( const TrackingRecHit murechit)
private

Definition at line 19 of file TrackerCleaner.cc.

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

19  {
20  assert(0); // CV: make sure general function never gets called;
21  // always use template specializations
22  return false;
23 }
template<typename T >
void TrackerCleaner< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 72 of file TrackerCleaner.h.

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

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

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 46 of file TrackerCleaner.h.

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