Skip to content

Commit

Permalink
Added NIP example that shows how to define trigger box as plane 2 of …
Browse files Browse the repository at this point in the history
…a detector
  • Loading branch information
dorotheapfeiffer committed May 4, 2023
1 parent 5f3bbdd commit d512910
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ plane clusters also in the detector cluster tree. The entries of the missing pla
2: COG including only over Threshold hits
3: COG2 including only over Threshold hits
4: position and time of largest ADC
5: trigger pattern (NIP box), the trigger pattern is stored as integer in time_algo2
The vmm that is connected to the NIP box has to be defined as plane 2 of the detector. The channels of the VMM have to be mapped to the strips in the form channel representing bit 0 = strip 0, bit 1 channel = strip 1 and so on.

-crl: Valid clusters normally have the same amount of charge in both detector planes
(ratio of charge plane 0 / charge plane 1 is 100% or 1). Depending on the readout,
Expand Down
2 changes: 1 addition & 1 deletion run/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ vmm-sdat is the analysis software for VMM3a data, recorded with the SRS or the E
The convertFile utility reads in the pcap file, and produces a root tree with the hits and clusters. The utility can be run directly from the command line, but since there are many parameters to be set, it is easier to use a script. In the analysis folder one finds the runConversion.py script. The script illustrates, how to run convertFile with the example.pcapng data file. The script shows how to store hits, plane clusters and detector clusters. The meaning of the command line parameters is explained in the main README file.

## Geometry files
Instead of defining the geometry with the parameters -vmm, -axis, -map one can also use a JSON geometry file. The file example_geometry.json in the run directory illustrates the format. In the script runConversion_geometry.py shows how to use the geometry file. In case the detector readout is pads and not strips, the file example_geometry_pads.json illustrates how to define such a detector. The script runConversion_geometry_pad.py executes the pad example. The example geometry_LET.json shows a geometry implementation of a MultiGrid detector that consists of wires and grids. For the grids only some channels on one VMM on the hybrid are used, whereas for the wires two VMMs on one hybrid are used. The channels that are not connected on the VMM3a are marked with a -1. The data format of the example_LET.pcapng file is the ESS data format, whereas the other pcapng files are in the SRS data files.
Instead of defining the geometry with the parameters -vmm, -axis, -map one can also use a JSON geometry file. The file example_geometry.json in the run directory illustrates the format. In the script runConversion_geometry.py shows how to use the geometry file. In case the detector readout is pads and not strips, the file example_geometry_pads.json illustrates how to define such a detector. The script runConversion_geometry_pad.py executes the pad example. The example geometry_LET.json shows a geometry implementation of a MultiGrid detector that consists of wires and grids. For the grids only some channels on one VMM on the hybrid are used, whereas for the wires two VMMs on one hybrid are used. The channels that are not connected on the VMM3a are marked with a -1. The data format of the example_LET.pcapng file is the ESS data format, whereas the other pcapng files are in the SRS data files. The NIP example runConversion_NIP.py shows how to define the VMM connected to the trigger box as plane 2 of a detector. The vmm channel representing bit 0 of the event-Id has to be mapped to strip 0, the channel presenting bit 1 to strip 1 and so on. As algorithm algo5 has to be chosen. Algo5 then decodes the event-ID from the strip pattern and writes it as integer into the time2_algo field in the tree.

If you define in your geometry file "plane2", vmm-sdat assumes that you are using a flat geometry with three planes of strips, like XYU or XUV. The tool then tries to find clusters in all three planes, and does not only match plane 0 and plane 1 as in the normal strip readout. Since the angles between the planes are not known in the XYU or XUV case, vmm-sdat does not provide overview plots for plane 2. The example runConversion_xyu.py illustrates the use of an xyu geometry with planes 0,1 and 2.

Expand Down
88 changes: 88 additions & 0 deletions run/example_geometry_NIP.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"vmm_geometry": [
{
"detector": 0,
"plane": 0,
"fec": 6,
"vmm": 0,
"id0": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63]
},
{
"detector": 0,
"plane": 0,
"fec": 6,
"vmm": 1,
"id0": [64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,
101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127]
},
{
"detector": 0,
"plane": 0,
"fec": 6,
"vmm": 2,
"id0": [128,129,130,131,132,133,134,135,136,137,138,139, 140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,
164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191]
},
{
"detector": 0,
"plane": 0,
"fec": 6,
"vmm": 3,
"id0": [192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,
221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,
251,252,253,254,255]
},
{
"detector": 0,
"plane": 1,
"fec": 6,
"vmm": 8,
"id0": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63]
},
{
"detector": 0,
"plane": 1,
"fec": 6,
"vmm": 9,
"id0": [64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,
101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127]
},
{
"detector": 0,
"plane": 1,
"fec": 6,
"vmm": 10,
"id0": [128,129,130,131,132,133,134,135,136,137,138,139, 140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,
164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191]
},
{
"detector": 0,
"plane": 1,
"fec": 6,
"vmm": 11,
"id0": [192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,
221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,
251,252,253,254,255]
},

{
"detector": 0,
"plane": 2,
"fec": 7,
"vmm": 8,
"id0": [
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
0,1,2,3,4,5,6,7,8,9,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1
]
}


]
}
12 changes: 12 additions & 0 deletions run/runConversion_NIP.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/python
import os
import subprocess
import re
import sys

try:
args = ['../build/convertFile', '-f', './example_xyu.pcapng', '-geo', './example_geometry_NIP.json', '-bc', '44.44', '-tac', '60', '-th','0', '-cs','1', '-ccs', '3', '-dt', '200', '-mst', '1', '-spc', '500', '-dp', '200', '-coin', 'center-of-masss', '-crl', '0.2', '-cru', '10', '-save', '[[0],[0],[0]]', '-algo', '5', '-info', 'nip_trigger', '-df','SRS']
subprocess.call(args)

except OSError:
pass
38 changes: 31 additions & 7 deletions src/Clusterer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,11 +595,12 @@ int Clusterer::ClusterByStrip(std::pair<uint8_t, uint8_t> dp,

// Add members of a cluster, if it is either the beginning of a cluster,
// or if strip gap and time span is correct
if (stripCount == 0 ||
(std::fabs(strip1 - strip2) > 0 &&
std::fabs(strip1 - strip2) - 1 <= m_config.pMissingStripsClusterX &&
time1 - startTime <= m_config.pSpanClusterTime &&
largestTime - time1 <= m_config.pSpanClusterTime)) {
if (stripCount == 0 || (std::fabs(strip1 - strip2) > 0 &&
((plane == 2 && m_config.pAlgo == 5) ||
(std::fabs(strip1 - strip2) - 1 <=
m_config.pMissingStripsClusterX)) &&
time1 - startTime <= m_config.pSpanClusterTime &&
largestTime - time1 <= m_config.pSpanClusterTime)) {
DTRACE(DEB, "\tstrip %d, time %llu, adc %d:\n", strip1,
static_cast<unsigned long long>(time1), adc1);
if (adc1 > adc2) {
Expand Down Expand Up @@ -644,8 +645,11 @@ int Clusterer::ClusterByStrip(std::pair<uint8_t, uint8_t> dp,
vADC.emplace_back(adc1);
stripCount++;
}
// Stop clustering if gap between strips is too large or time span too long
else if (std::fabs(strip1 - strip2) - 1 > m_config.pMissingStripsClusterX ||
// Stop clustering if gap between strips is too large or time span too
// long
else if ((!(plane == 2 && m_config.pAlgo == 5) &&
(std::fabs(strip1 - strip2) - 1 >
m_config.pMissingStripsClusterX)) ||
time1 - startTime > m_config.pSpanClusterTime ||
largestTime - time1 > m_config.pSpanClusterTime) {
// Valid cluster
Expand Down Expand Up @@ -702,6 +706,16 @@ int Clusterer::ClusterByStrip(std::pair<uint8_t, uint8_t> dp,
pos_algo = largestADCPos;
time_algo = largestADCTime;
}
// trigger pattern
else if (m_config.pAlgo == 5) {
pos_algo = 0;
time_algo = 0;
if (plane == 2) {
for (int n = 0; n < vStrips.size(); n++) {
time_algo = time_algo + pow(2.0, vStrips[n]);
}
}
}

clusterPlane.time_utpc = time_utpc;
clusterPlane.pos_utpc = pos_utpc;
Expand Down Expand Up @@ -815,6 +829,16 @@ int Clusterer::ClusterByStrip(std::pair<uint8_t, uint8_t> dp,
pos_algo = largestADCPos;
time_algo = largestADCTime;
}
// trigger pattern
else if (m_config.pAlgo == 5) {
pos_algo = 0;
time_algo = 0;
if (plane == 2) {
for (int n = 0; n < vStrips.size(); n++) {
time_algo = time_algo + pow(2.0, vStrips[n]);
}
}
}
clusterPlane.time_utpc = time_utpc;
clusterPlane.pos_utpc = pos_utpc;
clusterPlane.time_algo = time_algo;
Expand Down
13 changes: 13 additions & 0 deletions src/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,19 @@ bool Configuration::PrintUsage(const std::string &errorMessage, char *argv) {
std::cout << " 3: COG2 including only over Threshold hits"
<< std::endl;
std::cout << " 4: position and time of largest ADC" << std::endl;
std::cout << " 5: trigger pattern (NIP box), the trigger pattern is "
"stored as integer in time_algo2"
<< std::endl;
std::cout << " The vmm that is connected to the NIP box has to be "
"defined as plane 2 of the detector."
<< std::endl;
std::cout << " The channels of the VMM have to be mapped to the "
"strips in the form:"
<< std::endl;
std::cout << " channel representing bit 0 = strip 0, channel for "
"bit 1 = strip 1 and so on."
<< std::endl;

std::cout << "-crl: Valid clusters normally have the same amount of charge "
"in both detector planes (ratio of charge plane 0/charge plane "
"1 is 100\% or 1.\n"
Expand Down

0 comments on commit d512910

Please sign in to comment.