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 <HLTrigger/Muon/src/HLTScoutingMuonProducer.cc>

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

Public Member Functions

 HLTScoutingMuonProducer (const edm::ParameterSet &)
 
 ~HLTScoutingMuonProducer ()
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::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
 
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
 
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)
 

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

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

Private Attributes

const edm::EDGetTokenT< reco::RecoChargedCandidateCollectionChargedCandidateCollection_
 
const edm::EDGetTokenT< reco::VertexCollectiondisplacedvertexCollection_
 
const edm::EDGetTokenT< RecoChargedCandMapEcalPFClusterIsoMap_
 
const edm::EDGetTokenT< RecoChargedCandMapHcalPFClusterIsoMap_
 
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
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 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 45 of file HLTScoutingMuonProducer.h.

Member Typedef Documentation

Definition at line 47 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 {
40  //register products
41  produces<ScoutingMuonCollection>();
42  produces<ScoutingVertexCollection>("displacedVtx");
43 }
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_
HLTScoutingMuonProducer::~HLTScoutingMuonProducer ( )
default

Referenced by HLTScoutingMuonProducer().

Member Function Documentation

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

Definition at line 187 of file HLTScoutingMuonProducer.cc.

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

187  {
189  desc.add<edm::InputTag>("ChargedCandidates", edm::InputTag("hltL3MuonCandidates"));
190  desc.add<edm::InputTag>("Tracks", edm::InputTag("hltL3Muons"));
191  desc.add<edm::InputTag>("EcalPFClusterIsoMap", edm::InputTag("hltMuonEcalPFClusterIsoForMuons"));
192  desc.add<edm::InputTag>("HcalPFClusterIsoMap", edm::InputTag("hltMuonHcalPFClusterIsoForMuons"));
193  desc.add<edm::InputTag>("TrackIsoMap", edm::InputTag(
194  "hltMuonTkRelIsolationCut0p09Map:combinedRelativeIsoDeposits"));
195  desc.add<edm::InputTag>("displacedvertexCollection", edm::InputTag("hltDisplacedmumuVtxProducerDoubleMu3NoVtx"));
196  desc.add<double>("muonPtCut", 4.0);
197  desc.add<double>("muonEtaCut", 2.4);
198  desc.add<double>("minVtxProbCut", 0.001);
199  descriptions.add("hltScoutingMuonProducer", desc);
200 }
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
finaloverrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 48 of file HLTScoutingMuonProducer.cc.

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

50 {
51  using namespace edm;
52 
53  std::unique_ptr<ScoutingMuonCollection> outMuons(new ScoutingMuonCollection());
54  std::unique_ptr<ScoutingVertexCollection> dispVertices(new ScoutingVertexCollection());
55 
56  // Get RecoChargedCandidate
57  Handle<reco::RecoChargedCandidateCollection> ChargedCandidateCollection;
58  if(!iEvent.getByToken(ChargedCandidateCollection_, ChargedCandidateCollection)){
59  iEvent.put(std::move(outMuons));
60  return;
61  }
62 
63  // Get Track
65  if(!iEvent.getByToken(TrackCollection_, TrackCollection)){
66  iEvent.put(std::move(outMuons));
67  return;
68  }
69 
70  // Get EcalPFClusterIsoMap
71  Handle<RecoChargedCandMap> EcalPFClusterIsoMap;
72  iEvent.getByToken(EcalPFClusterIsoMap_, EcalPFClusterIsoMap);
73 
74  // Get HcalPFClusterIsoMap
75  Handle<RecoChargedCandMap> HcalPFClusterIsoMap;
76  iEvent.getByToken(HcalPFClusterIsoMap_, HcalPFClusterIsoMap);
77 
78  // Get TrackIsoMap
79  Handle<ValueMap<double>> TrackIsoMap;
80  if(!iEvent.getByToken(TrackIsoMap_, TrackIsoMap)){
81  iEvent.put(std::move(outMuons));
82  return;
83  }
84 
85  std::pair<reco::RecoChargedCandidate,reco::RecoChargedCandidate> ivtxMuPair;
86  std::vector<std::pair<reco::RecoChargedCandidate,reco::RecoChargedCandidate> > vtxMuPair;
87 
88  //get displaced vertices
89  Handle<reco::VertexCollection> displacedvertexCollection;
90  if(iEvent.getByToken(displacedvertexCollection_, displacedvertexCollection)){
91 
92  for(auto &dispvtx : *displacedvertexCollection){
93  if ( !dispvtx.isValid() ) continue ;
94  float vtxProb = 0.0;
95  if( (dispvtx.chi2()>=0.0) && (dispvtx.ndof()>0) ) vtxProb = TMath::Prob(dispvtx.chi2(), dispvtx.ndof() );
96  if (vtxProb < minVtxProbCut) continue;
97 
98  // Get the 2 tracks associated to displaced vertex
99  auto trackIt = dispvtx.tracks_begin();
100  reco::TrackRef vertextkRef1 = (*trackIt).castTo<reco::TrackRef>() ;
101  trackIt++;
102  reco::TrackRef vertextkRef2 = (*trackIt).castTo<reco::TrackRef>();
103 
104  // Get the muons associated with the tracks
105  int iFoundRefs = 0;
106  for (auto const & cand : *ChargedCandidateCollection) {
107  reco::TrackRef tkRef = cand.get<reco::TrackRef>();
108  if(tkRef == vertextkRef1) {ivtxMuPair.first= cand; iFoundRefs++ ;}
109  if(tkRef == vertextkRef2) {ivtxMuPair.second= cand; iFoundRefs++ ;}
110  }
111  if (iFoundRefs<2) continue;
112  vtxMuPair.push_back(ivtxMuPair);
113 
114  dispVertices->emplace_back(
115  dispvtx.x(), dispvtx.y(), dispvtx.z(),
116  dispvtx.zError(), dispvtx.xError(),
117  dispvtx.yError(), dispvtx.tracksSize(),
118  dispvtx.chi2(), dispvtx.ndof(), dispvtx.isValid()
119  );
120 
121  }
122  }
123 
124  // Produce muons
125  std::vector<int> vtxInd;
126  float minDR2=1e-06;
127  int index = 0;
128  for (auto &muon : *ChargedCandidateCollection) {
129  reco::RecoChargedCandidateRef muonRef = getRef(ChargedCandidateCollection, index);
130  ++index;
131  if (muonRef.isNull() || !muonRef.isAvailable())
132  continue;
133 
134  reco::TrackRef track = muon.track();
135  if (track.isNull() || !track.isAvailable())
136  continue;
137 
138  if (muon.pt() < muonPtCut)
139  continue;
140  if (fabs(muon.eta()) > muonEtaCut)
141  continue;
142 
143  double ecalisopf=-1.0;
144  if ( EcalPFClusterIsoMap.isValid()) { ecalisopf = (*EcalPFClusterIsoMap)[muonRef]; }
145 
146  double hcalisopf=-1.0;
147  if ( HcalPFClusterIsoMap.isValid()) { hcalisopf = (*HcalPFClusterIsoMap)[muonRef]; }
148 
149  for (unsigned int i=0; i<vtxMuPair.size(); i++) {
150  float dr2_1 = reco::deltaR2( ((vtxMuPair[i]).first),muon );
151  float dr2_2 = reco::deltaR2( ((vtxMuPair[i]).second),muon );
152  if ( (dr2_1<minDR2) || (dr2_2<minDR2) ) vtxInd.push_back(i) ;
153  }
154 
155  outMuons->emplace_back(muon.pt(), muon.eta(), muon.phi(), muon.mass(),
156  ecalisopf, hcalisopf,
157  (*TrackIsoMap)[muonRef], track->chi2(), track->ndof(),
158  track->charge(), track->dxy(), track->dz(),
159  track->hitPattern().numberOfValidMuonHits(),
160  track->hitPattern().numberOfValidPixelHits(),
161  0, // nMatchedStations
162  track->hitPattern().trackerLayersWithMeasurement(),
163  2, // Global muon
164  track->hitPattern().numberOfValidStripHits(),
165  track->qoverp(),
166  track->lambda(),
167  track->pt(),
168  track->phi(),
169  track->eta(),
170  track->dxyError(),
171  track->dzError(),
172  track->qoverpError(),
173  track->lambdaError(),
174  track->phiError(),
175  track->dsz(),
176  track->dszError(),
177  vtxInd
178  );
179  }
180 
181  // Put output
182  iEvent.put(std::move(outMuons));
183  iEvent.put(std::move(dispVertices), "displacedVtx");
184 }
helper::MatcherGetRef< C >::ref_type getRef(const Handle< C > &c, size_t k)
Definition: getRef.h:28
bool isAvailable() const
Definition: Ref.h:577
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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_
U second(std::pair< T, U > const &p)
std::vector< ScoutingVertex > ScoutingVertexCollection
const edm::EDGetTokenT< edm::ValueMap< double > > TrackIsoMap_
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:250
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > ChargedCandidateCollection_
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36
HLT enums.
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 58 of file HLTScoutingMuonProducer.h.

Referenced by produce().

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

Definition at line 63 of file HLTScoutingMuonProducer.h.

Referenced by produce().

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

Definition at line 60 of file HLTScoutingMuonProducer.h.

Referenced by produce().

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

Definition at line 61 of file HLTScoutingMuonProducer.h.

Referenced by produce().

const double HLTScoutingMuonProducer::minVtxProbCut
private

Definition at line 67 of file HLTScoutingMuonProducer.h.

Referenced by produce().

const double HLTScoutingMuonProducer::muonEtaCut
private

Definition at line 66 of file HLTScoutingMuonProducer.h.

Referenced by produce().

const double HLTScoutingMuonProducer::muonPtCut
private

Definition at line 65 of file HLTScoutingMuonProducer.h.

Referenced by produce().

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

Definition at line 59 of file HLTScoutingMuonProducer.h.

Referenced by produce().

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

Definition at line 62 of file HLTScoutingMuonProducer.h.

Referenced by produce().