CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
CosmicsMuonIdProducer Class Reference
Inheritance diagram for CosmicsMuonIdProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CosmicsMuonIdProducer (const edm::ParameterSet &iConfig)
 
virtual ~CosmicsMuonIdProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

MuonCosmicCompatibilityFillercompatibilityFiller_
 
edm::InputTag inputMuonCollection_
 
std::vector< edm::InputTaginputTrackCollections_
 
edm::EDGetTokenT< reco::MuonCollectionmuonToken_
 
std::vector< edm::EDGetTokenT< reco::TrackCollection > > trackTokens_
 

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

Definition at line 19 of file CosmicsMuonIdProducer.cc.

Constructor & Destructor Documentation

CosmicsMuonIdProducer::CosmicsMuonIdProducer ( const edm::ParameterSet iConfig)
inline

Definition at line 21 of file CosmicsMuonIdProducer.cc.

References compatibilityFiller_, edm::EDConsumerBase::consumesCollector(), edm::ParameterSet::getParameter(), mps_fire::i, inputMuonCollection_, inputTrackCollections_, muonToken_, and trackTokens_.

21  :
22  inputMuonCollection_(iConfig.getParameter<edm::InputTag>("muonCollection")),
23  inputTrackCollections_(iConfig.getParameter<std::vector<edm::InputTag> >("trackCollections"))
24  {
26  compatibilityFiller_ = new MuonCosmicCompatibilityFiller(iConfig.getParameter<edm::ParameterSet>("CosmicCompFillerParameters"),iC);
27 
28  produces<edm::ValueMap<unsigned int> >().setBranchAlias("cosmicsVeto");
29  produces<edm::ValueMap<reco::MuonCosmicCompatibility> >().setBranchAlias("cosmicCompatibility");
30 
31  muonToken_ = consumes<reco::MuonCollection>(inputMuonCollection_);
32  for(unsigned int i=0;i<inputTrackCollections_.size();++i)
33  trackTokens_.push_back(consumes<reco::TrackCollection>(inputTrackCollections_.at(i)));
34 
35  }
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< reco::TrackCollection > > trackTokens_
std::vector< edm::InputTag > inputTrackCollections_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
MuonCosmicCompatibilityFiller * compatibilityFiller_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
virtual CosmicsMuonIdProducer::~CosmicsMuonIdProducer ( )
inlinevirtual

Definition at line 36 of file CosmicsMuonIdProducer.cc.

References compatibilityFiller_, and produce().

36  {
38  delete compatibilityFiller_;
39  }
MuonCosmicCompatibilityFiller * compatibilityFiller_

Member Function Documentation

void CosmicsMuonIdProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Definition at line 53 of file CosmicsMuonIdProducer.cc.

References compatibilityFiller_, DEFINE_FWK_MODULE, MuonCosmicCompatibilityFiller::fillCompatibility(), objects.autophobj::filler, muonid::findOppositeTrack(), edm::Event::getByToken(), mps_fire::i, inputTrackCollections_, eostools::move(), metsig::muon, electronCleaner_cfi::muons, muonToken_, MillePedeFileConverter_cfg::out, edm::Event::put(), l1t::tracks, trackTokens_, and MuonErrorMatrixValues_cff::values.

Referenced by ~CosmicsMuonIdProducer().

54 {
56  iEvent.getByToken(muonToken_, muons);
57  // reserve some space
58  std::vector<unsigned int> values;
59  values.reserve(muons->size());
60 
61  std::vector<reco::MuonCosmicCompatibility> compValues;
62  compValues.reserve(muons->size());
63 
64  for(reco::MuonCollection::const_iterator muon = muons->begin();
65  muon != muons->end(); ++muon)
66  {
67  unsigned int foundPartner(0);
68  if ( muon->innerTrack().isNonnull() ){
69  for ( unsigned int i=0; i<inputTrackCollections_.size(); ++i )
70  {
72  iEvent.getByToken(trackTokens_.at(i), tracks);
73  if ( muonid::findOppositeTrack(tracks,*muon->innerTrack()).isNonnull() ){
74  foundPartner = i+1;
75  break;
76  }
77  }
78  }
79  values.push_back(foundPartner);
80 
81  compValues.push_back(compatibilityFiller_->fillCompatibility(*muon, iEvent, iSetup));
82  }
83 
84  // create and fill value map
85  auto out = std::make_unique<edm::ValueMap<unsigned int>>();
87  filler.insert(muons, values.begin(), values.end());
88  filler.fill();
89 
90 
91  auto outC = std::make_unique<edm::ValueMap<reco::MuonCosmicCompatibility>>();
93  fillerC.insert(muons, compValues.begin(), compValues.end());
94  fillerC.fill();
95 
96  // put value map into event
97  iEvent.put(std::move(out));
98  iEvent.put(std::move(outC));
99 }
std::vector< edm::EDGetTokenT< reco::TrackCollection > > trackTokens_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
reco::TrackRef findOppositeTrack(const edm::Handle< reco::TrackCollection > &collection, const reco::Track &muon, double angleMatch=0.01, double momentumMatch=0.05)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
std::vector< edm::InputTag > inputTrackCollections_
MuonCosmicCompatibilityFiller * compatibilityFiller_
reco::MuonCosmicCompatibility fillCompatibility(const reco::Muon &muon, edm::Event &, const edm::EventSetup &)
fill cosmic compatibility variables
edm::EDGetTokenT< reco::MuonCollection > muonToken_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

MuonCosmicCompatibilityFiller* CosmicsMuonIdProducer::compatibilityFiller_
private

Definition at line 49 of file CosmicsMuonIdProducer.cc.

Referenced by CosmicsMuonIdProducer(), produce(), and ~CosmicsMuonIdProducer().

edm::InputTag CosmicsMuonIdProducer::inputMuonCollection_
private

Definition at line 43 of file CosmicsMuonIdProducer.cc.

Referenced by CosmicsMuonIdProducer().

std::vector<edm::InputTag> CosmicsMuonIdProducer::inputTrackCollections_
private

Definition at line 44 of file CosmicsMuonIdProducer.cc.

Referenced by CosmicsMuonIdProducer(), and produce().

edm::EDGetTokenT<reco::MuonCollection> CosmicsMuonIdProducer::muonToken_
private

Definition at line 45 of file CosmicsMuonIdProducer.cc.

Referenced by CosmicsMuonIdProducer(), and produce().

std::vector<edm::EDGetTokenT<reco::TrackCollection> > CosmicsMuonIdProducer::trackTokens_
private

Definition at line 46 of file CosmicsMuonIdProducer.cc.

Referenced by CosmicsMuonIdProducer(), and produce().