Attachment 'sortConstantsFeb2018.py'

Download

   1 def sortConstantsFeb2018():
   2 
   3     #define mapping:
   4     layerToModule = {1:1, 2:6, 3:8, 4:2, 5:16, 6:3, 7:11, 8:12, 9:13, 10:17, 11:20, 12:10, 13:4, 14:9, 15:19, 16:21}
   5 
   6     #input and output files:
   7     workfile=["gain_dbstyle.txt","MIP_DBstyle_N100.txt","Pedestal_Feb2018_db.txt"]
   8     outfile=["gainSorted.txt","mipSorted.txt","pedestalSorted.txt"]
   9 
  10     #open and read files
  11     for n in range (0,3):
  12         f = open(workfile[n], 'r')
  13         out = open(outfile[n], 'w')
  14 
  15         for line in f:
  16             #find legend and print it to output file
  17             if line.startswith('#Layer') or line.startswith('#Module'):
  18                 print line
  19                 out.write(line)
  20 
  21             else:
  22                 read = line.split()
  23 
  24                 #substitute layer number with module number
  25                 read[0]=layerToModule[int(read[0])]
  26 
  27                 #put line back together as string and write it in output file
  28                 str1 = ' '.join(str(item) for item in read)
  29                 out.write(str(str1))
  30                 out.write("\n")
  31 
  32 sortConstantsFeb2018()

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.