CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TeVMuonTrackCleaner Class Reference
Inheritance diagram for TeVMuonTrackCleaner:
MuonTrackCleanerBase edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TeVMuonTrackCleaner (const edm::ParameterSet &)
 
 ~TeVMuonTrackCleaner ()
 
- Public Member Functions inherited from MuonTrackCleanerBase
 MuonTrackCleanerBase (const edm::ParameterSet &)
 
 ~MuonTrackCleanerBase ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void produceTrackExtras (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::InputTag srcGlobalMuons_cleaned_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Types inherited from MuonTrackCleanerBase
enum  { kInnerTrack, kOuterTrack, kLink, kTeV }
 
- Protected Member Functions inherited from MuonTrackCleanerBase
muonMomentumType getMuonMomentum (const reco::Candidate &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual void produceTracks (edm::Event &, const edm::EventSetup &)
 
- 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)
 
- Protected Attributes inherited from MuonTrackCleanerBase
double dRmatch_
 
int maxWarnings_tooFew_
 
int maxWarnings_tooMany_
 
std::string moduleLabel_
 
int numWarnings_tooFew_
 
int numWarnings_tooMany_
 
bool removeDuplicates_
 
edm::InputTag srcSelectedMuons_
 
std::vector< todoListEntryTypetodoList_
 
int type_
 
int verbosity_
 

Detailed Description

Produce collection of reco::Tracks in Z –> mu+ mu- event from which the two muons are removed (later to be replaced by simulated tau decay products)

This class takes care of updating the reco::MuonTrackLinks objects

Authors
Christian Veelken, LLR
Version
Revision:
1.1
Id:
GlobalMuonTrackCleaner.cc,v 1.1 2013/03/30 16:41:12 veelken Exp

Produce collection of reco::Tracks in Z –> mu+ mu- event from which the two muons are removed (later to be replaced by simulated tau decay products)

This class takes care of updating the edm::AssociationMap between globalMuons and tevMuons

Authors
Christian Veelken, LLR
Version
Revision:
1.1
Id:
TeVMuonTrackCleaner.cc,v 1.1 2013/03/30 16:41:12 veelken Exp

Definition at line 39 of file TeVMuonTrackCleaner.cc.

Constructor & Destructor Documentation

TeVMuonTrackCleaner::TeVMuonTrackCleaner ( const edm::ParameterSet cfg)
explicit

Definition at line 51 of file TeVMuonTrackCleaner.cc.

References MuonTrackCleanerBase::todoList_.

52  : MuonTrackCleanerBase(cfg),
53  srcGlobalMuons_cleaned_(cfg.getParameter<edm::InputTag>("srcGlobalMuons_cleaned"))
54 {
55  for ( typename std::vector<todoListEntryType>::const_iterator todoItem = todoList_.begin();
56  todoItem != todoList_.end(); ++todoItem ) {
57  produces<TrackToTrackMap>(todoItem->srcTracks_.instance());
58  }
59 }
T getParameter(std::string const &) const
edm::InputTag srcGlobalMuons_cleaned_
MuonTrackCleanerBase(const edm::ParameterSet &)
std::vector< todoListEntryType > todoList_
TeVMuonTrackCleaner::~TeVMuonTrackCleaner ( )
inline

Definition at line 43 of file TeVMuonTrackCleaner.cc.

43 {}

Member Function Documentation

void TeVMuonTrackCleaner::produceTrackExtras ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements MuonTrackCleanerBase.

Definition at line 83 of file TeVMuonTrackCleaner.cc.

References gather_cfg::cout, Exception, edm::Event::getByLabel(), edm::HandleBase::id(), edm::Ref< C, T, F >::id(), edm::InputTag::instance(), edm::Ref< C, T, F >::key(), edm::InputTag::label(), MuonTrackCleanerBase::moduleLabel_, edm::InputTag::process(), edm::Event::put(), srcGlobalMuons_cleaned_, MuonTrackCleanerBase::todoList_, and MuonTrackCleanerBase::verbosity_.

84 {
85  if ( verbosity_ ) std::cout << "<TeVMuonTrackCleaner::produceTrackExtras (" << moduleLabel_ << ")>:" << std::endl;
86 
87  edm::Handle<reco::TrackCollection> globalMuons_cleaned;
88  evt.getByLabel(srcGlobalMuons_cleaned_, globalMuons_cleaned);
89  if ( verbosity_ ) {
90  std::cout << "globalMuons(cleaned = " << srcGlobalMuons_cleaned_.label() << ":" << srcGlobalMuons_cleaned_.instance() << ":" << srcGlobalMuons_cleaned_.process() << ","
91  << " productId = " << globalMuons_cleaned.id() << "): #entries = " << globalMuons_cleaned->size() << std::endl;
92  }
93 
94  for ( typename std::vector<todoListEntryType>::const_iterator todoItem = todoList_.begin();
95  todoItem != todoList_.end(); ++todoItem ) {
96 
97  edm::Handle<TrackToTrackMap> trackToTrackMap;
98  evt.getByLabel(todoItem->srcTracks_, trackToTrackMap);
99  if ( verbosity_ ) {
100  for ( typename TrackToTrackMap::const_iterator entry = trackToTrackMap->begin();
101  entry != trackToTrackMap->end(); ++entry ) {
102  std::cout << "trackToTrackMap[" << entry->key.id() << ":" << entry->key.key() << "] = " << entry->val.id() << ":" << entry->val.key() << std::endl;
103  }
104  }
105 
106  std::auto_ptr<TrackToTrackMap> trackToTrackMap_cleaned(new TrackToTrackMap(globalMuons_cleaned, trackToTrackMap->refProd().val));
107 
108  size_t numGlobalMuons_cleaned = globalMuons_cleaned->size();
109  for ( size_t iGlobalMuons_cleaned = 0; iGlobalMuons_cleaned < numGlobalMuons_cleaned; ++iGlobalMuons_cleaned ) {
110  reco::TrackRef globalMuonTrack_cleaned(globalMuons_cleaned, iGlobalMuons_cleaned);
111  if ( verbosity_ ) {
112  std::cout << " globalMuon(cleaned = " << globalMuonTrack_cleaned.id() << ":" << globalMuonTrack_cleaned.key() << "):"
113  << " Pt = " << globalMuonTrack_cleaned->pt() << ", eta = " << globalMuonTrack_cleaned->eta() << ", phi = " << globalMuonTrack_cleaned->phi() << std::endl;
114  }
115  bool isMatched = false;
116  reco::TrackRef tevMuonTrack_matched;
117  double dRmatch = 1.e+3;
118  matchMuonTracks(globalMuonTrack_cleaned, *trackToTrackMap, isMatched, tevMuonTrack_matched, dRmatch, verbosity_);
119  if ( isMatched ) {
120  if ( verbosity_ ) {
121  std::cout << "--> adding trackToTrackMap[" << globalMuonTrack_cleaned.id() << ":" << globalMuonTrack_cleaned.key() << "]"
122  << " = " << tevMuonTrack_matched.id() << ":" << tevMuonTrack_matched.key() << std::endl;
123  }
124  trackToTrackMap_cleaned->insert(globalMuonTrack_cleaned, tevMuonTrack_matched);
125  } else {
126  throw cms::Exception("TeVMuonTrackCleaner::produceTrackExtras")
127  << "Failed to find Track association for " << globalMuonTrack_cleaned.id() << ":" << globalMuonTrack_cleaned.key() << "!!\n";
128  }
129  }
130 
131  evt.put(trackToTrackMap_cleaned, todoItem->srcTracks_.instance());
132  }
133 }
ProductID id() const
Definition: HandleBase.cc:15
key_type key() const
Accessor for product key.
Definition: Ref.h:264
ProductID id() const
Accessor for product ID.
Definition: Ref.h:258
edm::InputTag srcGlobalMuons_cleaned_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
bool isMatched(TrackingRecHit const &hit)
edm::AssociationMap< edm::OneToOne< reco::TrackCollection, reco::TrackCollection > > TrackToTrackMap
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
std::string const & label() const
Definition: InputTag.h:43
std::string const & process() const
Definition: InputTag.h:47
tuple cout
Definition: gather_cfg.py:121
std::vector< todoListEntryType > todoList_
std::string const & instance() const
Definition: InputTag.h:44

Member Data Documentation

edm::InputTag TeVMuonTrackCleaner::srcGlobalMuons_cleaned_
private

Definition at line 48 of file TeVMuonTrackCleaner.cc.

Referenced by produceTrackExtras().