-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ANNIEsoft:Application' into Application
- Loading branch information
Showing
29 changed files
with
1,447 additions
and
694 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,89 @@ | ||
# CNNImage | ||
|
||
CNNImage creates ANNIE event display information in a csv-file format that can directly be loaded into Machine Learning classifier frameworks like CNNs for image classification purposes. Currently only PMT information from the side PMTs is loaded, no information from the top/bottom PMTs and LAPPDs is used. | ||
CNNImage creates ANNIE event display information in matrix format that | ||
can directly be loaded and used by Machine Learning classifier frameworks like CNNs for image/event | ||
classification purposes. Currently only PMT information is loaded, no information from the LAPPDs is used. | ||
|
||
The event display created by this tool is given in a rectangular format (static mapping mode: 16x10, | ||
geometric mapping mode: user-defined shape), and produces normalized and absolute charge and time | ||
(time of first hit, and average hit time) maps that are stored in boost stores or may be written | ||
to csv files. | ||
|
||
## Data | ||
|
||
CNNImage creates multiple `.csv`-files and one `.root`-file. Each csv-file contains the event display information in single rows per event for a specific event type (PMTs/LAPPDs, charge/time), whereas the root-file provides the same information in a 2D histogram format. | ||
CNNImage creates multiple `.csv`-files and one `.root`-file, when `WriteToFile` | ||
is set to 1 in the config file. Each csv-file contains the event display information in single rows | ||
per event for a specific event type (PMTs/LAPPDs, charge/time), whereas the root-file provides the | ||
same information in a 2D histogram format, where each event gets its own histogram. | ||
|
||
The PMT data can be written Static mode, with a pre-defined mapping (16x10 Matrix) or Geometric mode | ||
(every pixel is defined by its geometric location, if a PMT happens to be within the pixel its value | ||
is added to the pixel value, PMTs can overlap. Top and bottom caps are given by circles and not | ||
squished into rows). The configuration variables `DimensionX` and `DimensionY` hence only apply when | ||
using the `Geometric` save mode and not for the `Static` save mode. | ||
|
||
LAPPDs are not yet supported in the static mapping. Further, static mapping does not support | ||
dynamically resizing the output matrix size. | ||
|
||
The `DataMode` configuration specifies whether the average hit time per PMT is calculated as a simple | ||
mean (`Normal`) or weighted by the charge (`Charge`). | ||
|
||
The PMT data can be written PMT-wise (every pixel is reserved for just 1 PMT, no spaces in between) or geometrically (every pixel is defined by its geometric location, if a PMT happens to be within the pixel its value is added to the pixel value). The configuration variables `DimensionX` and `DimensionY` hence only apply when using the `Geometric` save mode and not for the `PMT-wise` save mode. The dimensions for the `PMT-wise` save mode are simply given by the number of PMTs in x- and y-direction. When choosing `PMT-wise`, the LAPPD information is also saved per LAPPD in a 20x20cm grid. | ||
## Boost store | ||
The following data are provided within the RecoEvent boost store | ||
``` | ||
m_data->Stores.at("RecoEvent")->Set("CNNImageCharge", cnn_image_charge); | ||
m_data->Stores.at("RecoEvent")->Set("CNNImageChargeAbs", cnn_image_charge_abs); | ||
m_data->Stores.at("RecoEvent")->Set("CNNImageTime", cnn_image_time); | ||
m_data->Stores.at("RecoEvent")->Set("CNNImageTimeFirst", cnn_image_time_first); | ||
``` | ||
where the images are implemented as | ||
``` | ||
std::vector<double> cnn_image_charge(cnn_image_size, 0); | ||
``` | ||
|
||
The `DataMode` configuration specifies whether the average hit time per PMT is calculated as a simple mean (`Normal`) or weighted by the charge (`Charge-Weighted`). | ||
## Binning in Static mapping mode | ||
The Static PMT binning is defined in the `CNNImage::StaticPMTBinning` method. The vertical (y) and | ||
horizontal (x/phi) binning is implemented (in detector coordinates) as | ||
``` | ||
const std::vector<double> vertical_bins = {-180.0, -160.0, -125.0, -75.0, -30.0, 10.0, 30, 75.0, 130.0}; | ||
std::vector<double> phi_bins; | ||
for (int i = 0; i < 17; i++) { | ||
phi_bins.push_back(i * 2 * TMath::Pi() / 16); //16 bins for 16 PMTs next to eachother | ||
} | ||
``` | ||
The bottom and top PMTs are split into two rows, where the inner circle of the tank top PMTs correspond | ||
to the first row, the inner circle of the tank bottom PMTs correspond to the last row in the produced | ||
output. | ||
|
||
## Prerequisites | ||
The tool needs the following tools to be loaded at some point beforehand: | ||
``` | ||
MCParticleProperties | ||
MCRecoEventLoader | ||
ClusterFinder | ||
DigitBuilder | ||
TimeClustering | ||
EventSelector | ||
EnergyExtractor | ||
``` | ||
|
||
## Configuration | ||
|
||
CNNImage uses the following configuration variables: | ||
CNNImage uses the following recommended configuration variables: | ||
|
||
``` | ||
verbosity 1 | ||
DataMode Normal #options: Normal / Charge-Weighted | ||
SaveMode Geometric #options: Geometric / PMT-wise | ||
DimensionX 16 #choose something suitable (32/64/...) | ||
DimensionY 20 #choose something suitable (32/64/...) | ||
OutputFile beam_test0 #csv file name | ||
DetectorConf ANNIEp2v6 #specify the detector version used in simulation | ||
verbosity 0 | ||
DataMode Normal #options: Charge/Time/Normal | ||
SaveMode Static #options: Static / Geometric | ||
DimensionX 16 #choose something suitable (32/64/...) Relevant only for geometric mode | ||
DimensionY 10 #choose something suitable (32/64/...) | ||
OutputFile your_base_name #base name of output files, if WriteToFile == 1 | ||
DimensionLAPPD 5 #Size of the LAPPD pannal | ||
IncludeTopBottom 1 #Whether top and bottom should be included | ||
#IncludeTopBottom is only relevant for geometric mode | ||
DetectorConf ANNIEp2v7 | ||
useLAPPDs 0 | ||
WriteToFile 0 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 10 additions & 8 deletions
18
configfiles/CNNImage/CNNImage_Data/CNNImageConfig
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
# CNNImage config file | ||
|
||
verbosity 1 | ||
DataMode Normal #options: Charge/Time | ||
SaveMode PMT-wise #options: Geometric / PMT-wise | ||
verbosity 0 | ||
DataMode Normal #options: Normal / Charge-Weighted / TimeEvolution | ||
SaveMode Static #options: Static / Geometric | ||
DimensionX 16 #choose something suitable (32/64/...) | ||
DimensionY 20 #choose something suitable (32/64/...) | ||
OutputFile R1613p1_CNNImage | ||
DimensionLAPPD 5 # Size of the LAPPD pannal | ||
DimensionY 10 #choose something suitable (32/64/...) | ||
OutputFile CNNImage_data_testData | ||
useLAPPDs 0 | ||
DimensionLAPPD 5 #Size of the LAPPD pannal | ||
IncludeTopBottom 1 | ||
DetectorConf ANNIEp2v6 #specify the detector version used in simulation | ||
IsData 1 #IsData: 0/1 | ||
DetectorConf ANNIEp2v7 #specify the detector version used in simulation | ||
IsData 1 | ||
WriteToFile 0 |
18 changes: 11 additions & 7 deletions
18
configfiles/CNNImage/CNNImage_MC/CNNImageConfig
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
# CNNImage config file | ||
|
||
verbosity 0 | ||
DataMode Normal #options: Charge/Time | ||
SaveMode PMT-wise #options: Geometric / PMT-wise | ||
verbosity 1 | ||
IsData 0 | ||
DataMode Normal #options: Normal / Charge-Weighted / TimeEvolution | ||
SaveMode Static #options: Static / Geometric | ||
DimensionX 16 #choose something suitable (32/64/...) | ||
DimensionY 20 #choose something suitable (32/64/...) | ||
OutputFile test_beam_lappd5x5_0 | ||
DimensionLAPPD 5 # Size of the LAPPD pannal | ||
DimensionY 32 #choose something suitable (32/64/...) | ||
OutputFile ./test_output_cnnimageNM_geometric | ||
DimensionLAPPD 5 #Size of the LAPPD pannal | ||
IncludeTopBottom 1 | ||
DetectorConf ANNIEp2v6 #specify the detector version used in simulation | ||
DetectorConf ANNIEp2v7 #specify the detector version used in simulation | ||
useLAPPDs 0 | ||
WriteToFile 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# CNNImage config file | ||
|
||
verbosity 1 | ||
DataMode Normal #options: Normal / Charge-Weighted / TimeEvolution | ||
SaveMode Static #options: Static / Geometric / PMT-wise | ||
DimensionX 16 #choose something suitable (32/64/...) | ||
DimensionY 10 #choose something suitable (32/64/...) | ||
OutputFile cnnimage_electron_la_sE_1_94 | ||
MCStaticMapping configfiles/CNNImage/mc_cnnimage_mapping.csv | ||
DataStaticMapping configfiles/CNNImage/data_cnnimage_mapping.csv | ||
DimensionLAPPD 5 #Size of the LAPPD pannal | ||
IncludeTopBottom 1 | ||
DetectorConf ANNIEp2v7 #specify the detector version used in simulation | ||
useLAPPDs 0 | ||
WriteToFile 0 |
Oops, something went wrong.