169 if (newDir.length() != 0) {
178 if (newDir.length() == 0)
181 tfd = std::make_unique<TFileDirectory>(upDir.
tfd->mkdir(newDir));
191 if (newDir.length() == 0) {
192 tfd = std::make_unique<TFileDirectory>(
fs->tFileDirectory());
194 tfd = std::make_unique<TFileDirectory>(
fs->mkdir(newDir));
198 if (newDir.length() != 0) {
209 template <
typename T>
210 TH1*
make(
const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX);
211 template <
typename T>
213 template <
typename T>
222 template <
typename T>
231 std::unique_ptr<TFileDirectory>
tfd;
252 std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles);
255 void setUpTreeMembers(
const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_,
260 const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_);
276 const char* histName,
284 const char* histName,
292 const char* histName,
304 double& upperBoundX);
320 template <
class OBJECT_TYPE>
321 int GetIndex(
const std::vector<OBJECT_TYPE*>& vec,
const TString&
name);
387 template <
class OBJECT_TYPE>
390 for (
typename std::vector<OBJECT_TYPE*>::const_iterator iter = vec.begin(), iterEnd = vec.end(); iter != iterEnd;
392 if (*iter && (*iter)->GetName() ==
name)
395 edm::LogError(
"Alignment") <<
"@SUB=TrackerOfflineValidation::GetIndex" 396 <<
" could not find " <<
name;
401 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TH1F>(
402 const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX) {
404 theDbe->setCurrentFolder(directoryString);
405 return theDbe->book1D(
name,
title,
nBinX, minBinX, maxBinX)->getTH1();
412 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
const char*
name,
417 theDbe->setCurrentFolder(directoryString);
420 tmpProfile->SetDirectory(
nullptr);
421 return theDbe->bookProfile(
name, tmpProfile)->getTH1();
428 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
429 const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX) {
431 theDbe->setCurrentFolder(directoryString);
433 TProfile* tmpProfile =
new TProfile(
name,
title,
nBinX, minBinX, maxBinX);
434 tmpProfile->SetDirectory(
nullptr);
435 return theDbe->bookProfile(
name, tmpProfile)->getTH1();
442 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
445 theDbe->setCurrentFolder(directoryString);
454 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TH2F>(
const char*
name,
463 theDbe->setCurrentFolder(directoryString);
464 return theDbe->book2D(
name,
title,
nBinX, minBinX, maxBinX,
nBinY, minBinY, maxBinY)->getTH1();
477 bareTkGeomPtr_(nullptr),
478 compressionSettings_(parSet_.getUntrackedParameter<
int>(
"compressionSettings", -1)),
479 lCoorHistOn_(parSet_.getParameter<
bool>(
"localCoorHistosOn")),
480 moduleLevelHistsTransient_(parSet_.getParameter<
bool>(
"moduleLevelHistsTransient")),
481 moduleLevelProfiles_(parSet_.getParameter<
bool>(
"moduleLevelProfiles")),
482 stripYResiduals_(parSet_.getParameter<
bool>(
"stripYResiduals")),
483 useFwhm_(parSet_.getParameter<
bool>(
"useFwhm")),
484 useFit_(parSet_.getParameter<
bool>(
"useFit")),
485 useOverflowForRMS_(parSet_.getParameter<
bool>(
"useOverflowForRMS")),
486 dqmMode_(parSet_.getParameter<
bool>(
"useInDqmMode")),
487 moduleDirectory_(parSet_.getParameter<
std::
string>(
"moduleDirectoryInOutput")),
488 chargeCut_(parSet_.getParameter<
int>(
"chargeCut")),
490 maxTracks_(parSet_.getParameter<unsigned long long>(
"maxTracks")),
491 avalidator_(iConfig, consumesCollector()) {
523 <<
"There are " << newBareTkGeomPtr->
detIds().size() <<
" dets in the Geometry record.\n" 524 <<
"Out of these " << newBareTkGeomPtr->
detUnitIds().size() <<
" are detUnits";
535 std::vector<TrackerOfflineValidation::SummaryContainer> vTrackerprofiles;
546 <<
"TrackerGeometry changed, but will not re-book hists!";
552 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_tracketa",
"Track #eta;#eta_{Track};Number of Tracks", 90, -3., 3.));
553 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_trackphi",
"Track #phi;#phi_{Track};Number of Tracks", 90, -3.15, 3.15));
555 "h_trackNumberOfValidHits",
"Track # of valid hits;# of valid hits _{Track};Number of Tracks", 40, 0., 40.));
557 "h_trackNumberOfLostHits",
"Track # of lost hits;# of lost hits _{Track};Number of Tracks", 10, 0., 10.));
559 tfd.
make<TH1F>(
"h_curvature",
"Curvature #kappa;#kappa_{Track};Number of Tracks", 100, -.05, .05));
561 "h_curvature_pos",
"Curvature |#kappa| Positive Tracks;|#kappa_{pos Track}|;Number of Tracks", 100, .0, .05));
563 "h_curvature_neg",
"Curvature |#kappa| Negative Tracks;|#kappa_{neg Track}|;Number of Tracks", 100, .0, .05));
565 tfd.
make<TH1F>(
"h_diff_curvature",
566 "Curvature |#kappa| Tracks Difference;|#kappa_{Track}|;# Pos Tracks - # Neg Tracks",
570 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_chi2",
"#chi^{2};#chi^{2}_{Track};Number of Tracks", 500, -0.01, 500.));
572 tfd.
make<TH1F>(
"h_chi2Prob",
"#chi^{2} probability;#chi^{2}prob_{Track};Number of Tracks", 100, 0.0, 1.));
574 tfd.
make<TH1F>(
"h_normchi2",
"#chi^{2}/ndof;#chi^{2}/ndof;Number of Tracks", 100, -0.01, 10.));
575 vTrackHistos_.push_back(tfd.
make<TH1F>(
"h_pt",
"p_{T}^{track};p_{T}^{track} [GeV];Number of Tracks", 250, 0., 250));
577 "h_ptResolution",
"#delta_{p_{T}}/p_{T}^{track};#delta_{p_{T}}/p_{T}^{track};Number of Tracks", 100, 0., 0.5));
579 "p_d0_vs_phi",
"Transverse Impact Parameter vs. #phi;#phi_{Track};#LT d_{0} #GT [cm]", 100, -3.15, 3.15));
581 "p_dz_vs_phi",
"Longitudinal Impact Parameter vs. #phi;#phi_{Track};#LT d_{z} #GT [cm]", 100, -3.15, 3.15));
583 "p_d0_vs_eta",
"Transverse Impact Parameter vs. #eta;#eta_{Track};#LT d_{0} #GT [cm]", 100, -3.15, 3.15));
585 "p_dz_vs_eta",
"Longitudinal Impact Parameter vs. #eta;#eta_{Track};#LT d_{z} #GT [cm]", 100, -3.15, 3.15));
587 tfd.
make<TProfile>(
"p_chi2_vs_phi",
"#chi^{2} vs. #phi;#phi_{Track};#LT #chi^{2} #GT", 100, -3.15, 3.15));
589 "p_chi2Prob_vs_phi",
"#chi^{2} probablility vs. #phi;#phi_{Track};#LT #chi^{2} probability#GT", 100, -3.15, 3.15));
591 "p_chi2Prob_vs_d0",
"#chi^{2} probablility vs. |d_{0}|;|d_{0}|[cm];#LT #chi^{2} probability#GT", 100, 0, 80));
593 "p_normchi2_vs_phi",
"#chi^{2}/ndof vs. #phi;#phi_{Track};#LT #chi^{2}/ndof #GT", 100, -3.15, 3.15));
595 tfd.
make<TProfile>(
"p_chi2_vs_eta",
"#chi^{2} vs. #eta;#eta_{Track};#LT #chi^{2} #GT", 100, -3.15, 3.15));
597 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.};
599 "p_normchi2_vs_pt",
"norm #chi^{2} vs. p_{T}_{Track}; p_{T}_{Track};#LT #chi^{2}/ndof #GT", 18,
xBins));
602 tfd.
make<TProfile>(
"p_normchi2_vs_p",
"#chi^{2}/ndof vs. p_{Track};p_{Track};#LT #chi^{2}/ndof #GT", 18,
xBins));
604 "p_chi2Prob_vs_eta",
"#chi^{2} probability vs. #eta;#eta_{Track};#LT #chi^{2} probability #GT", 100, -3.15, 3.15));
606 "p_normchi2_vs_eta",
"#chi^{2}/ndof vs. #eta;#eta_{Track};#LT #chi^{2}/ndof #GT", 100, -3.15, 3.15));
608 tfd.
make<TProfile>(
"p_kappa_vs_phi",
"#kappa vs. #phi;#phi_{Track};#kappa", 100, -3.15, 3.15));
610 tfd.
make<TProfile>(
"p_kappa_vs_eta",
"#kappa vs. #eta;#eta_{Track};#kappa", 100, -3.15, 3.15));
612 "#delta_{p_{T}}/p_{T}^{track};#phi^{track};#delta_{p_{T}}/p_{T}^{track}",
617 "#delta_{p_{T}}/p_{T}^{track};#eta^{track};#delta_{p_{T}}/p_{T}^{track}",
623 "h2_d0_vs_phi",
"Transverse Impact Parameter vs. #phi;#phi_{Track};d_{0} [cm]", 100, -3.15, 3.15, 100, -1., 1.));
625 "Longitudinal Impact Parameter vs. #phi;#phi_{Track};d_{z} [cm]",
633 "h2_d0_vs_eta",
"Transverse Impact Parameter vs. #eta;#eta_{Track};d_{0} [cm]", 100, -3.15, 3.15, 100, -1., 1.));
635 "Longitudinal Impact Parameter vs. #eta;#eta_{Track};d_{z} [cm]",
643 tfd.
make<TH2F>(
"h2_chi2_vs_phi",
"#chi^{2} vs. #phi;#phi_{Track};#chi^{2}", 100, -3.15, 3.15, 500, 0., 500.));
645 "#chi^{2} probability vs. #phi;#phi_{Track};#chi^{2} probability",
653 "#chi^{2} probability vs. |d_{0}|;|d_{0}| [cm];#chi^{2} probability",
661 "h2_normchi2_vs_phi",
"#chi^{2}/ndof vs. #phi;#phi_{Track};#chi^{2}/ndof", 100, -3.15, 3.15, 100, 0., 10.));
663 tfd.
make<TH2F>(
"h2_chi2_vs_eta",
"#chi^{2} vs. #eta;#eta_{Track};#chi^{2}", 100, -3.15, 3.15, 500, 0., 500.));
665 "#chi^{2} probaility vs. #eta;#eta_{Track};#chi^{2} probability",
673 "h2_normchi2_vs_eta",
"#chi^{2}/ndof vs. #eta;#eta_{Track};#chi^{2}/ndof", 100, -3.15, 3.15, 100, 0., 10.));
675 tfd.
make<TH2F>(
"h2_kappa_vs_phi",
"#kappa vs. #phi;#phi_{Track};#kappa", 100, -3.15, 3.15, 100, .0, .05));
677 tfd.
make<TH2F>(
"h2_kappa_vs_eta",
"#kappa vs. #eta;#eta_{Track};#kappa", 100, -3.15, 3.15, 100, .0, .05));
679 "h2_normchi2_vs_kappa",
"#kappa vs. #chi^{2}/ndof;#chi^{2}/ndof;#kappa", 100, 0., 10, 100, -.03, .03));
683 "p_vs_resXprime_pixB",
"res_{x'} vs momentum in BPix;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
685 "p_vs_resXprime_pixE",
"res_{x'} vs momentum in FPix;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
687 "p_vs_resXprime_TIB",
"res_{x'} vs momentum in TIB;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
689 "p_vs_resXprime_TID",
"res_{x'} vs momentum in TID;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
691 "p_vs_resXprime_TOB",
"res_{x'} vs momentum in TOB;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
693 "p_vs_resXprime_TEC",
"res_{x'} vs momentum in TEC;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
697 "p_vs_resYprime_pixB",
"res_{y'} vs momentum in BPix;p [GeV]; res_{y'}", 15, 0., 15., 200, -0.1, 0.1));
699 "p_vs_resYprime_pixE",
"res_{y'} vs momentum in FPix;p [GeV]; res_{y'}", 15, 0., 15., 200, -0.1, 0.1));
704 for (
int i = 0, iEnd = ali.
components().size();
i < iEnd; ++
i) {
706 LogDebug(
"TrackerOfflineValidation") <<
"StructureName = " << structurename;
710 if (structurename !=
"Strip" && structurename !=
"Pixel")
713 if (structurename.find(
"Endcap", 0) != std::string::npos) {
746 std::stringstream histoname, histotitle, normhistoname, normhistotitle, yhistoname, yhistotitle, xprimehistoname,
747 xprimehistotitle, normxprimehistoname, normxprimehistotitle, yprimehistoname, yprimehistotitle,
748 normyprimehistoname, normyprimehistotitle, localxname, localxtitle, localyname, localytitle, resxvsxprofilename,
749 resxvsxprofiletitle, resyvsxprofilename, resyvsxprofiletitle, resxvsyprofilename, resxvsyprofiletitle,
750 resyvsyprofilename, resyvsyprofiletitle;
754 if (this->
isEndCap(static_cast<uint32_t>(subdetandlayer.first)))
755 wheel_or_layer =
"_wheel_";
756 else if (this->
isBarrel(static_cast<uint32_t>(subdetandlayer.first)))
757 wheel_or_layer =
"_layer_";
759 edm::LogWarning(
"TrackerOfflineValidation") <<
"@SUB=TrackerOfflineValidation::bookHists" 760 <<
"Unknown subdetid: " << subdetandlayer.first;
762 histoname <<
"h_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_" 764 yhistoname <<
"h_y_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_" 766 xprimehistoname <<
"h_xprime_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
767 <<
"_module_" <<
id.rawId();
768 yprimehistoname <<
"h_yprime_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
769 <<
"_module_" <<
id.rawId();
770 normhistoname <<
"h_normresiduals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
771 <<
"_module_" <<
id.rawId();
772 normxprimehistoname <<
"h_normxprimeresiduals_subdet_" << subdetandlayer.first << wheel_or_layer
773 << subdetandlayer.second <<
"_module_" <<
id.rawId();
774 normyprimehistoname <<
"h_normyprimeresiduals_subdet_" << subdetandlayer.first << wheel_or_layer
775 << subdetandlayer.second <<
"_module_" <<
id.rawId();
776 histotitle <<
"X Residual for module " <<
id.rawId() <<
";x_{tr} - x_{hit} [cm]";
777 yhistotitle <<
"Y Residual for module " <<
id.rawId() <<
";y_{tr} - y_{hit} [cm]";
778 normhistotitle <<
"Normalized Residual for module " <<
id.rawId() <<
";x_{tr} - x_{hit}/#sigma";
779 xprimehistotitle <<
"X' Residual for module " <<
id.rawId() <<
";(x_{tr} - x_{hit})' [cm]";
780 normxprimehistotitle <<
"Normalized X' Residual for module " <<
id.rawId() <<
";(x_{tr} - x_{hit})'/#sigma";
781 yprimehistotitle <<
"Y' Residual for module " <<
id.rawId() <<
";(y_{tr} - y_{hit})' [cm]";
782 normyprimehistotitle <<
"Normalized Y' Residual for module " <<
id.rawId() <<
";(y_{tr} - y_{hit})'/#sigma";
785 localxname <<
"h_localx_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_" 787 localyname <<
"h_localy_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second <<
"_module_" 789 localxtitle <<
"u local for module " <<
id.rawId() <<
"; u_{tr,r}";
790 localytitle <<
"v local for module " <<
id.rawId() <<
"; v_{tr,r}";
792 resxvsxprofilename <<
"p_residuals_x_vs_x_subdet_" << subdetandlayer.first << wheel_or_layer
793 << subdetandlayer.second <<
"_module_" <<
id.rawId();
794 resyvsxprofilename <<
"p_residuals_y_vs_x_subdet_" << subdetandlayer.first << wheel_or_layer
795 << subdetandlayer.second <<
"_module_" <<
id.rawId();
796 resxvsyprofilename <<
"p_residuals_x_vs_y_subdet_" << subdetandlayer.first << wheel_or_layer
797 << subdetandlayer.second <<
"_module_" <<
id.rawId();
798 resyvsyprofilename <<
"p_residuals_y_vs_y_subdet_" << subdetandlayer.first << wheel_or_layer
799 << subdetandlayer.second <<
"_module_" <<
id.rawId();
800 resxvsxprofiletitle <<
"U Residual vs u for module " <<
id.rawId()
801 <<
"; u_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
802 resyvsxprofiletitle <<
"V Residual vs u for module " <<
id.rawId()
803 <<
"; u_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
804 resxvsyprofiletitle <<
"U Residual vs v for module " <<
id.rawId()
805 <<
"; v_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
806 resyvsyprofiletitle <<
"V Residual vs v for module " <<
id.rawId()
807 <<
"; v_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
819 moduleLevelHistsTransient =
false;
825 moduleLevelHistsTransient, tfd, histoname.str().c_str(), histotitle.str().c_str(),
nbins,
xmin,
xmax);
828 moduleLevelHistsTransient, tfd, normhistoname.str().c_str(), normhistotitle.str().c_str(),
nbins,
xmin,
xmax);
833 xprimehistoname.str().c_str(),
834 xprimehistotitle.str().c_str(),
841 normxprimehistoname.str().c_str(),
842 normxprimehistotitle.str().c_str(),
851 moduleLevelHistsTransient, tfd, localxname.str().c_str(), localxtitle.str().c_str(),
nbins,
xmin,
xmax);
853 moduleLevelHistsTransient, tfd, localyname.str().c_str(), localytitle.str().c_str(),
nbins,
xmin,
xmax);
856 resxvsxprofilename.str().c_str(),
857 resxvsxprofiletitle.str().c_str(),
866 resxvsyprofilename.str().c_str(),
867 resxvsyprofiletitle.str().c_str(),
880 yprimehistoname.str().c_str(),
881 yprimehistotitle.str().c_str(),
888 moduleLevelHistsTransient, tfd, yhistoname.str().c_str(), yhistotitle.str().c_str(),
nbins,
xmin,
xmax);
893 normyprimehistoname.str().c_str(),
894 normyprimehistotitle.str().c_str(),
904 resyvsxprofilename.str().c_str(),
905 resyvsxprofiletitle.str().c_str(),
914 resyvsyprofilename.str().c_str(),
915 resyvsyprofiletitle.str().c_str(),
929 const char* histName,
938 return tfd.
make<TH1F>(histName,
histTitle, nBinsX, lowX, highX);
943 const char* histName,
953 return (TProfile*)tfd.
make<TProfile>(histName,
histTitle, nBinsX, lowX, highX);
958 const char* histName,
966 TProfile*
profile =
new TProfile(histName,
histTitle, nBinsX, lowX, highX, lowY, highY);
970 return (TProfile*)tfd.
make<TProfile>(histName,
histTitle, nBinsX, lowX, highX, lowY, highY);
995 double& upperBoundX) {
1054 lowerBoundX = binningPSet.
getParameter<
double>(
"xmin");
1055 upperBoundX = binningPSet.
getParameter<
double>(
"xmax");
1059 if (targetHist && sourceHist) {
1060 targetHist->SetBinContent(
bin, sourceHist->GetMean(1));
1062 targetHist->SetBinError(
bin,
Fwhm(sourceHist) / 2.);
1064 targetHist->SetBinError(
bin, sourceHist->GetRMS(1));
1111 <<
"[TrackerOfflineValidation] Error, tried to get reference for non-tracker subdet " << subdetid
1112 <<
" from detector " << detid.
det();
1124 TH1::StatOverflows(kTRUE);
1127 std::vector<TrackerValidationVariables::AVTrackStruct> vTrackstruct;
1130 for (std::vector<TrackerValidationVariables::AVTrackStruct>::const_iterator itT = vTrackstruct.begin();
1131 itT != vTrackstruct.end();
1144 vTrackHistos_[numOfValidHitsindex]->Fill(itT->numberOfValidHits);
1146 vTrackHistos_[numOfLostHitsindex]->Fill(itT->numberOfLostHits);
1150 if (itT->charge > 0)
1153 if (itT->charge < 0)
1163 if (itT->ptError != 0.) {
1165 vTrackHistos_[ptResolutionindex]->Fill(itT->ptError / itT->pt);
1181 vTrackProfiles_[chiProbabsd0index]->Fill(fabs(itT->d0), itT->chi2Prob);
1199 vTrackProfiles_[ptResphiindex]->Fill(itT->phi, itT->ptError / itT->pt);
1201 vTrackProfiles_[ptResetaindex]->Fill(itT->eta, itT->ptError / itT->pt);
1217 vTrack2DHistos_[chiProbabsd0index_2d]->Fill(fabs(itT->d0), itT->chi2Prob);
1234 for (std::vector<TrackerValidationVariables::AVHitStruct>::const_iterator itH = itT->hits.begin();
1235 itH != itT->hits.end();
1237 DetId detid(itH->rawDetId);
1242 histStruct.
ResHisto->Fill(itH->resX);
1243 if (itH->resErrX != 0)
1244 histStruct.
NormResHisto->Fill(itH->resX / itH->resErrX);
1250 if (itH->resXprime != -999.) {
1281 float tgalpha =
tan(itH->localAlpha);
1282 if (fabs(tgalpha) != 0) {
1283 histStruct.
LocalX->Fill(itH->localXnorm, tgalpha * tgalpha);
1284 histStruct.
LocalY->Fill(itH->localYnorm, tgalpha * tgalpha);
1296 histStruct.
ResXvsXProfile->Fill(itH->localXnorm, itH->resXatTrkY / tgalpha, tgalpha * tgalpha);
1297 histStruct.
ResXvsYProfile->Fill(itH->localYnorm, itH->resXatTrkY / tgalpha, tgalpha * tgalpha);
1303 if (itH->resXprimeErr != 0 && itH->resXprimeErr != -999) {
1308 if (itH->resYprime != -999.) {
1324 float tgbeta =
tan(itH->localBeta);
1325 if (fabs(tgbeta) != 0) {
1338 histStruct.
ResYvsXProfile->Fill(itH->localXnorm, itH->resY / tgbeta, tgbeta * tgbeta);
1339 histStruct.
ResYvsYProfile->Fill(itH->localYnorm, itH->resY / tgbeta, tgbeta * tgbeta);
1344 if (itH->resYprimeErr != 0 && itH->resYprimeErr != -999.) {
1354 TH1::StatOverflows(kFALSE);
1382 TTree*
tree =
fs->make<TTree>(
"TkOffVal",
"TkOffVal");
1388 tree->Branch(
"TkOffTreeVariables", &treeMemPtr);
1398 treeMemPtr =
nullptr;
1404 std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles) {
1409 for (
int iComp = 0, iCompEnd = ali.
components().size(); iComp < iCompEnd; ++iComp) {
1410 std::vector<TrackerOfflineValidation::SummaryContainer> vProfiles;
1413 LogDebug(
"TrackerOfflineValidation") <<
"StructureName = " << structurename;
1418 if (structurename !=
"Strip" && structurename !=
"Pixel")
1425 TH1* hX = vLevelProfiles[iComp].sumXResiduals_;
1426 TH1* hNormX = vLevelProfiles[iComp].sumNormXResiduals_;
1427 TH1* hY = vLevelProfiles[iComp].sumYResiduals_;
1428 TH1* hNormY = vLevelProfiles[iComp].sumNormYResiduals_;
1429 TH1* pXX = vLevelProfiles[iComp].sumResXvsXProfile_;
1430 TH1* pXY = vLevelProfiles[iComp].sumResXvsYProfile_;
1431 TH1* pYX = vLevelProfiles[iComp].sumResYvsXProfile_;
1432 TH1* pYY = vLevelProfiles[iComp].sumResYvsYProfile_;
1433 for (
uint n = 0;
n < vProfiles.size(); ++
n) {
1453 toFit_.push_back(vLevelProfiles[iComp].sumXResiduals_);
1454 toFit_.push_back(vLevelProfiles[iComp].sumNormXResiduals_);
1458 toFit_.push_back(hNormY);
1470 it->first->Add(it->second);
1474 setSummaryBin(std::get<0>(*it), std::get<1>(*it), std::get<2>(*it));
1476 for (std::vector<TH1*>::const_iterator it =
toFit_.begin(); it !=
toFit_.end(); ++it)
1487 const char* aliTypeName =
alignableTracker_->objectIdProvider().idToString(alitype);
1488 const char* aliSubtypeName =
alignableTracker_->objectIdProvider().idToString(subtype);
1491 const DetId aliDetId = ali.
id();
1501 const uint subcompSize = ali.
components()[0]->components().size();
1503 const TString
title(Form(
"Summary for substructures in %s %d;%s;", aliTypeName,
i, aliSubtypeName));
1505 sumContainer.summaryXResiduals_ = tfd.
make<TH1F>(
1506 Form(
"h_summaryX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x' #GT", aliSize, 0.5, aliSize + 0.5);
1507 sumContainer.summaryNormXResiduals_ = tfd.
make<TH1F>(
1508 Form(
"h_summaryNormX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x'/#sigma #GT", aliSize, 0.5, aliSize + 0.5);
1511 sumContainer.summaryYResiduals_ = tfd.
make<TH1F>(
1512 Form(
"h_summaryY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y' #GT", aliSize, 0.5, aliSize + 0.5);
1513 sumContainer.summaryNormYResiduals_ = tfd.
make<TH1F>(
1514 Form(
"h_summaryNormY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y'/#sigma #GT", aliSize, 0.5, aliSize + 0.5);
1518 if (subcompSize != 2) {
1521 <<
"Det with " << subcompSize <<
" components";
1524 const TString
title(Form(
1525 "Summary for substructures in %s %d;%s;",
1530 sumContainer.summaryXResiduals_ = tfd.
make<TH1F>(
1531 Form(
"h_summaryX%s_%d", aliTypeName,
i),
title +
"#LT #Delta x' #GT", (2 * aliSize), 0.5, 2 * aliSize + 0.5);
1532 sumContainer.summaryNormXResiduals_ = tfd.
make<TH1F>(Form(
"h_summaryNormX%s_%d", aliTypeName,
i),
1533 title +
"#LT #Delta x'/#sigma #GT",
1539 sumContainer.summaryYResiduals_ = tfd.
make<TH1F>(
1540 Form(
"h_summaryY%s_%d", aliTypeName,
i),
title +
"#LT #Delta y' #GT", (2 * aliSize), 0.5, 2 * aliSize + 0.5);
1541 sumContainer.summaryNormYResiduals_ = tfd.
make<TH1F>(Form(
"h_summaryNormY%s_%d", aliTypeName,
i),
1542 title +
"#LT #Delta y'/#sigma #GT",
1550 <<
"@SUB=TrackerOfflineValidation::bookSummaryHists" 1551 <<
"No summary histogram for hierarchy level " << aliTypeName <<
" in subdet " << aliDetId.
subdetId();
1559 const TString sumTitle(Form(
"Residual for %s %d in %s;", aliTypeName,
i,
typeName));
1563 sumContainer.sumXResiduals_ = tfd.
make<TH1F>(Form(
"h_Xprime_%s_%d", aliTypeName,
i),
1570 sumContainer.sumNormXResiduals_ = tfd.
make<TH1F>(Form(
"h_NormXprime_%s_%d", aliTypeName,
i),
1578 sumContainer.sumResXvsXProfile_ = tfd.
make<TProfile>(Form(
"p_resXX_%s_%d", aliTypeName,
i),
1584 sumContainer.sumResXvsXProfile_->Sumw2();
1585 sumContainer.sumResXvsYProfile_ = tfd.
make<TProfile>(Form(
"p_resXY_%s_%d", aliTypeName,
i),
1591 sumContainer.sumResXvsYProfile_->Sumw2();
1596 sumContainer.sumYResiduals_ = tfd.
make<TH1F>(Form(
"h_Yprime_%s_%d", aliTypeName,
i),
1603 sumContainer.sumNormYResiduals_ = tfd.
make<TH1F>(Form(
"h_NormYprime_%s_%d", aliTypeName,
i),
1611 sumContainer.sumResYvsXProfile_ = tfd.
make<TProfile>(Form(
"p_resYX_%s_%d", aliTypeName,
i),
1617 sumContainer.sumResYvsXProfile_->Sumw2();
1618 sumContainer.sumResYvsYProfile_ = tfd.
make<TProfile>(Form(
"p_resYY_%s_%d", aliTypeName,
i),
1624 sumContainer.sumResYvsYProfile_->Sumw2();
1632 for (
uint k = 0;
k < aliSize; ++
k) {
1653 for (
uint k = 0;
k < aliSize; ++
k) {
1654 for (
uint j = 0;
j < subcompSize; ++
j) {
1675 return sumContainer;
1679 float max =
hist->GetMaximum();
1680 int left = -1, right = -1;
1681 for (
unsigned int i = 1, iEnd =
hist->GetNbinsX();
i <= iEnd; ++
i) {
1682 if (
hist->GetBinContent(
i) <
max / 2. &&
hist->GetBinContent(
i + 1) >
max / 2. && left == -1) {
1683 if (
max / 2. -
hist->GetBinContent(
i) <
hist->GetBinContent(
i + 1) -
max / 2.) {
1691 if (left != -1 && right == -1) {
1692 if (
hist->GetBinContent(
i) >
max / 2. &&
hist->GetBinContent(
i + 1) <
max / 2.) {
1693 if (
hist->GetBinContent(
i) -
max / 2. <
max / 2. -
hist->GetBinContent(
i + 1)) {
1701 return hist->GetXaxis()->GetBinCenter(right) -
hist->GetXaxis()->GetBinCenter(left);
1707 for (std::map<int, TrackerOfflineValidation::ModuleHistos>::const_iterator it = moduleHist_.begin(),
1708 itEnd = moduleHist_.end();
1714 DetId detId_ = it->first;
1720 unsigned int whichHalfBarrel(1), rawId(detId_.
rawId());
1721 if ((rawId >= 302056964 && rawId < 302059300) || (rawId >= 302123268 && rawId < 302127140) ||
1722 (rawId >= 302189572 && rawId < 302194980))
1723 whichHalfBarrel = 2;
1725 treeMem.
half = whichHalfBarrel;
1729 unsigned int whichHalfCylinder(1), rawId(detId_.
rawId());
1730 if ((rawId >= 352394500 && rawId < 352406032) || (rawId >= 352460036 && rawId < 352471568) ||
1731 (rawId >= 344005892 && rawId < 344017424) || (rawId >= 344071428 && rawId < 344082960))
1732 whichHalfCylinder = 2;
1735 treeMem.
half = whichHalfCylinder;
1740 unsigned int whichHalfShell(1), rawId(detId_.
rawId());
1741 if ((rawId >= 369120484 && rawId < 369120688) || (rawId >= 369121540 && rawId < 369121776) ||
1742 (rawId >= 369136932 && rawId < 369137200) || (rawId >= 369137988 && rawId < 369138288) ||
1743 (rawId >= 369153396 && rawId < 369153744) || (rawId >= 369154436 && rawId < 369154800) ||
1744 (rawId >= 369169844 && rawId < 369170256) || (rawId >= 369170900 && rawId < 369171344) ||
1745 (rawId >= 369124580 && rawId < 369124784) || (rawId >= 369125636 && rawId < 369125872) ||
1746 (rawId >= 369141028 && rawId < 369141296) || (rawId >= 369142084 && rawId < 369142384) ||
1747 (rawId >= 369157492 && rawId < 369157840) || (rawId >= 369158532 && rawId < 369158896) ||
1748 (rawId >= 369173940 && rawId < 369174352) || (rawId >= 369174996 && rawId < 369175440))
1752 treeMem.
half = whichHalfShell;
1789 treeMem.
posX = gPModule.
x();
1790 treeMem.
posY = gPModule.
y();
1791 treeMem.
posZ = gPModule.
z();
1796 LocalPoint lUDirection(1., 0., 0.), lVDirection(0., 1., 0.), lWDirection(0., 0., 1.);
1798 gWDirection = surface.
toGlobal(lWDirection);
1799 double dR(999.),
dPhi(999.),
dZ(999.);
1802 dR = gWDirection.perp() - gPModule.
perp();
1804 dZ = gVDirection.z() - gPModule.
z();
1812 dZ = gWDirection.z() - gPModule.
z();
1818 dR = gVDirection.perp() - gPModule.
perp();
1820 dZ = gWDirection.z() - gPModule.
z();
1843 const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_) {
1844 for (std::map<int, TrackerOfflineValidation::ModuleHistos>::const_iterator it = moduleHist_.begin(),
1845 itEnd = moduleHist_.end();
1851 treeMem.
entries =
static_cast<UInt_t
>(it->second.ResXprimeHisto->GetEntries());
1852 treeMem.
meanX = it->second.ResXprimeHisto->GetMean();
1853 treeMem.
rmsX = it->second.ResXprimeHisto->GetRMS();
1859 std::pair<float, float> fitResult1 = this->
fitResiduals(it->second.ResXprimeHisto);
1860 treeMem.
fitMeanX = fitResult1.first;
1863 std::pair<float, float> fitResult2 = this->
fitResiduals(it->second.NormResXprimeHisto);
1871 int numberOfBins = it->second.ResXprimeHisto->GetNbinsX();
1875 it->second.ResXprimeHisto->GetBinContent(0) + it->second.ResXprimeHisto->GetBinContent(
numberOfBins + 1);
1878 treeMem.
meanNormX = it->second.NormResXprimeHisto->GetMean();
1879 treeMem.
rmsNormX = it->second.NormResXprimeHisto->GetRMS();
1882 it->second.NormResXprimeHisto->GetStats(
stats);
1887 treeMem.
sigmaNormX =
Fwhm(it->second.NormResXprimeHisto) / 2.355;
1888 treeMem.
histNameX = it->second.ResXprimeHisto->GetName();
1889 treeMem.
histNameNormX = it->second.NormResXprimeHisto->GetName();
1893 treeMem.
meanLocalX = it->second.ResHisto->GetMean();
1894 treeMem.
rmsLocalX = it->second.ResHisto->GetRMS();
1900 if (it->second.ResYHisto)
1906 if (it->second.ResYprimeHisto) {
1907 TH1*
h = it->second.ResYprimeHisto;
1908 treeMem.
meanY =
h->GetMean();
1909 treeMem.
rmsY =
h->GetRMS();
1912 std::pair<float, float> fitMeanSigma = this->
fitResiduals(h);
1913 treeMem.
fitMeanY = fitMeanSigma.first;
1914 treeMem.
fitSigmaY = fitMeanSigma.second;
1922 if (it->second.NormResYprimeHisto) {
1923 TH1*
h = it->second.NormResYprimeHisto;
1931 std::pair<float, float> fitMeanSigma = this->
fitResiduals(h);
1939 if (it->second.ResXvsXProfile) {
1940 TH1*
h = it->second.ResXvsXProfile;
1945 if (it->second.ResXvsYProfile) {
1946 TH1*
h = it->second.ResXvsYProfile;
1951 if (it->second.ResYvsXProfile) {
1952 TH1*
h = it->second.ResYvsXProfile;
1957 if (it->second.ResYvsYProfile) {
1958 TH1*
h = it->second.ResYvsYProfile;
1970 std::pair<float, float> fitResult(9999., 9999.);
1971 if (!
hist ||
hist->GetEntries() < 20)
1975 float sigma =
hist->GetRMS();
1980 TF1
func(
"tmp",
"gaus",
mean - 2. * sigma,
mean + 2. * sigma);
1981 if (0 ==
hist->Fit(&
func,
"QNR")) {
1983 sigma =
func.GetParameter(2);
1988 if (0 ==
hist->Fit(&
func,
"Q0LR")) {
1989 if (
hist->GetFunction(
func.GetName())) {
1990 hist->GetFunction(
func.GetName())->ResetBit(TF1::kNotDraw);
1992 fitResult.first =
func.GetParameter(1);
1993 fitResult.second =
func.GetParameter(2);
1997 edm::LogWarning(
"Alignment") <<
"@SUB=TrackerOfflineValidation::fitResiduals" 1998 <<
"Caught this exception during ROOT fit: " <<
e.what();
2008 double*
x =
new double[
nbins];
2009 double*
y =
new double[
nbins];
2012 y[
j] =
histo->GetBinContent(
j + 1);
const TrackerGeometry * bareTkGeomPtr_
static const std::string kSharedResource
static constexpr auto TEC
bool tibIsDoubleSide(const DetId &id) const
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
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)
constexpr Detector det() const
get the detector field from this detid
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)
#define DEFINE_FWK_MODULE(type)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getData(T &iHolder) const
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.
std::string histNameLocalY
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const TrackerGeomDet * idToDet(DetId) const override
std::string histNameNormLocalX
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)