Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
*.root
*.o
*.swp
*.root
*.log
.depend
example/analysis
leaf/DataModelRootDict*
leaf/HKAstroAnalysis.*
leaf/DataModel
Expand Down
101 changes: 58 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,81 @@
# LEAF
Low Energy Algoritm Framework
# :seedling: LEAF :seedling:

<ins>**L**</ins>ow <ins>**E**</ins>nergy <ins>**A**</ins>lgorithm <ins>**F**</ins>ramework


# DESCRIPTION

This algorithm is an alternative and simple LE fitter than can be used for HyperK and SuperK.

~~~~~~~~~~~~~~~~~~~~~~~~~
2020/02/09: LEAF was convert as a C++ class and can be included in your code.
~~~~~~~~~~~~~~~~~~~~~~~~~

New compilation method:

source RunAtStart.sh
./SetupDataModel.sh
cd leaf/
make clean; make

In order to use the class in your code look at example/
~~~~~~~~~~~~~~~~~~~~~~~~~
# DOWNLOAD AND PRE-REQUISITES

To download this repository use :

```
git clone --single-branch --branch develop_lite https://github.com/hyperk/LEAF.git
```

Then make sure the following pre-requisites are installed.
1. ROOT v5r34 or superior (not tested for older versions, but might work).
2. WCSim version compatible with your ROOT version.
3. BONSAI installation (although LEAF can work without it).

# COMPATIBILITY

# Pre-requisite to use the code:
1. BONSAI installation.
2. ROOT v5r34 or superior (not tested for older versions, but might work).
3. HKAstroAnalysis class is private and can be downloaded by SK collaborators on sukap cluster.
Versions listed below have been tested so far.

# Compatibility tested so far:
1. WCSim-hybrid version: for geometries "HyperK", "HyperK_mPMT", "HyperK_HybridmPMT", "HyperK_HybridmPMT10PC"
2. In general, with all WCSim-hybrid geometries using whether BoxandLine20inchHQE or PMT3inchR14374 PMTs.
3. With official HK WCSim: Ask G. Pronost.

# How to:
1. Source RunAtStart.sh after you updated your ROOT directory.
2. Use the script ./SetupDataModel.sh to define the DataModel (if you have hk-AstroAnalysis, you should setup the global variable)
2. Enter the leaf/ repository and make clean;make
3. Enter the example repository and make clean;make
4. One example of how to run the code is set in example: test_example.sh
5. inputs PDF, input from WCSim can be downloaded on sukap cluster. Please untar them in the LEAF repository.
6. You can use shell scripts in shell/ in order to run the fitter or launch on batch.

# Useful scripts in ./macros and ./shell
You can compile with GNUMake like following in ./macros:

# INSTALLATION

1. Go to libWCSIM/ repository and make softlinks to your WCSim installation.
```
$ cd libWCSIM/
$ ln -s /path/to/your/WCSim/include/ include
$ ln -s /path/to/your/WCSim/src/ src
$ ln -s /path/to/your/WCSim/lib/libWCSimRoot.so libWCSimRoot.so
$ ln -s /path/to/your/WCSim/lib/libWCSimRoot.so.1.12.xx libWCSimRoot.so.1.12.xx
```
2. Go to the cloned LEAF repository and source the script RunAtStart.sh after making sure you are sourcing the proper ROOT directory.
```
$ cd /path/to/the/cloned/repository/LEAF
$ source ./RunAtStart.sh
```
3. Enter the leaf/ repository and `make clean; make`
4. Enter the example/ repository and `make clean; make`
5. One example of how to run the code is set in example: test_example.sh

# TUNING FILES

Tuning files are provided in the inputs/ repository (e.g. ./inputs/timePDF_Directionality_DRnew.root) and are made from 10 MeV electrons generated isotropically and uniformly in the tank.
Alternatively, you can generate your own PDFs by following the commands below.

1. Go to macros/ repository and compile AnalyzeWSHierarchy and ProducePDF with GNUMake.
```
$ cd ./macros
$ make AnalyzeWSHierarchy
$ make ProducePDF
```
## Making tuning file (e.g. ./inputs/timePDF_Directionality_DRnew.root)
1. Produce plots by AnalyzeWSHierarchy: reads out WCSim output and makes plots.
2. Produce time PDF (and angular PDF) by ProducePDF: uses plots made by AnalyzeWSHierarchy and generate PDFs for LEAF.

2. Produce plots using AnalyzeWSHierarchy which reads out WCSim output. Optionally, you can index a range of events to read with -s (start index) and -e (end index).
```
$ AnalyzeWSHierarchy -f wcrim_hybrid.root -o plots.root
$ ProducePDF -f plots.root -o PDF.root
$ ./AnalyzeWSHierarchy -i wcrim.root -o plots.root -s 0 -e 1000 -v
```

## Making generic plots
- LEAFOutputAnalysisHybrid_leafclass: read LEAF output to produce generic plots. If one uses the master branch for LEAF, please use LEAFOutputAnalysisHybrid_master
3. Produce time PDF and angular PDF using ProducePDF: uses plots made using AnalyzeWSHierarchy and generate PDFs for LEAF.
```
$ ./ProducePDF -i plots.root -o PDF.root
```

## Shell scripts for analysis of large files
You can refere shell scripts in ./shell in order to analyze many files.
They are not working with latest LEAF class and its examples. They are just example how to analyze.
Pathes to PDF files required as inputs for LEAF are hard-coded inside leaf/LeafSplines.cc, inside the LoadSplines() methods.
Make sure these pathes are consistant with the files you generate on your own.

- generateShellXX.c: this is a root macro which generates shell scripts to be submitted to sukap by LauncherXX.sh
- generateShell.c
- generateShell_analyzeWCSim.c
- LauncherXX.sh: this submits jobs to sukap
- Launcher.sh
- Launcher_analyzeWCSim.sh
- Merger_analyzeWCSim.sh: merge generated output by Launcher_analyzeWCSim.sh

16 changes: 0 additions & 16 deletions SetupDataModel.sh

This file was deleted.

27 changes: 9 additions & 18 deletions example/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,38 @@ include ../Makefile/Makefile.${OSNAME}

# set compiler options for ROOT
CXXFLAGS += $(shell root-config --cflags)
CXXFLAGS += '-fPIC' -std=c++11 -Wall -Wpedantic -Wno-long-long
CXXFLAGS += -fPIC -std=c++17 -Wall -Wpedantic -Wno-long-long

INCFLAGS = -I. -I$(shell root-config --incdir)
INCFLAGS += -I$(WCSIM_BUILD_DIR)/include/WCSim
# INCFLAGS += -I$(WCSIMDIR)/include
# INCFLAGS += -I$(BONSAIDIR)/bonsai
INCFLAGS = -I.
#INCFLAGS += -I$(shell root-config --incdir) #included in --cflags
INCFLAGS += -I$(LEAFDIR)/libWCSIM/include
INCFLAGS += -I$(LEAFDIR)/leaf
INCFLAGS += -I$(LEAFDIR)/leaf/DataModel
INCFLAGS += -I$(LEAFDIR)/leaf/DataModel-lite

# LIBS += -L${WCSIMDIR} -lWCSimRoot
LIBS += -L${WCSIM_BUILD_DIR}/lib -lWCSimRoot
LIBS += -L$(LEAFDIR)/libWCSIM -lWCSimRoot
LIBS += $(shell root-config --libs) -lMinuit
# LIBS_BONSAI += -L${BONSAIDIR} -lWCSimBonsai
LIBS_LEAF += -L${LEAFDIR}/lib -lDataModelLite -lHKManager -lLEAF #-lHKAstroAnalysis


OBJECT = analysis

CXXFLAGS += -std=c++17

all: $(OBJECT)

analysis: analysis.o
@echo '<< compiling bin analysis >>'
@$(CXX) -g $(CXXFLAGS) -o $@ $^ $(LIBS) $(LIBS_BONSAI) $(LIBS_LEAF)


@$(CXX) -g $(CXXFLAGS) -o $@ $^ $(LIBS) $(LIBS_LEAF)

# default rules
.cc.o:
@echo '<< compiling' $< '>>'
@$(CXX) $(CXXFLAGS) $(INCFLAGS) -c $<

%.o: %.cc %.hh
%.o: %.cpp %.hpp
@echo '<< compiling' $< '>>'
@$(CXX) $(CXXFLAGS) $(INCFLAGS) -c -o $@ $<

%.o: %.cpp
@echo '<< compiling' $< '>>'
@$(CXX) $(CXXFLAGS) $(INCFLAGS) -c -o $@ $<


%.o: %.C %.h
@echo '<< compiling' $< '>>'
@$(CXX) $(CXXFLAGS) $(INCFLAGS) -c -o $@ $<
Expand Down
56 changes: 0 additions & 56 deletions example/GNUmakefile_nobonsai

This file was deleted.

Loading