From 1323619d919964a294fefc7d173ec85c32314b7d Mon Sep 17 00:00:00 2001 From: Victor Schwan Date: Thu, 26 Sep 2024 17:46:55 +0900 Subject: [PATCH 01/13] format material_(plots/scan)_2D.py --- utils/material_plots_2D.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/material_plots_2D.py b/utils/material_plots_2D.py index d67758cf0..ccf40547b 100644 --- a/utils/material_plots_2D.py +++ b/utils/material_plots_2D.py @@ -1,8 +1,9 @@ from __future__ import print_function + import argparse import math - -import sys, os +import os +import sys sys.path.append(os.path.expandvars("$FCCSW") + "/Examples/scripts") from plotstyle import FCCStyle From 04c696394a5d3ed6ff46bd81c535b0732fe132fb Mon Sep 17 00:00:00 2001 From: Victor Schwan Date: Tue, 10 Sep 2024 17:03:52 +0900 Subject: [PATCH 02/13] refactorization, parseArgs added to material_scan_2D.py, thetaRad as angleDef option added to material_plots_2D.py --- utils/material_plots_2D.py | 70 +++++++++++++++++++++++++++++--------- utils/material_scan_2D.py | 59 +++++++++++++++++++++++++++++--- 2 files changed, 108 insertions(+), 21 deletions(-) diff --git a/utils/material_plots_2D.py b/utils/material_plots_2D.py index ccf40547b..c8c529f9d 100644 --- a/utils/material_plots_2D.py +++ b/utils/material_plots_2D.py @@ -1,9 +1,17 @@ +""" +This script must be called with python: 'python material_scan_2D.py --{argument} {value}'. +The output files are saved in data/{outputDir}/name.suffix. +If no outputDir is specified, it will be data/plots/name.suffix. +""" + from __future__ import print_function import argparse import math -import os import sys +from os import fspath +from os.path import expandvars +from pathlib import Path sys.path.append(os.path.expandvars("$FCCSW") + "/Examples/scripts") from plotstyle import FCCStyle @@ -12,7 +20,8 @@ def main(): parser = argparse.ArgumentParser(description="Material Plotter") - parser.add_argument("--fname", "-f", dest="fname", type=str, help="name of file to read") + parser.add_argument("--inputFile", "-f", type=str, help="relative path to the input file") + parser.add_argument("--fname", "-f", dest="inputFile", type=str, help="name of file to read") parser.add_argument( "--angleMin", dest="angleMin", default=6, type=float, help="minimum eta/theta/cosTheta" ) @@ -21,23 +30,29 @@ def main(): ) parser.add_argument( "--angleDef", - dest="angleDef", default="eta", + choices=["eta", "theta", "cosTheta", "thetaRad"], type=str, - help="angle definition to use: eta, theta or cosTheta, default: eta", + help="Angle definition to use: eta, theta, thetaRad or cosTheta; default: eta", ) parser.add_argument( "--angleBinning", "-b", - dest="angleBinning", default=0.05, type=float, - help="eta/theta/cosTheta bin width", + help="Eta/theta/cosTheta bin width", + ) + parser.add_argument( + "--nPhiBins", default=100, type=int, help="Number of bins in phi" ) + parser.add_argument("--x0Max", "-x", default=0.0, type=float, help="Max of x0") parser.add_argument( - "--nPhiBins", dest="nPhiBins", default=100, type=int, help="number of bins in phi" + "--outputDir", + "-o", + type=str, + default="plots", + help="Directory to store output files in", ) - parser.add_argument("--x0max", "-x", dest="x0max", default=0.0, type=float, help="Max of x0") parser.add_argument( "--ignoreMats", "-i", @@ -46,13 +61,18 @@ def main(): default=[], help="List of materials that should be ignored", ) + args = parser.parse_args() + output_dir = Path("data") / args.outputDir + output_dir.mkdir( + parents=True, exist_ok=True + ) # Create the directory if it doesn't exist + ROOT.gStyle.SetNumberContours(100) - f = ROOT.TFile.Open(args.fname, "read") + f = ROOT.TFile.Open(fspath(Path(args.inputFile).with_suffix(".root")), "read") tree = f.Get("materials") - histDict = {} ROOT.gROOT.SetBatch(1) @@ -99,16 +119,31 @@ def main(): entry_x0 += entry.nX0.at(i) * 100.0 entry_lambda += entry.nLambda.at(i) entry_depth += entry.matDepth.at(i) + entry_x0 += entry.nX0.at(i) * 100.0 + entry_lambda += entry.nLambda.at(i) + entry_depth += entry.matDepth.at(i) h_x0.Fill(tree.angle, tree.phi, entry_x0) h_lambda.Fill(tree.angle, tree.phi, entry_lambda) h_depth.Fill(tree.angle, tree.phi, entry_depth) + h_x0.Fill(tree.angle, tree.phi, entry_x0) + h_lambda.Fill(tree.angle, tree.phi, entry_lambda) + h_depth.Fill(tree.angle, tree.phi, entry_depth) - # go through the + # go through the plots plots = ["x0", "lambda", "depth"] histograms = [h_x0, h_lambda, h_depth] +<<<<<<< HEAD axis_titles = ["Material budget x/X_{0} [%]", "Number of #lambda", "Material depth [cm]"] for i in range(len(plots)): +======= + axis_titles = [ + "Material budget x/X_{0} [%]", + "Number of #lambda", + "Material depth [cm]", + ] + for i, plot in enumerate(plots): +>>>>>>> 00de82a (refactorization, parseArgs added to material_scan_2D.py, thetaRad as angleDef option added to material_plots_2D.py) cv = ROOT.TCanvas("", "", 800, 600) cv.SetRightMargin(0.18) histograms[i].Draw("COLZ") @@ -117,6 +152,8 @@ def main(): title = "#eta" elif args.angleDef == "theta": title = "#theta [#circ]" + elif args.angleDef == "thetaRad": + title = "#theta [rad]" elif args.angleDef == "cosTheta": title = "cos(#theta)" histograms[i].GetXaxis().SetTitle(title) @@ -124,15 +161,16 @@ def main(): histograms[i].GetZaxis().SetTitle(axis_titles[i]) - if args.x0max != 0.0 and plots[i] == "x0": - histograms[i].SetMaximum(args.x0max) + if args.x0Max != 0.0 and plot == "x0": + histograms[i].SetMaximum(args.x0Max) histograms[i].GetXaxis().SetRangeUser(args.angleMin, args.angleMax) ROOT.gStyle.SetPadRightMargin(0.5) - cv.Print(plots[i] + ".pdf") - cv.Print(plots[i] + ".png") - cv.SaveAs(plots[i] + ".root") + output_path = output_dir / plot + cv.Print(fspath(output_path.with_suffix(".pdf"))) + cv.Print(fspath(output_path.with_suffix(".png"))) + cv.SaveAs(fspath(output_path.with_suffix(".root"))) if __name__ == "__main__": diff --git a/utils/material_scan_2D.py b/utils/material_scan_2D.py index ab6ee21eb..1886db72a 100644 --- a/utils/material_scan_2D.py +++ b/utils/material_scan_2D.py @@ -1,7 +1,15 @@ -import os -from Gaudi.Configuration import * +<""" +This script must be called with k4run: 'k4run material_scan_2D.py --{argument} {value}'. +The output files are saved in 'data/{outputDir}/{outputFileBase}.root'. +If no outputDir is specified, it will be 'data/{outputFileBase}.root'. +""" + +from os import environ, fspath +from pathlib import Path from Configurables import ApplicationMgr +from Gaudi.Configuration import * +from k4FWCore.parseArgs import parser ApplicationMgr().EvtSel = "None" ApplicationMgr().EvtMax = 1 @@ -10,9 +18,48 @@ # DD4hep geometry service from Configurables import GeoSvc +parser.add_argument( + "--compactFile", + help="Compact detector file to use", + type=str, + default=fspath( + Path(environ["k4geo_DIR"]) + / "ILD" + / "compact" + / "ILD_sl5_v02" + / "ILD_l5_v02.xml" + ), +) +parser.add_argument( + "--outputFileBase", + help="Base name of all the produced output files", + default="out_material_scan", +) +parser.add_argument( + "--angleDef", + help="angle definition to use: eta, theta, cosTheta or thetaRad, default: eta", + choices=["eta", "theta", "cosTheta", "thetaRad"], + default="eta", +) +parser.add_argument( + "--outputDir", + "-o", + type=str, + default="", + help="Directory to store the output file in", +) + +reco_args = parser.parse_known_args()[0] +compact_file = reco_args.compactFile +angle_def = reco_args.angleDef +output_dir = "data" / Path(reco_args.outputDir) +output_dir.mkdir( + parents=True, exist_ok=True +) # Create the directory if it doesn't exist + ## parse the given xml file geoservice = GeoSvc("GeoSvc") -geoservice.detectors = ["IDEA_o1_v02.xml"] +geoservice.detectors = [compact_file] geoservice.OutputLevel = INFO ApplicationMgr().ExtSvc += [geoservice] @@ -24,9 +71,11 @@ # For instance adding envelopeName="BoundaryPostCalorimetry" will perform the scan only till the end of calorimetry. # BoundaryPostCalorimetry is defined in Detector/DetFCChhECalInclined/compact/envelopePreCalo.xml materialservice = MaterialScan_2D_genericAngle("GeoDump") -materialservice.filename = "out_material_scan.root" +materialservice.filename = fspath( + output_dir / Path(reco_args.outputFileBase).with_suffix(".root") +) -materialservice.angleDef = "eta" # eta, theta, cosTheta or thetaRad +materialservice.angleDef = angle_def # eta, theta, cosTheta or thetaRad materialservice.angleBinning = 0.05 materialservice.angleMax = 3.0 materialservice.angleMin = -3.0 From 83e7be06032392ceb8a9171c9381b229dbf69f12 Mon Sep 17 00:00:00 2001 From: Victor Schwan Date: Thu, 26 Sep 2024 10:55:08 +0900 Subject: [PATCH 03/13] outsource creation of 2D hists to function --- utils/material_plots_2D.py | 51 ++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/utils/material_plots_2D.py b/utils/material_plots_2D.py index c8c529f9d..ec5e8bd22 100644 --- a/utils/material_plots_2D.py +++ b/utils/material_plots_2D.py @@ -18,6 +18,24 @@ import ROOT +def create_histogram( + name_and_title: str, argument_name_space: argparse.Namespace +) -> ROOT.TH2F: + return ROOT.TH2F( + name_and_title, + name_and_title, + int( + (argument_name_space.angleMax - argument_name_space.angleMin) + / argument_name_space.angleBinning + ), + argument_name_space.angleMin, + argument_name_space.angleMax, + argument_name_space.nPhiBins, + -math.pi, + math.pi, + ) + + def main(): parser = argparse.ArgumentParser(description="Material Plotter") parser.add_argument("--inputFile", "-f", type=str, help="relative path to the input file") @@ -76,36 +94,9 @@ def main(): ROOT.gROOT.SetBatch(1) - h_x0 = ROOT.TH2F( - "h_x0", - "h_x0", - int((args.angleMax - args.angleMin) / args.angleBinning), - args.angleMin, - args.angleMax, - args.nPhiBins, - -math.pi, - math.pi, - ) - h_lambda = ROOT.TH2F( - "h_lambda", - "h_lambda", - int((args.angleMax - args.angleMin) / args.angleBinning), - args.angleMin, - args.angleMax, - args.nPhiBins, - -math.pi, - math.pi, - ) - h_depth = ROOT.TH2F( - "h_depth", - "h_depth", - int((args.angleMax - args.angleMin) / args.angleBinning), - args.angleMin, - args.angleMax, - args.nPhiBins, - -math.pi, - math.pi, - ) + h_x0 = create_histogram("h_x0", args) + h_lambda = create_histogram("h_lambda", args) + h_depth = create_histogram("h_depth", args) for angleBinning, entry in enumerate(tree): nMat = entry.nMaterials From 29b2a29a28343b62adeb2b4a30e1bd0c6e789acd Mon Sep 17 00:00:00 2001 From: Victor Schwan <162138084+Victor-Schwan@users.noreply.github.com> Date: Fri, 27 Sep 2024 12:28:16 +0200 Subject: [PATCH 04/13] fix x0max user interface Co-authored-by: Thomas Madlener --- utils/material_plots_2D.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/material_plots_2D.py b/utils/material_plots_2D.py index ec5e8bd22..8f569d3c7 100644 --- a/utils/material_plots_2D.py +++ b/utils/material_plots_2D.py @@ -63,7 +63,7 @@ def main(): parser.add_argument( "--nPhiBins", default=100, type=int, help="Number of bins in phi" ) - parser.add_argument("--x0Max", "-x", default=0.0, type=float, help="Max of x0") + parser.add_argument("--x0max", "-x", default=0.0, type=float, help="Max of x0") parser.add_argument( "--outputDir", "-o", From dd2f0ecda1e42474fa523a2e36e246247d1a4efc Mon Sep 17 00:00:00 2001 From: tmadlener Date: Tue, 1 Oct 2024 13:13:21 +0200 Subject: [PATCH 05/13] Fix inputFile arg parsing --- utils/material_plots_2D.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/material_plots_2D.py b/utils/material_plots_2D.py index 8f569d3c7..c1154d4ea 100644 --- a/utils/material_plots_2D.py +++ b/utils/material_plots_2D.py @@ -38,8 +38,9 @@ def create_histogram( def main(): parser = argparse.ArgumentParser(description="Material Plotter") - parser.add_argument("--inputFile", "-f", type=str, help="relative path to the input file") - parser.add_argument("--fname", "-f", dest="inputFile", type=str, help="name of file to read") + parser.add_argument( + "--inputFile", "--fname", "-f", type=str, help="relative path to the input file" + ) parser.add_argument( "--angleMin", dest="angleMin", default=6, type=float, help="minimum eta/theta/cosTheta" ) From 22d7ee518f6ff3dd6fd89b98769fcb4218b4d4db Mon Sep 17 00:00:00 2001 From: tmadlener Date: Tue, 1 Oct 2024 13:13:44 +0200 Subject: [PATCH 06/13] Remove leftover conflict markers --- utils/material_plots_2D.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/utils/material_plots_2D.py b/utils/material_plots_2D.py index c1154d4ea..990ca9244 100644 --- a/utils/material_plots_2D.py +++ b/utils/material_plots_2D.py @@ -125,17 +125,8 @@ def main(): # go through the plots plots = ["x0", "lambda", "depth"] histograms = [h_x0, h_lambda, h_depth] -<<<<<<< HEAD axis_titles = ["Material budget x/X_{0} [%]", "Number of #lambda", "Material depth [cm]"] - for i in range(len(plots)): -======= - axis_titles = [ - "Material budget x/X_{0} [%]", - "Number of #lambda", - "Material depth [cm]", - ] for i, plot in enumerate(plots): ->>>>>>> 00de82a (refactorization, parseArgs added to material_scan_2D.py, thetaRad as angleDef option added to material_plots_2D.py) cv = ROOT.TCanvas("", "", 800, 600) cv.SetRightMargin(0.18) histograms[i].Draw("COLZ") From e07385fa9aa8c8d67203996678e68a993b2202f5 Mon Sep 17 00:00:00 2001 From: tmadlener Date: Tue, 1 Oct 2024 13:14:13 +0200 Subject: [PATCH 07/13] Complete switch back to x0max --- utils/material_plots_2D.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/material_plots_2D.py b/utils/material_plots_2D.py index 990ca9244..36c5104b3 100644 --- a/utils/material_plots_2D.py +++ b/utils/material_plots_2D.py @@ -144,8 +144,8 @@ def main(): histograms[i].GetZaxis().SetTitle(axis_titles[i]) - if args.x0Max != 0.0 and plot == "x0": - histograms[i].SetMaximum(args.x0Max) + if args.x0max != 0.0 and plot == "x0": + histograms[i].SetMaximum(args.x0max) histograms[i].GetXaxis().SetRangeUser(args.angleMin, args.angleMax) From 4b06fcb0a46134777c820100ac62f8a83bfe0ee5 Mon Sep 17 00:00:00 2001 From: tmadlener Date: Tue, 1 Oct 2024 13:15:39 +0200 Subject: [PATCH 08/13] Remove stray conflict marker remnants --- utils/material_scan_2D.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/material_scan_2D.py b/utils/material_scan_2D.py index 1886db72a..86f4625cf 100644 --- a/utils/material_scan_2D.py +++ b/utils/material_scan_2D.py @@ -1,4 +1,4 @@ -<""" +""" This script must be called with k4run: 'k4run material_scan_2D.py --{argument} {value}'. The output files are saved in 'data/{outputDir}/{outputFileBase}.root'. If no outputDir is specified, it will be 'data/{outputFileBase}.root'. From 8fa71c2f230fadda88dba3f505b8bf1af1130b1b Mon Sep 17 00:00:00 2001 From: tmadlener Date: Tue, 1 Oct 2024 13:20:47 +0200 Subject: [PATCH 09/13] Fix formatting --- utils/material_plots_2D.py | 12 +++--------- utils/material_scan_2D.py | 14 +++----------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/utils/material_plots_2D.py b/utils/material_plots_2D.py index 36c5104b3..13ffa46ca 100644 --- a/utils/material_plots_2D.py +++ b/utils/material_plots_2D.py @@ -18,9 +18,7 @@ import ROOT -def create_histogram( - name_and_title: str, argument_name_space: argparse.Namespace -) -> ROOT.TH2F: +def create_histogram(name_and_title: str, argument_name_space: argparse.Namespace) -> ROOT.TH2F: return ROOT.TH2F( name_and_title, name_and_title, @@ -61,9 +59,7 @@ def main(): type=float, help="Eta/theta/cosTheta bin width", ) - parser.add_argument( - "--nPhiBins", default=100, type=int, help="Number of bins in phi" - ) + parser.add_argument("--nPhiBins", default=100, type=int, help="Number of bins in phi") parser.add_argument("--x0max", "-x", default=0.0, type=float, help="Max of x0") parser.add_argument( "--outputDir", @@ -84,9 +80,7 @@ def main(): args = parser.parse_args() output_dir = Path("data") / args.outputDir - output_dir.mkdir( - parents=True, exist_ok=True - ) # Create the directory if it doesn't exist + output_dir.mkdir(parents=True, exist_ok=True) # Create the directory if it doesn't exist ROOT.gStyle.SetNumberContours(100) diff --git a/utils/material_scan_2D.py b/utils/material_scan_2D.py index 86f4625cf..c59a9b757 100644 --- a/utils/material_scan_2D.py +++ b/utils/material_scan_2D.py @@ -23,11 +23,7 @@ help="Compact detector file to use", type=str, default=fspath( - Path(environ["k4geo_DIR"]) - / "ILD" - / "compact" - / "ILD_sl5_v02" - / "ILD_l5_v02.xml" + Path(environ["k4geo_DIR"]) / "ILD" / "compact" / "ILD_sl5_v02" / "ILD_l5_v02.xml" ), ) parser.add_argument( @@ -53,9 +49,7 @@ compact_file = reco_args.compactFile angle_def = reco_args.angleDef output_dir = "data" / Path(reco_args.outputDir) -output_dir.mkdir( - parents=True, exist_ok=True -) # Create the directory if it doesn't exist +output_dir.mkdir(parents=True, exist_ok=True) # Create the directory if it doesn't exist ## parse the given xml file geoservice = GeoSvc("GeoSvc") @@ -71,9 +65,7 @@ # For instance adding envelopeName="BoundaryPostCalorimetry" will perform the scan only till the end of calorimetry. # BoundaryPostCalorimetry is defined in Detector/DetFCChhECalInclined/compact/envelopePreCalo.xml materialservice = MaterialScan_2D_genericAngle("GeoDump") -materialservice.filename = fspath( - output_dir / Path(reco_args.outputFileBase).with_suffix(".root") -) +materialservice.filename = fspath(output_dir / Path(reco_args.outputFileBase).with_suffix(".root")) materialservice.angleDef = angle_def # eta, theta, cosTheta or thetaRad materialservice.angleBinning = 0.05 From 48efc9682cb395694653477fa742575c4c7d903e Mon Sep 17 00:00:00 2001 From: Victor Schwan Date: Tue, 15 Oct 2024 17:03:27 +0200 Subject: [PATCH 10/13] bug fix and switch to os.smth to ease searching for usage --- utils/material_plots_2D.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/utils/material_plots_2D.py b/utils/material_plots_2D.py index 13ffa46ca..ec494103d 100644 --- a/utils/material_plots_2D.py +++ b/utils/material_plots_2D.py @@ -8,9 +8,8 @@ import argparse import math +import os import sys -from os import fspath -from os.path import expandvars from pathlib import Path sys.path.append(os.path.expandvars("$FCCSW") + "/Examples/scripts") @@ -84,7 +83,7 @@ def main(): ROOT.gStyle.SetNumberContours(100) - f = ROOT.TFile.Open(fspath(Path(args.inputFile).with_suffix(".root")), "read") + f = ROOT.TFile.Open(os.fspath(Path(args.inputFile).with_suffix(".root")), "read") tree = f.Get("materials") ROOT.gROOT.SetBatch(1) @@ -145,9 +144,9 @@ def main(): ROOT.gStyle.SetPadRightMargin(0.5) output_path = output_dir / plot - cv.Print(fspath(output_path.with_suffix(".pdf"))) - cv.Print(fspath(output_path.with_suffix(".png"))) - cv.SaveAs(fspath(output_path.with_suffix(".root"))) + cv.Print(os.fspath(output_path.with_suffix(".pdf"))) + cv.Print(os.fspath(output_path.with_suffix(".png"))) + cv.SaveAs(os.fspath(output_path.with_suffix(".root"))) if __name__ == "__main__": From c9eaae3af192ef630b86dce486c0799f6fdcdd0f Mon Sep 17 00:00:00 2001 From: Victor Schwan Date: Tue, 15 Oct 2024 17:27:11 +0200 Subject: [PATCH 11/13] make create_histogram function more reusable --- utils/material_plots_2D.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/utils/material_plots_2D.py b/utils/material_plots_2D.py index ec494103d..8237c9df8 100644 --- a/utils/material_plots_2D.py +++ b/utils/material_plots_2D.py @@ -17,17 +17,21 @@ import ROOT -def create_histogram(name_and_title: str, argument_name_space: argparse.Namespace) -> ROOT.TH2F: +def create_histogram( + name_and_title: str, + angle_min: float, + angle_max: float, + angle_binning: float, + n_phi_bins: int, +) -> ROOT.TH2F: + num_bins = int((angle_max - angle_min) / angle_binning) return ROOT.TH2F( name_and_title, name_and_title, - int( - (argument_name_space.angleMax - argument_name_space.angleMin) - / argument_name_space.angleBinning - ), - argument_name_space.angleMin, - argument_name_space.angleMax, - argument_name_space.nPhiBins, + num_bins, + angle_min, + angle_max, + n_phi_bins, -math.pi, math.pi, ) @@ -88,9 +92,9 @@ def main(): ROOT.gROOT.SetBatch(1) - h_x0 = create_histogram("h_x0", args) - h_lambda = create_histogram("h_lambda", args) - h_depth = create_histogram("h_depth", args) + h_x0 = create_histogram("h_x0", args.angleMin, args.angleMax, args.angleBinning, args.nPhiBins) + h_lambda = create_histogram("h_lambda", args.angleMin, args.angleMax, args.angleBinning, args.nPhiBins) + h_depth = create_histogram("h_depth", args.angleMin, args.angleMax, args.angleBinning, args.nPhiBins) for angleBinning, entry in enumerate(tree): nMat = entry.nMaterials From 31821f8148dcbe752857f36f877500277e9967d1 Mon Sep 17 00:00:00 2001 From: Victor Schwan Date: Tue, 15 Oct 2024 17:29:00 +0200 Subject: [PATCH 12/13] remove double definitions --- utils/material_plots_2D.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/utils/material_plots_2D.py b/utils/material_plots_2D.py index 8237c9df8..a978b6288 100644 --- a/utils/material_plots_2D.py +++ b/utils/material_plots_2D.py @@ -108,16 +108,10 @@ def main(): entry_x0 += entry.nX0.at(i) * 100.0 entry_lambda += entry.nLambda.at(i) entry_depth += entry.matDepth.at(i) - entry_x0 += entry.nX0.at(i) * 100.0 - entry_lambda += entry.nLambda.at(i) - entry_depth += entry.matDepth.at(i) h_x0.Fill(tree.angle, tree.phi, entry_x0) h_lambda.Fill(tree.angle, tree.phi, entry_lambda) h_depth.Fill(tree.angle, tree.phi, entry_depth) - h_x0.Fill(tree.angle, tree.phi, entry_x0) - h_lambda.Fill(tree.angle, tree.phi, entry_lambda) - h_depth.Fill(tree.angle, tree.phi, entry_depth) # go through the plots plots = ["x0", "lambda", "depth"] From c402f69c30b50763dff3aa237b123ccb248fc424 Mon Sep 17 00:00:00 2001 From: Victor Schwan Date: Tue, 15 Oct 2024 17:35:08 +0200 Subject: [PATCH 13/13] make ruff happy --- utils/material_plots_2D.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/material_plots_2D.py b/utils/material_plots_2D.py index a978b6288..e6ed7e3de 100644 --- a/utils/material_plots_2D.py +++ b/utils/material_plots_2D.py @@ -93,8 +93,12 @@ def main(): ROOT.gROOT.SetBatch(1) h_x0 = create_histogram("h_x0", args.angleMin, args.angleMax, args.angleBinning, args.nPhiBins) - h_lambda = create_histogram("h_lambda", args.angleMin, args.angleMax, args.angleBinning, args.nPhiBins) - h_depth = create_histogram("h_depth", args.angleMin, args.angleMax, args.angleBinning, args.nPhiBins) + h_lambda = create_histogram( + "h_lambda", args.angleMin, args.angleMax, args.angleBinning, args.nPhiBins + ) + h_depth = create_histogram( + "h_depth", args.angleMin, args.angleMax, args.angleBinning, args.nPhiBins + ) for angleBinning, entry in enumerate(tree): nMat = entry.nMaterials