CMS 3D CMS Logo

HLTDisplacedmumumuVtxProducer.cc
Go to the documentation of this file.
1 #include <iostream>
2 
6 
14 
19 
25 
27 
28 using namespace edm;
29 using namespace reco;
30 using namespace std;
31 using namespace trigger;
32 //
33 // constructors and destructor
34 //
36  : srcTag_(iConfig.getParameter<edm::InputTag>("Src")),
37  srcToken_(consumes<reco::RecoChargedCandidateCollection>(srcTag_)),
38  previousCandTag_(iConfig.getParameter<edm::InputTag>("PreviousCandTag")),
39  previousCandToken_(consumes<trigger::TriggerFilterObjectWithRefs>(previousCandTag_)),
40  maxEta_(iConfig.getParameter<double>("MaxEta")),
41  minPt_(iConfig.getParameter<double>("MinPt")),
42  minPtTriplet_(iConfig.getParameter<double>("MinPtTriplet")),
43  minInvMass_(iConfig.getParameter<double>("MinInvMass")),
44  maxInvMass_(iConfig.getParameter<double>("MaxInvMass")),
45  chargeOpt_(iConfig.getParameter<int>("ChargeOpt")) {
46  produces<VertexCollection>();
47 }
48 
50 
53  desc.add<edm::InputTag>("Src", edm::InputTag("hltL3MuonCandidates"));
54  desc.add<edm::InputTag>("PreviousCandTag", edm::InputTag(""));
55  desc.add<double>("MaxEta", 2.5);
56  desc.add<double>("MinPt", 0.0);
57  desc.add<double>("MinPtTriplet", 0.0);
58  desc.add<double>("MinInvMass", 1.0);
59  desc.add<double>("MaxInvMass", 20.0);
60  desc.add<int>("ChargeOpt", -1);
61  descriptions.add("hltDisplacedmumumuVtxProducer", desc);
62 }
63 
64 // ------------ method called on each new Event ------------
66  double const MuMass = 0.106;
67  double const MuMass2 = MuMass * MuMass;
68 
69  // get hold of muon trks
71  iEvent.getByToken(srcToken_, mucands);
72 
73  //get the transient track builder:
75  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", theB);
76 
77  std::unique_ptr<VertexCollection> vertexCollection(new VertexCollection());
78 
79  // look at all mucands, check cuts and make vertices
80  double e1, e2, e3;
82 
83  RecoChargedCandidateCollection::const_iterator cand1;
84  RecoChargedCandidateCollection::const_iterator cand2;
85  RecoChargedCandidateCollection::const_iterator cand3;
86 
87  // get the objects passing the previous filter
89  iEvent.getByToken(previousCandToken_, previousCands);
90 
91  vector<RecoChargedCandidateRef> vPrevCands;
92  previousCands->getObjects(TriggerMuon, vPrevCands);
93 
94  for (cand1 = mucands->begin(); cand1 != mucands->end(); cand1++) {
95  TrackRef tk1 = cand1->get<TrackRef>();
96  LogDebug("HLTDisplacedMumumuFilter") << " 1st muon in loop: q*pt= " << cand1->charge() * cand1->pt()
97  << ", eta= " << cand1->eta() << ", hits= " << tk1->numberOfValidHits();
98 
99  //first check if this muon passed the previous filter
100  if (!checkPreviousCand(tk1, vPrevCands))
101  continue;
102 
103  // cuts
104  if (fabs(cand1->eta()) > maxEta_)
105  continue;
106  if (cand1->pt() < minPt_)
107  continue;
108 
109  cand2 = cand1;
110  cand2++;
111  for (; cand2 != mucands->end(); cand2++) {
112  TrackRef tk2 = cand2->get<TrackRef>();
113 
114  // eta cut
115  LogDebug("HLTMuonDimuonFilter") << " 2nd muon in loop: q*pt= " << cand2->charge() * cand2->pt()
116  << ", eta= " << cand2->eta() << ", hits= " << tk2->numberOfValidHits()
117  << ", d0= " << tk2->d0();
118  //first check if this muon passed the previous filter
119  if (!checkPreviousCand(tk2, vPrevCands))
120  continue;
121 
122  // cuts
123  if (fabs(cand2->eta()) > maxEta_)
124  continue;
125  if (cand2->pt() < minPt_)
126  continue;
127 
128  cand3 = cand2;
129  cand3++;
130  for (; cand3 != mucands->end(); cand3++) {
131  TrackRef tk3 = cand3->get<TrackRef>();
132 
133  // eta cut
134  LogDebug("HLTMuonDimuonFilter") << " 3rd muon in loop: q*pt= " << cand3->charge() * cand3->pt()
135  << ", eta= " << cand3->eta() << ", hits= " << tk3->numberOfValidHits()
136  << ", d0= " << tk3->d0();
137  //first check if this muon passed the previous filter
138  if (!checkPreviousCand(tk3, vPrevCands))
139  continue;
140 
141  // cuts
142  if (fabs(cand3->eta()) > maxEta_)
143  continue;
144  if (cand3->pt() < minPt_)
145  continue;
146 
147  // opposite sign or same sign
148  if (chargeOpt_ > 0) {
149  if (fabs(cand1->charge() + cand2->charge() + cand3->charge()) != chargeOpt_)
150  continue;
151  }
152 
153  // Combined dimuon system
154  e1 = sqrt(cand1->momentum().Mag2() + MuMass2);
155  e2 = sqrt(cand2->momentum().Mag2() + MuMass2);
156  e3 = sqrt(cand3->momentum().Mag2() + MuMass2);
157  p1 = Particle::LorentzVector(cand1->px(), cand1->py(), cand1->pz(), e1);
158  p2 = Particle::LorentzVector(cand2->px(), cand2->py(), cand2->pz(), e2);
159  p3 = Particle::LorentzVector(cand3->px(), cand3->py(), cand3->pz(), e3);
160  p = p1 + p2 + p3;
161 
162  if (p.pt() < minPtTriplet_)
163  continue;
164 
165  double invmass = abs(p.mass());
166  LogDebug("HLTDisplacedMumumuFilter") << " ... 1-2 invmass= " << invmass;
167 
168  if (invmass < minInvMass_)
169  continue;
170  if (invmass > maxInvMass_)
171  continue;
172 
173  // do the vertex fit
174  vector<TransientTrack> t_tks;
175  TransientTrack ttkp1 = (*theB).build(&tk1);
176  TransientTrack ttkp2 = (*theB).build(&tk2);
177  TransientTrack ttkp3 = (*theB).build(&tk3);
178  t_tks.push_back(ttkp1);
179  t_tks.push_back(ttkp2);
180  t_tks.push_back(ttkp3);
181 
182  if (t_tks.size() != 3)
183  continue;
184 
185  KalmanVertexFitter kvf;
186  TransientVertex tv = kvf.vertex(t_tks);
187 
188  if (!tv.isValid())
189  continue;
190 
191  Vertex vertex = tv;
192 
193  // put vertex in the event
194  vertexCollection->push_back(vertex);
195  }
196  }
197  }
199 }
200 
202  const vector<RecoChargedCandidateRef>& refVect) const {
203  bool ok = false;
204  for (auto& i : refVect) {
205  if (i->get<TrackRef>() == trackref) {
206  ok = true;
207  break;
208  }
209  }
210  return ok;
211 }
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
trigger::TriggerFilterObjectWithRefs
Definition: TriggerFilterObjectWithRefs.h:35
KalmanVertexFitter::vertex
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
Definition: KalmanVertexFitter.h:49
HLTDisplacedmumumuVtxProducer::maxInvMass_
const double maxInvMass_
Definition: HLTDisplacedmumumuVtxProducer.h:48
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
KalmanVertexFitter.h
ESHandle.h
TransientVertex::isValid
bool isValid() const
Definition: TransientVertex.h:195
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
TriggerFilterObjectWithRefs.h
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
edm::Handle
Definition: AssociativeIterator.h:50
RecoCandidate.h
trigger::TriggerRefsCollections::getObjects
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
Definition: TriggerRefsCollections.h:452
HLTDisplacedmumumuVtxProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: HLTDisplacedmumumuVtxProducer.cc:65
reco::RecoChargedCandidateCollection
std::vector< RecoChargedCandidate > RecoChargedCandidateCollection
collectin of RecoChargedCandidate objects
Definition: RecoChargedCandidateFwd.h:9
HLTDisplacedmumumuVtxProducer::maxEta_
const double maxEta_
Definition: HLTDisplacedmumumuVtxProducer.h:44
edm::Ref< TrackCollection >
CandidateFwd.h
HLTDisplacedmumumuVtxProducer::srcToken_
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > srcToken_
Definition: HLTDisplacedmumumuVtxProducer.h:41
Track.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
TrackFwd.h
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
TransientTrackRecord
Definition: TransientTrackRecord.h:11
trigger::TriggerMuon
Definition: TriggerTypeDefs.h:68
edm::ESHandle< TransientTrackBuilder >
p2
double p2[4]
Definition: TauolaWrapper.h:90
HLTDisplacedmumumuVtxProducer::chargeOpt_
const int chargeOpt_
Definition: HLTDisplacedmumumuVtxProducer.h:49
RefToBase.h
HLTDisplacedmumumuVtxProducer.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
Vertex.h
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
TransientTrackBuilder.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
p1
double p1[4]
Definition: TauolaWrapper.h:89
TransientVertex
Definition: TransientVertex.h:18
edm::EventSetup
Definition: EventSetup.h:57
TransientTrackRecord.h
get
#define get
HLTDisplacedmumumuVtxProducer::minPtTriplet_
const double minPtTriplet_
Definition: HLTDisplacedmumumuVtxProducer.h:46
SiPixelPhase1Clusters_cfi.e3
e3
Definition: SiPixelPhase1Clusters_cfi.py:9
reco::JetExtendedAssociation::LorentzVector
math::PtEtaPhiELorentzVectorF LorentzVector
Definition: JetExtendedAssociation.h:25
VertexFwd.h
TransientVertex.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
HLTDisplacedmumumuVtxProducer::minPt_
const double minPt_
Definition: HLTDisplacedmumumuVtxProducer.h:45
reco::TransientTrack
Definition: TransientTrack.h:19
RecoChargedCandidate.h
spclusmultinvestigator_cfi.vertexCollection
vertexCollection
Definition: spclusmultinvestigator_cfi.py:4
HLTDisplacedmumumuVtxProducer::~HLTDisplacedmumumuVtxProducer
~HLTDisplacedmumumuVtxProducer() override
HLTDisplacedmumumuVtxProducer::minInvMass_
const double minInvMass_
Definition: HLTDisplacedmumumuVtxProducer.h:47
TriggerRefsCollections.h
p3
double p3[4]
Definition: TauolaWrapper.h:91
trigger
Definition: HLTPrescaleTableCond.h:8
Candidate.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HLTDisplacedmumumuVtxProducer::checkPreviousCand
bool checkPreviousCand(const reco::TrackRef &trackref, const std::vector< reco::RecoChargedCandidateRef > &ref2) const
Definition: HLTDisplacedmumumuVtxProducer.cc:201
edm::Event
Definition: Event.h:73
HLTDisplacedmumumuVtxProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTDisplacedmumumuVtxProducer.cc:51
RecoChargedCandidateFwd.h
edm::InputTag
Definition: InputTag.h:15
reco::Vertex
Definition: Vertex.h:35
HLTDisplacedmumumuVtxProducer::previousCandToken_
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
Definition: HLTDisplacedmumumuVtxProducer.h:43
HLTDisplacedmumumuVtxProducer::HLTDisplacedmumumuVtxProducer
HLTDisplacedmumumuVtxProducer(const edm::ParameterSet &)
Definition: HLTDisplacedmumumuVtxProducer.cc:35
KalmanVertexFitter
Definition: KalmanVertexFitter.h:22