CMS 3D CMS Logo

ResolutionAnalyzer.h
Go to the documentation of this file.
1 #ifndef RESOLUTIONANALYZER_HH
2 #define RESOLUTIONANALYZER_HH
3 
4 // -*- C++ -*-
5 //
6 // Package: ResolutionAnalyzer
7 // Class: ResolutionAnalyzer
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 
41 #include "HepPDT/defs.h"
42 #include "HepPDT/TableBuilder.hh"
43 #include "HepPDT/ParticleDataTable.hh"
44 
46 #include "HepMC/GenParticle.h"
47 #include "HepMC/GenEvent.h"
48 // #include "SimDataFormats/HepMCProduct/interface/HepMCProduct.h"
50 
54 
55 #include <CLHEP/Vector/LorentzVector.h>
56 
58 
59 #include "Histograms.h"
60 #include "MuScleFitUtils.h"
61 //
62 // class decleration
63 //
64 
66 public:
67  explicit ResolutionAnalyzer(const edm::ParameterSet&);
69 
70 private:
71  virtual void analyze(const edm::Event&, const edm::EventSetup&);
72  virtual void endJob() {};
73 
74  template<typename T>
75  std::vector<reco::LeafCandidate> fillMuonCollection (const std::vector<T>& tracks) {
76  std::vector<reco::LeafCandidate> muons;
77  typename std::vector<T>::const_iterator track;
78  for (track = tracks.begin(); track != tracks.end(); ++track){
79  reco::Particle::LorentzVector mu(track->px(),track->py(),track->pz(),
80  sqrt(track->p()*track->p() + MuScleFitUtils::mMu2));
82  if (debug_>0) std::cout <<std::setprecision(9)<< "Muon #" << MuScleFitUtils::goodmuon
83  << ": initial value Pt = " << mu.Pt() << std::endl;
84  reco::LeafCandidate muon(track->charge(),mu);
85  // Store muon
86  // ----------
87  muons.push_back( muon );
88  }
89  return muons;
90  }
91 
93  void fillHistoMap();
95  void writeHistoMap();
98 
99  // ----------member data ---------------------------
100 
101  // Collections labels
102  // ------------------
104 
108  bool debug_;
109  std::map<std::string, Histograms*> mapHisto_;
110  TFile * outputFile_;
111 
115 
116  TString treeFileName_;
117  int32_t maxEvents_;
118 
119  double ptMax_;
120 
126 };
127 
128 #endif // RESOLUTIONANALYZER_HH
std::map< std::string, Histograms * > mapHisto_
std::string theRootFileName_
std::vector< reco::LeafCandidate > fillMuonCollection(const std::vector< T > &tracks)
HCovarianceVSxy * massResolutionVsPtEta_
void fillHistoMap()
Used to fill the map with the histograms needed.
T sqrt(T t)
Definition: SSEVec.h:18
virtual void endJob()
void writeHistoMap()
Writes the histograms in the map.
std::string theCovariancesRootFileName_
const int mu
Definition: Constants.h:22
bool checkDeltaR(const reco::Particle::LorentzVector &genMu, const reco::Particle::LorentzVector &recMu)
Returns true if the two particles have DeltaR < cut.
virtual void analyze(const edm::Event &, const edm::EventSetup &)
static int goodmuon
static const double mMu2
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
ResolutionAnalyzer(const edm::ParameterSet &)
edm::InputTag theMuonLabel_