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<std::vector<int> >("pdgIdTP"));
00033 cosmictpSelector = CosmicTrackingParticleSelector(pset.getParameter<double>("ptMinTP"),
00034 pset.getParameter<double>("minRapidityTP"),
00035 pset.getParameter<double>("maxRapidityTP"),
00036 pset.getParameter<double>("tipTP"),
00037 pset.getParameter<double>("lipTP"),
00038 pset.getParameter<int>("minHitTP"),
00039 pset.getParameter<bool>("chargedOnlyTP"),
00040 pset.getParameter<std::vector<int> >("pdgIdTP"));
00041
00042 minPhi = pset.getParameter<double>("minPhi");
00043 maxPhi = pset.getParameter<double>("maxPhi");
00044 nintPhi = pset.getParameter<int>("nintPhi");
00045 useGsf = pset.getParameter<bool>("useGsf");
00046 BiDirectional_RecoToSim_association = pset.getParameter<bool>("BiDirectional_RecoToSim_association");
00047
00048
00049 edm::LogVerbatim("MuonTrackValidator") << "constructing MuonTrackValidator: " << pset.dump();
00050
00051 MABH = false;
00052 if (!UseAssociators) {
00053
00054 if (associators[0] == "MuonAssociationByHits") MABH = true;
00055
00056 associators.clear();
00057 associators.push_back(associatormap.label());
00058 edm::LogVerbatim("MuonTrackValidator") << "--> associators reset to: " <<associators[0];
00059 }
00060
00061
00062 if (usetracker) edm::LogVerbatim("MuonTrackValidator")
00063 <<"\n usetracker = TRUE : Tracker SimHits WILL be counted";
00064 else edm::LogVerbatim("MuonTrackValidator")
00065 <<"\n usetracker = FALSE : Tracker SimHits WILL NOT be counted";
00066 if (usemuon) edm::LogVerbatim("MuonTrackValidator")
00067 <<" usemuon = TRUE : Muon SimHits WILL be counted";
00068 else edm::LogVerbatim("MuonTrackValidator")
00069 <<" usemuon = FALSE : Muon SimHits WILL NOT be counted"<<std::endl;
00070
00071
00072 for (unsigned int www=0;www<label.size();www++) {
00073 std::string recoTracksLabel = label[www].label();
00074 std::string recoTracksInstance = label[www].instance();
00075
00076
00077 if (recoTracksLabel=="generalTracks" ||
00078 (recoTracksLabel.find("cutsRecoTracks") != std::string::npos) ||
00079 recoTracksLabel=="ctfWithMaterialTracksP5LHCNavigation" ||
00080 recoTracksLabel=="hltL3TkTracksFromL2" ||
00081 (recoTracksLabel=="hltL3Muons" && recoTracksInstance=="L2Seeded"))
00082 {
00083 if (usemuon) {
00084 edm::LogWarning("MuonTrackValidator")
00085 <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
00086 <<"\n with usemuon == true"<<"\n ---> please change to usemuon == false ";
00087 }
00088 if (!usetracker) {
00089 edm::LogWarning("MuonTrackValidator")
00090 <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
00091 <<"\n with usetracker == false"<<"\n ---> please change to usetracker == true ";
00092 }
00093 }
00094
00095
00096 else if (recoTracksLabel=="standAloneMuons" ||
00097 recoTracksLabel=="standAloneSETMuons" ||
00098 recoTracksLabel=="cosmicMuons" ||
00099 recoTracksLabel=="hltL2Muons")
00100 {
00101 if (usetracker) {
00102 edm::LogWarning("MuonTrackValidator")
00103 <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
00104 <<"\n with usetracker == true"<<"\n ---> please change to usetracker == false ";
00105 }
00106 if (!usemuon) {
00107 edm::LogWarning("MuonTrackValidator")
00108 <<"\n*** WARNING : inconsistent input tracksTag = "<<label[www]
00109 <<"\n with usemuon == false"<<"\n ---> please change to usemuon == true ";
00110 }
00111 }
00112
00113 }
00114 }
00115
00117 virtual ~MuonTrackValidator(){ }
00118
00120 void beginRun(edm::Run const&, edm::EventSetup const&);
00122 void analyze(const edm::Event&, const edm::EventSetup& );
00124 void endRun(edm::Run const&, edm::EventSetup const&);
00125
00126 private:
00128 void getRecoMomentum (const reco::Track& track, double& pt, double& ptError,
00129 double& qoverp, double& qoverpError, double& lambda, double& lambdaError,
00130 double& phi, double& phiError ) const;
00132 void getRecoMomentum (const reco::GsfTrack& gsfTrack, double& pt, double& ptError,
00133 double& qoverp, double& qoverpError, double& lambda, double& lambdaError,
00134 double& phi, double& phiError) const;
00135
00136 private:
00137 std::string dirName_;
00138 edm::InputTag associatormap;
00139 bool UseAssociators;
00140 double minPhi, maxPhi;
00141 int nintPhi;
00142 bool useGsf;
00143
00144
00145 TrackingParticleSelector tpSelector;
00146 CosmicTrackingParticleSelector cosmictpSelector;
00147
00148
00149 bool BiDirectional_RecoToSim_association;
00150
00151 bool MABH;
00152
00153
00154 std::vector<MonitorElement*> h_nchi2, h_nchi2_prob, h_losthits;
00155
00156
00157 std::vector<MonitorElement*> chi2_vs_nhits, etares_vs_eta;
00158 std::vector<MonitorElement*> h_ptshifteta;
00159 std::vector<MonitorElement*> ptres_vs_phi, chi2_vs_phi, nhits_vs_phi, phires_vs_phi;
00160
00161
00162 std::vector<MonitorElement*> ptmean_vs_eta_phi, phimean_vs_eta_phi;
00163
00164
00165 std::vector<MonitorElement*> h_assochi2, h_assochi2_prob;
00166
00167
00168 std::vector<MonitorElement*> chi2_vs_eta, nlosthits_vs_eta;
00169 std::vector<MonitorElement*> h_chi2meanh, h_losthits_eta;
00170 std::vector<MonitorElement*> h_hits_phi;
00171 std::vector<MonitorElement*> h_chi2meanhitsh, h_chi2mean_vs_phi;
00172
00173
00174 std::vector<MonitorElement*> dxyres_vs_eta, ptres_vs_eta, dzres_vs_eta, phires_vs_eta, cotThetares_vs_eta;
00175 std::vector<MonitorElement*> dxyres_vs_pt, ptres_vs_pt, dzres_vs_pt, phires_vs_pt, cotThetares_vs_pt;
00176
00177 std::vector<MonitorElement*> h_dxyrmsh, h_ptrmsh, h_dzrmsh, h_phirmsh, h_cotThetarmsh;
00178 std::vector<MonitorElement*> h_dxyrmshPt, h_ptrmshPt, h_dzrmshPt, h_phirmshPt, h_cotThetarmshPt;
00179 std::vector<MonitorElement*> h_ptrmshPhi, h_phirmshPhi;
00180
00181
00182 std::vector<MonitorElement*> h_dxymeanh, h_ptmeanh, h_dzmeanh, h_phimeanh, h_cotThetameanh;
00183 std::vector<MonitorElement*> h_dxymeanhPt, h_ptmeanhPt, h_dzmeanhPt, h_phimeanhPt, h_cotThetameanhPt;
00184 std::vector<MonitorElement*> h_ptmeanhPhi, h_phimeanhPhi;
00185
00186
00187 std::vector<MonitorElement*> dxypull_vs_eta, ptpull_vs_eta, dzpull_vs_eta, phipull_vs_eta, thetapull_vs_eta;
00188 std::vector<MonitorElement*> ptpull_vs_phi, phipull_vs_phi, thetapull_vs_phi;
00189 std::vector<MonitorElement*> h_dxypulleta, h_ptpulleta, h_dzpulleta, h_phipulleta, h_thetapulleta;
00190 std::vector<MonitorElement*> h_ptpullphi, h_phipullphi, h_thetapullphi;
00191 std::vector<MonitorElement*> h_dxypulletamean, h_ptpulletamean, h_dzpulletamean, h_phipulletamean, h_thetapulletamean;
00192 std::vector<MonitorElement*> h_ptpullphimean, h_phipullphimean, h_thetapullphimean;
00193 };
00194
00195
00196 #endif