From Millepede back into Pisa


Pisa reads a database table named fvtx_survey and uses the values in these records to place the wedges on half-disks, and to place half-disks into the cages [Pisa uses variable sili_use_survey=n in phnx.par, where n is the version number in the data base]. The source of these numbers is the wedge positions as they were measured at Hexagon, and analyzed by Steve Pate and company. Steve's files are comma-separated ascii files like this one (x,y in microns, angles in radians):
     * NE0 location,center x,center y,Angle
        0,6264.533,68735.584,   1.479
        1,15391.599,67390.161,   1.344
        2,23921.268,64753.166,   1.217
        3,32162.529,61163.684,   1.084
        4,39901.280,56293.086,   0.953
        5,46875.330,50670.046,   0.823
        6,53071.298,44140.247,   0.692
        ....
There is a php script that reads this file and enters the numbers into the data base. There is a copy at /phenix/WWW/p/draft/hubert/online/fvtx/Database/survey_insert_v4.php:

In the database, the structure of the table is as follows:
     fvtx=> \d fvtx_survey
          Table "public.fvtx_survey"
      Column  |     Type      | Modifiers 
     ---------+---------------+-----------
      version | smallint      | 
      object  | character(20) | 
      values  | real[]        | 
      comment | text          | 
and the values from the csv input now show up like this in the data base:

     fvtx=> select version,object,values from fvtx_survey where  version=1 and object like '%NE0 wedge %';
      version |        object        |                     values                
     ---------+----------------------+----------------------------------------------------------------
            1 | NE0 wedge x          | {0.62645,1.53915,2.39212,3.21625,3.99012,4.68753,5.30712,....}
            1 | NE0 wedge y          | {6.87355,6.73901,6.47531,6.11636,5.6293,5.067,4.41402,...}
            1 | NE0 wedge phi        | {5.25947,12.9944,20.2709,27.8913,35.397,42.8455,50.3512,...}
     (3 rows)

Note that the positions were converted to cm, and the angles to degrees. Some preliminary alignment work was done before Jin started applying Millepede, resulting in data base versions 2, 3, and 4. Version 4 formed the basis of the Millepede iterations.

Millepede produced a file containing small corrections to the wedge and disk positions. This is a temporary file called alignment_release5.txt, and looks like this:

     alignment_release5.txt
     wedge	0	0	0	0	0.00228046	0.0122415	0	0	0	0	
     wedge	0	0	0	1	0	0	0	0	0	0	
     wedge	0	0	0	2	0	0	0	0	0	0	
     wedge	0	0	0	3	0.00558662	0.008561	0	0	0	0	
     wedge	0	0	0	4	-0.000504371	-0.000587782	0	0	0	0	
     wedge	0	0	0	5	0.00681898	0.00607325	0	0	0	0	
     ....
Where the indices are arm (N,S), side (E,W), disk (0-3), wedge (0-23). dx. dy, dz, d_angles. In order to use these small corrections in Pisa, change the value of sili_use_survey to a negative value, in the current case to -4. Pisa will then pick up data base values for version 4, and also look for the millepede file alignment_deltas.txt (which in this case is soft-linked to alignment_release5.txt).

In addition, when the version number n is negative, Pisa also writes an ascii ouput file wedge_pos_out.csv :

     * SCM1_3,    0.11167,    0.19057
     * SW3 location,x,y,angle
      0,       1.15197,     10.23904,    6.46268
      1,       2.47865,      9.99793,   13.96840
      2,       3.76424,      9.60433,   21.47410
      3,       4.98242,      9.01042,   29.03720
      4,       6.10732,      8.29053,   36.48560

This file has the wedge positions as gotten from the data base (records with version 4), plus the small corrections from the millepede iterations.

This file has roughly the same format as the original csv files from Steve, but it is in cm and degrees, doesn't need the various sign manipulations. Also there are records for positioning the disks in the 4 cages, which are named SCM1-4 in Pisa.

We therefore use a modified script insert_survey_v5.php to now insert the millepede-corrected values into the data base, as version n+1.