ATLAS Offline Software
downloadSingle.py
Go to the documentation of this file.
1 #Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 # A script that re-downloads a single day's worth of data
4 # Very useful if something went wrong in the initial download
5 # Replace s and e with the desired start and end dates
6 
7 import datetime
8 import os
9 
10 url = 'http://atlas-ddv.cern.ch:8089/multidata/getDataSafely'
11 url2 = 'http://atlas-ddv.cern.ch:8089/multidata/downloadTxtData'
12 
13 
14 s = datetime.datetime(2016,12,30,0,0,0)
15 e = datetime.datetime(2016,12,31,0,0,0)
16 
17 dataFolder = '/eos/atlas/user/j/jdickins/Pixel/LeakageCurrent/IBLData/rawData/'
18 dataType = 'ENV_TT'
19 
20 if not os.path.exists(dataFolder+dataType+'/'):
21  os.mkdir(dataFolder+dataType+'/')
22 
23 if not os.path.exists(dataFolder+dataType+'Stave/'):
24  os.mkdir(dataFolder+dataType+'Stave/')
25 
26 saveFileName2 = dataFolder+dataType+'/'+s.strftime("%Y_%m_%d") +'-' +e.strftime("%Y_%m_%d")+ '.txt'
27 if os.path.exists(saveFileName2):
28  os.remove(saveFileName2)
29 
30 with open(saveFileName2,'w') as saveFile:
31 
32  staveString="stave"
33  for staveNumber in range (1,15):
34  if staveNumber<10:
35  staveString = "0" + str(staveNumber)
36  else:
37  staveString = str(staveNumber)
38 
39  # Generate save file name. I save in format YYYY/MM/DD, so it is in alphabetical order.
40  saveFileName = dataFolder+dataType+'Stave/'+s.strftime("%Y_%m_%d") +'-' +e.strftime("%Y_%m_%d")+ 'Stave'+ staveString + '.txt'
41  if os.path.exists(saveFileName):
42  os.remove(saveFileName)
43 
44  # Create wget command
45  cmd = 'wget --post-data "queryInfo=atlas_pvssPIX, alias, LI_S' + staveString + '_A_M1_' + dataType + ', ' + s.strftime("%d-%m-%Y") + ' 00:00, ' + e.strftime("%d-%m-%Y") + ' 00:01, , , , , ,no, , +2!atlas_pvssPIX, alias, LI_S' + staveString + '_A_M2_' + dataType + ', ' + s.strftime("%d-%m-%Y") + ' 00:00, ' + e.strftime("%d-%m-%Y") + ' 00:01, , , , , ,no, , +2!atlas_pvssPIX, alias, LI_S' + staveString + '_A_M3_' + dataType + ', ' + s.strftime("%d-%m-%Y") + ' 00:00, ' + e.strftime("%d-%m-%Y") + ' 00:01, , , , , ,no, , +2!atlas_pvssPIX, alias, LI_S' + staveString + '_A_M4_' + dataType + ', ' + s.strftime("%d-%m-%Y") + ' 00:00, ' + e.strftime("%d-%m-%Y") + ' 00:01, , , , , ,no, , +2!atlas_pvssPIX, alias, LI_S' + staveString + '_C_M1_' + dataType + ', ' + s.strftime("%d-%m-%Y") + ' 00:00, ' + e.strftime("%d-%m-%Y") + ' 00:01, , , , , ,no, , +2!atlas_pvssPIX, alias, LI_S' + staveString + '_C_M2_' + dataType + ', ' + s.strftime("%d-%m-%Y") + ' 00:00, ' + e.strftime("%d-%m-%Y") + ' 00:01, , , , , ,no, , +2!atlas_pvssPIX, alias, LI_S' + staveString + '_C_M3_' + dataType + ', ' + s.strftime("%d-%m-%Y") + ' 00:00, ' + e.strftime("%d-%m-%Y") + ' 00:01, , , , , ,no, , +2!atlas_pvssPIX, alias, LI_S' + staveString + '_C_M4_' + dataType + ', ' + s.strftime("%d-%m-%Y") + ' 00:00, ' + e.strftime("%d-%m-%Y") + ' 00:01, , , , , ,no, , +2!" ' + url + ' --output-document='+ saveFileName
46 
47  # Execute wget command
48  os.system(cmd)
49 
50  with open(saveFileName,'r') as bloop:
51 
52  for bloopLine in bloop:
53  saveFile.write(bloopLine)
54 
55 
Trk::open
@ open
Definition: BinningType.h:40
str
Definition: BTagTrackIpAccessor.cxx:11