Skip to content
Snippets Groups Projects
README.md 7 KiB
Newer Older
1147119500@qq.com's avatar
1147119500@qq.com committed
# BLUET-v5
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
Program for MTPC Series Simulation and Analysis.
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
# For Developers
Developers please follow the following process to collaborate on development.
1. 'git clone' the main branch on your own PC.
2. create new branch to record your jobs.
3. after 'git add' the necessary changes, 'git commit' them with proper introduction.
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
4. use 'git push --set-upstream your_branch' to store your work in the remote depository.
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
5. when finishing the modular work, please merge the main branch to your_branch.
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
6. resolve the confilicts
7. push your_branch to the gitlab
8. submit merge request to the main branch in gitlab.
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
# Prerequisites

To build the project you need

- a C++ compiler that supports C++17,
- a Fortran compiler,
- ROOT 6,
- GSL (GNU Scientific Library),
- CMake (version 3.9 or higher),
- Geant4 (version 10.6 or higher),
- Garfield++,
- fmt,
- eigen3.

hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
## Building the project
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
For simplicity on the server of the Institute of High Energy, we define a shell file `bluet.sh` to help users configure environment variables.
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
Assuming that `bluet.sh` is added to your `.bashrc`, such as 
```
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
>>> source /wns_ana/chenhaizheng-ana/bluet-v5/bluet.sh
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
```
you can build BLUET as follows: 
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
    >>> mkdir build
    >>> cd build
    >>> cmake ..
    >>> make -j<number of cores on your machine>

Otherwise, you need to make sure all dependencies are installed locally.
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
## Running the examples
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
You can run the examples from everywhere, while the path of the running file is declared in `bluet.sh`, such as:

```
>>> bluet
```

When you run the program for the first time, prompts for using each functional module will be given in the terminal, and a `temp_env.xml` file will be generated to record each working directory. 

The command line will output the following information:

```
DESCRIPTION
    Program for MTPC Series Simulation and Analysis.

SYNOPSIS
    bluet [--config <filepath>] [--rawdata <dirpath>] [--rootdata <dirpath>] [--eventdata <dirpath>]
          [--simdata <dirpath>]

    bluet geant4 [-t <threads>] [-n <events>] [--vis] [--subtask]
    bluet garfield [--read] [--gen]
    bluet raw2root [-f <name1...nameN>...] [-r <number1 number2>...] [-t <threads>] [--dir]
yih@ihep.ac.cn's avatar
yih@ihep.ac.cn committed
          [--subtask] [--slurm]
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed

    bluet factory [-f <name1...nameN>...] [-r <number1 number2>...] [-t <threads>] [-j <jobs>]
yih@ihep.ac.cn's avatar
yih@ihep.ac.cn committed
          [--dir] [--track] [--subtask] [--slurm]
yih@ihep.ac.cn's avatar
yih@ihep.ac.cn committed
    bluet lab [-f <name1...nameN>...] [-r <number1 number2>...] [--dir] [--cut] [--slurm]
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
    bluet drawwave [-f <name>] [--fit] [--cut]
    bluet drawevent [-f <name>] [--dec] [--cut] [--track] [--fit]
    bluet drawmap [-f <name>] [--vis]

OPTIONS
    change the environment:
        --config <filepath>           Change the path of config file.
        --rawdata <dirpath>           Change the path of raw data directory.
        --rootdata <dirpath>          Change the path of root data directory.
        --eventdata <dirpath>         Change the path of event data directory.
        --simdata <dirpath>           Change the path of sim data directory.

    geant4 mode:
        -t <threads>                  Set the numbet of multiple running threads.(default 1)
        -n <events>                   Set the numbet of events.
        --vis                         Start program in visual mode.
        --subtask                     Internal use of the program.

    garfield mode:
        --read                        Set the read funciont of Garfield module.
        --gen                         Set the generate funciont of Garfield module.

    raw2root mode:
        -f <name1...nameN>            Please input filenames.
        -r <number1 number2>          Please input two number(min max) to range a set of files.
        -t <threads>                  Set the numbet of multiple running threads.(default 1)
        --dir                         Processes all files under the RawData directory.
        --subtask                     Internal use of the program.
yih@ihep.ac.cn's avatar
yih@ihep.ac.cn committed
        --slurm                       Enable slurm mode.
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed

    factory mode:
        -f <name1...nameN>            Please input filenames.
        -r <number1 number2>          Please input two number(min max) to range a set of files.
        -t <threads>                  Set the numbet of multiple running threads.(default 1)
        -j <jobs>                     One file divided to number of tasks.(default 100)
        --dir                         Processes all files under the RootData directory.
yih@ihep.ac.cn's avatar
yih@ihep.ac.cn committed
        --dec                         Enable deconvolution.
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
        --track                       Enable track.
        --subtask                     Internal use of the program.
yih@ihep.ac.cn's avatar
yih@ihep.ac.cn committed
        --slurm                       Enable slurm mode.
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed

    lab mode:
        -f <name1...nameN>            Please input filenames.
        -r <number1 number2>          Please input two number(min max) to range a set of files.
        --dir                         Processes all files under the EventData directory.
        --cut                         Enable cut.
yih@ihep.ac.cn's avatar
yih@ihep.ac.cn committed
        --slurm                       Enable slurm mode.
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed

    drawwave mode:
        -f <name>                     Please input filename.
        --fit                         Enable fit.
        --cut                         Enable cut.

    drawevent mode:
        -f <name>                     Please input filename.
yih@ihep.ac.cn's avatar
yih@ihep.ac.cn committed
        --dec                         Enable deconvolution.
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
        --cut                         Enable cut.
        --track                       Enable track.
        --fit                         Enable Drawfit.

    drawmap mode:
        -f <name>                     Please input filename.
        --vis                         Enable visual the map file.

LICENSE
    China Spallation Neutron Source
```

The temporary environment variables of the program include the following five items:

- bluet_config: The path to the configuration file.
- bluet_rawdata: Experiment data storage directory.
- bluet_rootdata: Experimental data after format conversion.
- bluet_eventdata: Experimental data after data processing.
- bluet_simdata: Simulated signal data.

Temporary environment variables can be modified manually or with program-assisted modification.

```
>>> bluet --config /path/to/file
```

Ensure that all environment variables are set correctly, the configuration file is filled in correctly, and the program can select a function to run.

```
>>> bluet raw2root -f Daq.run.20231101091451.001.dat
```
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
In the following lines we use the geant4 example (`-t` is the selected threads, `-n` is the number of events):
hzchen@ihep.ac.cn's avatar
hzchen@ihep.ac.cn committed
>>> bluet geant4 -t 5 -n 1000
```

## Support
Here are some tutotials on MTPC and BLUET on Bilibili:
- [MTPC tutorial on Bilibili.](https://www.bilibili.com/video/BV11p4y1J7Y5/?spm_id_from=333.999.0.0&vd_source=752a33a845dc197d2672a4790fc6a4cc)
- [BLUET tutorial on Bilibili.](https://www.bilibili.com/video/BV1au4y197cF/?spm_id_from=333.999.0.0)

## Authors and acknowledgment
yangli@ihep.ac.cn's avatar
yangli@ihep.ac.cn committed
See [AUTHORS.md](./AUTHORS.md)
yangli@ihep.ac.cn's avatar
yangli@ihep.ac.cn committed
This software is distributed under the terms of the MIT license.
yih@ihep.ac.cn's avatar
yih@ihep.ac.cn committed
## Notes for developers
See [Notes for developers](https://code.ihep.ac.cn/csns-backn-tpc/bluet-v5/-/wikis/BLUET/Notes-for-developers).