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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
 HLTDisplacedtktkVtxProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HLTDisplacedtktkVtxProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::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, std::vector< reco::RecoChargedCandidateRef > &ref2)
 

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 int triggerTypeDaughters_
 

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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase 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::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 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 35 of file HLTDisplacedtktkVtxProducer.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file HLTDisplacedtktkVtxProducer.cc.

References ~HLTDisplacedtktkVtxProducer().

35  :
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  massParticle1_ (iConfig.getParameter<double>("massParticle1")),
46  massParticle2_ (iConfig.getParameter<double>("massParticle2")),
47  chargeOpt_ (iConfig.getParameter<int>("ChargeOpt")),
48  triggerTypeDaughters_(iConfig.getParameter<int>("triggerTypeDaughters"))
49 
50 {
51  produces<VertexCollection>();
52 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > srcToken_
HLTDisplacedtktkVtxProducer::~HLTDisplacedtktkVtxProducer ( )
overridedefault

Member Function Documentation

void HLTDisplacedtktkVtxProducer::beginJob ( void  )
virtual

Definition at line 76 of file HLTDisplacedtktkVtxProducer.cc.

77 {
78 
79 }
bool HLTDisplacedtktkVtxProducer::checkPreviousCand ( const reco::TrackRef trackref,
std::vector< reco::RecoChargedCandidateRef > &  ref2 
)
private

Definition at line 197 of file HLTDisplacedtktkVtxProducer.cc.

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

Referenced by produce().

197  {
198  bool ok=false;
199  for (auto & i : refVect) {
200  if ( i->get<TrackRef>() == trackref ) {
201  ok=true;
202  break;
203  }
204  }
205  return ok;
206 }
void HLTDisplacedtktkVtxProducer::endJob ( void  )
virtual

Definition at line 82 of file HLTDisplacedtktkVtxProducer.cc.

83 {
84 
85 }
void HLTDisplacedtktkVtxProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 58 of file HLTDisplacedtktkVtxProducer.cc.

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

58  {
60  desc.add<edm::InputTag>("Src",edm::InputTag("hltL3MuonCandidates"));
61  desc.add<edm::InputTag>("PreviousCandTag",edm::InputTag(""));
62  desc.add<double>("MaxEta",2.5);
63  desc.add<double>("MinPt",0.0);
64  desc.add<double>("MinPtPair",0.0);
65  desc.add<double>("MinInvMass",1.0);
66  desc.add<double>("MaxInvMass",20.0);
67  desc.add<double>("massParticle1",0.1396);
68  desc.add<double>("massParticle2",0.4937);
69  desc.add<int>("ChargeOpt",-1);
70  desc.add<int>("triggerTypeDaughters",0);
71 
72  descriptions.add("hltDisplacedtktkVtxProducer", desc);
73 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HLTDisplacedtktkVtxProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 88 of file HLTDisplacedtktkVtxProducer.cc.

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

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

Member Data Documentation

const int HLTDisplacedtktkVtxProducer::chargeOpt_
private

Definition at line 58 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

const double HLTDisplacedtktkVtxProducer::massParticle1_
private

Definition at line 56 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

const double HLTDisplacedtktkVtxProducer::massParticle2_
private

Definition at line 57 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

const double HLTDisplacedtktkVtxProducer::maxEta_
private

Definition at line 51 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

const double HLTDisplacedtktkVtxProducer::maxInvMass_
private

Definition at line 55 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

const double HLTDisplacedtktkVtxProducer::minInvMass_
private

Definition at line 54 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

const double HLTDisplacedtktkVtxProducer::minPt_
private

Definition at line 52 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

const double HLTDisplacedtktkVtxProducer::minPtPair_
private

Definition at line 53 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTDisplacedtktkVtxProducer::previousCandTag_
private

Definition at line 49 of file HLTDisplacedtktkVtxProducer.h.

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

Definition at line 50 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

const edm::InputTag HLTDisplacedtktkVtxProducer::srcTag_
private

Definition at line 47 of file HLTDisplacedtktkVtxProducer.h.

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

Definition at line 48 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().

const int HLTDisplacedtktkVtxProducer::triggerTypeDaughters_
private

Definition at line 59 of file HLTDisplacedtktkVtxProducer.h.

Referenced by produce().