Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tracker Alignment] Split vertex resolution validation submitter #30091

Merged
merged 4 commits into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
54 changes: 45 additions & 9 deletions Alignment/OfflineValidation/macros/MultiRunAndPlotPVValidation.C
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ struct outTrends {
void MultiRunPVValidation(TString namesandlabels = "",
bool lumi_axis_format = false,
bool time_axis_format = false,
bool useRMS = true);
bool useRMS = true,
TString lumiInputFile = "");
outTrends processData(size_t iter,
std::vector<int> intersection,
const Int_t nDirs_,
Expand Down Expand Up @@ -513,7 +514,8 @@ std::vector<std::string> split(const std::string &s, char delimiter)
//
///////////////////////////////////

void MultiRunPVValidation(TString namesandlabels, bool lumi_axis_format, bool time_axis_format, bool useRMS) {
void MultiRunPVValidation(
TString namesandlabels, bool lumi_axis_format, bool time_axis_format, bool useRMS, TString lumiInputFile) {
TStopwatch timer;
timer.Start();

Expand All @@ -535,12 +537,11 @@ void MultiRunPVValidation(TString namesandlabels, bool lumi_axis_format, bool ti

// preload the dates from file
std::map<int, TDatime> times;

if (time_axis_format) {
std::ifstream infile("times.txt");

if (!infile) {
std::cout << "missing input file :(" << std::endl;
std::cout << "Required time axis options, but missing input times file :(" << std::endl;
std::cout << " -- exiting" << std::endl;
return;
}
Expand Down Expand Up @@ -601,8 +602,6 @@ void MultiRunPVValidation(TString namesandlabels, bool lumi_axis_format, bool ti

std::vector<int> intersection;
std::vector<double> runs;
std::vector<double> lumiByRun;
std::map<int, double> lumiMapByRun;
std::vector<double> x_ticks;
std::vector<double> ex_ticks = {0.};

Expand Down Expand Up @@ -640,6 +639,41 @@ void MultiRunPVValidation(TString namesandlabels, bool lumi_axis_format, bool ti
tempSwap.clear();
}

// prelod the lumi from file
std::vector<double> lumiByRun;
std::map<int, double> lumiMapByRun;

bool useLumiByFile = (lumiInputFile.Length() > 0);

if (lumi_axis_format && useLumiByFile) {
std::ifstream lumifile(lumiInputFile.Data());
if (!lumifile) {
std::cout << "Required luminosity from file, but missing input file :(" << std::endl;
std::cout << " -- exiting" << std::endl;
return;
}

std::string line;
double lumiSoFar = 0.0;
while (std::getline(lumifile, line)) {
std::istringstream iss(line);
std::string a, b;
if (!(iss >> a >> b)) {
break;
} // error
int run = std::stoi(a);
double lumi = std::stod(b) / 1000.;

// check if the run is in the list
if (std::find(intersection.begin(), intersection.end(), run) != intersection.end()) {
lumiByRun.push_back(lumiSoFar + lumi);
lumiMapByRun[run] = (lumiSoFar + lumi);
lumiSoFar += lumi;
}
std::cout << run << " ====> lumi so far: " << lumiSoFar << std::endl;
}
}

// debug only
for (UInt_t index = 0; index < intersection.size(); index++) {
std::cout << index << " " << intersection[index] << std::endl;
Expand Down Expand Up @@ -719,9 +753,11 @@ void MultiRunPVValidation(TString namesandlabels, bool lumi_axis_format, bool ti
// we need to re-sum the luminosity so far

for (const auto &run : extractedTrend.m_runs) {
std::cout << run << " " << lumiSoFar + extractedTrend.m_lumiMapByRun[run] << std::endl;
lumiByRun.push_back(lumiSoFar + extractedTrend.m_lumiMapByRun[run]);
lumiMapByRun[run] = (lumiSoFar + extractedTrend.m_lumiMapByRun[run]);
if (!useLumiByFile) {
std::cout << run << " ====> lumi so far: " << lumiSoFar + extractedTrend.m_lumiMapByRun[run] << std::endl;
lumiByRun.push_back(lumiSoFar + extractedTrend.m_lumiMapByRun[run]);
lumiMapByRun[run] = (lumiSoFar + extractedTrend.m_lumiMapByRun[run]);
}
}

lumiSoFar += (extractedTrend.m_lumiSoFar / 1000.);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@
process.offlinePrimaryVerticesFromRefittedTrks.vertexCollections.maxDistanceToBeam = 1
process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxNormalizedChi2 = 20
process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.minSiliconLayersWithHits = 5
process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxD0Significance = 5.0
process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxD0Significance = 5.0
# as it was prior to https://github.com/cms-sw/cmssw/commit/c8462ae4313b6be3bbce36e45373aa6e87253c59
process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxD0Error = 1.0
process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxDzError = 1.0
process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.minPixelLayersWithHits = 2

###################################################################
Expand Down