CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Protected Member Functions | Protected Attributes
TrackMixerBase Class Referenceabstract

#include <TrackMixerBase.h>

Inheritance diagram for TrackMixerBase:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper GlobalMuonTrackMixer TeVMuonTrackMixer TrackMixer

Classes

struct  todoListEntryType
 

Public Member Functions

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

Protected Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual void produceTrackExtras (edm::Event &, const edm::EventSetup &)=0
 
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

std::string moduleLabel_
 
std::vector< todoListEntryTypetodoList_
 
int verbosity_
 

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)
 

Detailed Description

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

Author
Tomasz Maciej Frueboes; Christian Veelken, LLR
Version
Revision:
1.1
Id:
TrackMixerBase.h,v 1.1 2013/03/29 15:55:18 veelken Exp

Definition at line 29 of file TrackMixerBase.h.

Constructor & Destructor Documentation

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

Definition at line 3 of file TrackMixerBase.cc.

References edm::hlt::Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::InputTag::instance(), TrackMixerBase::todoListEntryType::srcTrackCollection1_, TrackMixerBase::todoListEntryType::srcTrackCollection2_, AlCaHLTBitMon_QueryRunRegistry::string, todoList_, and verbosity_.

4  : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
5 {
6  edm::VParameterSet todoList = cfg.getParameter<edm::VParameterSet>("todo");
7  if ( todoList.size() == 0 ) {
8  throw cms::Exception("Configuration")
9  << "Empty to-do list !!\n";
10  }
11 
12  for ( edm::VParameterSet::const_iterator todoItem = todoList.begin();
13  todoItem != todoList.end(); ++todoItem ) {
14  todoListEntryType todoListEntry;
15  todoListEntry.srcTrackCollection1_ = todoItem->getParameter<edm::InputTag>("collection1");
16  todoListEntry.srcTrackCollection2_ = todoItem->getParameter<edm::InputTag>("collection2");
17 
18  std::string instanceLabel1 = todoListEntry.srcTrackCollection1_.instance();
19  std::string instanceLabel2 = todoListEntry.srcTrackCollection2_.instance();
20  if ( instanceLabel1 != instanceLabel2 ) {
21  throw cms::Exception("Configuration")
22  << "Mismatch in Instance labels for collection 1 = " << instanceLabel1 << " and 2 = " << instanceLabel2 << " !!\n";
23  }
24 
25  todoList_.push_back(todoListEntry);
26 
27  produces<reco::TrackCollection>(instanceLabel1);
28  }
29 
30  verbosity_ = ( cfg.exists("verbosity") ) ?
31  cfg.getParameter<int>("verbosity") : 0;
32 }
T getParameter(std::string const &) const
std::vector< todoListEntryType > todoList_
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::string moduleLabel_
TrackMixerBase::~TrackMixerBase ( )
inline

Definition at line 33 of file TrackMixerBase.h.

33 {}

Member Function Documentation

void TrackMixerBase::produce ( edm::Event evt,
const edm::EventSetup es 
)
protectedvirtual

Implements edm::EDProducer.

Definition at line 34 of file TrackMixerBase.cc.

References produceTrackExtras(), and produceTracks().

35 {
36  produceTracks(evt, es);
37  produceTrackExtras(evt, es);
38 }
virtual void produceTracks(edm::Event &, const edm::EventSetup &)
virtual void produceTrackExtras(edm::Event &, const edm::EventSetup &)=0
virtual void TrackMixerBase::produceTrackExtras ( edm::Event ,
const edm::EventSetup  
)
protectedpure virtual

Implemented in TeVMuonTrackMixer, GlobalMuonTrackMixer, and TrackMixer.

Referenced by produce().

void TrackMixerBase::produceTracks ( edm::Event evt,
const edm::EventSetup es 
)
protectedvirtual

Definition at line 40 of file TrackMixerBase.cc.

References gather_cfg::cout, edm::Event::getByLabel(), edm::Event::getRefBeforePut(), customizeTrackingMonitorSeedNumber::idx, moduleLabel_, edm::Event::put(), todoList_, and verbosity_.

Referenced by produce().

41 {
42  if ( verbosity_ ) std::cout << "<TrackMixerBase::produce (" << moduleLabel_ << ")>:" << std::endl;
43 
44  for ( typename std::vector<todoListEntryType>::const_iterator todoItem = todoList_.begin();
45  todoItem != todoList_.end(); ++todoItem ) {
46  todoItem->trackRefMap_.clear();
47 
48  edm::Handle<reco::TrackCollection> trackCollection1;
49  evt.getByLabel(todoItem->srcTrackCollection1_, trackCollection1);
50 
51  edm::Handle<reco::TrackCollection> trackCollection2;
52  evt.getByLabel(todoItem->srcTrackCollection2_, trackCollection2);
53 
54  if ( verbosity_ ) {
55  std::cout << "trackCollection(input1 = " << todoItem->srcTrackCollection1_.label() << ":" << todoItem->srcTrackCollection1_.instance() << ":" << todoItem->srcTrackCollection1_.process() << "):"
56  << " #entries = " << trackCollection1->size() << std::endl;
57  std::cout << "trackCollection(input2 = " << todoItem->srcTrackCollection2_.label() << ":" << todoItem->srcTrackCollection2_.instance() << ":" << todoItem->srcTrackCollection2_.process() << "):"
58  << " #entries = " << trackCollection2->size() << std::endl;
59  }
60 
61  std::auto_ptr<reco::TrackCollection> trackCollection_output(new reco::TrackCollection());
62 
63  reco::TrackRefProd trackCollectionRefProd_output = evt.getRefBeforePut<reco::TrackCollection>(todoItem->srcTrackCollection1_.instance());
64  size_t idxTrack_output = 0;
65 
66  size_t numTracks1 = trackCollection1->size();
67  for ( size_t idxTrack1 = 0; idxTrack1 < numTracks1; ++idxTrack1 ) {
68  reco::TrackRef track1(trackCollection1, idxTrack1);
69  trackCollection_output->push_back(*track1);
70  todoItem->trackRefMap_[reco::TrackRef(trackCollectionRefProd_output, idxTrack_output)] = track1;
71  ++idxTrack_output;
72  }
73 
74  size_t numTracks2 = trackCollection2->size();
75  for ( size_t idxTrack2 = 0; idxTrack2 < numTracks2; ++idxTrack2 ) {
76  reco::TrackRef track2(trackCollection2, idxTrack2);
77  trackCollection_output->push_back(*track2);
78  todoItem->trackRefMap_[reco::TrackRef(trackCollectionRefProd_output, idxTrack_output)] = track2;
79  ++idxTrack_output;
80  }
81 
82  if ( verbosity_ ) {
83  std::cout << "trackCollection(output = " << moduleLabel_ << ":" << todoItem->srcTrackCollection1_.instance() << "): #entries = " << trackCollection_output->size() << std::endl;
84  int idx = 0;
85  for ( reco::TrackCollection::const_iterator track = trackCollection_output->begin();
86  track != trackCollection_output->end(); ++track ) {
87  if ( track->pt() > 5. ) {
88  std::cout << "track #" << idx << ": Pt = " << track->pt() << ", eta = " << track->eta() << ", phi = " << track->phi() << std::endl;
89  ++idx;
90  }
91  }
92  }
93 
94  evt.put(trackCollection_output, todoItem->srcTrackCollection1_.instance());
95  }
96 }
std::vector< todoListEntryType > todoList_
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
RefProd< PROD > getRefBeforePut()
Definition: Event.h:135
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:19
tuple cout
Definition: gather_cfg.py:121
std::string moduleLabel_

Member Data Documentation

std::string TrackMixerBase::moduleLabel_
protected
std::vector<todoListEntryType> TrackMixerBase::todoList_
protected
int TrackMixerBase::verbosity_
protected