CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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 (const auto& inCollection : inCollections) {
61  inputs_[inCollection.instance()] = consumes<TrackClusterCollection>(inCollection);
62  produces<TrackClusterCollection>(inCollection.instance());
63  }
64 }
const edm::EDGetTokenT< edm::View< pat::Muon > > mu_input_
std::map< std::string, edm::EDGetTokenT< TrackClusterCollection > > inputs_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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.

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.

References cms::cuda::assert().

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

Definition at line 72 of file TrackerCleaner.h.

References runTheMatrix::const, edm::Event::getByToken(), eostools::move(), patZpeak::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:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const edm::EDGetTokenT< edm::View< pat::Muon > > mu_input_
data_type const * const_iterator
Definition: DetSetNew.h:31
def move
Definition: eostools.py:511
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
tuple muons
Definition: patZpeak.py:39
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
bool match_rechit_type(const TrackingRecHit &murechit)
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

Definition at line 49 of file TrackerCleaner.h.

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

template<typename T >
const edm::EDGetTokenT<edm::View<pat::Muon> > TrackerCleaner< T >::mu_input_
private

Definition at line 46 of file TrackerCleaner.h.