172 if (newDir.length() != 0) {
181 if (newDir.length() == 0)
184 tfd = std::make_unique<TFileDirectory>(upDir.
tfd->mkdir(newDir));
194 if (newDir.length() == 0) {
195 tfd = std::make_unique<TFileDirectory>(
fs->tFileDirectory());
197 tfd = std::make_unique<TFileDirectory>(
fs->mkdir(newDir));
201 if (newDir.length() != 0) {
212 template <
typename T>
213 TH1*
make(
const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX);
214 template <
typename T>
216 template <
typename T>
225 template <
typename T>
234 std::unique_ptr<TFileDirectory>
tfd;
255 std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles);
258 void setUpTreeMembers(
const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_,
263 const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_);
279 const char* histName,
287 const char* histName,
295 const char* histName,
307 double& upperBoundX);
323 template <
class OBJECT_TYPE>
324 int GetIndex(
const std::vector<OBJECT_TYPE*>& vec,
const TString&
name);
390 template <
class OBJECT_TYPE>
393 for (
typename std::vector<OBJECT_TYPE*>::const_iterator iter = vec.begin(), iterEnd = vec.end(); iter != iterEnd;
395 if (*iter && (*iter)->GetName() ==
name)
398 edm::LogError(
"Alignment") <<
"@SUB=TrackerOfflineValidation::GetIndex" 399 <<
" could not find " <<
name;
404 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TH1F>(
405 const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX) {
407 theDbe->setCurrentFolder(directoryString);
408 return theDbe->book1D(
name,
title,
nBinX, minBinX, maxBinX)->getTH1();
415 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
const char*
name,
420 theDbe->setCurrentFolder(directoryString);
423 tmpProfile->SetDirectory(
nullptr);
424 return theDbe->bookProfile(
name, tmpProfile)->getTH1();
431 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
432 const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX) {
434 theDbe->setCurrentFolder(directoryString);
436 TProfile* tmpProfile =
new TProfile(
name,
title,
nBinX, minBinX, maxBinX);
437 tmpProfile->SetDirectory(
nullptr);
438 return theDbe->bookProfile(
name, tmpProfile)->getTH1();
445 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
448 theDbe->setCurrentFolder(directoryString);
457 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TH2F>(
const char*
name,
466 theDbe->setCurrentFolder(directoryString);
467 return theDbe->book2D(
name,
title,
nBinX, minBinX, maxBinX,
nBinY, minBinY, maxBinY)->getTH1();
480 bareTkGeomPtr_(nullptr),
481 compressionSettings_(parSet_.getUntrackedParameter<
int>(
"compressionSettings", -1)),
482 lCoorHistOn_(parSet_.getParameter<
bool>(
"localCoorHistosOn")),
483 moduleLevelHistsTransient_(parSet_.getParameter<
bool>(
"moduleLevelHistsTransient")),
484 moduleLevelProfiles_(parSet_.getParameter<
bool>(
"moduleLevelProfiles")),
485 stripYResiduals_(parSet_.getParameter<
bool>(
"stripYResiduals")),
486 useFwhm_(parSet_.getParameter<
bool>(
"useFwhm")),
487 useFit_(parSet_.getParameter<
bool>(
"useFit")),
488 useOverflowForRMS_(parSet_.getParameter<
bool>(
"useOverflowForRMS")),
489 dqmMode_(parSet_.getParameter<
bool>(
"useInDqmMode")),
490 moduleDirectory_(parSet_.getParameter<
std::
string>(
"moduleDirectoryInOutput")),
491 chargeCut_(parSet_.getParameter<
int>(
"chargeCut")),
493 maxTracks_(parSet_.getParameter<unsigned long long>(
"maxTracks")),
494 maxEntriesPerModuleForDmr_(parSet_.getParameter<unsigned
int>(
"maxEntriesPerModuleForDmr")),
495 avalidator_(iConfig, consumesCollector()) {
501 desc.setComment(
"Validates alignment payloads by evaluating unbiased track-hit resisuals");
503 desc.addUntracked<
int>(
"compressionSettings", -1);
504 desc.add<
bool>(
"localCoorHistosOn",
false);
505 desc.add<
bool>(
"moduleLevelHistsTransient",
false);
506 desc.add<
bool>(
"moduleLevelProfiles",
false);
507 desc.add<
bool>(
"stripYResiduals",
false);
508 desc.add<
bool>(
"useFwhm",
true);
509 desc.add<
bool>(
"useFit",
false);
510 desc.add<
bool>(
"useOverflowForRMS",
false);
511 desc.add<
bool>(
"useInDqmMode",
false);
513 desc.add<
int>(
"chargeCut", 0);
514 desc.add<
unsigned long long>(
"maxTracks", 0);
515 desc.add<
unsigned int>(
"maxEntriesPerModuleForDmr", 0);
518 std::vector<std::string> listOfResidualsPSets = {
"TH1XResPixelModules",
519 "TH1XResStripModules",
520 "TH1NormXResPixelModules",
521 "TH1NormXResStripModules",
522 "TH1XprimeResPixelModules",
523 "TH1XprimeResStripModules",
524 "TH1NormXprimeResPixelModules",
525 "TH1NormXprimeResStripModules",
526 "TH1YResPixelModules",
527 "TH1YResStripModules",
528 "TH1NormYResPixelModules",
529 "TH1NormYResStripModules",
530 "TProfileXResPixelModules",
531 "TProfileXResStripModules",
532 "TProfileYResPixelModules",
533 "TProfileYResStripModules"};
535 for (
const auto& myPSetName : listOfResidualsPSets) {
537 myPSet.
add<
int>(
"Nbinx", 100);
538 myPSet.
add<
double>(
"xmin", -5.f);
539 myPSet.
add<
double>(
"xmax", 5.f);
573 <<
"There are " << newBareTkGeomPtr->
detIds().size() <<
" dets in the Geometry record.\n" 574 <<
"Out of these " << newBareTkGeomPtr->
detUnitIds().size() <<
" are detUnits";
585 std::vector<TrackerOfflineValidation::SummaryContainer> vTrackerprofiles;
596 <<
"TrackerGeometry changed, but will not re-book hists!";
602 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_tracketa",
"Track #eta;#eta_{Track};Number of Tracks", 90, -3., 3.));
603 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_trackphi",
"Track #phi;#phi_{Track};Number of Tracks", 90, -3.15, 3.15));
605 "h_trackNumberOfValidHits",
"Track # of valid hits;# of valid hits _{Track};Number of Tracks", 40, 0., 40.));
607 "h_trackNumberOfLostHits",
"Track # of lost hits;# of lost hits _{Track};Number of Tracks", 10, 0., 10.));
609 tfd.
make<TH1F>(
"h_curvature",
"Curvature #kappa;#kappa_{Track};Number of Tracks", 100, -.05, .05));
611 "h_curvature_pos",
"Curvature |#kappa| Positive Tracks;|#kappa_{pos Track}|;Number of Tracks", 100, .0, .05));
613 "h_curvature_neg",
"Curvature |#kappa| Negative Tracks;|#kappa_{neg Track}|;Number of Tracks", 100, .0, .05));
615 tfd.
make<TH1F>(
"h_diff_curvature",
616 "Curvature |#kappa| Tracks Difference;|#kappa_{Track}|;# Pos Tracks - # Neg Tracks",
620 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_chi2",
"#chi^{2};#chi^{2}_{Track};Number of Tracks", 500, -0.01, 500.));
622 tfd.
make<TH1F>(
"h_chi2Prob",
"#chi^{2} probability;#chi^{2}prob_{Track};Number of Tracks", 100, 0.0, 1.));
624 tfd.
make<TH1F>(
"h_normchi2",
"#chi^{2}/ndof;#chi^{2}/ndof;Number of Tracks", 100, -0.01, 10.));
625 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_pt",
"p_{T}^{track};p_{T}^{track} [GeV];Number of Tracks", 250, 0., 250));
627 "h_ptResolution",
"#delta_{p_{T}}/p_{T}^{track};#delta_{p_{T}}/p_{T}^{track};Number of Tracks", 100, 0., 0.5));
629 "p_d0_vs_phi",
"Transverse Impact Parameter vs. #phi;#phi_{Track};#LT d_{0} #GT [cm]", 100, -3.15, 3.15));
631 "p_dz_vs_phi",
"Longitudinal Impact Parameter vs. #phi;#phi_{Track};#LT d_{z} #GT [cm]", 100, -3.15, 3.15));
633 "p_d0_vs_eta",
"Transverse Impact Parameter vs. #eta;#eta_{Track};#LT d_{0} #GT [cm]", 100, -3.15, 3.15));
635 "p_dz_vs_eta",
"Longitudinal Impact Parameter vs. #eta;#eta_{Track};#LT d_{z} #GT [cm]", 100, -3.15, 3.15));
637 tfd.
make<TProfile>(
"p_chi2_vs_phi",
"#chi^{2} vs. #phi;#phi_{Track};#LT #chi^{2} #GT", 100, -3.15, 3.15));
639 "p_chi2Prob_vs_phi",
"#chi^{2} probablility vs. #phi;#phi_{Track};#LT #chi^{2} probability#GT", 100, -3.15, 3.15));
641 "p_chi2Prob_vs_d0",
"#chi^{2} probablility vs. |d_{0}|;|d_{0}|[cm];#LT #chi^{2} probability#GT", 100, 0, 80));
643 "p_normchi2_vs_phi",
"#chi^{2}/ndof vs. #phi;#phi_{Track};#LT #chi^{2}/ndof #GT", 100, -3.15, 3.15));
645 tfd.
make<TProfile>(
"p_chi2_vs_eta",
"#chi^{2} vs. #eta;#eta_{Track};#LT #chi^{2} #GT", 100, -3.15, 3.15));
647 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.};
649 "p_normchi2_vs_pt",
"norm #chi^{2} vs. p_{T}_{Track}; p_{T}_{Track};#LT #chi^{2}/ndof #GT", 18,
xBins));
652 tfd.
make<TProfile>(
"p_normchi2_vs_p",
"#chi^{2}/ndof vs. p_{Track};p_{Track};#LT #chi^{2}/ndof #GT", 18,
xBins));
654 "p_chi2Prob_vs_eta",
"#chi^{2} probability vs. #eta;#eta_{Track};#LT #chi^{2} probability #GT", 100, -3.15, 3.15));
656 "p_normchi2_vs_eta",
"#chi^{2}/ndof vs. #eta;#eta_{Track};#LT #chi^{2}/ndof #GT", 100, -3.15, 3.15));
658 tfd.
make<TProfile>(
"p_kappa_vs_phi",
"#kappa vs. #phi;#phi_{Track};#kappa", 100, -3.15, 3.15));
660 tfd.
make<TProfile>(
"p_kappa_vs_eta",
"#kappa vs. #eta;#eta_{Track};#kappa", 100, -3.15, 3.15));
662 "#delta_{p_{T}}/p_{T}^{track};#phi^{track};#delta_{p_{T}}/p_{T}^{track}",
667 "#delta_{p_{T}}/p_{T}^{track};#eta^{track};#delta_{p_{T}}/p_{T}^{track}",
673 "h2_d0_vs_phi",
"Transverse Impact Parameter vs. #phi;#phi_{Track};d_{0} [cm]", 100, -3.15, 3.15, 100, -1., 1.));
675 "Longitudinal Impact Parameter vs. #phi;#phi_{Track};d_{z} [cm]",
683 "h2_d0_vs_eta",
"Transverse Impact Parameter vs. #eta;#eta_{Track};d_{0} [cm]", 100, -3.15, 3.15, 100, -1., 1.));
685 "Longitudinal Impact Parameter vs. #eta;#eta_{Track};d_{z} [cm]",
693 tfd.
make<TH2F>(
"h2_chi2_vs_phi",
"#chi^{2} vs. #phi;#phi_{Track};#chi^{2}", 100, -3.15, 3.15, 500, 0., 500.));
695 "#chi^{2} probability vs. #phi;#phi_{Track};#chi^{2} probability",
703 "#chi^{2} probability vs. |d_{0}|;|d_{0}| [cm];#chi^{2} probability",
711 "h2_normchi2_vs_phi",
"#chi^{2}/ndof vs. #phi;#phi_{Track};#chi^{2}/ndof", 100, -3.15, 3.15, 100, 0., 10.));
713 tfd.
make<TH2F>(
"h2_chi2_vs_eta",
"#chi^{2} vs. #eta;#eta_{Track};#chi^{2}", 100, -3.15, 3.15, 500, 0., 500.));
715 "#chi^{2} probaility vs. #eta;#eta_{Track};#chi^{2} probability",
723 "h2_normchi2_vs_eta",
"#chi^{2}/ndof vs. #eta;#eta_{Track};#chi^{2}/ndof", 100, -3.15, 3.15, 100, 0., 10.));
725 tfd.
make<TH2F>(
"h2_kappa_vs_phi",
"#kappa vs. #phi;#phi_{Track};#kappa", 100, -3.15, 3.15, 100, .0, .05));
727 tfd.
make<TH2F>(
"h2_kappa_vs_eta",
"#kappa vs. #eta;#eta_{Track};#kappa", 100, -3.15, 3.15, 100, .0, .05));
729 "h2_normchi2_vs_kappa",
"#kappa vs. #chi^{2}/ndof;#chi^{2}/ndof;#kappa", 100, 0., 10, 100, -.03, .03));
733 "p_vs_resXprime_pixB",
"res_{x'} vs momentum in BPix;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
735 "p_vs_resXprime_pixE",
"res_{x'} vs momentum in FPix;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
737 "p_vs_resXprime_TIB",
"res_{x'} vs momentum in TIB;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
739 "p_vs_resXprime_TID",
"res_{x'} vs momentum in TID;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
741 "p_vs_resXprime_TOB",
"res_{x'} vs momentum in TOB;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
743 "p_vs_resXprime_TEC",
"res_{x'} vs momentum in TEC;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
747 "p_vs_resYprime_pixB",
"res_{y'} vs momentum in BPix;p [GeV]; res_{y'}", 15, 0., 15., 200, -0.1, 0.1));
749 "p_vs_resYprime_pixE",
"res_{y'} vs momentum in FPix;p [GeV]; res_{y'}", 15, 0., 15., 200, -0.1, 0.1));
754 for (
int i = 0, iEnd = ali.
components().size();
i < iEnd; ++
i) {
756 LogDebug(
"TrackerOfflineValidation") <<
"StructureName = " << structurename;
760 if (structurename !=
"Strip" && structurename !=
"Pixel")
763 if (structurename.find(
"Endcap", 0) != std::string::npos) {
796 std::stringstream histoname, histotitle, normhistoname, normhistotitle, yhistoname, yhistotitle, xprimehistoname,
797 xprimehistotitle, normxprimehistoname, normxprimehistotitle, yprimehistoname, yprimehistotitle,
798 normyprimehistoname, normyprimehistotitle, localxname, localxtitle, localyname, localytitle, resxvsxprofilename,
799 resxvsxprofiletitle, resyvsxprofilename, resyvsxprofiletitle, resxvsyprofilename, resxvsyprofiletitle,
800 resyvsyprofilename, resyvsyprofiletitle;
804 if (this->
isEndCap(static_cast<uint32_t>(subdetandlayer.first)))
805 wheel_or_layer =
"_wheel_";
806 else if (this->
isBarrel(static_cast<uint32_t>(subdetandlayer.first)))
807 wheel_or_layer =
"_layer_";
809 edm::LogWarning(
"TrackerOfflineValidation") <<
"@SUB=TrackerOfflineValidation::bookHists" 810 <<
"Unknown subdetid: " << subdetandlayer.first;
812 histoname <<
"h_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_" 814 yhistoname <<
"h_y_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_" 816 xprimehistoname <<
"h_xprime_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
817 <<
"_module_" <<
id.rawId();
818 yprimehistoname <<
"h_yprime_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
819 <<
"_module_" <<
id.rawId();
820 normhistoname <<
"h_normresiduals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
821 <<
"_module_" <<
id.rawId();
822 normxprimehistoname <<
"h_normxprimeresiduals_subdet_" << subdetandlayer.first << wheel_or_layer
823 << subdetandlayer.second <<
"_module_" <<
id.rawId();
824 normyprimehistoname <<
"h_normyprimeresiduals_subdet_" << subdetandlayer.first << wheel_or_layer
825 << subdetandlayer.second <<
"_module_" <<
id.rawId();
826 histotitle <<
"X Residual for module " <<
id.rawId() <<
";x_{tr} - x_{hit} [cm]";
827 yhistotitle <<
"Y Residual for module " <<
id.rawId() <<
";y_{tr} - y_{hit} [cm]";
828 normhistotitle <<
"Normalized Residual for module " <<
id.rawId() <<
";x_{tr} - x_{hit}/#sigma";
829 xprimehistotitle <<
"X' Residual for module " <<
id.rawId() <<
";(x_{tr} - x_{hit})' [cm]";
830 normxprimehistotitle <<
"Normalized X' Residual for module " <<
id.rawId() <<
";(x_{tr} - x_{hit})'/#sigma";
831 yprimehistotitle <<
"Y' Residual for module " <<
id.rawId() <<
";(y_{tr} - y_{hit})' [cm]";
832 normyprimehistotitle <<
"Normalized Y' Residual for module " <<
id.rawId() <<
";(y_{tr} - y_{hit})'/#sigma";
835 localxname <<
"h_localx_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_" 837 localyname <<
"h_localy_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_" 839 localxtitle <<
"u local for module " <<
id.rawId() <<
"; u_{tr,r}";
840 localytitle <<
"v local for module " <<
id.rawId() <<
"; v_{tr,r}";
842 resxvsxprofilename <<
"p_residuals_x_vs_x_subdet_" << subdetandlayer.first << wheel_or_layer
843 << subdetandlayer.second <<
"_module_" <<
id.rawId();
844 resyvsxprofilename <<
"p_residuals_y_vs_x_subdet_" << subdetandlayer.first << wheel_or_layer
845 << subdetandlayer.second <<
"_module_" <<
id.rawId();
846 resxvsyprofilename <<
"p_residuals_x_vs_y_subdet_" << subdetandlayer.first << wheel_or_layer
847 << subdetandlayer.second <<
"_module_" <<
id.rawId();
848 resyvsyprofilename <<
"p_residuals_y_vs_y_subdet_" << subdetandlayer.first << wheel_or_layer
849 << subdetandlayer.second <<
"_module_" <<
id.rawId();
850 resxvsxprofiletitle <<
"U Residual vs u for module " <<
id.rawId()
851 <<
"; u_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
852 resyvsxprofiletitle <<
"V Residual vs u for module " <<
id.rawId()
853 <<
"; u_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
854 resxvsyprofiletitle <<
"U Residual vs v for module " <<
id.rawId()
855 <<
"; v_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
856 resyvsyprofiletitle <<
"V Residual vs v for module " <<
id.rawId()
857 <<
"; v_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
869 moduleLevelHistsTransient =
false;
875 moduleLevelHistsTransient, tfd, histoname.str().c_str(), histotitle.str().c_str(),
nbins,
xmin,
xmax);
878 moduleLevelHistsTransient, tfd, normhistoname.str().c_str(), normhistotitle.str().c_str(),
nbins,
xmin,
xmax);
883 xprimehistoname.str().c_str(),
884 xprimehistotitle.str().c_str(),
891 normxprimehistoname.str().c_str(),
892 normxprimehistotitle.str().c_str(),
901 moduleLevelHistsTransient, tfd, localxname.str().c_str(), localxtitle.str().c_str(),
nbins,
xmin,
xmax);
903 moduleLevelHistsTransient, tfd, localyname.str().c_str(), localytitle.str().c_str(),
nbins,
xmin,
xmax);
906 resxvsxprofilename.str().c_str(),
907 resxvsxprofiletitle.str().c_str(),
916 resxvsyprofilename.str().c_str(),
917 resxvsyprofiletitle.str().c_str(),
930 yprimehistoname.str().c_str(),
931 yprimehistotitle.str().c_str(),
938 moduleLevelHistsTransient, tfd, yhistoname.str().c_str(), yhistotitle.str().c_str(),
nbins,
xmin,
xmax);
943 normyprimehistoname.str().c_str(),
944 normyprimehistotitle.str().c_str(),
954 resyvsxprofilename.str().c_str(),
955 resyvsxprofiletitle.str().c_str(),
964 resyvsyprofilename.str().c_str(),
965 resyvsyprofiletitle.str().c_str(),
979 const char* histName,
988 return tfd.
make<TH1F>(histName,
histTitle, nBinsX, lowX, highX);
993 const char* histName,
1003 return (TProfile*)tfd.
make<TProfile>(histName,
histTitle, nBinsX, lowX, highX);
1008 const char* histName,
1016 TProfile*
profile =
new TProfile(histName,
histTitle, nBinsX, lowX, highX, lowY, highY);
1020 return (TProfile*)tfd.
make<TProfile>(histName,
histTitle, nBinsX, lowX, highX, lowY, highY);
1044 double& lowerBoundX,
1045 double& upperBoundX) {
1104 lowerBoundX = binningPSet.
getParameter<
double>(
"xmin");
1105 upperBoundX = binningPSet.
getParameter<
double>(
"xmax");
1109 if (targetHist && sourceHist) {
1110 targetHist->SetBinContent(
bin, sourceHist->GetMean(1));
1112 targetHist->SetBinError(
bin,
Fwhm(sourceHist) / 2.);
1114 targetHist->SetBinError(
bin, sourceHist->GetRMS(1));
1161 <<
"[TrackerOfflineValidation] Error, tried to get reference for non-tracker subdet " << subdetid
1162 <<
" from detector " <<
detid.det();
1174 TH1::StatOverflows(kTRUE);
1177 std::vector<TrackerValidationVariables::AVTrackStruct> vTrackstruct;
1180 for (std::vector<TrackerValidationVariables::AVTrackStruct>::const_iterator itT = vTrackstruct.begin();
1181 itT != vTrackstruct.end();
1194 vTrackHistos_[numOfValidHitsindex]->Fill(itT->numberOfValidHits);
1196 vTrackHistos_[numOfLostHitsindex]->Fill(itT->numberOfLostHits);
1200 if (itT->charge > 0)
1203 if (itT->charge < 0)
1213 if (itT->ptError != 0.) {
1215 vTrackHistos_[ptResolutionindex]->Fill(itT->ptError / itT->pt);
1231 vTrackProfiles_[chiProbabsd0index]->Fill(fabs(itT->d0), itT->chi2Prob);
1249 vTrackProfiles_[ptResphiindex]->Fill(itT->phi, itT->ptError / itT->pt);
1251 vTrackProfiles_[ptResetaindex]->Fill(itT->eta, itT->ptError / itT->pt);
1267 vTrack2DHistos_[chiProbabsd0index_2d]->Fill(fabs(itT->d0), itT->chi2Prob);
1284 for (std::vector<TrackerValidationVariables::AVHitStruct>::const_iterator itH = itT->hits.begin();
1285 itH != itT->hits.end();
1292 histStruct.
ResHisto->Fill(itH->resX);
1293 if (itH->resErrX != 0)
1294 histStruct.
NormResHisto->Fill(itH->resX / itH->resErrX);
1300 if (itH->resXprime != -999.) {
1331 float tgalpha =
tan(itH->localAlpha);
1335 if (fabs(tgalpha) != 0) {
1336 histStruct.
LocalX->Fill(itH->localXnorm, tgalpha * tgalpha);
1337 histStruct.
LocalY->Fill(itH->localYnorm, tgalpha * tgalpha);
1349 histStruct.
ResXvsXProfile->Fill(itH->localXnorm, itH->resXatTrkY / tgalpha, tgalpha * tgalpha);
1350 histStruct.
ResXvsYProfile->Fill(itH->localYnorm, itH->resXatTrkY / tgalpha, tgalpha * tgalpha);
1356 if (itH->resXprimeErr != 0 && itH->resXprimeErr != -999) {
1361 if (itH->resYprime != -999.) {
1377 float tgbeta =
tan(itH->localBeta);
1378 if (fabs(tgbeta) != 0) {
1391 histStruct.
ResYvsXProfile->Fill(itH->localXnorm, itH->resY / tgbeta, tgbeta * tgbeta);
1392 histStruct.
ResYvsYProfile->Fill(itH->localYnorm, itH->resY / tgbeta, tgbeta * tgbeta);
1397 if (itH->resYprimeErr != 0 && itH->resYprimeErr != -999.) {
1407 TH1::StatOverflows(kFALSE);
1435 TTree*
tree =
fs->make<TTree>(
"TkOffVal",
"TkOffVal");
1441 tree->Branch(
"TkOffTreeVariables", &treeMemPtr);
1451 treeMemPtr =
nullptr;
1457 std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles) {
1462 for (
int iComp = 0, iCompEnd = ali.
components().size(); iComp < iCompEnd; ++iComp) {
1463 std::vector<TrackerOfflineValidation::SummaryContainer> vProfiles;
1466 LogDebug(
"TrackerOfflineValidation") <<
"StructureName = " << structurename;
1471 if (structurename !=
"Strip" && structurename !=
"Pixel")
1478 TH1* hX = vLevelProfiles[iComp].sumXResiduals_;
1479 TH1* hNormX = vLevelProfiles[iComp].sumNormXResiduals_;
1480 TH1* hY = vLevelProfiles[iComp].sumYResiduals_;
1481 TH1* hNormY = vLevelProfiles[iComp].sumNormYResiduals_;
1482 TH1* pXX = vLevelProfiles[iComp].sumResXvsXProfile_;
1483 TH1* pXY = vLevelProfiles[iComp].sumResXvsYProfile_;
1484 TH1* pYX = vLevelProfiles[iComp].sumResYvsXProfile_;
1485 TH1* pYY = vLevelProfiles[iComp].sumResYvsYProfile_;
1486 for (
uint n = 0;
n < vProfiles.size(); ++
n) {
1506 toFit_.push_back(vLevelProfiles[iComp].sumXResiduals_);
1507 toFit_.push_back(vLevelProfiles[iComp].sumNormXResiduals_);
1511 toFit_.push_back(hNormY);
1523 it->first->Add(
it->second);
1529 for (std::vector<TH1*>::const_iterator
it =
toFit_.begin();
it !=
toFit_.end(); ++
it)
1540 const char* aliTypeName =
alignableTracker_->objectIdProvider().idToString(alitype);
1541 const char* aliSubtypeName =
alignableTracker_->objectIdProvider().idToString(subtype);
1544 const DetId aliDetId = ali.
id();
1554 const uint subcompSize = ali.
components()[0]->components().size();
1556 const TString
title(Form(
"Summary for substructures in %s %d;%s;", aliTypeName,
i, aliSubtypeName));
1558 sumContainer.summaryXResiduals_ = tfd.
make<TH1F>(
1559 Form(
"h_summaryX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x' #GT", aliSize, 0.5, aliSize + 0.5);
1560 sumContainer.summaryNormXResiduals_ = tfd.
make<TH1F>(
1561 Form(
"h_summaryNormX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x'/#sigma #GT", aliSize, 0.5, aliSize + 0.5);
1564 sumContainer.summaryYResiduals_ = tfd.
make<TH1F>(
1565 Form(
"h_summaryY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y' #GT", aliSize, 0.5, aliSize + 0.5);
1566 sumContainer.summaryNormYResiduals_ = tfd.
make<TH1F>(
1567 Form(
"h_summaryNormY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y'/#sigma #GT", aliSize, 0.5, aliSize + 0.5);
1571 if (subcompSize != 2) {
1574 <<
"Det with " << subcompSize <<
" components";
1577 const TString
title(Form(
1578 "Summary for substructures in %s %d;%s;",
1583 sumContainer.summaryXResiduals_ = tfd.
make<TH1F>(
1584 Form(
"h_summaryX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x' #GT", (2 * aliSize), 0.5, 2 * aliSize + 0.5);
1585 sumContainer.summaryNormXResiduals_ = tfd.
make<TH1F>(Form(
"h_summaryNormX%s_%d", aliTypeName,
i),
1586 title +
"#LT #Delta x'/#sigma #GT",
1592 sumContainer.summaryYResiduals_ = tfd.
make<TH1F>(
1593 Form(
"h_summaryY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y' #GT", (2 * aliSize), 0.5, 2 * aliSize + 0.5);
1594 sumContainer.summaryNormYResiduals_ = tfd.
make<TH1F>(Form(
"h_summaryNormY%s_%d", aliTypeName,
i),
1595 title +
"#LT #Delta y'/#sigma #GT",
1603 <<
"@SUB=TrackerOfflineValidation::bookSummaryHists" 1604 <<
"No summary histogram for hierarchy level " << aliTypeName <<
" in subdet " << aliDetId.
subdetId();
1612 const TString sumTitle(Form(
"Residual for %s %d in %s;", aliTypeName,
i,
typeName));
1616 sumContainer.sumXResiduals_ = tfd.
make<TH1F>(Form(
"h_Xprime_%s_%d", aliTypeName,
i),
1623 sumContainer.sumNormXResiduals_ = tfd.
make<TH1F>(Form(
"h_NormXprime_%s_%d", aliTypeName,
i),
1631 sumContainer.sumResXvsXProfile_ = tfd.
make<TProfile>(Form(
"p_resXX_%s_%d", aliTypeName,
i),
1637 sumContainer.sumResXvsXProfile_->Sumw2();
1638 sumContainer.sumResXvsYProfile_ = tfd.
make<TProfile>(Form(
"p_resXY_%s_%d", aliTypeName,
i),
1644 sumContainer.sumResXvsYProfile_->Sumw2();
1649 sumContainer.sumYResiduals_ = tfd.
make<TH1F>(Form(
"h_Yprime_%s_%d", aliTypeName,
i),
1656 sumContainer.sumNormYResiduals_ = tfd.
make<TH1F>(Form(
"h_NormYprime_%s_%d", aliTypeName,
i),
1664 sumContainer.sumResYvsXProfile_ = tfd.
make<TProfile>(Form(
"p_resYX_%s_%d", aliTypeName,
i),
1670 sumContainer.sumResYvsXProfile_->Sumw2();
1671 sumContainer.sumResYvsYProfile_ = tfd.
make<TProfile>(Form(
"p_resYY_%s_%d", aliTypeName,
i),
1677 sumContainer.sumResYvsYProfile_->Sumw2();
1685 for (
uint k = 0;
k < aliSize; ++
k) {
1706 for (
uint k = 0;
k < aliSize; ++
k) {
1707 for (
uint j = 0;
j < subcompSize; ++
j) {
1728 return sumContainer;
1732 float max =
hist->GetMaximum();
1733 int left = -1, right = -1;
1734 for (
unsigned int i = 1, iEnd =
hist->GetNbinsX();
i <= iEnd; ++
i) {
1735 if (
hist->GetBinContent(
i) <
max / 2. &&
hist->GetBinContent(
i + 1) >
max / 2. && left == -1) {
1736 if (
max / 2. -
hist->GetBinContent(
i) <
hist->GetBinContent(
i + 1) -
max / 2.) {
1744 if (left != -1 && right == -1) {
1745 if (
hist->GetBinContent(
i) >
max / 2. &&
hist->GetBinContent(
i + 1) <
max / 2.) {
1746 if (
hist->GetBinContent(
i) -
max / 2. <
max / 2. -
hist->GetBinContent(
i + 1)) {
1754 return hist->GetXaxis()->GetBinCenter(right) -
hist->GetXaxis()->GetBinCenter(left);
1760 for (std::map<int, TrackerOfflineValidation::ModuleHistos>::const_iterator
it = moduleHist_.begin(),
1761 itEnd = moduleHist_.end();
1773 unsigned int whichHalfBarrel(1),
rawId(detId_.
rawId());
1776 whichHalfBarrel = 2;
1778 treeMem.
half = whichHalfBarrel;
1782 unsigned int whichHalfCylinder(1),
rawId(detId_.
rawId());
1785 whichHalfCylinder = 2;
1788 treeMem.
half = whichHalfCylinder;
1793 unsigned int whichHalfShell(1),
rawId(detId_.
rawId());
1805 treeMem.
half = whichHalfShell;
1842 treeMem.
posX = gPModule.
x();
1843 treeMem.
posY = gPModule.
y();
1844 treeMem.
posZ = gPModule.
z();
1849 LocalPoint lUDirection(1., 0., 0.), lVDirection(0., 1., 0.), lWDirection(0., 0., 1.);
1851 gWDirection = surface.
toGlobal(lWDirection);
1852 double dR(999.),
dPhi(999.),
dZ(999.);
1855 dR = gWDirection.perp() - gPModule.
perp();
1857 dZ = gVDirection.z() - gPModule.
z();
1865 dZ = gWDirection.z() - gPModule.
z();
1871 dR = gVDirection.perp() - gPModule.
perp();
1873 dZ = gWDirection.z() - gPModule.
z();
1896 const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_) {
1897 for (std::map<int, TrackerOfflineValidation::ModuleHistos>::const_iterator
it = moduleHist_.begin(),
1898 itEnd = moduleHist_.end();
1904 treeMem.
entries =
static_cast<UInt_t
>(
it->second.ResXprimeHisto->GetEntries());
1905 treeMem.
meanX =
it->second.ResXprimeHisto->GetMean();
1906 treeMem.
rmsX =
it->second.ResXprimeHisto->GetRMS();
1912 std::pair<float, float> fitResult1 = this->
fitResiduals(
it->second.ResXprimeHisto);
1913 treeMem.
fitMeanX = fitResult1.first;
1916 std::pair<float, float> fitResult2 = this->
fitResiduals(
it->second.NormResXprimeHisto);
1928 it->second.ResXprimeHisto->GetBinContent(0) +
it->second.ResXprimeHisto->GetBinContent(
numberOfBins + 1);
1931 treeMem.
meanNormX =
it->second.NormResXprimeHisto->GetMean();
1932 treeMem.
rmsNormX =
it->second.NormResXprimeHisto->GetRMS();
1935 it->second.NormResXprimeHisto->GetStats(
stats);
1941 treeMem.
histNameX =
it->second.ResXprimeHisto->GetName();
1947 treeMem.
rmsLocalX =
it->second.ResHisto->GetRMS();
1953 if (
it->second.ResYHisto)
1959 if (
it->second.ResYprimeHisto) {
1960 TH1*
h =
it->second.ResYprimeHisto;
1961 treeMem.
meanY =
h->GetMean();
1962 treeMem.
rmsY =
h->GetRMS();
1965 std::pair<float, float> fitMeanSigma = this->
fitResiduals(h);
1966 treeMem.
fitMeanY = fitMeanSigma.first;
1967 treeMem.
fitSigmaY = fitMeanSigma.second;
1975 if (
it->second.NormResYprimeHisto) {
1976 TH1*
h =
it->second.NormResYprimeHisto;
1984 std::pair<float, float> fitMeanSigma = this->
fitResiduals(h);
1992 if (
it->second.ResXvsXProfile) {
1993 TH1*
h =
it->second.ResXvsXProfile;
1998 if (
it->second.ResXvsYProfile) {
1999 TH1*
h =
it->second.ResXvsYProfile;
2004 if (
it->second.ResYvsXProfile) {
2005 TH1*
h =
it->second.ResYvsXProfile;
2010 if (
it->second.ResYvsYProfile) {
2011 TH1*
h =
it->second.ResYvsYProfile;
2023 std::pair<float, float> fitResult(9999., 9999.);
2024 if (!
hist ||
hist->GetEntries() < 20)
2028 float sigma =
hist->GetRMS();
2033 TF1
func(
"tmp",
"gaus",
mean - 2. * sigma,
mean + 2. * sigma);
2034 if (0 ==
hist->Fit(&
func,
"QNR")) {
2036 sigma =
func.GetParameter(2);
2041 if (0 ==
hist->Fit(&
func,
"Q0LR")) {
2042 if (
hist->GetFunction(
func.GetName())) {
2043 hist->GetFunction(
func.GetName())->ResetBit(TF1::kNotDraw);
2045 fitResult.first =
func.GetParameter(1);
2046 fitResult.second =
func.GetParameter(2);
2050 edm::LogWarning(
"Alignment") <<
"@SUB=TrackerOfflineValidation::fitResiduals" 2051 <<
"Caught this exception during ROOT fit: " <<
e.what();
2061 double*
x =
new double[
nbins];
2062 double*
y =
new double[
nbins];
2065 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)
const unsigned int maxEntriesPerModuleForDmr_
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)