Difference between revisions of "Podd Analyzer"

From PREX Wiki
Jump to navigationJump to search
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
<font color="blue">Using Podd and the counting-mode DAQ is not a normal part of "production".  You probably don't need this
 +
unless you are an expert on Qsq measurements and such things.</font>
  
A good general reference for Podd
+
First, here is a good general reference for Podd
  
 
https://redmine.jlab.org/projects/podd/wiki
 
https://redmine.jlab.org/projects/podd/wiki
  
Specific information for analyzing PREX HRS data:
+
Specific information for analyzing PREX HRS counting-mode data is here. 
 +
The purpose of these analyses are for Optics, measuring Qsq, and background studies.
  
 
<pre>
 
<pre>
Brief instructions on running the Podd analyzer
+
Instructions on running the Podd analyzer
 
This file: /adaqfs/home/a-onl/happexsp/prex/README
 
This file: /adaqfs/home/a-onl/happexsp/prex/README
  
R. Michaels, May 3, 2019
+
maintained by R. Michaels, Ye Tian, Chandan Ghosh.  Updated Feb 1, 2020
  
 
I. Set up
 
I. Set up
Line 19: Line 22:
  
 
We're using the ''official'' (Ole's) analyzer at the moment, but  
 
We're using the ''official'' (Ole's) analyzer at the moment, but  
with the ParityData class plugin.  I also have a secret version of
+
with the ParityData class plugin.   
the full software on another account, but we'll try to use
 
Ole's version because it will be better supported.
 
  
 
The database is $DB_DIR = ./DB which is a link.  e.g. a link to  
 
The database is $DB_DIR = ./DB which is a link.  e.g. a link to  
 
PREXI or PREXII databases.  PREXI is there for test purposes,
 
PREXI or PREXII databases.  PREXI is there for test purposes,
while PREXII is forward-looking and needs to be updated.
+
while DB_PREXII is linked to DB, which is the current database.  
 
 
Two switch between these:
 
rm DB ; ln -s DB_PREXI DB
 
  
 
Our detectors are defined in db_P.dat in the $DB_DIR.
 
Our detectors are defined in db_P.dat in the $DB_DIR.
Line 34: Line 32:
 
in output.def
 
in output.def
  
Which run is analyzed is controlled by a link.
+
Input data files are located in the directory:
run.dat is the link.  For example:23
+
/adaq1/data1/
run.dat -> /home/rom/scratch/apex/apex_5021.dat.0
+
prexLHRS_*.dat.* for LHRS run
 +
prexRHRS_*.dat.* for RHRS run
  
Important files:
+
Important files for Podd:
  
 
db_run.dat -- defines kinematics
 
db_run.dat -- defines kinematics
db_cratemap.dat -- cratemap.  We have apex and prexI maps, so far
+
db_cratemap.dat -- cratemap.  aprexII map
 
onlana.cuts -- cuts file, see Podd documentation
 
onlana.cuts -- cuts file, see Podd documentation
 
output.def -- output definition, see Podd documentation
 
output.def -- output definition, see Podd documentation
rootlogon.C -- loads the libParity.so
+
rootlogon.C -- loads the libParity_*.so, since the flashadc
 +
located in different crates, slots for both arms, so we have two libParity_*.so files
 +
for analyzing the data.
 +
if we want to analyze the LHRS run, we need to load
 +
gSystem->Load("../ParityData/libParity_LHRS.so");
 +
if we want to analyze the RHRS run, we need to load
 +
gSystem->Load("../ParityData/libParity_RHRS.so");
 +
 
 
setup.C -- sets up the analyzer (see example below)
 
setup.C -- sets up the analyzer (see example below)
show*.C -- various macro examples. This needs work!
+
show*.C -- various macro examples. (showRight/Leftfadc.C s)
Afile.root -- the root output.  May want to put this on a work disk
 
 
bob.txt -- debug output.  May want to turn off debugging
 
bob.txt -- debug output.  May want to turn off debugging
  
You can do the following to get familiar with the code.
+
/***********************************************************************************************/
  
Running the analyzer, type "analyzer"
+
II. Running the analyzer, type "analyzer"
  
 +
[a-onl@aonl1]$ goprex
 
[a-onl@aonl1 prex]$ pwd
 
[a-onl@aonl1 prex]$ pwd
 
/adaqfs/home/a-onl/happexsp/prex
 
/adaqfs/home/a-onl/happexsp/prex
 +
[a-onl@aonl1 prex]$ vi rootlogon.C  (gSystem->Load("../ParityData/libParity_LHRS.so"); for LHRS
 +
                                    gSystem->Load("../ParityData/libParity_LHRS.so"); for RHRS)
 +
 
[a-onl@aonl1 prex]$ analyzer
 
[a-onl@aonl1 prex]$ analyzer
 
   ************************************************
 
   ************************************************
Line 69: Line 78:
 
   *                                              *
 
   *                                              *
 
   ************************************************
 
   ************************************************
analyzer [0] .x setup.C
+
analyzer [0] .x setup.C(runnumber)  //you need to change the nsplit number to handle more than one split file. prexLHRS_runnumber.dat.0, 1, 2...... 
analyzer [1] analyzer->Process(*run)
+
analyzer [1] .x macros/show*.C (analysis scripts.
 +
"showLeftfadc.C" plots fastbus ADC, fastbus TDC,flash ADC, time-over-threshold of flash ADC distributions for all detectors, VDC hit wires and VDC raw time, and S0 and VDC correlation )  
  
IIExercises to become familiar
+
***prexRHRS/LHRS_*.root -- the root output. They are located in the directory: /chafs1/work1/prex_counting/  
===================================
 
  
1. Run the analyzer, with  run.dat -> runL_sieve.dat
+
/***********************************************************************************************/
  
  and then:
+
III. Analysis Scripts
  
        analyzer [2] .x showSieveLeft.C
+
A work in progress !
  
2. rm run.dat ; ln -s happexsp_6840.dat.0 run.dat
+
Some scripts which may be useful are in ./macros
  
   analyzer [7] TH1F *h1 = new TH1F("h1","",100,0.,0.02)
+
detL1.C  detR1.C  showLeftfadc.C    showQsqLeft.C   showRightS0.C      showSieveRight.C
   (TH1F *) 0x194c30a0
+
detL2.C  detR2.C  showLeftS0.C      showQsqRight.C  showRightscaler.C  showVarsLeft.C
  analyzer [8] T->Draw("P.q2R>>h1")
+
detL3.C  detR3.C  showLeftscaler.C  showRightfadc.C  showSieveLeft.C   showVarsRight.C
 +
detL5.C  detR5.C
  
  There should also be EK_L.* and EK_R.* variables and you can
+
the "det" scripts are to show detectors.  this needs to be done first.
  analyzer [9] .x showQsqRight.C
+
the "Sieve" scripts are for showing sieve slit patterns. This probably needs some work.
 
+
the "scaler" scripts are for looking at scalers.
  Look at the P tree (generated by ParityData)
+
</pre>
  root [2] T->Print("P.*")
 
 
 
  Draw amplitudes for the upper Quartz detector on R-HRS
 
  root [4] T->Draw("P.upQadcR")
 
 
 
  (we need to define these for our new detector locations)
 
  
3. Analyze some flash ADC from APEX. 
+
Some more info, like how to re-analyze PREX-I data (circa 2010) or how to analyze scalers is in
 +
the file README_old in the working directory ("goprex")
  
  Link to some APEX data with mode 10 data.
+
== Notes on how to use the PODD analyzer for PREX Counting Mode Plots ==
        apex_5021.dat.0 -> /adaq1/data1/apex_5021.dat.0
 
        run.dat -> apex_5021.dat.0
 
  
  The flash adc printout in the debug file "bob.txt" should
+
--Find the run number you are interested in analyzing. These are the .dat files whose path is something like: ''/adaq1/data1/prexLHRS_XXXX.dat.Y'' or ''/adaq1/data1/prexRHRS_XXXX.dat.Y'' where ''XXXX'' is your run number, and ''Y'' is the file split number.
  be self-explanatory. Also in the root file there are
 
  snapshots like snap4->Draw(). This is still a work in
 
  progress!!
 
  
 +
--Open a terminal window and connect to an aonl machine. The command should look like: '''ssh -X a-onl@aonl1'''
  
III. Working with ParityData
+
--Type '''goprex''' to set up the environment.
=============================
 
  
directory: ~a-onl/happexsp/ParityData
+
--Run the analyzer by typing '''analyzer'''.
compile: make ; make install
 
  
Note, as I write this, the status is the following:
+
--Use the analyzer to run the setup.C script. This script takes two arguments; the first argument is the run number you'd like to analyze (see step one), the second argument is how many events you'd like to use. The default number of events is -1 which will just use all events in the run. The command should look something like this: '''.L setup.C (XXXX, YYYYYY)'''
A very large output is made:  bob.txt
 
It has debugging output. We can turn this off for production running.
 
  
The part that fills global variables defined in db_P.dat is  
+
--Find the rootfile you just created. (Hooray!) These are the .root files whose path is something like: ''/chafs1/work1/prex_counting/prexLHRS_XXXX_YYYYYY.root'' or ''/chafs1/work1/prex_counting/prexRHRS_XXXX_YYYYYY.root'' where ''XXXX'' is the run number and ''YYYYYY'' is the number of entries you chose in the last step. (Remember: default is -1, so if no argument was given for entries, ''YYYYYY'' will be -1)
fairly mature, but the FADC analysis needs a lot of work, though
 
a baseline version which works exists.
 
  
Each detector should go into Fastbus ADC and TDC, as well as
+
--You can now load your rootfile into the analyzer to look at plots or load macros on it. The command to do this should look like: '''analyzer /chafs1/work1/prex_counting/prexLHRS_XXXX_YYYYYY.root'''
scaler (see IV) and possibly a FADC. 
 
 
 
 
 
IV. Scalers
 
============
 
 
 
Scalers from the event type 140 are inserted into the ROOT trees,
 
both the "T" tree and dedicated scaler trees TSLeft and TSRight,
 
which you can see when you open the ROOT files and type ".ls".
 
TSRight->Scan("RightLclock:RightT1_r:RightT2_r:RightL1A_R:RightL1A_R_r")
 
 
 
The set up of the scalers is controlled by a database file,
 
see below.  These are kept in the working directory.
 
 
 
db_LeftScalevt.dat
 
db_RightScalevt.dat
 
 
 
The syntax is fairly straight forward.  For example, the following two
 
lines in db_RightScalevt.dat produce global variables "T5" (counts)
 
and "T5_r" (rates) in the output. 
 
 
 
variable 3 4 1  T5    RHRS T5
 
variable 3 4 2  T5_r  RHRS T5 rate
 
 
 
The numbers mean slot 3 (indices start at 0), channel 4, and the
 
3rd number means "counts"(1) or "rate"(2). The string after the
 
variable name is just a comment.
 
We'll need to adjust these and first test the scalers using
 
xscaler.  Type "goxscaler" on the a-onl to run xscaler.
 
 
 
 
 
V. Exercises for to perform to become acquainted.
 
=================================================
 
 
 
  1. Generate the sieve slit pattern from PREX-I data
 
 
 
  2. Generate the Qsq distribution using both the EK class (built into Podd)
 
 
 
      and from private analysis in ParityData.  Results should be identical.
 
 
 
  3. Look at detector signals from PREX-I.
 
 
 
  4. Look at FADC data from APEX.
 
 
 
---- now, to our own set up ---
 
 
 
  5. Establish detector channels (pulser simulation) in xscaler
 
 
 
  6. Adjust db_P.dat mapping to observe Fastbus ADC and TDC for detector
 
 
 
  7. Set up the FADC and observe snapshots of random events.
 
 
 
  8. Add integrated FADC data and time-over-threshold data to root output
 
 
 
</pre>
 

Latest revision as of 01:59, 1 February 2020

Using Podd and the counting-mode DAQ is not a normal part of "production". You probably don't need this unless you are an expert on Qsq measurements and such things.

First, here is a good general reference for Podd

https://redmine.jlab.org/projects/podd/wiki

Specific information for analyzing PREX HRS counting-mode data is here. The purpose of these analyses are for Optics, measuring Qsq, and background studies.

Instructions on running the Podd analyzer
This file: /adaqfs/home/a-onl/happexsp/prex/README

maintained by R. Michaels, Ye Tian, Chandan Ghosh.  Updated Feb 1, 2020

I. Set up
==========

Type "goprex" on a-onl account on aonl1 or aonl2 to go to the
working directory and set the environment.

We're using the ''official'' (Ole's) analyzer at the moment, but 
with the ParityData class plugin.  

The database is $DB_DIR = ./DB which is a link.  e.g. a link to 
PREXI or PREXII databases.   PREXI is there for test purposes,
while DB_PREXII is linked to DB, which is the current database. 

Our detectors are defined in db_P.dat in the $DB_DIR.
Which variables are written to the root output are defined
in output.def

Input data files are located in the directory:
/adaq1/data1/
prexLHRS_*.dat.* for LHRS run
prexRHRS_*.dat.* for RHRS run

Important files for Podd:

db_run.dat -- defines kinematics
db_cratemap.dat -- cratemap.  aprexII map 
onlana.cuts -- cuts file, see Podd documentation
output.def -- output definition, see Podd documentation
rootlogon.C -- loads the libParity_*.so, since the flashadc 
located in different crates, slots for both arms, so we have two libParity_*.so files
for analyzing the data. 
if we want to analyze the LHRS run, we need to load 
 gSystem->Load("../ParityData/libParity_LHRS.so");
if we want to analyze the RHRS run, we need to load
 gSystem->Load("../ParityData/libParity_RHRS.so");

setup.C -- sets up the analyzer (see example below)
show*.C -- various macro examples. (showRight/Leftfadc.C s)
bob.txt -- debug output.  May want to turn off debugging

/***********************************************************************************************/

II. Running the analyzer, type "analyzer"

[a-onl@aonl1]$ goprex
[a-onl@aonl1 prex]$ pwd
/adaqfs/home/a-onl/happexsp/prex
[a-onl@aonl1 prex]$ vi rootlogon.C  (gSystem->Load("../ParityData/libParity_LHRS.so"); for LHRS
                                     gSystem->Load("../ParityData/libParity_LHRS.so"); for RHRS) 

[a-onl@aonl1 prex]$ analyzer
  ************************************************
  *                                              *
  *            W E L C O M E  to  the            *
  *       H A L L A   C++  A N A L Y Z E R       *
  *                                              *
  *  Release            1.6.6        Apr 25 2019 *
  *  Based on ROOT  6.16/00          Jan 23 2019 *
  *                                              *
  *            For information visit             *
  *        http://hallaweb.jlab.org/podd/        *
  *                                              *
  ************************************************
analyzer [0] .x setup.C(runnumber)  //you need to change the nsplit number to handle more than one split file. prexLHRS_runnumber.dat.0, 1, 2......  
analyzer [1] .x macros/show*.C (analysis scripts. 
"showLeftfadc.C" plots fastbus ADC, fastbus TDC,flash ADC, time-over-threshold of flash ADC distributions for all detectors, VDC hit wires and VDC raw time, and S0 and VDC correlation ) 

***prexRHRS/LHRS_*.root -- the root output. They are located in the directory: /chafs1/work1/prex_counting/  

/***********************************************************************************************/

III. Analysis Scripts

A work in progress !

Some scripts which may be useful are in ./macros

detL1.C  detR1.C  showLeftfadc.C    showQsqLeft.C    showRightS0.C      showSieveRight.C
detL2.C  detR2.C  showLeftS0.C      showQsqRight.C   showRightscaler.C  showVarsLeft.C
detL3.C  detR3.C  showLeftscaler.C  showRightfadc.C  showSieveLeft.C    showVarsRight.C
detL5.C  detR5.C

the "det" scripts are to show detectors.  this needs to be done first.
the "Sieve" scripts are for showing sieve slit patterns.  This probably needs some work.
the "scaler" scripts are for looking at scalers.

Some more info, like how to re-analyze PREX-I data (circa 2010) or how to analyze scalers is in the file README_old in the working directory ("goprex")

Notes on how to use the PODD analyzer for PREX Counting Mode Plots

--Find the run number you are interested in analyzing. These are the .dat files whose path is something like: /adaq1/data1/prexLHRS_XXXX.dat.Y or /adaq1/data1/prexRHRS_XXXX.dat.Y where XXXX is your run number, and Y is the file split number.

--Open a terminal window and connect to an aonl machine. The command should look like: ssh -X a-onl@aonl1

--Type goprex to set up the environment.

--Run the analyzer by typing analyzer.

--Use the analyzer to run the setup.C script. This script takes two arguments; the first argument is the run number you'd like to analyze (see step one), the second argument is how many events you'd like to use. The default number of events is -1 which will just use all events in the run. The command should look something like this: .L setup.C (XXXX, YYYYYY)

--Find the rootfile you just created. (Hooray!) These are the .root files whose path is something like: /chafs1/work1/prex_counting/prexLHRS_XXXX_YYYYYY.root or /chafs1/work1/prex_counting/prexRHRS_XXXX_YYYYYY.root where XXXX is the run number and YYYYYY is the number of entries you chose in the last step. (Remember: default is -1, so if no argument was given for entries, YYYYYY will be -1)

--You can now load your rootfile into the analyzer to look at plots or load macros on it. The command to do this should look like: analyzer /chafs1/work1/prex_counting/prexLHRS_XXXX_YYYYYY.root