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 //
20 //
21 
22 // system include files
23 #include <memory>
24 #include <string>
25 #include <vector>
26 
27 // user include files
33 
40 
42 
43 // For the momentum scale resolution
45 
46 #include "TFile.h"
47 #include "TProfile.h"
48 
49 //
50 // class decleration
51 //
52 
54 public:
55  explicit TestResolution(const edm::ParameterSet&);
57 
58 private:
59  virtual void analyze(const edm::Event&, const edm::EventSetup&);
60  virtual void endJob() {};
61  template<typename T>
62  std::vector<reco::LeafCandidate> fillMuonCollection (const std::vector<T>& tracks) {
63  std::vector<reco::LeafCandidate> muons;
64  typename std::vector<T>::const_iterator track;
65  for (track = tracks.begin(); track != tracks.end(); ++track){
66  // Where 0.011163612 is the squared muon mass.
67  reco::Particle::LorentzVector mu(track->px(),track->py(),track->pz(),
68  sqrt(track->p()*track->p() + 0.011163612));
69  reco::LeafCandidate muon(track->charge(),mu);
70  // Store muon
71  // ----------
72  muons.push_back (muon);
73  }
74  return muons;
75  }
76 
77  // ----------member data ---------------------------
78 
79  // Collections labels
80  // ------------------
82 
85  TFile * outputFile_;
86 
87  TProfile * sigmaPt_;
88 
90 
91  std::auto_ptr<ResolutionFunction> resolutionFunction_;
92 };
93 
94 #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:22
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:27