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
 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
 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
 
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
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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, edm::hlt::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  std::auto_ptr<TrackToTrackMap> trackToTrackMap_cleaned(new TrackToTrackMap());
97 
98  edm::Handle<TrackToTrackMap> trackToTrackMap;
99  evt.getByLabel(todoItem->srcTracks_, trackToTrackMap);
100  if ( verbosity_ ) {
101  for ( typename TrackToTrackMap::const_iterator entry = trackToTrackMap->begin();
102  entry != trackToTrackMap->end(); ++entry ) {
103  std::cout << "trackToTrackMap[" << entry->key.id() << ":" << entry->key.key() << "] = " << entry->val.id() << ":" << entry->val.key() << std::endl;
104  }
105  }
106 
107  size_t numGlobalMuons_cleaned = globalMuons_cleaned->size();
108  for ( size_t iGlobalMuons_cleaned = 0; iGlobalMuons_cleaned < numGlobalMuons_cleaned; ++iGlobalMuons_cleaned ) {
109  reco::TrackRef globalMuonTrack_cleaned(globalMuons_cleaned, iGlobalMuons_cleaned);
110  if ( verbosity_ ) {
111  std::cout << " globalMuon(cleaned = " << globalMuonTrack_cleaned.id() << ":" << globalMuonTrack_cleaned.key() << "):"
112  << " Pt = " << globalMuonTrack_cleaned->pt() << ", eta = " << globalMuonTrack_cleaned->eta() << ", phi = " << globalMuonTrack_cleaned->phi() << std::endl;
113  }
114  bool isMatched = false;
115  reco::TrackRef tevMuonTrack_matched;
116  double dRmatch = 1.e+3;
117  matchMuonTracks(globalMuonTrack_cleaned, *trackToTrackMap, isMatched, tevMuonTrack_matched, dRmatch, verbosity_);
118  if ( isMatched ) {
119  if ( verbosity_ ) {
120  std::cout << "--> adding trackToTrackMap[" << globalMuonTrack_cleaned.id() << ":" << globalMuonTrack_cleaned.key() << "]"
121  << " = " << tevMuonTrack_matched.id() << ":" << tevMuonTrack_matched.key() << std::endl;
122  }
123  trackToTrackMap_cleaned->insert(globalMuonTrack_cleaned, tevMuonTrack_matched);
124  } else {
125  throw cms::Exception("TeVMuonTrackCleaner::produceTrackExtras")
126  << "Failed to find Track association for " << globalMuonTrack_cleaned.id() << ":" << globalMuonTrack_cleaned.key() << "!!\n";
127  }
128  }
129 
130  evt.put(trackToTrackMap_cleaned, todoItem->srcTracks_.instance());
131  }
132 }
ProductID id() const
Definition: HandleBase.cc:15
key_type key() const
Accessor for product key.
Definition: Ref.h:266
ProductID id() const
Accessor for product ID.
Definition: Ref.h:256
edm::InputTag srcGlobalMuons_cleaned_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
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:402
std::string const & label() const
Definition: InputTag.h:42
std::string const & process() const
Definition: InputTag.h:46
tuple cout
Definition: gather_cfg.py:121
std::vector< todoListEntryType > todoList_
std::string const & instance() const
Definition: InputTag.h:43

Member Data Documentation

edm::InputTag TeVMuonTrackCleaner::srcGlobalMuons_cleaned_
private

Definition at line 48 of file TeVMuonTrackCleaner.cc.

Referenced by produceTrackExtras().