Skip to content

Commit 33f746c

Browse files
authored
Merge pull request #467 from SBNSoftware/feature/fnicolas_pdsanalyzer
Add analyzer for PDS MC/reco studies
2 parents 9bdd09b + a16d97c commit 33f746c

9 files changed

Lines changed: 1889 additions & 0 deletions

File tree

sbndcode/OpDetAnalyzer/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
add_subdirectory(PDSAnalyzer)
2+
13
set(
24
MODULE_LIBRARIES
35
art::Framework_Principal
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
set(MODULE_LIBRARIES
2+
art::Framework_Principal
3+
art::Framework_Services_Registry
4+
art_root_io::tfile_support
5+
art_root_io::TFileService_service
6+
art::Persistency_Common
7+
art::Persistency_Provenance
8+
art::Utilities
9+
10+
ROOT::Tree
11+
ROOT::Core
12+
13+
larsim::Utils
14+
larsim::MCCheater_BackTrackerService_service
15+
larsim::MCCheater_ParticleInventoryService_service
16+
lardata::DetectorInfoServices_DetectorClocksServiceStandard_service
17+
larcore::Geometry_Geometry_service
18+
larcorealg::Geometry
19+
lardataobj::RawData
20+
lardataobj::RecoBase
21+
lardataobj::MCBase
22+
lardataobj::Simulation
23+
nusimdata::SimulationBase
24+
nug4::ParticleNavigation
25+
26+
sbnobj::Common_Reco
27+
sbndcode_OpDetSim
28+
29+
)
30+
31+
cet_build_plugin(SBNDPDSAnalyzer art::Module SOURCE SBNDPDSAnalyzer_module.cc LIBRARIES ${MODULE_LIBRARIES} )
32+
33+
add_subdirectory(job)
34+
35+
install_fhicl()
36+
install_source()
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Overview
2+
3+
`SBNDPDSAnalyzer` is an `art::analyzer` that saves useful information for PDS MC/reco studies at different stages of the simulation:
4+
- Gen: `MCTruth`
5+
- G4: `MCParticles` and deposited energy
6+
- Detsim: `OpDetWaveforms`
7+
- Reco1: deconvolved waveforms (`OpDetWaveforms`), `OpHits` and `OpFlashes`
8+
- Reco2: flash matchers scores (`SimpleFlash` and `OpT0Finder`) and `CRUMBS` score
9+
10+
Three TTrees are created:
11+
- `PDSMapTree`: Creates a tree with the optical channel IDs, position (X, Y and Z in cm) and the photon detector type (0: CoatedPMT, 1: UncoatedPMT, 2: VUV XARAPUCA and 3: VIS XARAPUCA).
12+
- `OpAnaTree`: TTree with the analysis variables (described below). Each entry in the TTree corresponds to an event.
13+
- `OpAnaPerTrackTree`: TTree with the number of SimPhotons produced by each MC particle. Each entry in the TTree corresponds to one MC particle in one event. Requires SimPhotons (not SimPhotonsLite).
14+
15+
Configuration parameters:
16+
- `SaveMCTruth`, `SaveMCParticles`, ...: booleans to save different data products at different stages of the simulation/reconstruction chain.
17+
- `Verbosity`: shows some printous while running the analyzer.
18+
- `MakePerTrackTree`: option to make a tree with the number of `SimPhotons` per `MCParticle` (`OpAnaPerTrackTree`).
19+
- `MakePDSGeoTree`: option to dump the PDS mapping in a TTree (`PDSMapTree`)
20+
- `UseSimPhotonsLite`: use `SimPhotonsLite` or `SimPhotons` (default is true, i.e. use `SimPhotonsLite`)
21+
- `KeepPDGCode`: specify what PDG codes will be stored in the TTree from the MC particles list. If no PDGs are specified, it saves all the MC particles (default is [], so it saves everything).
22+
- `MCTruthOrigin`: specify the `MCTruth` origins that will be saved. Default is [1], i.e. neutrino generated events.
23+
- `MCTruthPDG`: specify the PDG codes of the candidate vertex particles for the `MCTruth`. Defaults is [12, -12, 14, -14], i.e. BNB neutrinos.
24+
- `PDTypes`: vector specifying the PD types for which it will save the `SimPhotons` (default is ["pmt_coated", "pmt_uncoated"])
25+
- `G4BufferBoxX`, `G4BufferBoxY`, `G4BufferBoxZ`: only store MC particle trajectories inside the boundaries defined by the G4BufferBox variables.
26+
- `G4BeamWindow`: only store MC particles and trajectories in the time window defined by this parameter. Default is [-10000, 12000] #ns.
27+
28+
29+
# Variables in the TTree
30+
31+
### Variables at the particle generation stage
32+
33+
| Branch name | Type | Description |
34+
|-----------------------------|---------------------------------------------|--------------|
35+
| nuvX, nuvY, nuvZ | std::vector\<double\> | True neutrino interaction vertex (in cm) |
36+
| nuvT | std::vector\<double\> | True neutrino interaction time (in ns) |
37+
| nuvE | std::vector\<double\> | True neutrino energy (in GeV) |
38+
39+
40+
They store information regarging all the primary neutrino interactions in a given readout window. Loop over the std::vector to get the energy, interaction vertex and interaction time corresponding to the $i_{th}$ neutrino interaction.
41+
42+
### Variables at the LArG4 stage (particle propagation+ionization+scintillation)
43+
44+
#### Variables regarding the MC particles propagated by G4
45+
| Branch name | Type | Description |
46+
|-----------------------------|---------------------------------------------|--------------|
47+
| E | std::vector\<double\> | Primary energy of each MC particle (in GeV)|
48+
| process | std::vector\<std::string\> | Primary process of MC each particle|
49+
| trackID | std::vector\<int\> | MC particle ID|
50+
| motherID | std::vector\<int\> | ID of the mother MC particle|
51+
| PDGCode | std::vector\<int\> | PDG code |
52+
| InTimeCosmics | bool | Returns true if there is a cosmic interaction during the BNB spill |
53+
54+
Example: Consider a 1207 MeV beam $\nu_\mu$. It undergoes a charged current interaction, leading to a $\mu^-$ (E=574 MeV) and a proton (E=1543 MeV). The first entry in the previous vectors will have the following values:
55+
E[0]=0.574, process[0]=primary, trackID[0]=1, motherID[0]=0, PDGCode[0]=13, E[1]=1.543, PDGCode[1]=2212... If e.g. the muon decays to a Michel electron, there will be an entry with PDGCode=11, motherID=1 and process=Decay.
56+
57+
#### Variables regarding the deposited energy
58+
59+
| Branch name | Type | Description |
60+
|-----------------------------|---------------------------------------------|--------------|
61+
| energydep | std::vector\<std::vector<double\>\> | Energy deposition (in MeV) at each G4 tracking step. It's saved for each MC particle|
62+
| energydepX, energydepY, energydepZ | std::vector\<std::vector<double\>\> | Location (in cm) of each energy deposition. |
63+
| dEpromX, dEpromY, dEpromZ | std::vector<double\> | Average X, Y, Z (in cm) location of the energy depositions. It's saved for the two TPCs (vector size is 2)|
64+
| dEspreadX, dEspreadY, dEspreadZ | std::vector<double\> | X, Y, Z standard deviation of the energy depositions. It's saved for the two TPCs (vector size is 2)|
65+
| dElowedges, dEmaxedges | std::vector\<std::vector<double\>\> | (X, Y, Z) coordinates of the lowest (max) energy deposition. It's saved for the two TPCs (vector size is 2)|
66+
67+
Following the previous example, to read the energy deposition values and their locations induced by the primary proton you can take energydep[1], energydepX[1]...
68+
69+
#### Variables regarding the scintillation photons
70+
71+
72+
| Branch name | Type | Description |
73+
|-----------------------------|---------------------------------------------|--------------|
74+
| SimPhotonsperOpChVUV | std::vector\<double\> | Number of true photons at each PD (VUV wavelength)|
75+
| SimPhotonsperOpChVIS | std::vector\<double\> | Number of true photons at each PD (visible wavelength)|
76+
| SimPhotonsLiteVUV | std::vector\<std::vector<double\>\> | Photon arrival times at G4 stage (VUV). In ns.|
77+
| SimPhotonsLiteVIS | std::vector\<std::vector<double\>\> | Photon arrival times at G4 stage (VIS). In ns.|
78+
| NPhotons* variables| double | Integrated number of photons in the events per PD type. |
79+
80+
SBND has 312 PDs, hence the size of the SimPhotonsperOpChVUV(VIS) is 312. You can obtain the number of VUV photons reaching the coated PMT with ID 144 by taking SimPhotonsperOpChVUV[144]. The size of the SimPhotonsLiteVUV(VIS) is also 312. Each vector in the 'vector of vecrtors' contains the times (in ns) in which each photon gets to the given PD. Imagine 567 VUV photons reach the coated PMT with ID 144. The size of the vector SimPhotonsLiteVUV[144] will be 567.
81+
82+
83+
### Variables at the digitization stage
84+
| Branch name | Type | Description |
85+
|-----------------------------|---------------------------------------------|--------------|
86+
| SignalsDigi | std::vector\<std::vector<double\>\> | Digitized signals (ADC values) |
87+
| StampTime | std::vector<double\> | Start time of each digitized waveform (in $\mu$s) |
88+
| OpChDigi | std::vector<int\> | Associated PD ID |
89+
90+
The PMT/XARAPUCA output signals (including electronic response) are stored in the previous vectors. We only save the regions of the waveforms going above a certain thereshold (region of interest or ROIs). The ADC values of each identifeid ROI correspond to an entry in the SignalsDigi "vector of vectors". Note that we may have more than one ROI per PD, so the size of the SignalsDigi branch will be in general different than the number of PDs (312). To get the start time and the channel corresponding to the $i_{th}$ ROI get the StampTime and OpChDigi with index $i_{th}$.
91+
92+
### Variables at the reconstruction stage
93+
94+
#### Deconvolution
95+
| Branch name | Type | Description |
96+
|-----------------------------|---------------------------------------------|--------------|
97+
| SignalsDeco | std::vector\<std::vector\<double\>\> | Deconvolved signals |
98+
| StampTimeDeco | std::vector\<double\> | Start time of each digitized waveform (in $\mu s$) |
99+
| OpChDeco | std::vector\<int\> | Associated PD ID |
100+
101+
Same scheme followed, but storing the deconvolved signals instead of the raw waveforms.
102+
103+
#### Pulse finder (a.k.a. OpHits)
104+
105+
It dumps all the reconstructed OpHits in the event.
106+
107+
| Branch name | Type | Description |
108+
|-----------------------------|---------------------------------------------|--------------|
109+
| nophits | int | Total number of reconstructed OpHits |
110+
| ophit_opch | std::vector<int\> | Optical channel corresponding to the reconstructed OpHit |
111+
| ophit_peakT | std::vector<double\> | Waveform bin in which the OpHit gets the maximum value (in $\mu s$) |
112+
| ophit_startT | std::vector<double\>| Start of the OpHit (in $\mu s$) |
113+
| ophit_peakT | std::vector<double\> | OpHit rise time, relative to the StartTime (in $\mu s$) |
114+
| ophit_width | std::vector<double\> | With of the OpHit (in $\mu s$) |
115+
| ophit_amplitude | std::vector<double\> | Amplitude of the OpHit (in ADC units) |
116+
| ophit_area | std::vector<double\> | Area of the OpHit (in $\mu s$ x ADC units) |
117+
| ophit_pe | std::vector<double\> | Reconstructed number of PE |
118+
119+
120+
#### Clustering among different PDs (a.k.a. OpFlash)
121+
122+
It dumps all the reconstructed OpFlash in the event and the associated OpHits associated to each OpFlash. Each entry in the following vectors correspond to one OpFlash.
123+
124+
| Branch name | Type | Description |
125+
|-----------------------------|---------------------------------------------|--------------|
126+
| nopflash | int | Total number of reconstructed OpFlash objects |
127+
| flash_time| std::vector<double\> | t0 of the reconstructed OpFlashes |
128+
| flash_total_pe | std::vector<double\> | Integrated (all optical channels) number of photoelectrons in each OpFlash |
129+
| flash_pe_v | std::vector\<std::vector<double\>\> | Vector containing the reconstructed number of photoelectron in each optical channel for each OpFlash |
130+
| flash_x, flash_y, flash_z | std::vector<double\> | X, Y, Z position of the reconstructed OpFlash |
131+
| flash_ophit_* | std::vector\<std::vector<double\>\> | Save the attributes of the OpHits associated to each OpFlash |
132+
133+
#### Legend
134+
- PD: Photon Detector
135+
- PE: Photoelectron
136+
- BNB: Booster Neutrino Beam

0 commit comments

Comments
 (0)