CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ZMuMuTrackUserData Class Reference
Inheritance diagram for ZMuMuTrackUserData:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ZMuMuTrackUserData (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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_
 
EDGetTokenT< VertexCollectionprimaryVerticesToken_
 
double ptThreshold_
 
EDGetTokenT< vector
< pat::GenericParticle > > 
srcToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 27 of file ZMuMuTrackUserData.cc.

Constructor & Destructor Documentation

ZMuMuTrackUserData::ZMuMuTrackUserData ( const edm::ParameterSet cfg)

Definition at line 83 of file ZMuMuTrackUserData.cc.

83  :
84  srcToken_(consumes<vector<pat::GenericParticle> > ( cfg.getParameter<InputTag>( "src" ) ) ),
85  beamSpotToken_(consumes<BeamSpot> (cfg.getParameter<InputTag>( "beamSpot" ) ) ),
86  primaryVerticesToken_(consumes<VertexCollection> (cfg.getParameter<InputTag>( "primaryVertices" ) ) ),
87  ptThreshold_(cfg.getParameter<double >("ptThreshold") ),
88  etEcalThreshold_(cfg.getParameter<double >("etEcalThreshold") ),
89  etHcalThreshold_(cfg.getParameter<double >("etHcalThreshold") ),
90  dRVetoTrk_(cfg.getParameter<double >("dRVetoTrk") ),
91  dRTrk_(cfg.getParameter<double >("dRTrk") ),
92  dREcal_(cfg.getParameter<double >("dREcal") ),
93  dRHcal_(cfg.getParameter<double >("dRHcal") ),
94  alpha_(cfg.getParameter<double>("alpha") ),
95  beta_(cfg.getParameter<double>("beta") ){
96  produces<std::vector<pat::GenericParticle> >();
97 }
T getParameter(std::string const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
EDGetTokenT< vector< pat::GenericParticle > > srcToken_
EDGetTokenT< VertexCollection > primaryVerticesToken_
EDGetTokenT< BeamSpot > beamSpotToken_

Member Function Documentation

template<typename T >
vector< double > ZMuMuTrackUserData::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 44 of file ZMuMuTrackUserData.cc.

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

Referenced by produce().

44  {
45 
46  vector<double> iso;
47  const pat::IsoDeposit * trkIso = t.isoDeposit(pat::TrackIso);
48  const pat::IsoDeposit * ecalIso = t.isoDeposit(pat::EcalIso);
49  const pat::IsoDeposit * hcalIso = t.isoDeposit(pat::HcalIso);
50 
51  Direction dir = Direction(t.eta(), t.phi());
52 
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  iso.push_back(isovalueEcal);
72  iso.push_back(isovalueHcal);
73 
74  //double iso = isovalueTrk + isovalueEcal + isovalueHcal;
75  double combIso = alpha*( ((1+beta)/2*isovalueEcal) + ((1-beta)/2*isovalueHcal) ) + ((1-alpha)*isovalueTrk);
76 
77  iso.push_back(combIso);
78  double relIso = combIso /= t.pt();
79  iso.push_back(relIso);
80  return iso;
81 }
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 ZMuMuTrackUserData::produce ( edm::Event evt,
const edm::EventSetup  
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 99 of file ZMuMuTrackUserData.cc.

References pat::PATObject< ObjectType >::addUserFloat(), alpha_, beamSpotToken_, beta_, dREcal_, dRHcal_, dRTrk_, dRVetoTrk_, etEcalThreshold_, etHcalThreshold_, edm::Event::getByToken(), i, edm::Ref< C, T, F >::isNonnull(), isolation(), primaryVerticesToken_, ptThreshold_, edm::Event::put(), pat::GenericParticle::setIsolation(), srcToken_, pat::GenericParticle::track(), testEve_cfg::tracks, pat::User1Iso, pat::User2Iso, pat::User3Iso, pat::User4Iso, and pat::User5Iso.

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

99  {
101  evt.getByToken(srcToken_,tracks);
102 
103  Handle<BeamSpot> beamSpotHandle;
104  evt.getByToken(beamSpotToken_, beamSpotHandle);
105 
106  Handle<VertexCollection> primaryVertices; // Collection of primary Vertices
107  evt.getByToken(primaryVerticesToken_, primaryVertices);
108 
109  auto_ptr<vector<pat::GenericParticle> > tkColl( new vector<pat::GenericParticle> (*tracks) );
110  for (unsigned int i = 0; i< tkColl->size();++i){
111  pat::GenericParticle & tk = (*tkColl)[i];
113  tk.setIsolation(pat::User1Iso, iso[0]);
114  // cout << "track User1Iso " << iso[0] << endl;
115  tk.setIsolation(pat::User2Iso, iso[1]);
116  //cout << "track User2Iso " << iso[1] << endl;
117  tk.setIsolation(pat::User3Iso, iso[2]);
118  //cout << "track User3Iso " << iso[2] << endl;
119  tk.setIsolation(pat::User4Iso, iso[3]);
120  //cout << "track User4Iso " << iso[3] << endl;
121  tk.setIsolation(pat::User5Iso, iso[4]);
122  //cout << "track User5Iso " << iso[4] << endl;
123 
124 
125 
126  float zDaudxyFromBS = -1 ;
127  float zDaudzFromBS = -1;
128  float zDaudxyFromPV = -1;
129  float zDaudzFromPV = -1;
130  float zDauNofMuChambers = -1;
131  float zDauNofMuMatches = -1;
132  float zDauChi2 = -1;
133  float zDauTrkChi2 = -1;
134  float zDauSaChi2 = -1;
135  float zDauNofMuonHits =- 1;
136  float zDauNofStripHits = -1;
137  float zDauNofPixelHits = -1;
138  float zDauMuEnergyEm = -1;
139  float zDauMuEnergyHad = -1;
140 
141  TrackRef muTrkRef = tk.track();
142  if (muTrkRef.isNonnull()){
143  zDaudxyFromBS = muTrkRef->dxy(beamSpotHandle->position());
144  zDaudzFromBS = muTrkRef->dz(beamSpotHandle->position());
145  zDaudxyFromPV = muTrkRef->dxy(primaryVertices->begin()->position() );
146  zDaudzFromPV = muTrkRef->dz(primaryVertices->begin()->position() );
147  zDauChi2 = muTrkRef->normalizedChi2();
148  zDauTrkChi2 = muTrkRef->normalizedChi2();
149  zDauNofStripHits = muTrkRef->hitPattern().numberOfValidStripHits();
150  zDauNofPixelHits = muTrkRef->hitPattern().numberOfValidPixelHits();
151  }
152  tk.addUserFloat("zDau_dxyFromBS", zDaudxyFromBS);
153  tk.addUserFloat("zDau_dzFromBS", zDaudzFromBS);
154  tk.addUserFloat("zDau_dxyFromPV", zDaudxyFromPV);
155  tk.addUserFloat("zDau_dzFromPV", zDaudzFromPV);
156  tk.addUserFloat("zDau_NofMuonHits" , zDauNofMuonHits );
157  tk.addUserFloat("zDau_TrkNofStripHits" , zDauNofStripHits );
158  tk.addUserFloat("zDau_TrkNofPixelHits" , zDauNofPixelHits );
159  tk.addUserFloat("zDau_NofMuChambers", zDauNofMuChambers);
160  tk.addUserFloat("zDau_NofMuMatches", zDauNofMuMatches);
161  tk.addUserFloat("zDau_Chi2", zDauChi2);
162  tk.addUserFloat("zDau_TrkChi2", zDauTrkChi2);
163  tk.addUserFloat("zDau_SaChi2", zDauSaChi2);
164  tk.addUserFloat("zDau_MuEnergyEm", zDauMuEnergyEm);
165  tk.addUserFloat("zDau_MuEnergyHad", zDauMuEnergyHad);
166 
167 
168  }
169 
170  evt.put( tkColl);
171 }
int i
Definition: DBlmapReader.cc:9
void setIsolation(IsolationKeys key, float value)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
Analysis-level Generic Particle class (e.g. for hadron or muon not fully reconstructed) ...
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::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
void addUserFloat(const std::string &label, float data)
Set user-defined float.
Definition: PATObject.h:765
virtual reco::TrackRef track() const
EDGetTokenT< vector< pat::GenericParticle > > srcToken_
tuple tracks
Definition: testEve_cfg.py:39
EDGetTokenT< VertexCollection > primaryVerticesToken_
EDGetTokenT< BeamSpot > beamSpotToken_

Member Data Documentation

double ZMuMuTrackUserData::alpha_
private

Definition at line 37 of file ZMuMuTrackUserData.cc.

Referenced by produce().

EDGetTokenT<BeamSpot> ZMuMuTrackUserData::beamSpotToken_
private

Definition at line 34 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::beta_
private

Definition at line 37 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::dREcal_
private

Definition at line 36 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::dRHcal_
private

Definition at line 36 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::dRTrk_
private

Definition at line 36 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::dRVetoTrk_
private

Definition at line 36 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::etEcalThreshold_
private

Definition at line 36 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::etHcalThreshold_
private

Definition at line 36 of file ZMuMuTrackUserData.cc.

Referenced by produce().

EDGetTokenT<VertexCollection> ZMuMuTrackUserData::primaryVerticesToken_
private

Definition at line 35 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::ptThreshold_
private

Definition at line 36 of file ZMuMuTrackUserData.cc.

Referenced by produce().

EDGetTokenT<vector<pat::GenericParticle> > ZMuMuTrackUserData::srcToken_
private

Definition at line 33 of file ZMuMuTrackUserData.cc.

Referenced by produce().