FTPC NoiseFinder - GetGain and FindNoise

With DAQ1000, the RTS libraries are now in $STAR/StRoot/RTS. This enables the 
FTPC noise finder programs, GetGain and FindNoise,  to run on the rcas machines 
as well as on virgo-run09. 


If you login as ftpccrew on virgo-run09, the library environment will be set up 
automatically for you. $PATH will contain the SL09b version of the FTPC online 
library so you can execute GetGain and FindNoise. 

CURRENTLY DOESN'T WORK ON rcas
=====================================================================
The advantage of running on an rcas machine, is that you do NOT have to copy 
the daq files to the virgo-run09 data disk, you can get a daq file from HPSS 
and use it directly from /star/data03/daq/.... 
The disadvantage is that you have to create the GetGain and FindNoise binaries 
in your working directory:

    starver SL09b                        this is the STAR library version the
                                         FTPC online library currently uses 
                                         (2009-07-17)
    cvs co online/ftpc/NoiseFinder
    cd online/ftpc/NoiseFinder
    mkdir bin                            cvs checkout prunes empty directories 
    make all
    cd ../../..
    ln -s online/ftpc/NoiseFinder/bin/GetGain GetGain
    ln -s online/ftpc/NoiseFinder/bin/FindNoise FindNoise
=====================================================================

In 2010, the pulser signal moved. Before you make a gain table, 
determine at which timebin the pulser signal is located by looking at a 
pulser run with the pad monitor. Determine a lower and an upper timebin 
search limit - they should be 50 counts apart. 


                 minTime          maxTime
   <2010            50              100
    2010            20               70
    2011             50             100
 
Then to run in your working directory:
      mkdir gain_table
This will be the directory in which the gain table (GainTable.dat) from a 
pulser run is stored.

      GetGain -M minTimebin -X maxTimebin <pulserfile>  >& GetGain.log&

 
             minTimebin is the lower limit on the pulser timebin search area
             maxTimebin is the upper limit on the pulser timebin search area
             pulserfile can be either from the event pool (in this case you 
                        must run on virgo-run09) or a daq file you have 
                        downloaded from HPSS
             Output files:
                           GetGain.log
                           Gain.ps
                           Gain.root
                           gain_table/GainTable.dat

The Gain.ps file contains 28 pages of histograms:
                    page 1->20  average charge/pad
                                one histogram/sector => one page/padrow
                    page 21     empty
                    page 22     mean sector charge, sec vs. row
                   *page 23     mean pad charge, pad vs. row
                                dead pads  = white
                                noisy pads = red
                   *page 24     gain_table/GainTable.dat corrected pad charge,
                                pad vs. row
                    page 25-27  empty
                    page 28     average timebin value for FTPC West and East
                           
The second step is to run FindNoise FILE, this time FILE is a data run.
FindNoise uses the gain table in gain_table/GainTable.dat, and produces a new
gain table file: gain_table/NoiseCorrected_GainTable.dat

       FindNoise <filename>  >& FindNoise.log1&
               filename can be either from the event pool or a daq file
               default noisecut = noisecutWest = noisecutEast = 1000
               Output files:
                            FindNoise.log1
                            NoiseFinder.ps
                            gain_table/NoiseCorrected_GainTable.dat

Use the NoiseFinder.ps file to determine noisecutWest and noisecutEast 
then rerun FindNoise 

   FindNoise -W [noisecutWest] -E [noisecutEast] <filename>  >& FindNoise.log2&

               Output files:
                            FindNoise.log2
                            NoiseFinder.ps
                            gain_table/NoiseCorrected_GainTable.dat
                                Use this file to create the offline database
                                Calibrations_ftpc/ftpcAmpSlope table
                                                                                
 The NoiseFinder.ps file contains 25 pages of histograms:
                    page 1->20  average charge/pad
                                one histogram/sector => one page/padrow
                    page 21     empty
                    page 22     mean sector charge, sec vs. row
                   *page 23     mean pad charge, pad vs. row
                                dead pads  = white
                                noisy pads = red
                   *page 24     gain_table/GainTable.dat corrected pad charge,
                                pad vs. row
                   *page 25     gain_table/NoiseCorrected_GainTable.dat
                                corrected pad charge, pad vs. row


Then use the NoiseFinder utility, WriteAmpSlope_cc.so in $FTPC/lib, to create a
gain table file, ftpcAmpSlope.C, for the Calibrations_ftpc/ftpcAmpSlope in the 
offline database.  

Or use the NoiseFinder utility, WriteDaqFlagg_cc.so in $FTPC/lib, to create a
bad pad file, ftpcDaqFlagg.dat, for DAQ.

The FTPC NoiseFinder utilities WriteDaqFlagg and WriteAmpSlope are run in
root4star using shared libraries in $FTPC/lib. These shared libraries are
created as follows:

root4star
root4star [0] .L WriteDaqFlagg.cc+
Info in <TUnixSystem::ACLiC>: creating shared library /mnt/data2/pclusa8
/FtpcOnlineLibrary/online/ftpc/NoiseFinder/utils/./WriteDaqFlagg_cc.so
root4star [1] .mv WriteDaqFlagg_cc.so $FTPC/lib
root4star [2] .L WriteAmpSlope.cc+
Info in <TUnixSystem::ACLiC>: creating shared library /mnt/data2/pclusa8
/FtpcOnlineLibrary/online/ftpc/NoiseFinder/utils/./WriteAmpSlope_cc.so
root4star [3] .mv WriteAmpSlope_cc.so $FTPC/lib
root4star [4].q
 
WriteDaqFlagg.cc
================
WriteDaqFlagg.cc reads in the FTPC NoiseFinder output file (GainTable.dat)
and writes out a file (ftpcDaqFlagg.dat) with which noisy FTPC pads can be 
masked out in DAQ once Tonko receives a copy. 

To run in the FtpcOnlineLibrary environment:

root4star
root4star [0]gSystem->Load("WriteDaqFlagg_cc")
root4star [1]WriteDaqFlagg()

If you use WriteDaqFlagg(), the gain_table/GainTable.dat file will be read in.
You can specify the input file by replacing inputFile with the correct filename
in the root4star command WriteDaqFlagg("inputFile")

Outputfile:
            ftpcDaqFlag.dat

To maintain a record of which pads are masked out it is ESSENTIAL to
archive the ftpcDaqFlagg.dat files which are sent to Tonko. The files
are archive on virgo-run09 in /data/FlaggedDaqPads/YYYY
YYYY is a sub-directory with YYYY = year

cp ftpcDaqFlagg.dat /data/FlaggedDaqPads/YYYY/RUNNUMBER_ftpcDaqFlagg.dat

RUNNUMBER is the run number of the file used to produce the GainTable.dat
file 

 
WriteAmpSlope.cc
================
WriteAmpSlope.cc reads in the FTPC NoiseFinder output file from
./gain_table/NoiseCorrected_GainTable.dat) and writes out an ftpcAmpSlope.C 
file which can be added to the offline database in 
Calibrations_ftpc/ftpcAmpSlope.

To run in the FtpcOnlineLibrary environment:

root4star
root4star [0]gSystem->Load("WriteAmpSlope_cc")
root4star [1]WriteAmpSlope()

If you use WriteAmpSlope(), the gain_table/NoiseCorrected_GainTable.dat file 
will be read in.  You can specify the input file by replacing inputFile with 
the correct filename in the root4star command WriteDaqFlagg("inputFile")

Output file:
       ftpcAmpSlope.C
 This file should be added to the STAR data base using the DataBaseInstructions
described in /afs/rhic.bnl.gov/star/users/jcs/public/DataBaseInstructions

This page was updated by Janet Seyboth on March 14, 2010