CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
UpdatedMuonInnerTrackRef Class Reference
Inheritance diagram for UpdatedMuonInnerTrackRef:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 UpdatedMuonInnerTrackRef (const edm::ParameterSet &)
 
 ~UpdatedMuonInnerTrackRef () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
reco::TrackRef findNewRef (reco::TrackRef oldTrackRef, edm::Handle< reco::TrackCollection > &newTrackCollection)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

double maxInvPtDiff
 
double minDR
 
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
 
edm::EDGetTokenT< reco::TrackCollectionnewTrackToken_
 
edm::EDGetTokenT< reco::TrackCollectionoldTrackToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
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)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 19 of file Skim_UpdatedMuonInnerTrackRef.cc.

Constructor & Destructor Documentation

◆ UpdatedMuonInnerTrackRef()

UpdatedMuonInnerTrackRef::UpdatedMuonInnerTrackRef ( const edm::ParameterSet pset)
explicit

Definition at line 40 of file Skim_UpdatedMuonInnerTrackRef.cc.

40  {
41  // What is being produced
42  produces<std::vector<reco::Muon> >();
43 
44  // Input products
45  muonToken_ =
46  consumes<edm::View<reco::Muon> >(pset.getUntrackedParameter<edm::InputTag>("MuonTag", edm::InputTag("muons")));
47  oldTrackToken_ = consumes<reco::TrackCollection>(
48  pset.getUntrackedParameter<edm::InputTag>("OldTrackTag", edm::InputTag("generalTracks")));
49  newTrackToken_ = consumes<reco::TrackCollection>(
50  pset.getUntrackedParameter<edm::InputTag>("NewTrackTag", edm::InputTag("generalTracksSkim")));
51 
52  // matching criteria products
53  maxInvPtDiff = pset.getUntrackedParameter<double>("maxInvPtDiff", 0.005);
54  minDR = pset.getUntrackedParameter<double>("minDR", 0.1);
55 }

References HLT_2018_cff::InputTag, maxInvPtDiff, minDR, muonToken_, newTrackToken_, oldTrackToken_, and muonDTDigis_cfi::pset.

◆ ~UpdatedMuonInnerTrackRef()

UpdatedMuonInnerTrackRef::~UpdatedMuonInnerTrackRef ( )
override

Definition at line 58 of file Skim_UpdatedMuonInnerTrackRef.cc.

58 {}

Member Function Documentation

◆ beginJob()

void UpdatedMuonInnerTrackRef::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 61 of file Skim_UpdatedMuonInnerTrackRef.cc.

61 {}

◆ endJob()

void UpdatedMuonInnerTrackRef::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 64 of file Skim_UpdatedMuonInnerTrackRef.cc.

64 {}

◆ findNewRef()

reco::TrackRef UpdatedMuonInnerTrackRef::findNewRef ( reco::TrackRef  oldTrackRef,
edm::Handle< reco::TrackCollection > &  newTrackCollection 
)
private

Definition at line 112 of file Skim_UpdatedMuonInnerTrackRef.cc.

113  {
114  float dRMin = 1000;
115  int found = -1;
116  for (unsigned int i = 0; i < newTrackCollection->size(); i++) {
118  if (newTrackRef.isNull())
119  continue;
120 
121  if (fabs((1.0 / newTrackRef->pt()) - (1.0 / oldTrackRef->pt())) > maxInvPtDiff)
122  continue;
123  float dR = deltaR(newTrackRef->momentum(), oldTrackRef->momentum());
124  if (dR <= minDR && dR < dRMin) {
125  dRMin = dR;
126  found = i;
127  }
128  }
129 
130  if (found >= 0) {
132  } else {
133  return reco::TrackRef();
134  }
135 }

References PbPb_ZMuSkimMuonDPG_cff::deltaR, HGC3DClusterGenMatchSelector_cfi::dR, HLT_2018_cff::dRMin, newFWLiteAna::found, mps_fire::i, edm::Ref< C, T, F >::isNull(), maxInvPtDiff, minDR, and ConversionTrackRefFix_cfi::newTrackCollection.

Referenced by produce().

◆ produce()

void UpdatedMuonInnerTrackRef::produce ( edm::Event ev,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 67 of file Skim_UpdatedMuonInnerTrackRef.cc.

67  {
68  // Muon collection
69  edm::Handle<edm::View<reco::Muon> > muonCollectionHandle;
70  if (!ev.getByToken(muonToken_, muonCollectionHandle)) {
71  edm::LogError("") << ">>> Muon collection does not exist !!!";
72  return;
73  }
74 
76  if (!ev.getByToken(oldTrackToken_, oldTrackCollection)) {
77  edm::LogError("") << ">>> Old Track collection does not exist !!!";
78  return;
79  }
80 
82  if (!ev.getByToken(newTrackToken_, newTrackCollection)) {
83  edm::LogError("") << ">>> New Track collection does not exist !!!";
84  return;
85  }
86 
87  unsigned int muonCollectionSize = muonCollectionHandle->size();
88  std::unique_ptr<reco::MuonCollection> newmuons(new reco::MuonCollection);
89 
90  for (unsigned int i = 0; i < muonCollectionSize; i++) {
91  edm::RefToBase<reco::Muon> mu = muonCollectionHandle->refAt(i);
92  reco::Muon* newmu = mu->clone();
93 
94  if (mu->innerTrack().isNonnull()) {
95  reco::TrackRef newTrackRef = findNewRef(mu->innerTrack(), newTrackCollection);
96  /* printf(" %6.2f %+6.2f %+6.2f --> ",mu->innerTrack()->pt (), mu->innerTrack()->eta(), mu->innerTrack()->phi());
97  if(newTrackRef.isNonnull()){
98  printf(" %6.2f %+6.2f %+6.2f\n",newTrackRef->pt (), newTrackRef->eta(), newTrackRef->phi());
99  }else{
100  printf("\n");
101  }
102 */
103  newmu->setInnerTrack(newTrackRef);
104  }
105 
106  newmuons->push_back(*newmu);
107  }
108 
109  ev.put(std::move(newmuons));
110 }

References ev, findNewRef(), mps_fire::i, eostools::move(), amptDefaultParameters_cff::mu, muonToken_, MuonAlignmentFromReference_cff::newmuons, ConversionTrackRefFix_cfi::newTrackCollection, newTrackToken_, ElectronSeedTrackRefFix_cfi::oldTrackCollection, oldTrackToken_, and reco::Muon::setInnerTrack().

Member Data Documentation

◆ maxInvPtDiff

double UpdatedMuonInnerTrackRef::maxInvPtDiff
private

Definition at line 35 of file Skim_UpdatedMuonInnerTrackRef.cc.

Referenced by findNewRef(), and UpdatedMuonInnerTrackRef().

◆ minDR

double UpdatedMuonInnerTrackRef::minDR
private

Definition at line 36 of file Skim_UpdatedMuonInnerTrackRef.cc.

Referenced by findNewRef(), and UpdatedMuonInnerTrackRef().

◆ muonToken_

edm::EDGetTokenT<edm::View<reco::Muon> > UpdatedMuonInnerTrackRef::muonToken_
private

Definition at line 31 of file Skim_UpdatedMuonInnerTrackRef.cc.

Referenced by produce(), and UpdatedMuonInnerTrackRef().

◆ newTrackToken_

edm::EDGetTokenT<reco::TrackCollection> UpdatedMuonInnerTrackRef::newTrackToken_
private

Definition at line 33 of file Skim_UpdatedMuonInnerTrackRef.cc.

Referenced by produce(), and UpdatedMuonInnerTrackRef().

◆ oldTrackToken_

edm::EDGetTokenT<reco::TrackCollection> UpdatedMuonInnerTrackRef::oldTrackToken_
private

Definition at line 32 of file Skim_UpdatedMuonInnerTrackRef.cc.

Referenced by produce(), and UpdatedMuonInnerTrackRef().

MuonAlignmentFromReference_cff.newmuons
newmuons
Definition: MuonAlignmentFromReference_cff.py:26
mps_fire.i
i
Definition: mps_fire.py:355
UpdatedMuonInnerTrackRef::muonToken_
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
Definition: Skim_UpdatedMuonInnerTrackRef.cc:31
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition: Ref.h:235
reco::Muon::setInnerTrack
virtual void setInnerTrack(const TrackRef &t)
set reference to Track
UpdatedMuonInnerTrackRef::minDR
double minDR
Definition: Skim_UpdatedMuonInnerTrackRef.cc:36
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Handle
Definition: AssociativeIterator.h:50
reco::Muon
Definition: Muon.h:27
edm::Ref< TrackCollection >
reco::MuonCollection
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
UpdatedMuonInnerTrackRef::maxInvPtDiff
double maxInvPtDiff
Definition: Skim_UpdatedMuonInnerTrackRef.cc:35
HLT_2018_cff.dRMin
dRMin
Definition: HLT_2018_cff.py:7352
UpdatedMuonInnerTrackRef::oldTrackToken_
edm::EDGetTokenT< reco::TrackCollection > oldTrackToken_
Definition: Skim_UpdatedMuonInnerTrackRef.cc:32
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
reco::TrackRef
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::LogError
Definition: MessageLogger.h:183
UpdatedMuonInnerTrackRef::newTrackToken_
edm::EDGetTokenT< reco::TrackCollection > newTrackToken_
Definition: Skim_UpdatedMuonInnerTrackRef.cc:33
eostools.move
def move(src, dest)
Definition: eostools.py:511
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
ConversionTrackRefFix_cfi.newTrackCollection
newTrackCollection
Definition: ConversionTrackRefFix_cfi.py:6
edm::RefToBase
Definition: AssociativeIterator.h:54
UpdatedMuonInnerTrackRef::findNewRef
reco::TrackRef findNewRef(reco::TrackRef oldTrackRef, edm::Handle< reco::TrackCollection > &newTrackCollection)
Definition: Skim_UpdatedMuonInnerTrackRef.cc:112
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
ElectronSeedTrackRefFix_cfi.oldTrackCollection
oldTrackCollection
Definition: ElectronSeedTrackRefFix_cfi.py:7