File indexing completed on 2024-04-06 12:27:19
0001 #ifndef RecoMuon_TrackingTools_MuonErrorMatrixAnalyzer_H
0002 #define RecoMuon_TrackingTools_MuonErrorMatrixAnalyzer_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include <memory>
0015 #include "FWCore/Framework/interface/Frameworkfwd.h"
0016 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0017
0018 #include "FWCore/Framework/interface/Event.h"
0019 #include "FWCore/Framework/interface/EventSetup.h"
0020
0021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0022
0023 #include "RecoMuon/TrackingTools/interface/MuonErrorMatrix.h"
0024
0025 #include "FWCore/Framework/interface/ESHandle.h"
0026
0027 #include "DataFormats/GeometrySurface/interface/Cylinder.h"
0028 #include "DataFormats/GeometrySurface/interface/Plane.h"
0029
0030 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0031
0032 class MagneticField;
0033 class IdealMagneticFieldRecord;
0034 class TrackingComponentsRecord;
0035 class TH1;
0036 class TH2;
0037 class Propagator;
0038
0039
0040
0041
0042 class MuonErrorMatrixAnalyzer : public edm::one::EDAnalyzer<> {
0043 public:
0044
0045 explicit MuonErrorMatrixAnalyzer(const edm::ParameterSet&);
0046
0047
0048 ~MuonErrorMatrixAnalyzer();
0049
0050 private:
0051
0052 virtual void beginJob();
0053 virtual void analyze(const edm::Event&, const edm::EventSetup&);
0054 virtual void endJob();
0055
0056
0057 void analyze_from_errormatrix(const edm::Event&, const edm::EventSetup&);
0058
0059 void analyze_from_pull(const edm::Event&, const edm::EventSetup&);
0060
0061
0062
0063 std::string theCategory;
0064
0065
0066 edm::InputTag theTrackLabel;
0067 edm::InputTag trackingParticleLabel;
0068
0069
0070 std::string theAssocLabel;
0071
0072
0073 edm::ESHandle<MagneticField> theField;
0074 edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> theFieldToken;
0075
0076
0077 MuonErrorMatrix* theErrorMatrixStore_Reported;
0078 edm::ParameterSet theErrorMatrixStore_Reported_pset;
0079
0080
0081 MuonErrorMatrix* theErrorMatrixStore_Residual;
0082 edm::ParameterSet theErrorMatrixStore_Residual_pset;
0083
0084
0085 MuonErrorMatrix* theErrorMatrixStore_Pull;
0086 edm::ParameterSet theErrorMatrixStore_Pull_pset;
0087
0088
0089 double theGaussianPullFitRange;
0090
0091
0092 double theRadius;
0093
0094
0095 Cylinder::CylinderPointer refRSurface;
0096
0097
0098 double theZ;
0099
0100
0101 Plane::PlanePointer refZSurface[2];
0102
0103
0104 std::string thePropagatorName;
0105 edm::ESHandle<Propagator> thePropagator;
0106 edm::ESGetToken<Propagator, TrackingComponentsRecord> thePropagatorToken;
0107
0108
0109 FreeTrajectoryState refLocusState(const FreeTrajectoryState& fts);
0110
0111
0112 TFile* thePlotFile;
0113 TFileDirectory* thePlotDir;
0114 TList* theBookKeeping;
0115 std::string thePlotFileName;
0116
0117
0118 typedef TH1* TH1ptr;
0119 TH1ptr* theHist_array_residual[15];
0120 TH1ptr* theHist_array_pull[15];
0121
0122
0123 inline unsigned int index(TProfile3D* pf, unsigned int i, unsigned int j, unsigned int k) {
0124 return (((i * pf->GetNbinsY()) + j) * pf->GetNbinsZ()) + k;
0125 }
0126 unsigned int maxIndex(TProfile3D* pf) { return pf->GetNbinsX() * pf->GetNbinsY() * pf->GetNbinsZ(); }
0127
0128 struct extractRes {
0129 double corr;
0130 double x;
0131 double y;
0132 };
0133
0134 extractRes extract(TH2* h2);
0135 };
0136 #endif