35 #include <TProfile2D.h> 37 #include <TDirectory.h> 46 : myRootDir(
nullptr), myDeleteDir(
false), trackerTopology(tTopo)
48 myRootDir = TFile::Open(rootFileName,
"recreate");
77 if (!directory)
return false;
78 TDirectory *oldDir = gDirectory;
80 const int kNumBins = 20;
81 double binsPt[kNumBins+1] = {0.};
87 myTrackHists1D.push_back(
new TH1F(
"ptTrackLogBins",
"p_{t}(track);p_{t} [GeV]",
90 myTrackHists1D.push_back(
new TH1F(
"ptTrack",
"p_{t}(track);p_{t} [GeV]",
91 kNumBins, binsPt[0], binsPt[kNumBins]));
93 kNumBins, binsPt[0], 1.3*binsPt[kNumBins]));
94 myTrackHists1D.push_back(
new TH1F(
"etaTrack",
"#eta(track);#eta", 26, -2.6, 2.6));
98 myTrackHists1D.push_back(
new TH1F(
"nHitTrack",
"N_{hit}(track);N_{hit}", 40, 5., 45.));
99 myTrackHists1D.push_back(
new TH1F(
"nHitBPIXTrack",
"N_{hit, BPIX}(track);N_{hit}", 45, 0., 45.));
100 myTrackHists1D.push_back(
new TH1F(
"nHitFPIXTrack",
"N_{hit, FPIX}(track);N_{hit}", 45, 0., 45.));
101 myTrackHists1D.push_back(
new TH1F(
"nHitFPIXplusTrack",
"N_{hit, BPIXplus}(track);N_{hit}", 45, 0., 45.));
102 myTrackHists1D.push_back(
new TH1F(
"nHitFPIXminusTrack",
"N_{hit, BPIXminus}(track);N_{hit}", 45, 0., 45.));
103 myTrackHists1D.push_back(
new TH1F(
"nHitPIXELTrack",
"N_{hit, PIXEL}(track);N_{hit}", 45, 0., 45.));
104 myTrackHists1D.push_back(
new TH1F(
"nHitTIBTrack",
"N_{hit, TIB}(track);N_{hit}", 45, 0., 45.));
105 myTrackHists1D.push_back(
new TH1F(
"nHitTOBTrack",
"N_{hit, TOB}(track);N_{hit}", 45, 0., 45.));
106 myTrackHists1D.push_back(
new TH1F(
"nHitTIDplusTrack",
"N_{hit, TIDplus}(track);N_{hit}", 45, 0., 45.));
107 myTrackHists1D.push_back(
new TH1F(
"nHitTIDminusTrack",
"N_{hit, TIDminus}(track);N_{hit}", 45, 0., 45.));
108 myTrackHists1D.push_back(
new TH1F(
"nHitTIDTrack",
"N_{hit, TID}(track);N_{hit}", 45, 0., 45.));
109 myTrackHists1D.push_back(
new TH1F(
"nHitTECplusTrack",
"N_{hit, TECplus}(track);N_{hit}", 45, 0., 45.));
110 myTrackHists1D.push_back(
new TH1F(
"nHitTECminusTrack",
"N_{hit, TECminus}(track);N_{hit}", 45, 0., 45.));
111 myTrackHists1D.push_back(
new TH1F(
"nHitTECTrack",
"N_{hit, TEC}(track);N_{hit}", 45, 0., 45.));
112 myTrackHists1D.push_back(
new TH1F(
"nHitENDCAPplusTrack",
"N_{hit, ENDCAPplus}(track);N_{hit}", 45, 0., 45.));
113 myTrackHists1D.push_back(
new TH1F(
"nHitENDCAPminusTrack",
"N_{hit, ENDCAPminus}(track);N_{hit}", 45, 0., 45.));
114 myTrackHists1D.push_back(
new TH1F(
"nHitENDCAPTrack",
"N_{hit, ENDCAP}(track);N_{hit}", 45, 0., 45.));
115 myTrackHists2D.push_back(
new TH2F(
"nHitENDCAPTrackMinusVsPlus",
"N_{hit, ENDCAP}(track);N_{hit, plus};N_{hit, minus}",
116 45, 0., 45.,45, 0., 45.));
117 myTrackHists1D.push_back(
new TH1F(
"nHitInvalidTrack",
"N_{hit, invalid}(track)", 5, 0., 5.));
118 myTrackHists1D.push_back(
new TH1F(
"r1Track",
"r(1st hit);r [cm]", 20, 0., 20.));
119 myTrackHists1D.push_back(
new TH1F(
"phi1Track",
"#phi(1st hit);#phi",
121 myTrackHists1D.push_back(
new TH1F(
"y1Track",
"y(1st hit);y [cm]", 40, -120., +120.));
122 myTrackHists1D.push_back(
new TH1F(
"z1Track",
"z(1st hit);z [cm]", 20, -50, +50));
123 myTrackHists1D.push_back(
new TH1F(
"r1TrackSigned",
"r(1st hit);r_{#pm} [cm]",
125 myTrackHists1D.push_back(
new TH1F(
"z1TrackFull",
"z(1st hit);z [cm]", 20, -300., +300.));
126 myTrackHists1D.push_back(
new TH1F(
"rLastTrack",
"r(last hit);r [cm]", 20, 20., 120.));
127 myTrackHists1D.push_back(
new TH1F(
"phiLastTrack",
"#phi(last hit);#phi",
129 myTrackHists1D.push_back(
new TH1F(
"yLastTrack",
"y(last hit);y [cm]", 40, -120., +120.));
130 myTrackHists1D.push_back(
new TH1F(
"zLastTrack",
"z(last hit);z [cm]", 30, -300., +300.));
131 myTrackHists1D.push_back(
new TH1F(
"chi2PerNdf",
"#chi^{2}/ndf;#chi^{2}/ndf", 500, 0., 50.));
132 myTrackHists1D.push_back(
new TH1F(
"impParZ",
"impact parameter in z", 20, -20., 20.));
133 myTrackHists1D.push_back(
new TH1F(
"impParErrZ",
"error of impact parameter in z",
135 myTrackHists1D.push_back(
new TH1F(
"impParRphi",
"impact parameter in r#phi", 51, -0.05, .05));
136 myTrackHists1D.push_back(
new TH1F(
"impParErrRphi",
"error of impact parameter in r#phi",
139 myTrackHists2D.push_back(
new TH2F(
"rz1TrackFull",
"rz(1st hit);z [cm]; r_{#pm} [cm]",
140 40, -282., +282., 40, -115., +115.));
141 myTrackHists2D.push_back(
new TH2F(
"xy1Track",
"xy(1st hit);x [cm]; y [cm]",
142 40, -115., +115., 40, -115., +115.));
144 TDirectory *dirTracks = directory->mkdir(
"trackHists",
"input tracks");
152 myUsedTrackHists1D.push_back(
new TH1F(
"usedHitsX",
"n(x-hits) transferred to pede;n(x-hits)", nHits, 0., nHits));
153 myUsedTrackHists1D.push_back(
new TH1F(
"usedHitsY",
"n(y-hits) transferred to pede;n(y-hits)", 10, 0., 10));
155 TDirectory *dirUsedTracks = directory->mkdir(
"usedTrackHists",
"used tracks");
164 "mean of |#rho|, #rho#neq0;hit x/y;hit x/y;",
165 2*nHits, 0., nHits, 2*nHits, 0., nHits));
167 (
new TProfile2D(
"profCorrOffXy",
"mean of |#rho|, #rho#neq0, no xy_{hit};hit x/y;hit x/y;",
168 2*nHits, 0., nHits, 2*nHits, 0., nHits));
171 "hit correlations: off-block-diagonals;N(hit);#rho",
172 2*nHits, 0., nHits, 81, -.06, .06));
173 TArrayD logBins(102);
174 this->
equidistLogBins(logBins.GetArray(), logBins.GetSize()-1, 1.E-11, .1);
176 "hit correlations: off-block-diagonals;N(hit);|#rho|",
177 2*nHits, 0., nHits, logBins.GetSize()-1, logBins.GetArray()));
180 nHits, 0., nHits, 81, -.5, .5));
182 (
new TH2F(
"hitCorrXyValid",
"hit correlations: xy, 2D-det.;N(hit);#rho",
183 nHits, 0., nHits, 81, -.02, .02));
184 this->
equidistLogBins(logBins.GetArray(), logBins.GetSize()-1, 1.E-10, .5);
185 myTrajectoryHists2D.push_back(
new TH2F(
"hitCorrXyLog",
"hit correlations: xy;N(hit);|#rho|",
186 nHits, 0., nHits, logBins.GetSize()-1, logBins.GetArray()));
188 (
new TH2F(
"hitCorrXyLogValid",
"hit correlations: xy, 2D-det.;N(hit);|#rho|",
189 nHits, 0., nHits, logBins.GetSize()-1, logBins.GetArray()));
192 myTrajectoryHists1D.push_back(
new TH1F(
"measLocX",
"local x measurements;x", 101, -6., 6.));
199 myTrajectoryHists1D.push_back(
new TH1F(
"residLocX",
"local x residual;#Deltax", 101, -.75, .75));
202 myTrajectoryHists1D.push_back(
new TH1F(
"reduResidLocX",
"local x reduced residual;#Deltax/#sigma",
205 (
new TH1F(
"reduResidLocY",
"local y reduced residual, 2D-det.;#Deltay/#sigma", 101, -20., 20.));
209 nHits, 0., nHits, 101, -6., 6.));
210 myTrajectoryHists2D.push_back(
new TH2F(
"measLocYvsHit",
"local y measurements, 2D-det.;hit;y",
211 nHits, 0., nHits, 101, -10., 10.));
213 nHits, 0., nHits, 101, -6., 6.));
214 myTrajectoryHists2D.push_back(
new TH2F(
"trajLocYvsHit",
"local y trajectory, 2D-det.;hit;y",
215 nHits, 0., nHits, 101, -10., 10.));
218 nHits, 0., nHits, 101, -.75, .75));
219 myTrajectoryHists2D.push_back(
new TH2F(
"residLocYvsHit",
"local y residual, 2D-det.;hit;#Deltay",
220 nHits, 0., nHits, 101, -1., 1.));
222 (
new TH2F(
"reduResidLocXvsHit",
"local x reduced residual;hit;#Deltax/#sigma",
223 nHits, 0., nHits, 101, -20., 20.));
225 (
new TH2F(
"reduResidLocYvsHit",
"local y reduced residual, 2D-det.;hit;#Deltay/#sigma",
226 nHits, 0., nHits, 101, -20., 20.));
230 "mean derivatives;hit x/y;parameter;",
231 2*nHits, 0., nHits, 10, 0., 10.));
234 (
new TH2F(
"derivatives",
"derivative;parameter;#partial(x/y)_{local}/#partial(param)",
235 10, 0., 10., 101, -20., 20.));
236 this->
equidistLogBins(logBins.GetArray(), logBins.GetSize()-1, 1.E-12, 100.);
238 (
new TH2F(
"derivativesLog",
"|derivative|;parameter;|#partial(x/y)_{local}/#partial(param)|",
239 10, 0., 10., logBins.GetSize()-1, logBins.GetArray()));
241 (
new TH2F(
"derivativesVsPhi",
242 "derivatives vs. #phi;#phi(geomDet);#partial(x/y)_{local}/#partial(param)",
246 TDirectory *dirTraject = directory->mkdir(
"refTrajectoryHists",
"ReferenceTrajectory's");
252 (
new TH2F(
"localDerivsPar",
"local derivatives vs. paramater;parameter;#partial/#partial(param)",
253 6, 0., 6., 101, -200., 200.));
255 (
new TH2F(
"localDerivsPhi",
"local derivatives vs. #phi(det);#phi(det);#partial/#partial(param)",
257 this->
equidistLogBins(logBins.GetArray(), logBins.GetSize()-1, 1.E-13, 150.);
259 (
new TH2F(
"localDerivsParLog",
260 "local derivatives (#neq 0) vs. parameter;parameter;|#partial/#partial(param)|",
261 6, 0., 6., logBins.GetSize()-1, logBins.GetArray()));
263 (
new TH2F(
"localDerivsPhiLog",
264 "local derivatives (#neq 0) vs. #phi(det);#phi(det);|#partial/#partial(param)|",
268 (
new TH2F(
"globalDerivsPar",
269 "global derivatives vs. paramater;parameter;#partial/#partial(param)",
270 maxParNum, 0., maxParNum, 100, -200, 200));
272 (
new TH2F(
"globalDerivsPhi",
273 "global derivatives vs. #phi(det);#phi(det);#partial/#partial(param)",
275 this->
equidistLogBins(logBins.GetArray(), logBins.GetSize()-1, 1.E-7, 5.e2);
277 (
new TH2F(
"globalDerivsParLog",
278 "global derivatives (#neq 0) vs. parameter;parameter;|#partial/#partial(param)|",
279 maxParNum, 0., maxParNum, logBins.GetSize()-1, logBins.GetArray()));
281 (
new TH2F(
"globalDerivsPhiLog",
282 "global derivatives (#neq 0) vs. #phi(det);#phi(det);|#partial/#partial(param)|",
290 TDirectory *dirDerivs = directory->mkdir(
"derivatives",
"derivatives etc.");
294 myResidHists2D.push_back(
new TH2F(
"residPhi",
"residuum vs. #phi(det);#phi(det);residuum[cm]",
296 myResidHists2D.push_back(
new TH2F(
"sigmaPhi",
"#sigma vs. #phi(det);#phi(det);#sigma[cm]",
299 "residuum/#sigma vs. #phi(det);#phi(det);residuum/#sigma",
339 TDirectory *dirResid = directory->mkdir(
"residuals",
"hit residuals, sigma,...");
345 std::vector<TH1*> allResidHistsX;
346 allResidHistsX.push_back(
new TH1F(
"resid",
"hit residuals;residuum [cm]", 101,-.5,.5));
348 allResidHistsX.push_back(
new TH1F(
"sigma",
"hit uncertainties;#sigma [cm]", 100,0.,1.));
350 allResidHistsX.push_back(
new TH1F(
"reduResid",
"reduced hit residuals;res./#sigma",
353 allResidHistsX.push_back(
new TH1F(
"angle",
"#phi_{tr} wrt normal (sens. plane);#phi_{n}^{sens}",
354 50, 0., TMath::PiOver2()));
355 allResidHistsX.push_back(
new TH2F(
"residVsAngle",
356 "residuum vs. #phi_{tr} wrt normal (sens. plane);#phi_{n}^{sens};residuum [cm]",
357 50, 0., TMath::PiOver2(), 51, -1., 1.));
358 this->
equidistLogBins(logBins.GetArray(), logBins.GetSize()-1, 1.E-6, 100.);
359 allResidHistsX.push_back(
new TH2F(
"sigmaVsAngle",
360 "#sigma vs. #phi_{tr} wrt normal (sens. plane);#phi_{n}^{sens};#sigma [cm]",
361 50, 0., TMath::PiOver2(), logBins.GetSize()-1, logBins.GetArray()));
362 allResidHistsX.push_back(
new TH2F(
"reduResidVsAngle",
363 "reduced residuum vs. #phi_{tr} wrt normal (sens. plane);#phi_{n}^{sens};res./#sigma",
364 50, 0., TMath::PiOver2(), 51, -15., 15.));
366 allResidHistsX.push_back(
new TH1F(
"residGt45",
367 "hit residuals (#phi_{n}^{sens}>45#circ);residuum [cm]",
370 allResidHistsX.push_back(
new TH1F(
"sigmaGt45",
371 "hit uncertainties(#phi_{n}^{sens}>45#circ);#sigma [cm]",
374 allResidHistsX.push_back(
new TH1F(
"reduResidGt45",
375 "reduced hit residuals(#phi_{n}^{sens}>45#circ);res./#sigma",
378 allResidHistsX.push_back(
new TH1F(
"residLt45",
379 "hit residuals (#phi_{n}^{sens}<45#circ);residuum [cm]",
382 allResidHistsX.push_back(
new TH1F(
"sigmaLt45",
383 "hit uncertainties(#phi_{n}^{sens}<45#circ);#sigma [cm]",
386 allResidHistsX.push_back(
new TH1F(
"reduResidLt45",
387 "reduced hit residuals(#phi_{n}^{sens}<45#circ);res./#sigma",
398 for (
unsigned int iHit = 0; iHit < 30; ++iHit) {
399 for (
unsigned int iHist = 0; iHist < 4 && iHist < allResidHistsX.size(); ++iHist) {
400 TH1 *
h = allResidHistsX[iHist];
401 myResidHitHists1DX.push_back(static_cast<TH1*>(h->Clone(Form(
"%s_%d", h->GetName(), iHit))));
406 TDirectory *dirResidX =
407 (dirResid ? dirResid :
directory)->
mkdir(
"X",
"hit residuals etc. for x measurements");
416 std::vector<TH1*> &yHists1D = allResidHistsX;
425 TDirectory *dirResidY =
426 (dirResid ? dirResid :
directory)->
mkdir(
"Y",
"hit residuals etc. for y measurements");
435 "mean frame to frame derivatives;col;row",
436 6, 0., 6., 6, 0., 6.));
438 "mean |frame to frame derivatives|, #neq0;col;row",
439 6, 0., 6., 6, 0., 6.));
441 this->
equidistLogBins(logBins.GetArray(), logBins.GetSize()-1, 1.E-36, 100.);
442 for (
unsigned int i = 0;
i < 6; ++
i) {
443 for (
unsigned int j = 0; j < 6; ++j) {
445 (
new TH2F(Form(
"frame2framePhi%d%d",
i, j),
446 Form(
"frame to frame derivatives, %d%d;#phi(aliDet);deriv",
i,j),
450 (
new TH2F(Form(
"frame2frameR%d%d",
i, j),
451 Form(
"frame to frame derivatives, %d%d;r(aliDet);deriv",
i,j),
452 51, 0., 110., 10, 0., 1.));
456 (
new TH2F(Form(
"frame2framePhiLog%d%d",
i, j),
457 Form(
"frame to frame |derivatives|, %d%d, #neq0;#phi(aliDet);deriv",
i,j),
460 (
new TH2F(Form(
"frame2frameRLog%d%d",
i, j),
461 Form(
"frame to frame |derivatives|, %d%d, #neq0;r(aliDet);deriv",
i,j),
462 51, 0., 110., logBins.GetSize()-1, logBins.GetArray()));
466 TDirectory *dirF2f = directory->mkdir(
"frame2FrameHists",
"derivatives etc.");
470 myCorrHists.push_back(
new TH1F(
"xyCorrTPB",
"#rho_{xy} in pixel barrel", 50, -.5, .5));
471 myCorrHists.push_back(
new TH1F(
"xyCorrTPE",
"#rho_{xy} in forward pixel", 50, -.5, .5));
472 myCorrHists.push_back(
new TH1F(
"xyCorrTIB",
"#rho_{xy} in TIB", 50, -.5, .5));
473 myCorrHists.push_back(
new TH1F(
"xyCorrTID",
"#rho_{xy} in TID", 50, -1., 1.));
474 myCorrHists.push_back(
new TH1F(
"xyCorrTOB",
"#rho_{xy} in TOB", 50, -.5, .5));
475 myCorrHists.push_back(
new TH1F(
"xyCorrTEC",
"#rho_{xy} in TEC", 50, -1., 1.));
476 TDirectory *dirCorr = directory->mkdir(
"hitCorrelationHists",
"correlations");
480 myPxbSurveyHists.push_back(
new TH1F(
"PxbSurvChi2_lo",
"#chi^{2} from PXB survey", 25, 0, 25));
481 myPxbSurveyHists.push_back(
new TH1F(
"PxbSurvChi2_md",
"#chi^{2} from PXB survey", 25, 0, 500));
482 myPxbSurveyHists.push_back(
new TH1F(
"PxbSurvChi2_hi",
"#chi^{2} from PXB survey", 25, 0, 50000));
483 myPxbSurveyHists.push_back(
new TH1F(
"PxbSurvChi2prob",
"Math::Prob(#chi^{2},4) from PXB survey", 25, 0, 1));
484 myPxbSurveyHists.push_back(
new TH1F(
"PxbSurv_a0",
"a_{0} from PXB survey", 100, -3000, 3000));
485 myPxbSurveyHists.push_back(
new TH1F(
"PxbSurv_a0_abs",
"fabs(a_{0}) from PXB survey", 100, 0, 3000));
486 myPxbSurveyHists.push_back(
new TH1F(
"PxbSurv_a1",
"a_{1} from PXB survey", 100, -6000, 6000));
487 myPxbSurveyHists.push_back(
new TH1F(
"PxbSurv_a1_abs",
"fabs(a_{1}) from PXB survey", 100, 0, 6000));
488 myPxbSurveyHists.push_back(
new TH1F(
"PxbSurv_scale",
"scale (#sqrt{a_{2}^{2}+a_{3}^{2}}) from PXB survey", 100, 0, 1500));
489 myPxbSurveyHists.push_back(
new TH1F(
"PxbSurv_phi",
"angle(#atan{a_{3}/a_{4}}) from PXB survey", 100, -.05, .05));
490 TDirectory *dirPxbSurvey = directory->mkdir(
"PxbSurveyHists",
"PxbSurvey");
507 if (nBins < 1 || first <= 0. || last <= 0.)
return false;
511 const double firstLog = TMath::Log10(bins[0]);
512 const double lastLog = TMath::Log10(bins[nBins]);
513 for (
int i = 1;
i < nBins; ++
i) {
514 bins[
i] = TMath::Power(10., firstLog +
i*(lastLog-firstLog)/(nBins));
542 std::vector<TH2*> &trackHists2D)
548 static const int iPtLog = this->
GetIndex(trackHists1D,
"ptTrackLogBins");
549 trackHists1D[iPtLog]->Fill(track->
pt());
550 static const int iPt = this->
GetIndex(trackHists1D,
"ptTrack");
551 trackHists1D[iPt]->Fill(track->
pt());
552 static const int iP = this->
GetIndex(trackHists1D,
"pTrack");
553 trackHists1D[iP]->Fill(
p.R());
554 static const int iEta = this->
GetIndex(trackHists1D,
"etaTrack");
555 trackHists1D[iEta]->Fill(
p.Eta());
556 static const int iTheta = this->
GetIndex(trackHists1D,
"thetaTrack");
557 trackHists1D[iTheta]->Fill(
p.Theta());
558 static const int iPhi = this->
GetIndex(trackHists1D,
"phiTrack");
559 trackHists1D[iPhi]->Fill(
p.Phi());
561 static const int iNhit = this->
GetIndex(trackHists1D,
"nHitTrack");
563 static const int iNhitInvalid = this->
GetIndex(trackHists1D,
"nHitInvalidTrack");
566 int nhitinTIB = 0, nhitinTOB = 0, nhitinTID = 0;
567 int nhitinTEC = 0, nhitinBPIX = 0, nhitinFPIX = 0, nhitinPIXEL=0;
568 int nhitinENDCAP = 0, nhitinENDCAPplus = 0, nhitinENDCAPminus = 0;
569 int nhitinTIDplus = 0, nhitinTIDminus = 0;
570 int nhitinFPIXplus = 0, nhitinFPIXminus = 0;
571 int nhitinTECplus = 0, nhitinTECminus = 0;
572 unsigned int thishit = 0;
576 const DetId detId(
hit->geographicalId());
577 const int subdetId = detId.
subdetId();
579 if (!
hit->isValid())
continue;
581 edm::LogError(
"DetectorMismatch") <<
"@SUB=MillePedeMonitor::fillTrack" 583 <<
"), but " << detId.det() <<
".";
614 else if (
kBPIX == subdetId) {++nhitinBPIX;++nhitinPIXEL;}
615 else if (
kFPIX == subdetId) {
625 static const int iNhit01 = this->
GetIndex(trackHists1D,
"nHitBPIXTrack");
626 trackHists1D[iNhit01]->Fill(nhitinBPIX);
627 static const int iNhit02 = this->
GetIndex(trackHists1D,
"nHitFPIXplusTrack");
628 trackHists1D[iNhit02]->Fill(nhitinFPIXplus);
629 static const int iNhit03 = this->
GetIndex(trackHists1D,
"nHitFPIXminusTrack");
630 trackHists1D[iNhit03]->Fill(nhitinFPIXminus);
631 static const int iNhit04 = this->
GetIndex(trackHists1D,
"nHitFPIXTrack");
632 trackHists1D[iNhit04]->Fill(nhitinFPIX);
633 static const int iNhit05 = this->
GetIndex(trackHists1D,
"nHitPIXELTrack");
634 trackHists1D[iNhit05]->Fill(nhitinPIXEL);
635 static const int iNhit06 = this->
GetIndex(trackHists1D,
"nHitTIBTrack");
636 trackHists1D[iNhit06]->Fill(nhitinTIB);
637 static const int iNhit07 = this->
GetIndex(trackHists1D,
"nHitTOBTrack");
638 trackHists1D[iNhit07]->Fill(nhitinTOB);
639 static const int iNhit08 = this->
GetIndex(trackHists1D,
"nHitTIDplusTrack");
640 trackHists1D[iNhit08]->Fill(nhitinTIDplus);
641 static const int iNhit09 = this->
GetIndex(trackHists1D,
"nHitTIDminusTrack");
642 trackHists1D[iNhit09]->Fill(nhitinTIDminus);
643 static const int iNhit10 = this->
GetIndex(trackHists1D,
"nHitTIDTrack");
644 trackHists1D[iNhit10]->Fill(nhitinTID);
645 static const int iNhit11 = this->
GetIndex(trackHists1D,
"nHitTECplusTrack");
646 trackHists1D[iNhit11]->Fill(nhitinTECplus);
647 static const int iNhit12 = this->
GetIndex(trackHists1D,
"nHitTECminusTrack");
648 trackHists1D[iNhit12]->Fill(nhitinTECminus);
649 static const int iNhit13 = this->
GetIndex(trackHists1D,
"nHitTECTrack");
650 trackHists1D[iNhit13]->Fill(nhitinTEC);
651 static const int iNhit14 = this->
GetIndex(trackHists1D,
"nHitENDCAPplusTrack");
652 trackHists1D[iNhit14]->Fill(nhitinENDCAPplus);
653 static const int iNhit15 = this->
GetIndex(trackHists1D,
"nHitENDCAPminusTrack");
654 trackHists1D[iNhit15]->Fill(nhitinENDCAPminus);
655 static const int iNhit16 = this->
GetIndex(trackHists1D,
"nHitENDCAPTrack");
656 trackHists1D[iNhit16]->Fill(nhitinENDCAP);
657 static const int iNhit17 = this->
GetIndex(trackHists2D,
"nHitENDCAPTrackMinusVsPlus");
658 trackHists2D[iNhit17]->Fill(nhitinENDCAPplus,nhitinENDCAPminus);
662 static const int iR1 = this->
GetIndex(trackHists1D,
"r1Track");
663 trackHists1D[iR1]->Fill(firstPoint.Rho());
664 const double rSigned1 = (firstPoint.y() > 0 ? firstPoint.Rho() : -firstPoint.Rho());
665 static const int iR1Signed = this->
GetIndex(trackHists1D,
"r1TrackSigned");
666 trackHists1D[iR1Signed]->Fill(rSigned1);
667 static const int iZ1 = this->
GetIndex(trackHists1D,
"z1Track");
668 trackHists1D[iZ1]->Fill(firstPoint.Z());
669 static const int iZ1Full = this->
GetIndex(trackHists1D,
"z1TrackFull");
670 trackHists1D[iZ1Full]->Fill(firstPoint.Z());
671 static const int iY1 = this->
GetIndex(trackHists1D,
"y1Track");
672 trackHists1D[iY1]->Fill(firstPoint.Y());
673 static const int iPhi1 = this->
GetIndex(trackHists1D,
"phi1Track");
674 trackHists1D[iPhi1]->Fill(firstPoint.phi());
675 static const int iRz1Full = this->
GetIndex(trackHists2D,
"rz1TrackFull");
676 trackHists2D[iRz1Full]->Fill(firstPoint.Z(), rSigned1);
677 static const int iXy1 = this->
GetIndex(trackHists2D,
"xy1Track");
678 trackHists2D[iXy1]->Fill(firstPoint.X(), firstPoint.Y());
683 static const int iRlast = this->
GetIndex(trackHists1D,
"rLastTrack");
684 trackHists1D[iRlast]->Fill(lastPoint.Rho());
685 static const int iZlast = this->
GetIndex(trackHists1D,
"zLastTrack");
686 trackHists1D[iZlast]->Fill(lastPoint.Z());
687 static const int iYlast = this->
GetIndex(trackHists1D,
"yLastTrack");
688 trackHists1D[iYlast]->Fill(lastPoint.Y());
689 static const int iPhiLast = this->
GetIndex(trackHists1D,
"phiLastTrack");
690 trackHists1D[iPhiLast]->Fill(lastPoint.phi());
693 static const int iChi2Ndf = this->
GetIndex(trackHists1D,
"chi2PerNdf");
696 static const int iImpZ = this->
GetIndex(trackHists1D,
"impParZ");
697 trackHists1D[iImpZ]->Fill(track->
dz());
698 static const int iImpZerr = this->
GetIndex(trackHists1D,
"impParErrZ");
699 trackHists1D[iImpZerr]->Fill(track->
dzError());
702 static const int iImpRphi = this->
GetIndex(trackHists1D,
"impParRphi");
703 trackHists1D[iImpRphi]->Fill(track->
d0());
704 static const int iImpRphiErr = this->
GetIndex(trackHists1D,
"impParErrRphi");
705 trackHists1D[iImpRphiErr]->Fill(track->
d0Error());
714 if (refTrajPtr->isValid()) {
723 const AlgebraicVector &trajectoryLoc = refTrajPtr->trajectoryPositions();
728 const int nRow = refTrajPtr->numberOfHitMeas();
730 for (
int iRow = 0; iRow < nRow; ++iRow) {
731 const double residuum = measurementsLoc[iRow] - trajectoryLoc[iRow];
732 const double covMeasLocRow = covMeasLoc[iRow][iRow];
733 const bool is2DhitRow = (!recHits[iRow/2]->detUnit()
734 || recHits[iRow/2]->detUnit()->type().isTrackerPixel());
751 if (covMeasLocRow > 0.) {
754 static const int iReduResidLocXvsHit =
756 myTrajectoryHists2D[iReduResidLocXvsHit]->Fill(iRow/2, residuum/TMath::Sqrt(covMeasLocRow));
758 }
else if (is2DhitRow) {
774 if (covMeasLocRow > 0.) {
778 "reduResidLocYvsHit");
779 myTrajectoryHists2D[iReduResidLocYvsHit]->Fill(iRow/2, residuum/TMath::Sqrt(covMeasLocRow));
783 float nHitRow = iRow/2;
786 for (
int iCol = iRow+1; iCol < nRow; ++iCol) {
787 double rho = TMath::Sqrt(covMeasLocRow + covMeasLoc[iCol][iCol]);
788 rho = (0. == rho ? -2 : covMeasLoc[iRow][iCol] /
rho);
789 float nHitCol = iCol/2;
792 if (0. == rho)
continue;
806 "hitCorrXyLogValid");
820 for (
int iCol = 0; iCol < derivatives.num_col(); ++iCol) {
829 derivatives[iRow][iCol]);
837 const float *localDerivs,
unsigned int nLocal,
838 const float *globalDerivs,
unsigned int nGlobal,
841 const double phi = recHit->det()->position().phi();
847 for (
unsigned int i = 0;
i < nLocal; ++
i) {
850 if (localDerivs[i]) {
861 for (
unsigned int i = 0;
i < nGlobal; ++
i) {
865 if (globalDerivs[i]) {
878 unsigned int nHit,
float residuum,
float sigma,
bool isY)
882 const GlobalPoint detPos(recHit->det()->position());
883 const double phi = detPos.phi();
928 const float phiSensToNorm = TMath::ATan(
TMath::Abs((isY ? mom.y() : mom.x())/mom.z()));
937 const DetId detId(recHit->det()->geographicalId());
940 unsigned int subDetNum = detId.
subdetId();
941 if (subDetNum < histArrayVec.size() && subDetNum > 0) {
942 this->
fillResidualHists(histArrayVec[subDetNum], phiSensToNorm, residuum, sigma);
946 <<
"Expect subDetNum from 1 to 6, got " << subDetNum;
953 float phiSensToNorm,
float residuum,
float sigma)
959 static const int iRes = this->
GetIndex(hists,
"resid");
960 hists[iRes]->Fill(residuum);
961 static const int iSigma = this->
GetIndex(hists,
"sigma");
962 hists[iSigma]->Fill(sigma);
963 static const int iSigmaVsAngle = this->
GetIndex(hists,
"sigmaVsAngle");
964 hists[iSigmaVsAngle]->Fill(phiSensToNorm, sigma);
965 static const int iResidVsAngle = this->
GetIndex(hists,
"residVsAngle");
966 hists[iResidVsAngle]->Fill(phiSensToNorm, residuum);
967 static const int iReduRes = this->
GetIndex(hists,
"reduResid");
968 static const int iReduResidVsAngle = this->
GetIndex(hists,
"reduResidVsAngle");
970 hists[iReduRes]->Fill(residuum/sigma);
971 hists[iReduResidVsAngle]->Fill(phiSensToNorm, residuum/sigma);
973 static const int iAngle = this->
GetIndex(hists,
"angle");
974 hists[iAngle]->Fill(phiSensToNorm);
976 if (phiSensToNorm > TMath::DegToRad()*45.) {
977 static const int iResGt45 = this->
GetIndex(hists,
"residGt45");
978 hists[iResGt45]->Fill(residuum);
979 static const int iSigmaGt45 = this->
GetIndex(hists,
"sigmaGt45");
980 hists[iSigmaGt45]->Fill(sigma);
981 static const int iReduResGt45 = this->
GetIndex(hists,
"reduResidGt45");
982 if (sigma) hists[iReduResGt45]->Fill(residuum/sigma);
984 static const int iResLt45 = this->
GetIndex(hists,
"residLt45");
985 hists[iResLt45]->Fill(residuum);
986 static const int iSigmaLt45 = this->
GetIndex(hists,
"sigmaLt45");
987 hists[iSigmaLt45]->Fill(sigma);
988 static const int iReduResLt45 = this->
GetIndex(hists,
"reduResidLt45");
989 if (sigma) hists[iReduResLt45]->Fill(residuum/sigma);
995 float residuum,
float sigma,
unsigned int nHit)
1001 static constexpr unsigned int maxNhit = 29;
1002 static const auto iResHit = indexArray1D<TH1,maxNhit+1>(
hists,
"resid_%d");
1003 static const auto iSigmaHit = indexArray1D<TH1,maxNhit+1>(
hists,
"sigma_%d");
1004 static const auto iReduResHit = indexArray1D<TH1,maxNhit+1>(
hists,
"reduResid_%d");
1005 static const auto iAngleHit = indexArray1D<TH1,maxNhit+1>(
hists,
"angle_%d");
1006 if (nHit > maxNhit) nHit = maxNhit;
1008 hists[iResHit[nHit]]->Fill(residuum);
1009 hists[iSigmaHit[nHit]]->Fill(sigma);
1011 hists[iReduResHit[nHit]]->Fill(residuum/sigma);
1013 hists[iAngleHit[nHit]]->Fill(angle);
1027 static const auto iF2fIjPhiLog = indexArray2D<TH2,6>(
myFrame2FrameHists2D,
"frame2framePhiLog%d%d");
1029 static const auto iF2fIjRLog = indexArray2D<TH2,6>(
myFrame2FrameHists2D,
"frame2frameRLog%d%d");
1033 for (
unsigned int i = 0;
i < 6; ++
i) {
1034 for (
unsigned int j = 0; j < 6; ++j) {
1035 myFrame2FrameHists2D[iF2f]->Fill(
i, j, frameDeriv[
i][j]);
1036 myFrame2FrameHists2D[iF2fIjPhi[
i][j]]->Fill(phi, frameDeriv[
i][j]);
1037 myFrame2FrameHists2D[iF2fIjR[
i][j]]->Fill(r, frameDeriv[
i][j]);
1038 if (frameDeriv[
i][j]) {
1039 myFrame2FrameHists2D[iF2fAbs]->Fill(
i, j,
TMath::Abs(frameDeriv[
i][j]));
1040 myFrame2FrameHists2D[iF2fIjPhiLog[
i][j]]->Fill(phi,
TMath::Abs(frameDeriv[
i][j]));
1041 myFrame2FrameHists2D[iF2fIjRLog[
i][j]]->Fill(r,
TMath::Abs(frameDeriv[
i][j]));
1050 const DetId detId(recHit->det()->geographicalId());
1053 if ((detId.subdetId() < 1 || detId.subdetId() > 6) &&
1055 edm::LogWarning(
"Alignment") <<
"@SUB=MillePedeMonitor::fillCorrelations2D" 1056 <<
"Expect subdetId from 1 to 6, got " << detId.subdetId();
std::vector< TH1 * > myTrackHists1D
int GetIndex(const std::vector< OBJECT_TYPE * > &vec, const TString &name)
double d0Error() const
error on d0
void fillCorrelations2D(float corr, const TransientTrackingRecHit::ConstRecHitPointer &hit)
std::vector< TH2 * > myDerivHists2D
std::vector< std::vector< TH1 * > > myResidHistsVec1DX
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
void fillFrameToFrame(const AlignableDetOrUnitPtr &aliDet, const Alignable *ali)
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
LocalVector localDirection() const
void fillPxbSurveyHistsLocalPars(const float &a0, const float &a1, const float &S, const float &phi)
Geom::Phi< T > phi() const
bool innerOk() const
return true if the innermost hit is valid
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
std::vector< TH1 * > myTrajectoryHists1D
const TrackerTopology * trackerTopology
std::vector< TH1 * > myResidHitHists1DY
const Vector & momentum() const
track momentum vector
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
std::vector< OBJECT_TYPE * > cloneHists(const std::vector< OBJECT_TYPE * > &orgs, const TString &namAd, const TString &titAd) const
const math::XYZPoint & outerPosition() const
position of the outermost hit
MillePedeMonitor(const TrackerTopology *tTopo, const char *rootFile="trackMonitor.root")
void fillResiduals(const TransientTrackingRecHit::ConstRecHitPointer &recHit, const TrajectoryStateOnSurface &tsos, unsigned int nHit, float residuum, float sigma, bool isY)
bool tecIsZMinusSide(const DetId &id) const
void fillPxbSurveyHistsChi2(const float &chi2)
static const unsigned int theMaxNumParam
bool tidIsZMinusSide(const DetId &id) const
const math::XYZPoint & innerPosition() const
position of the innermost hit
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
void addToDirectory(const std::vector< OBJECT_TYPE * > &objs, TDirectory *dir) const
std::vector< TH2 * > myTrackHists2D
std::vector< TH2 * > myResidHists2D
CLHEP::HepMatrix AlgebraicMatrix
void fillUsedTrack(const reco::Track *track, unsigned int nHitX, unsigned int nHitY)
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
std::vector< TH1 * > myCorrHists
std::vector< TH1 * > myPxbSurveyHists
double pt() const
track transverse momentum
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
auto recHits() const
Access to reconstructed hits on the track.
std::vector< TH1 * > myUsedTrackHists1D
unsigned short numberOfValidHits() const
number of valid hits found
bool init(TDirectory *directory)
math::XYZPoint Point
point in the space
AlgebraicMatrix frameToFrameDerivative(const Alignable *object, const Alignable *composedObject) const
std::vector< ConstRecHitPointer > ConstRecHitContainer
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
double dzError() const
error on dz
std::vector< TH2 * > myTrajectoryHists2D
std::vector< std::vector< TH1 * > > myResidHistsVec1DY
[0]=all [1]=TPB [2]=TPE [3]=TIB [4]=TID [5]=TOB [6]=TEC
CLHEP::HepVector AlgebraicVector
bool equidistLogBins(double *bins, int nBins, double first, double last) const
static const DetId detId()
bool tidIsZPlusSide(const DetId &id) const
bool outerOk() const
return true if the outermost hit is valid
void fillResidualHists(const std::vector< TH1 * > &hists, float phiSensToNorm, float residuum, float sigma)
void fillTrack(const reco::Track *track)
std::vector< TH1 * > myResidHitHists1DX
[0]=all [1]=TPB [2]=TPE [3]=TIB [4]=TID [5]=TOB [6]=TEC
bool tecIsZPlusSide(const DetId &id) const
std::vector< TH2 * > myUsedTrackHists2D
static int position[264][3]
void fillRefTrajectory(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr)
CLHEP::HepSymMatrix AlgebraicSymMatrix
unsigned int pxfSide(const DetId &id) const
void fillDerivatives(const TransientTrackingRecHit::ConstRecHitPointer &recHit, const float *localDerivs, unsigned int nLocal, const float *globalDerivs, unsigned int nGlobal, const int *labels)
const PositionType & globalPosition() const
Return the global position of the object.
std::vector< TH2 * > myFrame2FrameHists2D
math::XYZVector Vector
spatial vector
void fillResidualHitHists(const std::vector< TH1 * > &hists, float angle, float residuum, float sigma, unsigned int nHit)
T angle(T x1, T y1, T z1, T x2, T y2, T z2)