Skip to content

Commit 165d5ab

Browse files
author
Brinden Carlson
committed
fix unmerged changes
2 parents f40e1d6 + df7973c commit 165d5ab

107 files changed

Lines changed: 1769 additions & 556 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
1717

18-
set(${PROJECT_NAME}_CMAKE_PROJECT_VERSION_STRING 09.90.00)
18+
set(${PROJECT_NAME}_CMAKE_PROJECT_VERSION_STRING 09.91.02)
1919
find_package(cetmodules REQUIRED)
2020
project(sbndcode LANGUAGES CXX)
2121

2222
# for CI:
23-
# project(sbndcode VERSION 09.90.00)
23+
# project(sbndcode VERSION 09.91.02)
2424

2525
message(STATUS "\n")
2626
message(STATUS "================================= ${PROJECT_NAME} =================================")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
add_subdirectory(TPC)
2+
add_subdirectory(CRT)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
install_headers()
2+
install_fhicl()
3+
install_source()
4+
5+
file(GLOB channel_map_file *ChannelMap*.txt)
6+
install_fw( LIST ${channel_map_file} )
7+
8+
art_make(SERVICE_LIBRARIES
9+
art::Framework_Services_Registry
10+
art::Framework_Principal
11+
art::Framework_Core
12+
art::Persistency_Provenance
13+
messagefacility::MF_MessageLogger
14+
ROOT::Core
15+
)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
///////////////////////////////////////////////////////////////////////////////////////////////////
2+
// Class: SBND::CRTChannelMapService
3+
// Module type: service
4+
// File: CRTChannelMapService.h
5+
// Author: Henry Lay, May 2024
6+
//
7+
// Implementation of hardware-offline channel mapping reading from a file or from the hardware database
8+
// SBND CRT
9+
///////////////////////////////////////////////////////////////////////////////////////////////////
10+
11+
#ifndef SBNDCRTChannelMapService_H
12+
#define SBNDCRTChannelMapService_H
13+
14+
#include <unordered_map>
15+
#include <vector>
16+
#include <string>
17+
18+
#include "fhiclcpp/ParameterSet.h"
19+
#include "art/Framework/Core/ModuleMacros.h"
20+
#include "art/Framework/Services/Registry/ServiceMacros.h"
21+
22+
namespace SBND {
23+
class CRTChannelMapService;
24+
}
25+
26+
27+
class SBND::CRTChannelMapService {
28+
29+
public:
30+
31+
CRTChannelMapService(fhicl::ParameterSet const& pset);
32+
CRTChannelMapService(fhicl::ParameterSet const& pset, art::ActivityRegistry&);
33+
34+
typedef struct ModuleInfo {
35+
unsigned int feb_mac5; // The MAC5 address of the hardware front end board
36+
bool channel_order_swapped; // Are the order of the channels inverted with respect to simulation (FEB direction)
37+
unsigned int offline_module_id; // The module number in simulation
38+
bool valid;
39+
} ModuleInfo_t;
40+
41+
ModuleInfo_t GetModuleInfoFromFEBMAC5(unsigned int feb_mac5) const;
42+
43+
ModuleInfo_t GetModuleInfoFromOfflineID(unsigned int offline_module_id) const;
44+
45+
private:
46+
47+
// look up channel info by offline module number
48+
49+
std::unordered_map<unsigned int, ModuleInfo_t> fModuleInfoFromOfflineID;
50+
51+
// look up channel info by FEB MAC5
52+
53+
std::unordered_map<unsigned int, ModuleInfo_t> fModuleInfoFromFEBMAC5;
54+
55+
};
56+
57+
DECLARE_ART_SERVICE(SBND::CRTChannelMapService, LEGACY)
58+
59+
#endif
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
//////////////////////////////////////////////////////////////////////////////////////////////////
2+
// Class: SBND::CRTChannelMapService
3+
// Module type: service
4+
// File: SBND::CRTChannelMapService_service.cc
5+
// Author: Henry Lay, May 2024.
6+
//
7+
// Implementation of hardware-offline channel mapping reading from a file.
8+
///////////////////////////////////////////////////////////////////////////////////////////////////
9+
10+
#include <iostream>
11+
#include <fstream>
12+
#include <sstream>
13+
#include <stdlib.h>
14+
15+
#include "CRTChannelMapService.h"
16+
#include "messagefacility/MessageLogger/MessageLogger.h"
17+
18+
SBND::CRTChannelMapService::CRTChannelMapService(fhicl::ParameterSet const& pset)
19+
{
20+
const std::string channelMapFile = pset.get<std::string>("FileName");
21+
22+
std::string fullname;
23+
cet::search_path sp("FW_SEARCH_PATH");
24+
sp.find_file(channelMapFile, fullname);
25+
26+
if(fullname.empty())
27+
{
28+
std::cout << "SBND::CRTChannelMapService Input file " << channelMapFile << " not found" << std::endl;
29+
throw cet::exception("File not found");
30+
}
31+
32+
std::cout << "SBND CRT Channel Map: Building map from file " << channelMapFile << std::endl;
33+
std::ifstream inFile(fullname, std::ios::in);
34+
std::string line;
35+
36+
while(std::getline(inFile,line))
37+
{
38+
std::stringstream linestream(line);
39+
40+
SBND::CRTChannelMapService::ModuleInfo_t m;
41+
linestream
42+
>> m.offline_module_id
43+
>> m.feb_mac5
44+
>> m.channel_order_swapped;
45+
46+
m.valid = true;
47+
48+
fModuleInfoFromOfflineID[m.offline_module_id] = m;
49+
fModuleInfoFromFEBMAC5[m.feb_mac5] = m;
50+
}
51+
52+
inFile.close();
53+
}
54+
55+
SBND::CRTChannelMapService::CRTChannelMapService(fhicl::ParameterSet const& pset, art::ActivityRegistry&)
56+
: SBND::CRTChannelMapService(pset)
57+
{
58+
}
59+
60+
SBND::CRTChannelMapService::ModuleInfo_t SBND::CRTChannelMapService::GetModuleInfoFromFEBMAC5(unsigned int feb_mac5) const
61+
{
62+
SBND::CRTChannelMapService::ModuleInfo_t bad;
63+
bad.valid = false;
64+
65+
auto moduleIter = fModuleInfoFromFEBMAC5.find(feb_mac5);
66+
67+
if(moduleIter == fModuleInfoFromFEBMAC5.end())
68+
{
69+
mf::LogInfo("SBND CRT Channel Map") << "Asked for FEB with MAC5: " << feb_mac5 << '\n'
70+
<< "This FEB does not appear in the channel map." << std::endl;
71+
72+
return bad;
73+
}
74+
75+
return moduleIter->second;
76+
}
77+
78+
SBND::CRTChannelMapService::ModuleInfo_t SBND::CRTChannelMapService::GetModuleInfoFromOfflineID(unsigned int offline_module_id) const
79+
{
80+
SBND::CRTChannelMapService::ModuleInfo_t bad;
81+
bad.valid = false;
82+
83+
auto moduleIter = fModuleInfoFromOfflineID.find(offline_module_id);
84+
85+
if(moduleIter == fModuleInfoFromOfflineID.end())
86+
{
87+
mf::LogInfo("SBND CRT Channel Map") << "Asked for module with offline ID: " << offline_module_id << '\n'
88+
<< "This module does not appear in the channel map." << std::endl;
89+
90+
return bad;
91+
}
92+
93+
return moduleIter->second;
94+
}
95+
96+
DEFINE_ART_SERVICE(SBND::CRTChannelMapService)
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
56 159 1
2+
57 153 1
3+
58 156 1
4+
59 152 1
5+
60 182 1
6+
61 158 1
7+
62 157 1
8+
63 136 0
9+
64 150 0
10+
65 151 0
11+
66 134 0
12+
67 135 0
13+
68 149 0
14+
69 181 0
15+
70 238 0
16+
71 155 0
17+
72 79 1
18+
73 206 1
19+
74 204 1
20+
75 200 1
21+
76 222 1
22+
77 220 1
23+
78 81 1
24+
79 85 1
25+
80 143 1
26+
81 162 1
27+
82 133 1
28+
83 132 1
29+
84 18 1
30+
85 160 1
31+
86 44 1
32+
87 147 1
33+
88 146 1
34+
89 131 1
35+
108 77 0
36+
109 78 0
37+
110 98 1
38+
111 97 1
39+
112 87 1
40+
113 95 1
41+
114 94 1
42+
115 93 1
43+
116 86 0
44+
117 83 0
45+
118 84 0
46+
119 104 1
47+
120 103 1
48+
121 102 1
49+
122 101 1
50+
123 100 1
51+
124 99 1
52+
125 90 0
53+
126 91 0
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
56 159 1
2+
57 153 1
3+
58 156 1
4+
59 152 1
5+
60 182 1
6+
61 158 1
7+
62 157 1
8+
63 136 0
9+
64 150 0
10+
65 151 0
11+
66 134 0
12+
67 135 0
13+
68 149 0
14+
69 181 0
15+
70 238 0
16+
71 155 0
17+
72 79 1
18+
73 206 1
19+
74 204 1
20+
75 200 1
21+
76 222 1
22+
77 220 1
23+
78 81 1
24+
79 85 1
25+
80 143 1
26+
81 162 1
27+
82 133 1
28+
83 132 1
29+
84 18 1
30+
85 44 1
31+
86 160 1
32+
87 147 1
33+
88 146 1
34+
89 131 1
35+
90 19 1
36+
91 202 1
37+
92 199 1
38+
93 197 1
39+
94 207 1
40+
95 203 1
41+
96 45 1
42+
97 198 1
43+
98 174 1
44+
99 148 1
45+
100 163 1
46+
101 164 1
47+
102 165 1
48+
103 80 1
49+
104 193 0
50+
105 42 0
51+
106 138 0
52+
107 130 1
53+
108 77 0
54+
109 78 0
55+
110 98 1
56+
111 97 1
57+
112 87 1
58+
113 95 1
59+
114 94 1
60+
115 93 1
61+
116 86 0
62+
117 83 0
63+
118 84 0
64+
119 104 1
65+
120 103 1
66+
121 102 1
67+
122 101 1
68+
123 100 1
69+
124 99 1
70+
125 90 0
71+
126 91 0
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
56 159 1
2+
57 153 1
3+
58 156 1
4+
59 152 1
5+
60 182 1
6+
61 158 1
7+
62 157 1
8+
63 136 0
9+
64 150 0
10+
65 151 0
11+
66 134 0
12+
67 135 0
13+
68 149 0
14+
69 58 0
15+
70 238 0
16+
71 155 0
17+
72 79 1
18+
73 206 1
19+
74 204 1
20+
75 200 1
21+
76 222 1
22+
77 220 1
23+
78 81 1
24+
79 85 1
25+
80 143 1
26+
81 162 1
27+
82 133 1
28+
83 132 1
29+
84 18 1
30+
85 44 1
31+
86 160 1
32+
87 147 1
33+
88 146 1
34+
89 131 1
35+
90 19 1
36+
91 202 1
37+
92 199 1
38+
93 197 1
39+
94 207 1
40+
95 203 1
41+
96 45 1
42+
97 198 1
43+
98 174 1
44+
99 148 1
45+
100 163 1
46+
101 164 1
47+
102 165 1
48+
103 80 1
49+
104 193 0
50+
105 42 0
51+
106 138 0
52+
107 130 1
53+
108 77 0
54+
109 78 0
55+
110 98 1
56+
111 97 1
57+
112 87 1
58+
113 95 1
59+
114 94 1
60+
115 93 1
61+
116 86 0
62+
117 83 0
63+
118 84 0
64+
119 104 1
65+
120 103 1
66+
121 102 1
67+
122 101 1
68+
123 100 1
69+
124 99 1
70+
125 90 0
71+
126 91 0

0 commit comments

Comments
 (0)