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::stream::EDProducer<>

Public Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
 HLTDisplacedmumuVtxProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HLTDisplacedmumuVtxProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

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::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 32 of file HLTDisplacedmumuVtxProducer.h.

Constructor & Destructor Documentation

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

Definition at line 36 of file HLTDisplacedmumuVtxProducer.cc.

References ~HLTDisplacedmumuVtxProducer().

36  :
37  srcTag_ (iConfig.getParameter<edm::InputTag>("Src")),
38  srcToken_(consumes<reco::RecoChargedCandidateCollection>(srcTag_)),
39  previousCandTag_(iConfig.getParameter<edm::InputTag>("PreviousCandTag")),
40  previousCandToken_(consumes<trigger::TriggerFilterObjectWithRefs>(previousCandTag_)),
41  maxEta_ (iConfig.getParameter<double>("MaxEta")),
42  minPt_ (iConfig.getParameter<double>("MinPt")),
43  minPtPair_ (iConfig.getParameter<double>("MinPtPair")),
44  minInvMass_ (iConfig.getParameter<double>("MinInvMass")),
45  maxInvMass_ (iConfig.getParameter<double>("MaxInvMass")),
46  chargeOpt_ (iConfig.getParameter<int>("ChargeOpt"))
47 {
48  produces<VertexCollection>();
49 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > srcToken_
HLTDisplacedmumuVtxProducer::~HLTDisplacedmumuVtxProducer ( )
overridedefault

Member Function Documentation

void HLTDisplacedmumuVtxProducer::beginJob ( void  )
virtual

Definition at line 69 of file HLTDisplacedmumuVtxProducer.cc.

70 {
71 
72 }
bool HLTDisplacedmumuVtxProducer::checkPreviousCand ( const reco::TrackRef trackref,
std::vector< reco::RecoChargedCandidateRef > &  ref2 
)
private

Definition at line 184 of file HLTDisplacedmumuVtxProducer.cc.

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

Referenced by produce().

184  {
185  bool ok=false;
186  for (auto & i : refVect) {
187  if ( i->get<TrackRef>() == trackref ) {
188  ok=true;
189  break;
190  }
191  }
192  return ok;
193 }
void HLTDisplacedmumuVtxProducer::endJob ( void  )
virtual

Definition at line 75 of file HLTDisplacedmumuVtxProducer.cc.

76 {
77 
78 }
void HLTDisplacedmumuVtxProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 55 of file HLTDisplacedmumuVtxProducer.cc.

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

55  {
57  desc.add<edm::InputTag>("Src",edm::InputTag("hltL3MuonCandidates"));
58  desc.add<edm::InputTag>("PreviousCandTag",edm::InputTag(""));
59  desc.add<double>("MaxEta",2.5);
60  desc.add<double>("MinPt",0.0);
61  desc.add<double>("MinPtPair",0.0);
62  desc.add<double>("MinInvMass",1.0);
63  desc.add<double>("MaxInvMass",20.0);
64  desc.add<int>("ChargeOpt",-1);
65  descriptions.add("hltDisplacedmumuVtxProducer", desc);
66 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HLTDisplacedmumuVtxProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 81 of file HLTDisplacedmumuVtxProducer.cc.

References funct::abs(), chargeOpt_, checkPreviousCand(), 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, KalmanVertexFitter::vertex(), and particleFlowSuperClusterECAL_cfi::vertexCollection.

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

Referenced by produce().

const double HLTDisplacedmumuVtxProducer::maxEta_
private

Definition at line 48 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

const double HLTDisplacedmumuVtxProducer::maxInvMass_
private

Definition at line 52 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

const double HLTDisplacedmumuVtxProducer::minInvMass_
private

Definition at line 51 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

const double HLTDisplacedmumuVtxProducer::minPt_
private

Definition at line 49 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

const double HLTDisplacedmumuVtxProducer::minPtPair_
private

Definition at line 50 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTDisplacedmumuVtxProducer::previousCandTag_
private

Definition at line 46 of file HLTDisplacedmumuVtxProducer.h.

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

Definition at line 47 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTDisplacedmumuVtxProducer::srcTag_
private

Definition at line 44 of file HLTDisplacedmumuVtxProducer.h.

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

Definition at line 45 of file HLTDisplacedmumuVtxProducer.h.

Referenced by produce().