167 if (newDir.length() != 0) {
176 if (newDir.length() == 0)
189 if (newDir.length() == 0) {
196 if (newDir.length() != 0) {
207 template <
typename T>
208 TH1*
make(
const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX);
209 template <
typename T>
211 template <
typename T>
220 template <
typename T>
229 std::unique_ptr<TFileDirectory>
tfd;
250 std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles);
253 void setUpTreeMembers(
const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_,
258 const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_);
274 const char* histName,
282 const char* histName,
290 const char* histName,
302 double& upperBoundX);
318 template <
class OBJECT_TYPE>
319 int GetIndex(
const std::vector<OBJECT_TYPE*>& vec,
const TString&
name);
384 template <
class OBJECT_TYPE>
387 for (
typename std::vector<OBJECT_TYPE*>::const_iterator iter = vec.begin(), iterEnd = vec.end(); iter != iterEnd;
389 if (*iter && (*iter)->GetName() ==
name)
392 edm::LogError(
"Alignment") <<
"@SUB=TrackerOfflineValidation::GetIndex"
393 <<
" could not find " <<
name;
398 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TH1F>(
399 const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX) {
409 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
const char*
name,
414 theDbe->setCurrentFolder(directoryString);
417 tmpProfile->SetDirectory(
nullptr);
418 return theDbe->bookProfile(
name, tmpProfile)->getTH1();
425 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
426 const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX) {
428 theDbe->setCurrentFolder(directoryString);
430 TProfile* tmpProfile =
new TProfile(
name,
title,
nBinX, minBinX, maxBinX);
431 tmpProfile->SetDirectory(
nullptr);
432 return theDbe->bookProfile(
name, tmpProfile)->getTH1();
439 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
442 theDbe->setCurrentFolder(directoryString);
451 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TH2F>(
const char*
name,
460 theDbe->setCurrentFolder(directoryString);
461 return theDbe->book2D(
name,
title,
nBinX, minBinX, maxBinX,
nBinY, minBinY, maxBinY)->getTH1();
516 <<
"There are " << newBareTkGeomPtr->
detIds().size() <<
" dets in the Geometry record.\n"
517 <<
"Out of these " << newBareTkGeomPtr->
detUnitIds().size() <<
" are detUnits";
528 std::vector<TrackerOfflineValidation::SummaryContainer> vTrackerprofiles;
539 <<
"TrackerGeometry changed, but will not re-book hists!";
545 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_tracketa",
"Track #eta;#eta_{Track};Number of Tracks", 90, -3., 3.));
546 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_trackphi",
"Track #phi;#phi_{Track};Number of Tracks", 90, -3.15, 3.15));
548 "h_trackNumberOfValidHits",
"Track # of valid hits;# of valid hits _{Track};Number of Tracks", 40, 0., 40.));
550 "h_trackNumberOfLostHits",
"Track # of lost hits;# of lost hits _{Track};Number of Tracks", 10, 0., 10.));
552 tfd.
make<TH1F>(
"h_curvature",
"Curvature #kappa;#kappa_{Track};Number of Tracks", 100, -.05, .05));
554 "h_curvature_pos",
"Curvature |#kappa| Positive Tracks;|#kappa_{pos Track}|;Number of Tracks", 100, .0, .05));
556 "h_curvature_neg",
"Curvature |#kappa| Negative Tracks;|#kappa_{neg Track}|;Number of Tracks", 100, .0, .05));
558 tfd.
make<TH1F>(
"h_diff_curvature",
559 "Curvature |#kappa| Tracks Difference;|#kappa_{Track}|;# Pos Tracks - # Neg Tracks",
563 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_chi2",
"#chi^{2};#chi^{2}_{Track};Number of Tracks", 500, -0.01, 500.));
565 tfd.
make<TH1F>(
"h_chi2Prob",
"#chi^{2} probability;#chi^{2}prob_{Track};Number of Tracks", 100, 0.0, 1.));
567 tfd.
make<TH1F>(
"h_normchi2",
"#chi^{2}/ndof;#chi^{2}/ndof;Number of Tracks", 100, -0.01, 10.));
568 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_pt",
"p_{T}^{track};p_{T}^{track} [GeV];Number of Tracks", 250, 0., 250));
570 "h_ptResolution",
"#delta_{p_{T}}/p_{T}^{track};#delta_{p_{T}}/p_{T}^{track};Number of Tracks", 100, 0., 0.5));
572 "p_d0_vs_phi",
"Transverse Impact Parameter vs. #phi;#phi_{Track};#LT d_{0} #GT [cm]", 100, -3.15, 3.15));
574 "p_dz_vs_phi",
"Longitudinal Impact Parameter vs. #phi;#phi_{Track};#LT d_{z} #GT [cm]", 100, -3.15, 3.15));
576 "p_d0_vs_eta",
"Transverse Impact Parameter vs. #eta;#eta_{Track};#LT d_{0} #GT [cm]", 100, -3.15, 3.15));
578 "p_dz_vs_eta",
"Longitudinal Impact Parameter vs. #eta;#eta_{Track};#LT d_{z} #GT [cm]", 100, -3.15, 3.15));
580 tfd.
make<TProfile>(
"p_chi2_vs_phi",
"#chi^{2} vs. #phi;#phi_{Track};#LT #chi^{2} #GT", 100, -3.15, 3.15));
582 "p_chi2Prob_vs_phi",
"#chi^{2} probablility vs. #phi;#phi_{Track};#LT #chi^{2} probability#GT", 100, -3.15, 3.15));
584 "p_chi2Prob_vs_d0",
"#chi^{2} probablility vs. |d_{0}|;|d_{0}|[cm];#LT #chi^{2} probability#GT", 100, 0, 80));
586 "p_normchi2_vs_phi",
"#chi^{2}/ndof vs. #phi;#phi_{Track};#LT #chi^{2}/ndof #GT", 100, -3.15, 3.15));
588 tfd.
make<TProfile>(
"p_chi2_vs_eta",
"#chi^{2} vs. #eta;#eta_{Track};#LT #chi^{2} #GT", 100, -3.15, 3.15));
590 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.};
592 "p_normchi2_vs_pt",
"norm #chi^{2} vs. p_{T}_{Track}; p_{T}_{Track};#LT #chi^{2}/ndof #GT", 18,
xBins));
595 tfd.
make<TProfile>(
"p_normchi2_vs_p",
"#chi^{2}/ndof vs. p_{Track};p_{Track};#LT #chi^{2}/ndof #GT", 18,
xBins));
597 "p_chi2Prob_vs_eta",
"#chi^{2} probability vs. #eta;#eta_{Track};#LT #chi^{2} probability #GT", 100, -3.15, 3.15));
599 "p_normchi2_vs_eta",
"#chi^{2}/ndof vs. #eta;#eta_{Track};#LT #chi^{2}/ndof #GT", 100, -3.15, 3.15));
601 tfd.
make<TProfile>(
"p_kappa_vs_phi",
"#kappa vs. #phi;#phi_{Track};#kappa", 100, -3.15, 3.15));
603 tfd.
make<TProfile>(
"p_kappa_vs_eta",
"#kappa vs. #eta;#eta_{Track};#kappa", 100, -3.15, 3.15));
605 "#delta_{p_{T}}/p_{T}^{track};#phi^{track};#delta_{p_{T}}/p_{T}^{track}",
610 "#delta_{p_{T}}/p_{T}^{track};#eta^{track};#delta_{p_{T}}/p_{T}^{track}",
616 "h2_d0_vs_phi",
"Transverse Impact Parameter vs. #phi;#phi_{Track};d_{0} [cm]", 100, -3.15, 3.15, 100, -1., 1.));
618 "Longitudinal Impact Parameter vs. #phi;#phi_{Track};d_{z} [cm]",
626 "h2_d0_vs_eta",
"Transverse Impact Parameter vs. #eta;#eta_{Track};d_{0} [cm]", 100, -3.15, 3.15, 100, -1., 1.));
628 "Longitudinal Impact Parameter vs. #eta;#eta_{Track};d_{z} [cm]",
636 tfd.
make<TH2F>(
"h2_chi2_vs_phi",
"#chi^{2} vs. #phi;#phi_{Track};#chi^{2}", 100, -3.15, 3.15, 500, 0., 500.));
638 "#chi^{2} probability vs. #phi;#phi_{Track};#chi^{2} probability",
646 "#chi^{2} probability vs. |d_{0}|;|d_{0}| [cm];#chi^{2} probability",
654 "h2_normchi2_vs_phi",
"#chi^{2}/ndof vs. #phi;#phi_{Track};#chi^{2}/ndof", 100, -3.15, 3.15, 100, 0., 10.));
656 tfd.
make<TH2F>(
"h2_chi2_vs_eta",
"#chi^{2} vs. #eta;#eta_{Track};#chi^{2}", 100, -3.15, 3.15, 500, 0., 500.));
658 "#chi^{2} probaility vs. #eta;#eta_{Track};#chi^{2} probability",
666 "h2_normchi2_vs_eta",
"#chi^{2}/ndof vs. #eta;#eta_{Track};#chi^{2}/ndof", 100, -3.15, 3.15, 100, 0., 10.));
668 tfd.
make<TH2F>(
"h2_kappa_vs_phi",
"#kappa vs. #phi;#phi_{Track};#kappa", 100, -3.15, 3.15, 100, .0, .05));
670 tfd.
make<TH2F>(
"h2_kappa_vs_eta",
"#kappa vs. #eta;#eta_{Track};#kappa", 100, -3.15, 3.15, 100, .0, .05));
672 "h2_normchi2_vs_kappa",
"#kappa vs. #chi^{2}/ndof;#chi^{2}/ndof;#kappa", 100, 0., 10, 100, -.03, .03));
676 "p_vs_resXprime_pixB",
"res_{x'} vs momentum in BPix;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
678 "p_vs_resXprime_pixE",
"res_{x'} vs momentum in FPix;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
680 "p_vs_resXprime_TIB",
"res_{x'} vs momentum in TIB;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
682 "p_vs_resXprime_TID",
"res_{x'} vs momentum in TID;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
684 "p_vs_resXprime_TOB",
"res_{x'} vs momentum in TOB;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
686 "p_vs_resXprime_TEC",
"res_{x'} vs momentum in TEC;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
690 "p_vs_resYprime_pixB",
"res_{y'} vs momentum in BPix;p [GeV]; res_{y'}", 15, 0., 15., 200, -0.1, 0.1));
692 "p_vs_resYprime_pixE",
"res_{y'} vs momentum in FPix;p [GeV]; res_{y'}", 15, 0., 15., 200, -0.1, 0.1));
697 for (
int i = 0, iEnd = ali.
components().size();
i < iEnd; ++
i) {
699 LogDebug(
"TrackerOfflineValidation") <<
"StructureName = " << structurename;
703 if (structurename !=
"Strip" && structurename !=
"Pixel")
706 if (structurename.find(
"Endcap", 0) != std::string::npos) {
739 std::stringstream histoname, histotitle, normhistoname, normhistotitle, yhistoname, yhistotitle, xprimehistoname,
740 xprimehistotitle, normxprimehistoname, normxprimehistotitle, yprimehistoname, yprimehistotitle,
741 normyprimehistoname, normyprimehistotitle, localxname, localxtitle, localyname, localytitle, resxvsxprofilename,
742 resxvsxprofiletitle, resyvsxprofilename, resyvsxprofiletitle, resxvsyprofilename, resxvsyprofiletitle,
743 resyvsyprofilename, resyvsyprofiletitle;
747 if (this->
isEndCap(static_cast<uint32_t>(subdetandlayer.first)))
748 wheel_or_layer =
"_wheel_";
749 else if (this->
isBarrel(static_cast<uint32_t>(subdetandlayer.first)))
750 wheel_or_layer =
"_layer_";
752 edm::LogWarning(
"TrackerOfflineValidation") <<
"@SUB=TrackerOfflineValidation::bookHists"
753 <<
"Unknown subdetid: " << subdetandlayer.first;
755 histoname <<
"h_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_"
757 yhistoname <<
"h_y_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_"
759 xprimehistoname <<
"h_xprime_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
760 <<
"_module_" <<
id.rawId();
761 yprimehistoname <<
"h_yprime_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
762 <<
"_module_" <<
id.rawId();
763 normhistoname <<
"h_normresiduals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
764 <<
"_module_" <<
id.rawId();
765 normxprimehistoname <<
"h_normxprimeresiduals_subdet_" << subdetandlayer.first << wheel_or_layer
766 << subdetandlayer.second <<
"_module_" <<
id.rawId();
767 normyprimehistoname <<
"h_normyprimeresiduals_subdet_" << subdetandlayer.first << wheel_or_layer
768 << subdetandlayer.second <<
"_module_" <<
id.rawId();
769 histotitle <<
"X Residual for module " <<
id.rawId() <<
";x_{tr} - x_{hit} [cm]";
770 yhistotitle <<
"Y Residual for module " <<
id.rawId() <<
";y_{tr} - y_{hit} [cm]";
771 normhistotitle <<
"Normalized Residual for module " <<
id.rawId() <<
";x_{tr} - x_{hit}/#sigma";
772 xprimehistotitle <<
"X' Residual for module " <<
id.rawId() <<
";(x_{tr} - x_{hit})' [cm]";
773 normxprimehistotitle <<
"Normalized X' Residual for module " <<
id.rawId() <<
";(x_{tr} - x_{hit})'/#sigma";
774 yprimehistotitle <<
"Y' Residual for module " <<
id.rawId() <<
";(y_{tr} - y_{hit})' [cm]";
775 normyprimehistotitle <<
"Normalized Y' Residual for module " <<
id.rawId() <<
";(y_{tr} - y_{hit})'/#sigma";
778 localxname <<
"h_localx_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_"
780 localyname <<
"h_localy_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_"
782 localxtitle <<
"u local for module " <<
id.rawId() <<
"; u_{tr,r}";
783 localytitle <<
"v local for module " <<
id.rawId() <<
"; v_{tr,r}";
785 resxvsxprofilename <<
"p_residuals_x_vs_x_subdet_" << subdetandlayer.first << wheel_or_layer
786 << subdetandlayer.second <<
"_module_" <<
id.rawId();
787 resyvsxprofilename <<
"p_residuals_y_vs_x_subdet_" << subdetandlayer.first << wheel_or_layer
788 << subdetandlayer.second <<
"_module_" <<
id.rawId();
789 resxvsyprofilename <<
"p_residuals_x_vs_y_subdet_" << subdetandlayer.first << wheel_or_layer
790 << subdetandlayer.second <<
"_module_" <<
id.rawId();
791 resyvsyprofilename <<
"p_residuals_y_vs_y_subdet_" << subdetandlayer.first << wheel_or_layer
792 << subdetandlayer.second <<
"_module_" <<
id.rawId();
793 resxvsxprofiletitle <<
"U Residual vs u for module " <<
id.rawId()
794 <<
"; u_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
795 resyvsxprofiletitle <<
"V Residual vs u for module " <<
id.rawId()
796 <<
"; u_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
797 resxvsyprofiletitle <<
"U Residual vs v for module " <<
id.rawId()
798 <<
"; v_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
799 resyvsyprofiletitle <<
"V Residual vs v for module " <<
id.rawId()
800 <<
"; v_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
812 moduleLevelHistsTransient =
false;
818 moduleLevelHistsTransient, tfd, histoname.str().c_str(), histotitle.str().c_str(),
nbins,
xmin,
xmax);
821 moduleLevelHistsTransient, tfd, normhistoname.str().c_str(), normhistotitle.str().c_str(),
nbins,
xmin,
xmax);
826 xprimehistoname.str().c_str(),
827 xprimehistotitle.str().c_str(),
834 normxprimehistoname.str().c_str(),
835 normxprimehistotitle.str().c_str(),
844 moduleLevelHistsTransient, tfd, localxname.str().c_str(), localxtitle.str().c_str(),
nbins,
xmin,
xmax);
846 moduleLevelHistsTransient, tfd, localyname.str().c_str(), localytitle.str().c_str(),
nbins,
xmin,
xmax);
849 resxvsxprofilename.str().c_str(),
850 resxvsxprofiletitle.str().c_str(),
859 resxvsyprofilename.str().c_str(),
860 resxvsyprofiletitle.str().c_str(),
873 yprimehistoname.str().c_str(),
874 yprimehistotitle.str().c_str(),
881 moduleLevelHistsTransient, tfd, yhistoname.str().c_str(), yhistotitle.str().c_str(),
nbins,
xmin,
xmax);
886 normyprimehistoname.str().c_str(),
887 normyprimehistotitle.str().c_str(),
897 resyvsxprofilename.str().c_str(),
898 resyvsxprofiletitle.str().c_str(),
907 resyvsyprofilename.str().c_str(),
908 resyvsyprofiletitle.str().c_str(),
922 const char* histName,
931 return tfd.
make<TH1F>(histName,
histTitle, nBinsX, lowX, highX);
936 const char* histName,
946 return (TProfile*)tfd.
make<TProfile>(histName,
histTitle, nBinsX, lowX, highX);
951 const char* histName,
959 TProfile*
profile =
new TProfile(histName,
histTitle, nBinsX, lowX, highX, lowY, highY);
963 return (TProfile*)tfd.
make<TProfile>(histName,
histTitle, nBinsX, lowX, highX, lowY, highY);
988 double& upperBoundX) {
1047 lowerBoundX = binningPSet.
getParameter<
double>(
"xmin");
1048 upperBoundX = binningPSet.
getParameter<
double>(
"xmax");
1052 if (targetHist && sourceHist) {
1053 targetHist->SetBinContent(
bin, sourceHist->GetMean(1));
1055 targetHist->SetBinError(
bin,
Fwhm(sourceHist) / 2.);
1057 targetHist->SetBinError(
bin, sourceHist->GetRMS(1));
1104 <<
"[TrackerOfflineValidation] Error, tried to get reference for non-tracker subdet " << subdetid
1105 <<
" from detector " << detid.
det();
1117 TH1::StatOverflows(kTRUE);
1120 std::vector<TrackerValidationVariables::AVTrackStruct> vTrackstruct;
1123 for (std::vector<TrackerValidationVariables::AVTrackStruct>::const_iterator itT = vTrackstruct.begin();
1124 itT != vTrackstruct.end();
1137 vTrackHistos_[numOfValidHitsindex]->Fill(itT->numberOfValidHits);
1139 vTrackHistos_[numOfLostHitsindex]->Fill(itT->numberOfLostHits);
1143 if (itT->charge > 0)
1146 if (itT->charge < 0)
1156 if (itT->ptError != 0.) {
1158 vTrackHistos_[ptResolutionindex]->Fill(itT->ptError / itT->pt);
1174 vTrackProfiles_[chiProbabsd0index]->Fill(fabs(itT->d0), itT->chi2Prob);
1192 vTrackProfiles_[ptResphiindex]->Fill(itT->phi, itT->ptError / itT->pt);
1194 vTrackProfiles_[ptResetaindex]->Fill(itT->eta, itT->ptError / itT->pt);
1210 vTrack2DHistos_[chiProbabsd0index_2d]->Fill(fabs(itT->d0), itT->chi2Prob);
1227 for (std::vector<TrackerValidationVariables::AVHitStruct>::const_iterator itH = itT->hits.begin();
1228 itH != itT->hits.end();
1230 DetId detid(itH->rawDetId);
1235 histStruct.
ResHisto->Fill(itH->resX);
1236 if (itH->resErrX != 0)
1237 histStruct.
NormResHisto->Fill(itH->resX / itH->resErrX);
1243 if (itH->resXprime != -999.) {
1274 float tgalpha =
tan(itH->localAlpha);
1275 if (fabs(tgalpha) != 0) {
1276 histStruct.
LocalX->Fill(itH->localXnorm, tgalpha * tgalpha);
1277 histStruct.
LocalY->Fill(itH->localYnorm, tgalpha * tgalpha);
1289 histStruct.
ResXvsXProfile->Fill(itH->localXnorm, itH->resXatTrkY / tgalpha, tgalpha * tgalpha);
1290 histStruct.
ResXvsYProfile->Fill(itH->localYnorm, itH->resXatTrkY / tgalpha, tgalpha * tgalpha);
1296 if (itH->resXprimeErr != 0 && itH->resXprimeErr != -999) {
1301 if (itH->resYprime != -999.) {
1317 float tgbeta =
tan(itH->localBeta);
1318 if (fabs(tgbeta) != 0) {
1331 histStruct.
ResYvsXProfile->Fill(itH->localXnorm, itH->resY / tgbeta, tgbeta * tgbeta);
1332 histStruct.
ResYvsYProfile->Fill(itH->localYnorm, itH->resY / tgbeta, tgbeta * tgbeta);
1337 if (itH->resYprimeErr != 0 && itH->resYprimeErr != -999.) {
1347 TH1::StatOverflows(kFALSE);
1371 TTree*
tree = fs->
make<TTree>(
"TkOffVal",
"TkOffVal");
1377 tree->Branch(
"TkOffTreeVariables", &treeMemPtr);
1387 treeMemPtr =
nullptr;
1393 std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles) {
1398 for (
int iComp = 0, iCompEnd = ali.
components().size(); iComp < iCompEnd; ++iComp) {
1399 std::vector<TrackerOfflineValidation::SummaryContainer> vProfiles;
1402 LogDebug(
"TrackerOfflineValidation") <<
"StructureName = " << structurename;
1407 if (structurename !=
"Strip" && structurename !=
"Pixel")
1414 TH1* hX = vLevelProfiles[iComp].sumXResiduals_;
1415 TH1* hNormX = vLevelProfiles[iComp].sumNormXResiduals_;
1416 TH1* hY = vLevelProfiles[iComp].sumYResiduals_;
1417 TH1* hNormY = vLevelProfiles[iComp].sumNormYResiduals_;
1418 TH1* pXX = vLevelProfiles[iComp].sumResXvsXProfile_;
1419 TH1* pXY = vLevelProfiles[iComp].sumResXvsYProfile_;
1420 TH1* pYX = vLevelProfiles[iComp].sumResYvsXProfile_;
1421 TH1* pYY = vLevelProfiles[iComp].sumResYvsYProfile_;
1422 for (
uint n = 0;
n < vProfiles.size(); ++
n) {
1442 toFit_.push_back(vLevelProfiles[iComp].sumXResiduals_);
1443 toFit_.push_back(vLevelProfiles[iComp].sumNormXResiduals_);
1447 toFit_.push_back(hNormY);
1456 for (std::vector<std::pair<TH1*, TH1*> >::const_iterator it =
sumHistStructure_.begin();
1459 it->first->Add(it->second);
1461 for (std::vector<std::tuple<int, TH1*, TH1*> >::const_iterator it =
summaryBins_.begin(); it !=
summaryBins_.end();
1463 setSummaryBin(std::get<0>(*it), std::get<1>(*it), std::get<2>(*it));
1465 for (std::vector<TH1*>::const_iterator it =
toFit_.begin(); it !=
toFit_.end(); ++it)
1476 const char* aliTypeName =
alignableTracker_->objectIdProvider().idToString(alitype);
1477 const char* aliSubtypeName =
alignableTracker_->objectIdProvider().idToString(subtype);
1480 const DetId aliDetId = ali.
id();
1490 const uint subcompSize = ali.
components()[0]->components().size();
1492 const TString
title(Form(
"Summary for substructures in %s %d;%s;", aliTypeName,
i, aliSubtypeName));
1494 sumContainer.summaryXResiduals_ = tfd.
make<TH1F>(
1495 Form(
"h_summaryX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x' #GT", aliSize, 0.5, aliSize + 0.5);
1496 sumContainer.summaryNormXResiduals_ = tfd.
make<TH1F>(
1497 Form(
"h_summaryNormX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x'/#sigma #GT", aliSize, 0.5, aliSize + 0.5);
1500 sumContainer.summaryYResiduals_ = tfd.
make<TH1F>(
1501 Form(
"h_summaryY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y' #GT", aliSize, 0.5, aliSize + 0.5);
1502 sumContainer.summaryNormYResiduals_ = tfd.
make<TH1F>(
1503 Form(
"h_summaryNormY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y'/#sigma #GT", aliSize, 0.5, aliSize + 0.5);
1507 if (subcompSize != 2) {
1510 <<
"Det with " << subcompSize <<
" components";
1513 const TString
title(Form(
1514 "Summary for substructures in %s %d;%s;",
1519 sumContainer.summaryXResiduals_ = tfd.
make<TH1F>(
1520 Form(
"h_summaryX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x' #GT", (2 * aliSize), 0.5, 2 * aliSize + 0.5);
1521 sumContainer.summaryNormXResiduals_ = tfd.
make<TH1F>(Form(
"h_summaryNormX%s_%d", aliTypeName,
i),
1522 title +
"#LT #Delta x'/#sigma #GT",
1528 sumContainer.summaryYResiduals_ = tfd.
make<TH1F>(
1529 Form(
"h_summaryY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y' #GT", (2 * aliSize), 0.5, 2 * aliSize + 0.5);
1530 sumContainer.summaryNormYResiduals_ = tfd.
make<TH1F>(Form(
"h_summaryNormY%s_%d", aliTypeName,
i),
1531 title +
"#LT #Delta y'/#sigma #GT",
1539 <<
"@SUB=TrackerOfflineValidation::bookSummaryHists"
1540 <<
"No summary histogram for hierarchy level " << aliTypeName <<
" in subdet " << aliDetId.
subdetId();
1548 const TString sumTitle(Form(
"Residual for %s %d in %s;", aliTypeName,
i,
typeName));
1552 sumContainer.sumXResiduals_ = tfd.
make<TH1F>(Form(
"h_Xprime_%s_%d", aliTypeName,
i),
1559 sumContainer.sumNormXResiduals_ = tfd.
make<TH1F>(Form(
"h_NormXprime_%s_%d", aliTypeName,
i),
1567 sumContainer.sumResXvsXProfile_ = tfd.
make<TProfile>(Form(
"p_resXX_%s_%d", aliTypeName,
i),
1573 sumContainer.sumResXvsXProfile_->Sumw2();
1574 sumContainer.sumResXvsYProfile_ = tfd.
make<TProfile>(Form(
"p_resXY_%s_%d", aliTypeName,
i),
1580 sumContainer.sumResXvsYProfile_->Sumw2();
1585 sumContainer.sumYResiduals_ = tfd.
make<TH1F>(Form(
"h_Yprime_%s_%d", aliTypeName,
i),
1592 sumContainer.sumNormYResiduals_ = tfd.
make<TH1F>(Form(
"h_NormYprime_%s_%d", aliTypeName,
i),
1600 sumContainer.sumResYvsXProfile_ = tfd.
make<TProfile>(Form(
"p_resYX_%s_%d", aliTypeName,
i),
1606 sumContainer.sumResYvsXProfile_->Sumw2();
1607 sumContainer.sumResYvsYProfile_ = tfd.
make<TProfile>(Form(
"p_resYY_%s_%d", aliTypeName,
i),
1613 sumContainer.sumResYvsYProfile_->Sumw2();
1621 for (
uint k = 0;
k < aliSize; ++
k) {
1642 for (
uint k = 0;
k < aliSize; ++
k) {
1643 for (
uint j = 0;
j < subcompSize; ++
j) {
1664 return sumContainer;
1668 float max =
hist->GetMaximum();
1669 int left = -1, right = -1;
1670 for (
unsigned int i = 1, iEnd =
hist->GetNbinsX();
i <= iEnd; ++
i) {
1671 if (
hist->GetBinContent(
i) <
max / 2. &&
hist->GetBinContent(
i + 1) >
max / 2. && left == -1) {
1672 if (
max / 2. -
hist->GetBinContent(
i) <
hist->GetBinContent(
i + 1) -
max / 2.) {
1680 if (left != -1 && right == -1) {
1681 if (
hist->GetBinContent(
i) >
max / 2. &&
hist->GetBinContent(
i + 1) <
max / 2.) {
1682 if (
hist->GetBinContent(
i) -
max / 2. <
max / 2. -
hist->GetBinContent(
i + 1)) {
1690 return hist->GetXaxis()->GetBinCenter(right) -
hist->GetXaxis()->GetBinCenter(left);
1696 for (std::map<int, TrackerOfflineValidation::ModuleHistos>::const_iterator it = moduleHist_.begin(),
1697 itEnd = moduleHist_.end();
1703 DetId detId_ = it->first;
1709 unsigned int whichHalfBarrel(1), rawId(detId_.
rawId());
1710 if ((rawId >= 302056964 && rawId < 302059300) || (rawId >= 302123268 && rawId < 302127140) ||
1711 (rawId >= 302189572 && rawId < 302194980))
1712 whichHalfBarrel = 2;
1714 treeMem.
half = whichHalfBarrel;
1718 unsigned int whichHalfCylinder(1), rawId(detId_.
rawId());
1719 if ((rawId >= 352394500 && rawId < 352406032) || (rawId >= 352460036 && rawId < 352471568) ||
1720 (rawId >= 344005892 && rawId < 344017424) || (rawId >= 344071428 && rawId < 344082960))
1721 whichHalfCylinder = 2;
1724 treeMem.
half = whichHalfCylinder;
1729 unsigned int whichHalfShell(1), rawId(detId_.
rawId());
1730 if ((rawId >= 369120484 && rawId < 369120688) || (rawId >= 369121540 && rawId < 369121776) ||
1731 (rawId >= 369136932 && rawId < 369137200) || (rawId >= 369137988 && rawId < 369138288) ||
1732 (rawId >= 369153396 && rawId < 369153744) || (rawId >= 369154436 && rawId < 369154800) ||
1733 (rawId >= 369169844 && rawId < 369170256) || (rawId >= 369170900 && rawId < 369171344) ||
1734 (rawId >= 369124580 && rawId < 369124784) || (rawId >= 369125636 && rawId < 369125872) ||
1735 (rawId >= 369141028 && rawId < 369141296) || (rawId >= 369142084 && rawId < 369142384) ||
1736 (rawId >= 369157492 && rawId < 369157840) || (rawId >= 369158532 && rawId < 369158896) ||
1737 (rawId >= 369173940 && rawId < 369174352) || (rawId >= 369174996 && rawId < 369175440))
1741 treeMem.
half = whichHalfShell;
1778 treeMem.
posX = gPModule.
x();
1779 treeMem.
posY = gPModule.
y();
1780 treeMem.
posZ = gPModule.
z();
1785 LocalPoint lUDirection(1., 0., 0.), lVDirection(0., 1., 0.), lWDirection(0., 0., 1.);
1787 gWDirection = surface.
toGlobal(lWDirection);
1788 double dR(999.),
dPhi(999.), dZ(999.);
1791 dR = gWDirection.perp() - gPModule.
perp();
1793 dZ = gVDirection.z() - gPModule.
z();
1801 dZ = gWDirection.z() - gPModule.
z();
1807 dR = gVDirection.perp() - gPModule.
perp();
1809 dZ = gWDirection.z() - gPModule.
z();
1832 const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_) {
1833 for (std::map<int, TrackerOfflineValidation::ModuleHistos>::const_iterator it = moduleHist_.begin(),
1834 itEnd = moduleHist_.end();
1840 treeMem.
entries = static_cast<UInt_t>(it->second.ResXprimeHisto->GetEntries());
1841 treeMem.
meanX = it->second.ResXprimeHisto->GetMean();
1842 treeMem.
rmsX = it->second.ResXprimeHisto->GetRMS();
1848 std::pair<float, float> fitResult1 = this->
fitResiduals(it->second.ResXprimeHisto);
1849 treeMem.
fitMeanX = fitResult1.first;
1852 std::pair<float, float> fitResult2 = this->
fitResiduals(it->second.NormResXprimeHisto);
1860 int numberOfBins = it->second.ResXprimeHisto->GetNbinsX();
1864 it->second.ResXprimeHisto->GetBinContent(0) + it->second.ResXprimeHisto->GetBinContent(
numberOfBins + 1);
1867 treeMem.
meanNormX = it->second.NormResXprimeHisto->GetMean();
1868 treeMem.
rmsNormX = it->second.NormResXprimeHisto->GetRMS();
1871 it->second.NormResXprimeHisto->GetStats(
stats);
1876 treeMem.
sigmaNormX =
Fwhm(it->second.NormResXprimeHisto) / 2.355;
1877 treeMem.
histNameX = it->second.ResXprimeHisto->GetName();
1878 treeMem.
histNameNormX = it->second.NormResXprimeHisto->GetName();
1882 treeMem.
meanLocalX = it->second.ResHisto->GetMean();
1883 treeMem.
rmsLocalX = it->second.ResHisto->GetRMS();
1889 if (it->second.ResYHisto)
1895 if (it->second.ResYprimeHisto) {
1896 TH1*
h = it->second.ResYprimeHisto;
1897 treeMem.
meanY =
h->GetMean();
1898 treeMem.
rmsY =
h->GetRMS();
1901 std::pair<float, float> fitMeanSigma = this->
fitResiduals(h);
1902 treeMem.
fitMeanY = fitMeanSigma.first;
1903 treeMem.
fitSigmaY = fitMeanSigma.second;
1911 if (it->second.NormResYprimeHisto) {
1912 TH1*
h = it->second.NormResYprimeHisto;
1920 std::pair<float, float> fitMeanSigma = this->
fitResiduals(h);
1928 if (it->second.ResXvsXProfile) {
1929 TH1*
h = it->second.ResXvsXProfile;
1934 if (it->second.ResXvsYProfile) {
1935 TH1*
h = it->second.ResXvsYProfile;
1940 if (it->second.ResYvsXProfile) {
1941 TH1*
h = it->second.ResYvsXProfile;
1946 if (it->second.ResYvsYProfile) {
1947 TH1*
h = it->second.ResYvsYProfile;
1959 std::pair<float, float> fitResult(9999., 9999.);
1960 if (!
hist ||
hist->GetEntries() < 20)
1964 float sigma =
hist->GetRMS();
1970 if (0 ==
hist->Fit(&
func,
"QNR")) {
1972 sigma =
func.GetParameter(2);
1977 if (0 ==
hist->Fit(&
func,
"Q0LR")) {
1978 if (
hist->GetFunction(
func.GetName())) {
1979 hist->GetFunction(
func.GetName())->ResetBit(TF1::kNotDraw);
1981 fitResult.first =
func.GetParameter(1);
1982 fitResult.second =
func.GetParameter(2);
1986 edm::LogWarning(
"Alignment") <<
"@SUB=TrackerOfflineValidation::fitResiduals"
1987 <<
"Caught this exception during ROOT fit: " <<
e.what();
1997 double*
x =
new double[
nbins];
1998 double*
y =
new double[
nbins];
2001 y[
j] =
histo->GetBinContent(
j + 1);