CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
 HLTDisplacedmumuVtxProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~HLTDisplacedmumuVtxProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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 maxEta_
 
const double maxInvMass_
 
const double minInvMass_
 
const double minPt_
 
const double minPtPair_
 
const edm::InputTag previousCandTag_
 
const edm::EDGetTokenT
< trigger::TriggerFilterObjectWithRefs
previousCandToken_
 
const edm::InputTag srcTag_
 
const edm::EDGetTokenT
< reco::RecoChargedCandidateCollection
srcToken_
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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 32 of file HLTDisplacedmumuVtxProducer.h.

Constructor & Destructor Documentation

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

Definition at line 36 of file HLTDisplacedmumuVtxProducer.cc.

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 ( )

Definition at line 52 of file HLTDisplacedmumuVtxProducer.cc.

53 {
54 
55 }

Member Function Documentation

void HLTDisplacedmumuVtxProducer::beginJob ( void  )
virtual

Definition at line 72 of file HLTDisplacedmumuVtxProducer.cc.

73 {
74 
75 }
bool HLTDisplacedmumuVtxProducer::checkPreviousCand ( const reco::TrackRef trackref,
std::vector< reco::RecoChargedCandidateRef > &  ref2 
)
private

Definition at line 187 of file HLTDisplacedmumuVtxProducer.cc.

References i, and convertSQLiteXML::ok.

Referenced by produce().

187  {
188  bool ok=false;
189  for (unsigned int i=0; i<refVect.size(); i++) {
190  if ( refVect[i]->get<TrackRef>() == trackref ) {
191  ok=true;
192  break;
193  }
194  }
195  return ok;
196 }
int i
Definition: DBlmapReader.cc:9
void HLTDisplacedmumuVtxProducer::endJob ( void  )
virtual

Definition at line 78 of file HLTDisplacedmumuVtxProducer.cc.

79 {
80 
81 }
void HLTDisplacedmumuVtxProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 58 of file HLTDisplacedmumuVtxProducer.cc.

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

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<int>("ChargeOpt",-1);
68  descriptions.add("hltDisplacedmumuVtxProducer", desc);
69 }
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 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 84 of file HLTDisplacedmumuVtxProducer.cc.

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

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