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 | Private Attributes
HLTDisplacedtktktkVtxProducer Class Reference

#include <HLTDisplacedtktktkVtxProducer.h>

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

Public Member Functions

 HLTDisplacedtktktkVtxProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HLTDisplacedtktktkVtxProducer () 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
 

Private Attributes

const int chargeOpt_
 
double firstTrackMass
 
double firstTrackMass2
 
double firstTrackPt
 
const double massParticle1_
 
const double massParticle2_
 
const double massParticle3_
 
const double maxEta_
 
const double maxInvMass_
 
const double maxInvMassRes_
 
const double minInvMass_
 
const double minInvMassRes_
 
const double minPtRes_
 
const double minPtTk1_
 
const double minPtTk2_
 
const double minPtTk3_
 
const double minPtTri_
 
const edm::InputTag previousCandTag_
 
const edm::EDGetTokenT
< trigger::TriggerFilterObjectWithRefs
previousCandToken_
 
const int resOpt_
 
double secondTrackMass
 
double secondTrackMass2
 
double secondTrackPt
 
const edm::InputTag srcTag_
 
const edm::EDGetTokenT
< reco::RecoChargedCandidateCollection
srcToken_
 
double thirdTrackMass
 
double thirdTrackMass2
 
double thirdTrackPt
 
const edm::ESGetToken
< TransientTrackBuilder,
TransientTrackRecord
transientTrackRecordToken_
 
const int triggerTypeDaughters_
 

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

Definition at line 35 of file HLTDisplacedtktktkVtxProducer.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file HLTDisplacedtktktkVtxProducer.cc.

References firstTrackMass, firstTrackMass2, firstTrackPt, massParticle1_, massParticle2_, massParticle3_, minPtTk1_, minPtTk2_, minPtTk3_, resOpt_, secondTrackMass, secondTrackMass2, secondTrackPt, std::swap(), thirdTrackMass, thirdTrackMass2, and thirdTrackPt.

30  : transientTrackRecordToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))),
31  srcTag_(iConfig.getParameter<edm::InputTag>("Src")),
32  srcToken_(consumes<reco::RecoChargedCandidateCollection>(srcTag_)),
33  previousCandTag_(iConfig.getParameter<edm::InputTag>("PreviousCandTag")),
34  previousCandToken_(consumes<trigger::TriggerFilterObjectWithRefs>(previousCandTag_)),
35  maxEta_(iConfig.getParameter<double>("MaxEtaTk")),
36  minPtTk1_(iConfig.getParameter<double>("MinPtResTk1")),
37  minPtTk2_(iConfig.getParameter<double>("MinPtResTk2")),
38  minPtTk3_(iConfig.getParameter<double>("MinPtThirdTk")),
39  minPtRes_(iConfig.getParameter<double>("MinPtRes")),
40  minPtTri_(iConfig.getParameter<double>("MinPtTri")),
41  minInvMassRes_(iConfig.getParameter<double>("MinInvMassRes")),
42  maxInvMassRes_(iConfig.getParameter<double>("MaxInvMassRes")),
43  minInvMass_(iConfig.getParameter<double>("MinInvMass")),
44  maxInvMass_(iConfig.getParameter<double>("MaxInvMass")),
45  massParticle1_(iConfig.getParameter<double>("massParticleRes1")),
46  massParticle2_(iConfig.getParameter<double>("massParticleRes2")),
47  massParticle3_(iConfig.getParameter<double>("massParticle3")),
48  chargeOpt_(iConfig.getParameter<int>("ChargeOpt")),
49  resOpt_(iConfig.getParameter<int>("ResOpt")),
50  triggerTypeDaughters_(iConfig.getParameter<int>("triggerTypeDaughters")) {
51  produces<VertexCollection>();
52 
59  if (resOpt_ <= 0 && massParticle1_ != massParticle2_) {
63  }
65  std::swap(firstTrackMass, thirdTrackMass);
67  }
68  }
69  firstTrackMass2 = firstTrackMass * firstTrackMass;
72 }
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > srcToken_
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackRecordToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
HLTDisplacedtktktkVtxProducer::~HLTDisplacedtktktkVtxProducer ( )
overridedefault

Member Function Documentation

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

Definition at line 268 of file HLTDisplacedtktktkVtxProducer.cc.

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

Referenced by produce().

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

Definition at line 76 of file HLTDisplacedtktktkVtxProducer.cc.

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

76  {
78  desc.add<edm::InputTag>("Src", edm::InputTag("hltL3MuonCandidates"));
79  desc.add<edm::InputTag>("PreviousCandTag", edm::InputTag(""));
80  desc.add<double>("MaxEtaTk", 2.5);
81  desc.add<double>("MinPtResTk1", 0.0);
82  desc.add<double>("MinPtResTk2", 0.0);
83  desc.add<double>("MinPtThirdTk", 0.0);
84  desc.add<double>("MinPtRes", 0.0);
85  desc.add<double>("MinPtTri", 0.0);
86  desc.add<double>("MinInvMassRes", 1.0);
87  desc.add<double>("MaxInvMassRes", 20.0);
88  desc.add<double>("MinInvMass", 1.0);
89  desc.add<double>("MaxInvMass", 20.0);
90  desc.add<double>("massParticleRes1", 0.4937);
91  desc.add<double>("massParticleRes2", 0.4937);
92  desc.add<double>("massParticle3", 0.1396);
93  desc.add<int>("ChargeOpt", -1);
94  desc.add<int>("ResOpt", 1);
95  desc.add<int>("triggerTypeDaughters", 0);
96 
97  descriptions.add("hltDisplacedtktktkVtxProducer", desc);
98 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HLTDisplacedtktktkVtxProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 101 of file HLTDisplacedtktktkVtxProducer.cc.

References funct::abs(), chargeOpt_, checkPreviousCand(), firstTrackMass, firstTrackMass2, firstTrackPt, edm::Ref< C, T, F >::get(), edm::Event::getByToken(), edm::EventSetup::getHandle(), TransientVertex::isValid(), LogDebug, maxEta_, maxInvMass_, maxInvMassRes_, minInvMass_, minInvMassRes_, minPtRes_, minPtTri_, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, previousCandToken_, edm::Event::put(), resOpt_, secondTrackMass, secondTrackMass2, secondTrackPt, mathSSE::sqrt(), srcToken_, thirdTrackMass, thirdTrackMass2, thirdTrackPt, transientTrackRecordToken_, triggerTypeDaughters_, KalmanVertexFitter::vertex(), and GoodVertex_cfg::vertexCollection.

101  {
102  // get hold of track trks
104  iEvent.getByToken(srcToken_, trackcands);
105  if (trackcands->size() < 3)
106  return;
107 
108  // get the transient track builder
109  auto const& theB = iSetup.getHandle(transientTrackRecordToken_);
110 
111  std::unique_ptr<VertexCollection> vertexCollection(new VertexCollection());
112 
113  // look at all trackcands, check cuts and make vertices
114  double e1, e2, e3;
116 
117  RecoChargedCandidateCollection::const_iterator cand1;
118  RecoChargedCandidateCollection::const_iterator cand2;
119  RecoChargedCandidateCollection::const_iterator cand3;
120 
121  // get the objects passing the previous filter
123  iEvent.getByToken(previousCandToken_, previousCands);
124 
125  vector<RecoChargedCandidateRef> vPrevCands;
126  previousCands->getObjects(triggerTypeDaughters_, vPrevCands);
127 
128  std::vector<bool> candComp;
129  for (cand1 = trackcands->begin(); cand1 != trackcands->end(); cand1++)
130  candComp.push_back(checkPreviousCand(cand1->get<TrackRef>(), vPrevCands));
131 
132  for (cand1 = trackcands->begin(); cand1 != trackcands->end(); cand1++) {
133  TrackRef tk1 = cand1->get<TrackRef>();
134  LogDebug("HLTDisplacedtktktkVtxProducer") << " 1st track in loop: q*pt= " << cand1->charge() * cand1->pt()
135  << ", eta= " << cand1->eta() << ", hits= " << tk1->numberOfValidHits();
136 
137  //first check if this track passed the previous filter
138  if (!candComp[cand1 - trackcands->begin()])
139  continue;
140  // if( ! checkPreviousCand( tk1, vPrevCands) ) continue;
141 
142  // cuts
143  if (std::abs(cand1->eta()) > maxEta_)
144  continue;
145  if (cand1->pt() < firstTrackPt)
146  continue;
147 
148  cand2 = trackcands->begin();
150  cand2 = cand1 + 1;
151  }
152 
153  for (; cand2 != trackcands->end(); cand2++) {
154  TrackRef tk2 = cand2->get<TrackRef>();
155  if (tk1 == tk2)
156  continue;
157  LogDebug("HLTDisplacedtktktkVtxProducer")
158  << " 2nd track in loop: q*pt= " << cand2->charge() * cand2->pt() << ", eta= " << cand2->eta()
159  << ", hits= " << tk2->numberOfValidHits() << ", d0= " << tk2->d0();
160 
161  //first check if this track passed the previous filter
162  if (!candComp[cand2 - trackcands->begin()])
163  continue;
164  // if( ! checkPreviousCand( tk2, vPrevCands) ) continue;
165 
166  // cuts
167  if (std::abs(cand2->eta()) > maxEta_)
168  continue;
169  if (cand2->pt() < secondTrackPt)
170  continue;
171 
172  // opposite sign or same sign for resonance
173  if (resOpt_ > 0) {
174  if (chargeOpt_ < 0) {
175  if (cand1->charge() * cand2->charge() > 0)
176  continue;
177  } else if (chargeOpt_ > 0) {
178  if (cand1->charge() * cand2->charge() < 0)
179  continue;
180  }
181  }
182 
183  //
184  // Combined ditrack system
185  e1 = sqrt(cand1->momentum().Mag2() + firstTrackMass2);
186  e2 = sqrt(cand2->momentum().Mag2() + secondTrackMass2);
187  pres = Particle::LorentzVector(cand1->px(), cand1->py(), cand1->pz(), e1) +
188  Particle::LorentzVector(cand2->px(), cand2->py(), cand2->pz(), e2);
189 
190  if (resOpt_ > 0) {
191  if (pres.pt() < minPtRes_)
192  continue;
193  double invmassRes = std::abs(pres.mass());
194  LogDebug("HLTDisplacedtktktkVtxProducer") << " ... 1-2 invmass= " << invmassRes;
195  if (invmassRes < minInvMassRes_)
196  continue;
197  if (invmassRes > maxInvMassRes_)
198  continue;
199  }
200 
201  cand3 = trackcands->begin();
203  cand3 = cand2 + 1;
204  }
205 
206  for (; cand3 != trackcands->end(); cand3++) {
207  TrackRef tk3 = cand3->get<TrackRef>();
208  if (tk1 == tk3 || tk2 == tk3)
209  continue;
210  LogDebug("HLTDisplacedtktktkVtxProducer")
211  << " 3rd track in loop: q*pt= " << cand3->charge() * cand3->pt() << ", eta= " << cand3->eta()
212  << ", hits= " << tk3->numberOfValidHits();
213 
214  //first check if this track passed the previous filter
215  if (!candComp[cand3 - trackcands->begin()])
216  continue;
217  // if( ! checkPreviousCand( tk3, vPrevCands) ) continue;
218 
219  // cuts
220  if (std::abs(cand3->eta()) > maxEta_)
221  continue;
222  if (cand3->pt() < thirdTrackPt)
223  continue;
224 
225  e3 = sqrt(cand3->momentum().Mag2() + thirdTrackMass2);
226  p = Particle::LorentzVector(cand1->px(), cand1->py(), cand1->pz(), e1) +
227  Particle::LorentzVector(cand2->px(), cand2->py(), cand2->pz(), e2) +
228  Particle::LorentzVector(cand3->px(), cand3->py(), cand3->pz(), e3);
229 
230  if (p.pt() < minPtTri_)
231  continue;
232  double invmass = std::abs(p.mass());
233  LogDebug("HLTDisplacedtktktkVtxProducer") << " ... 1-2-3 invmass= " << invmass;
234  if (invmass < minInvMass_)
235  continue;
236  if (invmass > maxInvMass_)
237  continue;
238 
239  // do the vertex fit
240  vector<TransientTrack> t_tks;
241  TransientTrack ttkp1 = (*theB).build(&tk1);
242  TransientTrack ttkp2 = (*theB).build(&tk2);
243  TransientTrack ttkp3 = (*theB).build(&tk3);
244 
245  t_tks.push_back(ttkp1);
246  t_tks.push_back(ttkp2);
247  t_tks.push_back(ttkp3);
248 
249  if (t_tks.size() != 3)
250  continue;
251 
252  KalmanVertexFitter kvf;
253  TransientVertex tv = kvf.vertex(t_tks);
254 
255  if (!tv.isValid())
256  continue;
257 
258  Vertex vertex = tv;
259 
260  // put vertex in the event
261  vertexCollection->push_back(vertex);
262  }
263  }
264  }
265  iEvent.put(std::move(vertexCollection));
266 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
std::vector< Vertex > VertexCollection
Definition: Vertex.h:12
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > srcToken_
tuple vertexCollection
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
T sqrt(T t)
Definition: SSEVec.h:19
def move
Definition: eostools.py:511
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackRecordToken_
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
bool checkPreviousCand(const reco::TrackRef &trackref, const std::vector< reco::RecoChargedCandidateRef > &ref2) const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
bool isValid() const
math::PtEtaPhiELorentzVectorF LorentzVector
#define LogDebug(id)

Member Data Documentation

const int HLTDisplacedtktktkVtxProducer::chargeOpt_
private

Definition at line 63 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by produce().

double HLTDisplacedtktktkVtxProducer::firstTrackMass
private

Definition at line 67 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer(), and produce().

double HLTDisplacedtktktkVtxProducer::firstTrackMass2
private

Definition at line 73 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer(), and produce().

double HLTDisplacedtktktkVtxProducer::firstTrackPt
private

Definition at line 70 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer(), and produce().

const double HLTDisplacedtktktkVtxProducer::massParticle1_
private

Definition at line 60 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer().

const double HLTDisplacedtktktkVtxProducer::massParticle2_
private

Definition at line 61 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer().

const double HLTDisplacedtktktkVtxProducer::massParticle3_
private

Definition at line 62 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer().

const double HLTDisplacedtktktkVtxProducer::maxEta_
private

Definition at line 50 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by produce().

const double HLTDisplacedtktktkVtxProducer::maxInvMass_
private

Definition at line 59 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by produce().

const double HLTDisplacedtktktkVtxProducer::maxInvMassRes_
private

Definition at line 57 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by produce().

const double HLTDisplacedtktktkVtxProducer::minInvMass_
private

Definition at line 58 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by produce().

const double HLTDisplacedtktktkVtxProducer::minInvMassRes_
private

Definition at line 56 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by produce().

const double HLTDisplacedtktktkVtxProducer::minPtRes_
private

Definition at line 54 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by produce().

const double HLTDisplacedtktktkVtxProducer::minPtTk1_
private

Definition at line 51 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer().

const double HLTDisplacedtktktkVtxProducer::minPtTk2_
private

Definition at line 52 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer().

const double HLTDisplacedtktktkVtxProducer::minPtTk3_
private

Definition at line 53 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer().

const double HLTDisplacedtktktkVtxProducer::minPtTri_
private

Definition at line 55 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTDisplacedtktktkVtxProducer::previousCandTag_
private

Definition at line 48 of file HLTDisplacedtktktkVtxProducer.h.

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

Definition at line 49 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by produce().

const int HLTDisplacedtktktkVtxProducer::resOpt_
private

Definition at line 64 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer(), and produce().

double HLTDisplacedtktktkVtxProducer::secondTrackMass
private

Definition at line 68 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer(), and produce().

double HLTDisplacedtktktkVtxProducer::secondTrackMass2
private

Definition at line 74 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer(), and produce().

double HLTDisplacedtktktkVtxProducer::secondTrackPt
private

Definition at line 71 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer(), and produce().

const edm::InputTag HLTDisplacedtktktkVtxProducer::srcTag_
private

Definition at line 46 of file HLTDisplacedtktktkVtxProducer.h.

const edm::EDGetTokenT<reco::RecoChargedCandidateCollection> HLTDisplacedtktktkVtxProducer::srcToken_
private

Definition at line 47 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by produce().

double HLTDisplacedtktktkVtxProducer::thirdTrackMass
private

Definition at line 69 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer(), and produce().

double HLTDisplacedtktktkVtxProducer::thirdTrackMass2
private

Definition at line 75 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer(), and produce().

double HLTDisplacedtktktkVtxProducer::thirdTrackPt
private

Definition at line 72 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by HLTDisplacedtktktkVtxProducer(), and produce().

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

Definition at line 45 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by produce().

const int HLTDisplacedtktktkVtxProducer::triggerTypeDaughters_
private

Definition at line 65 of file HLTDisplacedtktktkVtxProducer.h.

Referenced by produce().