00001 #ifndef RESOLUTIONANALYZER_HH 00002 #define RESOLUTIONANALYZER_HH 00003 00004 // -*- C++ -*- 00005 // 00006 // Package: ResolutionAnalyzer 00007 // Class: ResolutionAnalyzer 00008 // 00016 // 00017 // Original Author: Marco De Mattia 00018 // Created: Thu Sep 11 12:16:00 CEST 2008 00019 // $Id: ResolutionAnalyzer.h,v 1.16 2012/12/20 16:09:29 emiglior Exp $ 00020 // 00021 // 00022 00023 // system include files 00024 #include <memory> 00025 #include <string> 00026 #include <vector> 00027 00028 // user include files 00029 #include "FWCore/Framework/interface/Frameworkfwd.h" 00030 #include "FWCore/Framework/interface/EDAnalyzer.h" 00031 #include "FWCore/Framework/interface/Event.h" 00032 #include "FWCore/Framework/interface/MakerMacros.h" 00033 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00034 00035 #include "DataFormats/TrackReco/interface/Track.h" 00036 #include "DataFormats/MuonReco/interface/Muon.h" 00037 #include "DataFormats/MuonReco/interface/MuonFwd.h" 00038 #include "DataFormats/Candidate/interface/Candidate.h" 00039 #include "RecoMuon/TrackingTools/interface/MuonPatternRecoDumper.h" 00040 #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h" 00041 00042 #include "HepPDT/defs.h" 00043 #include "HepPDT/TableBuilder.hh" 00044 #include "HepPDT/ParticleDataTable.hh" 00045 00046 #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" 00047 #include "HepMC/GenParticle.h" 00048 #include "HepMC/GenEvent.h" 00049 // #include "SimDataFormats/HepMCProduct/interface/HepMCProduct.h" 00050 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" 00051 00052 #include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h" 00053 #include "SimDataFormats/Track/interface/SimTrackContainer.h" 00054 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h" 00055 00056 #include <CLHEP/Vector/LorentzVector.h> 00057 00058 #include "DataFormats/Candidate/interface/LeafCandidate.h" 00059 00060 #include "Histograms.h" 00061 #include "MuScleFitUtils.h" 00062 // 00063 // class decleration 00064 // 00065 00066 class ResolutionAnalyzer : public edm::EDAnalyzer { 00067 public: 00068 explicit ResolutionAnalyzer(const edm::ParameterSet&); 00069 ~ResolutionAnalyzer(); 00070 00071 private: 00072 virtual void analyze(const edm::Event&, const edm::EventSetup&); 00073 virtual void endJob() {}; 00074 00075 template<typename T> 00076 std::vector<reco::LeafCandidate> fillMuonCollection (const std::vector<T>& tracks) { 00077 std::vector<reco::LeafCandidate> muons; 00078 typename std::vector<T>::const_iterator track; 00079 for (track = tracks.begin(); track != tracks.end(); ++track){ 00080 reco::Particle::LorentzVector mu(track->px(),track->py(),track->pz(), 00081 sqrt(track->p()*track->p() + MuScleFitUtils::mMu2)); 00082 MuScleFitUtils::goodmuon++; 00083 if (debug_>0) std::cout <<std::setprecision(9)<< "Muon #" << MuScleFitUtils::goodmuon 00084 << ": initial value Pt = " << mu.Pt() << std::endl; 00085 reco::LeafCandidate muon(track->charge(),mu); 00086 // Store muon 00087 // ---------- 00088 muons.push_back( muon ); 00089 } 00090 return muons; 00091 } 00092 00094 void fillHistoMap(); 00096 void writeHistoMap(); 00098 bool checkDeltaR(const reco::Particle::LorentzVector & genMu, const reco::Particle::LorentzVector & recMu); 00099 00100 // ----------member data --------------------------- 00101 00102 // Collections labels 00103 // ------------------ 00104 edm::InputTag theMuonLabel_; 00105 00106 int theMuonType_; 00107 std::string theRootFileName_; 00108 std::string theCovariancesRootFileName_; 00109 bool debug_; 00110 std::map<std::string, Histograms*> mapHisto_; 00111 TFile * outputFile_; 00112 00113 int eventCounter_; 00114 bool resonance_; 00115 bool readCovariances_; 00116 00117 TString treeFileName_; 00118 int32_t maxEvents_; 00119 00120 double ptMax_; 00121 00122 HCovarianceVSxy * massResolutionVsPtEta_; 00123 TH2D * recoPtVsgenPt_; 00124 TH2D * recoPtVsgenPtEta12_; 00125 TH1D * deltaPtOverPt_; 00126 TH1D * deltaPtOverPtForEta12_; 00127 }; 00128 00129 #endif // RESOLUTIONANALYZER_HH