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
 
 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

bool match_rechit_type (const TrackingRecHit &murechit)
 
template<>
bool match_rechit_type (const TrackingRecHit &murechit)
 
template<>
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 39 of file TrackerCleaner.h.

Member Typedef Documentation

◆ TrackClusterCollection

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

Definition at line 48 of file TrackerCleaner.h.

Constructor & Destructor Documentation

◆ TrackerCleaner()

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

Definition at line 15 of file TrackerCleaner.cc.

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

16  : mu_input_(consumes<edm::View<pat::Muon>>(iConfig.getParameter<edm::InputTag>("MuonCollection")))
17 
18 {
19  std::vector<edm::InputTag> inCollections = iConfig.getParameter<std::vector<edm::InputTag>>("oldCollection");
20  for (const auto &inCollection : inCollections) {
21  inputs_[inCollection.instance()] = consumes<TrackClusterCollection>(inCollection);
22  produces<TrackClusterCollection>(inCollection.instance());
23  }
24 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< edm::View< pat::Muon > > mu_input_
std::map< std::string, edm::EDGetTokenT< TrackClusterCollection > > inputs_

◆ ~TrackerCleaner()

template<typename T >
TrackerCleaner< T >::~TrackerCleaner ( )
override

Definition at line 27 of file TrackerCleaner.cc.

27  {
28  // nothing to be done yet...
29 }

Member Function Documentation

◆ match_rechit_type() [1/3]

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

Definition at line 92 of file TrackerCleaner.cc.

References cms::cuda::assert().

92  {
93  assert(0); // CV: make sure general function never gets called;
94  // always use template specializations
95  return false;
96 }
assert(be >=bs)

◆ match_rechit_type() [2/3]

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

Definition at line 99 of file TrackerCleaner.cc.

99  {
100  const std::type_info &hit_type = typeid(murechit);
101  if (hit_type == typeid(SiStripRecHit2D))
102  return true;
103  else if (hit_type == typeid(SiStripRecHit1D))
104  return true;
105  else if (hit_type == typeid(SiStripMatchedRecHit2D))
106  return true;
107  else if (hit_type == typeid(ProjectedSiStripRecHit2D))
108  return true;
109 
110  return false;
111 }

◆ match_rechit_type() [3/3]

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

Definition at line 114 of file TrackerCleaner.cc.

114  {
115  const std::type_info &hit_type = typeid(murechit);
116  if (hit_type == typeid(SiPixelRecHit))
117  return true;
118 
119  return false;
120 }
Our base class.
Definition: SiPixelRecHit.h:23

◆ produce()

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

Definition at line 32 of file TrackerCleaner.cc.

References BaseTrackerRecHit::firstClusterRef(), heavyIonCSV_trainingSettings::idx, iEvent, HLT_FULL_cff::inputClusters, trackerHitRTTI::isMatched(), eostools::move(), DiMuonV_cfg::muons, convertSQLitetoXML_cfg::output, reco::Track::recHitsBegin(), and reco::Track::recHitsEnd().

32  {
33  using namespace edm;
34 
36  iEvent.getByToken(mu_input_, muonHandle);
37  edm::View<pat::Muon> muons = *muonHandle;
38 
39  for (auto input_ : inputs_) {
41  iEvent.getByToken(input_.second, inputClusters);
42 
43  std::vector<bool> vetodClusters;
44 
45  vetodClusters.resize(inputClusters->dataSize(), false);
46 
47  for (edm::View<pat::Muon>::const_iterator iMuon = muons.begin(); iMuon != muons.end(); ++iMuon) {
48  if (!iMuon->isGlobalMuon())
49  continue;
50  const reco::Track *mutrack = iMuon->globalTrack().get();
51  for (trackingRecHit_iterator hitIt = mutrack->recHitsBegin(); hitIt != mutrack->recHitsEnd(); ++hitIt) {
52  const TrackingRecHit &murechit = **hitIt;
53  if (!(murechit).isValid())
54  continue;
55 
56  if (match_rechit_type(murechit)) {
57  auto &thit = reinterpret_cast<BaseTrackerRecHit const &>(murechit);
58  auto const &cluster = thit.firstClusterRef();
59  vetodClusters[cluster.key()] = true;
60  }
61  auto &thit = reinterpret_cast<BaseTrackerRecHit const &>(murechit);
62  if (trackerHitRTTI::isMatched(thit)) {
63  vetodClusters[reinterpret_cast<SiStripMatchedRecHit2D const &>(murechit).stereoClusterRef().key()] = true;
64  }
65  }
66  }
67  std::unique_ptr<TrackClusterCollection> output(new TrackClusterCollection());
68 
69  int idx = 0;
70  for (typename TrackClusterCollection::const_iterator clustSet = inputClusters->begin();
71  clustSet != inputClusters->end();
72  ++clustSet) {
73  DetId detIdObject(clustSet->detId());
74  typename TrackClusterCollection::FastFiller spc(*output, detIdObject);
75  for (typename edmNew::DetSet<T>::const_iterator clustIt = clustSet->begin(); clustIt != clustSet->end();
76  ++clustIt) {
77  idx++;
78  if (vetodClusters[idx - 1])
79  continue;
80  spc.push_back(*clustIt);
81  }
82  }
83  iEvent.put(std::move(output), input_.first);
84  }
85 }
const edm::EDGetTokenT< edm::View< pat::Muon > > mu_input_
data_type const * const_iterator
Definition: DetSetNew.h:31
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:214
int iEvent
Definition: GenABIO.cc:224
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:91
bool isMatched(TrackingRecHit const &hit)
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
virtual OmniClusterRef const & firstClusterRef() const =0
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:88
Definition: output.py:1
bool match_rechit_type(const TrackingRecHit &murechit)
def move(src, dest)
Definition: eostools.py:511
edmNew::DetSetVector< T > TrackClusterCollection

Member Data Documentation

◆ inputs_

template<typename T >
std::map<std::string, edm::EDGetTokenT<TrackClusterCollection> > TrackerCleaner< T >::inputs_
private

Definition at line 50 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 47 of file TrackerCleaner.h.