CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ZMuMuMuonUserData Class Reference
Inheritance diagram for ZMuMuMuonUserData:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ZMuMuMuonUserData (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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)
 
 ~ProducerBase () noexcept(false) override
 
- 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

template<typename T >
vector< double > isolation (const T &t, double ptThreshold, double etEcalThreshold, double etHcalThreshold, double dRVetoTrk, double dRTrk, double dREcal, double dRHcal, double alpha, double beta)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

double alpha_
 
EDGetTokenT< BeamSpotbeamSpotToken_
 
double beta_
 
double dREcal_
 
double dRHcal_
 
double dRTrk_
 
double dRVetoTrk_
 
double etEcalThreshold_
 
double etHcalThreshold_
 
string hltPath_
 
EDGetTokenT< VertexCollectionprimaryVerticesToken_
 
double ptThreshold_
 
EDGetTokenT< vector< pat::Muon > > srcToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 28 of file ZMuMuMuonUserData.cc.

Constructor & Destructor Documentation

ZMuMuMuonUserData::ZMuMuMuonUserData ( const edm::ParameterSet cfg)

Definition at line 110 of file ZMuMuMuonUserData.cc.

111  : srcToken_(consumes<vector<pat::Muon> >(cfg.getParameter<InputTag>("src"))),
112  beamSpotToken_(consumes<BeamSpot>(cfg.getParameter<InputTag>("beamSpot"))),
113  primaryVerticesToken_(consumes<VertexCollection>(cfg.getParameter<InputTag>("primaryVertices"))),
114  alpha_(cfg.getParameter<double>("alpha")),
115  beta_(cfg.getParameter<double>("beta")),
116  ptThreshold_(cfg.getParameter<double>("ptThreshold")),
117  etEcalThreshold_(cfg.getParameter<double>("etEcalThreshold")),
118  etHcalThreshold_(cfg.getParameter<double>("etHcalThreshold")),
119  dRVetoTrk_(cfg.getParameter<double>("dRVetoTrk")),
120  dRTrk_(cfg.getParameter<double>("dRTrk")),
121  dREcal_(cfg.getParameter<double>("dREcal")),
122  dRHcal_(cfg.getParameter<double>("dRHcal")),
123  hltPath_(cfg.getParameter<std::string>("hltPath")) {
124  produces<std::vector<pat::Muon> >();
125 }
T getParameter(std::string const &) const
EDGetTokenT< VertexCollection > primaryVerticesToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
EDGetTokenT< vector< pat::Muon > > srcToken_
EDGetTokenT< BeamSpot > beamSpotToken_

Member Function Documentation

template<typename T >
vector< double > ZMuMuMuonUserData::isolation ( const T t,
double  ptThreshold,
double  etEcalThreshold,
double  etHcalThreshold,
double  dRVetoTrk,
double  dRTrk,
double  dREcal,
double  dRHcal,
double  alpha,
double  beta 
)
private

Definition at line 55 of file ZMuMuMuonUserData.cc.

References zMuMuMuonUserData::beta, DeadROC_duringRun::dir, pat::EcalIso, pat::HcalIso, objects.autophobj::relIso, reco::IsoDeposit::sumWithin(), pat::TrackIso, and ZMuMuCategoriesSequences_cff::trkIso.

Referenced by produce().

64  {
65  vector<double> iso;
66  const pat::IsoDeposit *trkIso = t.isoDeposit(pat::TrackIso);
67  const pat::IsoDeposit *ecalIso = t.isoDeposit(pat::EcalIso);
68  const pat::IsoDeposit *hcalIso = t.isoDeposit(pat::HcalIso);
69 
70  Direction dir = Direction(t.eta(), t.phi());
71 
73  vetosTrk.push_back(new ConeVeto(dir, dRVetoTrk));
74  vetosTrk.push_back(new ThresholdVeto(ptThreshold));
75 
76  pat::IsoDeposit::AbsVetos vetosEcal;
77  vetosEcal.push_back(new ConeVeto(dir, 0.));
78  vetosEcal.push_back(new ThresholdVeto(etEcalThreshold));
79 
80  pat::IsoDeposit::AbsVetos vetosHcal;
81  vetosHcal.push_back(new ConeVeto(dir, 0.));
82  vetosHcal.push_back(new ThresholdVeto(etHcalThreshold));
83 
84  double isovalueTrk = (trkIso->sumWithin(dRTrk, vetosTrk));
85  double isovalueEcal = (ecalIso->sumWithin(dREcal, vetosEcal));
86  double isovalueHcal = (hcalIso->sumWithin(dRHcal, vetosHcal));
87 
88  iso.push_back(isovalueTrk);
89  //cout<<"isoTrk"<<isovalueTrk<<" "<<t.trackIso()<<endl;
90  iso.push_back(isovalueEcal);
91  //cout<<"isoEcal"<<isovalueEcal<<" "<<t.ecalIso()<<endl;
92  iso.push_back(isovalueHcal);
93  //cout<<"isoHcal"<<isovalueHcal<<" "<<t.hcalIso()<<endl;
94  //double isovalueTrk = t.trackIso();
95  //double isovalueEcal = t.ecalIso();
96  //double isovalueHcal = t.hcalIso();
97 
98  //double iso = isovalueTrk + isovalueEcal + isovalueHcal;
99  double combIso =
100  alpha * (((1 + beta) / 2 * isovalueEcal) + ((1 - beta) / 2 * isovalueHcal)) + ((1 - alpha) * isovalueTrk);
101  iso.push_back(combIso);
102  //cout<<"combIso"<<iso[3]<<endl;
103 
104  double relIso = combIso /= t.pt();
105  iso.push_back(relIso);
106  //cout<<"relIso"<<iso[4]<<endl;
107  return iso;
108 }
double sumWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
Definition: IsoDeposit.cc:137
alpha
zGenParticlesMatch = cms.InputTag(""),
isodeposit::AbsVetos AbsVetos
Definition: IsoDeposit.h:53
void ZMuMuMuonUserData::produce ( edm::Event evt,
const edm::EventSetup  
)
overrideprivate

Definition at line 127 of file ZMuMuMuonUserData.cc.

References pat::PATObject< ObjectType >::addUserFloat(), alpha_, beamSpotToken_, beta_, reco::Muon::calEnergy(), DEFINE_FWK_MODULE, dREcal_, dRHcal_, dRTrk_, dRVetoTrk_, reco::MuonEnergy::em, etEcalThreshold_, etHcalThreshold_, edm::Event::getByToken(), pat::Muon::globalTrack(), reco::MuonEnergy::had, hltPath_, mps_fire::i, pat::Muon::innerTrack(), reco::Muon::isGlobalMuon(), edm::Ref< C, T, F >::isNonnull(), isolation(), reco::Muon::isStandAloneMuon(), reco::Muon::isTrackerMuon(), visualization-live-secondInstance_cfg::m, eostools::move(), PDWG_BPHSkim_cff::muons, reco::Muon::numberOfChambers(), reco::Muon::numberOfMatches(), pat::Muon::outerTrack(), reco::BeamSpot::position(), zMuMuMuonUserData::primaryVertices, primaryVerticesToken_, ptThreshold_, edm::Event::put(), pat::Lepton< LeptonType >::setIsolation(), srcToken_, pat::PATObject< ObjectType >::triggerObjectMatchesByPath(), pat::User1Iso, pat::User2Iso, pat::User3Iso, pat::User4Iso, and pat::User5Iso.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

127  {
129  evt.getByToken(srcToken_, muons);
130 
131  Handle<BeamSpot> beamSpotHandle;
132  evt.getByToken(beamSpotToken_, beamSpotHandle);
133 
134  Handle<VertexCollection> primaryVertices; // Collection of primary Vertices
135  evt.getByToken(primaryVerticesToken_, primaryVertices);
136 
137  unique_ptr<vector<pat::Muon> > muonColl(new vector<pat::Muon>(*muons));
138  for (unsigned int i = 0; i < muonColl->size(); ++i) {
139  pat::Muon &m = (*muonColl)[i];
140  //pat::Muon *mu = new pat::Muon(m);
141  vector<double> iso = isolation(
143  m.setIsolation(pat::User1Iso, iso[0]);
144  //cout<<"muon User1Iso "<<iso[0]<<endl;
145  m.setIsolation(pat::User2Iso, iso[1]);
146  //cout<<"iso2 "<<iso[1]<<endl;
147  m.setIsolation(pat::User3Iso, iso[2]);
148  //cout<<"iso3 "<<iso[2]<<endl;
149  m.setIsolation(pat::User4Iso, iso[3]);
150  //cout<<"iso4 "<<iso[3]<<endl;
151  m.setIsolation(pat::User5Iso, iso[4]);
152  //cout<<"iso5 "<<iso[4]<<endl;
153  float zDauMuEnergyEm = m.calEnergy().em;
154  float zDauMuEnergyHad = m.calEnergy().had;
155  TrackRef muGlbRef = m.globalTrack();
156  TrackRef muTrkRef = m.innerTrack();
157  TrackRef muSaRef = m.outerTrack();
158  float zDaudxyFromBS = -1;
159  float zDaudzFromBS = -1;
160  float zDaudxyFromPV = -1;
161  float zDaudzFromPV = -1;
162  int zDauNofMuChambers = m.numberOfChambers();
163  int zDauNofMuMatches = m.numberOfMatches();
164  // for the following variables looking at global/trk and sta at the same time
165  float zDauChi2 = -1;
166  float zDauTrkChi2 = -1;
167  float zDauSaChi2 = -1;
168  float zDauNofMuonHits = -1;
169  float zDauSaNofMuonHits = -1;
170  float zDauNofStripHits = -1;
171  float zDauTrkNofStripHits = -1;
172  float zDauNofPixelHits = -1;
173  float zDauTrkNofPixelHits = -1;
174 
175  if (muGlbRef.isNonnull() && m.isGlobalMuon() == true) {
176  zDaudxyFromBS = muGlbRef->dxy(beamSpotHandle->position());
177  zDaudzFromBS = muGlbRef->dz(beamSpotHandle->position());
178  zDaudxyFromPV = muGlbRef->dxy(primaryVertices->begin()->position());
179  zDaudzFromPV = muGlbRef->dz(primaryVertices->begin()->position());
180  zDauChi2 = muGlbRef->normalizedChi2();
181  zDauTrkChi2 = muTrkRef->normalizedChi2();
182  zDauSaChi2 = muSaRef->normalizedChi2();
183  zDauNofMuonHits = muGlbRef->hitPattern().numberOfValidMuonHits();
184  zDauSaNofMuonHits = muSaRef->hitPattern().numberOfValidMuonHits();
185  zDauNofStripHits = muGlbRef->hitPattern().numberOfValidStripHits();
186  zDauTrkNofStripHits = muTrkRef->hitPattern().numberOfValidStripHits();
187  zDauNofPixelHits = muGlbRef->hitPattern().numberOfValidPixelHits();
188  zDauTrkNofPixelHits = muTrkRef->hitPattern().numberOfValidPixelHits();
189  } else if (muSaRef.isNonnull() && m.isStandAloneMuon() == true) {
190  zDaudxyFromBS = muSaRef->dxy(beamSpotHandle->position());
191  zDaudzFromBS = muSaRef->dz(beamSpotHandle->position());
192  zDaudxyFromPV = muSaRef->dxy(primaryVertices->begin()->position());
193  zDaudzFromPV = muSaRef->dz(primaryVertices->begin()->position());
194  zDauSaChi2 = muSaRef->normalizedChi2();
195  zDauSaNofMuonHits = muSaRef->hitPattern().numberOfValidMuonHits();
196 
197  } else if (muTrkRef.isNonnull() && m.isTrackerMuon() == true) {
198  zDaudxyFromBS = muTrkRef->dxy(beamSpotHandle->position());
199  zDaudzFromBS = muTrkRef->dz(beamSpotHandle->position());
200  zDaudxyFromPV = muTrkRef->dxy(primaryVertices->begin()->position());
201  zDaudzFromPV = muTrkRef->dz(primaryVertices->begin()->position());
202  zDauTrkChi2 = muTrkRef->normalizedChi2();
203  zDauTrkNofStripHits = muTrkRef->hitPattern().numberOfValidStripHits();
204  zDauTrkNofPixelHits = muTrkRef->hitPattern().numberOfValidPixelHits();
205  }
206 
208  float muHLTBit;
209  int dimTrig = muHLTMatches.size();
210  if (dimTrig != 0) {
211  muHLTBit = 1;
212  } else {
213  muHLTBit = 0;
214  }
215  m.addUserFloat("zDau_dxyFromBS", zDaudxyFromBS);
216  m.addUserFloat("zDau_dzFromBS", zDaudzFromBS);
217  m.addUserFloat("zDau_dxyFromPV", zDaudxyFromPV);
218  m.addUserFloat("zDau_dzFromPV", zDaudzFromPV);
219  m.addUserFloat("zDau_HLTBit", muHLTBit);
220  m.addUserFloat("zDau_dzFromPV", zDaudzFromPV);
221  m.addUserFloat("zDau_Chi2", zDauChi2);
222  m.addUserFloat("zDau_TrkChi2", zDauTrkChi2);
223  m.addUserFloat("zDau_SaChi2", zDauSaChi2);
224  m.addUserFloat("zDau_NofMuonHits", zDauNofMuonHits);
225  m.addUserFloat("zDau_SaNofMuonHits", zDauSaNofMuonHits);
226  m.addUserFloat("zDau_NofStripHits", zDauNofStripHits);
227  m.addUserFloat("zDau_TrkNofStripHits", zDauTrkNofStripHits);
228  m.addUserFloat("zDau_NofPixelHits", zDauNofPixelHits);
229  m.addUserFloat("zDau_TrkNofPixelHits", zDauTrkNofPixelHits);
230  m.addUserFloat("zDau_NofMuChambers", zDauNofMuChambers);
231  m.addUserFloat("zDau_NofMuMatches", zDauNofMuMatches);
232  m.addUserFloat("zDau_MuEnergyEm", zDauMuEnergyEm);
233  m.addUserFloat("zDau_MuEnergyHad", zDauMuEnergyHad);
234  }
235 
236  evt.put(std::move(muonColl));
237 }
EDGetTokenT< VertexCollection > primaryVerticesToken_
vector< double > isolation(const T &t, double ptThreshold, double etEcalThreshold, double etHcalThreshold, double dRVetoTrk, double dRTrk, double dREcal, double dRHcal, double alpha, double beta)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
void setIsolation(IsolationKeys key, float value)
Definition: Lepton.h:115
bool isStandAloneMuon() const override
Definition: Muon.h:300
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
void addUserFloat(const std::string &label, float data, const bool overwrite=false)
Set user-defined float.
Definition: PATObject.h:897
bool isTrackerMuon() const override
Definition: Muon.h:299
EDGetTokenT< vector< pat::Muon > > srcToken_
reco::TrackRef innerTrack() const override
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
Definition: Muon.h:72
reco::TrackRef outerTrack() const override
reference to Track reconstructed in the muon detector only (reimplemented from reco::Muon) ...
Definition: Muon.h:76
bool isGlobalMuon() const override
Definition: Muon.h:298
EDGetTokenT< BeamSpot > beamSpotToken_
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:682
MuonEnergy calEnergy() const
get energy deposition information
Definition: Muon.h:106
reco::TrackRef globalTrack() const override
reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon) ...
Definition: Muon.h:80
int numberOfChambers() const
Definition: Muon.h:252
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
const Point & position() const
position
Definition: BeamSpot.h:59
Analysis-level muon class.
Definition: Muon.h:51
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

double ZMuMuMuonUserData::alpha_
private

Definition at line 38 of file ZMuMuMuonUserData.cc.

Referenced by produce().

EDGetTokenT<BeamSpot> ZMuMuMuonUserData::beamSpotToken_
private

Definition at line 36 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::beta_
private

Definition at line 38 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::dREcal_
private

Definition at line 39 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::dRHcal_
private

Definition at line 39 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::dRTrk_
private

Definition at line 39 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::dRVetoTrk_
private

Definition at line 39 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::etEcalThreshold_
private

Definition at line 39 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::etHcalThreshold_
private

Definition at line 39 of file ZMuMuMuonUserData.cc.

Referenced by produce().

string ZMuMuMuonUserData::hltPath_
private

Definition at line 40 of file ZMuMuMuonUserData.cc.

Referenced by produce().

EDGetTokenT<VertexCollection> ZMuMuMuonUserData::primaryVerticesToken_
private

Definition at line 37 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::ptThreshold_
private

Definition at line 39 of file ZMuMuMuonUserData.cc.

Referenced by produce().

EDGetTokenT<vector<pat::Muon> > ZMuMuMuonUserData::srcToken_
private

Definition at line 35 of file ZMuMuMuonUserData.cc.

Referenced by produce().