Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 37 additions & 45 deletions UserDev/EventDisplay/RawViewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,78 +7,70 @@ set(EventDisplay_RawViewer_SOURCES
DrawWire.cxx
RawBase.cxx
)
set(EventDisplay_RawViewer_HEADERS
DrawOpDetWaveform.h
DrawRawDigit.h
DrawWire.h
RawBase.h
)

find_package(Python REQUIRED COMPONENTS Interpreter Development NumPy)
set(EventDisplay_RawViewer_INCLUDES
${Python_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/core
)

set(EventDisplay_RawViewer_LIBS
${gallery_LIBRARY_DIR}/libgallery.so
${ROOT_LIBRARIES}
${CLHEP_LIBRARIES}
${canvas_LIBRARY_DIR}/libcanvas.so
${larcoreobj_LIBRARY_DIR}/liblarcoreobj_SummaryData.so
${larcorealg_LIBRARY_DIR}/liblarcorealg_Geometry.so
${lardataobj_LIBRARY_DIR}/liblardataobj_RecoBase.so
${lardataalg_LIBRARY_DIR}/liblardataalg_DetectorInfo.so
${cetlib_except_LIBRARY_DIR}/libcetlib_except.so
gallery_framework_Base
gallery_framework_Analysis
Python::NumPy
)

find_package(sbnobj)
message(STATUS "Compile with SBNOBJ=" ${sbnobj_FOUND})
if (${sbnobj_FOUND})
list(APPEND EventDisplay_RawViewer_SOURCES DrawFEBData.cxx)
list(APPEND EventDisplay_RawViewer_SOURCES DrawChannelROI.cxx)
list(APPEND EventDisplay_RawViewer_HEADERS DrawFEBData.h)
list(APPEND EventDisplay_RawViewer_HEADERS DrawChannelROI.h)
list(APPEND EventDisplay_RawViewer_INCLUDES ${sbnobj_INCLUDE_DIR})
list(APPEND EventDisplay_RawViewer_LIBS ${sbnobj_LIBRARY_DIR}/libsbnobj_SBND_CRT.so)
list(APPEND EventDisplay_RawViewer_LIBS ${sbnobj_LIBRARY_DIR}/libsbnobj_ICARUS_TPC.so)
endif()


find_package(icarusalg)
find_package(icarus_signal_processing)
find_package(icaruscode)
message(STATUS "Compile with ICARUSCODE=" ${icaruscode_FOUND})
if (${icaruscode_FOUND})
# do something
list(APPEND EventDisplay_RawViewer_INCLUDES ${icaruscode_INCLUDE_DIRS})
list(APPEND EventDisplay_RawViewer_LIBS ${icaruscode_LIBRARY_DIR}/libicaruscode_IcarusObj.so)
endif()

add_library(EventDisplay_RawViewer SHARED ${EventDisplay_RawViewer_SOURCES})

if (${sbnobj_FOUND})
target_compile_definitions(EventDisplay_RawViewer PUBLIC WITH_SBNOBJ)
target_link_libraries(EventDisplay_RawViewer ${sbnobj_LIBRARY_DIR}/libsbnobj_SBND_CRT.so)
target_include_directories(EventDisplay_RawViewer PRIVATE ${sbnobj_INCLUDE_DIR})

# for channel ROI
target_link_libraries(EventDisplay_RawViewer ${sbnobj_LIBRARY_DIR}/libsbnobj_ICARUS_TPC.so)
target_include_directories(EventDisplay_RawViewer PRIVATE ${sbnobj_INCLUDE_DIR})
endif()

if (${icaruscode_FOUND})
target_compile_definitions(EventDisplay_RawViewer PUBLIC WITH_ICARUSCODE)
target_link_libraries(EventDisplay_RawViewer ${icaruscode_LIBRARY_DIR}/libicaruscode_IcarusObj.so)
target_include_directories(EventDisplay_RawViewer PRIVATE ${icaruscode_INCLUDE_DIRS})
target_include_directories(EventDisplay_RawViewer PRIVATE ${icaruscode_INCLUDE_DIRS})
endif()


target_link_libraries(EventDisplay_RawViewer
${gallery_LIBRARY_DIR}/libgallery.so
${ROOT_LIBRARIES}
${CLHEP_LIBRARIES}
${canvas_LIBRARY_DIR}/libcanvas.so
${larcoreobj_LIBRARY_DIR}/liblarcoreobj_SummaryData.so
${larcorealg_LIBRARY_DIR}/liblarcorealg_Geometry.so
${lardataobj_LIBRARY_DIR}/liblardataobj_RecoBase.so
${lardataalg_LIBRARY_DIR}/liblardataalg_DetectorInfo.so
${cetlib_except_LIBRARY_DIR}/libcetlib_except.so
gallery_framework_Base
gallery_framework_Analysis
gallery_framework_LArUtil
)


target_include_directories(EventDisplay_RawViewer PRIVATE ${PROJECT_SOURCE_DIR}/core)

find_package(Python REQUIRED COMPONENTS Interpreter Development NumPy)
target_include_directories(EventDisplay_RawViewer PRIVATE ${Python_INCLUDE_DIRS})
target_include_directories(EventDisplay_RawViewer PRIVATE ${EventDisplay_RawViewer_INCLUDES})
target_link_libraries(EventDisplay_RawViewer PRIVATE ${EventDisplay_RawViewer_LIBS})

target_link_libraries(EventDisplay_RawViewer Python::NumPy)

set(EventDisplay_RawViewer_HEADERS
DrawOpDetWaveform.h
DrawRawDigit.h
DrawWire.h
RawBase.h
)
if (${sbnobj_FOUND})
list(APPEND EventDisplay_RawViewer_HEADERS DrawFEBData.h)
list(APPEND EventDisplay_RawViewer_HEADERS DrawChannelROI.h)
endif()
if (${icaruscode_FOUND})
# do something
endif()

ROOT_GENERATE_DICTIONARY(EventDisplay_RawViewer_Dict
${EventDisplay_RawViewer_HEADERS}
Expand Down
6 changes: 2 additions & 4 deletions UserDev/EventDisplay/RecoViewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ add_library(EventDisplay_RecoViewer SHARED
)


find_package(Python REQUIRED COMPONENTS Interpreter Development NumPy)
target_link_libraries(EventDisplay_RecoViewer
${gallery_LIBRARY_DIR}/libgallery.so
${ROOT_LIBRARIES}
Expand All @@ -26,18 +27,15 @@ target_link_libraries(EventDisplay_RecoViewer
gallery_framework_Base
gallery_framework_Analysis
gallery_framework_LArUtil
Python::NumPy
)

target_include_directories(EventDisplay_RecoViewer PRIVATE ${PROJECT_SOURCE_DIR}/core)

find_package(nusimdata REQUIRED)
target_include_directories(EventDisplay_RecoViewer PRIVATE ${nusimdata_INCLUDE_DIRS})

find_package(Python REQUIRED COMPONENTS Interpreter Development NumPy)
target_include_directories(EventDisplay_RecoViewer PRIVATE ${Python_INCLUDE_DIRS})

target_link_libraries(EventDisplay_RecoViewer Python::NumPy)

ROOT_GENERATE_DICTIONARY(EventDisplay_RecoViewer_Dict
DrawCluster.h
DrawEndpoint.h
Expand Down
4 changes: 2 additions & 2 deletions UserDev/EventDisplay/python/titus/drawables/drawable.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def analyze(self):

if self._producer_name == _NULL_NAME:
return

self._process.analyze(self._gi.event_handle())

def set_producer(self, producer):
Expand Down Expand Up @@ -78,7 +78,7 @@ def set_producer(self, producer):
self._process.addInput(p)
else:
self._process.setInput(str(producer))

self._producer_name = producer

def init(self):
Expand Down
12 changes: 5 additions & 7 deletions UserDev/EventDisplay/python/titus/gallery_interface/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def getWireReadout(self):

def getAuxDetGeometryCore(self):
return self._auxDetGeometryCore

def getGeometryCore(self):
return self._geometryCore

Expand Down Expand Up @@ -367,9 +367,9 @@ def configure(self, geometryCore, detProperties, readoutProperties, detClocks, l
self._wireReadout = readoutProperties #We have two names for this now
self._auxDetGeometryCore = auxDetGeometryCore

self._halfwidth = geometryCore.Cryostat(0).HalfWidth()
self._halfheight = geometryCore.Cryostat(0).HalfHeight()
self._length = geometryCore.Cryostat(0).Length()
self._halfwidth = geometryCore.TPC().HalfWidth()
self._halfheight = geometryCore.TPC().HalfHeight()
self._length = geometryCore.TPC().Length()
#self._time2Cm = detProperties.SamplingRate() / 1000.0 * detProperties.DriftVelocity(detProperties.Efield(), detProperties.Temperature())
self._time2Cm = self._detectorClocks.TPCClock().TickPeriod() * self._detectorProperties.DriftVelocity(self._detectorProperties.Efield(), self._detectorProperties.Temperature())
self._wire2Cm = readoutProperties.Plane(ROOT.geo.TPCID(0, 0), 0).WirePitch()
Expand Down Expand Up @@ -466,7 +466,6 @@ def __init__(self, geometryCore=None, detProperties=None, readoutProperties=None
self._levels = [(100, -10), (-10, 100), (-10, 200)]

self._view_names = ['U', 'V', 'Y']
# self._plane_mix = {0: [4], 1: [3], 2: [5]}
self._plane_mix = {0: [3], 1: [4], 2: [5]}
self._plane_flip = [False, False, False, True, True, True]
self._plane_shift = [False, False, False, False, False, False]
Expand Down Expand Up @@ -567,9 +566,8 @@ def __init__(self, geometryCore=None, detProperties=None, readoutProperties=None
self.configure(geometryCore, detProperties, readoutProperties, detClocks, lar_properties, auxDetGeometryCore)

self._pedestals = [0, 0, 0, 0, 0, 0]
self._levels = [(100, 0), (0, 100), (0, 100), (100, 0), (0, 100), (0, 100)]
self._levels = [(40000, 0), (0, 40000), (0, 40000), (40000, 0), (0, 40000), (0, 40000)]
self._view_names = ['H', 'U', 'V']
# self._plane_mix = {0: [3, 6, 9], 1: [5, 8, 11], 2: [4, 7, 10]}
self._plane_mix = {0: [3], 1: [5], 2: [4], 6: [9], 7: [11], 8: [10]}
self._plane_flip = [False, False, False, True, True, True, False, False, False, True, True, True]

Expand Down
54 changes: 32 additions & 22 deletions UserDev/EventDisplay/python/titus/modules/tpc_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
_SET_LOGO_SIZE = 'TPC/Logo size'


# icarus wires/channel ROIs are stored as four products with different labels
# use this list to iterate through them
_ICARUS_CRYO_LABELS = ('EE', 'WE', 'EW', 'WW')

class TpcModule(Module):
def __init__(self, larsoft_module, geom_module):
super().__init__()
Expand Down Expand Up @@ -297,7 +301,7 @@ def init_tpc_controls(self):
default_products = self._gi.get_default_products(_RECOB_CHANNELROI)
self._channel_roi_choice = MultiSelectionBox(self, _RECOB_CHANNELROI, products, default_products)
self._channel_roi_choice.activated.connect(self.change_wire_choice)

wire_choice_layout.addWidget(self._channel_roi_button, 3, 0, 1, 1)
wire_choice_layout.addWidget(self._channel_roi_choice, 3, 1, 1, 1)
self._channel_roi_choice.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
Expand Down Expand Up @@ -771,7 +775,13 @@ def clear_wire_drawer():
if producers is not None:
producer = producers
elif self._gm.current_geom.name() == 'icarus' and len(all_producers) > 3:
producer = [p.full_name() for p in all_producers[:3]]
# filter for EE EW, WE, WW variations. Extract prefix+suffix of
# the product, then check for variations
stem = self._wire_choice.selected_products()[0]
for cryo_str in _ICARUS_CRYO_LABELS:
stem = stem.replace(f'{cryo_str}:', '_CRYO_')
prefix, suffix = stem.split('_CRYO_')
producer = [f'{prefix}{label}:{suffix}' for label in _ICARUS_CRYO_LABELS]
else:
producer = self._wire_choice.selected_products()[0]

Expand All @@ -788,7 +798,13 @@ def clear_wire_drawer():
if producers is not None:
producer = producers
elif self._gm.current_geom.name() == 'icarus' and len(all_producers) > 3:
producer = [p.full_name() for p in all_producers[:3]]
# filter for EE EW, WE, WW variations. Extract prefix+suffix of
# the product, then check for variations
stem = self._channel_roi_choice.selected_products()[0]
for cryo_str in _ICARUS_CRYO_LABELS:
stem = stem.replace(f'{cryo_str}:', '_CRYO_')
prefix, suffix = stem.split('_CRYO_')
producer = [f'{prefix}{label}:{suffix}' for label in _ICARUS_CRYO_LABELS]
else:
producer = self._wire_choice.selected_products()[0]

Expand Down Expand Up @@ -1264,8 +1280,8 @@ def __init__(self, geometry, plane=-1, cryostat=0, tpc=0, gallery_interface=None
self._viewport_name_low.setStyleSheet('color: rgb(169,169,169);')
self._viewport_name_low.setMaximumWidth(25)

self._geometry.planeMix()[plane][0] - self._geometry.nPlanes()
name = f'TPC West, Plane {plane}'
self._other_plane = self._geometry.planeMix()[plane][0] % self._geometry.nPlanes()
name = f'TPC West, Plane {self._other_plane}'
self._viewport_name_up = VerticalLabel(name)
self._viewport_name_up.setStyleSheet('color: rgb(169,169,169);')
self._viewport_name_up.setMaximumWidth(25)
Expand Down Expand Up @@ -1482,6 +1498,7 @@ def refreshAnodeCathode(self):
Draws lines corresponding to the cathode and anode positions for t0 = 0
Red line = anode
Blue line = cathode
use ticks, since that's how the array is stored
'''

if not self._showAnodeCathode:
Expand All @@ -1493,9 +1510,8 @@ def refreshAnodeCathode(self):
# Take into account the distance between planes
offset = self._geometry.triggerOffset() * self._geometry.time2cm() # - delta_plane

hw = 100
x_cathode = (2 * self._geometry.halfwidth() + offset)/self._geometry.time2cm()
x_anode = offset/self._geometry.time2cm()
x_cathode = (2.0 * self._geometry.halfwidth() + offset)/self._geometry.time2cm()
x_anode = offset / self._geometry.time2cm()

# If we are changing the t0, shift the anode and cathode position
x_cathode += self._manual_t0
Expand All @@ -1506,7 +1522,6 @@ def refreshAnodeCathode(self):
x_cathode = self._geometry.tRange() - x_cathode
x_anode = self._geometry.tRange() - x_anode


# Add the ad-hoc gap between TPCs
x_cathode += tpc * self._geometry.cathodeGap()
x_anode += tpc * self._geometry.cathodeGap()
Expand All @@ -1516,9 +1531,8 @@ def refreshAnodeCathode(self):
x_anode += tpc * self._geometry.tRange()

# If we are deleting entries to see the cathodes together, do it here too
x_cathode = x_cathode - 2 * tpc * self._removed_entries
x_anode = x_anode - 2 * tpc * self._removed_entries

x_cathode -= 2 * tpc * self._removed_entries
x_anode -= 2 * tpc * self._removed_entries

# Construct the cathode line and append it
line = QtWidgets.QGraphicsLineItem()
Expand All @@ -1544,8 +1558,7 @@ def uniteCathodes(self, uniteC):
self._removed_entries = 0

if self._uniteCathodes:

x_cathode = (2 * self._geometry.halfwidth() + self._geometry.offset(self._plane))/self._geometry.time2cm()
x_cathode = (2.0 * self._geometry.halfwidth() + self._geometry.offset(self._plane))/self._geometry.time2cm()
x_anode = 0 + self._geometry.offset(self._plane)/self._geometry.time2cm()

x_cathode += self._manual_t0
Expand All @@ -1570,7 +1583,7 @@ def uniteCathodes(self, uniteC):

data = np.delete(data, final_slice, axis=1)
self.drawPlane(data)

self.drawPlane(data)
self.showAnodeCathode(self._showAnodeCathode)

Expand Down Expand Up @@ -1609,7 +1622,7 @@ def mouseMoved(self, pos):
else:
message += "W: "
message += str(int(self.q.x()))

if self._cmSpace:
if type(message) != str:
message.append(", Y: ")
Expand Down Expand Up @@ -1669,18 +1682,15 @@ def show_waveform(self, wire, tpc, replace_idx=None):
data = self._item.image
if wire < 0 or wire >= len(data):
return

self._wireData = data[wire]
self._wireData = self._wireData[self._first_entry:self._last_entry]

# Here we want to display the real plane number, not the view.
# So, make sure that if you are in an odd TPC we display the right number.
plane = self._plane
if tpc %2 != 0:
if self._plane == 0:
plane = 1
elif self._plane == 1:
plane = 0
if tpc % 2 != 0:
plane = self._other_plane

self._wdf(wireData=self._wireData, wire=wire, plane=plane, tpc=tpc,\
cryo=self._cryostat, drawer=self, replace_idx=replace_idx)
Expand Down