Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/howard v09 72 00 08 harps #791

Draft
wants to merge 3 commits into
base: release/SBN2023A_NuMI
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
BEGIN_PROLOG

ICARUS_Calibration_GlobalTags: {
@table::TPC_CalibrationTags_Oct2023
@table::TPC_CalibrationTags_Dec2024_TEMP_FOR_HARPS
@table::PMT_CalibrationTags_Run2_Sept2023
@table::CRT_CalibrationTags_Oct2023
}
Expand Down
10 changes: 10 additions & 0 deletions fcl/configurations/calibration_database_TPC_TagSets_icarus.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,14 @@ TPC_CalibrationTags_Oct2023: {

}

## TEMPORARY
TPC_CalibrationTags_Dec2024_TEMP_FOR_HARPS: {

tpc_channelstatus_data: "v3r1"
tpc_elifetime_data: "v2r1"
tpc_dqdxcalibration_data: "v2r1"
tpc_yz_correction_allplanes_data: "v1r0"

}

END_PROLOG
22 changes: 20 additions & 2 deletions icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ class NormalizeYZSQL : public INormalizeCharge
class ScaleInfo {
public:
struct Point {
int iplane;
int itpc;
double y, z;
};

class ScaleBin {
public:
int iplane;
int itpc;
double ylo;
double yhi;
Expand Down Expand Up @@ -94,6 +96,7 @@ DEFINE_ART_CLASS_TOOL(NormalizeYZSQL)
constexpr bool icarus::calo::NormalizeYZSQL::ScaleInfo::ScaleBin::operator<
(const ScaleBin& other) const noexcept
{
if (iplane != other.iplane) return iplane < other.iplane;
if (itpc != other.itpc) return itpc < other.itpc;
if (yhi != other.yhi) return yhi < other.yhi;
return zhi < other.zhi;
Expand All @@ -103,6 +106,7 @@ bool icarus::calo::NormalizeYZSQL::ScaleInfo::BinComp::operator()
(const ScaleBin& a, const Point& b) const noexcept
{
// the bin `a` must be strictly before the point `b`
if (a.iplane != b.iplane) return a.iplane < b.iplane;
if (a.itpc != b.itpc) return a.itpc < b.itpc;
if (a.yhi <= b.y) return true;
if (a.ylo > b.y) return false;
Expand All @@ -113,6 +117,7 @@ bool icarus::calo::NormalizeYZSQL::ScaleInfo::BinComp::operator()
(const Point& a, const ScaleBin& b) const noexcept
{
// the point `a` must be strictly before the bin `b`
if (a.iplane != b.iplane) return a.iplane < b.iplane;
if (a.itpc != b.itpc) return a.itpc < b.itpc;
if (a.y < b.ylo) return true;
if (a.y >= b.yhi) return false;
Expand All @@ -122,6 +127,7 @@ bool icarus::calo::NormalizeYZSQL::ScaleInfo::BinComp::operator()
bool icarus::calo::NormalizeYZSQL::ScaleInfo::ScaleBin::contains
(const Point& point) const noexcept
{
if (point.iplane != iplane) return false;
if (point.itpc != itpc) return false;
if ((point.y < ylo) || (point.y >= yhi)) return false;
return ((point.z >= zlo) && (point.z < zhi));
Expand Down Expand Up @@ -154,6 +160,7 @@ icarus::calo::NormalizeYZSQL::NormalizeYZSQL(fhicl::ParameterSet const &pset):
void icarus::calo::NormalizeYZSQL::configure(const fhicl::ParameterSet& pset) {}

const icarus::calo::NormalizeYZSQL::ScaleInfo& icarus::calo::NormalizeYZSQL::GetScaleInfo(uint64_t run) {

// check the cache
if (fScaleInfos.count(run)) {
return fScaleInfos.at(run);
Expand All @@ -173,7 +180,13 @@ const icarus::calo::NormalizeYZSQL::ScaleInfo& icarus::calo::NormalizeYZSQL::Get

// Iterate over the channels
thisscale.bins.reserve(channels.size());

for (unsigned ch = 0; ch < channels.size(); ch++) {

long lplane;
fDB.GetNamedChannelData(ch, "plane", lplane);
int iplane(lplane);

std::string tpcname;
fDB.GetNamedChannelData(ch, "tpc", tpcname);
int itpc = -1;
Expand Down Expand Up @@ -201,6 +214,7 @@ const icarus::calo::NormalizeYZSQL::ScaleInfo& icarus::calo::NormalizeYZSQL::Get
bin.yhi = yhi;
bin.zlo = zlo;
bin.zhi = zhi;
bin.iplane = iplane;
bin.itpc = itpc;
bin.scale = scale;

Expand All @@ -215,9 +229,13 @@ const icarus::calo::NormalizeYZSQL::ScaleInfo& icarus::calo::NormalizeYZSQL::Get

double icarus::calo::NormalizeYZSQL::Normalize(double dQdx, const art::Event &e,
const recob::Hit &hit, const geo::Point_t &location, const geo::Vector_t &direction, double t0) {

// Get the info
ScaleInfo const& i = GetScaleInfo(e.id().runID().run());

// plane
int plane = hit.WireID().Plane;

// compute itpc
int cryo = hit.WireID().Cryostat;
int tpc = hit.WireID().TPC;
Expand All @@ -226,15 +244,15 @@ double icarus::calo::NormalizeYZSQL::Normalize(double dQdx, const art::Event &e,
double y = location.y();
double z = location.z();

ScaleInfo::Point const point { itpc, y, z };
ScaleInfo::Point const point { plane, itpc, y, z };
ScaleInfo::ScaleBin const* b = i.findBin(point);

double const scale = b? b->scale: 1;
if (!b) {
// TODO: what to do if no lifetime is found? throw an exception??
}

if (fVerbose) std::cout << "NormalizeYZSQL Tool -- Data Cryo: " << cryo << " TPC: " << tpc << " iTPC: " << itpc << " Y: " << y << " Z: " << z << " scale: " << scale << std::endl;
if (fVerbose) std::cout << "NormalizeYZSQL Tool -- Data Cryo: " << cryo << " Plane: " << plane << " TPC: " << tpc << " iTPC: " << itpc << " Y: " << y << " Z: " << z << " scale: " << scale << std::endl;

return dQdx / scale;
}
Expand Down
4 changes: 2 additions & 2 deletions icaruscode/TPC/Calorimetry/normtools_icarus.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ tpcgain_local: {

yznorm_sql: {
tool_type: NormalizeYZSQL
DBFileName: tpc_yz_correction_data
DBTag: @local::ICARUS_Calibration_GlobalTags.tpc_yz_correction_data
DBFileName: tpc_yz_correction_allplanes_data
DBTag: @local::ICARUS_Calibration_GlobalTags.tpc_yz_correction_allplanes_data
Verbose: false
}

Expand Down
38 changes: 38 additions & 0 deletions icaruscode/TPC/Tracking/ICARUSPandora/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,43 @@

# where should the scripts/..xml file be installed? Perhaps in bin?

art_make_library(
LIBRARIES
lardataobj::RecoBase
fhiclcpp::fhiclcpp
cetlib::cetlib
)
set( MODULE_LIBRARIES
larcorealg::Geometry
larcorealg::Geometry
larcore::Geometry_Geometry_service
lardata::Utilities
larevt::Filters
lardataobj::RecoBase
lardata::ArtDataHelper
nurandom::RandomUtils_NuRandomService_service
art::Framework_Core
art::Framework_Principal
art::Framework_Services_Registry
art_root_io::tfile_support ROOT::Core
art_root_io::TFileService_service
art::Persistency_Common
art::Persistency_Provenance
art::Utilities
canvas::canvas
messagefacility::MF_MessageLogger
messagefacility::headers
fhiclcpp::fhiclcpp
cetlib::cetlib
CLHEP::Random
ROOT::Geom
ROOT::XMLIO
ROOT::Gdml
ROOT::FFTW

)
cet_build_plugin(HARPS art::module LIBRARIES ${MODULE_LIBRARIES})

set( TOOL_LIBRARIES
larpandora::LArPandoraInterface
lardataobj::RecoBase
Expand All @@ -12,6 +49,7 @@ set( TOOL_LIBRARIES

cet_build_plugin(LArPandoraHitCollectionToolICARUS art::tool LIBRARIES ${TOOL_LIBRARIES})

install_headers()
install_fhicl()
install_source()

Expand Down
Loading