CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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&);
56  ~TestResolution() override;
57 
58 private:
59  void analyze(const edm::Event&, const edm::EventSetup&) override;
60  void endJob() override{};
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.
68  track->px(), track->py(), track->pz(), 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  // ------------------
85 
88  TFile* outputFile_;
89 
90  TProfile* sigmaPt_;
91 
93 
94  std::unique_ptr<ResolutionFunction> resolutionFunction_;
95 };
96 
97 #endif // TESTRESOLUTION_HH
TestResolution(const edm::ParameterSet &)
edm::EDGetTokenT< reco::TrackCollection > saMuonsToken_
auto const & tracks
cannot be loose
std::string theRootFileName_
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
TFile * outputFile_
T sqrt(T t)
Definition: SSEVec.h:19
const int mu
Definition: Constants.h:22
~TestResolution() override
std::vector< reco::LeafCandidate > fillMuonCollection(const std::vector< T > &tracks)
TProfile * sigmaPt_
tuple muons
Definition: patZpeak.py:39
edm::EDGetTokenT< reco::MuonCollection > glbMuonsToken_
void analyze(const edm::Event &, const edm::EventSetup &) override
void endJob() override
std::unique_ptr< ResolutionFunction > resolutionFunction_
edm::InputTag theMuonLabel_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21