Skip to content
Closed
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
5 changes: 3 additions & 2 deletions fcl/caf/cafmaker_add_detsim2d_icarus.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ physics.producers.mcreco.SimChannelLabel: "daq:simpleSC"

# Mini production, pre signal shape tuning
# this_cal_constants: [1.343e-2, 1.338e-2, 0.01227]
# Post signal shape tuning
this_cal_constants: [1.343e-2, 1.338e-2, 0.01285]
# Post signal shape tuning, post gain fixing
# See docdb 32139
this_cal_constants: [1.343e-2, 1.338e-2, 0.01265]
#include "set_caf_calconst.fcl"
1 change: 1 addition & 0 deletions fcl/caf/cafmaker_defs.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ recoana_mccalo_producers: {
# Overwrite Labels
recoana_mccalo_producers.pandoraCaloGausCryoE.TrackModuleLabel: "pandoraTrackGausCryoE"
recoana_mccalo_producers.pandoraCaloGausCryoW.TrackModuleLabel: "pandoraTrackGausCryoW"
recoana_mccalo_producers.pandoraCaloGausCryoW.Cryostat: 1

# Setup CaloAlg for VertexCharge
recoana_mccalo_producers.vertexChargeCryoE.CaloAlg: @local::icarus_calorimetryalgmc
Expand Down
2 changes: 0 additions & 2 deletions fcl/caf/cafmakerjob_icarus_data.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,3 @@ physics.producers.cafmaker.SimChannelLabel: ""
physics.producers.cafmaker.SystWeightLabels: []

physics.producers.cafmaker.TriggerLabel: "daqTrigger" # the general configuration, for MC, has a different one (see also https://github.com/SBNSoftware/icaruscode/issues/556)

#include "icarus_data_recombination.fcl"
20 changes: 11 additions & 9 deletions icaruscode/TPC/Calorimetry/NormalizeTPCSQL_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class NormalizeTPCSQL : public INormalizeCharge
};

// Helpers
ScaleInfo GetScaleInfo(uint64_t timestamp);
ScaleInfo GetScaleInfo(uint64_t run);

// Cache timestamp requests
// Cache run requests
std::map<uint64_t, ScaleInfo> fScaleInfos;
};

Expand All @@ -69,16 +69,18 @@ icarus::calo::NormalizeTPCSQL::NormalizeTPCSQL(fhicl::ParameterSet const &pset):

void icarus::calo::NormalizeTPCSQL::configure(const fhicl::ParameterSet& pset) {}

icarus::calo::NormalizeTPCSQL::ScaleInfo icarus::calo::NormalizeTPCSQL::GetScaleInfo(uint64_t timestamp) {
icarus::calo::NormalizeTPCSQL::ScaleInfo icarus::calo::NormalizeTPCSQL::GetScaleInfo(uint64_t run) {
// check the cache
if (fScaleInfos.count(timestamp)) {
return fScaleInfos.at(timestamp);
if (fScaleInfos.count(run)) {
return fScaleInfos.at(run);
}

// Lookup the data
fDB.UpdateData(timestamp*1e9);
// Look up the run
//
// Translate the run into a fake "timestamp"
fDB.UpdateData((run+1000000000)*1000000000);

// Collect the timestamp info
// Collect the run info
ScaleInfo thisscale;

// Iterate over the rows
Expand All @@ -89,7 +91,7 @@ icarus::calo::NormalizeTPCSQL::ScaleInfo icarus::calo::NormalizeTPCSQL::GetScale
thisscale.scale[ch] = scale;
}
// Set the cache
fScaleInfos[timestamp] = thisscale;
fScaleInfos[run] = thisscale;

return thisscale;
}
Expand Down
24 changes: 12 additions & 12 deletions icaruscode/TPC/Calorimetry/NormalizeTPC_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class NormalizeTPC : public INormalizeCharge
};

// Helpers
ScaleInfo GetScaleInfo(uint64_t timestamp);
std::string URL(uint64_t timestamp);
ScaleInfo GetScaleInfo(uint64_t run);
std::string URL(uint64_t run);

// Cache timestamp requests
// Cache run requests
std::map<uint64_t, ScaleInfo> fScaleInfos;
};

Expand All @@ -68,19 +68,19 @@ void icarus::calo::NormalizeTPC::configure(const fhicl::ParameterSet& pset) {
fVerbose = pset.get<bool>("Verbose", false);
}

std::string icarus::calo::NormalizeTPC::URL(uint64_t timestamp) {
return fURL + std::to_string(timestamp);
std::string icarus::calo::NormalizeTPC::URL(uint64_t run) {
return fURL + std::to_string(run);
}

icarus::calo::NormalizeTPC::ScaleInfo icarus::calo::NormalizeTPC::GetScaleInfo(uint64_t timestamp) {
icarus::calo::NormalizeTPC::ScaleInfo icarus::calo::NormalizeTPC::GetScaleInfo(uint64_t run) {
// check the cache
if (fScaleInfos.count(timestamp)) {
return fScaleInfos.at(timestamp);
if (fScaleInfos.count(run)) {
return fScaleInfos.at(run);
}

// Otherwise, look it up
int error = 0;
std::string url = URL(timestamp);
std::string url = URL(run);

if (fVerbose) std::cout << "NormalizeTPC Tool -- New Scale info, requesting data from url:\n" << url << std::endl;

Expand All @@ -97,7 +97,7 @@ icarus::calo::NormalizeTPC::ScaleInfo icarus::calo::NormalizeTPC::GetScaleInfo(u
<< "). HTTP error status: " << getHTTPstatus(d) << ". HTTP error message: " << getHTTPmessage(d);
}

// Collect the timestamp info
// Collect the run info
ScaleInfo thisscale;

// Number of rows
Expand Down Expand Up @@ -128,15 +128,15 @@ icarus::calo::NormalizeTPC::ScaleInfo icarus::calo::NormalizeTPC::GetScaleInfo(u
}

// Set the cache
fScaleInfos[timestamp] = thisscale;
fScaleInfos[run] = thisscale;

return thisscale;
}

double icarus::calo::NormalizeTPC::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 i = GetScaleInfo(e.time().timeHigh());
ScaleInfo i = GetScaleInfo(e.id().runID().run());

// Lookup the TPC, cryo
unsigned tpc = hit.WireID().TPC;
Expand Down
20 changes: 11 additions & 9 deletions icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ class NormalizeYZSQL : public INormalizeCharge
ScaleBin const* findBin(const Point& point) const noexcept;

};
// Cache timestamp requests
// Cache run requests
std::map<uint64_t, ScaleInfo> fScaleInfos;

// Helpers
const ScaleInfo& GetScaleInfo(uint64_t timestamp);
const ScaleInfo& GetScaleInfo(uint64_t run);
};

DEFINE_ART_CLASS_TOOL(NormalizeYZSQL)
Expand Down Expand Up @@ -153,16 +153,18 @@ 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 timestamp) {
const icarus::calo::NormalizeYZSQL::ScaleInfo& icarus::calo::NormalizeYZSQL::GetScaleInfo(uint64_t run) {
// check the cache
if (fScaleInfos.count(timestamp)) {
return fScaleInfos.at(timestamp);
if (fScaleInfos.count(run)) {
return fScaleInfos.at(run);
}

// Prep data
fDB.UpdateData(timestamp*1e9);
// Look up the run
//
// Translate the run into a fake "timestamp"
fDB.UpdateData((run+1000000000)*1000000000);

// Collect the timestamp info
// Collect the run info
ScaleInfo thisscale;

// Lookup the channels
Expand Down Expand Up @@ -207,7 +209,7 @@ const icarus::calo::NormalizeYZSQL::ScaleInfo& icarus::calo::NormalizeYZSQL::Get
std::sort(thisscale.bins.begin(), thisscale.bins.end());

// Set the cache
return fScaleInfos[timestamp] = std::move(thisscale);
return fScaleInfos[run] = std::move(thisscale);

}

Expand Down
34 changes: 17 additions & 17 deletions icaruscode/TPC/Calorimetry/NormalizeYZ_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ class NormalizeYZ : public INormalizeCharge
};

// Helpers
const ScaleInfo& GetScaleInfo(uint64_t timestamp);
std::string URL(uint64_t timestamp);
const ScaleInfo& GetScaleInfo(uint64_t run);
std::string URL(uint64_t run);

// Cache timestamp requests
// Cache run requests
std::map<uint64_t, ScaleInfo> fScaleInfos;
};

Expand All @@ -80,19 +80,19 @@ void icarus::calo::NormalizeYZ::configure(const fhicl::ParameterSet& pset) {
fVerbose = pset.get<bool>("Verbose", false);
}

std::string icarus::calo::NormalizeYZ::URL(uint64_t timestamp) {
return fURL + std::to_string(timestamp);
std::string icarus::calo::NormalizeYZ::URL(uint64_t run) {
return fURL + std::to_string(run);
}

const icarus::calo::NormalizeYZ::ScaleInfo& icarus::calo::NormalizeYZ::GetScaleInfo(uint64_t timestamp) {
const icarus::calo::NormalizeYZ::ScaleInfo& icarus::calo::NormalizeYZ::GetScaleInfo(uint64_t run) {
// check the cache
if (fScaleInfos.count(timestamp)) {
return fScaleInfos.at(timestamp);
if (fScaleInfos.count(run)) {
return fScaleInfos.at(run);
}

// Otherwise, look it up
int error = 0;
std::string url = URL(timestamp);
std::string url = URL(run);

if (fVerbose) std::cout << "NormalizeYZ Tool -- New Scale info, requesting data from url:\n" << url << std::endl;

Expand All @@ -109,7 +109,7 @@ const icarus::calo::NormalizeYZ::ScaleInfo& icarus::calo::NormalizeYZ::GetScaleI
<< "). HTTP error status: " << getHTTPstatus(d) << ". HTTP error message: " << getHTTPmessage(d);
}

// Collect the timestamp info
// Collect the run info
ScaleInfo thisscale;

// Get the First row to get tzero
Expand All @@ -132,18 +132,18 @@ const icarus::calo::NormalizeYZ::ScaleInfo& icarus::calo::NormalizeYZ::GetScaleI
thisscale = scale;
found_scale_t0 = true;

if (fVerbose) std::cout << "NormalizeYZ Tool -- Found prior matching T0 from timestamp: " << scale_pair.first << std::endl;
if (fVerbose) std::cout << "NormalizeYZ Tool -- Found prior matching T0 from run: " << scale_pair.first << std::endl;

break;
}
}

if (found_scale_t0) {
fScaleInfos[timestamp] = thisscale;
return fScaleInfos.at(timestamp);
fScaleInfos[run] = thisscale;
return fScaleInfos.at(run);
}

// We haven't seen this timestamp before and we haven't seen the valid t0 before.
// We haven't seen this run before and we haven't seen the valid t0 before.
//
// Process the HTTP response
thisscale.tzero = tzero;
Expand Down Expand Up @@ -213,14 +213,14 @@ const icarus::calo::NormalizeYZ::ScaleInfo& icarus::calo::NormalizeYZ::GetScaleI
}

// Set the cache
fScaleInfos[timestamp] = thisscale;
return fScaleInfos.at(timestamp);
fScaleInfos[run] = thisscale;
return fScaleInfos.at(run);
}

double icarus::calo::NormalizeYZ::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 i = GetScaleInfo(e.time().timeHigh());
ScaleInfo i = GetScaleInfo(e.id().runID().run());

double scale = 1;
bool found_bin = false;;
Expand Down
3 changes: 3 additions & 0 deletions icaruscode/TPC/Calorimetry/calorimetryICARUS.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ icarus_calorimetryalgmc.CalAreaConstants: [0.01343, 0.01338, 0.01219]

icarus_calorimetryalgdata.CalAreaConstants: @local::icarus_data_calconst
icarus_calorimetryalgdata.CaloDoLifeTimeCorrection: false # handled by NormTools
icarus_calorimetryalgdata.ModBoxA: 0.906
icarus_calorimetryalgdata.ModBoxBTF1: "[0]/TMath::Sqrt(TMath::Sin(x*TMath::Pi()/180)**2 + TMath::Cos(x*TMath::Pi()/180)**2/[1]**2)"
icarus_calorimetryalgdata.ModBoxBParam: [0.203, 1.25]

standard_gnocchicaloicarus:
{
Expand Down
7 changes: 0 additions & 7 deletions icaruscode/TPC/Calorimetry/icarus_data_recombination.fcl

This file was deleted.

18 changes: 8 additions & 10 deletions icaruscode/TPC/Calorimetry/normtools_icarus.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ wirenorm: {
yznorm: {
tool_type: NormalizeYZ
Timeout: 200
URL: "https://dbdata0vm.fnal.gov:9443/icarus_con_prod/app/data?f=test_tpc_yz_correction_data&t="
URL: "https://dbdata0vm.fnal.gov:9443/icarus_con_prod/app/data?f=tpc_yz_correction_data&t="
Verbose: false
}

Expand All @@ -44,25 +44,23 @@ tpcgain_sql: {

tpcgain_local: {
tool_type: NormalizeTPCLocal
# Recombination floating, muon+proton fit
# CalConstants: [81.04, 79.5, 82.88, 81.88]
# Recombination fixed, muon+proton fit
CalConstants: [80.32, 79.82, 82.24, 81.68]
# Relative normalization of the TPCs
CalConstants: [1.0118, 1.0000, 1.0333, 1.0230]
Verbose: false
}


yznorm_sql: {
tool_type: NormalizeYZSQL
DBFileName: tpc_yz_correction_data
DBTag: v1r0
Verbose: false
}

# icarus_calonormtools: [@local::driftnorm, @local::yznorm, @local::tpcgain]
icarus_calonormtools: [@local::driftnorm_sql, @local::yznorm_sql, @local::tpcgain_local]
icarus_calonormtools: [@local::driftnorm, @local::yznorm, @local::tpcgain]
# icarus_calonormtools: [@local::driftnorm_sql, @local::yznorm_sql, @local::tpcgain_sql]

# The norm tools already take care of this
icarus_data_calconst: [1., 1., 1.]
# Gain with angular dep. recombination
# Assume equal on planes -- this is __wrong__ -- will need to be fixed when they are calibrated
icarus_data_calconst: [0.013316, 0.013316, 0.013316]

END_PROLOG
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ icarus_simwire_wirecell_fitSR.wcls_main.params.file_rcresp: "icarus_fnal_rc_tail
# Add in the tuned field responses
icarus_simwire_wirecell_fitSR.wcls_main.params.files_fields: "icarus_fnal_fit_ks.json.bz2"
# futz with shaping+gain values (note these are really just scale factors and should not be taken literally)
icarus_simwire_wirecell_fitSR.wcls_main.structs.gain0: 10.2636323 # mV/fC
icarus_simwire_wirecell_fitSR.wcls_main.structs.gain1: 12.1420344 # mV/fC
icarus_simwire_wirecell_fitSR.wcls_main.structs.gain0: 11.9918701 # mV/fC
icarus_simwire_wirecell_fitSR.wcls_main.structs.gain1: 12.6181926 # mV/fC
icarus_simwire_wirecell_fitSR.wcls_main.structs.gain2: 13.0261362 # mV/fC
icarus_simwire_wirecell_fitSR.wcls_main.structs.shaping1: 1.45 # us


END_PROLOG