Skip to content

Commit 4f6b3ea

Browse files
Merge pull request #918 from SBNSoftware/feature/hlay_crt_channel_map_evds
CRT Channel Mapping Event Displays
2 parents 43e7807 + 1b8c860 commit 4f6b3ea

8 files changed

Lines changed: 356 additions & 4 deletions

sbndcode/CRT/CRTEventDisplay/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@ simple_plugin(
1313
sbndcode_CRT_CRTEventDisplay
1414
)
1515

16+
simple_plugin(
17+
CRTChannelMappingEventDisplay module
18+
sbndcode_CRT_CRTEventDisplay
19+
)
20+
1621
install_fhicl()
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
////////////////////////////////////////////////////////////////////////
2+
// Class: CRTChannelMappingEventDisplay
3+
// Plugin Type: analyzer (Unknown Unknown)
4+
// File: CRTChannelMappingEventDisplay_module.cc
5+
//
6+
// Generated at Thu Oct 6 09:32:09 2022 by Henry Lay using cetskelgen
7+
// from version .
8+
////////////////////////////////////////////////////////////////////////
9+
10+
#include "art/Framework/Core/EDAnalyzer.h"
11+
#include "art/Framework/Core/ModuleMacros.h"
12+
#include "art/Framework/Principal/Event.h"
13+
#include "art/Framework/Principal/Handle.h"
14+
#include "art/Framework/Principal/Run.h"
15+
#include "art/Framework/Principal/SubRun.h"
16+
#include "canvas/Utilities/InputTag.h"
17+
#include "fhiclcpp/ParameterSet.h"
18+
#include "messagefacility/MessageLogger/MessageLogger.h"
19+
20+
#include "lardata/DetectorInfoServices/DetectorClocksService.h"
21+
#include "sbndcode/CRT/CRTEventDisplay/CRTEventDisplayAlg.h"
22+
23+
#include "TSystem.h"
24+
25+
namespace sbnd::crt {
26+
class CRTChannelMappingEventDisplay;
27+
}
28+
29+
class sbnd::crt::CRTChannelMappingEventDisplay : public art::EDAnalyzer {
30+
public:
31+
32+
struct Config {
33+
using Name = fhicl::Name;
34+
using Comment = fhicl::Comment;
35+
36+
fhicl::Table<CRTEventDisplayAlg::Config> EventDisplayConfig {
37+
Name("EventDisplayConfig"),
38+
};
39+
40+
fhicl::Atom<std::string> SaveDir {
41+
Name("SaveDir"),
42+
};
43+
};
44+
45+
using Parameters = art::EDAnalyzer::Table<Config>;
46+
47+
explicit CRTChannelMappingEventDisplay(Parameters const &config);
48+
49+
CRTChannelMappingEventDisplay(CRTChannelMappingEventDisplay const&) = delete;
50+
CRTChannelMappingEventDisplay(CRTChannelMappingEventDisplay&&) = delete;
51+
CRTChannelMappingEventDisplay& operator=(CRTChannelMappingEventDisplay const&) = delete;
52+
CRTChannelMappingEventDisplay& operator=(CRTChannelMappingEventDisplay&&) = delete;
53+
54+
void analyze(art::Event const& e) override;
55+
56+
private:
57+
58+
CRTEventDisplayAlg fCRTEventDisplayAlg;
59+
art::ServiceHandle<CRTGeoService> fCRTGeoService;
60+
std::string fSaveDir;
61+
std::vector<int> fChosenTaggers;
62+
};
63+
64+
65+
sbnd::crt::CRTChannelMappingEventDisplay::CRTChannelMappingEventDisplay(Parameters const& config)
66+
: EDAnalyzer{config}
67+
, fCRTEventDisplayAlg(config().EventDisplayConfig())
68+
, fSaveDir(config().SaveDir())
69+
, fChosenTaggers(config().EventDisplayConfig().ChosenTaggers())
70+
{
71+
gSystem->Exec(Form("mkdir -p %s", fSaveDir.c_str()));
72+
}
73+
74+
void sbnd::crt::CRTChannelMappingEventDisplay::analyze(art::Event const& e)
75+
{
76+
auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(e);
77+
78+
for(auto const& [ name, module ] : fCRTGeoService->GetModules())
79+
{
80+
if(std::find(fChosenTaggers.begin(), fChosenTaggers.end(), CRTCommonUtils::GetTaggerEnum(module.taggerName)) == fChosenTaggers.end())
81+
continue;
82+
83+
fCRTEventDisplayAlg.SetHighlightedModules({module.adID});
84+
85+
fCRTEventDisplayAlg.Draw(clockData, e, Form("%s/%s", fSaveDir.c_str(), name.c_str()));
86+
}
87+
}
88+
89+
DEFINE_ART_MODULE(sbnd::crt::CRTChannelMappingEventDisplay)
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
version=$1
2+
gdml=$2
3+
author=$3
4+
email=$4
5+
basedir=$5
6+
7+
echo $version
8+
echo $gdml
9+
echo $author
10+
echo $email
11+
echo $basedir
12+
13+
mkdir ${basedir}/tex_work
14+
15+
echo "\documentclass{article}
16+
\usepackage[a4paper, margin=3cm]{geometry}
17+
\usepackage{graphicx}
18+
\usepackage{pgffor}
19+
\usepackage[hidelinks]{hyperref}
20+
21+
\title{SBND CRT Channel Mapping Displays \\\\ \vspace{1em} \small \textit{Produced using} \texttt{sbndcode ${version}} \textit{\&} \texttt{${gdml}}}
22+
\author{${author} \\\\ \small ${email}}" > ${basedir}/tex_work/crt_channel_mapping_evds.tex
23+
24+
walls=(bottom south north west east toplow tophigh)
25+
wallnames=(Bottom South North West East "Top Low" "Top High")
26+
27+
for wall in "${walls[@]}"
28+
do
29+
list=$(ls ${basedir}/${wall}_wall/*_front.pdf)
30+
echo -n "\newcommand*{\\"$wall"ids}{" >> ${basedir}/tex_work/crt_channel_mapping_evds.tex
31+
32+
for item in ${list}
33+
do
34+
name=$(echo $item | cut -d '/' -f 10)
35+
number=$(echo $name | cut -d '_' -f 2)
36+
echo -n $number, >> ${basedir}/tex_work/crt_channel_mapping_evds.tex
37+
done
38+
39+
sed -i '$ s/.$//' ${basedir}/tex_work/crt_channel_mapping_evds.tex
40+
echo "}" >> ${basedir}/tex_work/crt_channel_mapping_evds.tex
41+
done
42+
43+
echo "\begin{document}
44+
45+
\maketitle
46+
47+
\centering
48+
\vspace{2em}
49+
50+
\includegraphics[width=.6\textwidth]{/nashome/h/hlay/UOSLogo_Primary_Violet_RGB.png}
51+
\vspace{2em}
52+
53+
\includegraphics[width=.5\textwidth]{/nashome/h/hlay/sbnd_pride_transparent.png}
54+
\flushleft
55+
\newpage
56+
\tableofcontents
57+
\newpage
58+
\section{Explanation}
59+
This document contains a series of illustrations created using the \texttt{CRTEventDisplay} tool originally written by Tom Brooks \& heavily developed by myself. It shows the position of the various CRT modules according to the gdml file used in SBND simulation and reconstruction. The document is split into sections for the different tagger walls. For each module three illustrations are provided: front, top and side views. The axes show detector coordinates (X, Y and Z) and \`\`building coordinates\" (North, West and Up). The relevant module is shown in green. The TPCs are shown in grey in the centre for reference. The black outer is the full tagger wall. The thin grey are other modules in the wall. The red is the FEB position and the blue corresponds to the end of the FEB with channel 0 (the ethernet ports).
60+
" >> ${basedir}/tex_work/crt_channel_mapping_evds.tex
61+
62+
for i in "${!walls[@]}"
63+
do
64+
echo "\newpage
65+
\section{${wallnames[i]} Wall}
66+
\begingroup
67+
\foreach \x in \\${walls[i]}ids
68+
{
69+
\newpage
70+
\subsection{volCRTModule\x\_\x}
71+
\begin{center}
72+
\includegraphics[width=.85\textwidth]{${basedir}/${walls[i]}_wall/volCRTModule\x_\x_front.pdf}\\\\
73+
\includegraphics[width=.85\textwidth]{${basedir}/${walls[i]}_wall/volCRTModule\x_\x_top.pdf}\\\\
74+
\includegraphics[width=.85\textwidth]{${basedir}/${walls[i]}_wall/volCRTModule\x_\x_side.pdf}
75+
\end{center}
76+
}
77+
\endgroup" >> ${basedir}/tex_work/crt_channel_mapping_evds.tex
78+
done
79+
80+
echo "\end{document}" >> ${basedir}/tex_work/crt_channel_mapping_evds.tex
81+
82+
pdflatex --shell-escape -output-directory ${basedir}/tex_work ${basedir}/tex_work/crt_channel_mapping_evds.tex
83+
pdflatex --shell-escape -output-directory ${basedir}/tex_work ${basedir}/tex_work/crt_channel_mapping_evds.tex

sbndcode/CRT/CRTEventDisplay/crteventdisplay_sbnd.fcl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,20 @@ BEGIN_PROLOG
44

55
crteventdisplay_sbnd:
66
{
7-
EventDisplayConfig: @local::crteventdisplayalg_sbnd
8-
module_type: "CRTEventDisplay"
7+
EventDisplayConfig: @local::crteventdisplayalg_sbnd
8+
module_type: "CRTEventDisplay"
99
}
1010

1111
crteventdisplay_sbnd_data:
1212
{
13-
EventDisplayConfig: @local::crteventdisplayalg_sbnd_data
14-
module_type: "CRTEventDisplay"
13+
EventDisplayConfig: @local::crteventdisplayalg_sbnd_data
14+
module_type: "CRTEventDisplay"
15+
}
16+
17+
crteventdisplay_sbnd_channel_mapping:
18+
{
19+
EventDisplayConfig: @local::crteventdisplayalg_sbnd_channel_mapping
20+
module_type: "CRTChannelMappingEventDisplay"
1521
}
1622

1723
END_PROLOG

sbndcode/CRT/CRTEventDisplay/crteventdisplayalg_sbnd.fcl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,28 @@ crteventdisplayalg_sbnd_data.UseTs0: true
9797
crteventdisplayalg_sbnd_data.MinTime: -1.5e6
9898
crteventdisplayalg_sbnd_data.MaxTime: 1.5e6
9999

100+
crteventdisplayalg_sbnd_channel_mapping: @local::crteventdisplayalg_sbnd
101+
102+
crteventdisplayalg_sbnd_channel_mapping.MC: false
103+
crteventdisplayalg_sbnd_channel_mapping.SaveRoot: false
104+
crteventdisplayalg_sbnd_channel_mapping.SaveViews: true
105+
106+
crteventdisplayalg_sbnd_channel_mapping.ChoseTaggers: true
107+
crteventdisplayalg_sbnd_channel_mapping.HighlightModules: true
108+
109+
crteventdisplayalg_sbnd_channel_mapping.DrawTaggers: true
110+
crteventdisplayalg_sbnd_channel_mapping.DrawModules: true
111+
crteventdisplayalg_sbnd_channel_mapping.DrawFEBs: true
112+
crteventdisplayalg_sbnd_channel_mapping.DrawFEBEnds: true
113+
crteventdisplayalg_sbnd_channel_mapping.DrawStrips: false
114+
crteventdisplayalg_sbnd_channel_mapping.DrawTPC: true
115+
crteventdisplayalg_sbnd_channel_mapping.DrawTrueTracks: false
116+
crteventdisplayalg_sbnd_channel_mapping.DrawSimDeposits: false
117+
crteventdisplayalg_sbnd_channel_mapping.DrawStripHits: false
118+
crteventdisplayalg_sbnd_channel_mapping.DrawClusters: false
119+
crteventdisplayalg_sbnd_channel_mapping.DrawSpacePoints: false
120+
crteventdisplayalg_sbnd_channel_mapping.DrawTracks: false
121+
122+
crteventdisplayalg_sbnd_channel_mapping.Print: false
123+
100124
END_PROLOG
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include "services_sbnd.fcl"
2+
#include "particleinventoryservice.fcl"
3+
#include "crteventdisplay_sbnd.fcl"
4+
#include "crt_services_sbnd.fcl"
5+
6+
process_name: CRTEventDisplay
7+
8+
services:
9+
{
10+
@table::sbnd_services
11+
@table::crt_services_sbnd
12+
ParticleInventoryService: @local::standard_particleinventoryservice
13+
CRTChannelMapService: @local::crt_channel_map_no_inversion
14+
}
15+
16+
source:
17+
{
18+
module_type: RootInput
19+
maxEvents: -1
20+
}
21+
22+
physics:
23+
{
24+
analyzers:
25+
{
26+
crtevdbot: @local::crteventdisplay_sbnd_channel_mapping
27+
crtevdsou: @local::crteventdisplay_sbnd_channel_mapping
28+
crtevdnor: @local::crteventdisplay_sbnd_channel_mapping
29+
crtevdwes: @local::crteventdisplay_sbnd_channel_mapping
30+
crtevdeas: @local::crteventdisplay_sbnd_channel_mapping
31+
crtevdtpl: @local::crteventdisplay_sbnd_channel_mapping
32+
crtevdtph: @local::crteventdisplay_sbnd_channel_mapping
33+
}
34+
35+
ana: [ crtevdbot, crtevdsou, crtevdnor, crtevdwes, crtevdeas, crtevdtpl, crtevdtph ]
36+
37+
end_paths: [ ana ]
38+
}
39+
40+
physics.analyzers.crtevdbot.SaveDir: "/YOUR/DIRECTORY/NAME/bottom_wall"
41+
physics.analyzers.crtevdbot.EventDisplayConfig.ChosenTaggers: [ 0 ]
42+
physics.analyzers.crtevdsou.SaveDir: "/YOUR/DIRECTORY/NAME/south_wall"
43+
physics.analyzers.crtevdsou.EventDisplayConfig.ChosenTaggers: [ 1 ]
44+
physics.analyzers.crtevdnor.SaveDir: "/YOUR/DIRECTORY/NAME/north_wall"
45+
physics.analyzers.crtevdnor.EventDisplayConfig.ChosenTaggers: [ 2 ]
46+
physics.analyzers.crtevdwes.SaveDir: "/YOUR/DIRECTORY/NAME/west_wall"
47+
physics.analyzers.crtevdwes.EventDisplayConfig.ChosenTaggers: [ 3 ]
48+
physics.analyzers.crtevdeas.SaveDir: "/YOUR/DIRECTORY/NAME/east_wall"
49+
physics.analyzers.crtevdeas.EventDisplayConfig.ChosenTaggers: [ 4 ]
50+
physics.analyzers.crtevdtpl.SaveDir: "/YOUR/DIRECTORY/NAME/toplow_wall"
51+
physics.analyzers.crtevdtpl.EventDisplayConfig.ChosenTaggers: [ 5 ]
52+
physics.analyzers.crtevdtph.SaveDir: "/YOUR/DIRECTORY/NAME/tophigh_wall"
53+
physics.analyzers.crtevdtph.EventDisplayConfig.ChosenTaggers: [ 6 ]
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
40 173 0
2+
41 172 0
3+
42 168 0
4+
43 170 0
5+
44 176 0
6+
45 59 0
7+
46 171 0
8+
47 61 0
9+
48 166 0
10+
49 169 0
11+
50 56 0
12+
51 60 0
13+
52 34 0
14+
53 33 0
15+
54 57 0
16+
55 24 0
17+
56 159 0
18+
57 153 0
19+
58 156 0
20+
59 152 0
21+
60 182 0
22+
61 158 0
23+
62 157 0
24+
63 136 0
25+
64 150 0
26+
65 151 0
27+
66 134 0
28+
67 135 0
29+
68 149 0
30+
69 58 0
31+
70 238 0
32+
71 155 0
33+
72 222 0
34+
73 220 0
35+
74 81 0
36+
75 85 0
37+
76 79 0
38+
77 206 0
39+
78 204 0
40+
79 200 0
41+
80 18 0
42+
81 132 0
43+
82 133 0
44+
83 162 0
45+
84 143 0
46+
85 131 0
47+
86 146 0
48+
87 147 0
49+
88 44 0
50+
89 160 0
51+
90 19 0
52+
91 202 0
53+
92 199 0
54+
93 197 0
55+
94 207 0
56+
95 203 0
57+
96 45 0
58+
97 198 0
59+
98 174 0
60+
99 148 0
61+
100 163 0
62+
101 164 0
63+
102 165 0
64+
103 80 0
65+
104 193 0
66+
105 42 0
67+
106 138 0
68+
107 130 0
69+
108 77 0
70+
109 78 0
71+
110 98 0
72+
111 97 0
73+
112 87 0
74+
113 95 0
75+
114 94 0
76+
115 93 0
77+
116 86 0
78+
117 83 0
79+
118 84 0
80+
119 104 0
81+
120 103 0
82+
121 102 0
83+
122 101 0
84+
123 100 0
85+
124 99 0
86+
125 90 0
87+
126 91 0

sbndcode/ChannelMaps/CRT/crt_channel_map_service_sbnd.fcl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ crt_channel_map_sbnd:
66
TimingChainMapFileName: "SBNDCRTTimingChainMap_v1.txt"
77
}
88

9+
crt_channel_map_no_inversion:
10+
{
11+
FileName: "SBNDCRTChannelMap_v5_no_inversion.txt"
12+
}
13+
914
END_PROLOG

0 commit comments

Comments
 (0)