Ignore:
Timestamp:
Oct 16, 2009 5:17:38 PM (13 years ago)
Author:
srkline
Message:

Changing ILL_ files to use the #define ILL_D22, removing the need for Lionel's verison of WorkFileUtils?. The change there was in the DetCorr? function, doing a tuby-by-tube correction rather than our array correction. We can make use of this later for vSANS, surely.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/WorkFileUtils.ipf

    r570 r576  
    7070                Return(0)               //does not generate an error - a single file was converted to work.newtype 
    7171        Endif 
     72         
     73        NVAR pixelsX = root:myGlobals:gNPixelsX 
     74        NVAR pixelsY = root:myGlobals:gNPixelsY 
    7275         
    7376        //now make references to data in newType folder 
     
    138141        dscale = 1/(1-deadTime*cntrate) 
    139142 
     143#ifdef ILL_D22 
     144        Variable tubeSum 
     145        // for D22 detector might need to use cntrate/128 as it is the tube response 
     146        for(ii=0;ii<pixelsX;ii+=1) 
     147                //sum the counts in each tube 
     148                tubeSum = 0 
     149                for(jj=0;jj<pixelsY;jj+=1) 
     150                        tubeSum += data[jj][ii] 
     151                endfor 
     152                // countrate in tube ii 
     153                cntrate = tubeSum/itim 
     154                // deadtime scaling in tube ii 
     155                dscale = 1/(1-deadTime*cntrate) 
     156                // multiply data[ii][] by the dead time 
     157                data[][ii] *= dscale 
     158        endfor 
     159#endif 
     160 
    140161        //update totals by adding RAW values to the local ones (write to work header at end of function) 
    141162        total_mon += raw_reals[0] 
     163#ifdef ILL_D22 
     164        total_det += sum(data,-inf,inf)                 //add the newly scaled detector array 
     165#else 
    142166        total_det += dscale*raw_reals[2] 
     167#endif 
    143168        total_trn += raw_reals[39] 
    144169        total_rtime += raw_ints[2] 
     
    157182                endif 
    158183        endif 
    159          
    160         NVAR pixelsX = root:myGlobals:gNPixelsX 
    161         NVAR pixelsY = root:myGlobals:gNPixelsY 
    162184         
    163185        If((xshift == 0) && (yshift == 0))              //no shift, just add them 
     
    248270        ConvertFolderToLinearScale("RAW") 
    249271        //then continue 
    250  
     272         
     273        NVAR pixelsX = root:myGlobals:gNPixelsX 
     274        NVAR pixelsY = root:myGlobals:gNPixelsY 
     275         
    251276        //copy from current dir (RAW) to work, defined by destpath 
    252277        DestPath = "root:Packages:NIST:"+newType 
     
    286311        dscale = 1/(1-deadTime*cntrate) 
    287312         
     313#ifdef ILL_D22 
     314        Variable tubeSum 
     315        // for D22 detector might need to use cntrate/128 as it is the tube response 
     316        for(ii=0;ii<pixelsX;ii+=1) 
     317                //sum the counts in each tube 
     318                tubeSum = 0 
     319                for(jj=0;jj<pixelsY;jj+=1) 
     320                        tubeSum += data[jj][ii] 
     321                endfor 
     322                // countrate in tube ii 
     323                cntrate = tubeSum/itim 
     324                // deadtime scaling in tube ii 
     325                dscale = 1/(1-deadTime*cntrate) 
     326                // multiply data[ii][] by the dead time 
     327                data[][ii] *= dscale 
     328        endfor 
     329#endif 
     330         
     331         
    288332        //update totals to put in the work header (at the end of the function) 
    289333        total_mon += realsread[0] 
     334#ifdef ILL_D22   
     335        total_det += sum(data,-inf,inf)                 //add the newly scaled detector array 
     336#else 
    290337        total_det += dscale*realsread[2] 
     338#endif 
    291339        total_trn += realsread[39] 
    292340        total_rtime += integersread[2] 
     
    297345        //only ONE data file- no addition of multiple runs in this function, so data is 
    298346        //just simply corrected for deadtime. 
     347#ifndef ILL_D22         //correction done tube-by-tube above 
    299348        data *= dscale          //deadtime correction 
    300          
     349#endif 
     350 
    301351        //scale the data to the default montor counts 
    302352        scale = defmon/total_mon 
     
    446496                        // so divide here to get the correct answer (5/22/08 SRK) 
    447497                        if(doEfficiency) 
     498#ifdef ILL_D22 
     499                                data[ii][jj]  /= DetEffCorrILL(lambda,dtdist,xd)                //tube-by-tube corrections  
     500                  solidAngle[ii][jj] = DetEffCorrILL(lambda,dtdist,xd) 
     501#else 
    448502                                data[ii][jj] /= DetEffCorr(lambda,dtdist,xd,yd) 
    449503        //                      solidAngle[ii][jj] = DetEffCorr(lambda,dtdist,xd,yd)            //testing only 
     504#endif 
    450505                        endif 
    451506                         
Note: See TracChangeset for help on using the changeset viewer.