CMS 3D CMS Logo

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

#include <HLTmumutkVtxProducer.h>

Inheritance diagram for HLTmumutkVtxProducer:
edm::stream::EDProducer<>

Public Member Functions

 HLTmumutkVtxProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HLTmumutkVtxProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

bool checkPreviousCand (const reco::TrackRef &trackref, const std::vector< reco::RecoChargedCandidateRef > &ref2) const
 
bool overlap (const reco::TrackRef &trackref1, const reco::TrackRef &trackref2)
 

Static Private Member Functions

static FreeTrajectoryState initialFreeState (const reco::Track &, const MagneticField *)
 

Private Attributes

const edm::InputTag beamSpotTag_
 
const edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
const double maxEta_
 
const double maxInvMass_
 
const std::string mfName_
 
const double minD0Significance_
 
const double minInvMass_
 
const double minPt_
 
const edm::InputTag muCandTag_
 
const edm::EDGetTokenT< reco::RecoChargedCandidateCollectionmuCandToken_
 
const double overlapDR_
 
const edm::InputTag previousCandTag_
 
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefspreviousCandToken_
 
const double thirdTrackMass_
 
const edm::InputTag trkCandTag_
 
const edm::EDGetTokenT< reco::RecoChargedCandidateCollectiontrkCandToken_
 

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
 

Detailed Description

HLT Filter for b to (mumu) + X

Implementation: <Notes on="" implementation>="">

Definition at line 43 of file HLTmumutkVtxProducer.h.

Constructor & Destructor Documentation

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

Definition at line 31 of file HLTmumutkVtxProducer.cc.

References ~HLTmumutkVtxProducer().

32  : muCandTag_(iConfig.getParameter<edm::InputTag>("MuCand")),
33  muCandToken_(consumes<reco::RecoChargedCandidateCollection>(muCandTag_)),
34  trkCandTag_(iConfig.getParameter<edm::InputTag>("TrackCand")),
35  trkCandToken_(consumes<reco::RecoChargedCandidateCollection>(trkCandTag_)),
36  previousCandTag_(iConfig.getParameter<edm::InputTag>("PreviousCandTag")),
37  previousCandToken_(consumes<trigger::TriggerFilterObjectWithRefs>(previousCandTag_)),
38  mfName_(iConfig.getParameter<std::string>("SimpleMagneticField")),
39  thirdTrackMass_(iConfig.getParameter<double>("ThirdTrackMass")),
40  maxEta_(iConfig.getParameter<double>("MaxEta")),
41  minPt_(iConfig.getParameter<double>("MinPt")),
42  minInvMass_(iConfig.getParameter<double>("MinInvMass")),
43  maxInvMass_(iConfig.getParameter<double>("MaxInvMass")),
44  minD0Significance_(iConfig.getParameter<double>("MinD0Significance")),
45  overlapDR_(iConfig.getParameter<double>("OverlapDR")),
46  beamSpotTag_(iConfig.getParameter<edm::InputTag>("BeamSpotTag")),
47  beamSpotToken_(consumes<reco::BeamSpot>(beamSpotTag_)) {
48  produces<VertexCollection>();
49 }
T getParameter(std::string const &) const
const std::string mfName_
const edm::InputTag beamSpotTag_
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > trkCandToken_
const edm::InputTag previousCandTag_
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > muCandToken_
const edm::InputTag trkCandTag_
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
const edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
const edm::InputTag muCandTag_
HLTmumutkVtxProducer::~HLTmumutkVtxProducer ( )
overridedefault

Referenced by HLTmumutkVtxProducer().

Member Function Documentation

bool HLTmumutkVtxProducer::checkPreviousCand ( const reco::TrackRef trackref,
const std::vector< reco::RecoChargedCandidateRef > &  ref2 
) const
private

Definition at line 237 of file HLTmumutkVtxProducer.cc.

References mps_fire::i, and convertSQLiteXML::ok.

Referenced by produce().

238  {
239  bool ok = false;
240  for (auto& i : refVect) {
241  if (i->get<TrackRef>() == trackref) {
242  ok = true;
243  break;
244  }
245  }
246  return ok;
247 }
void HLTmumutkVtxProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 54 of file HLTmumutkVtxProducer.cc.

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

54  {
56  desc.add<edm::InputTag>("MuCand", edm::InputTag("hltMuTracks"));
57  desc.add<edm::InputTag>("TrackCand", edm::InputTag("hltMumukAllConeTracks"));
58  desc.add<edm::InputTag>("PreviousCandTag", edm::InputTag("hltDisplacedmumuFilterDoubleMu4Jpsi"));
59  desc.add<std::string>("SimpleMagneticField", "");
60  desc.add<double>("ThirdTrackMass", 0.493677);
61  desc.add<double>("MaxEta", 2.5);
62  desc.add<double>("MinPt", 3.0);
63  desc.add<double>("MinInvMass", 0.0);
64  desc.add<double>("MaxInvMass", 99999.);
65  desc.add<double>("MinD0Significance", 0.0);
66  desc.add<double>("OverlapDR", 1.44e-4);
67  desc.add<edm::InputTag>("BeamSpotTag", edm::InputTag("hltOfflineBeamSpot"));
68  descriptions.add("HLTmumutkVtxProducer", desc);
69 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
FreeTrajectoryState HLTmumutkVtxProducer::initialFreeState ( const reco::Track tk,
const MagneticField field 
)
staticprivate

Definition at line 221 of file HLTmumutkVtxProducer.cc.

References reco::TrackBase::charge(), reco::TrackBase::covariance(), runTheMatrix::err, reco::TrackBase::momentum(), and reco::TrackBase::vertex().

Referenced by produce().

221  {
223  GlobalPoint gpos(pos);
224  Basic3DVector<float> mom(tk.momentum());
225  GlobalVector gmom(mom);
226  GlobalTrajectoryParameters par(gpos, gmom, tk.charge(), field);
228  return FreeTrajectoryState(par, err);
229 }
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:629
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:641
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:677
int charge() const
track electric charge
Definition: TrackBase.h:575
bool HLTmumutkVtxProducer::overlap ( const reco::TrackRef trackref1,
const reco::TrackRef trackref2 
)
private

Definition at line 231 of file HLTmumutkVtxProducer.cc.

References PbPb_ZMuSkimMuonDPG_cff::deltaR, and overlapDR_.

Referenced by produce().

231  {
232  if (deltaR(trackref1->eta(), trackref1->phi(), trackref2->eta(), trackref2->phi()) < overlapDR_)
233  return true;
234  return false;
235 }
void HLTmumutkVtxProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 72 of file HLTmumutkVtxProducer.cc.

References funct::abs(), beamSpotToken_, checkPreviousCand(), StorageManager_cfg::e1, SiPixelPhase1Clusters_cfi::e3, edm::EventSetup::get(), edm::Ref< C, T, F >::get(), edm::Event::getByToken(), trigger::TriggerRefsCollections::getObjects(), initialFreeState(), TransientVertex::isValid(), LogDebug, maxEta_, maxInvMass_, mfName_, minD0Significance_, minInvMass_, minPt_, eostools::move(), muCandToken_, overlap(), AlCaHLTBitMon_ParallelJobs::p, p1, p2, p3, previousCandToken_, edm::ESHandle< T >::product(), edm::Event::put(), Measurement1D::significance(), mathSSE::sqrt(), thirdTrackMass_, TrajectoryStateClosestToBeamLine::transverseImpactParameter(), trigger::TriggerMuon, trkCandToken_, bphysicsOniaDQM_cfi::vertex, KalmanVertexFitter::vertex(), and spclusmultinvestigator_cfi::vertexCollection.

72  {
73  const double MuMass(0.106);
74  const double MuMass2(MuMass * MuMass);
75  const double thirdTrackMass2(thirdTrackMass_ * thirdTrackMass_);
76 
77  // get hold of muon trks
79  iEvent.getByToken(muCandToken_, mucands);
80 
81  //get the transient track builder:
83  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", theB);
84 
85  //get the beamspot position
86  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
87  iEvent.getByToken(beamSpotToken_, recoBeamSpotHandle);
88 
89  //get the b field
90  ESHandle<MagneticField> bFieldHandle;
91  iSetup.get<IdealMagneticFieldRecord>().get(mfName_, bFieldHandle);
92  const MagneticField* magField = bFieldHandle.product();
93  TSCBLBuilderNoMaterial blsBuilder;
94 
95  // get track candidates around displaced muons
97  iEvent.getByToken(trkCandToken_, trkcands);
98 
99  unique_ptr<VertexCollection> vertexCollection(new VertexCollection());
100 
101  // Ref to Candidate object to be recorded in filter object
105 
106  double e1, e2, e3;
108 
109  if (mucands->size() < 2)
110  return;
111  if (trkcands->empty())
112  return;
113 
114  RecoChargedCandidateCollection::const_iterator mucand1;
115  RecoChargedCandidateCollection::const_iterator mucand2;
116  RecoChargedCandidateCollection::const_iterator trkcand;
117 
118  // get the objects passing the previous filter
120  iEvent.getByToken(previousCandToken_, previousCands);
121 
122  vector<RecoChargedCandidateRef> vPrevCands;
123  previousCands->getObjects(TriggerMuon, vPrevCands);
124 
125  for (mucand1 = mucands->begin(); mucand1 != mucands->end(); ++mucand1) {
126  TrackRef trk1 = mucand1->get<TrackRef>();
127  LogDebug("HLTmumutkVtxProducer") << " 1st muon: q*pt= " << trk1->charge() * trk1->pt() << ", eta= " << trk1->eta()
128  << ", hits= " << trk1->numberOfValidHits();
129 
130  //first check if this muon passed the previous filter
131  if (!checkPreviousCand(trk1, vPrevCands))
132  continue;
133 
134  // eta and pt cut
135  if (fabs(trk1->eta()) > maxEta_)
136  continue;
137  if (trk1->pt() < minPt_)
138  continue;
139 
140  mucand2 = mucand1;
141  ++mucand2;
142  for (; mucand2 != mucands->end(); mucand2++) {
143  TrackRef trk2 = mucand2->get<TrackRef>();
144 
145  LogDebug("HLTDisplacedMumukFilter") << " 2nd muon: q*pt= " << trk2->charge() * trk2->pt()
146  << ", eta= " << trk2->eta() << ", hits= " << trk2->numberOfValidHits();
147 
148  //first check if this muon passed the previous filter
149  if (!checkPreviousCand(trk2, vPrevCands))
150  continue;
151  // eta and pt cut
152  if (fabs(trk2->eta()) > maxEta_)
153  continue;
154  if (trk2->pt() < minPt_)
155  continue;
156 
157  //loop on track collection
158  for (trkcand = trkcands->begin(); trkcand != trkcands->end(); ++trkcand) {
159  TrackRef trk3 = trkcand->get<TrackRef>();
160  if (overlap(trk1, trk3))
161  continue;
162  if (overlap(trk2, trk3))
163  continue;
164 
165  LogDebug("HLTDisplacedMumukFilter") << " 3rd track: q*pt= " << trk3->charge() * trk3->pt()
166  << ", eta= " << trk3->eta() << ", hits= " << trk3->numberOfValidHits();
167 
168  // eta and pt cut
169  if (fabs(trk3->eta()) > maxEta_)
170  continue;
171  if (trk3->pt() < minPt_)
172  continue;
173 
174  // Combined system
175  e1 = sqrt(trk1->momentum().Mag2() + MuMass2);
176  e2 = sqrt(trk2->momentum().Mag2() + MuMass2);
177  e3 = sqrt(trk3->momentum().Mag2() + thirdTrackMass2);
178 
179  p1 = Particle::LorentzVector(trk1->px(), trk1->py(), trk1->pz(), e1);
180  p2 = Particle::LorentzVector(trk2->px(), trk2->py(), trk2->pz(), e2);
181  p3 = Particle::LorentzVector(trk3->px(), trk3->py(), trk3->pz(), e3);
182 
183  p = p1 + p2 + p3;
184 
185  //invariant mass cut
186  double invmass = abs(p.mass());
187  LogDebug("HLTDisplacedMumukFilter") << " Invmass= " << invmass;
188  if (invmass < minInvMass_)
189  continue;
190  if (invmass > maxInvMass_)
191  continue;
192 
193  // do the vertex fit
194  vector<TransientTrack> t_tks;
195  t_tks.push_back((*theB).build(&trk1));
196  t_tks.push_back((*theB).build(&trk2));
197  t_tks.push_back((*theB).build(&trk3));
198  if (t_tks.size() != 3)
199  continue;
200 
201  FreeTrajectoryState InitialFTS = initialFreeState(*trk3, magField);
202  TrajectoryStateClosestToBeamLine tscb(blsBuilder(InitialFTS, *recoBeamSpotHandle));
203  double d0sig = tscb.transverseImpactParameter().significance();
204  if (d0sig < minD0Significance_)
205  continue;
206 
207  KalmanVertexFitter kvf;
208  TransientVertex tv = kvf.vertex(t_tks);
209  if (!tv.isValid())
210  continue;
211  Vertex vertex = tv;
212 
213  // put vertex in the event
214  vertexCollection->push_back(vertex);
215  }
216  }
217  }
218  iEvent.put(std::move(vertexCollection));
219 }
#define LogDebug(id)
static FreeTrajectoryState initialFreeState(const reco::Track &, const MagneticField *)
const std::string mfName_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
bool overlap(const reco::TrackRef &trackref1, const reco::TrackRef &trackref2)
T sqrt(T t)
Definition: SSEVec.h:19
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > trkCandToken_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
double p2[4]
Definition: TauolaWrapper.h:90
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > muCandToken_
double p1[4]
Definition: TauolaWrapper.h:89
T get() const
Definition: EventSetup.h:73
bool checkPreviousCand(const reco::TrackRef &trackref, const std::vector< reco::RecoChargedCandidateRef > &ref2) const
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
const edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
T const * product() const
Definition: ESHandle.h:86
bool isValid() const
def move(src, dest)
Definition: eostools.py:511
math::PtEtaPhiELorentzVectorF LorentzVector
double p3[4]
Definition: TauolaWrapper.h:91

Member Data Documentation

const edm::InputTag HLTmumutkVtxProducer::beamSpotTag_
private

Definition at line 72 of file HLTmumutkVtxProducer.h.

const edm::EDGetTokenT<reco::BeamSpot> HLTmumutkVtxProducer::beamSpotToken_
private

Definition at line 73 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const double HLTmumutkVtxProducer::maxEta_
private

Definition at line 65 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const double HLTmumutkVtxProducer::maxInvMass_
private

Definition at line 68 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const std::string HLTmumutkVtxProducer::mfName_
private

Definition at line 62 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const double HLTmumutkVtxProducer::minD0Significance_
private

Definition at line 69 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const double HLTmumutkVtxProducer::minInvMass_
private

Definition at line 67 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const double HLTmumutkVtxProducer::minPt_
private

Definition at line 66 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTmumutkVtxProducer::muCandTag_
private

Definition at line 55 of file HLTmumutkVtxProducer.h.

const edm::EDGetTokenT<reco::RecoChargedCandidateCollection> HLTmumutkVtxProducer::muCandToken_
private

Definition at line 56 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const double HLTmumutkVtxProducer::overlapDR_
private

Definition at line 70 of file HLTmumutkVtxProducer.h.

Referenced by overlap().

const edm::InputTag HLTmumutkVtxProducer::previousCandTag_
private

Definition at line 59 of file HLTmumutkVtxProducer.h.

const edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> HLTmumutkVtxProducer::previousCandToken_
private

Definition at line 60 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const double HLTmumutkVtxProducer::thirdTrackMass_
private

Definition at line 64 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTmumutkVtxProducer::trkCandTag_
private

Definition at line 57 of file HLTmumutkVtxProducer.h.

const edm::EDGetTokenT<reco::RecoChargedCandidateCollection> HLTmumutkVtxProducer::trkCandToken_
private

Definition at line 58 of file HLTmumutkVtxProducer.h.

Referenced by produce().