CMS 3D CMS Logo

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

#include <HLTDisplacedtktkVtxProducer.h>

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

Public Member Functions

 HLTDisplacedtktkVtxProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HLTDisplacedtktkVtxProducer () 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_
 
const double massParticle1_
 
const double massParticle2_
 
const double maxEta_
 
const double maxInvMass_
 
const double minInvMass_
 
const double minPt_
 
const double minPtPair_
 
const edm::InputTag previousCandTag_
 
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefspreviousCandToken_
 
const edm::InputTag srcTag_
 
const edm::EDGetTokenT< reco::RecoChargedCandidateCollectionsrcToken_
 
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecordtransientTrackRecordToken_
 
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 HLTDisplacedtktkVtxProducer.h.

Constructor & Destructor Documentation

◆ HLTDisplacedtktkVtxProducer()

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

Definition at line 28 of file HLTDisplacedtktkVtxProducer.cc.

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  minPtPair_(iConfig.getParameter<double>("MinPtPair")),
37  minInvMass_(iConfig.getParameter<double>("MinInvMass")),
38  maxInvMass_(iConfig.getParameter<double>("MaxInvMass")),
39  massParticle1_(iConfig.getParameter<double>("massParticle1")),
40  massParticle2_(iConfig.getParameter<double>("massParticle2")),
41  chargeOpt_(iConfig.getParameter<int>("ChargeOpt")),
42  triggerTypeDaughters_(iConfig.getParameter<int>("triggerTypeDaughters")) {
43  produces<VertexCollection>();
44 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackRecordToken_
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > srcToken_

◆ ~HLTDisplacedtktkVtxProducer()

HLTDisplacedtktkVtxProducer::~HLTDisplacedtktkVtxProducer ( )
overridedefault

Member Function Documentation

◆ checkPreviousCand()

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

Definition at line 192 of file HLTDisplacedtktkVtxProducer.cc.

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

Referenced by produce().

193  {
194  bool ok = false;
195  for (auto& i : refVect) {
196  if (i->get<TrackRef>() == trackref) {
197  ok = true;
198  break;
199  }
200  }
201  return ok;
202 }

◆ fillDescriptions()

void HLTDisplacedtktkVtxProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 48 of file HLTDisplacedtktkVtxProducer.cc.

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

48  {
50  desc.add<edm::InputTag>("Src", edm::InputTag("hltL3MuonCandidates"));
51  desc.add<edm::InputTag>("PreviousCandTag", edm::InputTag(""));
52  desc.add<double>("MaxEta", 2.5);
53  desc.add<double>("MinPt", 0.0);
54  desc.add<double>("MinPtPair", 0.0);
55  desc.add<double>("MinInvMass", 1.0);
56  desc.add<double>("MaxInvMass", 20.0);
57  desc.add<double>("massParticle1", 0.1396);
58  desc.add<double>("massParticle2", 0.4937);
59  desc.add<int>("ChargeOpt", -1);
60  desc.add<int>("triggerTypeDaughters", 0);
61 
62  descriptions.add("hltDisplacedtktkVtxProducer", desc);
63 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void HLTDisplacedtktkVtxProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 66 of file HLTDisplacedtktkVtxProducer.cc.

References funct::abs(), chargeOpt_, checkPreviousCand(), StorageManager_cfg::e1, edm::Ref< C, T, F >::get(), edm::EventSetup::getHandle(), trigger::TriggerRefsCollections::getObjects(), iEvent, TransientVertex::isValid(), LogDebug, massParticle1_, massParticle2_, maxEta_, maxInvMass_, minInvMass_, minPt_, minPtPair_, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, previousCandToken_, mathSSE::sqrt(), srcToken_, transientTrackRecordToken_, triggerTypeDaughters_, bphysicsOniaDQM_cfi::vertex, KalmanVertexFitter::vertex(), and spclusmultinvestigator_cfi::vertexCollection.

66  {
67  double const firstTrackMass = massParticle1_;
68  double const firstTrackMass2 = firstTrackMass * firstTrackMass;
69  double const secondTrackMass = massParticle2_;
70  double const secondTrackMass2 = secondTrackMass * secondTrackMass;
71 
72  // get hold of track trks
74  iEvent.getByToken(srcToken_, trackcands);
75 
76  // get the transient track builder
77  auto const& theB = iSetup.getHandle(transientTrackRecordToken_);
78 
79  std::unique_ptr<VertexCollection> vertexCollection(new VertexCollection());
80 
81  // look at all trackcands, check cuts and make vertices
82  double e1, e2;
84 
85  RecoChargedCandidateCollection::const_iterator cand1;
86  RecoChargedCandidateCollection::const_iterator cand2;
87 
88  // get the objects passing the previous filter
90  iEvent.getByToken(previousCandToken_, previousCands);
91 
92  vector<RecoChargedCandidateRef> vPrevCands;
93  previousCands->getObjects(triggerTypeDaughters_, vPrevCands);
94 
95  std::vector<bool> candComp;
96  for (cand1 = trackcands->begin(); cand1 != trackcands->end(); cand1++)
97  candComp.push_back(checkPreviousCand(cand1->get<TrackRef>(), vPrevCands));
98 
99  for (cand1 = trackcands->begin(); cand1 != trackcands->end(); cand1++) {
100  TrackRef tk1 = cand1->get<TrackRef>();
101  LogDebug("HLTDisplacedtktkVtxProducer") << " 1st track in loop: q*pt= " << cand1->charge() * cand1->pt()
102  << ", eta= " << cand1->eta() << ", hits= " << tk1->numberOfValidHits();
103 
104  //first check if this track passed the previous filter
105  if (!candComp[cand1 - trackcands->begin()])
106  continue;
107  // if( ! checkPreviousCand( tk1, vPrevCands) ) continue;
108 
109  // cuts
110  if (abs(cand1->eta()) > maxEta_)
111  continue;
112  if (cand1->pt() < minPt_)
113  continue;
114 
115  cand2 = trackcands->begin();
117  cand2 = cand1 + 1;
118  }
119 
120  for (; cand2 != trackcands->end(); cand2++) {
121  TrackRef tk2 = cand2->get<TrackRef>();
122  if (tk1 == tk2)
123  continue;
124 
125  // eta cut
126  LogDebug("HLTDisplacedtktkVtxProducer")
127  << " 2nd track in loop: q*pt= " << cand2->charge() * cand2->pt() << ", eta= " << cand2->eta()
128  << ", hits= " << tk2->numberOfValidHits() << ", d0= " << tk2->d0();
129  //first check if this track passed the previous filter
130  if (!candComp[cand2 - trackcands->begin()])
131  continue;
132  // if( ! checkPreviousCand( tk2, vPrevCands) ) continue;
133 
134  // cuts
135  if (abs(cand2->eta()) > maxEta_)
136  continue;
137  if (cand2->pt() < minPt_)
138  continue;
139 
140  // opposite sign or same sign
141  if (chargeOpt_ < 0) {
142  if (cand1->charge() * cand2->charge() > 0)
143  continue;
144  } else if (chargeOpt_ > 0) {
145  if (cand1->charge() * cand2->charge() < 0)
146  continue;
147  }
148 
149  // Combined ditrack system
150  e1 = sqrt(cand1->momentum().Mag2() + firstTrackMass2);
151  e2 = sqrt(cand2->momentum().Mag2() + secondTrackMass2);
152  p1 = Particle::LorentzVector(cand1->px(), cand1->py(), cand1->pz(), e1);
153  p2 = Particle::LorentzVector(cand2->px(), cand2->py(), cand2->pz(), e2);
154  p = p1 + p2;
155 
156  if (p.pt() < minPtPair_)
157  continue;
158 
159  double invmass = abs(p.mass());
160  LogDebug("HLTDisplacedtktkVtxProducer") << " ... 1-2 invmass= " << invmass;
161 
162  if (invmass < minInvMass_)
163  continue;
164  if (invmass > maxInvMass_)
165  continue;
166 
167  // do the vertex fit
168  vector<TransientTrack> t_tks;
169  TransientTrack ttkp1 = (*theB).build(&tk1);
170  TransientTrack ttkp2 = (*theB).build(&tk2);
171  t_tks.push_back(ttkp1);
172  t_tks.push_back(ttkp2);
173 
174  if (t_tks.size() != 2)
175  continue;
176 
177  KalmanVertexFitter kvf;
178  TransientVertex tv = kvf.vertex(t_tks);
179 
180  if (!tv.isValid())
181  continue;
182 
183  Vertex vertex = tv;
184 
185  // put vertex in the event
186  vertexCollection->push_back(vertex);
187  }
188  }
190 }
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackRecordToken_
std::vector< Vertex > VertexCollection
Definition: Vertex.h:31
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
int iEvent
Definition: GenABIO.cc:224
bool isValid() const
T sqrt(T t)
Definition: SSEVec.h:19
bool checkPreviousCand(const reco::TrackRef &trackref, const std::vector< reco::RecoChargedCandidateRef > &ref2) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > srcToken_
def move(src, dest)
Definition: eostools.py:511
math::PtEtaPhiELorentzVectorF LorentzVector
#define LogDebug(id)

Member Data Documentation

◆ chargeOpt_

const int HLTDisplacedtktkVtxProducer::chargeOpt_
private

Definition at line 57 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

◆ massParticle1_

const double HLTDisplacedtktkVtxProducer::massParticle1_
private

Definition at line 55 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

◆ massParticle2_

const double HLTDisplacedtktkVtxProducer::massParticle2_
private

Definition at line 56 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

◆ maxEta_

const double HLTDisplacedtktkVtxProducer::maxEta_
private

Definition at line 50 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

◆ maxInvMass_

const double HLTDisplacedtktkVtxProducer::maxInvMass_
private

Definition at line 54 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

◆ minInvMass_

const double HLTDisplacedtktkVtxProducer::minInvMass_
private

Definition at line 53 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

◆ minPt_

const double HLTDisplacedtktkVtxProducer::minPt_
private

Definition at line 51 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

◆ minPtPair_

const double HLTDisplacedtktkVtxProducer::minPtPair_
private

Definition at line 52 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

◆ previousCandTag_

const edm::InputTag HLTDisplacedtktkVtxProducer::previousCandTag_
private

Definition at line 48 of file HLTDisplacedtktkVtxProducer.h.

◆ previousCandToken_

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

Definition at line 49 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

◆ srcTag_

const edm::InputTag HLTDisplacedtktkVtxProducer::srcTag_
private

Definition at line 46 of file HLTDisplacedtktkVtxProducer.h.

◆ srcToken_

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

Definition at line 47 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

◆ transientTrackRecordToken_

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

Definition at line 45 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

◆ triggerTypeDaughters_

const int HLTDisplacedtktkVtxProducer::triggerTypeDaughters_
private

Definition at line 58 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().