CMS 3D CMS Logo

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

#include <HLTmumutktkVtxProducer.h>

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

Public Member Functions

 HLTmumutktkVtxProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HLTmumutktkVtxProducer () 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 fourthTrackMass_
 
const double maxEta_
 
const double maxInvMass_
 
const double maxTrkTrkMass_
 
const std::string mfName_
 
const double minD0Significance_
 
const double minInvMass_
 
const double minPt_
 
const double minTrkTrkMass_
 
const edm::InputTag muCandTag_
 
const edm::EDGetTokenT< reco::RecoChargedCandidateCollectionmuCandToken_
 
const bool oppositeSign_
 
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

Definition at line 39 of file HLTmumutktkVtxProducer.h.

Constructor & Destructor Documentation

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

Definition at line 32 of file HLTmumutktkVtxProducer.cc.

References ~HLTmumutktkVtxProducer().

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

Referenced by HLTmumutktkVtxProducer().

Member Function Documentation

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

Definition at line 291 of file HLTmumutktkVtxProducer.cc.

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

Referenced by produce().

292  {
293  bool ok = false;
294  for (auto& i : refVect) {
295  if (i->get<TrackRef>() == trackref) {
296  ok = true;
297  break;
298  }
299  }
300  return ok;
301 }
void HLTmumutktkVtxProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 59 of file HLTmumutktkVtxProducer.cc.

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

59  {
61  desc.add<edm::InputTag>("MuCand", edm::InputTag("hltMuTracks"));
62  desc.add<edm::InputTag>("TrackCand", edm::InputTag("hltMumukAllConeTracks"));
63  desc.add<edm::InputTag>("PreviousCandTag", edm::InputTag("hltDisplacedmumuFilterDoubleMu4Jpsi"));
64  desc.add<std::string>("SimpleMagneticField", "");
65  desc.add<double>("ThirdTrackMass", 0.493677);
66  desc.add<double>("FourthTrackMass", 0.493677);
67  desc.add<double>("MaxEta", 2.5);
68  desc.add<double>("MinPt", 0.0);
69  desc.add<double>("MinInvMass", 0.0);
70  desc.add<double>("MaxInvMass", 99999.);
71  desc.add<double>("MinTrkTrkMass", 0.0);
72  desc.add<double>("MaxTrkTrkMass", 99999.);
73  desc.add<double>("MinD0Significance", 0.0);
74  desc.add<bool>("OppositeSign", false);
75  desc.add<double>("OverlapDR", 0.001);
76  desc.add<edm::InputTag>("BeamSpotTag", edm::InputTag("hltOfflineBeamSpot"));
77  descriptions.add("HLTmumutktkVtxProducer", desc);
78 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
FreeTrajectoryState HLTmumutktkVtxProducer::initialFreeState ( const reco::Track tk,
const MagneticField field 
)
staticprivate

Definition at line 275 of file HLTmumutktkVtxProducer.cc.

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

Referenced by produce().

275  {
277  GlobalPoint gpos(pos);
278  Basic3DVector<float> mom(tk.momentum());
279  GlobalVector gmom(mom);
280  GlobalTrajectoryParameters par(gpos, gmom, tk.charge(), field);
282  return FreeTrajectoryState(par, err);
283 }
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 HLTmumutktkVtxProducer::overlap ( const reco::TrackRef trackref1,
const reco::TrackRef trackref2 
)
private

Definition at line 285 of file HLTmumutktkVtxProducer.cc.

References PbPb_ZMuSkimMuonDPG_cff::deltaR, and overlapDR_.

Referenced by produce().

285  {
286  if (deltaR(trackref1->eta(), trackref1->phi(), trackref2->eta(), trackref2->phi()) < overlapDR_)
287  return true;
288  return false;
289 }
void HLTmumutktkVtxProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 81 of file HLTmumutktkVtxProducer.cc.

References beamSpotToken_, checkPreviousCand(), StorageManager_cfg::e1, fourthTrackMass_, edm::EventSetup::get(), edm::Ref< C, T, F >::get(), edm::Event::getByToken(), trigger::TriggerRefsCollections::getObjects(), initialFreeState(), TransientVertex::isValid(), LogDebug, maxEta_, maxInvMass_, maxTrkTrkMass_, mfName_, minD0Significance_, minInvMass_, minPt_, minTrkTrkMass_, eostools::move(), muCandToken_, oppositeSign_, overlap(), AlCaHLTBitMon_ParallelJobs::p, p1, p2, 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.

81  {
82  const double MuMass(0.106);
83  const double MuMass2(MuMass * MuMass);
84  const double thirdTrackMass2(thirdTrackMass_ * thirdTrackMass_);
85  const double fourthTrackMass2(fourthTrackMass_ * fourthTrackMass_);
86 
87  // get hold of muon trks
89  iEvent.getByToken(muCandToken_, mucands);
90 
91  //get the transient track builder:
93  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", theB);
94 
95  //get the beamspot position
96  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
97  iEvent.getByToken(beamSpotToken_, recoBeamSpotHandle);
98 
99  //get the b field
100  ESHandle<MagneticField> bFieldHandle;
101  iSetup.get<IdealMagneticFieldRecord>().get(mfName_, bFieldHandle);
102  const MagneticField* magField = bFieldHandle.product();
103  TSCBLBuilderNoMaterial blsBuilder;
104 
105  // get track candidates around displaced muons
107  iEvent.getByToken(trkCandToken_, trkcands);
108 
109  unique_ptr<VertexCollection> vertexCollection(new VertexCollection());
110 
111  // Ref to Candidate object to be recorded in filter object
114  RecoChargedCandidateRef refTrk1;
115  RecoChargedCandidateRef refTrk2;
116 
117  double e1, e2, e3_m3, e3_m4, e4_m3, e4_m4;
118  Particle::LorentzVector p, pBar, p1, p2, p3_m3, p3_m4, p4_m3, p4_m4, p_m3m4, p_m4m3;
119 
120  if (mucands->size() < 2)
121  return;
122  if (trkcands->size() < 2)
123  return;
124 
125  RecoChargedCandidateCollection::const_iterator mucand1;
126  RecoChargedCandidateCollection::const_iterator mucand2;
127  RecoChargedCandidateCollection::const_iterator trkcand1;
128  RecoChargedCandidateCollection::const_iterator trkcand2;
129 
130  // get the objects passing the previous filter
132  iEvent.getByToken(previousCandToken_, previousCands);
133 
134  vector<RecoChargedCandidateRef> vPrevCands;
135  previousCands->getObjects(TriggerMuon, vPrevCands);
136 
137  for (mucand1 = mucands->begin(); mucand1 != mucands->end(); ++mucand1) {
138  TrackRef trk1 = mucand1->get<TrackRef>();
139  LogDebug("HLTmumutktkVtxProducer") << " 1st muon: q*pt= " << trk1->charge() * trk1->pt() << ", eta= " << trk1->eta()
140  << ", hits= " << trk1->numberOfValidHits();
141 
142  //first check if this muon passed the previous filter
143  if (!checkPreviousCand(trk1, vPrevCands))
144  continue;
145  // eta and pt cut
146  if (fabs(trk1->eta()) > maxEta_)
147  continue;
148  if (trk1->pt() < minPt_)
149  continue;
150 
151  mucand2 = mucand1;
152  ++mucand2;
153  for (; mucand2 != mucands->end(); mucand2++) {
154  TrackRef trk2 = mucand2->get<TrackRef>();
155  if (overlap(trk1, trk2))
156  continue;
157 
158  LogDebug("HLTDisplacedMumukFilter") << " 2nd muon: q*pt= " << trk2->charge() * trk2->pt()
159  << ", eta= " << trk2->eta() << ", hits= " << trk2->numberOfValidHits();
160 
161  //first check if this muon passed the previous filter
162  if (!checkPreviousCand(trk2, vPrevCands))
163  continue;
164  // eta and pt cut
165  if (fabs(trk2->eta()) > maxEta_)
166  continue;
167  if (trk2->pt() < minPt_)
168  continue;
169 
170  //loop on track collection - trk1
171  for (trkcand1 = trkcands->begin(); trkcand1 != trkcands->end(); ++trkcand1) {
172  TrackRef trk3 = trkcand1->get<TrackRef>();
173 
174  if (overlap(trk1, trk3))
175  continue;
176  if (overlap(trk2, trk3))
177  continue;
178 
179  LogDebug("HLTDisplacedMumukFilter") << " 3rd track: q*pt= " << trk3->charge() * trk3->pt()
180  << ", eta= " << trk3->eta() << ", hits= " << trk3->numberOfValidHits();
181 
182  // eta and pt cut
183  if (fabs(trk3->eta()) > maxEta_)
184  continue;
185  if (trk3->pt() < minPt_)
186  continue;
187 
188  FreeTrajectoryState InitialFTS_Trk3 = initialFreeState(*trk3, magField);
189  TrajectoryStateClosestToBeamLine tscb_Trk3(blsBuilder(InitialFTS_Trk3, *recoBeamSpotHandle));
190  double d0sigTrk3 = tscb_Trk3.transverseImpactParameter().significance();
191  if (d0sigTrk3 < minD0Significance_)
192  continue;
193 
194  //loop on track collection - trk2
195  for (trkcand2 = trkcands->begin(); trkcand2 != trkcands->end(); ++trkcand2) {
196  TrackRef trk4 = trkcand2->get<TrackRef>();
197 
198  if (oppositeSign_) {
199  if (trk3->charge() * trk4->charge() != -1)
200  continue;
201  }
202  if (overlap(trk1, trk4))
203  continue;
204  if (overlap(trk2, trk4))
205  continue;
206  if (overlap(trk3, trk4))
207  continue;
208 
209  LogDebug("HLTDisplacedMumukFilter") << " 4th track: q*pt= " << trk4->charge() * trk4->pt()
210  << ", eta= " << trk4->eta() << ", hits= " << trk4->numberOfValidHits();
211 
212  // eta and pt cut
213  if (fabs(trk4->eta()) > maxEta_)
214  continue;
215  if (trk4->pt() < minPt_)
216  continue;
217 
218  FreeTrajectoryState InitialFTS_Trk4 = initialFreeState(*trk4, magField);
219  TrajectoryStateClosestToBeamLine tscb_Trk4(blsBuilder(InitialFTS_Trk4, *recoBeamSpotHandle));
220  double d0sigTrk4 = tscb_Trk4.transverseImpactParameter().significance();
221  if (d0sigTrk4 < minD0Significance_)
222  continue;
223 
224  // Combined system
225  e1 = sqrt(trk1->momentum().Mag2() + MuMass2);
226  e2 = sqrt(trk2->momentum().Mag2() + MuMass2);
227  e3_m3 = sqrt(trk3->momentum().Mag2() + thirdTrackMass2);
228  e3_m4 = sqrt(trk3->momentum().Mag2() + fourthTrackMass2);
229  e4_m3 = sqrt(trk4->momentum().Mag2() + thirdTrackMass2);
230  e4_m4 = sqrt(trk4->momentum().Mag2() + fourthTrackMass2);
231 
232  p1 = Particle::LorentzVector(trk1->px(), trk1->py(), trk1->pz(), e1);
233  p2 = Particle::LorentzVector(trk2->px(), trk2->py(), trk2->pz(), e2);
234  p3_m3 = Particle::LorentzVector(trk3->px(), trk3->py(), trk3->pz(), e3_m3);
235  p3_m4 = Particle::LorentzVector(trk3->px(), trk3->py(), trk3->pz(), e3_m4);
236  p4_m3 = Particle::LorentzVector(trk4->px(), trk4->py(), trk4->pz(), e4_m3);
237  p4_m4 = Particle::LorentzVector(trk4->px(), trk4->py(), trk4->pz(), e4_m4);
238 
239  p = p1 + p2 + p3_m3 + p4_m4;
240  pBar = p1 + p2 + p3_m4 + p4_m3;
241  p_m3m4 = p3_m3 + p4_m4;
242  p_m4m3 = p3_m4 + p4_m3;
243 
244  //invariant mass cut
245  if (!((p_m3m4.mass() > minTrkTrkMass_ && p_m3m4.mass() < maxTrkTrkMass_) ||
246  (p_m4m3.mass() > minTrkTrkMass_ && p_m4m3.mass() < maxTrkTrkMass_)))
247  continue;
248  if (!((p.mass() > minInvMass_ && p.mass() < maxInvMass_) ||
249  (pBar.mass() > minInvMass_ && pBar.mass() < maxInvMass_)))
250  continue;
251 
252  // do the vertex fit
253  vector<TransientTrack> t_tks;
254  t_tks.push_back((*theB).build(&trk1));
255  t_tks.push_back((*theB).build(&trk2));
256  t_tks.push_back((*theB).build(&trk3));
257  t_tks.push_back((*theB).build(&trk4));
258  if (t_tks.size() != 4)
259  continue;
260 
261  KalmanVertexFitter kvf;
262  TransientVertex tv = kvf.vertex(t_tks);
263  if (!tv.isValid())
264  continue;
265  Vertex vertex = tv;
266 
267  vertexCollection->push_back(vertex);
268  }
269  }
270  }
271  }
272  iEvent.put(std::move(vertexCollection));
273 }
#define LogDebug(id)
bool checkPreviousCand(const reco::TrackRef &trackref, const std::vector< reco::RecoChargedCandidateRef > &ref2) const
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
bool overlap(const reco::TrackRef &trackref1, const reco::TrackRef &trackref2)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
static FreeTrajectoryState initialFreeState(const reco::Track &, const MagneticField *)
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > trkCandToken_
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > muCandToken_
T sqrt(T t)
Definition: SSEVec.h:19
const edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
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< trigger::TriggerFilterObjectWithRefs > previousCandToken_
double p1[4]
Definition: TauolaWrapper.h:89
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86
bool isValid() const
def move(src, dest)
Definition: eostools.py:511
math::PtEtaPhiELorentzVectorF LorentzVector

Member Data Documentation

const edm::InputTag HLTmumutktkVtxProducer::beamSpotTag_
private

Definition at line 70 of file HLTmumutktkVtxProducer.h.

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

Definition at line 71 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::fourthTrackMass_
private

Definition at line 60 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::maxEta_
private

Definition at line 61 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::maxInvMass_
private

Definition at line 64 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::maxTrkTrkMass_
private

Definition at line 66 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const std::string HLTmumutktkVtxProducer::mfName_
private

Definition at line 58 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::minD0Significance_
private

Definition at line 67 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::minInvMass_
private

Definition at line 63 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::minPt_
private

Definition at line 62 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::minTrkTrkMass_
private

Definition at line 65 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTmumutktkVtxProducer::muCandTag_
private

Definition at line 51 of file HLTmumutktkVtxProducer.h.

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

Definition at line 52 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const bool HLTmumutktkVtxProducer::oppositeSign_
private

Definition at line 68 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::overlapDR_
private

Definition at line 69 of file HLTmumutktkVtxProducer.h.

Referenced by overlap().

const edm::InputTag HLTmumutktkVtxProducer::previousCandTag_
private

Definition at line 55 of file HLTmumutktkVtxProducer.h.

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

Definition at line 56 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::thirdTrackMass_
private

Definition at line 59 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTmumutktkVtxProducer::trkCandTag_
private

Definition at line 53 of file HLTmumutktkVtxProducer.h.

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

Definition at line 54 of file HLTmumutktkVtxProducer.h.

Referenced by produce().