00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "DQMOffline/Muon/src/MuonSeedsAnalyzer.h"
00012
00013 #include "DataFormats/Common/interface/Handle.h"
00014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00015 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00016 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00017 #include "DataFormats/TrackReco/interface/Track.h"
00018
00019 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00020 #include "DataFormats/TrackReco/interface/Track.h"
00021 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
00022
00023 #include "RecoMuon/TrackingTools/interface/MuonPatternRecoDumper.h"
00024 #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
00025 #include "TrackingTools/DetLayers/interface/DetLayer.h"
00026 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
00027
00028 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00029
00030 #include <string>
00031 using namespace std;
00032 using namespace edm;
00033
00034
00035
00036 MuonSeedsAnalyzer::MuonSeedsAnalyzer(const edm::ParameterSet& pSet, MuonServiceProxy *theService):MuonAnalyzerBase(theService) {
00037 parameters = pSet;
00038 }
00039
00040
00041 MuonSeedsAnalyzer::~MuonSeedsAnalyzer() { }
00042
00043
00044 void MuonSeedsAnalyzer::beginJob(DQMStore * dbe) {
00045
00046 metname = "seedsAnalyzer";
00047
00048 LogTrace(metname)<<"[MuonSeedsAnalyzer] Parameters initialization";
00049 dbe->setCurrentFolder("Muons/MuonSeedsAnalyzer");
00050
00051 seedHitBin = parameters.getParameter<int>("RecHitBin");
00052 seedHitMin = parameters.getParameter<double>("RecHitMin");
00053 seedHitMax = parameters.getParameter<double>("RecHitMax");
00054 string histname = "NumberOfRecHitsPerSeed_";
00055 NumberOfRecHitsPerSeed = dbe->book1D(histname, "Number of seed recHits", seedHitBin, seedHitMin, seedHitMax);
00056
00057 PhiBin = parameters.getParameter<int>("PhiBin");
00058 PhiMin = parameters.getParameter<double>("PhiMin");
00059 PhiMax = parameters.getParameter<double>("PhiMax");
00060 histname = "seedPhi_";
00061 seedPhi = dbe->book1D(histname, "Seed #phi", PhiBin, PhiMin, PhiMax);
00062 seedPhi->setAxisTitle("rad");
00063
00064 EtaBin = parameters.getParameter<int>("EtaBin");
00065 EtaMin = parameters.getParameter<double>("EtaMin");
00066 EtaMax = parameters.getParameter<double>("EtaMax");
00067 histname = "seedEta_";
00068 seedEta = dbe->book1D(histname, "Seed #eta", EtaBin, EtaMin, EtaMax);
00069
00070 ThetaBin = parameters.getParameter<int>("ThetaBin");
00071 ThetaMin = parameters.getParameter<double>("ThetaMin");
00072 ThetaMax = parameters.getParameter<double>("ThetaMax");
00073 histname = "seedTheta_";
00074 seedTheta = dbe->book1D(histname, "Seed #theta", ThetaBin, ThetaMin, ThetaMax);
00075 seedTheta->setAxisTitle("rad");
00076
00077 seedPtBin = parameters.getParameter<int>("seedPtBin");
00078 seedPtMin = parameters.getParameter<double>("seedPtMin");
00079 seedPtMax = parameters.getParameter<double>("seedPtMax");
00080 histname = "seedPt_";
00081 seedPt = dbe->book1D(histname, "Seed p_{t}", seedPtBin, seedPtMin, seedPtMax);
00082 seedPt->setAxisTitle("GeV");
00083
00084 seedPxyzBin = parameters.getParameter<int>("seedPxyzBin");
00085 seedPxyzMin = parameters.getParameter<double>("seedPxyzMin");
00086 seedPxyzMax = parameters.getParameter<double>("seedPxyzMax");
00087 histname = "seedPx_";
00088 seedPx = dbe->book1D(histname, "Seed p_{x}", seedPxyzBin, seedPxyzMin, seedPxyzMax);
00089 seedPx->setAxisTitle("GeV");
00090 histname = "seedPy_";
00091 seedPy = dbe->book1D(histname, "Seed p_{y}", seedPxyzBin, seedPxyzMin, seedPxyzMax);
00092 seedPy->setAxisTitle("GeV");
00093 histname = "seedPz_";
00094 seedPz = dbe->book1D(histname, "Seed p_{z}", seedPxyzBin, seedPxyzMin, seedPxyzMax);
00095 seedPz->setAxisTitle("GeV");
00096
00097 pErrBin = parameters.getParameter<int>("pErrBin");
00098 pErrMin = parameters.getParameter<double>("pErrMin");
00099 pErrMax = parameters.getParameter<double>("pErrMax");
00100 histname = "seedPtErrOverPt_";
00101 seedPtErr = dbe->book1D(histname, "Seed p_{t}Err/p_{t}", pErrBin, pErrMin, pErrMax);
00102 histname = "seedPtErrOverPtVsPhi_";
00103 seedPtErrVsPhi = dbe->book2D(histname, "Seed p_{t}Err/p_{t} vs #phi", PhiBin, PhiMin, PhiMax, pErrBin, pErrMin, pErrMax);
00104 seedPtErrVsPhi->setAxisTitle("rad",2);
00105 histname = "seedPtErrOverPtVsEta_";
00106 seedPtErrVsEta = dbe->book2D(histname, "Seed p_{t}Err/p_{t} vs #eta", EtaBin, EtaMin, EtaMax, pErrBin, pErrMin, pErrMax);
00107 histname = "seedPtErrOverPtVsPt_";
00108 seedPtErrVsPt = dbe->book2D(histname, "Seed p_{t}Err/p_{t} vs p_{t}", seedPtBin/5, seedPtMin, seedPtMax, pErrBin, pErrMin, pErrMax);
00109 seedPtErrVsPt->setAxisTitle("GeV",2);
00110 histname = "seedPErrOverP_";
00111 seedPErr = dbe->book1D(histname, "Seed pErr/p", pErrBin, pErrMin, pErrMax);
00112 histname = "seedPErrOverPVsPhi_";
00113 seedPErrVsPhi = dbe->book2D(histname, "Seed pErr/p vs #phi", PhiBin, PhiMin, PhiMax, pErrBin, pErrMin, pErrMax);
00114 seedPErrVsPhi->setAxisTitle("rad",2);
00115 histname = "seedPErrOverPVsEta_";
00116 seedPErrVsEta = dbe->book2D(histname, "Seed pErr/p vs #eta", EtaBin, EtaMin, EtaMax, pErrBin, pErrMin, pErrMax);
00117 histname = "seedPErrOverPVsPt_";
00118 seedPErrVsPt = dbe->book2D(histname, "Seed pErr/p vs p_{t}", seedPtBin/5, seedPtMin, seedPtMax, pErrBin, pErrMin, pErrMax);
00119 seedPErrVsPt->setAxisTitle("GeV",2);
00120
00121 pxyzErrBin = parameters.getParameter<int>("pxyzErrBin");
00122 pxyzErrMin = parameters.getParameter<double>("pxyzErrMin");
00123 pxyzErrMax = parameters.getParameter<double>("pxyzErrMax");
00124 histname = "seedPxErrOverPx_";
00125 seedPxErr = dbe->book1D(histname, "Seed p_{x}Err/p_{x}", pxyzErrBin, pxyzErrMin, pxyzErrMax);
00126 histname = "seedPyErrOverPy_";
00127 seedPyErr = dbe->book1D(histname, "Seed p_{y}Err/p_{y}", pxyzErrBin, pxyzErrMin, pxyzErrMax);
00128 histname = "seedPzErrOverPz_";
00129 seedPzErr = dbe->book1D(histname, "Seed p_{z}Err/p_{z}", pxyzErrBin, pxyzErrMin, pxyzErrMax);
00130
00131 phiErrBin = parameters.getParameter<int>("phiErrBin");
00132 phiErrMin = parameters.getParameter<double>("phiErrMin");
00133 phiErrMax = parameters.getParameter<double>("phiErrMax");
00134 histname = "seedPhiErr_";
00135 seedPhiErr = dbe->book1D(histname, "Seed #phi error", phiErrBin, phiErrMin, phiErrMax);
00136
00137 etaErrBin = parameters.getParameter<int>("etaErrBin");
00138 etaErrMin = parameters.getParameter<double>("etaErrMin");
00139 etaErrMax = parameters.getParameter<double>("etaErrMax");
00140 histname = "seedEtaErr_";
00141 seedEtaErr = dbe->book1D(histname, "Seed #eta error", etaErrBin, etaErrMin, etaErrMax);
00142
00143 }
00144
00145
00146 void MuonSeedsAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const TrajectorySeed& seed) {
00147
00148 TrajectoryStateOnSurface seedTSOS = getSeedTSOS(seed);
00149 AlgebraicSymMatrix66 errors = seedTSOS.cartesianError().matrix();
00150 double partialPterror = errors(3,3)*pow(seedTSOS.globalMomentum().x(),2) + errors(4,4)*pow(seedTSOS.globalMomentum().y(),2);
00151
00152 LogTrace(metname)<<"[MuonSeedAnalyzer] Filling the histos";
00153
00154
00155 LogTrace(metname)<<"Number od recHits per seed: "<<seed.nHits();
00156 NumberOfRecHitsPerSeed->Fill(seed.nHits());
00157
00158
00159 LogTrace(metname)<<"seed momentum: "<<seedTSOS.globalMomentum().perp();
00160 seedPt->Fill(seedTSOS.globalMomentum().perp());
00161
00162
00163 LogTrace(metname)<<"seed px: "<<seedTSOS.globalMomentum().x();
00164 seedPx->Fill(seedTSOS.globalMomentum().x());
00165
00166
00167 LogTrace(metname)<<"seed py: "<<seedTSOS.globalMomentum().y();
00168 seedPy->Fill(seedTSOS.globalMomentum().y());
00169
00170
00171 LogTrace(metname)<<"seed pz: "<<seedTSOS.globalMomentum().z();
00172 seedPz->Fill(seedTSOS.globalMomentum().z());
00173
00174
00175 LogTrace(metname)<<"seed phi: "<<seedTSOS.globalMomentum().phi();
00176 seedPhi->Fill(seedTSOS.globalMomentum().phi());
00177
00178
00179 LogTrace(metname)<<"seed theta: "<<seedTSOS.globalMomentum().theta();
00180 seedTheta->Fill(seedTSOS.globalMomentum().theta());
00181
00182
00183 LogTrace(metname)<<"seed eta: "<<seedTSOS.globalMomentum().eta();
00184 seedEta->Fill(seedTSOS.globalMomentum().eta());
00185
00186
00187 LogTrace(metname)<<"seed pt error: "<<sqrt(partialPterror)/seedTSOS.globalMomentum().perp();
00188 seedPtErr->Fill(sqrt(partialPterror)/seedTSOS.globalMomentum().perp());
00189
00190
00191 seedPtErrVsPhi->Fill(seedTSOS.globalMomentum().phi(),
00192 sqrt(partialPterror)/seedTSOS.globalMomentum().perp());
00193
00194 seedPtErrVsEta->Fill(seedTSOS.globalMomentum().eta(),
00195 sqrt(partialPterror)/seedTSOS.globalMomentum().perp());
00196
00197 seedPtErrVsPt->Fill(seedTSOS.globalMomentum().perp(),
00198 sqrt(partialPterror)/seedTSOS.globalMomentum().perp());
00199
00200
00201 LogTrace(metname)<<"seed px error: "<<sqrt(errors(3,3))/seedTSOS.globalMomentum().x();
00202 seedPxErr->Fill(sqrt(errors(3,3))/seedTSOS.globalMomentum().x());
00203
00204
00205 LogTrace(metname)<<"seed py error: "<<sqrt(errors(4,4))/seedTSOS.globalMomentum().y();
00206 seedPyErr->Fill(sqrt(errors(4,4))/seedTSOS.globalMomentum().y());
00207
00208
00209 LogTrace(metname)<<"seed pz error: "<<sqrt(errors(5,5))/seedTSOS.globalMomentum().z();
00210 seedPzErr->Fill(sqrt(errors(5,5))/seedTSOS.globalMomentum().z());
00211
00212
00213 LogTrace(metname)<<"seed p error: "<<sqrt(partialPterror+errors(5,5)*pow(seedTSOS.globalMomentum().z(),2))/seedTSOS.globalMomentum().mag();
00214 seedPErr->Fill(sqrt(partialPterror+errors(5,5)*pow(seedTSOS.globalMomentum().z(),2))/seedTSOS.globalMomentum().mag());
00215
00216
00217 seedPErrVsPhi->Fill(seedTSOS.globalMomentum().phi(),
00218 sqrt(partialPterror+errors(5,5)*pow(seedTSOS.globalMomentum().z(),2))/seedTSOS.globalMomentum().mag());
00219
00220 seedPErrVsEta->Fill(seedTSOS.globalMomentum().eta(),
00221 sqrt(partialPterror+errors(5,5)*pow(seedTSOS.globalMomentum().z(),2))/seedTSOS.globalMomentum().mag());
00222
00223 seedPErrVsPt->Fill(seedTSOS.globalMomentum().perp(),
00224 sqrt(partialPterror+errors(5,5)*pow(seedTSOS.globalMomentum().z(),2))/seedTSOS.globalMomentum().mag());
00225
00226
00227 LogTrace(metname)<<"seed phi error: "<<sqrt(seedTSOS.curvilinearError().matrix()(2,2));
00228 seedPhiErr->Fill(sqrt(seedTSOS.curvilinearError().matrix()(2,2)));
00229
00230
00231 LogTrace(metname)<<"seed eta error: "<<sqrt(seedTSOS.curvilinearError().matrix()(1,1))*abs(sin(seedTSOS.globalMomentum().theta()));
00232 seedEtaErr->Fill(sqrt(seedTSOS.curvilinearError().matrix()(1,1))*abs(sin(seedTSOS.globalMomentum().theta())));
00233
00234 }
00235
00236
00237 TrajectoryStateOnSurface MuonSeedsAnalyzer::getSeedTSOS(const TrajectorySeed& seed){
00238
00239
00240 PTrajectoryStateOnDet pTSOD = seed.startingState();
00241
00242 TrajectoryStateTransform tsTransform;
00243 DetId seedDetId(pTSOD.detId());
00244 const GeomDet* gdet = service()->trackingGeometry()->idToDet( seedDetId );
00245 TrajectoryStateOnSurface initialState = tsTransform.transientState(pTSOD, &(gdet->surface()), &*(service())->magneticField());
00246
00247 return initialState;
00248
00249 }
00250
00251