CMS 3D CMS Logo

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