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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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::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().

24  :
25  ChargedCandidateCollection_(consumes<reco::RecoChargedCandidateCollection>
26  (iConfig.getParameter<edm::InputTag>("ChargedCandidates"))),
27  TrackCollection_(consumes<reco::TrackCollection>
28  (iConfig.getParameter<edm::InputTag>("Tracks"))),
29  EcalPFClusterIsoMap_(consumes<RecoChargedCandMap>(iConfig.getParameter<edm::InputTag>(
30  "EcalPFClusterIsoMap"))),
31  HcalPFClusterIsoMap_(consumes<RecoChargedCandMap>(iConfig.getParameter<edm::InputTag>(
32  "HcalPFClusterIsoMap"))),
34  "TrackIsoMap"))),
35  displacedvertexCollection_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("displacedvertexCollection"))),
36  muonPtCut(iConfig.getParameter<double>("muonPtCut")),
37  muonEtaCut(iConfig.getParameter<double>("muonEtaCut")),
38  minVtxProbCut(iConfig.getParameter<double>("minVtxProbCut")),
39  linkToken_ (consumes<reco::MuonTrackLinksCollection>(iConfig.getParameter<edm::InputTag>("InputLinks")))
40 {
41  //register products
42  produces<ScoutingMuonCollection>();
43  produces<ScoutingVertexCollection>("displacedVtx");
44 }
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 211 of file HLTScoutingMuonProducer.cc.

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

211  {
213  desc.add<edm::InputTag>("ChargedCandidates", edm::InputTag("hltL3MuonCandidates"));
214  desc.add<edm::InputTag>("Tracks", edm::InputTag("hltL3Muons"));
215  desc.add<edm::InputTag>("EcalPFClusterIsoMap", edm::InputTag("hltMuonEcalPFClusterIsoForMuons"));
216  desc.add<edm::InputTag>("HcalPFClusterIsoMap", edm::InputTag("hltMuonHcalPFClusterIsoForMuons"));
217  desc.add<edm::InputTag>("TrackIsoMap", edm::InputTag(
218  "hltMuonTkRelIsolationCut0p09Map:combinedRelativeIsoDeposits"));
219  desc.add<edm::InputTag>("displacedvertexCollection", edm::InputTag("hltDisplacedmumuVtxProducerDoubleMu3NoVtx"));
220  desc.add<double>("muonPtCut", 4.0);
221  desc.add<double>("muonEtaCut", 2.4);
222  desc.add<double>("minVtxProbCut", 0.001);
223  desc.add<edm::InputTag>("InputLinks",edm::InputTag("hltL3MuonsIterL3LinksNoVtx"));
224 
225  descriptions.add("hltScoutingMuonProducer", desc);
226 }
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 49 of file HLTScoutingMuonProducer.cc.

References funct::abs(), ChargedCandidateCollection_, reco::deltaR2(), displacedvertexCollection_, MillePedeFileConverter_cfg::e, EcalPFClusterIsoMap_, reco::TrackBase::eta(), plotBeamSpotDB::first, edm::Event::getByToken(), edm::getRef(), HcalPFClusterIsoMap_, mps_fire::i, edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNull(), edm::HandleBase::isValid(), linkToken_, minVtxProbCut, eostools::move(), muonEtaCut, muonPtCut, reco::TrackBase::phi(), reco::TrackBase::pt(), edm::Event::put(), edm::second(), HiIsolationCommonParameters_cff::track, TrackCollection_, and TrackIsoMap_.

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