Skip to content

Commit 279cb08

Browse files
authored
Fix LUT creation (#38)
- Enforcing seed set in pythia
1 parent a058f94 commit 279cb08

File tree

4 files changed

+48
-21
lines changed

4 files changed

+48
-21
lines changed

examples/scripts/createO2tables.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def run_cmd(cmd, comment=""):
5656
if content:
5757
verbose_msg("++", content.strip())
5858
if "Encountered error" in content:
59-
msg("[WARNING] Error encountered runtime in", cmd, color=bcolors.BWARNING)
59+
msg("[WARNING] Error encountered runtime in",
60+
cmd, color=bcolors.BWARNING)
6061
except:
6162
fatal_msg("Error while running", cmd)
6263

@@ -239,7 +240,8 @@ def write_to_runner(line, log_file=None, check_status=False):
239240
if check_status:
240241
f_run.write("\nReturnValue=$?\n")
241242
f_run.write("if [[ $ReturnValue != 0 ]]; then\n")
242-
f_run.write(f" echo \"Encountered error with command '{line.strip()}'\"\n")
243+
f_run.write(
244+
f" echo \"Encountered error with command '{line.strip()}'\"\n")
243245
f_run.write(" exit $ReturnValue\n")
244246
f_run.write("fi\n")
245247

@@ -270,7 +272,9 @@ def copy_and_link(file_name):
270272
# Adjust configuration file
271273
with open(generator_cfg, "a") as f_cfg:
272274
# number of events and random seed
275+
f_cfg.write(f"\n\n\n#### Additional part ###\n\n\n\n")
273276
f_cfg.write(f"Main:numberOfEvents {nevents}\n")
277+
f_cfg.write(f"Random:setSeed = on\n")
274278
f_cfg.write(f"Random:seed = {run_number}\n")
275279
# collision time spread [mm/c]
276280
f_cfg.write("Beams:allowVertexSpread on \n")

src/lutWrite.its1.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ void lutWrite_its1(const char *filename = "lutCovm.dat", int pdg = 211,
2525
// init FAT
2626
fatInit_its1(field, rmin);
2727
// write
28-
lutWrite(filename, pdg, field, rmin);
28+
lutWrite(filename, pdg, field);
2929
}

src/lutWrite.its2.cc

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,21 @@ void fatInit_its2(float field = 0.5, float rmin = 100.) {
1313
fat.AddLayer((char *)"vertex", 0, 0); // dummy vertex for matrix calculation
1414

1515
// new ideal Pixel properties?
16-
Double_t x0 = 0.0050;
16+
Double_t x0IB = 0.0035; // X/X0 of the inner barrel (first three layers)
17+
Double_t x0OB = 0.008; // X/X0 of the outer barrel
1718
Double_t resRPhi = 0.0006;
1819
Double_t resZ = 0.0006;
1920
Double_t eff = 0.98;
20-
Double_t xrhoOB = 1.1646e-01; // 500 mum Si
21+
Double_t xrhoIB = 1.1646e-02; // Surface density for 50 mum thick Si
22+
Double_t xrhoOB = 1.1646e-01; // Surface density for 500 mum thick Si
2123

22-
fat.AddLayer((char *)"ddd1", 2.3, x0, xrhoOB, resRPhi, resZ, eff);
23-
fat.AddLayer((char *)"ddd2", 3.1, x0, xrhoOB, resRPhi, resZ, eff);
24-
fat.AddLayer((char *)"ddd3", 3.9, x0, xrhoOB, resRPhi, resZ, eff);
25-
fat.AddLayer((char *)"ddd4", 19.4, x0, xrhoOB, resRPhi, resZ, eff);
26-
fat.AddLayer((char *)"ddd5", 24.7, x0, xrhoOB, resRPhi, resZ, eff);
27-
fat.AddLayer((char *)"ddd6", 35.3, x0, xrhoOB, resRPhi, resZ, eff);
28-
fat.AddLayer((char *)"ddd7", 40.5, x0, xrhoOB, resRPhi, resZ, eff);
24+
fat.AddLayer((char *)"ddd1", 2.3, x0IB, xrhoIB, resRPhi, resZ, eff);
25+
fat.AddLayer((char *)"ddd2", 3.1, x0IB, xrhoIB, resRPhi, resZ, eff);
26+
fat.AddLayer((char *)"ddd3", 3.9, x0IB, xrhoIB, resRPhi, resZ, eff);
27+
fat.AddLayer((char *)"ddd4", 19.4, x0OB, xrhoOB, resRPhi, resZ, eff);
28+
fat.AddLayer((char *)"ddd5", 24.7, x0OB, xrhoOB, resRPhi, resZ, eff);
29+
fat.AddLayer((char *)"ddd6", 35.3, x0OB, xrhoOB, resRPhi, resZ, eff);
30+
fat.AddLayer((char *)"ddd7", 40.5, x0OB, xrhoOB, resRPhi, resZ, eff);
2931

3032
fat.AddTPC(0.1, 0.1); // TPC
3133
fat.SetAtLeastHits(4);
@@ -43,5 +45,5 @@ void lutWrite_its2(const char *filename = "lutCovm.dat", int pdg = 211,
4345
// init FAT
4446
fatInit_its2(field, rmin);
4547
// write
46-
lutWrite(filename, pdg, field, rmin);
48+
lutWrite(filename, pdg, field);
4749
}

src/lutWrite.its3.cc

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,49 @@
55

66
#include "lutWrite.cc"
77

8+
// Adds foam spacers between inner layers
9+
const bool add_foam = true;
10+
// Puts foam spacers mid-way betwen layers
11+
const bool foam_middle = false;
12+
813
void fatInit_its3(float field = 0.5, float rmin = 100.) {
914
fat.SetBField(field);
1015
fat.SetdNdEtaCent(400.);
1116

12-
fat.AddLayer((char *)"bpipe", 1.6, 0.0022); // beam pipe
13-
fat.AddLayer((char *)"vertex", 0, 0); // dummy vertex for matrix calculation
17+
Double_t x0BP = 0.0014; // 500 mum Be
18+
Double_t xrhoBP = 9.24e-02; // 500 mum Be
19+
20+
// dummy vertex for matrix calculation
21+
fat.AddLayer((char *)"vertex", 0.0, 0, 0);
22+
fat.AddLayer((char *)"bpipe", 1.625, x0BP, xrhoBP); // 500 mum Be beam pipe
1423

15-
// new ideal Pixel properties?
1624
Double_t x0IB = 0.0005; // X/X0 of the inner barrel (first three layers)
17-
Double_t x0OB = 0.0035; // X/X0 of the outer barrel
25+
Double_t x0OB = 0.008; // X/X0 of the outer barrel
1826
Double_t resRPhi = 0.0006; // Resolution in Rphi
1927
Double_t resZ = 0.0006; // Resolution in Z
2028
Double_t eff = 0.98; // Efficiency
2129
Double_t xrhoIB = 1.1646e-02; // Surface density for 50 mum thick Si
2230
Double_t xrhoOB = 1.1646e-01; // Surface density for 500 mum thick Si
2331

32+
const Double_t x0Foam = 0.0008; // X0 ~710cm for 0.6cm thick foam
33+
float foam_radius = 9.370 * x0IB; // width of a chip
34+
2435
fat.AddLayer((char *)"ddd1", 1.8, x0IB, xrhoIB, resRPhi, resZ, eff);
25-
fat.AddLayer((char *)"foam1", 1.8 + 9.370 * x0IB, 0.0008); // Foam spacer
36+
if (foam_middle)
37+
foam_radius = (2.4 - 1.8) / 2;
38+
if (add_foam)
39+
fat.AddLayer((char *)"foam1", 1.8 + foam_radius, x0Foam); // Foam spacer
2640
fat.AddLayer((char *)"ddd2", 2.4, x0IB, xrhoIB, resRPhi, resZ, eff);
27-
fat.AddLayer((char *)"foam2", 2.4 + 9.370 * x0IB, 0.0008); // Foam spacer
41+
if (foam_middle)
42+
foam_radius = (3.0 - 2.4) / 2;
43+
if (add_foam)
44+
fat.AddLayer((char *)"foam2", 2.4 + foam_radius, x0Foam); // Foam spacer
2845
fat.AddLayer((char *)"ddd3", 3.0, x0IB, xrhoIB, resRPhi, resZ, eff);
29-
fat.AddLayer((char *)"foam3", 3.0 + 9.370 * x0IB, 0.0008); // Foam spacer
46+
if (foam_middle)
47+
foam_radius = (19.4 - 3.0) / 2;
48+
if (add_foam)
49+
fat.AddLayer((char *)"foam3", 3.0 + foam_radius, x0Foam); // Foam spacer
50+
// Structural cylinder?
3051
fat.AddLayer((char *)"ddd4", 19.4, x0OB, xrhoOB, resRPhi, resZ, eff);
3152
fat.AddLayer((char *)"ddd5", 24.7, x0OB, xrhoOB, resRPhi, resZ, eff);
3253
fat.AddLayer((char *)"ddd6", 35.3, x0OB, xrhoOB, resRPhi, resZ, eff);
@@ -48,5 +69,5 @@ void lutWrite_its3(const char *filename = "lutCovm.dat", int pdg = 211,
4869
// init FAT
4970
fatInit_its3(field, rmin);
5071
// write
51-
lutWrite(filename, pdg, field, rmin);
72+
lutWrite(filename, pdg, field);
5273
}

0 commit comments

Comments
 (0)