CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TestResolution.h
Go to the documentation of this file.
1 #ifndef TESTRESOLUTION_HH
2 #define TESTRESOLUTION_HH
3 
4 // -*- C++ -*-
5 //
6 // Package: TestResolution
7 // Class: TestResolution
8 //
16 //
17 // Original Author: Marco De Mattia
18 // Created: Thu Sep 11 12:16:00 CEST 2008
19 // $Id: TestResolution.h,v 1.6 2010/10/22 17:48:08 wmtan Exp $
20 //
21 //
22 
23 // system include files
24 #include <memory>
25 #include <string>
26 #include <vector>
27 
28 // user include files
34 
41 
43 
44 // For the momentum scale resolution
46 
47 #include "TFile.h"
48 #include "TProfile.h"
49 
50 //
51 // class decleration
52 //
53 
55 public:
56  explicit TestResolution(const edm::ParameterSet&);
58 
59 private:
60  virtual void analyze(const edm::Event&, const edm::EventSetup&);
61  virtual void endJob() {};
62  template<typename T>
63  std::vector<reco::LeafCandidate> fillMuonCollection (const std::vector<T>& tracks) {
64  std::vector<reco::LeafCandidate> muons;
65  typename std::vector<T>::const_iterator track;
66  for (track = tracks.begin(); track != tracks.end(); ++track){
67  // Where 0.011163612 is the squared muon mass.
68  reco::Particle::LorentzVector mu(track->px(),track->py(),track->pz(),
69  sqrt(track->p()*track->p() + 0.011163612));
70  reco::LeafCandidate muon(track->charge(),mu);
71  // Store muon
72  // ----------
73  muons.push_back (muon);
74  }
75  return muons;
76  }
77 
78  // ----------member data ---------------------------
79 
80  // Collections labels
81  // ------------------
83 
86  TFile * outputFile_;
87 
88  TProfile * sigmaPt_;
89 
91 
92  std::auto_ptr<ResolutionFunction> resolutionFunction_;
93 };
94 
95 #endif // TESTRESOLUTION_HH
TestResolution(const edm::ParameterSet &)
std::string theRootFileName_
TFile * outputFile_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
T sqrt(T t)
Definition: SSEVec.h:48
std::auto_ptr< ResolutionFunction > resolutionFunction_
const int mu
Definition: Constants.h:23
std::vector< reco::LeafCandidate > fillMuonCollection(const std::vector< T > &tracks)
tuple tracks
Definition: testEve_cfg.py:39
TProfile * sigmaPt_
tuple muons
Definition: patZpeak.py:38
virtual void endJob()
edm::InputTag theMuonLabel_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:25