FairShip
Loading...
Searching...
No Matches
run_prod.py
Go to the documentation of this file.
1# SPDX-License-Identifier: LGPL-3.0-or-later
2# SPDX-FileCopyrightText: Copyright CERN for the benefit of the SHiP Collaboration
3
4import os
5import time
6
7import ROOT
8
9
10def makeProd(prefix, DY, y: bool = False, phiRandom: bool = False, X=None) -> None:
11 ncpu = 9
12 shipsoft = os.environ["SHIPSOFT"].replace("/dev", "")
13 if not y:
14 f = shipsoft + "/data/pythia8_Geant4_onlyMuons.root"
15 cmd = "python $FAIRSHIP/macro/run_simScript.py --MuonBack -f " + f + " -Y " + str(float(DY)) # --display"
16 elif y == "Jpsi":
17 f = shipsoft + "/data/pythia8_Geant4_Jpsi_onlyMuons.root"
18 cmd = "python $FAIRSHIP/macro/run_simScript.py --MuonBack -f " + f + " -Y " + str(float(DY)) # --display"
19 else:
20 f = shipsoft + "/data/pythia8_Geant4_Yandex_onlyMuons.root"
21 cmd = "python $FAIRSHIP/macro/run_simScript.py --MuonBack -f " + f + " -Y " + str(float(DY)) # --display"
22 if phiRandom:
23 cmd = cmd + " --phiRandom"
24 fn = ROOT.TFile(f)
25 sTree = fn.FindObjectAny("pythia8-Geant4")
26 ntot = sTree.GetEntries()
27 fn.Close()
28 ns = 0
29 n3 = int(ntot / ncpu)
30 for i in range(1, ncpu + 1):
31 d = prefix + str(i)
32 if d not in os.listdir("."):
33 os.system("mkdir " + d)
34 os.chdir("./" + prefix + "1")
35 for i in range(1, ncpu + 1):
36 if i == ncpu:
37 n3 = ntot - (i - 1) * n3
38 if X:
39 if i == X:
40 os.system("cp $FAIRSHIP/macro/run_simScript.py .")
41 os.system(cmd + " -n " + str(n3) + " -i " + str(ns) + " > log &")
42 else:
43 os.system("cp $FAIRSHIP/macro/run_simScript.py .")
44 os.system(cmd + " -n " + str(n3) + " -i " + str(ns) + " > log &")
45 time.sleep(5)
46 # print " -n "+str(n3)+" -i "+str(ns)
47 ns += n3
48 if i == ncpu:
49 os.chdir("../")
50 break
51 os.chdir("../" + prefix + str(i + 1))
52
53
54#
55# 11-19 with QGSP_BERT_EMV instead of QGSP_BERT_HP_PEN
56# 51-59 passive shielding
57# 41-49 fixed field horizontal
58# 61-69 chamber with vacuum
59# 71-79 without field in the wings
60# 81-89 add shielding
61# 91-99 also 111-119 switch off muBrems, muPair
62# 101-109 vacuum tube as cone, Al->Steel
63# 121-129 switch off only muIoni
64# 151-159 vacuum tube as cone, Al->Steel, air in cave
65# 161-169 new geometry
66# 251-259 passive shielding with concrete walls
67# 171-179 new increased Bdl, 2.5m clearance from start, 9m space for tau
68# 181-189 even more field, narrow tunnel around first magnet, add 2m hadron absorber
69# 311-314 change numbering of veto volumes
70# 321-324 1 Teslas
71# 331-339 added TauSensitive, fixed C1, using muons from Yandex
72# 341-349 should be the same as 331-339
73# 351-354 fixed RpcPoints, fixed field ! also - 359 made on t3
74# 361-364 4m high magnets!
75# 371-374 new strawpoints with magC1 fixed
76# 381-389 yandex file, overwrite with magC1 fixed
77# 391-399 change to dY = 2m
78# 401-409 change to dY = 2m Yandex
79# 411-419 back to dY = 4m, add sensitive plance downstream det2
80# 421-429 reduce size of vacuum tank before veto station, add pdgcode for muonPoint, move det2 closer
81# 431-439 reduce size of vacuum tank before veto station, add pdgcode for muonPoint, move det2 closer Yandex
82# 441-449 try with increased tau mu detector, and reduced height of active muon shield, dy=1m
83# 451-459 try with increased tau mu detector, and reduced height of active muon shield, dy=1m Yandex
84# 461-469 dy=4m and then 1m, RPC fixed, display on
85# 471-479 dy=4m and then 1m, RPC fixed, Yandex
86# 481-489 dy=4m and then 1m, RPC fixed, display OFF
87# 491-499 back to dy=1m display on
88# 501-509 dy=4m for last magnet part, display on
89# 511-519 dy=2,3,4m for last magnet parts, display on
90# 521-529 removal of almost overlaps
91# 551-554 ultimate slim design
92# 561-564 fixing overlaps hcal and almost overlaps in magnets
93# 571-574 more undetected overlaps fixed
94# 581-584 test with replacing tungsten core with iron
95# reuse the following, minor mod det2 with shielding, different lengths, new fine tuned active shield, no hcal overlap
96# new scaling of L vs Y
97# 591-599 6m height
98# 601-609 6m height, Yandex data
99# 610-619 10m height
100# 620-629 10m height, Yandex data
101#
102# 630-639 10m height, change RPC width 4.5->3.6m
103# 640-649 6m height, change RPC width 4.5->3.6m
104# makeProd("muon59",6,False) #
105# makeProd("muon60",6,True) #
106# makeProd("muon61",10,False) #
107# makeProd("muon62",10,True) #
108
109# makeProd("muon63",10,False) #
110# makeProd("muon64",10,True) #
111# makeProd("muon65",6,False) #
112# makeProd("muon66",6,True) #
113
114# run more statistics, 61, 62
115# makeProd("muon611",10,False,True)
116# makeProd("muon621",10,True,True)
117# makeProd("muon612",10,False,True)
118# makeProd("muon622",10,True,True)
119# makeProd("muon613",10,False,True)
120# makeProd("muon623",10,True,True)
121# makeProd("muon614",10,False,True)
122# makeProd("muon624",10,True,True)
123# makeProd("muon615",10,False,True)
124# makeProd("muon625",10,True,True)
125# makeProd("muon616",10,False,True)
126# makeProd("muon626",10,True,True)
127# makeProd("muon617",10,False,True)
128# makeProd("muon627",10,True,True)
129# makeProd("muon618",10,False,True)
130# makeProd("muon628",10,True,True)
131# makeProd("muon619",10,False,True)
132# makeProd("muon629",10,True,True)
133# makeProd("muon700",10,False,False) # switch off field of active shielding # prefix,DY,y=False,phiRandom=False,X=None
134# makeProd("muon710",10,False,False) # start production with beam smeared on r=3cm disk
135# makeProd("muon720",10,True,False)
136# makeProd("muon711",10,False,True) # start production with beam smeared on r=3cm disk
137# makeProd("muon721",10,True,True)
138# makeProd("muon712",10,False,True) # start production with beam smeared on r=3cm disk
139# makeProd("muon722",10,True,True)
140# makeProd("muon713",10,False,True) # start production with beam smeared on r=3cm disk
141# makeProd("muon723",10,True,True)
142# makeProd("muon714",10,False,True) # start production with beam smeared on r=3cm disk
143# makeProd("muon724",10,True,True)
144# makeProd("muon715",10,False,True) # start production with beam smeared on r=3cm disk
145# makeProd("muon725",10,True,True)
146# makeProd("muon716",10,False,True) # start production with beam smeared on r=3cm disk
147# makeProd("muon726",10,True,True)
148# makeProd("muon717",10,False,True) # start production with beam smeared on r=3cm disk
149# makeProd("muon777",10,False,True) # in case the other one does not work 717
150# makeProd("muon727",10,True,True) # ?
151# makeProd("muon718",10,False,True) # start production with beam smeared on r=3cm disk
152# makeProd("muon728",10,True,True)
153# makeProd("muon719",10,False,True) # start production with beam smeared on r=3cm disk
154# makeProd("muon729",10,True,True) #
155# makeProd("muon730",10,'Jpsi',False) # made with E50
156# makeProd("muon731",10,'Jpsi',True) # made with E50
157# makeProd("muon732",10,'Jpsi',True) # made with E50
158# makeProd("muon733",10,'Jpsi',True) # back to pencil beam
159# makeProd("muon630",10,False,True) # test with new muonShield code, 3cm smearing
160# makeProd("muon631",10,False,True) # run with concrete wall enabled as sensitive
161# makeProd("muon632",10,False,True) # run with concrete wall enabled as sensitive, active shielding polarity fixed
162# but wrong geometry
163# makeProd("muon810",10,False,False) # start production with latest geometry
164# makeProd("muon820",10,True,False)
165# makeProd("muon811",10,False,True) #
166# makeProd("muon821",10,True,True)
167
174
175# makeProd("muon814",10,False,True) #
176# makeProd("muon824",10,True,True)
177# makeProd("muon815",10,False,True)
178# makeProd("muon825",10,True,True)
179# makeProd("muon816",10,False,True)
180# makeProd("muon826",10,True,True)
181# makeProd("muon817",10,False,True)
182# makeProd("muon827",10,True,True)
183# makeProd("muon818",10,False,True)
184# makeProd("muon828",10,True,True)
185# makeProd("muon819",10,False,True)
186# makeProd("muon829",10,True,True)
187# makeProd("muon910",10,False,True)
188# makeProd("muon920",10,True,True)
189# makeProd("muon911",10,False,True)
190# makeProd("muon921",10,True,True)
191
192# makeProd("muon912",10,False,True)
193# makeProd("muon922",10,True,True)
194
195# makeProd("muon913",10,False,True)
196# makeProd("muon923",10,True,True)
197# makeProd("muon914",10,False,True)
198# makeProd("muon924",10,True,True)
199# makeProd("muon915",10,False,True)
200# makeProd("muon925",10,True,True)
201# makeProd("muon916",10,False,True)
202# makeProd("muon926",10,True,True)
203# makeProd("muon917",10,False,True)
204# makeProd("muon927",10,True,True)
205# makeProd("muon927",10,True,True,8)
206# makeProd("muon918",10,False,True)
207# makeProd("muon928",10,True,True)
208# makeProd("muon919",10,False,True)
209# makeProd("muon929",10,True,True)
210# makeProd("muon1019",10,False,True)
211# makeProd("muon1029",10,True,True)
212# makeProd("muon1018",10,False,True)
213# makeProd("muon1028",10,True,True)
214# makeProd("muon1017",10,False,True)
215# makeProd("muon1027",10,True,True)
216# makeProd("muon1016",10,False,True)
217# makeProd("muon1026",10,True,True)
218# makeProd("muon1015",10,False,True)
219# makeProd("muon1025",10,True,True)
220# makeProd("muon1014",10,False,True)
221# makeProd("muon1024",10,True,True)
222# makeProd("muon1013",10,False,True)
223# makeProd("muon1023",10,True,True)
224# makeProd("muon1012",10,False,True)
225# makeProd("muon1022",10,True,True)
226
227
228def copy2EOS() -> None:
229 import os
230
231 eos = "/afs/cern.ch/project/eos/installation/0.3.15/bin/eos.select"
232 for prod in [610, 620]:
233 for run in range(0, 10):
234 prefix = "muon" + str(prod + run)
235 if prod in [610, 620] and run == 0:
236 prefix = "muon" + str(int(prod / 100))
237 for i in range(1, 10):
238 # requires full path
239 cmd = (
240 eos
241 + " cp -r "
242 + os.path.abspath(".")
243 + "/"
244 + prefix
245 + str(i)
246 + "/ /eos/experiment/ship/data/muonBackground/"
247 + prefix
248 + str(i)
249 + "/"
250 )
251 print(cmd)
252 os.system(cmd)
253
254
255def copyFromEOS() -> None:
256 import os
257
258 eos = "/afs/cern.ch/project/eos/installation/0.3.15/bin/eos.select"
259 for prod in [610, 620]:
260 for run in range(0, 10):
261 prefix = "muon" + str(prod + run)
262 if prod in [610, 620] and run == 0:
263 prefix = "muon" + str(int(prod / 100))
264 for i in range(1, 10):
265 # requires full path
266 cmd = (
267 eos
268 + " cp -r /eos/experiment/ship/data/muonBackground/"
269 + prefix
270 + str(i)
271 + "/ "
272 + os.path.abspath(".")
273 + "/"
274 + prefix
275 + str(i)
276 + "/"
277 )
278 print(cmd)
279 os.system(cmd)
None makeProd(prefix, DY, bool y=False, bool phiRandom=False, X=None)
Definition: run_prod.py:10
None copyFromEOS()
Definition: run_prod.py:255
None copy2EOS()
makeProd("muon812",10,False,True) # –< 831 copied back, done 16.3.2015 makeProd("muon822",...
Definition: run_prod.py:228