A package should be built before running the scripts, or remove any mention of these packages in the Fun4All macros so you can just process the data.
There is an included script called BuildAll.sh
which will build all the modules in MvtxCalibration/src
and create condor files to submit jobs in MvtxCalibration/condor
. This is an example of how to run the script:
export $MYINSTALL=<your install directory path>
source BuildAll.sh $MYINSTALL
You can also run BuildAll.sh
without any arguments and it will default to installing in MvtxCalibration/install
.
source BuildAll.sh
Help can be found by running BuildAll.sh
with the -h
flag.
source BuildAll.sh -h
The BuildAll.sh
script will build the modules in MvtxCalibration/src
and create condor files to submit jobs in MvtxCalibration/condor
. It will also configure directories for output files and logs. A brief overview of what the script does is below.
-
Build the modules in
MvtxCalibration/src
and install them in the provided install directory.mvtxfhr
: Fake hit rate analysis modulerawdatatools
: Tools to manage raw.prdf
files
-
Create
MvtxCalibration/condor
directory with scripts to submit condor jobs of analysis on RCF.-
fhr_task.job
: Condor job script that calls exicutible and pipes in arguments fromargs.list
.-
Check that this file has the correct
initialDir
. For example mine is:initialDir = /sphenix/user/tmengel/MVTX/MvtxCalibration
-
-
run_fhr_task.job
: Exicutible file that sources install directory and callsFun4All_MvtxFHR.C
.- Check that this file has the correct
$INSTALLDIR
. It should be the path supplied toBuildAll.sh
.
- Check that this file has the correct
-
args.list
: List file that contains arguments for each condor job.-
The arguments are
<number of events>
<run number>
<trigger rate [kHz]>
<output file path>
<trigger guard output (optional could be "none")>
-
Check the output path for root files and make sure it leads to
MvtxCalibration/rootfiles
-
-
MvtxCalibration/condor/log
: Directory for condor job logs and output files.
-
-
Create
MvtxCalibration/rootfiles
where output is saved from condor jobs.
After running BuildAll.sh
your MvtxCalibration
directory should look like this:
MvtxCalibration/
├── condor/
│ ├── args.list
│ ├── fhr_task.job
│ ├── log/
│ ├── run_fhr_task.job
├── rootfiles/
├── src/
│ ├── mvtxfhr/
│ ├── rawdatatools/
├── macros/
│ ├── Fun4All_MvtxFHR.C
├── README.md
├── BuildAll.sh
You could also have a install
directory if you didn't provide an an install directory to BuildAll.sh
.
There are 2 modules in the MvtxCalibration
package that are automatically build via the BuildAll.sh
script. These modules are used to analyze raw MVTX data files and optimize the fake hit rate.
These modules are located in the MvtxCalibration/src
directory. The modules are:
mvtxfhr
- Contains classes and subsystem modules for doing a Fake hit rate analysis on raw
.prdf
files.
- Contains classes and subsystem modules for doing a Fake hit rate analysis on raw
rawdatatools
- Contains classes to find and manage raw
.prdf
files in the data directory onRCF
.
- Contains classes to find and manage raw
This module contains classes and subsystem modules for doing a Fake hit rate analysis on raw .prdf
files. The module contains classes for loading pixel masks from the conditions database, creating hitmaps from raw data, and calculating the fake hit rate.
-
MvtxPixelDefs
- Contains definitions and methods for creating pixel keys for each pixel in the MVTX detector. The pixel key is a 64-bit integer that uniquely identifies each pixel in the detector.
-
MvtxPixelMask
- Class which loads pixel masks from the conditions database and provides methods for masking pixels in hitmaps.
-
MvtxHitMap
- Class which creates hitmaps from raw data files. Hitmap is a vector of pairs of pixel keys and the number of hits in that pixel.
-
MvtxFakeHitRate
- Main class for calculating the fake hit rate. Creates hitmaps from raw data files, masks pixels, and calculates the fake hit rate.
-
SetOutputfile(std::string outputfile)
- Sets the output file for the fake hit rate analysis. The output file will contain the fake hit rate and the optimized pixel mask.
-
SetMaxMaskedPixels(int max_masked_pixels)
- Sets the maximum number of pixels to mask in the optimization. The optimization will mask the
max_masked_pixels
pixels with the most hits in the hitmap.
- Sets the maximum number of pixels to mask in the optimization. The optimization will mask the
-
MvtxTriggerRampGaurd
- Event selector that selects events based on change in BCO. This is used to remove strobes at the beginning of the run when the trigger rate is not stable.
-
SaveOutput(std::string outputfile)
- Sets to debug mode. Saves histograms of
$\Delta BCO$ both before and after the trigger ramp guard. Also saves TTree with all$\Delta BCO$ values.
- Sets to debug mode. Saves histograms of
-
SetTriggerRate(double trigger_rate)
- Sets the trigger rate in kHz. This is used to calculate the expected number GTM periods between readout windows.
-
SetConcurrentStrobeTarget(int target)
- Sets the target number of concurrent strobes that need to be less than the threshold to pass the trigger ramp guard.
This module contains classes to find and manage raw .prdf
files in the sPHENIX raw data directories on RCF. This allows users to find and load raw data files for analysis for any subsystem with a given run number.
-
RawDataDefs
- Contains definitions for the raw data file types and the directory structure of the raw data files on RCF. This also contains naming schemes for all subsystems.
- Some useful definitions:
RawDataDefs::SPHNXPRO_COMM : "/sphenix/lustre01/sphnxpro/commissioning"; RawDataDefs::SPHNXPRO_PHYS : "/sphenix/lustre01/sphnxpro/physics"; RawDataDefs::BEAM : "beam"; RawDataDefs::CALIB : "calib"; RawDataDefs::COSMIC : "cosmic"; RawDataDefs::PHYSICS : "physics"; RawDataDefs::DATA : "data"; RawDataDefs::JUNK : "junk"; RawDataDefs::GL1 : "GL1"; RawDataDefs::HCAL : "HCal"; RawDataDefs::INTT : "INTT"; RawDataDefs::LL1 : "LL1"; RawDataDefs::MVTX : "MVTX"; RawDataDefs::TPOT : "TPOT"; RawDataDefs::ZDC : "ZDC"; RawDataDefs::EMCAL : "emcal"; RawDataDefs::MBD : "mbd"; RawDataDefs::TPC : "tpc";
-
RawFileUtils
- Namespace with utility function for determining if a raw prdf file is valid for analysis. This includes checking if the file is complete, and is the correct file type.
-
RawFileFinder
- Class for finding raw data files in the sPHENIX raw data directories on RCF. Uses bash commands to find files and directories based on run number and subsystem.
-
RawDataManager
-
Main class for managing raw data files. This class finds raw data files, loads them into memory, and provides methods for accessing the raw data files.
-
Example usage:
RawDataManager * rdm = new RawDataManager(); rdm->SetDataPath(RawDataDefs::SPHNXPRO_COMM); // or RawDataDefs::SPHNXPRO_PHYS rdm->SetRunNumber(42639); rdm->SetRunType(RawDataDefs::CALIB); // physics, calib, junk, etc. rdm->SelectSubsystems({RawDataDefs::MVTX, RawDataDefs::GL1}); // rdm->GetAvailableSubsystems(); rdm->Verbosity(0); std::vector<std::string> mvtx_files = rdm->GetFiles( RawDataDefs::MVTX, RawDataDefs::get_channel_name(RawDataDefs::MVTX, 2));
The above code will find all MVTX and GL1 files for the given run number and run type. The
iflx
variable is the file index, which is used to get the nth FELIX server for the MVTX. TheRawDataDefs::get_channel_name
function is used to get the channel name for the given subsystem and channel index. Themvtx_files
vector will contain all the MVTX files for the given run number and run type.for (auto file : mvtx_files) { std::cout << file << std::endl; }
Output:
/sphenix/lustre01/sphnxpro/commissioning/MVTX/calib/calib_mvtx2-00042639-0000.evt /sphenix/lustre01/sphnxpro/commissioning/MVTX/calib/calib_mvtx2-00042639-0001.evt /sphenix/lustre01/sphnxpro/commissioning/MVTX/calib/calib_mvtx2-00042639-0002.evt /sphenix/lustre01/sphnxpro/commissioning/MVTX/calib/calib_mvtx2-00042639-0003.evt /sphenix/lustre01/sphnxpro/commissioning/MVTX/calib/calib_mvtx2-00042639-0004.evt /sphenix/lustre01/sphnxpro/commissioning/MVTX/calib/calib_mvtx2-00042639-0005.evt /sphenix/lustre01/sphnxpro/commissioning/MVTX/calib/calib_mvtx2-00042639-0006.evt /sphenix/lustre01/sphnxpro/commissioning/MVTX/calib/calib_mvtx2-00042639-0007.evt /sphenix/lustre01/sphnxpro/commissioning/MVTX/calib/calib_mvtx2-00042639-0008.evt /sphenix/lustre01/sphnxpro/commissioning/MVTX/calib/calib_mvtx2-00042639-0009.evt
-
The fake hit rate analysis is run using the Fun4All_MvtxFHR.C
macro in the MvtxCalibration/macros
directory. This macro will run the fake hit rate analysis on raw MVTX data files and save the results to an output file. The macro takes the following arguments:
nEvents
: Number of events to processrun_number
: Run number of the datatrigger_rate_kHz
: Trigger rate in kHzoutput_name
: Output file nameselected_layer
: Selected layer to analyze (optional, -1 for all layers)trigger_guard_output_name
: Output file name for trigger guard analysis (optional)
The macro can be run using the following command:
root -l -b -q 'Fun4All_MvtxFHR.C(10000, 42641, 44, "output.root", "-1", "trigger_guard_output.root")'
The macro will initialze a Fun4All server, then load raw MVTX data files for the given run number using the RawDataManager
class. The macro will then create a MvtxFakeHitRate
object and set the output file name and the maximum number of pixels to mask. The macro will then run the fake hit rate analysis and save the results to the output file. The output file will contain the fake hit rate and the optimized pixel mask.
To generate a json file with the pixel mask, you can use the MakeJsonHotPixelMap.C
macro in the MvtxCalibration/macros
directory. This macro will read the output file from the fake hit rate analysis and generate a json file with the pixel mask. The macro takes the following arguments:
calibration_file
: Output file from the fake hit rate analysistarget_threshold
: Target threshold for fake hit rate
The macro can be run using the following command:
root -l -b -q 'MakeJsonHotPixelMap.C("output.root", 10e-8)'
The macro will read the output file from the fake hit rate analysis and generate a json file with the pixel mask. The json file will contain the pixel mask and the fake hit rate for each pixel. The macro will also print the number of pixels masked and the fake hit rate threshold.
This is a work in progress and likely has some bugs. If you have any questions or need help, please contact me at
<[email protected]>
.