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

◆ TrackClusterCollection

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

Definition at line 47 of file TrackerCleaner.h.

Constructor & Destructor Documentation

◆ TrackerCleaner()

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

Definition at line 55 of file TrackerCleaner.h.

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 }

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

◆ ~TrackerCleaner()

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

◆ match_rechit_type() [1/3]

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 }

◆ match_rechit_type() [2/3]

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 }

◆ match_rechit_type() [3/3]

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

Definition at line 19 of file TrackerCleaner.cc.

19  {
20  assert(0); // CV: make sure general function never gets called;
21  // always use template specializations
22  return false;
23 }

References cms::cuda::assert().

◆ produce()

template<typename T >
void TrackerCleaner< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 72 of file TrackerCleaner.h.

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 }

References charmTagsComputerCvsB_cfi::idx, iEvent, eostools::move(), PDWG_BPHSkim_cff::muons, convertSQLitetoXML_cfg::output, reco::Track::recHitsBegin(), and reco::Track::recHitsEnd().

Member Data Documentation

◆ inputs_

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().

◆ mu_input_

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

Definition at line 46 of file TrackerCleaner.h.

TrackerCleaner::inputs_
std::map< std::string, edm::EDGetTokenT< TrackClusterCollection > > inputs_
Definition: TrackerCleaner.h:49
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
reco::Track::recHitsBegin
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:88
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
edm
HLT enums.
Definition: AlignableModifier.h:19
edmNew::DetSetVector::const_iterator
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetSetVectorNew.h:231
cms::cuda::assert
assert(be >=bs)
TrackerCleaner::match_rechit_type
bool match_rechit_type(const TrackingRecHit &murechit)
Definition: TrackerCleaner.cc:19
charmTagsComputerCvsB_cfi.idx
idx
Definition: charmTagsComputerCvsB_cfi.py:108
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
edm::Handle
Definition: AssociativeIterator.h:50
ProjectedSiStripRecHit2D
Definition: ProjectedSiStripRecHit2D.h:8
SiPixelRecHit
Our base class.
Definition: SiPixelRecHit.h:23
DetId
Definition: DetId.h:17
TrackerCleaner::TrackClusterCollection
edmNew::DetSetVector< T > TrackClusterCollection
Definition: TrackerCleaner.h:47
reco::Track::recHitsEnd
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:91
reco::Track
Definition: Track.h:27
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
edm::View
Definition: CaloClusterFwd.h:14
iEvent
int iEvent
Definition: GenABIO.cc:224
SiStripRecHit1D
Definition: SiStripRecHit1D.h:8
TrackingRecHit
Definition: TrackingRecHit.h:21
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TrackerCleaner::mu_input_
const edm::EDGetTokenT< edm::View< pat::Muon > > mu_input_
Definition: TrackerCleaner.h:46
eostools.move
def move(src, dest)
Definition: eostools.py:511
SiStripMatchedRecHit2D
Definition: SiStripMatchedRecHit2D.h:8
edmNew::DetSetVector::FastFiller
friend class FastFiller
Definition: DetSetVectorNew.h:410
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::InputTag
Definition: InputTag.h:15
edmNew::DetSet::const_iterator
const data_type * const_iterator
Definition: DetSetNew.h:31