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
TeVMuonTrackMixer Class Reference
Inheritance diagram for TeVMuonTrackMixer:
TrackMixerBase edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TeVMuonTrackMixer (const edm::ParameterSet &)
 
 ~TeVMuonTrackMixer ()
 
- Public Member Functions inherited from TrackMixerBase
 TrackMixerBase (const edm::ParameterSet &)
 
 ~TrackMixerBase ()
 
- 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 Member Functions inherited from TrackMixerBase
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 TrackMixerBase
std::string moduleLabel_
 
std::vector< todoListEntryTypetodoList_
 
int verbosity_
 

Detailed Description

Merge collections of reco::Tracks of original Z -> mumu events (after removing the reconstructed muons) and embedded tau decay products.

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

Author
Tomasz Maciej Frueboes; Christian Veelken, LLR
Version
Revision:
1.2
Id:
TeVMuonTrackMixer.cc,v 1.2 2013/03/30 13:22:48 veelken Exp

Definition at line 39 of file TeVMuonTrackMixer.cc.

Constructor & Destructor Documentation

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

Definition at line 51 of file TeVMuonTrackMixer.cc.

References TrackMixerBase::todoList_.

52  : TrackMixerBase(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->srcTrackCollection1_.instance());
58  }
59 }
T getParameter(std::string const &) const
std::vector< todoListEntryType > todoList_
edm::InputTag srcGlobalMuons_cleaned_
TrackMixerBase(const edm::ParameterSet &)
TeVMuonTrackMixer::~TeVMuonTrackMixer ( )
inline

Definition at line 43 of file TeVMuonTrackMixer.cc.

43 {}

Member Function Documentation

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

Implements TrackMixerBase.

Definition at line 83 of file TeVMuonTrackMixer.cc.

References gather_cfg::cout, edm::hlt::Exception, edm::Event::getByLabel(), edm::HandleBase::id(), edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::key(), TrackMixerBase::moduleLabel_, edm::Event::put(), srcGlobalMuons_cleaned_, TrackMixerBase::todoList_, and TrackMixerBase::verbosity_.

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

Member Data Documentation

edm::InputTag TeVMuonTrackMixer::srcGlobalMuons_cleaned_
private

Definition at line 48 of file TeVMuonTrackMixer.cc.

Referenced by produceTrackExtras().