Skip to content

Commit

Permalink
Merge pull request #41911 from mmusich/AllInOne_ZmumuFixes_13_1_X
Browse files Browse the repository at this point in the history
[13.1.X]  Tracker Alignment: all in one Zmumu fixes
  • Loading branch information
cmsbuild authored Jun 9, 2023
2 parents 5d0812e + 312ba75 commit 67fd0a5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 10 additions & 3 deletions Alignment/OfflineValidation/bin/Zmumumerge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const TString tstring_variables_name[variables_number] = {
void Fitting_GetMassmeanVSvariables(TString inputfile_name, TString output_path) {
TH2D* th2d_mass_variables[variables_number];
TFile* inputfile = TFile::Open(inputfile_name.Data());
TDirectoryFile* tdirectory = (TDirectoryFile*)inputfile->Get("myanalysis");
TDirectoryFile* tdirectory = (TDirectoryFile*)inputfile->Get("DiMuonMassValidation");
for (int i = 0; i < variables_number; i++) {
TString th2d_name = Form("th2d_mass_%s", tstring_variables_name[i].Data());
th2d_mass_variables[i] = (TH2D*)tdirectory->Get(th2d_name);
Expand Down Expand Up @@ -238,12 +238,18 @@ void Draw_TH1D_forMultiRootFiles(const vector<TString>& file_names,
}
lg->Draw("same");
c->SaveAs(output_name);
if (output_name.Contains(".pdf")) {
TString output_name_png(output_name); // output_name is const, copy to modify
output_name_png.Replace(output_name_png.Index(".pdf"), 4, ".png");
c->SaveAs(output_name_png);
}
}

int Zmumumerge(int argc, char* argv[]) {
vector<TString> vec_single_file_path;
vector<TString> vec_single_file_name;
vector<TString> vec_global_tag;
vector<TString> vec_title;
vector<int> vec_color;
vector<int> vec_style;

Expand All @@ -260,6 +266,7 @@ int Zmumumerge(int argc, char* argv[]) {
vec_color.push_back(childTree.second.get<int>("color"));
vec_style.push_back(childTree.second.get<int>("style"));
vec_global_tag.push_back(childTree.second.get<std::string>("globaltag"));
vec_title.push_back(childTree.second.get<std::string>("title"));

//Fitting_GetMassmeanVSvariables(childTree.second.get<std::string>("file") + "/Zmumu.root", childTree.second.get<std::string>("file"));
}
Expand All @@ -278,15 +285,15 @@ int Zmumumerge(int argc, char* argv[]) {
TString th1d_name = Form("th1d_meanmass_%s", tstring_variables_name[idx_variable].Data());
Draw_TH1D_forMultiRootFiles(
vec_single_fittingoutput,
vec_global_tag,
vec_title,
vec_color,
vec_style,
th1d_name,
merge_output + Form("/meanmass_%s_GTs.pdf", tstring_variables_name[idx_variable].Data()));
TString th1d_name_entries = Form("th1d_entries_%s", tstring_variables_name[idx_variable].Data());
Draw_TH1D_forMultiRootFiles(
vec_single_fittingoutput,
vec_global_tag,
vec_title,
vec_color,
vec_style,
th1d_name_entries,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import math
import json
import os
from sys import version_info

import FWCore.ParameterSet.Config as cms
import FWCore.PythonUtilities.LumiList as LumiList
Expand All @@ -26,7 +27,10 @@
# Read in AllInOne config in JSON format
###################################################################
with open(options.config, "r") as configFile:
config = _byteify(json.load(configFile, object_hook=_byteify),ignore_dicts=True)
if version_info.major == 2:
config = _byteify(json.load(configFile, object_hook=_byteify),ignore_dicts=True)
else:
config = json.load(configFile)

###################################################################
# Read filenames from given TXT file
Expand Down

0 comments on commit 67fd0a5

Please sign in to comment.