Skip to content

Commit 46cbc17

Browse files
committed
use clockdata for t_drift in NormalizeDriftSQLite_tool.cc. Adding exception handlings too
1 parent 1b94d48 commit 46cbc17

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

sbndcode/Calibration/TPCCalorimetry/NormalizeDriftSQLite_tool.cc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "art/Framework/Services/Registry/ServiceHandle.h"
66
#include "art/Persistency/Common/PtrMaker.h"
77
#include "art/Utilities/ToolMacros.h"
8+
#include "cetlib_except/exception.h"
89
#include "cetlib/cpu_timer.h"
910
#include "fhiclcpp/ParameterSet.h"
1011
#include "messagefacility/MessageLogger/MessageLogger.h"
@@ -110,7 +111,10 @@ sbnd::calo::NormalizeDriftSQLite::RunInfo sbnd::calo::NormalizeDriftSQLite::GetR
110111
double sbnd::calo::NormalizeDriftSQLite::Normalize(double dQdx, const art::Event &e,
111112
const recob::Hit &hit, const geo::Point_t &location, const geo::Vector_t &direction, double t0) {
112113

113-
assert(fClockData);
114+
if (!fClockData) {
115+
std::cout << "Error: fClockData is not valid" << std::endl;
116+
throw cet::exception("fClockData is not valid");
117+
}
114118

115119
// Get the info
116120
RunInfo runelifetime = GetRunInfo(e.id().runID().run());
@@ -127,16 +131,20 @@ double sbnd::calo::NormalizeDriftSQLite::Normalize(double dQdx, const art::Event
127131
if (cryo == 0 && tpc == 1) thiselifetime = runelifetime.tau_W;
128132

129133
// Get the hit time
130-
double thit = hit.PeakTime()/2000. - 0.2 - t0;
134+
double thit = fClockData->TPCTick2TrigTime(hit.PeakTime()) - t0;
135+
thit = thit * 1.e-3;
131136

132137
if (fVerbose) std::cout << "NormalizeDriftSQLite Tool -- Norm factor: " << exp(thit / thiselifetime) << " at TPC: " << tpc << " Cryo: " << cryo << " Time: " << thit << " Track T0: " << t0 << ", x: " << location.X() << std::endl;
133138

134139
// Scale
135140
if (thiselifetime > 0) {
136141
dQdx = dQdx*exp(thit / thiselifetime);
137142
}
138-
// TODO: what to do if no lifetime is found? throw an exception??
139-
else {}
143+
// Throw exception if thiselifetime is not updated to non-zero value
144+
else {
145+
std::cout << "sbnd::calo::NormalizeDriftSQLite::Normalize electron lifetime is not found for run " << e.id().runID().run() << std::endl;
146+
throw cet::exception("Electron lifetime is not found");
147+
}
140148

141149
return dQdx;
142150
}

sbndcode/Calibration/configurations/calibration_database_TPC_TagSets_sbnd.fcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ BEGIN_PROLOG
99
## First one for 2025 Fall, only with etau tag
1010
TPC_CalibrationTags_Nov2025: {
1111

12-
tpc_elifetime_data: "v1r1"
12+
tpc_elifetime_data: "v2r1"
1313

1414
}
1515

0 commit comments

Comments
 (0)