00001 #ifndef MuonTrackValidator_h
00002 #define MuonTrackValidator_h
00003
00010 #include "FWCore/Framework/interface/Frameworkfwd.h"
00011 #include "FWCore/Framework/interface/EDAnalyzer.h"
00012 #include "Validation/RecoMuon/plugins/MuonTrackValidatorBase.h"
00013
00014 #include "DataFormats/TrackReco/interface/Track.h"
00015 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
00016
00017 class MuonTrackValidator : public edm::EDAnalyzer, protected MuonTrackValidatorBase {
00018 public:
00020 MuonTrackValidator(const edm::ParameterSet& pset):MuonTrackValidatorBase(pset){
00021 dirName_ = pset.getParameter<std::string>("dirName");
00022 associatormap = pset.getParameter< edm::InputTag >("associatormap");
00023 UseAssociators = pset.getParameter< bool >("UseAssociators");
00024 tpSelector = TrackingParticleSelector(pset.getParameter<double>("ptMinTP"),
00025 pset.getParameter<double>("minRapidityTP"),
00026 pset.getParameter<double>("maxRapidityTP"),
00027 pset.getParameter<double>("tipTP"),
00028 pset.getParameter<double>("lipTP"),
00029 pset.getParameter<int>("minHitTP"),
00030 pset.getParameter<bool>("signalOnlyTP"),
00031 pset.getParameter<bool>("chargedOnlyTP"),
00032 pset.getParameter<bool>("stableOnlyTP"),
00033 pset.getParameter<std::vector<int> >("pdgIdTP"));
00034 cosmictpSelector = CosmicTrackingParticleSelector(pset.getParameter<double>("ptMinTP"),
00035 pset.getParameter<double>("minRapidityTP"),
00036 pset.getParameter<double>("maxRapidityTP"),
00037 pset.getParameter<double>("tipTP"),
00038 pset.getParameter<double>("lipTP"),
00039 pset.getParameter<int>("minHitTP"),
00040 pset.getParameter<bool>("chargedOnlyTP"),
00041 pset.getParameter<std::vector<int> >("pdgIdTP"));
00042
00043 minPhi = pset.getParameter<double>("minPhi");
00044 maxPhi = pset.getParameter<double>("maxPhi");
00045 nintPhi = pset.getParameter<int>("nintPhi");
00046 useGsf = pset.getParameter<bool>("useGsf");
00047 BiDirectional_RecoToSim_association = pset.getParameter<bool>("BiDirectional_RecoToSim_association");
00048
00049
00050 edm::LogVerbatim("MuonTrackValidator") << "constructing MuonTrackValidator: " << pset.dump();
00051
00052 MABH = false;
00053 if (!UseAssociators) {
00054
00055 if (associators[0] == "MuonAssociationByHits") MABH = true;
00056
00057 associators.clear();
00058 associators.push_back(associatormap.label());
00059 edm::LogVerbatim("MuonTrackValidator") << "--> associators reset to: " <<associators[0];
00060 }
00061
00062
00063 if (usetracker) edm::LogVerbatim("MuonTrackValidator")
00064 <<"\n usetracker = TRUE : Tracker SimHits WILL be counted";
00065 else edm::LogVerbatim("MuonTrackValidator")
00066 <<"\n usetracker = FALSE : Tracker SimHits WILL NOT be counted";
00067 if (usemuon) edm::LogVerbatim("MuonTrackValidator")
00068 <<" usemuon = TRUE : Muon SimHits WILL be counted";
00069 else edm::LogVerbatim("MuonTrackValidator")
00070 <<" usemuon = FALSE : Muon SimHits WILL NOT be counted"<<std::endl;
00071
00072
00073 for (unsigned int www=0;www<label.size();www++) {
00074 std::string recoTracksLabel = label[www].label();
00075 std::string recoTracksInstance = label[www].instance();
00076
00077
00078 if (recoTracksLabel=="generalTracks" ||
00079 (recoTracksLabel.find("cutsRecoTracks") != std::string::npos) ||
00080 recoTracksLabel=="ctfWithMaterialTracksP5LHCNavigation" ||
00081 recoTracksLabel=="hltL3TkTracksFromL2" ||
00082 (recoTracksLabel=="hltL3Muons" && recoTracksInstance=="L2Seeded"))
00083 {
00084 if (usemuon) {
00085 edm::LogWarning("MuonTrackValidator")
00086 <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
00087 <<"\n with usemuon == true"<<"\n ---> please change to usemuon == false ";
00088 }
00089 if (!usetracker) {
00090 edm::LogWarning("MuonTrackValidator")
00091 <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
00092 <<"\n with usetracker == false"<<"\n ---> please change to usetracker == true ";
00093 }
00094 }
00095
00096
00097 else if (recoTracksLabel=="standAloneMuons" ||
00098 recoTracksLabel=="standAloneSETMuons" ||
00099 recoTracksLabel=="cosmicMuons" ||
00100 recoTracksLabel=="hltL2Muons")
00101 {
00102 if (usetracker) {
00103 edm::LogWarning("MuonTrackValidator")
00104 <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
00105 <<"\n with usetracker == true"<<"\n ---> please change to usetracker == false ";
00106 }
00107 if (!usemuon) {
00108 edm::LogWarning("MuonTrackValidator")
00109 <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
00110 <<"\n with usemuon == false"<<"\n ---> please change to usemuon == true ";
00111 }
00112 }
00113
00114 }
00115 }
00116
00118 virtual ~MuonTrackValidator(){ }
00119
00121 void beginRun(edm::Run const&, edm::EventSetup const&);
00123 void analyze(const edm::Event&, const edm::EventSetup& );
00125 void endRun(edm::Run const&, edm::EventSetup const&);
00126
00127 private:
00129 void getRecoMomentum (const reco::Track& track, double& pt, double& ptError,
00130 double& qoverp, double& qoverpError, double& lambda, double& lambdaError,
00131 double& phi, double& phiError ) const;
00133 void getRecoMomentum (const reco::GsfTrack& gsfTrack, double& pt, double& ptError,
00134 double& qoverp, double& qoverpError, double& lambda, double& lambdaError,
00135 double& phi, double& phiError) const;
00136
00137 private:
00138 std::string dirName_;
00139 edm::InputTag associatormap;
00140 bool UseAssociators;
00141 double minPhi, maxPhi;
00142 int nintPhi;
00143 bool useGsf;
00144
00145
00146 TrackingParticleSelector tpSelector;
00147 CosmicTrackingParticleSelector cosmictpSelector;
00148
00149
00150 bool BiDirectional_RecoToSim_association;
00151
00152 bool MABH;
00153
00154
00155 std::vector<MonitorElement*> h_nchi2, h_nchi2_prob, h_losthits;
00156
00157
00158 std::vector<MonitorElement*> chi2_vs_nhits, etares_vs_eta;
00159 std::vector<MonitorElement*> h_ptshifteta;
00160 std::vector<MonitorElement*> ptres_vs_phi, chi2_vs_phi, nhits_vs_phi, phires_vs_phi;
00161
00162
00163 std::vector<MonitorElement*> ptmean_vs_eta_phi, phimean_vs_eta_phi;
00164
00165
00166 std::vector<MonitorElement*> h_assochi2, h_assochi2_prob;
00167
00168
00169 std::vector<MonitorElement*> chi2_vs_eta, nlosthits_vs_eta;
00170 std::vector<MonitorElement*> h_chi2meanh, h_losthits_eta;
00171 std::vector<MonitorElement*> h_hits_phi;
00172 std::vector<MonitorElement*> h_chi2meanhitsh, h_chi2mean_vs_phi;
00173
00174
00175 std::vector<MonitorElement*> dxyres_vs_eta, ptres_vs_eta, dzres_vs_eta, phires_vs_eta, cotThetares_vs_eta;
00176 std::vector<MonitorElement*> dxyres_vs_pt, ptres_vs_pt, dzres_vs_pt, phires_vs_pt, cotThetares_vs_pt;
00177
00178
00179 std::vector<MonitorElement*> dxypull_vs_eta, ptpull_vs_eta, dzpull_vs_eta, phipull_vs_eta, thetapull_vs_eta;
00180 std::vector<MonitorElement*> ptpull_vs_phi, phipull_vs_phi, thetapull_vs_phi;
00181 std::vector<MonitorElement*> h_dxypulleta, h_ptpulleta, h_dzpulleta, h_phipulleta, h_thetapulleta;
00182 std::vector<MonitorElement*> h_ptpullphi, h_phipullphi, h_thetapullphi;
00183
00184 };
00185
00186
00187 #endif