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) {
193 tfd = std::make_unique<TFileDirectory>(
fs->tFileDirectory());
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) {
405 theDbe->setCurrentFolder(directoryString);
406 return theDbe->book1D(
name,
title,
nBinX, minBinX, maxBinX)->getTH1();
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();
478 bareTkGeomPtr_(nullptr),
479 compressionSettings_(parSet_.getUntrackedParameter<
int>(
"compressionSettings", -1)),
480 lCoorHistOn_(parSet_.getParameter<
bool>(
"localCoorHistosOn")),
481 moduleLevelHistsTransient_(parSet_.getParameter<
bool>(
"moduleLevelHistsTransient")),
482 moduleLevelProfiles_(parSet_.getParameter<
bool>(
"moduleLevelProfiles")),
483 stripYResiduals_(parSet_.getParameter<
bool>(
"stripYResiduals")),
484 useFwhm_(parSet_.getParameter<
bool>(
"useFwhm")),
485 useFit_(parSet_.getParameter<
bool>(
"useFit")),
486 useOverflowForRMS_(parSet_.getParameter<
bool>(
"useOverflowForRMS")),
487 dqmMode_(parSet_.getParameter<
bool>(
"useInDqmMode")),
488 moduleDirectory_(parSet_.getParameter<
std::
string>(
"moduleDirectoryInOutput")),
489 chargeCut_(parSet_.getParameter<
int>(
"chargeCut")),
491 maxTracks_(parSet_.getParameter<unsigned long long>(
"maxTracks")),
492 avalidator_(iConfig, consumesCollector()) {
498 desc.setComment(
"Validates alignment payloads by evaluating unbiased track-hit resisuals");
500 desc.addUntracked<
int>(
"compressionSettings", -1);
501 desc.add<
bool>(
"localCoorHistosOn",
false);
502 desc.add<
bool>(
"moduleLevelHistsTransient",
false);
503 desc.add<
bool>(
"moduleLevelProfiles",
false);
504 desc.add<
bool>(
"stripYResiduals",
false);
505 desc.add<
bool>(
"useFwhm",
true);
506 desc.add<
bool>(
"useFit",
false);
507 desc.add<
bool>(
"useOverflowForRMS",
false);
508 desc.add<
bool>(
"useInDqmMode",
false);
510 desc.add<
int>(
"chargeCut", 0);
511 desc.add<
unsigned long long>(
"maxTracks", 0);
514 std::vector<std::string> listOfResidualsPSets = {
"TH1XResPixelModules",
515 "TH1XResStripModules",
516 "TH1NormXResPixelModules",
517 "TH1NormXResStripModules",
518 "TH1XprimeResPixelModules",
519 "TH1XprimeResStripModules",
520 "TH1NormXprimeResPixelModules",
521 "TH1NormXprimeResStripModules",
522 "TH1YResPixelModules",
523 "TH1YResStripModules",
524 "TH1NormYResPixelModules",
525 "TH1NormYResStripModules",
526 "TProfileXResPixelModules",
527 "TProfileXResStripModules",
528 "TProfileYResPixelModules",
529 "TProfileYResStripModules"};
531 for (
const auto& myPSetName : listOfResidualsPSets) {
533 myPSet.
add<
int>(
"Nbinx", 100);
534 myPSet.
add<
double>(
"xmin", -5.f);
535 myPSet.
add<
double>(
"xmax", 5.f);
569 <<
"There are " << newBareTkGeomPtr->
detIds().size() <<
" dets in the Geometry record.\n" 570 <<
"Out of these " << newBareTkGeomPtr->
detUnitIds().size() <<
" are detUnits";
581 std::vector<TrackerOfflineValidation::SummaryContainer> vTrackerprofiles;
592 <<
"TrackerGeometry changed, but will not re-book hists!";
598 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_tracketa",
"Track #eta;#eta_{Track};Number of Tracks", 90, -3., 3.));
599 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_trackphi",
"Track #phi;#phi_{Track};Number of Tracks", 90, -3.15, 3.15));
601 "h_trackNumberOfValidHits",
"Track # of valid hits;# of valid hits _{Track};Number of Tracks", 40, 0., 40.));
603 "h_trackNumberOfLostHits",
"Track # of lost hits;# of lost hits _{Track};Number of Tracks", 10, 0., 10.));
605 tfd.
make<TH1F>(
"h_curvature",
"Curvature #kappa;#kappa_{Track};Number of Tracks", 100, -.05, .05));
607 "h_curvature_pos",
"Curvature |#kappa| Positive Tracks;|#kappa_{pos Track}|;Number of Tracks", 100, .0, .05));
609 "h_curvature_neg",
"Curvature |#kappa| Negative Tracks;|#kappa_{neg Track}|;Number of Tracks", 100, .0, .05));
611 tfd.
make<TH1F>(
"h_diff_curvature",
612 "Curvature |#kappa| Tracks Difference;|#kappa_{Track}|;# Pos Tracks - # Neg Tracks",
616 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_chi2",
"#chi^{2};#chi^{2}_{Track};Number of Tracks", 500, -0.01, 500.));
618 tfd.
make<TH1F>(
"h_chi2Prob",
"#chi^{2} probability;#chi^{2}prob_{Track};Number of Tracks", 100, 0.0, 1.));
620 tfd.
make<TH1F>(
"h_normchi2",
"#chi^{2}/ndof;#chi^{2}/ndof;Number of Tracks", 100, -0.01, 10.));
621 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_pt",
"p_{T}^{track};p_{T}^{track} [GeV];Number of Tracks", 250, 0., 250));
623 "h_ptResolution",
"#delta_{p_{T}}/p_{T}^{track};#delta_{p_{T}}/p_{T}^{track};Number of Tracks", 100, 0., 0.5));
625 "p_d0_vs_phi",
"Transverse Impact Parameter vs. #phi;#phi_{Track};#LT d_{0} #GT [cm]", 100, -3.15, 3.15));
627 "p_dz_vs_phi",
"Longitudinal Impact Parameter vs. #phi;#phi_{Track};#LT d_{z} #GT [cm]", 100, -3.15, 3.15));
629 "p_d0_vs_eta",
"Transverse Impact Parameter vs. #eta;#eta_{Track};#LT d_{0} #GT [cm]", 100, -3.15, 3.15));
631 "p_dz_vs_eta",
"Longitudinal Impact Parameter vs. #eta;#eta_{Track};#LT d_{z} #GT [cm]", 100, -3.15, 3.15));
633 tfd.
make<TProfile>(
"p_chi2_vs_phi",
"#chi^{2} vs. #phi;#phi_{Track};#LT #chi^{2} #GT", 100, -3.15, 3.15));
635 "p_chi2Prob_vs_phi",
"#chi^{2} probablility vs. #phi;#phi_{Track};#LT #chi^{2} probability#GT", 100, -3.15, 3.15));
637 "p_chi2Prob_vs_d0",
"#chi^{2} probablility vs. |d_{0}|;|d_{0}|[cm];#LT #chi^{2} probability#GT", 100, 0, 80));
639 "p_normchi2_vs_phi",
"#chi^{2}/ndof vs. #phi;#phi_{Track};#LT #chi^{2}/ndof #GT", 100, -3.15, 3.15));
641 tfd.
make<TProfile>(
"p_chi2_vs_eta",
"#chi^{2} vs. #eta;#eta_{Track};#LT #chi^{2} #GT", 100, -3.15, 3.15));
643 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.};
645 "p_normchi2_vs_pt",
"norm #chi^{2} vs. p_{T}_{Track}; p_{T}_{Track};#LT #chi^{2}/ndof #GT", 18,
xBins));
648 tfd.
make<TProfile>(
"p_normchi2_vs_p",
"#chi^{2}/ndof vs. p_{Track};p_{Track};#LT #chi^{2}/ndof #GT", 18,
xBins));
650 "p_chi2Prob_vs_eta",
"#chi^{2} probability vs. #eta;#eta_{Track};#LT #chi^{2} probability #GT", 100, -3.15, 3.15));
652 "p_normchi2_vs_eta",
"#chi^{2}/ndof vs. #eta;#eta_{Track};#LT #chi^{2}/ndof #GT", 100, -3.15, 3.15));
654 tfd.
make<TProfile>(
"p_kappa_vs_phi",
"#kappa vs. #phi;#phi_{Track};#kappa", 100, -3.15, 3.15));
656 tfd.
make<TProfile>(
"p_kappa_vs_eta",
"#kappa vs. #eta;#eta_{Track};#kappa", 100, -3.15, 3.15));
658 "#delta_{p_{T}}/p_{T}^{track};#phi^{track};#delta_{p_{T}}/p_{T}^{track}",
663 "#delta_{p_{T}}/p_{T}^{track};#eta^{track};#delta_{p_{T}}/p_{T}^{track}",
669 "h2_d0_vs_phi",
"Transverse Impact Parameter vs. #phi;#phi_{Track};d_{0} [cm]", 100, -3.15, 3.15, 100, -1., 1.));
671 "Longitudinal Impact Parameter vs. #phi;#phi_{Track};d_{z} [cm]",
679 "h2_d0_vs_eta",
"Transverse Impact Parameter vs. #eta;#eta_{Track};d_{0} [cm]", 100, -3.15, 3.15, 100, -1., 1.));
681 "Longitudinal Impact Parameter vs. #eta;#eta_{Track};d_{z} [cm]",
689 tfd.
make<TH2F>(
"h2_chi2_vs_phi",
"#chi^{2} vs. #phi;#phi_{Track};#chi^{2}", 100, -3.15, 3.15, 500, 0., 500.));
691 "#chi^{2} probability vs. #phi;#phi_{Track};#chi^{2} probability",
699 "#chi^{2} probability vs. |d_{0}|;|d_{0}| [cm];#chi^{2} probability",
707 "h2_normchi2_vs_phi",
"#chi^{2}/ndof vs. #phi;#phi_{Track};#chi^{2}/ndof", 100, -3.15, 3.15, 100, 0., 10.));
709 tfd.
make<TH2F>(
"h2_chi2_vs_eta",
"#chi^{2} vs. #eta;#eta_{Track};#chi^{2}", 100, -3.15, 3.15, 500, 0., 500.));
711 "#chi^{2} probaility vs. #eta;#eta_{Track};#chi^{2} probability",
719 "h2_normchi2_vs_eta",
"#chi^{2}/ndof vs. #eta;#eta_{Track};#chi^{2}/ndof", 100, -3.15, 3.15, 100, 0., 10.));
721 tfd.
make<TH2F>(
"h2_kappa_vs_phi",
"#kappa vs. #phi;#phi_{Track};#kappa", 100, -3.15, 3.15, 100, .0, .05));
723 tfd.
make<TH2F>(
"h2_kappa_vs_eta",
"#kappa vs. #eta;#eta_{Track};#kappa", 100, -3.15, 3.15, 100, .0, .05));
725 "h2_normchi2_vs_kappa",
"#kappa vs. #chi^{2}/ndof;#chi^{2}/ndof;#kappa", 100, 0., 10, 100, -.03, .03));
729 "p_vs_resXprime_pixB",
"res_{x'} vs momentum in BPix;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
731 "p_vs_resXprime_pixE",
"res_{x'} vs momentum in FPix;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
733 "p_vs_resXprime_TIB",
"res_{x'} vs momentum in TIB;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
735 "p_vs_resXprime_TID",
"res_{x'} vs momentum in TID;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
737 "p_vs_resXprime_TOB",
"res_{x'} vs momentum in TOB;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
739 "p_vs_resXprime_TEC",
"res_{x'} vs momentum in TEC;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
743 "p_vs_resYprime_pixB",
"res_{y'} vs momentum in BPix;p [GeV]; res_{y'}", 15, 0., 15., 200, -0.1, 0.1));
745 "p_vs_resYprime_pixE",
"res_{y'} vs momentum in FPix;p [GeV]; res_{y'}", 15, 0., 15., 200, -0.1, 0.1));
750 for (
int i = 0, iEnd = ali.
components().size();
i < iEnd; ++
i) {
752 LogDebug(
"TrackerOfflineValidation") <<
"StructureName = " << structurename;
756 if (structurename !=
"Strip" && structurename !=
"Pixel")
759 if (structurename.find(
"Endcap", 0) != std::string::npos) {
792 std::stringstream histoname, histotitle, normhistoname, normhistotitle, yhistoname, yhistotitle, xprimehistoname,
793 xprimehistotitle, normxprimehistoname, normxprimehistotitle, yprimehistoname, yprimehistotitle,
794 normyprimehistoname, normyprimehistotitle, localxname, localxtitle, localyname, localytitle, resxvsxprofilename,
795 resxvsxprofiletitle, resyvsxprofilename, resyvsxprofiletitle, resxvsyprofilename, resxvsyprofiletitle,
796 resyvsyprofilename, resyvsyprofiletitle;
800 if (this->
isEndCap(static_cast<uint32_t>(subdetandlayer.first)))
801 wheel_or_layer =
"_wheel_";
802 else if (this->
isBarrel(static_cast<uint32_t>(subdetandlayer.first)))
803 wheel_or_layer =
"_layer_";
805 edm::LogWarning(
"TrackerOfflineValidation") <<
"@SUB=TrackerOfflineValidation::bookHists" 806 <<
"Unknown subdetid: " << subdetandlayer.first;
808 histoname <<
"h_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_" 810 yhistoname <<
"h_y_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_" 812 xprimehistoname <<
"h_xprime_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
813 <<
"_module_" <<
id.rawId();
814 yprimehistoname <<
"h_yprime_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
815 <<
"_module_" <<
id.rawId();
816 normhistoname <<
"h_normresiduals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
817 <<
"_module_" <<
id.rawId();
818 normxprimehistoname <<
"h_normxprimeresiduals_subdet_" << subdetandlayer.first << wheel_or_layer
819 << subdetandlayer.second <<
"_module_" <<
id.rawId();
820 normyprimehistoname <<
"h_normyprimeresiduals_subdet_" << subdetandlayer.first << wheel_or_layer
821 << subdetandlayer.second <<
"_module_" <<
id.rawId();
822 histotitle <<
"X Residual for module " <<
id.rawId() <<
";x_{tr} - x_{hit} [cm]";
823 yhistotitle <<
"Y Residual for module " <<
id.rawId() <<
";y_{tr} - y_{hit} [cm]";
824 normhistotitle <<
"Normalized Residual for module " <<
id.rawId() <<
";x_{tr} - x_{hit}/#sigma";
825 xprimehistotitle <<
"X' Residual for module " <<
id.rawId() <<
";(x_{tr} - x_{hit})' [cm]";
826 normxprimehistotitle <<
"Normalized X' Residual for module " <<
id.rawId() <<
";(x_{tr} - x_{hit})'/#sigma";
827 yprimehistotitle <<
"Y' Residual for module " <<
id.rawId() <<
";(y_{tr} - y_{hit})' [cm]";
828 normyprimehistotitle <<
"Normalized Y' Residual for module " <<
id.rawId() <<
";(y_{tr} - y_{hit})'/#sigma";
831 localxname <<
"h_localx_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_" 833 localyname <<
"h_localy_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_" 835 localxtitle <<
"u local for module " <<
id.rawId() <<
"; u_{tr,r}";
836 localytitle <<
"v local for module " <<
id.rawId() <<
"; v_{tr,r}";
838 resxvsxprofilename <<
"p_residuals_x_vs_x_subdet_" << subdetandlayer.first << wheel_or_layer
839 << subdetandlayer.second <<
"_module_" <<
id.rawId();
840 resyvsxprofilename <<
"p_residuals_y_vs_x_subdet_" << subdetandlayer.first << wheel_or_layer
841 << subdetandlayer.second <<
"_module_" <<
id.rawId();
842 resxvsyprofilename <<
"p_residuals_x_vs_y_subdet_" << subdetandlayer.first << wheel_or_layer
843 << subdetandlayer.second <<
"_module_" <<
id.rawId();
844 resyvsyprofilename <<
"p_residuals_y_vs_y_subdet_" << subdetandlayer.first << wheel_or_layer
845 << subdetandlayer.second <<
"_module_" <<
id.rawId();
846 resxvsxprofiletitle <<
"U Residual vs u for module " <<
id.rawId()
847 <<
"; u_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
848 resyvsxprofiletitle <<
"V Residual vs u for module " <<
id.rawId()
849 <<
"; u_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
850 resxvsyprofiletitle <<
"U Residual vs v for module " <<
id.rawId()
851 <<
"; v_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
852 resyvsyprofiletitle <<
"V Residual vs v for module " <<
id.rawId()
853 <<
"; v_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
865 moduleLevelHistsTransient =
false;
871 moduleLevelHistsTransient, tfd, histoname.str().c_str(), histotitle.str().c_str(),
nbins,
xmin,
xmax);
874 moduleLevelHistsTransient, tfd, normhistoname.str().c_str(), normhistotitle.str().c_str(),
nbins,
xmin,
xmax);
879 xprimehistoname.str().c_str(),
880 xprimehistotitle.str().c_str(),
887 normxprimehistoname.str().c_str(),
888 normxprimehistotitle.str().c_str(),
897 moduleLevelHistsTransient, tfd, localxname.str().c_str(), localxtitle.str().c_str(),
nbins,
xmin,
xmax);
899 moduleLevelHistsTransient, tfd, localyname.str().c_str(), localytitle.str().c_str(),
nbins,
xmin,
xmax);
902 resxvsxprofilename.str().c_str(),
903 resxvsxprofiletitle.str().c_str(),
912 resxvsyprofilename.str().c_str(),
913 resxvsyprofiletitle.str().c_str(),
926 yprimehistoname.str().c_str(),
927 yprimehistotitle.str().c_str(),
934 moduleLevelHistsTransient, tfd, yhistoname.str().c_str(), yhistotitle.str().c_str(),
nbins,
xmin,
xmax);
939 normyprimehistoname.str().c_str(),
940 normyprimehistotitle.str().c_str(),
950 resyvsxprofilename.str().c_str(),
951 resyvsxprofiletitle.str().c_str(),
960 resyvsyprofilename.str().c_str(),
961 resyvsyprofiletitle.str().c_str(),
975 const char* histName,
984 return tfd.
make<TH1F>(histName,
histTitle, nBinsX, lowX, highX);
989 const char* histName,
999 return (TProfile*)tfd.
make<TProfile>(histName,
histTitle, nBinsX, lowX, highX);
1004 const char* histName,
1012 TProfile*
profile =
new TProfile(histName,
histTitle, nBinsX, lowX, highX, lowY, highY);
1016 return (TProfile*)tfd.
make<TProfile>(histName,
histTitle, nBinsX, lowX, highX, lowY, highY);
1040 double& lowerBoundX,
1041 double& upperBoundX) {
1100 lowerBoundX = binningPSet.
getParameter<
double>(
"xmin");
1101 upperBoundX = binningPSet.
getParameter<
double>(
"xmax");
1105 if (targetHist && sourceHist) {
1106 targetHist->SetBinContent(
bin, sourceHist->GetMean(1));
1108 targetHist->SetBinError(
bin,
Fwhm(sourceHist) / 2.);
1110 targetHist->SetBinError(
bin, sourceHist->GetRMS(1));
1157 <<
"[TrackerOfflineValidation] Error, tried to get reference for non-tracker subdet " << subdetid
1158 <<
" from detector " <<
detid.det();
1170 TH1::StatOverflows(kTRUE);
1173 std::vector<TrackerValidationVariables::AVTrackStruct> vTrackstruct;
1176 for (std::vector<TrackerValidationVariables::AVTrackStruct>::const_iterator itT = vTrackstruct.begin();
1177 itT != vTrackstruct.end();
1190 vTrackHistos_[numOfValidHitsindex]->Fill(itT->numberOfValidHits);
1192 vTrackHistos_[numOfLostHitsindex]->Fill(itT->numberOfLostHits);
1196 if (itT->charge > 0)
1199 if (itT->charge < 0)
1209 if (itT->ptError != 0.) {
1211 vTrackHistos_[ptResolutionindex]->Fill(itT->ptError / itT->pt);
1227 vTrackProfiles_[chiProbabsd0index]->Fill(fabs(itT->d0), itT->chi2Prob);
1245 vTrackProfiles_[ptResphiindex]->Fill(itT->phi, itT->ptError / itT->pt);
1247 vTrackProfiles_[ptResetaindex]->Fill(itT->eta, itT->ptError / itT->pt);
1263 vTrack2DHistos_[chiProbabsd0index_2d]->Fill(fabs(itT->d0), itT->chi2Prob);
1280 for (std::vector<TrackerValidationVariables::AVHitStruct>::const_iterator itH = itT->hits.begin();
1281 itH != itT->hits.end();
1288 histStruct.
ResHisto->Fill(itH->resX);
1289 if (itH->resErrX != 0)
1290 histStruct.
NormResHisto->Fill(itH->resX / itH->resErrX);
1296 if (itH->resXprime != -999.) {
1327 float tgalpha =
tan(itH->localAlpha);
1328 if (fabs(tgalpha) != 0) {
1329 histStruct.
LocalX->Fill(itH->localXnorm, tgalpha * tgalpha);
1330 histStruct.
LocalY->Fill(itH->localYnorm, tgalpha * tgalpha);
1342 histStruct.
ResXvsXProfile->Fill(itH->localXnorm, itH->resXatTrkY / tgalpha, tgalpha * tgalpha);
1343 histStruct.
ResXvsYProfile->Fill(itH->localYnorm, itH->resXatTrkY / tgalpha, tgalpha * tgalpha);
1349 if (itH->resXprimeErr != 0 && itH->resXprimeErr != -999) {
1354 if (itH->resYprime != -999.) {
1370 float tgbeta =
tan(itH->localBeta);
1371 if (fabs(tgbeta) != 0) {
1384 histStruct.
ResYvsXProfile->Fill(itH->localXnorm, itH->resY / tgbeta, tgbeta * tgbeta);
1385 histStruct.
ResYvsYProfile->Fill(itH->localYnorm, itH->resY / tgbeta, tgbeta * tgbeta);
1390 if (itH->resYprimeErr != 0 && itH->resYprimeErr != -999.) {
1400 TH1::StatOverflows(kFALSE);
1428 TTree*
tree =
fs->make<TTree>(
"TkOffVal",
"TkOffVal");
1434 tree->Branch(
"TkOffTreeVariables", &treeMemPtr);
1444 treeMemPtr =
nullptr;
1450 std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles) {
1455 for (
int iComp = 0, iCompEnd = ali.
components().size(); iComp < iCompEnd; ++iComp) {
1456 std::vector<TrackerOfflineValidation::SummaryContainer> vProfiles;
1459 LogDebug(
"TrackerOfflineValidation") <<
"StructureName = " << structurename;
1464 if (structurename !=
"Strip" && structurename !=
"Pixel")
1471 TH1* hX = vLevelProfiles[iComp].sumXResiduals_;
1472 TH1* hNormX = vLevelProfiles[iComp].sumNormXResiduals_;
1473 TH1* hY = vLevelProfiles[iComp].sumYResiduals_;
1474 TH1* hNormY = vLevelProfiles[iComp].sumNormYResiduals_;
1475 TH1* pXX = vLevelProfiles[iComp].sumResXvsXProfile_;
1476 TH1* pXY = vLevelProfiles[iComp].sumResXvsYProfile_;
1477 TH1* pYX = vLevelProfiles[iComp].sumResYvsXProfile_;
1478 TH1* pYY = vLevelProfiles[iComp].sumResYvsYProfile_;
1479 for (
uint n = 0;
n < vProfiles.size(); ++
n) {
1499 toFit_.push_back(vLevelProfiles[iComp].sumXResiduals_);
1500 toFit_.push_back(vLevelProfiles[iComp].sumNormXResiduals_);
1504 toFit_.push_back(hNormY);
1516 it->first->Add(
it->second);
1522 for (std::vector<TH1*>::const_iterator
it =
toFit_.begin();
it !=
toFit_.end(); ++
it)
1533 const char* aliTypeName =
alignableTracker_->objectIdProvider().idToString(alitype);
1534 const char* aliSubtypeName =
alignableTracker_->objectIdProvider().idToString(subtype);
1537 const DetId aliDetId = ali.
id();
1547 const uint subcompSize = ali.
components()[0]->components().size();
1549 const TString
title(Form(
"Summary for substructures in %s %d;%s;", aliTypeName,
i, aliSubtypeName));
1551 sumContainer.summaryXResiduals_ = tfd.
make<TH1F>(
1552 Form(
"h_summaryX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x' #GT", aliSize, 0.5, aliSize + 0.5);
1553 sumContainer.summaryNormXResiduals_ = tfd.
make<TH1F>(
1554 Form(
"h_summaryNormX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x'/#sigma #GT", aliSize, 0.5, aliSize + 0.5);
1557 sumContainer.summaryYResiduals_ = tfd.
make<TH1F>(
1558 Form(
"h_summaryY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y' #GT", aliSize, 0.5, aliSize + 0.5);
1559 sumContainer.summaryNormYResiduals_ = tfd.
make<TH1F>(
1560 Form(
"h_summaryNormY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y'/#sigma #GT", aliSize, 0.5, aliSize + 0.5);
1564 if (subcompSize != 2) {
1567 <<
"Det with " << subcompSize <<
" components";
1570 const TString
title(Form(
1571 "Summary for substructures in %s %d;%s;",
1576 sumContainer.summaryXResiduals_ = tfd.
make<TH1F>(
1577 Form(
"h_summaryX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x' #GT", (2 * aliSize), 0.5, 2 * aliSize + 0.5);
1578 sumContainer.summaryNormXResiduals_ = tfd.
make<TH1F>(Form(
"h_summaryNormX%s_%d", aliTypeName,
i),
1579 title +
"#LT #Delta x'/#sigma #GT",
1585 sumContainer.summaryYResiduals_ = tfd.
make<TH1F>(
1586 Form(
"h_summaryY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y' #GT", (2 * aliSize), 0.5, 2 * aliSize + 0.5);
1587 sumContainer.summaryNormYResiduals_ = tfd.
make<TH1F>(Form(
"h_summaryNormY%s_%d", aliTypeName,
i),
1588 title +
"#LT #Delta y'/#sigma #GT",
1596 <<
"@SUB=TrackerOfflineValidation::bookSummaryHists" 1597 <<
"No summary histogram for hierarchy level " << aliTypeName <<
" in subdet " << aliDetId.
subdetId();
1605 const TString sumTitle(Form(
"Residual for %s %d in %s;", aliTypeName,
i,
typeName));
1609 sumContainer.sumXResiduals_ = tfd.
make<TH1F>(Form(
"h_Xprime_%s_%d", aliTypeName,
i),
1616 sumContainer.sumNormXResiduals_ = tfd.
make<TH1F>(Form(
"h_NormXprime_%s_%d", aliTypeName,
i),
1624 sumContainer.sumResXvsXProfile_ = tfd.
make<TProfile>(Form(
"p_resXX_%s_%d", aliTypeName,
i),
1630 sumContainer.sumResXvsXProfile_->Sumw2();
1631 sumContainer.sumResXvsYProfile_ = tfd.
make<TProfile>(Form(
"p_resXY_%s_%d", aliTypeName,
i),
1637 sumContainer.sumResXvsYProfile_->Sumw2();
1642 sumContainer.sumYResiduals_ = tfd.
make<TH1F>(Form(
"h_Yprime_%s_%d", aliTypeName,
i),
1649 sumContainer.sumNormYResiduals_ = tfd.
make<TH1F>(Form(
"h_NormYprime_%s_%d", aliTypeName,
i),
1657 sumContainer.sumResYvsXProfile_ = tfd.
make<TProfile>(Form(
"p_resYX_%s_%d", aliTypeName,
i),
1663 sumContainer.sumResYvsXProfile_->Sumw2();
1664 sumContainer.sumResYvsYProfile_ = tfd.
make<TProfile>(Form(
"p_resYY_%s_%d", aliTypeName,
i),
1670 sumContainer.sumResYvsYProfile_->Sumw2();
1678 for (
uint k = 0;
k < aliSize; ++
k) {
1699 for (
uint k = 0;
k < aliSize; ++
k) {
1700 for (
uint j = 0;
j < subcompSize; ++
j) {
1721 return sumContainer;
1725 float max =
hist->GetMaximum();
1726 int left = -1, right = -1;
1727 for (
unsigned int i = 1, iEnd =
hist->GetNbinsX();
i <= iEnd; ++
i) {
1728 if (
hist->GetBinContent(
i) <
max / 2. &&
hist->GetBinContent(
i + 1) >
max / 2. && left == -1) {
1729 if (
max / 2. -
hist->GetBinContent(
i) <
hist->GetBinContent(
i + 1) -
max / 2.) {
1737 if (left != -1 && right == -1) {
1738 if (
hist->GetBinContent(
i) >
max / 2. &&
hist->GetBinContent(
i + 1) <
max / 2.) {
1739 if (
hist->GetBinContent(
i) -
max / 2. <
max / 2. -
hist->GetBinContent(
i + 1)) {
1747 return hist->GetXaxis()->GetBinCenter(right) -
hist->GetXaxis()->GetBinCenter(left);
1753 for (std::map<int, TrackerOfflineValidation::ModuleHistos>::const_iterator
it = moduleHist_.begin(),
1754 itEnd = moduleHist_.end();
1766 unsigned int whichHalfBarrel(1),
rawId(detId_.
rawId());
1769 whichHalfBarrel = 2;
1771 treeMem.
half = whichHalfBarrel;
1775 unsigned int whichHalfCylinder(1),
rawId(detId_.
rawId());
1778 whichHalfCylinder = 2;
1781 treeMem.
half = whichHalfCylinder;
1786 unsigned int whichHalfShell(1),
rawId(detId_.
rawId());
1798 treeMem.
half = whichHalfShell;
1835 treeMem.
posX = gPModule.
x();
1836 treeMem.
posY = gPModule.
y();
1837 treeMem.
posZ = gPModule.
z();
1842 LocalPoint lUDirection(1., 0., 0.), lVDirection(0., 1., 0.), lWDirection(0., 0., 1.);
1844 gWDirection = surface.
toGlobal(lWDirection);
1845 double dR(999.),
dPhi(999.),
dZ(999.);
1848 dR = gWDirection.perp() - gPModule.
perp();
1850 dZ = gVDirection.z() - gPModule.
z();
1858 dZ = gWDirection.z() - gPModule.
z();
1864 dR = gVDirection.perp() - gPModule.
perp();
1866 dZ = gWDirection.z() - gPModule.
z();
1889 const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_) {
1890 for (std::map<int, TrackerOfflineValidation::ModuleHistos>::const_iterator
it = moduleHist_.begin(),
1891 itEnd = moduleHist_.end();
1897 treeMem.
entries =
static_cast<UInt_t
>(
it->second.ResXprimeHisto->GetEntries());
1898 treeMem.
meanX =
it->second.ResXprimeHisto->GetMean();
1899 treeMem.
rmsX =
it->second.ResXprimeHisto->GetRMS();
1905 std::pair<float, float> fitResult1 = this->
fitResiduals(
it->second.ResXprimeHisto);
1906 treeMem.
fitMeanX = fitResult1.first;
1909 std::pair<float, float> fitResult2 = this->
fitResiduals(
it->second.NormResXprimeHisto);
1921 it->second.ResXprimeHisto->GetBinContent(0) +
it->second.ResXprimeHisto->GetBinContent(
numberOfBins + 1);
1924 treeMem.
meanNormX =
it->second.NormResXprimeHisto->GetMean();
1925 treeMem.
rmsNormX =
it->second.NormResXprimeHisto->GetRMS();
1928 it->second.NormResXprimeHisto->GetStats(
stats);
1934 treeMem.
histNameX =
it->second.ResXprimeHisto->GetName();
1940 treeMem.
rmsLocalX =
it->second.ResHisto->GetRMS();
1946 if (
it->second.ResYHisto)
1952 if (
it->second.ResYprimeHisto) {
1953 TH1*
h =
it->second.ResYprimeHisto;
1954 treeMem.
meanY =
h->GetMean();
1955 treeMem.
rmsY =
h->GetRMS();
1958 std::pair<float, float> fitMeanSigma = this->
fitResiduals(h);
1959 treeMem.
fitMeanY = fitMeanSigma.first;
1960 treeMem.
fitSigmaY = fitMeanSigma.second;
1968 if (
it->second.NormResYprimeHisto) {
1969 TH1*
h =
it->second.NormResYprimeHisto;
1977 std::pair<float, float> fitMeanSigma = this->
fitResiduals(h);
1985 if (
it->second.ResXvsXProfile) {
1986 TH1*
h =
it->second.ResXvsXProfile;
1991 if (
it->second.ResXvsYProfile) {
1992 TH1*
h =
it->second.ResXvsYProfile;
1997 if (
it->second.ResYvsXProfile) {
1998 TH1*
h =
it->second.ResYvsXProfile;
2003 if (
it->second.ResYvsYProfile) {
2004 TH1*
h =
it->second.ResYvsYProfile;
2016 std::pair<float, float> fitResult(9999., 9999.);
2017 if (!
hist ||
hist->GetEntries() < 20)
2021 float sigma =
hist->GetRMS();
2026 TF1
func(
"tmp",
"gaus",
mean - 2. * sigma,
mean + 2. * sigma);
2027 if (0 ==
hist->Fit(&
func,
"QNR")) {
2029 sigma =
func.GetParameter(2);
2034 if (0 ==
hist->Fit(&
func,
"Q0LR")) {
2035 if (
hist->GetFunction(
func.GetName())) {
2036 hist->GetFunction(
func.GetName())->ResetBit(TF1::kNotDraw);
2038 fitResult.first =
func.GetParameter(1);
2039 fitResult.second =
func.GetParameter(2);
2043 edm::LogWarning(
"Alignment") <<
"@SUB=TrackerOfflineValidation::fitResiduals" 2044 <<
"Caught this exception during ROOT fit: " <<
e.what();
2054 double*
x =
new double[
nbins];
2055 double*
y =
new double[
nbins];
2058 y[
j] =
histo->GetBinContent(
j + 1);
const TrackerGeometry * bareTkGeomPtr_
static const std::string kSharedResource
static constexpr auto TEC
bool tibIsDoubleSide(const DetId &id) const
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
bool tecIsDoubleSide(const DetId &id) const
bool tidIsDoubleSide(const DetId &id) const
std::map< int, TrackerOfflineValidation::ModuleHistos > mTidResiduals_
T getParameter(std::string const &) const
unsigned int tobLayer(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
std::vector< TH1 * > vDeleteObjects_
std::vector< TH1 * > vTrackHistos_
moduleLevelHistsTransient
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const unsigned long long maxTracks_
std::vector< unsigned int > tidModuleInfo(const DetId &id) const
TH1 * make(const char *name, const char *title, int nBinX, double minBinX, double maxBinX)
Float_t numberOfOverflows
unsigned int pxfBlade(const DetId &id) const
bool isPixel(uint32_t subDetId)
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
std::vector< TH1 * > vTrack2DHistos_
TH1 * bookTH1F(bool isTransient, DirectoryWrapper &tfd, const char *histName, const char *histTitle, int nBinsX, double lowX, double highX)
std::unique_ptr< AlignableTracker > alignableTracker_
uint32_t tidStereo(const DetId &id) const
unsigned int tibModule(const DetId &id) const
unsigned int tidSide(const DetId &id) const
std::string directoryString
container to hold data to be written into TTree
Geom::Phi< T > phi() const
std::string profileNameResXvsX
void fillTree(TTree &tree, TkOffTreeVariables &treeMem, const std::map< int, TrackerOfflineValidation::ModuleHistos > &moduleHist_)
unsigned int pxfModule(const DetId &id) const
std::vector< unsigned int > tecPetalInfo(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
constexpr unsigned int subDetId[21]
const bool stripYResiduals_
const bool useOverflowForRMS_
edm::ESHandle< TrackerGeometry > tkGeom_
unsigned int pxbLadder(const DetId &id) const
Log< level::Error, false > LogError
ModuleHistos & getHistStructFromMap(const DetId &detid)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
const bool moduleLevelProfiles_
Float_t numberOfUnderflows
void setSummaryBin(int bin, TH1 *targetHist, TH1 *sourceHist)
const int compressionSettings_
TrackerOfflineValidation::SummaryContainer bookSummaryHists(DirectoryWrapper &tfd, const Alignable &ali, align::StructureType type, int i)
unsigned int tecRing(const DetId &id) const
ring id
bool tobIsDoubleSide(const DetId &id) const
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
std::map< int, TrackerOfflineValidation::ModuleHistos > mTobResiduals_
TProfile * ResXvsYProfile
TH1 * summaryNormYResiduals_
std::string profileNameResYvsX
TProfile * ResYvsYProfile
unsigned int tecModule(const DetId &id) const
T const * product() const
std::map< int, TrackerOfflineValidation::ModuleHistos > mPxeResiduals_
uint32_t tobStereo(const DetId &id) const
TH1 * summaryNormXResiduals_
std::string histNameNormX
std::map< int, TkOffTreeVariables > mTreeMembers_
void setUpTreeMembers(const std::map< int, TrackerOfflineValidation::ModuleHistos > &moduleHist_, const TrackerGeometry &tkgeom, const TrackerTopology *tTopo)
unsigned int tecSide(const DetId &id) const
unsigned long long nTracks_
float Fwhm(const TH1 *hist) const
float getMedian(const TH1 *hist) const
std::vector< std::pair< TH1 *, TH1 * > > sumHistStructure_
unsigned int pxfDisk(const DetId &id) const
Tan< T >::type tan(const T &t)
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
void getBinning(uint32_t subDetId, TrackerOfflineValidation::HistogramType residualtype, int &nBinsX, double &lowerBoundX, double &upperBoundX)
virtual void checkBookHists(const edm::EventSetup &setup)
TProfile * bookTProfile(bool isTransient, DirectoryWrapper &tfd, const char *histName, const char *histTitle, int nBinsX, double lowX, double highX)
static void fillPSetDescription(edm::ParameterSetDescription &descriptions)
#define DEFINE_FWK_MODULE(type)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
static constexpr auto TOB
void prepareSummaryHists(DirectoryWrapper &tfd, const Alignable &ali, std::vector< TrackerOfflineValidation::SummaryContainer > &vLevelProfiles)
virtual const Alignables & components() const =0
Return vector of all direct components.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::string histNameLocalY
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const TrackerGeomDet * idToDet(DetId) const override
std::string histNameNormLocalX
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool isDetOrDetUnit(align::StructureType type)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
unsigned int pxfPanel(const DetId &id) const
Log< level::Info, false > LogInfo
DirectoryWrapper(const std::string &newDir, const std::string &basedir, bool useDqmMode)
std::map< int, TrackerOfflineValidation::ModuleHistos > mTecResiduals_
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
unsigned int pxfSide(const DetId &id) const
std::vector< std::tuple< int, TH1 *, TH1 * > > summaryBins_
std::vector< unsigned int > tibStringInfo(const DetId &id) const
static constexpr auto TIB
const Plane & surface() const
The nominal surface of the GeomDet.
void fillTrackQuantities(const edm::Event &, const edm::EventSetup &, std::vector< AVTrackStruct > &v_avtrackout)
const std::string moduleDirectory_
void collateSummaryHists()
std::unique_ptr< TFileDirectory > tfd
std::map< int, TrackerOfflineValidation::ModuleHistos > mTibResiduals_
constexpr uint32_t rawId() const
get the raw id
int GetIndex(const std::vector< OBJECT_TYPE *> &vec, const TString &name)
std::string histNameLocalX
void summarizeBinInContainer(int bin, SummaryContainer &targetContainer, SummaryContainer &sourceContainer)
const bool moduleLevelHistsTransient_
bool isEndCap(uint32_t subDetId)
const Surface::PositionType & position() const
The position (origin of the R.F.)
std::string profileNameResXvsY
std::vector< TH1 * > toFit_
std::vector< unsigned int > tobRodInfo(const DetId &id) const
void bookGlobalHists(DirectoryWrapper &tfd)
DirectoryWrapper(const DirectoryWrapper &upDir, const std::string &newDir, const std::string &basedir, bool useDqmMode)
TrackerValidationVariables avalidator_
std::pair< int, int > typeAndLayerFromDetId(const DetId &detId, const TrackerTopology *tTopo) const
~TrackerOfflineValidation() override
TProfile * ResXvsXProfile
std::vector< TH1 * > vTrackProfiles_
unsigned int tidRing(const DetId &id) const
void bookDirHists(DirectoryWrapper &tfd, const Alignable &ali, const TrackerTopology *tTopo)
uint32_t tecStereo(const DetId &id) const
unsigned int tibLayer(const DetId &id) const
unsigned int tobModule(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
Log< level::Warning, false > LogWarning
std::string histNameNormY
std::pair< float, float > fitResiduals(TH1 *hist) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const edm::ParameterSet parSet_
TrackerOfflineValidation(const edm::ParameterSet &)
static constexpr auto TID
const DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.
dqm::legacy::DQMStore DQMStore
std::map< int, TrackerOfflineValidation::ModuleHistos > mPxbResiduals_
TProfile * ResYvsXProfile
uint32_t tibStereo(const DetId &id) const
void analyze(const edm::Event &, const edm::EventSetup &) override
std::string profileNameResYvsY
void bookHists(DirectoryWrapper &tfd, const Alignable &ali, const TrackerTopology *tTopo, align::StructureType type, int i)
bool isBarrel(uint32_t subDetId)