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::ProductRegistryHelper

Public Member Functions

 ZMuMuTrackUserData (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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 &)
 

Private Attributes

double alpha_
 
InputTag beamSpot_
 
double beta_
 
double dREcal_
 
double dRHcal_
 
double dRTrk_
 
double dRVetoTrk_
 
double etEcalThreshold_
 
double etHcalThreshold_
 
InputTag primaryVertices_
 
double ptThreshold_
 
InputTag src_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 27 of file ZMuMuTrackUserData.cc.

Constructor & Destructor Documentation

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

Definition at line 81 of file ZMuMuTrackUserData.cc.

81  :
82  src_( cfg.getParameter<InputTag>( "src" ) ),
83  beamSpot_(cfg.getParameter<InputTag>( "beamSpot" ) ),
84  primaryVertices_(cfg.getParameter<InputTag>( "primaryVertices" ) ),
85  ptThreshold_(cfg.getParameter<double >("ptThreshold") ),
86  etEcalThreshold_(cfg.getParameter<double >("etEcalThreshold") ),
87  etHcalThreshold_(cfg.getParameter<double >("etHcalThreshold") ),
88  dRVetoTrk_(cfg.getParameter<double >("dRVetoTrk") ),
89  dRTrk_(cfg.getParameter<double >("dRTrk") ),
90  dREcal_(cfg.getParameter<double >("dREcal") ),
91  dRHcal_(cfg.getParameter<double >("dRHcal") ),
92  alpha_(cfg.getParameter<double>("alpha") ),
93  beta_(cfg.getParameter<double>("beta") ){
94  produces<std::vector<pat::GenericParticle> >();
95 }
T getParameter(std::string const &) const

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 42 of file ZMuMuTrackUserData.cc.

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

Referenced by produce().

42  {
43 
44  vector<double> iso;
45  const pat::IsoDeposit * trkIso = t.isoDeposit(pat::TrackIso);
46  const pat::IsoDeposit * ecalIso = t.isoDeposit(pat::EcalIso);
47  const pat::IsoDeposit * hcalIso = t.isoDeposit(pat::HcalIso);
48 
49  Direction dir = Direction(t.eta(), t.phi());
50 
51 
53  vetosTrk.push_back(new ConeVeto( dir, dRVetoTrk ));
54  vetosTrk.push_back(new ThresholdVeto( ptThreshold ));
55 
56  pat::IsoDeposit::AbsVetos vetosEcal;
57  vetosEcal.push_back(new ConeVeto( dir, 0.));
58  vetosEcal.push_back(new ThresholdVeto( etEcalThreshold ));
59 
60  pat::IsoDeposit::AbsVetos vetosHcal;
61  vetosHcal.push_back(new ConeVeto( dir, 0. ));
62  vetosHcal.push_back(new ThresholdVeto( etHcalThreshold ));
63 
64  double isovalueTrk = (trkIso->sumWithin(dRTrk,vetosTrk));
65  double isovalueEcal = (ecalIso->sumWithin(dREcal,vetosEcal));
66  double isovalueHcal = (hcalIso->sumWithin(dRHcal,vetosHcal));
67 
68  iso.push_back(isovalueTrk);
69  iso.push_back(isovalueEcal);
70  iso.push_back(isovalueHcal);
71 
72  //double iso = isovalueTrk + isovalueEcal + isovalueHcal;
73  double combIso = alpha*( ((1+beta)/2*isovalueEcal) + ((1-beta)/2*isovalueHcal) ) + ((1-alpha)*isovalueTrk);
74 
75  iso.push_back(combIso);
76  double relIso = combIso /= t.pt();
77  iso.push_back(relIso);
78  return iso;
79 }
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:50
void ZMuMuTrackUserData::produce ( edm::Event evt,
const edm::EventSetup  
)
privatevirtual

Implements edm::EDProducer.

Definition at line 97 of file ZMuMuTrackUserData.cc.

References pat::PATObject< ObjectType >::addUserFloat(), alpha_, beamSpot_, beta_, dREcal_, dRHcal_, dRTrk_, dRVetoTrk_, etEcalThreshold_, etHcalThreshold_, edm::Event::getByLabel(), i, edm::Ref< C, T, F >::isNonnull(), isolation(), primaryVertices_, ptThreshold_, edm::Event::put(), pat::GenericParticle::setIsolation(), src_, 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().

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

Member Data Documentation

double ZMuMuTrackUserData::alpha_
private

Definition at line 35 of file ZMuMuTrackUserData.cc.

Referenced by produce().

InputTag ZMuMuTrackUserData::beamSpot_
private

Definition at line 33 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::beta_
private

Definition at line 35 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::dREcal_
private

Definition at line 34 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::dRHcal_
private

Definition at line 34 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::dRTrk_
private

Definition at line 34 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::dRVetoTrk_
private

Definition at line 34 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::etEcalThreshold_
private

Definition at line 34 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::etHcalThreshold_
private

Definition at line 34 of file ZMuMuTrackUserData.cc.

Referenced by produce().

InputTag ZMuMuTrackUserData::primaryVertices_
private

Definition at line 33 of file ZMuMuTrackUserData.cc.

Referenced by produce().

double ZMuMuTrackUserData::ptThreshold_
private

Definition at line 34 of file ZMuMuTrackUserData.cc.

Referenced by produce().

InputTag ZMuMuTrackUserData::src_
private

Definition at line 33 of file ZMuMuTrackUserData.cc.

Referenced by produce().