CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
 
 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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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 bool matchToPrevious_
 
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_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 33 of file HLTDisplacedmumuVtxProducer.h.

Constructor & Destructor Documentation

◆ HLTDisplacedmumuVtxProducer()

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

Definition at line 29 of file HLTDisplacedmumuVtxProducer.cc.

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  matchToPrevious_(iConfig.getParameter<bool>("matchToPrevious")),
36  maxEta_(iConfig.getParameter<double>("MaxEta")),
37  minPt_(iConfig.getParameter<double>("MinPt")),
38  minPtPair_(iConfig.getParameter<double>("MinPtPair")),
39  minInvMass_(iConfig.getParameter<double>("MinInvMass")),
40  maxInvMass_(iConfig.getParameter<double>("MaxInvMass")),
41  chargeOpt_(iConfig.getParameter<int>("ChargeOpt")) {
42  produces<VertexCollection>();
43 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > srcToken_
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackRecordToken_

◆ ~HLTDisplacedmumuVtxProducer()

HLTDisplacedmumuVtxProducer::~HLTDisplacedmumuVtxProducer ( )
overridedefault

Member Function Documentation

◆ checkPreviousCand()

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

Definition at line 177 of file HLTDisplacedmumuVtxProducer.cc.

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

Referenced by produce().

178  {
179  bool ok = false;
180  for (auto& i : refVect) {
181  if (i->get<TrackRef>() == trackref) {
182  ok = true;
183  break;
184  }
185  }
186  return ok;
187 }

◆ fillDescriptions()

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

Definition at line 47 of file HLTDisplacedmumuVtxProducer.cc.

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

47  {
49  desc.add<edm::InputTag>("Src", edm::InputTag("hltL3MuonCandidates"));
50  desc.add<edm::InputTag>("PreviousCandTag", edm::InputTag(""));
51  desc.add<bool>("matchToPrevious", true);
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<int>("ChargeOpt", -1);
58  descriptions.add("hltDisplacedmumuVtxProducer", desc);
59 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void HLTDisplacedmumuVtxProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 62 of file HLTDisplacedmumuVtxProducer.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, matchToPrevious_, maxEta_, maxInvMass_, minInvMass_, minPt_, minPtPair_, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, previousCandToken_, mathSSE::sqrt(), srcToken_, transientTrackRecordToken_, trigger::TriggerMuon, bphysicsOniaDQM_cfi::vertex, KalmanVertexFitter::vertex(), and spclusmultinvestigator_cfi::vertexCollection.

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

Member Data Documentation

◆ chargeOpt_

const int HLTDisplacedmumuVtxProducer::chargeOpt_
private

Definition at line 54 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

◆ matchToPrevious_

const bool HLTDisplacedmumuVtxProducer::matchToPrevious_
private

Definition at line 48 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

◆ maxEta_

const double HLTDisplacedmumuVtxProducer::maxEta_
private

Definition at line 49 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

◆ maxInvMass_

const double HLTDisplacedmumuVtxProducer::maxInvMass_
private

Definition at line 53 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

◆ minInvMass_

const double HLTDisplacedmumuVtxProducer::minInvMass_
private

Definition at line 52 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

◆ minPt_

const double HLTDisplacedmumuVtxProducer::minPt_
private

Definition at line 50 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

◆ minPtPair_

const double HLTDisplacedmumuVtxProducer::minPtPair_
private

Definition at line 51 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

◆ previousCandTag_

const edm::InputTag HLTDisplacedmumuVtxProducer::previousCandTag_
private

Definition at line 46 of file HLTDisplacedmumuVtxProducer.h.

◆ previousCandToken_

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

Definition at line 47 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

◆ srcTag_

const edm::InputTag HLTDisplacedmumuVtxProducer::srcTag_
private

Definition at line 44 of file HLTDisplacedmumuVtxProducer.h.

◆ srcToken_

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

Definition at line 45 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

◆ transientTrackRecordToken_

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

Definition at line 43 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().