CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
MuMuForEmbeddingSelector Class Reference

#include <TauAnalysis/EmbeddingProducer/plugins/MuMuForEmbeddingSelector.cc>

Inheritance diagram for MuMuForEmbeddingSelector:
edm::stream::EDProducer<>

Public Member Functions

 MuMuForEmbeddingSelector (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpottheBeamSpotLabel_
 
edm::EDGetTokenT< edm::View< pat::MET > > theMETLabel_
 
edm::EDGetTokenT< edm::View< pat::MET > > thePuppiMETLabel_
 
edm::EDGetTokenT< reco::VertexCollectiontheVertexLabel_
 
bool use_zmass = false
 
edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > ZmumuCandidates_
 

Static Private Attributes

static constexpr double zmass = 91.1876
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 46 of file MuMuForEmbeddingSelector.cc.

Constructor & Destructor Documentation

◆ MuMuForEmbeddingSelector()

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

Definition at line 76 of file MuMuForEmbeddingSelector.cc.

References edm::ParameterSet::getParameter(), theBeamSpotLabel_, theMETLabel_, thePuppiMETLabel_, theVertexLabel_, and use_zmass.

78  iConfig.getParameter<edm::InputTag>("ZmumuCandidatesCollection"))) {
79  use_zmass = iConfig.getParameter<bool>("use_zmass");
80  produces<edm::RefVector<pat::MuonCollection>>();
81  produces<float>("oldMass");
82  produces<float>("newMass");
83  produces<float>("nPairCandidates");
84  produces<bool>("isMediumLeadingMuon");
85  produces<bool>("isTightLeadingMuon");
86  produces<bool>("isMediumTrailingMuon");
87  produces<bool>("isTightTrailingMuon");
88  produces<float>("initialMETEt");
89  produces<float>("initialMETphi");
90  produces<float>("initialPuppiMETEt");
91  produces<float>("initialPuppiMETphi");
92  theVertexLabel_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("inputTagVertex"));
93  theBeamSpotLabel_ = consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("inputTagBeamSpot"));
94  theMETLabel_ = consumes<edm::View<pat::MET>>(iConfig.getParameter<edm::InputTag>("Met"));
95  thePuppiMETLabel_ = consumes<edm::View<pat::MET>>(iConfig.getParameter<edm::InputTag>("PuppiMet"));
96  // now do what ever other initialization is needed
97 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< edm::View< pat::MET > > thePuppiMETLabel_
edm::EDGetTokenT< reco::VertexCollection > theVertexLabel_
edm::EDGetTokenT< reco::BeamSpot > theBeamSpotLabel_
edm::EDGetTokenT< edm::View< pat::MET > > theMETLabel_
edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > ZmumuCandidates_

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 183 of file MuMuForEmbeddingSelector.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

183  {
184  // The following says we do not know what parameters are allowed so do no validation
185  // Please change this to state exactly what you do use, even if it is no parameters
187  desc.setUnknown();
188  descriptions.addDefault(desc);
189 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ produce()

void MuMuForEmbeddingSelector::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 104 of file MuMuForEmbeddingSelector.cc.

References funct::abs(), isoTrack_cff::beamSpot, edm::RefToBase< T >::castTo(), reco::CompositeCandidate::daughter(), iEvent, muon::isMediumMuon(), muon::isTightMuon(), reco::LeafCandidate::mass(), reco::Candidate::masterClone(), BTaggingMonitor_cfi::met, eostools::move(), BeamMonitor_cff::primaryVertex, copyEcalPFRecHitThresholds_cfg::prod, theBeamSpotLabel_, theMETLabel_, thePuppiMETLabel_, theVertexLabel_, use_zmass, bphysicsOniaDQM_cfi::vertex, L1BJetProducer_cff::vtx, zmass, SelectingProcedure_cff::ZmumuCandidates, and ZmumuCandidates_.

104  {
105  using namespace edm;
107  iEvent.getByToken(ZmumuCandidates_, ZmumuCandidatesHandle);
108  edm::View<reco::CompositeCandidate> ZmumuCandidates = *ZmumuCandidatesHandle;
109  const reco::CompositeCandidate *chosenZCand = nullptr;
110  const reco::CompositeCandidate *chosenZCand_zmass = nullptr;
111  const reco::CompositeCandidate *chosenZCand_largest = nullptr;
112  double massDifference = 9999;
114  iEvent.getByToken(theBeamSpotLabel_, beamSpot);
116  iEvent.getByToken(theVertexLabel_, vertex);
118  iEvent.getByToken(theMETLabel_, met);
120  iEvent.getByToken(thePuppiMETLabel_, puppimet);
121  // get primary vertex
122  reco::Vertex::Point posVtx;
123  reco::Vertex::Error errVtx;
124  for (const auto &vtx : *vertex) {
125  if (vtx.isValid() && !vtx.isFake()) {
126  posVtx = vtx.position();
127  errVtx = vtx.error();
128  break;
129  }
130  }
131  reco::Vertex primaryVertex(posVtx, errVtx);
132 
134  iZCand != ZmumuCandidates.end();
135  ++iZCand) {
136  if (std::abs(zmass - iZCand->mass()) < massDifference) {
137  massDifference = std::abs(zmass - iZCand->mass());
138  chosenZCand_zmass = &(*iZCand);
139  }
140  }
142  iZCand != ZmumuCandidates.end();
143  ++iZCand) {
144  if (chosenZCand_largest == nullptr) {
145  chosenZCand_largest = &(*iZCand);
146  } else {
147  if (iZCand->mass() > chosenZCand_largest->mass()) {
148  chosenZCand_largest = &(*iZCand);
149  }
150  }
151  }
152  if (use_zmass) {
153  chosenZCand = chosenZCand_zmass;
154  } else {
155  chosenZCand = chosenZCand_largest;
156  }
157 
158  std::unique_ptr<edm::RefVector<pat::MuonCollection>> prod(new edm::RefVector<pat::MuonCollection>());
159  prod->reserve(2);
160  prod->push_back(chosenZCand->daughter(0)->masterClone().castTo<pat::MuonRef>());
161  prod->push_back(chosenZCand->daughter(1)->masterClone().castTo<pat::MuonRef>());
162  iEvent.put(std::move(prod));
163  iEvent.put(std::make_unique<float>(chosenZCand_zmass->mass()), "oldMass");
164  iEvent.put(std::make_unique<float>(chosenZCand_largest->mass()), "newMass");
165  iEvent.put(std::make_unique<float>(ZmumuCandidates.size()), "nPairCandidates");
166  iEvent.put(std::make_unique<bool>(chosenZCand->daughter(0)->masterClone().castTo<pat::MuonRef>()->isMediumMuon()),
167  "isMediumLeadingMuon");
168  iEvent.put(std::make_unique<bool>(
170  "isTightLeadingMuon");
171  iEvent.put(std::make_unique<bool>(chosenZCand->daughter(1)->masterClone().castTo<pat::MuonRef>()->isMediumMuon()),
172  "isMediumTrailingMuon");
173  iEvent.put(std::make_unique<bool>(
175  "isTightTrailingMuon");
176  iEvent.put(std::make_unique<float>(met->at(0).et()), "initialMETEt");
177  iEvent.put(std::make_unique<float>(met->at(0).phi()), "initialMETphi");
178  iEvent.put(std::make_unique<float>(puppimet->at(0).et()), "initialPuppiMETEt");
179  iEvent.put(std::make_unique<float>(puppimet->at(0).phi()), "initialPuppiMETphi");
180 }
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
edm::EDGetTokenT< edm::View< pat::MET > > thePuppiMETLabel_
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
static constexpr double zmass
REF castTo() const
Definition: RefToBase.h:243
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:45
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< reco::VertexCollection > theVertexLabel_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
edm::EDGetTokenT< reco::BeamSpot > theBeamSpotLabel_
edm::EDGetTokenT< edm::View< pat::MET > > theMETLabel_
HLT enums.
double mass() const final
mass
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:88
edm::EDGetTokenT< edm::View< reco::CompositeCandidate > > ZmumuCandidates_
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
primaryVertex
hltOfflineBeamSpot for HLTMON
def move(src, dest)
Definition: eostools.py:511
virtual const CandidateBaseRef & masterClone() const =0

Member Data Documentation

◆ theBeamSpotLabel_

edm::EDGetTokenT<reco::BeamSpot> MuMuForEmbeddingSelector::theBeamSpotLabel_
private

Definition at line 58 of file MuMuForEmbeddingSelector.cc.

Referenced by MuMuForEmbeddingSelector(), and produce().

◆ theMETLabel_

edm::EDGetTokenT<edm::View<pat::MET> > MuMuForEmbeddingSelector::theMETLabel_
private

Definition at line 59 of file MuMuForEmbeddingSelector.cc.

Referenced by MuMuForEmbeddingSelector(), and produce().

◆ thePuppiMETLabel_

edm::EDGetTokenT<edm::View<pat::MET> > MuMuForEmbeddingSelector::thePuppiMETLabel_
private

Definition at line 60 of file MuMuForEmbeddingSelector.cc.

Referenced by MuMuForEmbeddingSelector(), and produce().

◆ theVertexLabel_

edm::EDGetTokenT<reco::VertexCollection> MuMuForEmbeddingSelector::theVertexLabel_
private

Definition at line 57 of file MuMuForEmbeddingSelector.cc.

Referenced by MuMuForEmbeddingSelector(), and produce().

◆ use_zmass

bool MuMuForEmbeddingSelector::use_zmass = false
private

Definition at line 61 of file MuMuForEmbeddingSelector.cc.

Referenced by MuMuForEmbeddingSelector(), and produce().

◆ zmass

constexpr double MuMuForEmbeddingSelector::zmass = 91.1876
staticprivate

Definition at line 62 of file MuMuForEmbeddingSelector.cc.

Referenced by produce().

◆ ZmumuCandidates_

edm::EDGetTokenT<edm::View<reco::CompositeCandidate> > MuMuForEmbeddingSelector::ZmumuCandidates_
private

Definition at line 56 of file MuMuForEmbeddingSelector.cc.

Referenced by produce().