Instructions on running QA code for development

 This document information Gene provided how to deal with github to get relevant QA makers, and how to run them on daq files

I have set this up in ~videbaks/tpcqa in Stroot and work directories.

Running code for tests

How to run the TPC QA codes, which you probably want to do in 'stardev' to minimize any surprises that may come later

1) Compile your version of the codes with cons.

2) Process data to fill histograms. I put some DAQ files here:
/star/data03/daq/2023/211/24211048/

>> there are several files. certainly enough for my tests

And here's an example job to process one:
setenv INPUTFILE0 st_physics_adc_24211048_raw_0400004.daq
root4star -b -q -l bfc.C\(10000,\"P2023a,Stica,BEmcChkStat,\-hitfilt,TpxRaw\",\"$INPUTFILE0\"\)>& ${INPUTFILE0:r}.log





>>
>> should the input file name not have the full path? 

>> when I ran this no log file was produced- replaced with a simple test.log in local directory
>> need to try again
.. I just ran it with 10 events.
>> The log file indicated my local .so was loaded and hist.root file generated. All good.


I found that I can speed this up by about a third if we turn _off_ tracking. But for that, you need to change the chain slightly...
root4star -b -q -l bfc.C\(10000,\"P2023a,QAalltrigs,\-ITTF,BEmcChkStat,\-hitfilt,TpxRaw\",\"$INPUTFILE0\"\)>& ${INPUTFILE0:r}.log
...and you need a copy of StRoot/St_QA_Maker with the following change to StEventQAMaker.cxx line 447 to set fillHists = kTRUE:
447c447
<     fillHists = kFALSE;
---

    fillHists = kRUE;

The data processing creates st_physics*.hist.root files. I suggest doing this with just 100 events at first to make sure it works OK. But if you need lots of statistics, you may want to process several of the DAQ files I restored for you.

3) [optional] If you processed multiple DAQ files, then add them together:
ls -1 st_physics*.hist.root > histlist
root4star -b -q -l bfcread_hist_files_add.C\(20,\"histlist\",\"st_physics_adc_24211048_raw_9999999\"\) >&! log.add

4) Extract the TPC histograms into a regular ROOT file:
/star/u/starqa/bin/getTpcQA.csh BLAH
where BLAH is either a single st_physics*.hist.root file from step 2 if you only processed one, or st_physics_adc_24211048_raw_9999999.hist.root if you added several together via step 3.

5) Run the TPC QA post-processing to generate a summary report:

if (-e summary.txt) rm summary.txt
root -l -b tpcQA_24211048.root <<EOF >&! tpcQA.log
.L /star/data10/qa/tpc/macros/AnaQA.C
if(checkFile()) {
openDoc("summary.txt");
getAllBadPads();
}
EOF







--- setup git and local copies

1) First, make sure your fork of of star-sw is up-to-date on github by clicking the button that says "Sync fork"
 
2) Just above that is a green "Code" button. Click on that, and then under the SSH option, click the little copy icon to the right of the text. Here's what it looks like for me:
 
 

3) Then, in an empty directory on SDCC:

git clone --no-checkout BLAH
(where BLAH is the above text that you can just paste after having copied it)
 
Then:
cd star-sw/

 
4) Now, go back to the github web page, click in some blank area to make the above-shown code information go away, and then try to copy those 7 characters of jiberish to the left of the commits, shown in the lower left of this image for me:
 
Go back to SDCC, and type:
git checkout -b TpcQA BLAH
(where BLAH in this case is that jiberish, like 6ff5756)
This will create a "TpcQA" branch from your repository fork, allowing you to work with a branch of code that you can easily delete and start over if you mess up, but without affecting your main fork of the star-sw repository..
 
5) After you've copied the codes you need to somewhere else and finished testing, bring that code back into this area and come back to this star-sw directory. You can see a list of modified codes via:
git status
and the list of changed code lines via
git diff
 
6) Next, tell git about the changed codes you're going to include in your commit using git add. You can specify individual files after the words "git add", or just do the following to get all changed files.
git add -u
 
Now git diff will return nothing, while git status will list the files changed in a green color instead of red.
 
7) Follow this with:
git commit
...which will let you put in a short description at the top of some text inside an editor, then you can save and exit the editor and the commit is done.
 
8) Next you do:
git push
This will spit out something saying it didn't work, but it nicely tells you what to copy and paste to the command line instead. It will be something like this, but you should copy and paste whatever it tells you:
git push --set-upstream origin TpcQA
 
9) OK, now go back to the github web page. It will nicely change on its own to show you a big green button to submit a pull request with the changes. Once you've clicked that, you make sure the pull request title and description as as you like, and then submit it.
 
10) When the github pull request is done, you can erase this star-sw directory on SDCC, and you can go back to your git star-sw repository to list the branches of your repository and delete this TpcQA branch that you created.
 
___________
 
And there you have it in the fewest, cleanest, simplest steps that I know how. I'm sure there are more nuanced ways to allow you to keep using this same branch, but I just do a new branch for each and every code change.

--- documentation for changes made: