CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
HLTScoutingMuonProducer Class Reference

#include <HLTScoutingMuonProducer.h>

Inheritance diagram for HLTScoutingMuonProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HLTScoutingMuonProducer (const edm::ParameterSet &)
 
 ~HLTScoutingMuonProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () 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
 
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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Types

typedef edm::AssociationMap< edm::OneToValue< std::vector< reco::RecoChargedCandidate >, float, unsigned int > > RecoChargedCandMap
 

Private Member Functions

void produce (edm::StreamID sid, edm::Event &iEvent, edm::EventSetup const &setup) const final
 

Private Attributes

const edm::EDGetTokenT< reco::RecoChargedCandidateCollectionChargedCandidateCollection_
 
const edm::EDGetTokenT< reco::VertexCollectiondisplacedvertexCollection_
 
const edm::EDGetTokenT< RecoChargedCandMapEcalPFClusterIsoMap_
 
const edm::EDGetTokenT< RecoChargedCandMapHcalPFClusterIsoMap_
 
const edm::EDGetTokenT< reco::MuonTrackLinksCollectionlinkToken_
 
const double minVtxProbCut
 
const double muonEtaCut
 
const double muonPtCut
 
const edm::EDGetTokenT< reco::TrackCollectionTrackCollection_
 
const edm::EDGetTokenT< edm::ValueMap< double > > TrackIsoMap_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Description: Producer for ScoutingMuon

Definition at line 48 of file HLTScoutingMuonProducer.h.

Member Typedef Documentation

Definition at line 50 of file HLTScoutingMuonProducer.h.

Constructor & Destructor Documentation

HLTScoutingMuonProducer::HLTScoutingMuonProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 24 of file HLTScoutingMuonProducer.cc.

References ~HLTScoutingMuonProducer().

26  consumes<reco::RecoChargedCandidateCollection>(iConfig.getParameter<edm::InputTag>("ChargedCandidates"))),
27  TrackCollection_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("Tracks"))),
28  EcalPFClusterIsoMap_(consumes<RecoChargedCandMap>(iConfig.getParameter<edm::InputTag>("EcalPFClusterIsoMap"))),
29  HcalPFClusterIsoMap_(consumes<RecoChargedCandMap>(iConfig.getParameter<edm::InputTag>("HcalPFClusterIsoMap"))),
32  consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("displacedvertexCollection"))),
33  muonPtCut(iConfig.getParameter<double>("muonPtCut")),
34  muonEtaCut(iConfig.getParameter<double>("muonEtaCut")),
35  minVtxProbCut(iConfig.getParameter<double>("minVtxProbCut")),
36  linkToken_(consumes<reco::MuonTrackLinksCollection>(iConfig.getParameter<edm::InputTag>("InputLinks"))) {
37  //register products
38  produces<ScoutingMuonCollection>();
39  produces<ScoutingVertexCollection>("displacedVtx");
40 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< RecoChargedCandMap > EcalPFClusterIsoMap_
const edm::EDGetTokenT< reco::TrackCollection > TrackCollection_
const edm::EDGetTokenT< RecoChargedCandMap > HcalPFClusterIsoMap_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< edm::ValueMap< double > > TrackIsoMap_
const edm::EDGetTokenT< reco::VertexCollection > displacedvertexCollection_
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > ChargedCandidateCollection_
const edm::EDGetTokenT< reco::MuonTrackLinksCollection > linkToken_
HLTScoutingMuonProducer::~HLTScoutingMuonProducer ( )
overridedefault

Referenced by HLTScoutingMuonProducer().

Member Function Documentation

void HLTScoutingMuonProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 229 of file HLTScoutingMuonProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), DEFINE_FWK_MODULE, and HLT_2018_cff::InputTag.

229  {
231  desc.add<edm::InputTag>("ChargedCandidates", edm::InputTag("hltIterL3MuonCandidates"));
232  desc.add<edm::InputTag>("Tracks", edm::InputTag("hltPixelTracks"));
233  desc.add<edm::InputTag>("EcalPFClusterIsoMap", edm::InputTag("hltMuonEcalMFPFClusterIsoForMuons"));
234  desc.add<edm::InputTag>("HcalPFClusterIsoMap", edm::InputTag("hltMuonHcalRegPFClusterIsoForMuons"));
235  desc.add<edm::InputTag>("TrackIsoMap", edm::InputTag("hltMuonTkRelIsolationCut0p07Map:combinedRelativeIsoDeposits"));
236  desc.add<edm::InputTag>("displacedvertexCollection", edm::InputTag("hltPixelVertices"));
237  desc.add<double>("muonPtCut", 3.0);
238  desc.add<double>("muonEtaCut", 2.4);
239  desc.add<double>("minVtxProbCut", 0.001);
240  desc.add<edm::InputTag>("InputLinks", edm::InputTag("hltL3MuonsIterL3Links"));
241 
242  descriptions.add("hltScoutingMuonProducer", desc);
243 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HLTScoutingMuonProducer::produce ( edm::StreamID  sid,
edm::Event iEvent,
edm::EventSetup const &  setup 
) const
finalprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 45 of file HLTScoutingMuonProducer.cc.

References funct::abs(), ChargedCandidateCollection_, reco::deltaR2(), HLTMuonOfflineAnalyzer_cfi::deltaR2, HLT_2018_cff::displacedvertexCollection, displacedvertexCollection_, MillePedeFileConverter_cfg::e, HLT_2018_cff::EcalPFClusterIsoMap, EcalPFClusterIsoMap_, reco::TrackBase::eta(), dqmdumpme::first, edm::Event::getByToken(), edm::getRef(), HLT_2018_cff::HcalPFClusterIsoMap, HcalPFClusterIsoMap_, mps_fire::i, edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNull(), edm::HandleBase::isValid(), MainPageGenerator::link, electronStore::links, linkToken_, minVtxProbCut, eostools::move(), muonEtaCut, muonPtCut, reco::TrackBase::phi(), reco::TrackBase::pt(), edm::Event::put(), edm::second(), HLT_2018_cff::track, TrackCollection_, HLT_2018_cff::TrackIsoMap, and TrackIsoMap_.

45  {
46  using namespace edm;
47 
48  std::unique_ptr<ScoutingMuonCollection> outMuons(new ScoutingMuonCollection());
49  std::unique_ptr<ScoutingVertexCollection> dispVertices(new ScoutingVertexCollection());
50 
51  // Get RecoChargedCandidate
52  Handle<reco::RecoChargedCandidateCollection> ChargedCandidateCollection;
53  if (!iEvent.getByToken(ChargedCandidateCollection_, ChargedCandidateCollection)) {
54  iEvent.put(std::move(outMuons));
55  return;
56  }
57 
58  // Get Track
60  if (!iEvent.getByToken(TrackCollection_, TrackCollection)) {
61  iEvent.put(std::move(outMuons));
62  return;
63  }
64 
65  // Get EcalPFClusterIsoMap
67  iEvent.getByToken(EcalPFClusterIsoMap_, EcalPFClusterIsoMap);
68 
69  // Get HcalPFClusterIsoMap
71  iEvent.getByToken(HcalPFClusterIsoMap_, HcalPFClusterIsoMap);
72 
73  // Get TrackIsoMap
75  if (!iEvent.getByToken(TrackIsoMap_, TrackIsoMap)) {
76  iEvent.put(std::move(outMuons));
77  return;
78  }
79 
80  std::pair<reco::RecoChargedCandidate, reco::RecoChargedCandidate> ivtxMuPair;
81  std::vector<std::pair<reco::RecoChargedCandidate, reco::RecoChargedCandidate>> vtxMuPair;
82 
83  //get displaced vertices
85  if (iEvent.getByToken(displacedvertexCollection_, displacedvertexCollection)) {
86  for (auto& dispvtx : *displacedvertexCollection) {
87  if (!dispvtx.isValid())
88  continue;
89  float vtxProb = 0.0;
90  if ((dispvtx.chi2() >= 0.0) && (dispvtx.ndof() > 0))
91  vtxProb = TMath::Prob(dispvtx.chi2(), dispvtx.ndof());
92  if (vtxProb < minVtxProbCut)
93  continue;
94 
95  // Get the 2 tracks associated to displaced vertex
96  auto trackIt = dispvtx.tracks_begin();
97  reco::TrackRef vertextkRef1 = (*trackIt).castTo<reco::TrackRef>();
98  trackIt++;
99  reco::TrackRef vertextkRef2 = (*trackIt).castTo<reco::TrackRef>();
100 
101  // Get the muons associated with the tracks
102  int iFoundRefs = 0;
103  for (auto const& cand : *ChargedCandidateCollection) {
104  reco::TrackRef tkRef = cand.get<reco::TrackRef>();
105  if (tkRef == vertextkRef1) {
106  ivtxMuPair.first = cand;
107  iFoundRefs++;
108  }
109  if (tkRef == vertextkRef2) {
110  ivtxMuPair.second = cand;
111  iFoundRefs++;
112  }
113  }
114  if (iFoundRefs < 2)
115  continue;
116  vtxMuPair.push_back(ivtxMuPair);
117 
118  dispVertices->emplace_back(dispvtx.x(),
119  dispvtx.y(),
120  dispvtx.z(),
121  dispvtx.zError(),
122  dispvtx.xError(),
123  dispvtx.yError(),
124  dispvtx.tracksSize(),
125  dispvtx.chi2(),
126  dispvtx.ndof(),
127  dispvtx.isValid());
128  }
129  }
130 
131  // Produce muons
132  std::vector<int> vtxInd;
133  float minDR2 = 1e-06;
134  int index = 0;
135 
136  // Read Links collection:
138  iEvent.getByToken(linkToken_, links);
139 
140  for (auto& muon : *ChargedCandidateCollection) {
141  reco::RecoChargedCandidateRef muonRef = getRef(ChargedCandidateCollection, index);
142  ++index;
143  if (muonRef.isNull() || !muonRef.isAvailable())
144  continue;
145 
146  reco::TrackRef track = muon.track();
147  if (track.isNull() || !track.isAvailable())
148  continue;
149 
150  int validmuhit = 0;
151  int matchedsta = 0;
152  for (auto const& link : *links) {
153  const reco::Track& trackerTrack = *link.trackerTrack();
154  float dR2 = deltaR2(track->eta(), track->phi(), trackerTrack.eta(), trackerTrack.phi());
155  float dPt = std::abs(track->pt() - trackerTrack.pt());
156  if (track->pt() != 0)
157  dPt = dPt / track->pt();
158 
159  if (dR2 < 0.02 * 0.02 and dPt < 0.001) {
160  const reco::TrackRef staTrack = link.standAloneTrack();
161  validmuhit = staTrack->hitPattern().numberOfValidMuonHits();
162  matchedsta = staTrack->hitPattern().muonStationsWithValidHits();
163  }
164  }
165 
166  if (muon.pt() < muonPtCut)
167  continue;
168  if (fabs(muon.eta()) > muonEtaCut)
169  continue;
170 
171  double ecalisopf = -1.0;
172  if (EcalPFClusterIsoMap.isValid()) {
173  ecalisopf = (*EcalPFClusterIsoMap)[muonRef];
174  }
175 
176  double hcalisopf = -1.0;
177  if (HcalPFClusterIsoMap.isValid()) {
178  hcalisopf = (*HcalPFClusterIsoMap)[muonRef];
179  }
180 
181  vtxInd.reserve(vtxMuPair.size());
182  for (unsigned int i = 0; i < vtxMuPair.size(); i++) {
183  float dr2_1 = reco::deltaR2(((vtxMuPair[i]).first), muon);
184  float dr2_2 = reco::deltaR2(((vtxMuPair[i]).second), muon);
185  if ((dr2_1 < minDR2) || (dr2_2 < minDR2))
186  vtxInd.push_back(i);
187  }
188 
189  outMuons->emplace_back(muon.pt(),
190  muon.eta(),
191  muon.phi(),
192  muon.mass(),
193  ecalisopf,
194  hcalisopf,
195  (*TrackIsoMap)[muonRef],
196  track->chi2(),
197  track->ndof(),
198  track->charge(),
199  track->dxy(),
200  track->dz(),
201  validmuhit,
202  track->hitPattern().numberOfValidPixelHits(),
203  matchedsta,
204  track->hitPattern().trackerLayersWithMeasurement(),
205  2, // Global muon
206  track->hitPattern().numberOfValidStripHits(),
207  track->qoverp(),
208  track->lambda(),
209  track->pt(),
210  track->phi(),
211  track->eta(),
212  track->dxyError(),
213  track->dzError(),
214  track->qoverpError(),
215  track->lambdaError(),
216  track->phiError(),
217  track->dsz(),
218  track->dszError(),
219  vtxInd);
220  vtxInd.clear();
221  }
222 
223  // Put output
224  iEvent.put(std::move(outMuons));
225  iEvent.put(std::move(dispVertices), "displacedVtx");
226 }
helper::MatcherGetRef< C >::ref_type getRef(const Handle< C > &c, size_t k)
Definition: getRef.h:28
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
const edm::EDGetTokenT< RecoChargedCandMap > EcalPFClusterIsoMap_
const edm::EDGetTokenT< reco::TrackCollection > TrackCollection_
const edm::EDGetTokenT< RecoChargedCandMap > HcalPFClusterIsoMap_
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:614
bool isAvailable() const
Definition: Ref.h:537
U second(std::pair< T, U > const &p)
std::vector< ScoutingVertex > ScoutingVertexCollection
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:617
const edm::EDGetTokenT< edm::ValueMap< double > > TrackIsoMap_
double pt() const
track transverse momentum
Definition: TrackBase.h:602
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< ScoutingMuon > ScoutingMuonCollection
Definition: ScoutingMuon.h:176
const edm::EDGetTokenT< reco::VertexCollection > displacedvertexCollection_
bool isValid() const
Definition: HandleBase.h:70
bool isNull() const
Checks for null.
Definition: Ref.h:235
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > ChargedCandidateCollection_
const edm::EDGetTokenT< reco::MuonTrackLinksCollection > linkToken_
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

const edm::EDGetTokenT<reco::RecoChargedCandidateCollection> HLTScoutingMuonProducer::ChargedCandidateCollection_
private

Definition at line 61 of file HLTScoutingMuonProducer.h.

Referenced by produce().

const edm::EDGetTokenT<reco::VertexCollection> HLTScoutingMuonProducer::displacedvertexCollection_
private

Definition at line 66 of file HLTScoutingMuonProducer.h.

Referenced by produce().

const edm::EDGetTokenT<RecoChargedCandMap> HLTScoutingMuonProducer::EcalPFClusterIsoMap_
private

Definition at line 63 of file HLTScoutingMuonProducer.h.

Referenced by produce().

const edm::EDGetTokenT<RecoChargedCandMap> HLTScoutingMuonProducer::HcalPFClusterIsoMap_
private

Definition at line 64 of file HLTScoutingMuonProducer.h.

Referenced by produce().

const edm::EDGetTokenT<reco::MuonTrackLinksCollection> HLTScoutingMuonProducer::linkToken_
private

Definition at line 72 of file HLTScoutingMuonProducer.h.

Referenced by produce().

const double HLTScoutingMuonProducer::minVtxProbCut
private

Definition at line 70 of file HLTScoutingMuonProducer.h.

Referenced by produce().

const double HLTScoutingMuonProducer::muonEtaCut
private

Definition at line 69 of file HLTScoutingMuonProducer.h.

Referenced by produce().

const double HLTScoutingMuonProducer::muonPtCut
private

Definition at line 68 of file HLTScoutingMuonProducer.h.

Referenced by produce().

const edm::EDGetTokenT<reco::TrackCollection> HLTScoutingMuonProducer::TrackCollection_
private

Definition at line 62 of file HLTScoutingMuonProducer.h.

Referenced by produce().

const edm::EDGetTokenT<edm::ValueMap<double> > HLTScoutingMuonProducer::TrackIsoMap_
private

Definition at line 65 of file HLTScoutingMuonProducer.h.

Referenced by produce().