CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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::BeamSpot
beamSpotToken_
 
const edm::ESGetToken
< MagneticField,
IdealMagneticFieldRecord
idealMagneticFieldRecordToken_
 
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::RecoChargedCandidateCollection
muCandToken_
 
const double overlapDR_
 
const edm::InputTag previousCandTag_
 
const edm::EDGetTokenT
< trigger::TriggerFilterObjectWithRefs
previousCandToken_
 
const double thirdTrackMass_
 
const edm::ESGetToken
< TransientTrackBuilder,
TransientTrackRecord
transientTrackRecordToken_
 
const edm::InputTag trkCandTag_
 
const edm::EDGetTokenT
< reco::RecoChargedCandidateCollection
trkCandToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

HLT Filter for b to (mumu) + X

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

Definition at line 47 of file HLTmumutkVtxProducer.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file HLTmumutkVtxProducer.cc.

27  : transientTrackRecordToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))),
28  muCandTag_(iConfig.getParameter<edm::InputTag>("MuCand")),
29  muCandToken_(consumes<reco::RecoChargedCandidateCollection>(muCandTag_)),
30  trkCandTag_(iConfig.getParameter<edm::InputTag>("TrackCand")),
31  trkCandToken_(consumes<reco::RecoChargedCandidateCollection>(trkCandTag_)),
32  previousCandTag_(iConfig.getParameter<edm::InputTag>("PreviousCandTag")),
33  previousCandToken_(consumes<trigger::TriggerFilterObjectWithRefs>(previousCandTag_)),
34  mfName_(iConfig.getParameter<std::string>("SimpleMagneticField")),
36  thirdTrackMass_(iConfig.getParameter<double>("ThirdTrackMass")),
37  maxEta_(iConfig.getParameter<double>("MaxEta")),
38  minPt_(iConfig.getParameter<double>("MinPt")),
39  minInvMass_(iConfig.getParameter<double>("MinInvMass")),
40  maxInvMass_(iConfig.getParameter<double>("MaxInvMass")),
41  minD0Significance_(iConfig.getParameter<double>("MinD0Significance")),
42  overlapDR_(iConfig.getParameter<double>("OverlapDR")),
43  beamSpotTag_(iConfig.getParameter<edm::InputTag>("BeamSpotTag")),
44  beamSpotToken_(consumes<reco::BeamSpot>(beamSpotTag_)) {
45  produces<VertexCollection>();
46 }
const std::string mfName_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > idealMagneticFieldRecordToken_
const edm::InputTag beamSpotTag_
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackRecordToken_
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > trkCandToken_
const edm::InputTag previousCandTag_
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > muCandToken_
const edm::InputTag trkCandTag_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
const edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
const edm::InputTag muCandTag_
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
HLTmumutkVtxProducer::~HLTmumutkVtxProducer ( )
overridedefault

Member Function Documentation

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

Definition at line 232 of file HLTmumutkVtxProducer.cc.

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

Referenced by produce().

233  {
234  bool ok = false;
235  for (auto& i : refVect) {
236  if (i->get<TrackRef>() == trackref) {
237  ok = true;
238  break;
239  }
240  }
241  return ok;
242 }
void HLTmumutkVtxProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 51 of file HLTmumutkVtxProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

51  {
53  desc.add<edm::InputTag>("MuCand", edm::InputTag("hltMuTracks"));
54  desc.add<edm::InputTag>("TrackCand", edm::InputTag("hltMumukAllConeTracks"));
55  desc.add<edm::InputTag>("PreviousCandTag", edm::InputTag("hltDisplacedmumuFilterDoubleMu4Jpsi"));
56  desc.add<std::string>("SimpleMagneticField", "");
57  desc.add<double>("ThirdTrackMass", 0.493677);
58  desc.add<double>("MaxEta", 2.5);
59  desc.add<double>("MinPt", 3.0);
60  desc.add<double>("MinInvMass", 0.0);
61  desc.add<double>("MaxInvMass", 99999.);
62  desc.add<double>("MinD0Significance", 0.0);
63  desc.add<double>("OverlapDR", 1.44e-4);
64  desc.add<edm::InputTag>("BeamSpotTag", edm::InputTag("hltOfflineBeamSpot"));
65  descriptions.add("HLTmumutkVtxProducer", desc);
66 }
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 216 of file HLTmumutkVtxProducer.cc.

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

Referenced by produce().

216  {
217  Basic3DVector<float> pos(tk.vertex());
218  GlobalPoint gpos(pos);
219  Basic3DVector<float> mom(tk.momentum());
220  GlobalVector gmom(mom);
221  GlobalTrajectoryParameters par(gpos, gmom, tk.charge(), field);
223  return FreeTrajectoryState(par, err);
224 }
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:664
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:676
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:716
int charge() const
track electric charge
Definition: TrackBase.h:596
bool HLTmumutkVtxProducer::overlap ( const reco::TrackRef trackref1,
const reco::TrackRef trackref2 
)
private

Definition at line 226 of file HLTmumutkVtxProducer.cc.

References HLT_FULL_cff::deltaR, and overlapDR_.

Referenced by produce().

226  {
227  if (deltaR(trackref1->eta(), trackref1->phi(), trackref2->eta(), trackref2->phi()) < overlapDR_)
228  return true;
229  return false;
230 }
void HLTmumutkVtxProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 69 of file HLTmumutkVtxProducer.cc.

References funct::abs(), beamSpotToken_, checkPreviousCand(), edm::Ref< C, T, F >::get(), edm::Event::getByToken(), edm::EventSetup::getHandle(), idealMagneticFieldRecordToken_, initialFreeState(), TransientVertex::isValid(), LogDebug, magField, maxEta_, maxInvMass_, minD0Significance_, minInvMass_, minPt_, eostools::move(), muCandToken_, overlap(), AlCaHLTBitMon_ParallelJobs::p, fireworks::p1, fireworks::p2, previousCandToken_, edm::Event::put(), Measurement1D::significance(), mathSSE::sqrt(), thirdTrackMass_, transientTrackRecordToken_, TrajectoryStateClosestToBeamLine::transverseImpactParameter(), trigger::TriggerMuon, trkCandToken_, KalmanVertexFitter::vertex(), and GoodVertex_cfg::vertexCollection.

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

Member Data Documentation

const edm::InputTag HLTmumutkVtxProducer::beamSpotTag_
private

Definition at line 79 of file HLTmumutkVtxProducer.h.

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

Definition at line 80 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> HLTmumutkVtxProducer::idealMagneticFieldRecordToken_
private

Definition at line 69 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const double HLTmumutkVtxProducer::maxEta_
private

Definition at line 72 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const double HLTmumutkVtxProducer::maxInvMass_
private

Definition at line 75 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const std::string HLTmumutkVtxProducer::mfName_
private

Definition at line 68 of file HLTmumutkVtxProducer.h.

const double HLTmumutkVtxProducer::minD0Significance_
private

Definition at line 76 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const double HLTmumutkVtxProducer::minInvMass_
private

Definition at line 74 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const double HLTmumutkVtxProducer::minPt_
private

Definition at line 73 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTmumutkVtxProducer::muCandTag_
private

Definition at line 61 of file HLTmumutkVtxProducer.h.

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

Definition at line 62 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const double HLTmumutkVtxProducer::overlapDR_
private

Definition at line 77 of file HLTmumutkVtxProducer.h.

Referenced by overlap().

const edm::InputTag HLTmumutkVtxProducer::previousCandTag_
private

Definition at line 65 of file HLTmumutkVtxProducer.h.

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

Definition at line 66 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const double HLTmumutkVtxProducer::thirdTrackMass_
private

Definition at line 71 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> HLTmumutkVtxProducer::transientTrackRecordToken_
private

Definition at line 59 of file HLTmumutkVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTmumutkVtxProducer::trkCandTag_
private

Definition at line 63 of file HLTmumutkVtxProducer.h.

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

Definition at line 64 of file HLTmumutkVtxProducer.h.

Referenced by produce().