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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TrackerCleaner (const edm::ParameterSet &)
 
 ~TrackerCleaner () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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  :
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_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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:127
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
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:104
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:510
edmNew::DetSetVector< T > TrackClusterCollection
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:109

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