CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
SoftLepton Class Reference

#include <RecoBTag/SoftLepton/plugin/SoftLepton.h>

Inheritance diagram for SoftLepton:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  TrackCompare
 

Public Types

typedef std::map< unsigned int,
float > 
LeptonIds
 
typedef std::map
< edm::RefToBase< reco::Track >
, LeptonIds, TrackCompare
Leptons
 
- 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
 

Public Member Functions

 SoftLepton (const edm::ParameterSet &iConfig)
 
reco::SoftLeptonTagInfo tag (const edm::RefToBase< reco::Jet > &jet, const reco::TrackRefVector &tracks, const Leptons &leptons, const reco::Vertex &primaryVertex) const
 
 ~SoftLepton ()
 
- 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)
 

Protected Member Functions

GlobalVector refineJetAxis (const edm::RefToBase< reco::Jet > &jet, const reco::TrackRefVector &tracks, const edm::RefToBase< reco::Track > &exclude=edm::RefToBase< reco::Track >()) const
 
- 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)
 

Static Protected Member Functions

static double boostedPPar (const math::XYZVector &vector, const math::XYZVector &axis)
 
static double relativeEta (const math::XYZVector &vector, const math::XYZVector &axis)
 

Private Member Functions

virtual void produce (edm::Event &event, const edm::EventSetup &setup)
 

Private Attributes

double m_chi2Cut
 
double m_deltaRCut
 
const edm::InputTag m_jets
 
const edm::InputTag m_leptonCands
 
const edm::InputTag m_leptonId
 
const edm::InputTag m_leptons
 
muon::SelectionType m_muonSelection
 
unsigned int m_refineJetAxis
 
const TransientTrackBuilderm_transientTrackBuilder
 
const edm::EDGetTokenT
< edm::View< reco::Electron > > 
token_electrons
 
const edm::EDGetTokenT
< edm::View< reco::GsfElectron > > 
token_gsfElectrons
 
const edm::EDGetTokenT
< edm::View< reco::Jet > > 
token_jets
 
const edm::EDGetTokenT
< reco::JetTracksAssociationCollection
token_jtas
 
const edm::EDGetTokenT
< edm::ValueMap< float > > 
token_leptonCands
 
const edm::EDGetTokenT
< edm::ValueMap< float > > 
token_leptonId
 
const edm::EDGetTokenT
< edm::View< reco::Muon > > 
token_muons
 
const edm::EDGetTokenT
< reco::PFCandidateCollection
token_pfElectrons
 
const edm::EDGetTokenT
< reco::VertexCollection
token_primaryVertex
 
const edm::EDGetTokenT
< edm::View< reco::Track > > 
token_tracks
 

Static Private Attributes

static const reco::Vertex s_nominalBeamSpot
 

Detailed Description

Description: CMSSW EDProducer for soft lepton b tagging.

Implementation:

Description: CMSSW EDProducer wrapper for sot lepton b tagging.

Implementation: The actual tagging is performed by SoftLeptonAlgorithm.

Definition at line 51 of file SoftLepton.h.

Member Typedef Documentation

typedef std::map<unsigned int, float> SoftLepton::LeptonIds

Definition at line 65 of file SoftLepton.h.

Definition at line 66 of file SoftLepton.h.

Constructor & Destructor Documentation

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

Definition at line 66 of file SoftLepton.cc.

66  :
67  m_jets( iConfig.getParameter<edm::InputTag>( "jets" ) ),
68  token_jtas( mayConsume<reco::JetTracksAssociationCollection>( iConfig.getParameter<edm::InputTag>( "jets" ) ) ),
70  token_primaryVertex( consumes<reco::VertexCollection>( iConfig.getParameter<edm::InputTag>( "primaryVertex" ) ) ),
71  m_leptons( iConfig.getParameter<edm::InputTag>( "leptons" ) ),
72  token_gsfElectrons( mayConsume<GsfElectronView>( iConfig.getParameter<edm::InputTag>( "leptons" ) ) ),
73  token_electrons( mayConsume<ElectronView>( iConfig.getParameter<edm::InputTag>( "leptons" ) ) ),
74  token_pfElectrons( mayConsume<reco::PFCandidateCollection>( iConfig.getParameter<edm::InputTag>( "leptons" ) ) ),
75  token_muons( mayConsume<MuonView>( iConfig.getParameter<edm::InputTag>( "leptons" ) ) ),
77  m_leptonCands( iConfig.exists("leptonCands") ? iConfig.getParameter<edm::InputTag>( "leptonCands" ) : edm::InputTag() ),
78  token_leptonCands( mayConsume<edm::ValueMap<float> >( iConfig.exists("leptonCands") ? iConfig.getParameter<edm::InputTag>( "leptonCands" ) : edm::InputTag() ) ),
79  m_leptonId( iConfig.exists("leptonId") ? iConfig.getParameter<edm::InputTag>( "leptonId" ) : edm::InputTag() ),
80  token_leptonId( mayConsume<edm::ValueMap<float> >( iConfig.exists("leptonId") ? iConfig.getParameter<edm::InputTag>( "leptonId" ) : edm::InputTag() ) ),
82  m_refineJetAxis( iConfig.getParameter<unsigned int>( "refineJetAxis" ) ),
83  m_deltaRCut( iConfig.getParameter<double>( "leptonDeltaRCut" ) ),
84  m_chi2Cut( iConfig.getParameter<double>( "leptonChi2Cut" ) ),
85  m_muonSelection( (muon::SelectionType) iConfig.getParameter<unsigned int>( "muonSelection" ) )
86 {
87  produces<reco::SoftLeptonTagInfoCollection>();
88 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< reco::PFCandidateCollection > token_pfElectrons
Definition: SoftLepton.h:106
const edm::EDGetTokenT< edm::ValueMap< float > > token_leptonCands
Definition: SoftLepton.h:110
bool exists(std::string const &parameterName) const
checks if a parameter exists
const edm::EDGetTokenT< edm::ValueMap< float > > token_leptonId
Definition: SoftLepton.h:112
const edm::EDGetTokenT< edm::View< reco::Muon > > token_muons
Definition: SoftLepton.h:107
const edm::EDGetTokenT< edm::View< reco::Electron > > token_electrons
Definition: SoftLepton.h:105
double m_chi2Cut
Definition: SoftLepton.h:120
const edm::EDGetTokenT< edm::View< reco::GsfElectron > > token_gsfElectrons
Definition: SoftLepton.h:104
SelectionType
Selector type.
Definition: MuonSelectors.h:17
const edm::InputTag m_leptons
Definition: SoftLepton.h:103
const edm::EDGetTokenT< reco::VertexCollection > token_primaryVertex
Definition: SoftLepton.h:102
const edm::InputTag m_leptonId
Definition: SoftLepton.h:111
double m_deltaRCut
Definition: SoftLepton.h:119
const edm::InputTag m_leptonCands
Definition: SoftLepton.h:109
unsigned int m_refineJetAxis
Definition: SoftLepton.h:118
const edm::EDGetTokenT< edm::View< reco::Jet > > token_jets
Definition: SoftLepton.h:101
muon::SelectionType m_muonSelection
Definition: SoftLepton.h:123
const edm::InputTag m_jets
Definition: SoftLepton.h:99
const TransientTrackBuilder * m_transientTrackBuilder
Definition: SoftLepton.h:115
const edm::EDGetTokenT< edm::View< reco::Track > > token_tracks
Definition: SoftLepton.h:108
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > token_jtas
Definition: SoftLepton.h:100
SoftLepton::~SoftLepton ( void  )

Definition at line 91 of file SoftLepton.cc.

91  {
92 }

Member Function Documentation

double SoftLepton::boostedPPar ( const math::XYZVector vector,
const math::XYZVector axis 
)
staticprotected

Definition at line 398 of file SoftLepton.cc.

References metsig::jet.

Referenced by tag().

398  {
399  static const double lepton_mass = 0.00; // assume a massless (ultrarelativistic) lepton
400  static const double jet_mass = 5.279; // use B±/B0 mass as the jet rest mass [PDG 2007 updates]
401  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > lepton(vector.Dot(axis) / axis.r(), Perp(vector, axis), 0., lepton_mass);
402  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > jet( axis.r(), 0., 0., jet_mass );
403  ROOT::Math::BoostX boost( -jet.Beta() );
404  return boost(lepton).x();
405 }
void SoftLepton::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 409 of file SoftLepton.cc.

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

409  {
410 
412  desc.add<unsigned int>("muonSelection",1);
413  desc.add<edm::InputTag>("leptons",edm::InputTag("muons"));
414  desc.add<edm::InputTag>("primaryVertex",edm::InputTag("offlinePrimaryVertices"));
415  desc.add<edm::InputTag>("leptonCands",edm::InputTag(""));
416  desc.add<edm::InputTag>("leptonId",edm::InputTag(""));
417  desc.add<unsigned int>("refineJetAxis",0);
418  desc.add<edm::InputTag>("jets",edm::InputTag("ak4PFJetsCHS"));
419  desc.add<double>("leptonDeltaRCut",0.4);
420  desc.add<double>("leptonChi2Cut",9999.0);
421  descriptions.addDefault(desc);
422 }
void addDefault(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void SoftLepton::produce ( edm::Event event,
const edm::EventSetup setup 
)
privatevirtual

Implements edm::stream::EDProducerBase.

Definition at line 96 of file SoftLepton.cc.

References metsig::electron, Exception, edm::EventSetup::get(), i, HLT_25ns14e33_v1_cff::InputTag, muon::isGoodMuon(), edm::HandleBase::isValid(), fwrapper::jets, HLT_25ns14e33_v1_cff::leptonId, HLT_25ns14e33_v1_cff::leptons, m_jets, m_leptonCands, m_leptonId, m_leptons, m_muonSelection, m_transientTrackBuilder, metsig::muon, edm::errors::NotFound, edm::ESHandle< class >::product(), query::result, s_nominalBeamSpot, findQualityFiles::size, tag(), token_electrons, token_gsfElectrons, token_jets, token_jtas, token_leptonCands, token_leptonId, token_muons, token_pfElectrons, token_primaryVertex, token_tracks, and testEve_cfg::tracks.

96  {
97 
98  // grab a TransientTrack helper from the Event Setup
100  setup.get<TransientTrackRecord>().get( "TransientTrackBuilder", builder );
101  m_transientTrackBuilder = builder.product();
102 
103  // input objects
104 
105  // input jets (and possibly tracks)
106  ProductID jets_id;
107  std::vector<edm::RefToBase<reco::Jet> > jets;
108  std::vector<reco::TrackRefVector> tracks;
109  do { {
110  // look for a JetTracksAssociationCollection
112  event.getByToken(token_jtas, h_jtas);
113  if (h_jtas.isValid()) {
114  unsigned int size = h_jtas->size();
115  jets.resize(size);
116  tracks.resize(size);
117  for (unsigned int i = 0; i < size; ++i) {
118  jets[i] = (*h_jtas)[i].first;
119  tracks[i] = (*h_jtas)[i].second;
120  }
121  break;
122  }
123  } { // else...
124  // look for a View<Jet>
126  event.getByToken(token_jets, h_jets);
127  if (h_jets.isValid()) {
128  unsigned int size = h_jets->size();
129  jets.resize(size);
130  tracks.resize(size);
131  for (unsigned int i = 0; i < h_jets->size(); i++)
132  jets[i] = h_jets->refAt(i);
133  break;
134  }
135  } { // else...
136  throw edm::Exception(edm::errors::NotFound) << "Object " << m_jets << " of type among (\"reco::JetTracksAssociationCollection\", \"edm::View<reco::Jet>\") not found";
137  } } while (false);
138 
139  // input primary vetex
140  reco::Vertex vertex;
141  Handle<reco::VertexCollection> h_primaryVertex;
142  event.getByToken(token_primaryVertex, h_primaryVertex);
143  if (h_primaryVertex.isValid() and not h_primaryVertex->empty())
144  vertex = h_primaryVertex->front();
145  else
146  // fall back to nominal beam spot
147  vertex = s_nominalBeamSpot;
148 
149  // input leptons (can be of different types)
151 
152  Handle<edm::ValueMap<float> > h_leptonCands;
153  bool haveLeptonCands = !(m_leptonCands == edm::InputTag());
154  if (haveLeptonCands)
155  event.getByToken(token_leptonCands, h_leptonCands);
156 
157  // try to access the input collection as a collection of GsfElectrons, Muons or Tracks
158 
160  do { {
161  // look for View<GsfElectron>
162  Handle<GsfElectronView> h_electrons;
163  event.getByToken(token_gsfElectrons, h_electrons);
164 
165  if (h_electrons.isValid()) {
166  leptonId = SoftLeptonProperties::Quality::egammaElectronId;
167  for (GsfElectronView::const_iterator electron = h_electrons->begin(); electron != h_electrons->end(); ++electron) {
168  LeptonIds &id = leptons[reco::TrackBaseRef(electron->gsfTrack())];
169  id[SoftLeptonProperties::Quality::pfElectronId] = electron->mva_e_pi();
170  if (haveLeptonCands)
171  id[SoftLeptonProperties::Quality::btagElectronCands] = (*h_leptonCands)[h_electrons->refAt(electron - h_electrons->begin())];
172  }
173  break;
174  }
175  } { // else
176  // look for View<Electron>
177  // FIXME: is this obsolete?
178  Handle<ElectronView> h_electrons;
179  event.getByToken(token_electrons, h_electrons);
180  if (h_electrons.isValid()) {
181  leptonId = SoftLeptonProperties::Quality::egammaElectronId;
182  for (ElectronView::const_iterator electron = h_electrons->begin(); electron != h_electrons->end(); ++electron) {
183  LeptonIds &id = leptons[reco::TrackBaseRef(electron->track())];
184  if (haveLeptonCands)
185  id[SoftLeptonProperties::Quality::btagElectronCands] = (*h_leptonCands)[h_electrons->refAt(electron - h_electrons->begin())];
186  }
187  break;
188  }
189  } { // else
190  // look for PFElectrons
191  // FIXME: is this obsolete?
193  event.getByToken(token_pfElectrons, h_electrons);
194  if (h_electrons.isValid()) {
195  leptonId = SoftLeptonProperties::Quality::egammaElectronId;
196  for (reco::PFCandidateCollection::const_iterator electron = h_electrons->begin(); electron != h_electrons->end(); ++electron) {
197  LeptonIds *id;
198  if (electron->gsfTrackRef().isNonnull())
199  id = &leptons[reco::TrackBaseRef(electron->gsfTrackRef())];
200  else if (electron->trackRef().isNonnull())
201  id = &leptons[reco::TrackBaseRef(electron->trackRef())];
202  else
203  continue;
204  (*id)[SoftLeptonProperties::Quality::pfElectronId] = electron->mva_e_pi();
205  if (haveLeptonCands)
206  (*id)[SoftLeptonProperties::Quality::btagElectronCands] = (*h_leptonCands)[reco::PFCandidateRef(h_electrons, electron - h_electrons->begin())];
207  }
208  break;
209  }
210  } { // else
211  // look for View<Muon>
212  Handle<MuonView> h_muons;
213  event.getByToken(token_muons, h_muons);
214  if (h_muons.isValid()) {
215  for (MuonView::const_iterator muon = h_muons->begin(); muon != h_muons->end(); ++muon) {
216  // FIXME -> turn this selection into a muonCands input?
218  LeptonIds *id;
219  if (muon->globalTrack().isNonnull())
220  id = &leptons[reco::TrackBaseRef(muon->globalTrack())];
221  else if (muon->innerTrack().isNonnull())
222  id = &leptons[reco::TrackBaseRef(muon->innerTrack())];
223  else if (muon->outerTrack().isNonnull())
224  // does this makes sense ?
225  id = &leptons[reco::TrackBaseRef(muon->outerTrack())];
226  else
227  continue;
228  if (haveLeptonCands)
229  (*id)[SoftLeptonProperties::Quality::btagMuonCands] = (*h_leptonCands)[h_muons->refAt(muon - h_muons->begin())];
230  }
231  }
232  break;
233  }
234  } { // else
235  // look for edm::View<Track>
237  event.getByToken(token_tracks, h_tracks);
238  if (h_tracks.isValid()) {
239  for (unsigned int i = 0; i < h_tracks->size(); i++) {
240  LeptonIds &id = leptons[h_tracks->refAt(i)];
241  if (haveLeptonCands)
242  id[SoftLeptonProperties::Quality::btagLeptonCands] = (*h_leptonCands)[h_tracks->refAt(i)];
243  }
244  break;
245  }
246  } { // else
247  throw edm::Exception(edm::errors::NotFound) << "Object " << m_leptons << " of type among (\"edm::View<reco::GsfElectron>\", \"edm::View<reco::Muon>\", \"edm::View<reco::Track>\") !found";
248  } } while (false);
249 
250  if (!(m_leptonId == edm::InputTag())) {
251  Handle<edm::ValueMap<float> > h_leptonId;
252  event.getByToken(token_leptonId, h_leptonId);
253 
254  for (Leptons::iterator lepton = leptons.begin(); lepton != leptons.end(); ++lepton)
255  lepton->second[leptonId] = (*h_leptonId)[lepton->first];
256  }
257 
258  // output collections
259  std::auto_ptr<reco::SoftLeptonTagInfoCollection> outputCollection( new reco::SoftLeptonTagInfoCollection() );
260  for (unsigned int i = 0; i < jets.size(); ++i) {
261  reco::SoftLeptonTagInfo result = tag( jets[i], tracks[i], leptons, vertex );
262  outputCollection->push_back( result );
263  }
264  event.put( outputCollection );
265 }
int i
Definition: DBlmapReader.cc:9
const edm::EDGetTokenT< reco::PFCandidateCollection > token_pfElectrons
Definition: SoftLepton.h:106
const edm::EDGetTokenT< edm::ValueMap< float > > token_leptonCands
Definition: SoftLepton.h:110
const edm::EDGetTokenT< edm::ValueMap< float > > token_leptonId
Definition: SoftLepton.h:112
const edm::EDGetTokenT< edm::View< reco::Muon > > token_muons
Definition: SoftLepton.h:107
const edm::EDGetTokenT< edm::View< reco::Electron > > token_electrons
Definition: SoftLepton.h:105
const edm::EDGetTokenT< edm::View< reco::GsfElectron > > token_gsfElectrons
Definition: SoftLepton.h:104
std::vector< SoftLeptonTagInfo > SoftLeptonTagInfoCollection
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
Definition: TrackFwd.h:32
const edm::InputTag m_leptons
Definition: SoftLepton.h:103
vector< PseudoJet > jets
tuple result
Definition: query.py:137
const edm::EDGetTokenT< reco::VertexCollection > token_primaryVertex
Definition: SoftLepton.h:102
const edm::InputTag m_leptonId
Definition: SoftLepton.h:111
edm::Ref< PFCandidateCollection > PFCandidateRef
persistent reference to a PFCandidate
bool isValid() const
Definition: HandleBase.h:75
const edm::InputTag m_leptonCands
Definition: SoftLepton.h:109
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
reco::SoftLeptonTagInfo tag(const edm::RefToBase< reco::Jet > &jet, const reco::TrackRefVector &tracks, const Leptons &leptons, const reco::Vertex &primaryVertex) const
Definition: SoftLepton.cc:268
const edm::EDGetTokenT< edm::View< reco::Jet > > token_jets
Definition: SoftLepton.h:101
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
std::map< unsigned int, float > LeptonIds
Definition: SoftLepton.h:65
static const reco::Vertex s_nominalBeamSpot
Definition: SoftLepton.h:126
muon::SelectionType m_muonSelection
Definition: SoftLepton.h:123
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:85
std::map< edm::RefToBase< reco::Track >, LeptonIds, TrackCompare > Leptons
Definition: SoftLepton.h:66
const edm::InputTag m_jets
Definition: SoftLepton.h:99
const TransientTrackBuilder * m_transientTrackBuilder
Definition: SoftLepton.h:115
const edm::EDGetTokenT< edm::View< reco::Track > > token_tracks
Definition: SoftLepton.h:108
tuple size
Write out results.
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > token_jtas
Definition: SoftLepton.h:100
GlobalVector SoftLepton::refineJetAxis ( const edm::RefToBase< reco::Jet > &  jet,
const reco::TrackRefVector tracks,
const edm::RefToBase< reco::Track > &  exclude = edm::RefToBase<reco::Track>() 
) const
protected

Definition at line 315 of file SoftLepton.cc.

References AXIS_CALORIMETRIC_NOLEPTON, AXIS_CHARGED_AVERAGE, AXIS_CHARGED_AVERAGE_NOLEPTON, AXIS_CHARGED_SUM, AXIS_CHARGED_SUM_NOLEPTON, edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), reco::TrackBase::eta(), edm::RefToBase< T >::isNonnull(), M_PI, m_refineJetAxis, reco::LeafCandidate::momentum(), reco::TrackBase::momentum(), or, perp(), reco::TrackBase::phi(), and reco::TrackBase::pt().

Referenced by tag().

319  {
320  math::XYZVector axis = jet->momentum();
321 
324 
325  double sum_pT = 0.;
326  double sum_eta_by_pT = 0.;
327  double sum_phi_by_pT = 0.;
328 
329  double perp;
330  double phi_rel;
331  double eta_rel;
332 
333  // refine jet eta and phi with charged tracks measurements, if available
334  for (reco::TrackRefVector::const_iterator track_it = tracks.begin(); track_it != tracks.end(); ++track_it ) {
335  const reco::Track & track = **track_it;
336 
337  perp = track.pt();
338  eta_rel = (double) track.eta() - axis.eta();
339  phi_rel = (double) track.phi() - axis.phi();
340  while (phi_rel < -M_PI) phi_rel += 2*M_PI;
341  while (phi_rel > M_PI) phi_rel -= 2*M_PI;
342 
343  sum_pT += perp;
344  sum_phi_by_pT += perp * phi_rel;
345  sum_eta_by_pT += perp * eta_rel;
346  }
347 
348  // "remove" excluded track
350  const reco::Track & track = *exclude;
351 
352  perp = track.pt();
353  eta_rel = (double) track.eta() - axis.eta();
354  phi_rel = (double) track.phi() - axis.phi();
355  while (phi_rel < -M_PI) phi_rel += 2*M_PI;
356  while (phi_rel > M_PI) phi_rel -= 2*M_PI;
357 
358  sum_pT -= perp;
359  sum_phi_by_pT -= perp * phi_rel;
360  sum_eta_by_pT -= perp * eta_rel;
361  }
362 
363  if (sum_pT > 1.) // avoid the case of only the lepton-track with small rounding errors
364  axis = math::RhoEtaPhiVector( axis.rho(), axis.eta() + sum_eta_by_pT / sum_pT, axis.phi() + sum_phi_by_pT / sum_pT);
365 
366  } else if (m_refineJetAxis == AXIS_CHARGED_SUM or
368  math::XYZVector sum;
369 
370  // recalculate the jet direction as the sum of charget tracks momenta
371  for (reco::TrackRefVector::const_iterator track_it = tracks.begin(); track_it != tracks.end(); ++track_it ) {
372  const reco::Track & track = **track_it;
373  sum += track.momentum();
374  }
375 
376  // "remove" excluded track
377  if (m_refineJetAxis == AXIS_CHARGED_SUM_NOLEPTON and exclude.isNonnull()) {
378  const reco::Track & track = *exclude;
379  sum -= track.momentum();
380  }
381 
382  if (sum.R() > 1.) // avoid the case of only the lepton-track with small rounding errors
383  axis = sum;
385  axis -= exclude->momentum();
386  }
387 
388  return GlobalVector(axis.x(), axis.y(), axis.z());
389 }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
virtual Vector momentum() const
spatial momentum vector
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:632
bool isNonnull() const
Checks for non-null.
Definition: RefToBase.h:330
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:662
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:255
RhoEtaPhiVectorD RhoEtaPhiVector
spatial vector with cylindrical internal representation using pseudorapidity
Definition: Vector3D.h:32
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:250
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:638
double pt() const
track transverse momentum
Definition: TrackBase.h:608
#define M_PI
unsigned int m_refineJetAxis
Definition: SoftLepton.h:118
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
T perp() const
Magnitude of transverse component.
Global3DVector GlobalVector
Definition: GlobalVector.h:10
double SoftLepton::relativeEta ( const math::XYZVector vector,
const math::XYZVector axis 
)
staticprotected

Definition at line 391 of file SoftLepton.cc.

References dot(), cmsBatch::log, and mag().

Referenced by tag().

391  {
392  double mag = vector.r() * axis.r();
393  double dot = vector.Dot(axis);
394  return -log((mag - dot)/(mag + dot)) / 2;
395 }
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
T dot(const Basic3DVector &v) const
Scalar product, or &quot;dot&quot; product, with a vector of same type.
tuple log
Definition: cmsBatch.py:341
reco::SoftLeptonTagInfo SoftLepton::tag ( const edm::RefToBase< reco::Jet > &  jet,
const reco::TrackRefVector tracks,
const Leptons leptons,
const reco::Vertex primaryVertex 
) const

Definition at line 268 of file SoftLepton.cc.

References boostedPPar(), TransientTrackBuilder::build(), deltaR(), reco::SoftLeptonProperties::deltaR, reco::SoftLeptonProperties::etaRel, info(), reco::TemplatedSoftLeptonTagInfo< REF >::insert(), m_chi2Cut, m_deltaRCut, m_transientTrackBuilder, reco::SoftLeptonProperties::p0Par, reco::SoftLeptonProperties::ptRel, reco::SoftLeptonProperties::ratio, reco::SoftLeptonProperties::ratioRel, refineJetAxis(), relativeEta(), reco::JetTagInfo::setJetRef(), reco::SoftLeptonProperties::setQuality(), IPTools::signedImpactParameter3D(), IPTools::signedTransverseImpactParameter(), Measurement1D::significance(), reco::SoftLeptonProperties::sip2d, reco::SoftLeptonProperties::sip2dsig, reco::SoftLeptonProperties::sip3d, reco::SoftLeptonProperties::sip3dsig, Measurement1D::value(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by produce(), and Inspector.Inspector::SetTag().

273  {
275  info.setJetRef( jet );
276 
277  for(Leptons::const_iterator lepton = leptons.begin(); lepton != leptons.end(); ++lepton) {
278  const math::XYZVector & lepton_momentum = lepton->first->momentum();
279  if (m_chi2Cut > 0.0 && lepton->first->normalizedChi2() > m_chi2Cut)
280  continue;
281 
282  const GlobalVector jetAxis = refineJetAxis( jet, tracks, lepton->first );
283  const math::XYZVector axis( jetAxis.x(), jetAxis.y(), jetAxis.z());
284  float deltaR = Geom::deltaR(lepton_momentum, axis);
285  if (deltaR > m_deltaRCut)
286  continue;
287 
288  reco::SoftLeptonProperties properties;
289 
290  reco::TransientTrack transientTrack = m_transientTrackBuilder->build(*lepton->first);
291  Measurement1D ip2d = IPTools::signedTransverseImpactParameter( transientTrack, jetAxis, primaryVertex ).second;
292  Measurement1D ip3d = IPTools::signedImpactParameter3D( transientTrack, jetAxis, primaryVertex ).second;
293  properties.sip2dsig = ip2d.significance();
294  properties.sip3dsig = ip3d.significance();
295  properties.sip2d = ip2d.value();
296  properties.sip3d = ip3d.value();
297  properties.deltaR = deltaR;
298  properties.ptRel = Perp( lepton_momentum, axis );
299  properties.p0Par = boostedPPar( lepton_momentum, axis );
300  properties.etaRel = relativeEta( lepton_momentum, axis );
301  properties.ratio = lepton_momentum.R() / axis.R();
302  properties.ratioRel = lepton_momentum.Dot(axis) / axis.Mag2();
303 
304  for(LeptonIds::const_iterator iter = lepton->second.begin(); iter != lepton->second.end(); ++iter)
305  properties.setQuality(static_cast<SoftLeptonProperties::Quality::Generic>(iter->first), iter->second);
306 
307  info.insert( lepton->first, properties );
308  }
309 
310  return info;
311 }
static const TGPicture * info(bool iBackgroundIsBlack)
std::pair< bool, Measurement1D > signedTransverseImpactParameter(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:50
reco::TransientTrack build(const reco::Track *p) const
T y() const
Definition: PV3DBase.h:63
std::pair< bool, Measurement1D > signedImpactParameter3D(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:71
void setJetRef(const edm::Ref< T > &jetRef)
Definition: JetTagInfo.h:25
double m_chi2Cut
Definition: SoftLepton.h:120
void setQuality(Quality::Generic qual, float value)
static double relativeEta(const math::XYZVector &vector, const math::XYZVector &axis)
Definition: SoftLepton.cc:391
GlobalVector refineJetAxis(const edm::RefToBase< reco::Jet > &jet, const reco::TrackRefVector &tracks, const edm::RefToBase< reco::Track > &exclude=edm::RefToBase< reco::Track >()) const
Definition: SoftLepton.cc:315
T z() const
Definition: PV3DBase.h:64
double m_deltaRCut
Definition: SoftLepton.h:119
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
void insert(const REF &lepton, const SoftLeptonProperties &properties)
double significance() const
Definition: Measurement1D.h:32
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
double value() const
Definition: Measurement1D.h:28
const TransientTrackBuilder * m_transientTrackBuilder
Definition: SoftLepton.h:115
T x() const
Definition: PV3DBase.h:62
static double boostedPPar(const math::XYZVector &vector, const math::XYZVector &axis)
Definition: SoftLepton.cc:398

Member Data Documentation

double SoftLepton::m_chi2Cut
private

Definition at line 120 of file SoftLepton.h.

Referenced by tag().

double SoftLepton::m_deltaRCut
private

Definition at line 119 of file SoftLepton.h.

Referenced by tag().

const edm::InputTag SoftLepton::m_jets
private

Definition at line 99 of file SoftLepton.h.

Referenced by produce().

const edm::InputTag SoftLepton::m_leptonCands
private

Definition at line 109 of file SoftLepton.h.

Referenced by produce().

const edm::InputTag SoftLepton::m_leptonId
private

Definition at line 111 of file SoftLepton.h.

Referenced by produce().

const edm::InputTag SoftLepton::m_leptons
private

Definition at line 103 of file SoftLepton.h.

Referenced by produce().

muon::SelectionType SoftLepton::m_muonSelection
private

Definition at line 123 of file SoftLepton.h.

Referenced by produce().

unsigned int SoftLepton::m_refineJetAxis
private

Definition at line 118 of file SoftLepton.h.

Referenced by refineJetAxis().

const TransientTrackBuilder* SoftLepton::m_transientTrackBuilder
private

Definition at line 115 of file SoftLepton.h.

Referenced by produce(), and tag().

const reco::Vertex SoftLepton::s_nominalBeamSpot
staticprivate

Definition at line 126 of file SoftLepton.h.

Referenced by produce().

const edm::EDGetTokenT<edm::View<reco::Electron> > SoftLepton::token_electrons
private

Definition at line 105 of file SoftLepton.h.

Referenced by produce().

const edm::EDGetTokenT<edm::View<reco::GsfElectron> > SoftLepton::token_gsfElectrons
private

Definition at line 104 of file SoftLepton.h.

Referenced by produce().

const edm::EDGetTokenT<edm::View<reco::Jet> > SoftLepton::token_jets
private

Definition at line 101 of file SoftLepton.h.

Referenced by produce().

const edm::EDGetTokenT<reco::JetTracksAssociationCollection> SoftLepton::token_jtas
private

Definition at line 100 of file SoftLepton.h.

Referenced by produce().

const edm::EDGetTokenT<edm::ValueMap<float> > SoftLepton::token_leptonCands
private

Definition at line 110 of file SoftLepton.h.

Referenced by produce().

const edm::EDGetTokenT<edm::ValueMap<float> > SoftLepton::token_leptonId
private

Definition at line 112 of file SoftLepton.h.

Referenced by produce().

const edm::EDGetTokenT<edm::View<reco::Muon> > SoftLepton::token_muons
private

Definition at line 107 of file SoftLepton.h.

Referenced by produce().

const edm::EDGetTokenT<reco::PFCandidateCollection> SoftLepton::token_pfElectrons
private

Definition at line 106 of file SoftLepton.h.

Referenced by produce().

const edm::EDGetTokenT<reco::VertexCollection> SoftLepton::token_primaryVertex
private

Definition at line 102 of file SoftLepton.h.

Referenced by produce().

const edm::EDGetTokenT<edm::View<reco::Track> > SoftLepton::token_tracks
private

Definition at line 108 of file SoftLepton.h.

Referenced by produce().