Attachment 'sortConstantsMar2018.py'

Download

   1 def sortConstantsMar2018():
   2     #define mapping:
   3     #modules, that were also used in feb tb will not be used again, thus their value is set to -1000
   4     layerToModule = [{1:22,2:26,3:23,4:24,5:25,6:5,7:14,8:15,9:32,10:40},{1:-1000,2:-1000,3:30,4:36,5:37},{1:18,2:28,3:31,4:38,5:39},{1:-1000,2:27,3:29,4:33,5:34}]
   5 
   6     #define input and output files
   7     workfile=["dbstyle_gain_2018Mar_batch1_2.txt","dbstyle_gain_2018Mar_batch3.txt","dbstyle_gain_2018Mar_batch4.txt","dbstyle_gain_2018Mar_batch6.txt","db_mip_Mar2018_batch1_2.txt","db_mip_Mar2018_batch3.txt","db_mip_Mar2018_batch4.txt","db_mip_Mar2018_batch6.txt","DB_Pedestal_Mar2018_batch1_2.txt","DB_Pedestal_Mar2018_batch3.txt","DB_Pedestal_Mar2018_batch4.txt","DB_Pedestal_Mar2018_batch6.txt"]
   8     outfile=["gainSorted_1_2.txt","gainSorted_3.txt","gainSorted_4.txt","gainSorted_6.txt","mipSorted_1_2.txt","mipSorted_3.txt","mipSorted_4.txt","mipSorted_6.txt","pedestalSorted_1_2.txt","pedestalSorted_3.txt","pedestalSorted_4.txt","pedestalSorted_6.txt"]
   9 
  10 
  11     for n in range (0,3):
  12         for nn in range (0,4):
  13             f = open(workfile[n*4+nn], 'r')
  14             out = open(outfile[n*4+nn], 'w')
  15 
  16             #search for legend and print it to output file
  17             for line in f:
  18                 if line.startswith('#Layer') or line.startswith('#Module'):
  19                     out.write(line)
  20 
  21                 else:
  22                     read = line.split()
  23                     #substitute layer number with module number
  24                     read[0]=layerToModule[nn][int(read[0])]
  25 
  26                     #write values to output file
  27                     str1 = ' '.join(str(item) for item in read)
  28                     out.write(str(str1))
  29                     out.write("\n")
  30 
  31 sortConstantsMar2018()

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2018-04-19 07:32:10, 631.5 KB) [[attachment:DB_constants_gain.txt]]
  • [get | view] (2018-05-08 20:12:52, 652.9 KB) [[attachment:DB_constants_gain_corr.txt]]
  • [get | view] (2018-04-19 07:32:28, 593.9 KB) [[attachment:DB_constants_mip.txt]]
  • [get | view] (2018-05-08 20:13:21, 617.3 KB) [[attachment:DB_constants_mip_corr.txt]]
  • [get | view] (2018-04-19 07:32:43, 596.2 KB) [[attachment:DB_constants_pedestal.txt]]
  • [get | view] (2018-05-08 20:13:38, 681.3 KB) [[attachment:DB_constants_pedestal_corr.txt]]
  • [get | view] (2018-04-19 10:17:04, 1.1 KB) [[attachment:DBtoslcio.sh]]
  • [get | view] (2018-04-18 07:34:04, 19.1 KB) [[attachment:Reco.xml]]
  • [get | view] (2018-04-18 07:36:26, 0.6 KB) [[attachment:Reco_sed.sh]]
  • [get | view] (2018-04-18 14:54:27, 10.8 KB) [[attachment:eventDisplay.xml]]
  • [get | view] (2018-04-18 13:25:03, 1.5 KB) [[attachment:mergeCalibValues.py]]
  • [get | view] (2018-04-18 07:36:36, 1.0 KB) [[attachment:myMarlin.sh]]
  • [get | view] (2018-04-18 14:55:10, 19.3 KB) [[attachment:reconstructRawData_slcioIutput.xml]]
  • [get | view] (2018-04-18 13:24:06, 1.1 KB) [[attachment:sortConstantsFeb2018.py]]
  • [get | view] (2018-04-18 13:24:36, 1.7 KB) [[attachment:sortConstantsMar2018.py]]
  • [get | view] (2018-04-18 07:32:42, 2.0 KB) [[attachment:steering.xml]]
  • [get | view] (2018-04-19 09:47:52, 62.3 KB) [[attachment:steering4dqm_tb_2018.xml]]
  • [get | view] (2018-04-18 17:02:01, 16.9 KB) [[attachment:steering_cosmics_2018April.xml]]
  • [get | view] (2018-04-20 14:19:48, 16.4 KB) [[attachment:steering_cosmics_2018April_38Layers.xml]]
  • [get | view] (2018-04-19 09:02:04, 17.1 KB) [[attachment:steering_cosmics_2018April_4812.xml]]
  • [get | view] (2018-05-09 20:03:41, 61.6 KB) [[attachment:test_canvases1.xml]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.