170 if (newDir.length() != 0) {
179 if (newDir.length() == 0)
182 tfd = std::make_unique<TFileDirectory>(upDir.
tfd->mkdir(newDir));
192 if (newDir.length() == 0) {
195 tfd = std::make_unique<TFileDirectory>(fs->
mkdir(newDir));
199 if (newDir.length() != 0) {
210 template <
typename T>
211 TH1*
make(
const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX);
212 template <
typename T>
214 template <
typename T>
223 template <
typename T>
232 std::unique_ptr<TFileDirectory>
tfd;
253 std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles);
256 void setUpTreeMembers(
const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_,
261 const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_);
277 const char* histName,
285 const char* histName,
293 const char* histName,
305 double& upperBoundX);
321 template <
class OBJECT_TYPE>
322 int GetIndex(
const std::vector<OBJECT_TYPE*>& vec,
const TString&
name);
388 template <
class OBJECT_TYPE>
391 for (
typename std::vector<OBJECT_TYPE*>::const_iterator iter = vec.begin(), iterEnd = vec.end(); iter != iterEnd;
393 if (*iter && (*iter)->GetName() ==
name)
396 edm::LogError(
"Alignment") <<
"@SUB=TrackerOfflineValidation::GetIndex"
397 <<
" could not find " <<
name;
402 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TH1F>(
403 const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX) {
413 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
const char*
name,
418 theDbe->setCurrentFolder(directoryString);
421 tmpProfile->SetDirectory(
nullptr);
422 return theDbe->bookProfile(
name, tmpProfile)->getTH1();
429 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
430 const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX) {
432 theDbe->setCurrentFolder(directoryString);
434 TProfile* tmpProfile =
new TProfile(
name,
title,
nBinX, minBinX, maxBinX);
435 tmpProfile->SetDirectory(
nullptr);
436 return theDbe->bookProfile(
name, tmpProfile)->getTH1();
443 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
446 theDbe->setCurrentFolder(directoryString);
455 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TH2F>(
const char*
name,
464 theDbe->setCurrentFolder(directoryString);
465 return theDbe->book2D(
name,
title,
nBinX, minBinX, maxBinX,
nBinY, minBinY, maxBinY)->getTH1();
524 <<
"There are " << newBareTkGeomPtr->
detIds().size() <<
" dets in the Geometry record.\n"
525 <<
"Out of these " << newBareTkGeomPtr->
detUnitIds().size() <<
" are detUnits";
536 std::vector<TrackerOfflineValidation::SummaryContainer> vTrackerprofiles;
547 <<
"TrackerGeometry changed, but will not re-book hists!";
553 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_tracketa",
"Track #eta;#eta_{Track};Number of Tracks", 90, -3., 3.));
554 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_trackphi",
"Track #phi;#phi_{Track};Number of Tracks", 90, -3.15, 3.15));
556 "h_trackNumberOfValidHits",
"Track # of valid hits;# of valid hits _{Track};Number of Tracks", 40, 0., 40.));
558 "h_trackNumberOfLostHits",
"Track # of lost hits;# of lost hits _{Track};Number of Tracks", 10, 0., 10.));
560 tfd.
make<TH1F>(
"h_curvature",
"Curvature #kappa;#kappa_{Track};Number of Tracks", 100, -.05, .05));
562 "h_curvature_pos",
"Curvature |#kappa| Positive Tracks;|#kappa_{pos Track}|;Number of Tracks", 100, .0, .05));
564 "h_curvature_neg",
"Curvature |#kappa| Negative Tracks;|#kappa_{neg Track}|;Number of Tracks", 100, .0, .05));
566 tfd.
make<TH1F>(
"h_diff_curvature",
567 "Curvature |#kappa| Tracks Difference;|#kappa_{Track}|;# Pos Tracks - # Neg Tracks",
571 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_chi2",
"#chi^{2};#chi^{2}_{Track};Number of Tracks", 500, -0.01, 500.));
573 tfd.
make<TH1F>(
"h_chi2Prob",
"#chi^{2} probability;#chi^{2}prob_{Track};Number of Tracks", 100, 0.0, 1.));
575 tfd.
make<TH1F>(
"h_normchi2",
"#chi^{2}/ndof;#chi^{2}/ndof;Number of Tracks", 100, -0.01, 10.));
576 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_pt",
"p_{T}^{track};p_{T}^{track} [GeV];Number of Tracks", 250, 0., 250));
578 "h_ptResolution",
"#delta_{p_{T}}/p_{T}^{track};#delta_{p_{T}}/p_{T}^{track};Number of Tracks", 100, 0., 0.5));
580 "p_d0_vs_phi",
"Transverse Impact Parameter vs. #phi;#phi_{Track};#LT d_{0} #GT [cm]", 100, -3.15, 3.15));
582 "p_dz_vs_phi",
"Longitudinal Impact Parameter vs. #phi;#phi_{Track};#LT d_{z} #GT [cm]", 100, -3.15, 3.15));
584 "p_d0_vs_eta",
"Transverse Impact Parameter vs. #eta;#eta_{Track};#LT d_{0} #GT [cm]", 100, -3.15, 3.15));
586 "p_dz_vs_eta",
"Longitudinal Impact Parameter vs. #eta;#eta_{Track};#LT d_{z} #GT [cm]", 100, -3.15, 3.15));
588 tfd.
make<TProfile>(
"p_chi2_vs_phi",
"#chi^{2} vs. #phi;#phi_{Track};#LT #chi^{2} #GT", 100, -3.15, 3.15));
590 "p_chi2Prob_vs_phi",
"#chi^{2} probablility vs. #phi;#phi_{Track};#LT #chi^{2} probability#GT", 100, -3.15, 3.15));
592 "p_chi2Prob_vs_d0",
"#chi^{2} probablility vs. |d_{0}|;|d_{0}|[cm];#LT #chi^{2} probability#GT", 100, 0, 80));
594 "p_normchi2_vs_phi",
"#chi^{2}/ndof vs. #phi;#phi_{Track};#LT #chi^{2}/ndof #GT", 100, -3.15, 3.15));
596 tfd.
make<TProfile>(
"p_chi2_vs_eta",
"#chi^{2} vs. #eta;#eta_{Track};#LT #chi^{2} #GT", 100, -3.15, 3.15));
598 double xBins[19] = {0., 0.15, 0.5, 1., 1.5, 2., 2.5, 3., 3.5, 4., 4.5, 5., 7., 10., 15., 25., 40., 100., 200.};
600 "p_normchi2_vs_pt",
"norm #chi^{2} vs. p_{T}_{Track}; p_{T}_{Track};#LT #chi^{2}/ndof #GT", 18,
xBins));
603 tfd.
make<TProfile>(
"p_normchi2_vs_p",
"#chi^{2}/ndof vs. p_{Track};p_{Track};#LT #chi^{2}/ndof #GT", 18,
xBins));
605 "p_chi2Prob_vs_eta",
"#chi^{2} probability vs. #eta;#eta_{Track};#LT #chi^{2} probability #GT", 100, -3.15, 3.15));
607 "p_normchi2_vs_eta",
"#chi^{2}/ndof vs. #eta;#eta_{Track};#LT #chi^{2}/ndof #GT", 100, -3.15, 3.15));
609 tfd.
make<TProfile>(
"p_kappa_vs_phi",
"#kappa vs. #phi;#phi_{Track};#kappa", 100, -3.15, 3.15));
611 tfd.
make<TProfile>(
"p_kappa_vs_eta",
"#kappa vs. #eta;#eta_{Track};#kappa", 100, -3.15, 3.15));
613 "#delta_{p_{T}}/p_{T}^{track};#phi^{track};#delta_{p_{T}}/p_{T}^{track}",
618 "#delta_{p_{T}}/p_{T}^{track};#eta^{track};#delta_{p_{T}}/p_{T}^{track}",
624 "h2_d0_vs_phi",
"Transverse Impact Parameter vs. #phi;#phi_{Track};d_{0} [cm]", 100, -3.15, 3.15, 100, -1., 1.));
626 "Longitudinal Impact Parameter vs. #phi;#phi_{Track};d_{z} [cm]",
634 "h2_d0_vs_eta",
"Transverse Impact Parameter vs. #eta;#eta_{Track};d_{0} [cm]", 100, -3.15, 3.15, 100, -1., 1.));
636 "Longitudinal Impact Parameter vs. #eta;#eta_{Track};d_{z} [cm]",
644 tfd.
make<TH2F>(
"h2_chi2_vs_phi",
"#chi^{2} vs. #phi;#phi_{Track};#chi^{2}", 100, -3.15, 3.15, 500, 0., 500.));
646 "#chi^{2} probability vs. #phi;#phi_{Track};#chi^{2} probability",
654 "#chi^{2} probability vs. |d_{0}|;|d_{0}| [cm];#chi^{2} probability",
662 "h2_normchi2_vs_phi",
"#chi^{2}/ndof vs. #phi;#phi_{Track};#chi^{2}/ndof", 100, -3.15, 3.15, 100, 0., 10.));
664 tfd.
make<TH2F>(
"h2_chi2_vs_eta",
"#chi^{2} vs. #eta;#eta_{Track};#chi^{2}", 100, -3.15, 3.15, 500, 0., 500.));
666 "#chi^{2} probaility vs. #eta;#eta_{Track};#chi^{2} probability",
674 "h2_normchi2_vs_eta",
"#chi^{2}/ndof vs. #eta;#eta_{Track};#chi^{2}/ndof", 100, -3.15, 3.15, 100, 0., 10.));
676 tfd.
make<TH2F>(
"h2_kappa_vs_phi",
"#kappa vs. #phi;#phi_{Track};#kappa", 100, -3.15, 3.15, 100, .0, .05));
678 tfd.
make<TH2F>(
"h2_kappa_vs_eta",
"#kappa vs. #eta;#eta_{Track};#kappa", 100, -3.15, 3.15, 100, .0, .05));
680 "h2_normchi2_vs_kappa",
"#kappa vs. #chi^{2}/ndof;#chi^{2}/ndof;#kappa", 100, 0., 10, 100, -.03, .03));
684 "p_vs_resXprime_pixB",
"res_{x'} vs momentum in BPix;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
686 "p_vs_resXprime_pixE",
"res_{x'} vs momentum in FPix;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
688 "p_vs_resXprime_TIB",
"res_{x'} vs momentum in TIB;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
690 "p_vs_resXprime_TID",
"res_{x'} vs momentum in TID;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
692 "p_vs_resXprime_TOB",
"res_{x'} vs momentum in TOB;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
694 "p_vs_resXprime_TEC",
"res_{x'} vs momentum in TEC;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
698 "p_vs_resYprime_pixB",
"res_{y'} vs momentum in BPix;p [GeV]; res_{y'}", 15, 0., 15., 200, -0.1, 0.1));
700 "p_vs_resYprime_pixE",
"res_{y'} vs momentum in FPix;p [GeV]; res_{y'}", 15, 0., 15., 200, -0.1, 0.1));
705 for (
int i = 0, iEnd = ali.
components().size();
i < iEnd; ++
i) {
707 LogDebug(
"TrackerOfflineValidation") <<
"StructureName = " << structurename;
711 if (structurename !=
"Strip" && structurename !=
"Pixel")
714 if (structurename.find(
"Endcap", 0) != std::string::npos) {
747 std::stringstream histoname, histotitle, normhistoname, normhistotitle, yhistoname, yhistotitle, xprimehistoname,
748 xprimehistotitle, normxprimehistoname, normxprimehistotitle, yprimehistoname, yprimehistotitle,
749 normyprimehistoname, normyprimehistotitle, localxname, localxtitle, localyname, localytitle, resxvsxprofilename,
750 resxvsxprofiletitle, resyvsxprofilename, resyvsxprofiletitle, resxvsyprofilename, resxvsyprofiletitle,
751 resyvsyprofilename, resyvsyprofiletitle;
755 if (this->
isEndCap(static_cast<uint32_t>(subdetandlayer.first)))
756 wheel_or_layer =
"_wheel_";
757 else if (this->
isBarrel(static_cast<uint32_t>(subdetandlayer.first)))
758 wheel_or_layer =
"_layer_";
760 edm::LogWarning(
"TrackerOfflineValidation") <<
"@SUB=TrackerOfflineValidation::bookHists"
761 <<
"Unknown subdetid: " << subdetandlayer.first;
763 histoname <<
"h_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_"
765 yhistoname <<
"h_y_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_"
767 xprimehistoname <<
"h_xprime_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
768 <<
"_module_" <<
id.rawId();
769 yprimehistoname <<
"h_yprime_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
770 <<
"_module_" <<
id.rawId();
771 normhistoname <<
"h_normresiduals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
772 <<
"_module_" <<
id.rawId();
773 normxprimehistoname <<
"h_normxprimeresiduals_subdet_" << subdetandlayer.first << wheel_or_layer
774 << subdetandlayer.second <<
"_module_" <<
id.rawId();
775 normyprimehistoname <<
"h_normyprimeresiduals_subdet_" << subdetandlayer.first << wheel_or_layer
776 << subdetandlayer.second <<
"_module_" <<
id.rawId();
777 histotitle <<
"X Residual for module " <<
id.rawId() <<
";x_{tr} - x_{hit} [cm]";
778 yhistotitle <<
"Y Residual for module " <<
id.rawId() <<
";y_{tr} - y_{hit} [cm]";
779 normhistotitle <<
"Normalized Residual for module " <<
id.rawId() <<
";x_{tr} - x_{hit}/#sigma";
780 xprimehistotitle <<
"X' Residual for module " <<
id.rawId() <<
";(x_{tr} - x_{hit})' [cm]";
781 normxprimehistotitle <<
"Normalized X' Residual for module " <<
id.rawId() <<
";(x_{tr} - x_{hit})'/#sigma";
782 yprimehistotitle <<
"Y' Residual for module " <<
id.rawId() <<
";(y_{tr} - y_{hit})' [cm]";
783 normyprimehistotitle <<
"Normalized Y' Residual for module " <<
id.rawId() <<
";(y_{tr} - y_{hit})'/#sigma";
786 localxname <<
"h_localx_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_"
788 localyname <<
"h_localy_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_"
790 localxtitle <<
"u local for module " <<
id.rawId() <<
"; u_{tr,r}";
791 localytitle <<
"v local for module " <<
id.rawId() <<
"; v_{tr,r}";
793 resxvsxprofilename <<
"p_residuals_x_vs_x_subdet_" << subdetandlayer.first << wheel_or_layer
794 << subdetandlayer.second <<
"_module_" <<
id.rawId();
795 resyvsxprofilename <<
"p_residuals_y_vs_x_subdet_" << subdetandlayer.first << wheel_or_layer
796 << subdetandlayer.second <<
"_module_" <<
id.rawId();
797 resxvsyprofilename <<
"p_residuals_x_vs_y_subdet_" << subdetandlayer.first << wheel_or_layer
798 << subdetandlayer.second <<
"_module_" <<
id.rawId();
799 resyvsyprofilename <<
"p_residuals_y_vs_y_subdet_" << subdetandlayer.first << wheel_or_layer
800 << subdetandlayer.second <<
"_module_" <<
id.rawId();
801 resxvsxprofiletitle <<
"U Residual vs u for module " <<
id.rawId()
802 <<
"; u_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
803 resyvsxprofiletitle <<
"V Residual vs u for module " <<
id.rawId()
804 <<
"; u_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
805 resxvsyprofiletitle <<
"U Residual vs v for module " <<
id.rawId()
806 <<
"; v_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
807 resyvsyprofiletitle <<
"V Residual vs v for module " <<
id.rawId()
808 <<
"; v_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
820 moduleLevelHistsTransient =
false;
826 moduleLevelHistsTransient, tfd, histoname.str().c_str(), histotitle.str().c_str(),
nbins,
xmin,
xmax);
829 moduleLevelHistsTransient, tfd, normhistoname.str().c_str(), normhistotitle.str().c_str(),
nbins,
xmin,
xmax);
834 xprimehistoname.str().c_str(),
835 xprimehistotitle.str().c_str(),
842 normxprimehistoname.str().c_str(),
843 normxprimehistotitle.str().c_str(),
852 moduleLevelHistsTransient, tfd, localxname.str().c_str(), localxtitle.str().c_str(),
nbins,
xmin,
xmax);
854 moduleLevelHistsTransient, tfd, localyname.str().c_str(), localytitle.str().c_str(),
nbins,
xmin,
xmax);
857 resxvsxprofilename.str().c_str(),
858 resxvsxprofiletitle.str().c_str(),
867 resxvsyprofilename.str().c_str(),
868 resxvsyprofiletitle.str().c_str(),
881 yprimehistoname.str().c_str(),
882 yprimehistotitle.str().c_str(),
889 moduleLevelHistsTransient, tfd, yhistoname.str().c_str(), yhistotitle.str().c_str(),
nbins,
xmin,
xmax);
894 normyprimehistoname.str().c_str(),
895 normyprimehistotitle.str().c_str(),
905 resyvsxprofilename.str().c_str(),
906 resyvsxprofiletitle.str().c_str(),
915 resyvsyprofilename.str().c_str(),
916 resyvsyprofiletitle.str().c_str(),
930 const char* histName,
939 return tfd.
make<TH1F>(histName,
histTitle, nBinsX, lowX, highX);
944 const char* histName,
954 return (TProfile*)tfd.
make<TProfile>(histName,
histTitle, nBinsX, lowX, highX);
959 const char* histName,
967 TProfile*
profile =
new TProfile(histName,
histTitle, nBinsX, lowX, highX, lowY, highY);
971 return (TProfile*)tfd.
make<TProfile>(histName,
histTitle, nBinsX, lowX, highX, lowY, highY);
996 double& upperBoundX) {
1055 lowerBoundX = binningPSet.
getParameter<
double>(
"xmin");
1056 upperBoundX = binningPSet.
getParameter<
double>(
"xmax");
1060 if (targetHist && sourceHist) {
1061 targetHist->SetBinContent(
bin, sourceHist->GetMean(1));
1063 targetHist->SetBinError(
bin,
Fwhm(sourceHist) / 2.);
1065 targetHist->SetBinError(
bin, sourceHist->GetRMS(1));
1112 <<
"[TrackerOfflineValidation] Error, tried to get reference for non-tracker subdet " << subdetid
1113 <<
" from detector " << detid.
det();
1125 TH1::StatOverflows(kTRUE);
1128 std::vector<TrackerValidationVariables::AVTrackStruct> vTrackstruct;
1131 for (std::vector<TrackerValidationVariables::AVTrackStruct>::const_iterator itT = vTrackstruct.begin();
1132 itT != vTrackstruct.end();
1145 vTrackHistos_[numOfValidHitsindex]->Fill(itT->numberOfValidHits);
1147 vTrackHistos_[numOfLostHitsindex]->Fill(itT->numberOfLostHits);
1151 if (itT->charge > 0)
1154 if (itT->charge < 0)
1164 if (itT->ptError != 0.) {
1166 vTrackHistos_[ptResolutionindex]->Fill(itT->ptError / itT->pt);
1182 vTrackProfiles_[chiProbabsd0index]->Fill(fabs(itT->d0), itT->chi2Prob);
1200 vTrackProfiles_[ptResphiindex]->Fill(itT->phi, itT->ptError / itT->pt);
1202 vTrackProfiles_[ptResetaindex]->Fill(itT->eta, itT->ptError / itT->pt);
1218 vTrack2DHistos_[chiProbabsd0index_2d]->Fill(fabs(itT->d0), itT->chi2Prob);
1235 for (std::vector<TrackerValidationVariables::AVHitStruct>::const_iterator itH = itT->hits.begin();
1236 itH != itT->hits.end();
1238 DetId detid(itH->rawDetId);
1243 histStruct.
ResHisto->Fill(itH->resX);
1244 if (itH->resErrX != 0)
1245 histStruct.
NormResHisto->Fill(itH->resX / itH->resErrX);
1251 if (itH->resXprime != -999.) {
1282 float tgalpha =
tan(itH->localAlpha);
1283 if (fabs(tgalpha) != 0) {
1284 histStruct.
LocalX->Fill(itH->localXnorm, tgalpha * tgalpha);
1285 histStruct.
LocalY->Fill(itH->localYnorm, tgalpha * tgalpha);
1297 histStruct.
ResXvsXProfile->Fill(itH->localXnorm, itH->resXatTrkY / tgalpha, tgalpha * tgalpha);
1298 histStruct.
ResXvsYProfile->Fill(itH->localYnorm, itH->resXatTrkY / tgalpha, tgalpha * tgalpha);
1304 if (itH->resXprimeErr != 0 && itH->resXprimeErr != -999) {
1309 if (itH->resYprime != -999.) {
1325 float tgbeta =
tan(itH->localBeta);
1326 if (fabs(tgbeta) != 0) {
1339 histStruct.
ResYvsXProfile->Fill(itH->localXnorm, itH->resY / tgbeta, tgbeta * tgbeta);
1340 histStruct.
ResYvsYProfile->Fill(itH->localYnorm, itH->resY / tgbeta, tgbeta * tgbeta);
1345 if (itH->resYprimeErr != 0 && itH->resYprimeErr != -999.) {
1355 TH1::StatOverflows(kFALSE);
1383 TTree*
tree = fs->
make<TTree>(
"TkOffVal",
"TkOffVal");
1389 tree->Branch(
"TkOffTreeVariables", &treeMemPtr);
1399 treeMemPtr =
nullptr;
1405 std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles) {
1410 for (
int iComp = 0, iCompEnd = ali.
components().size(); iComp < iCompEnd; ++iComp) {
1411 std::vector<TrackerOfflineValidation::SummaryContainer> vProfiles;
1414 LogDebug(
"TrackerOfflineValidation") <<
"StructureName = " << structurename;
1419 if (structurename !=
"Strip" && structurename !=
"Pixel")
1426 TH1* hX = vLevelProfiles[iComp].sumXResiduals_;
1427 TH1* hNormX = vLevelProfiles[iComp].sumNormXResiduals_;
1428 TH1* hY = vLevelProfiles[iComp].sumYResiduals_;
1429 TH1* hNormY = vLevelProfiles[iComp].sumNormYResiduals_;
1430 TH1* pXX = vLevelProfiles[iComp].sumResXvsXProfile_;
1431 TH1* pXY = vLevelProfiles[iComp].sumResXvsYProfile_;
1432 TH1* pYX = vLevelProfiles[iComp].sumResYvsXProfile_;
1433 TH1* pYY = vLevelProfiles[iComp].sumResYvsYProfile_;
1434 for (
uint n = 0;
n < vProfiles.size(); ++
n) {
1454 toFit_.push_back(vLevelProfiles[iComp].sumXResiduals_);
1455 toFit_.push_back(vLevelProfiles[iComp].sumNormXResiduals_);
1459 toFit_.push_back(hNormY);
1471 it->first->Add(it->second);
1475 setSummaryBin(std::get<0>(*it), std::get<1>(*it), std::get<2>(*it));
1477 for (std::vector<TH1*>::const_iterator it =
toFit_.begin(); it !=
toFit_.end(); ++it)
1488 const char* aliTypeName =
alignableTracker_->objectIdProvider().idToString(alitype);
1489 const char* aliSubtypeName =
alignableTracker_->objectIdProvider().idToString(subtype);
1492 const DetId aliDetId = ali.
id();
1502 const uint subcompSize = ali.
components()[0]->components().size();
1504 const TString
title(Form(
"Summary for substructures in %s %d;%s;", aliTypeName,
i, aliSubtypeName));
1506 sumContainer.summaryXResiduals_ = tfd.
make<TH1F>(
1507 Form(
"h_summaryX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x' #GT", aliSize, 0.5, aliSize + 0.5);
1508 sumContainer.summaryNormXResiduals_ = tfd.
make<TH1F>(
1509 Form(
"h_summaryNormX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x'/#sigma #GT", aliSize, 0.5, aliSize + 0.5);
1512 sumContainer.summaryYResiduals_ = tfd.
make<TH1F>(
1513 Form(
"h_summaryY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y' #GT", aliSize, 0.5, aliSize + 0.5);
1514 sumContainer.summaryNormYResiduals_ = tfd.
make<TH1F>(
1515 Form(
"h_summaryNormY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y'/#sigma #GT", aliSize, 0.5, aliSize + 0.5);
1519 if (subcompSize != 2) {
1522 <<
"Det with " << subcompSize <<
" components";
1525 const TString
title(Form(
1526 "Summary for substructures in %s %d;%s;",
1531 sumContainer.summaryXResiduals_ = tfd.
make<TH1F>(
1532 Form(
"h_summaryX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x' #GT", (2 * aliSize), 0.5, 2 * aliSize + 0.5);
1533 sumContainer.summaryNormXResiduals_ = tfd.
make<TH1F>(Form(
"h_summaryNormX%s_%d", aliTypeName,
i),
1534 title +
"#LT #Delta x'/#sigma #GT",
1540 sumContainer.summaryYResiduals_ = tfd.
make<TH1F>(
1541 Form(
"h_summaryY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y' #GT", (2 * aliSize), 0.5, 2 * aliSize + 0.5);
1542 sumContainer.summaryNormYResiduals_ = tfd.
make<TH1F>(Form(
"h_summaryNormY%s_%d", aliTypeName,
i),
1543 title +
"#LT #Delta y'/#sigma #GT",
1551 <<
"@SUB=TrackerOfflineValidation::bookSummaryHists"
1552 <<
"No summary histogram for hierarchy level " << aliTypeName <<
" in subdet " << aliDetId.
subdetId();
1560 const TString sumTitle(Form(
"Residual for %s %d in %s;", aliTypeName,
i,
typeName));
1564 sumContainer.sumXResiduals_ = tfd.
make<TH1F>(Form(
"h_Xprime_%s_%d", aliTypeName,
i),
1571 sumContainer.sumNormXResiduals_ = tfd.
make<TH1F>(Form(
"h_NormXprime_%s_%d", aliTypeName,
i),
1579 sumContainer.sumResXvsXProfile_ = tfd.
make<TProfile>(Form(
"p_resXX_%s_%d", aliTypeName,
i),
1585 sumContainer.sumResXvsXProfile_->Sumw2();
1586 sumContainer.sumResXvsYProfile_ = tfd.
make<TProfile>(Form(
"p_resXY_%s_%d", aliTypeName,
i),
1592 sumContainer.sumResXvsYProfile_->Sumw2();
1597 sumContainer.sumYResiduals_ = tfd.
make<TH1F>(Form(
"h_Yprime_%s_%d", aliTypeName,
i),
1604 sumContainer.sumNormYResiduals_ = tfd.
make<TH1F>(Form(
"h_NormYprime_%s_%d", aliTypeName,
i),
1612 sumContainer.sumResYvsXProfile_ = tfd.
make<TProfile>(Form(
"p_resYX_%s_%d", aliTypeName,
i),
1618 sumContainer.sumResYvsXProfile_->Sumw2();
1619 sumContainer.sumResYvsYProfile_ = tfd.
make<TProfile>(Form(
"p_resYY_%s_%d", aliTypeName,
i),
1625 sumContainer.sumResYvsYProfile_->Sumw2();
1633 for (
uint k = 0;
k < aliSize; ++
k) {
1654 for (
uint k = 0;
k < aliSize; ++
k) {
1655 for (
uint j = 0;
j < subcompSize; ++
j) {
1676 return sumContainer;
1680 float max =
hist->GetMaximum();
1681 int left = -1, right = -1;
1682 for (
unsigned int i = 1, iEnd =
hist->GetNbinsX();
i <= iEnd; ++
i) {
1683 if (
hist->GetBinContent(
i) <
max / 2. &&
hist->GetBinContent(
i + 1) >
max / 2. && left == -1) {
1684 if (
max / 2. -
hist->GetBinContent(
i) <
hist->GetBinContent(
i + 1) -
max / 2.) {
1692 if (left != -1 && right == -1) {
1693 if (
hist->GetBinContent(
i) >
max / 2. &&
hist->GetBinContent(
i + 1) <
max / 2.) {
1694 if (
hist->GetBinContent(
i) -
max / 2. <
max / 2. -
hist->GetBinContent(
i + 1)) {
1702 return hist->GetXaxis()->GetBinCenter(right) -
hist->GetXaxis()->GetBinCenter(left);
1708 for (std::map<int, TrackerOfflineValidation::ModuleHistos>::const_iterator it = moduleHist_.begin(),
1709 itEnd = moduleHist_.end();
1715 DetId detId_ = it->first;
1721 unsigned int whichHalfBarrel(1), rawId(detId_.
rawId());
1722 if ((rawId >= 302056964 && rawId < 302059300) || (rawId >= 302123268 && rawId < 302127140) ||
1723 (rawId >= 302189572 && rawId < 302194980))
1724 whichHalfBarrel = 2;
1726 treeMem.
half = whichHalfBarrel;
1730 unsigned int whichHalfCylinder(1), rawId(detId_.
rawId());
1731 if ((rawId >= 352394500 && rawId < 352406032) || (rawId >= 352460036 && rawId < 352471568) ||
1732 (rawId >= 344005892 && rawId < 344017424) || (rawId >= 344071428 && rawId < 344082960))
1733 whichHalfCylinder = 2;
1736 treeMem.
half = whichHalfCylinder;
1741 unsigned int whichHalfShell(1), rawId(detId_.
rawId());
1742 if ((rawId >= 369120484 && rawId < 369120688) || (rawId >= 369121540 && rawId < 369121776) ||
1743 (rawId >= 369136932 && rawId < 369137200) || (rawId >= 369137988 && rawId < 369138288) ||
1744 (rawId >= 369153396 && rawId < 369153744) || (rawId >= 369154436 && rawId < 369154800) ||
1745 (rawId >= 369169844 && rawId < 369170256) || (rawId >= 369170900 && rawId < 369171344) ||
1746 (rawId >= 369124580 && rawId < 369124784) || (rawId >= 369125636 && rawId < 369125872) ||
1747 (rawId >= 369141028 && rawId < 369141296) || (rawId >= 369142084 && rawId < 369142384) ||
1748 (rawId >= 369157492 && rawId < 369157840) || (rawId >= 369158532 && rawId < 369158896) ||
1749 (rawId >= 369173940 && rawId < 369174352) || (rawId >= 369174996 && rawId < 369175440))
1753 treeMem.
half = whichHalfShell;
1790 treeMem.
posX = gPModule.
x();
1791 treeMem.
posY = gPModule.
y();
1792 treeMem.
posZ = gPModule.
z();
1797 LocalPoint lUDirection(1., 0., 0.), lVDirection(0., 1., 0.), lWDirection(0., 0., 1.);
1799 gWDirection = surface.
toGlobal(lWDirection);
1800 double dR(999.),
dPhi(999.), dZ(999.);
1803 dR = gWDirection.perp() - gPModule.
perp();
1805 dZ = gVDirection.z() - gPModule.
z();
1813 dZ = gWDirection.z() - gPModule.
z();
1819 dR = gVDirection.perp() - gPModule.
perp();
1821 dZ = gWDirection.z() - gPModule.
z();
1844 const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_) {
1845 for (std::map<int, TrackerOfflineValidation::ModuleHistos>::const_iterator it = moduleHist_.begin(),
1846 itEnd = moduleHist_.end();
1852 treeMem.
entries = static_cast<UInt_t>(it->second.ResXprimeHisto->GetEntries());
1853 treeMem.
meanX = it->second.ResXprimeHisto->GetMean();
1854 treeMem.
rmsX = it->second.ResXprimeHisto->GetRMS();
1860 std::pair<float, float> fitResult1 = this->
fitResiduals(it->second.ResXprimeHisto);
1861 treeMem.
fitMeanX = fitResult1.first;
1864 std::pair<float, float> fitResult2 = this->
fitResiduals(it->second.NormResXprimeHisto);
1872 int numberOfBins = it->second.ResXprimeHisto->GetNbinsX();
1876 it->second.ResXprimeHisto->GetBinContent(0) + it->second.ResXprimeHisto->GetBinContent(
numberOfBins + 1);
1879 treeMem.
meanNormX = it->second.NormResXprimeHisto->GetMean();
1880 treeMem.
rmsNormX = it->second.NormResXprimeHisto->GetRMS();
1883 it->second.NormResXprimeHisto->GetStats(
stats);
1888 treeMem.
sigmaNormX =
Fwhm(it->second.NormResXprimeHisto) / 2.355;
1889 treeMem.
histNameX = it->second.ResXprimeHisto->GetName();
1890 treeMem.
histNameNormX = it->second.NormResXprimeHisto->GetName();
1894 treeMem.
meanLocalX = it->second.ResHisto->GetMean();
1895 treeMem.
rmsLocalX = it->second.ResHisto->GetRMS();
1901 if (it->second.ResYHisto)
1907 if (it->second.ResYprimeHisto) {
1908 TH1*
h = it->second.ResYprimeHisto;
1909 treeMem.
meanY =
h->GetMean();
1910 treeMem.
rmsY =
h->GetRMS();
1913 std::pair<float, float> fitMeanSigma = this->
fitResiduals(h);
1914 treeMem.
fitMeanY = fitMeanSigma.first;
1915 treeMem.
fitSigmaY = fitMeanSigma.second;
1923 if (it->second.NormResYprimeHisto) {
1924 TH1*
h = it->second.NormResYprimeHisto;
1932 std::pair<float, float> fitMeanSigma = this->
fitResiduals(h);
1940 if (it->second.ResXvsXProfile) {
1941 TH1*
h = it->second.ResXvsXProfile;
1946 if (it->second.ResXvsYProfile) {
1947 TH1*
h = it->second.ResXvsYProfile;
1952 if (it->second.ResYvsXProfile) {
1953 TH1*
h = it->second.ResYvsXProfile;
1958 if (it->second.ResYvsYProfile) {
1959 TH1*
h = it->second.ResYvsYProfile;
1971 std::pair<float, float> fitResult(9999., 9999.);
1972 if (!
hist ||
hist->GetEntries() < 20)
1976 float sigma =
hist->GetRMS();
1982 if (0 ==
hist->Fit(&
func,
"QNR")) {
1984 sigma =
func.GetParameter(2);
1989 if (0 ==
hist->Fit(&
func,
"Q0LR")) {
1990 if (
hist->GetFunction(
func.GetName())) {
1991 hist->GetFunction(
func.GetName())->ResetBit(TF1::kNotDraw);
1993 fitResult.first =
func.GetParameter(1);
1994 fitResult.second =
func.GetParameter(2);
1998 edm::LogWarning(
"Alignment") <<
"@SUB=TrackerOfflineValidation::fitResiduals"
1999 <<
"Caught this exception during ROOT fit: " <<
e.what();
2009 double*
x =
new double[
nbins];
2010 double*
y =
new double[
nbins];
2013 y[
j] =
histo->GetBinContent(
j + 1);