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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > 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)
 

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
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)
 
- 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 28 of file ZMuMuMuonUserData.cc.

Constructor & Destructor Documentation

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

Definition at line 91 of file ZMuMuMuonUserData.cc.

91  :
92  srcToken_(consumes<vector<pat::Muon> > ( cfg.getParameter<InputTag>( "src" ) ) ),
93  beamSpotToken_(consumes<BeamSpot> (cfg.getParameter<InputTag>( "beamSpot" ) ) ),
94  primaryVerticesToken_(consumes<VertexCollection> (cfg.getParameter<InputTag>( "primaryVertices" ) ) ),
95  alpha_(cfg.getParameter<double>("alpha") ),
96  beta_(cfg.getParameter<double>("beta") ),
97  ptThreshold_(cfg.getParameter<double >("ptThreshold") ),
98  etEcalThreshold_(cfg.getParameter<double >("etEcalThreshold") ),
99  etHcalThreshold_(cfg.getParameter<double >("etHcalThreshold") ),
100  dRVetoTrk_(cfg.getParameter<double >("dRVetoTrk") ),
101  dRTrk_(cfg.getParameter<double >("dRTrk") ),
102  dREcal_(cfg.getParameter<double >("dREcal") ),
103  dRHcal_(cfg.getParameter<double >("dRHcal") ),
104  hltPath_(cfg.getParameter<std::string >("hltPath") ){
105  produces<std::vector<pat::Muon> >();
106 }
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 45 of file ZMuMuMuonUserData.cc.

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

Referenced by produce().

45  {
46 
47  vector<double> iso;
48  const pat::IsoDeposit * trkIso = t.isoDeposit(pat::TrackIso);
49  const pat::IsoDeposit * ecalIso = t.isoDeposit(pat::EcalIso);
50  const pat::IsoDeposit * hcalIso = t.isoDeposit(pat::HcalIso);
51 
52  Direction dir = Direction(t.eta(), t.phi());
53 
55  vetosTrk.push_back(new ConeVeto( dir, dRVetoTrk ));
56  vetosTrk.push_back(new ThresholdVeto( ptThreshold ));
57 
58  pat::IsoDeposit::AbsVetos vetosEcal;
59  vetosEcal.push_back(new ConeVeto( dir, 0.));
60  vetosEcal.push_back(new ThresholdVeto( etEcalThreshold ));
61 
62  pat::IsoDeposit::AbsVetos vetosHcal;
63  vetosHcal.push_back(new ConeVeto( dir, 0. ));
64  vetosHcal.push_back(new ThresholdVeto( etHcalThreshold ));
65 
66  double isovalueTrk = (trkIso->sumWithin(dRTrk,vetosTrk));
67  double isovalueEcal = (ecalIso->sumWithin(dREcal,vetosEcal));
68  double isovalueHcal = (hcalIso->sumWithin(dRHcal,vetosHcal));
69 
70  iso.push_back(isovalueTrk);
71  //cout<<"isoTrk"<<isovalueTrk<<" "<<t.trackIso()<<endl;
72  iso.push_back(isovalueEcal);
73  //cout<<"isoEcal"<<isovalueEcal<<" "<<t.ecalIso()<<endl;
74  iso.push_back(isovalueHcal);
75  //cout<<"isoHcal"<<isovalueHcal<<" "<<t.hcalIso()<<endl;
76  //double isovalueTrk = t.trackIso();
77  //double isovalueEcal = t.ecalIso();
78  //double isovalueHcal = t.hcalIso();
79 
80  //double iso = isovalueTrk + isovalueEcal + isovalueHcal;
81  double combIso = alpha*( ((1+beta)/2*isovalueEcal) + ((1-beta)/2*isovalueHcal) ) + ((1-alpha)*isovalueTrk);
82  iso.push_back(combIso);
83  //cout<<"combIso"<<iso[3]<<endl;
84 
85  double relIso = combIso /= t.pt();
86  iso.push_back(relIso);
87  //cout<<"relIso"<<iso[4]<<endl;
88  return iso;
89 }
const double beta
float alpha
Definition: AMPTWrapper.h:95
double sumWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
Definition: IsoDeposit.cc:138
dbl *** dir
Definition: mlp_gen.cc:35
isodeposit::AbsVetos AbsVetos
Definition: IsoDeposit.h:51
void ZMuMuMuonUserData::produce ( edm::Event evt,
const edm::EventSetup  
)
overrideprivate

Definition at line 108 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(), funct::m, eostools::move(), electronCleaner_cfi::muons, reco::Muon::numberOfChambers(), reco::Muon::numberOfMatches(), pat::Muon::outerTrack(), reco::BeamSpot::position(), jetUpdater_cff::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().

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

Member Data Documentation

double ZMuMuMuonUserData::alpha_
private

Definition at line 37 of file ZMuMuMuonUserData.cc.

Referenced by produce().

EDGetTokenT<BeamSpot> ZMuMuMuonUserData::beamSpotToken_
private

Definition at line 35 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::beta_
private

Definition at line 37 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::dREcal_
private

Definition at line 38 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::dRHcal_
private

Definition at line 38 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::dRTrk_
private

Definition at line 38 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::dRVetoTrk_
private

Definition at line 38 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::etEcalThreshold_
private

Definition at line 38 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::etHcalThreshold_
private

Definition at line 38 of file ZMuMuMuonUserData.cc.

Referenced by produce().

string ZMuMuMuonUserData::hltPath_
private

Definition at line 39 of file ZMuMuMuonUserData.cc.

Referenced by produce().

EDGetTokenT<VertexCollection> ZMuMuMuonUserData::primaryVerticesToken_
private

Definition at line 36 of file ZMuMuMuonUserData.cc.

Referenced by produce().

double ZMuMuMuonUserData::ptThreshold_
private

Definition at line 38 of file ZMuMuMuonUserData.cc.

Referenced by produce().

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

Definition at line 34 of file ZMuMuMuonUserData.cc.

Referenced by produce().