CMS 3D CMS Logo

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

#include <HLTDisplacedmumuVtxProducer.h>

Inheritance diagram for HLTDisplacedmumuVtxProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HLTDisplacedmumuVtxProducer (const edm::ParameterSet &)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
 ~HLTDisplacedmumuVtxProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (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 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_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 30 of file HLTDisplacedmumuVtxProducer.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file HLTDisplacedmumuVtxProducer.cc.

References ~HLTDisplacedmumuVtxProducer().

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  minPtPair_(iConfig.getParameter<double>("MinPtPair")),
43  minInvMass_(iConfig.getParameter<double>("MinInvMass")),
44  maxInvMass_(iConfig.getParameter<double>("MaxInvMass")),
45  chargeOpt_(iConfig.getParameter<int>("ChargeOpt")) {
46  produces<VertexCollection>();
47 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > srcToken_
HLTDisplacedmumuVtxProducer::~HLTDisplacedmumuVtxProducer ( )
overridedefault

Member Function Documentation

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

Definition at line 179 of file HLTDisplacedmumuVtxProducer.cc.

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

Referenced by produce().

180  {
181  bool ok = false;
182  for (auto& i : refVect) {
183  if (i->get<TrackRef>() == trackref) {
184  ok = true;
185  break;
186  }
187  }
188  return ok;
189 }
void HLTDisplacedmumuVtxProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 51 of file HLTDisplacedmumuVtxProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HLT_2018_cff::InputTag.

51  {
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>("MinPtPair", 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("hltDisplacedmumuVtxProducer", desc);
62 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HLTDisplacedmumuVtxProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
override

Definition at line 65 of file HLTDisplacedmumuVtxProducer.cc.

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

65  {
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;
82 
83  RecoChargedCandidateCollection::const_iterator cand1;
84  RecoChargedCandidateCollection::const_iterator cand2;
85 
86  // get the objects passing the previous filter
88  iEvent.getByToken(previousCandToken_, previousCands);
89 
90  vector<RecoChargedCandidateRef> vPrevCands;
91  previousCands->getObjects(TriggerMuon, vPrevCands);
92 
93  for (cand1 = mucands->begin(); cand1 != mucands->end(); cand1++) {
94  TrackRef tk1 = cand1->get<TrackRef>();
95  LogDebug("HLTDisplacedMumuFilter") << " 1st muon in loop: q*pt= " << cand1->charge() * cand1->pt()
96  << ", eta= " << cand1->eta() << ", hits= " << tk1->numberOfValidHits();
97 
98  //first check if this muon passed the previous filter
99  if (!checkPreviousCand(tk1, vPrevCands))
100  continue;
101 
102  // cuts
103  if (fabs(cand1->eta()) > maxEta_)
104  continue;
105  if (cand1->pt() < minPt_)
106  continue;
107 
108  cand2 = cand1;
109  cand2++;
110  for (; cand2 != mucands->end(); cand2++) {
111  TrackRef tk2 = cand2->get<TrackRef>();
112 
113  // eta cut
114  LogDebug("HLTDisplacedmumuVtxProducer")
115  << " 2nd muon in loop: q*pt= " << cand2->charge() * cand2->pt() << ", eta= " << cand2->eta()
116  << ", hits= " << tk2->numberOfValidHits() << ", d0= " << tk2->d0();
117  //first check if this muon passed the previous filter
118  if (!checkPreviousCand(tk2, vPrevCands))
119  continue;
120 
121  // cuts
122  if (fabs(cand2->eta()) > maxEta_)
123  continue;
124  if (cand2->pt() < minPt_)
125  continue;
126 
127  // opposite sign or same sign
128  if (chargeOpt_ < 0) {
129  if (cand1->charge() * cand2->charge() > 0)
130  continue;
131  } else if (chargeOpt_ > 0) {
132  if (cand1->charge() * cand2->charge() < 0)
133  continue;
134  }
135 
136  // Combined dimuon system
137  e1 = sqrt(cand1->momentum().Mag2() + MuMass2);
138  e2 = sqrt(cand2->momentum().Mag2() + MuMass2);
139  p1 = Particle::LorentzVector(cand1->px(), cand1->py(), cand1->pz(), e1);
140  p2 = Particle::LorentzVector(cand2->px(), cand2->py(), cand2->pz(), e2);
141  p = p1 + p2;
142 
143  if (p.pt() < minPtPair_)
144  continue;
145 
146  double invmass = abs(p.mass());
147  LogDebug("HLTDisplacedMumuFilter") << " ... 1-2 invmass= " << invmass;
148 
149  if (invmass < minInvMass_)
150  continue;
151  if (invmass > maxInvMass_)
152  continue;
153 
154  // do the vertex fit
155  vector<TransientTrack> t_tks;
156  TransientTrack ttkp1 = (*theB).build(&tk1);
157  TransientTrack ttkp2 = (*theB).build(&tk2);
158  t_tks.push_back(ttkp1);
159  t_tks.push_back(ttkp2);
160 
161  if (t_tks.size() != 2)
162  continue;
163 
164  KalmanVertexFitter kvf;
165  TransientVertex tv = kvf.vertex(t_tks);
166 
167  if (!tv.isValid())
168  continue;
169 
170  Vertex vertex = tv;
171 
172  // put vertex in the event
173  vertexCollection->push_back(vertex);
174  }
175  }
176  iEvent.put(std::move(vertexCollection));
177 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
bool checkPreviousCand(const reco::TrackRef &trackref, const std::vector< reco::RecoChargedCandidateRef > &ref2) const
T sqrt(T t)
Definition: SSEVec.h:19
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > srcToken_
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
T get() const
Definition: EventSetup.h:73
bool isValid() const
def move(src, dest)
Definition: eostools.py:511
math::PtEtaPhiELorentzVectorF LorentzVector

Member Data Documentation

const int HLTDisplacedmumuVtxProducer::chargeOpt_
private

Definition at line 49 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

const double HLTDisplacedmumuVtxProducer::maxEta_
private

Definition at line 44 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

const double HLTDisplacedmumuVtxProducer::maxInvMass_
private

Definition at line 48 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

const double HLTDisplacedmumuVtxProducer::minInvMass_
private

Definition at line 47 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

const double HLTDisplacedmumuVtxProducer::minPt_
private

Definition at line 45 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

const double HLTDisplacedmumuVtxProducer::minPtPair_
private

Definition at line 46 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTDisplacedmumuVtxProducer::previousCandTag_
private

Definition at line 42 of file HLTDisplacedmumuVtxProducer.h.

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

Definition at line 43 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTDisplacedmumuVtxProducer::srcTag_
private

Definition at line 40 of file HLTDisplacedmumuVtxProducer.h.

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

Definition at line 41 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().