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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

bool checkPreviousCand (const reco::TrackRef &trackref, std::vector< reco::RecoChargedCandidateRef > &ref2)
 
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().

32  :
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 {
54  produces<VertexCollection>();
55 }
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,
std::vector< reco::RecoChargedCandidateRef > &  ref2 
)
private

Definition at line 271 of file HLTmumutktkVtxProducer.cc.

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

Referenced by produce().

271  {
272  bool ok=false;
273  for (auto & i : refVect) {
274  if ( i->get<TrackRef>() == trackref ) {
275  ok=true;
276  break;
277  }
278  }
279  return ok;
280 }
void HLTmumutktkVtxProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 61 of file HLTmumutktkVtxProducer.cc.

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

61  {
63  desc.add<edm::InputTag>("MuCand",edm::InputTag("hltMuTracks"));
64  desc.add<edm::InputTag>("TrackCand",edm::InputTag("hltMumukAllConeTracks"));
65  desc.add<edm::InputTag>("PreviousCandTag",edm::InputTag("hltDisplacedmumuFilterDoubleMu4Jpsi"));
66  desc.add<std::string>("SimpleMagneticField","");
67  desc.add<double>("ThirdTrackMass",0.493677);
68  desc.add<double>("FourthTrackMass",0.493677);
69  desc.add<double>("MaxEta",2.5);
70  desc.add<double>("MinPt",0.0);
71  desc.add<double>("MinInvMass",0.0);
72  desc.add<double>("MaxInvMass",99999.);
73  desc.add<double>("MinTrkTrkMass",0.0);
74  desc.add<double>("MaxTrkTrkMass",99999.);
75  desc.add<double>("MinD0Significance",0.0);
76  desc.add<bool>("OppositeSign",false);
77  desc.add<double>("OverlapDR",0.001);
78  desc.add<edm::InputTag>("BeamSpotTag",edm::InputTag("hltOfflineBeamSpot"));
79  descriptions.add("HLTmumutktkVtxProducer",desc);
80 }
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 255 of file HLTmumutktkVtxProducer.cc.

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

Referenced by produce().

256 {
258  GlobalPoint gpos( pos);
259  Basic3DVector<float> mom( tk.momentum());
260  GlobalVector gmom( mom);
261  GlobalTrajectoryParameters par( gpos, gmom, tk.charge(), field);
263  return FreeTrajectoryState( par, err);
264 }
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:714
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:738
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:782
int charge() const
track electric charge
Definition: TrackBase.h:606
bool HLTmumutktkVtxProducer::overlap ( const reco::TrackRef trackref1,
const reco::TrackRef trackref2 
)
private

Definition at line 266 of file HLTmumutktkVtxProducer.cc.

References boostedElectronIsolation_cff::deltaR, and overlapDR_.

Referenced by produce().

266  {
267  if (deltaR(trackref1->eta(), trackref1->phi(), trackref2->eta(), trackref2->phi()) < overlapDR_) return true;
268  return false;
269 }
void HLTmumutktkVtxProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 83 of file HLTmumutktkVtxProducer.cc.

References beamSpotToken_, checkPreviousCand(), 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_, KalmanVertexFitter::vertex(), and particleFlowSuperClusterECAL_cfi::vertexCollection.

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

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

Definition at line 72 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::fourthTrackMass_
private

Definition at line 61 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::maxEta_
private

Definition at line 62 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::maxInvMass_
private

Definition at line 65 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::maxTrkTrkMass_
private

Definition at line 67 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const std::string HLTmumutktkVtxProducer::mfName_
private

Definition at line 59 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::minD0Significance_
private

Definition at line 68 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::minInvMass_
private

Definition at line 64 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::minPt_
private

Definition at line 63 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::minTrkTrkMass_
private

Definition at line 66 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTmumutktkVtxProducer::muCandTag_
private

Definition at line 52 of file HLTmumutktkVtxProducer.h.

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

Definition at line 53 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const bool HLTmumutktkVtxProducer::oppositeSign_
private

Definition at line 69 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::overlapDR_
private

Definition at line 70 of file HLTmumutktkVtxProducer.h.

Referenced by overlap().

const edm::InputTag HLTmumutktkVtxProducer::previousCandTag_
private

Definition at line 56 of file HLTmumutktkVtxProducer.h.

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

Definition at line 57 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const double HLTmumutktkVtxProducer::thirdTrackMass_
private

Definition at line 60 of file HLTmumutktkVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTmumutktkVtxProducer::trkCandTag_
private

Definition at line 54 of file HLTmumutktkVtxProducer.h.

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

Definition at line 55 of file HLTmumutktkVtxProducer.h.

Referenced by produce().