Skip to content

Commit 0f7ffa2

Browse files
committed
merge feature/hhausner_wiremod_v10_MoreScalingEnabled
2 parents 9e8d036 + 75853f7 commit 0f7ffa2

3 files changed

Lines changed: 77 additions & 8 deletions

File tree

sbncode/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ add_subdirectory(GeometryTools)
2020
add_subdirectory(CosmicID)
2121
add_subdirectory(DetSim)
2222
add_subdirectory(Cluster3D)
23+
add_subdirectory(WireMod)
2324
add_subdirectory(HitFinder)
2425

2526
# Supera

sbncode/WireMod/Utility/WireModUtility.cc

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,6 @@ std::vector<std::pair<unsigned int, unsigned int>> sys::WireModUtility::GetHitTa
108108
return target_roi_vec;
109109
}
110110

111-
//--- FillROIMatchedIDEMap ---
112-
void sys::WireModUtility::FillROIMatchedIDEMap(std::vector<sim::SimChannel> const& simchVec, std::vector<recob::Wire> const& wireVec, double offset)
113-
{
114-
}
115-
116111
//--- FillROIMatchedEdepMap ---
117112
void sys::WireModUtility::FillROIMatchedEdepMap(std::vector<sim::SimEnergyDeposit> const& edepVec, std::vector<recob::Wire> const& wireVec, double offset)
118113
{
@@ -366,6 +361,7 @@ sys::WireModUtility::TruthProperties_t sys::WireModUtility::CalcPropertiesFromEd
366361
edep_props.dxdr = (edep_ptr->EndX() - edep_ptr->StartX()) / edep_ptr->StepLength();
367362
edep_props.dydr = (edep_ptr->EndY() - edep_ptr->StartY()) / edep_ptr->StepLength();
368363
edep_props.dzdr = (edep_ptr->EndZ() - edep_ptr->StartZ()) / edep_ptr->StepLength();
364+
369365
edep_props.dedr = edep_ptr->E() / edep_ptr->StepLength();
370366

371367
total_energy_all += edep_ptr->E();
@@ -413,6 +409,7 @@ sys::WireModUtility::TruthProperties_t sys::WireModUtility::CalcPropertiesFromEd
413409
edep_col_properties.dxdr = 0.;
414410
edep_col_properties.dydr = 0.;
415411
edep_col_properties.dzdr = 0.;
412+
416413
edep_col_properties.dedr = 0.;
417414

418415
double total_energy = 0.0;
@@ -431,6 +428,7 @@ sys::WireModUtility::TruthProperties_t sys::WireModUtility::CalcPropertiesFromEd
431428
edep_col_properties.dxdr += edep_ptr->E()*(edep_ptr->EndX() - edep_ptr->StartX()) / edep_ptr->StepLength();
432429
edep_col_properties.dydr += edep_ptr->E()*(edep_ptr->EndY() - edep_ptr->StartY()) / edep_ptr->StepLength();
433430
edep_col_properties.dzdr += edep_ptr->E()*(edep_ptr->EndZ() - edep_ptr->StartZ()) / edep_ptr->StepLength();
431+
434432
edep_col_properties.dedr += edep_ptr->E()*edep_ptr->E() / edep_ptr->StepLength();
435433
}
436434

@@ -442,6 +440,7 @@ sys::WireModUtility::TruthProperties_t sys::WireModUtility::CalcPropertiesFromEd
442440
edep_col_properties.dxdr = edep_col_properties.dxdr / total_energy;
443441
edep_col_properties.dydr = edep_col_properties.dydr / total_energy;
444442
edep_col_properties.dzdr = edep_col_properties.dzdr / total_energy;
443+
445444
edep_col_properties.dedr = edep_col_properties.dedr / total_energy;
446445
}
447446

@@ -571,7 +570,7 @@ sys::WireModUtility::ScaleValues_t sys::WireModUtility::GetViewScaleValues(sys::
571570
scales.r_sigma *= splines_Sigma_YZAngle [plane]->Eval(ThetaYZ_PlaneRel(truth_props.dxdr, truth_props.dydr, truth_props.dzdr, plane_obj.ThetaZ()));
572571
}
573572

574-
if(applydEdXScale)
573+
if (applydEdXScale)
575574
{
576575
if (splines_Charge_dEdX[plane] == nullptr ||
577576
splines_Sigma_dEdX [plane] == nullptr )
@@ -581,6 +580,45 @@ sys::WireModUtility::ScaleValues_t sys::WireModUtility::GetViewScaleValues(sys::
581580
scales.r_sigma *= splines_Sigma_dEdX [plane]->Eval(truth_props.dedr);
582581
}
583582

583+
if (applyXXZAngleScale)
584+
{
585+
if (graph2Ds_Charge_XXZAngle[plane] == nullptr ||
586+
graph2Ds_Sigma_XXZAngle [plane] == nullptr )
587+
throw cet::exception("WireModUtility")
588+
<< "Tried to apply XXZAngle scale factor, but could not find graphs. Check that you have set those in the utility.";
589+
temp_scale = graph2Ds_Charge_XXZAngle[plane]->Interpolate(truth_props.x, ThetaXZ_PlaneRel(truth_props.dxdr, truth_props.dydr, truth_props.dzdr, plane_obj.ThetaZ()));
590+
if(temp_scale>0.001) scales.r_Q *= temp_scale;
591+
592+
temp_scale = graph2Ds_Sigma_XXZAngle [plane]->Interpolate(truth_props.x, ThetaXZ_PlaneRel(truth_props.dxdr, truth_props.dydr, truth_props.dzdr, plane_obj.ThetaZ()));
593+
if(temp_scale>0.001) scales.r_sigma *= temp_scale;
594+
}
595+
596+
if (applyXdQdXScale)
597+
{
598+
if (graph2Ds_Charge_XdQdX[plane] == nullptr ||
599+
graph2Ds_Sigma_XdQdX [plane] == nullptr )
600+
throw cet::exception("WireModUtility")
601+
<< "Tried to apply XdQdX scale factor, but could not find graphs. Check that you have set those in the utility.";
602+
temp_scale = graph2Ds_Charge_XdQdX[plane]->Interpolate(truth_props.x, truth_props.dqdr);
603+
if(temp_scale>0.001) scales.r_Q *= temp_scale;
604+
605+
temp_scale = graph2Ds_Sigma_XdQdX [plane]->Interpolate(truth_props.x, truth_props.dqdr);
606+
if(temp_scale>0.001) scales.r_sigma *= temp_scale;
607+
}
608+
609+
if (applyXZAngledQdXScale)
610+
{
611+
if (graph2Ds_Charge_XZAngledQdX[plane] == nullptr ||
612+
graph2Ds_Sigma_XZAngledQdX [plane] == nullptr )
613+
throw cet::exception("WireModUtility")
614+
<< "Tried to apply XZAngledQdX scale factor, but could not find graphs. Check that you have set those in the utility.";
615+
temp_scale = graph2Ds_Charge_XZAngledQdX[plane]->Interpolate(ThetaXZ_PlaneRel(truth_props.dxdr, truth_props.dydr, truth_props.dzdr, plane_obj.ThetaZ()), truth_props.dqdr);
616+
if(temp_scale>0.001) scales.r_Q *= temp_scale;
617+
618+
temp_scale = graph2Ds_Sigma_XZAngledQdX [plane]->Interpolate(ThetaXZ_PlaneRel(truth_props.dxdr, truth_props.dydr, truth_props.dzdr, plane_obj.ThetaZ()), truth_props.dqdr);
619+
if(temp_scale>0.001) scales.r_sigma *= temp_scale;
620+
}
621+
584622
return scales;
585623
}
586624

sbncode/WireMod/Utility/WireModUtility.hh

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "lardataobj/RecoBase/Hit.h"
2020
#include "lardataobj/RecoBase/Wire.h"
2121
#include "lardataobj/Simulation/SimEnergyDeposit.h"
22-
#include "lardataobj/Simulation/SimChannel.h"
2322
#include "larcoreobj/SimpleTypesAndConstants/PhysicalConstants.h"
2423
#include "nusimdata/SimulationBase/MCParticle.h"
2524
#include "nusimdata/SimulationBase/MCTruth.h"
@@ -43,6 +42,12 @@ namespace sys {
4342
bool applyXZAngleScale; // do we scale with XZ angle?
4443
bool applyYZAngleScale; // do we scale with YZ angle?
4544
bool applydEdXScale; // do we scale with dEdx?
45+
<<<<<<< HEAD
46+
=======
47+
bool applyXXZAngleScale; // do we scale with X vs XZ angle?
48+
bool applyXdQdXScale; // do we scale with X vs dQ/dX?
49+
bool applyXZAngledQdXScale; // do we scale with XZ angle vs dQ/dX?
50+
>>>>>>> feature/hhausner_wiremod_v10_MoreScalingEnabled
4651
double readoutWindowTicks; // how many ticks are in the readout window?
4752
double tickOffset; // do we want an offset in the ticks?
4853

@@ -59,6 +64,16 @@ namespace sys {
5964
std::vector<TGraph2D*> graph2Ds_Charge_YZ; // the graphs for the charge correction in YZ
6065
std::vector<TGraph2D*> graph2Ds_Sigma_YZ; // the graphs for the width correction in YZ
6166

67+
<<<<<<< HEAD
68+
=======
69+
std::vector<TGraph2D*> graph2Ds_Charge_XXZAngle; // the graphs for the charge correction in X vs XZ angle
70+
std::vector<TGraph2D*> graph2Ds_Sigma_XXZAngle; // the graphs for the width correction in X vs XZ angle
71+
std::vector<TGraph2D*> graph2Ds_Charge_XdQdX; // the graphs for charge correction in X vs dQ/dX
72+
std::vector<TGraph2D*> graph2Ds_Sigma_XdQdX; // the graphs for width correction in X vs dQ/dX
73+
std::vector<TGraph2D*> graph2Ds_Charge_XZAngledQdX; // the graphs for charge correction in XZ angle vs dQ/dX
74+
std::vector<TGraph2D*> graph2Ds_Sigma_XZAngledQdX; // the graphs for width correction in XZ angle vs dQ/dX
75+
76+
>>>>>>> feature/hhausner_wiremod_v10_MoreScalingEnabled
6277
// lets try making a constructor here
6378
// assume we can get a geometry service, a detector clcok, and a detector properties
6479
// pass the CryoStat and TPC IDs because it's IDs all the way down
@@ -72,6 +87,12 @@ namespace sys {
7287
const bool& arg_ApplyXZAngleScale = true,
7388
const bool& arg_ApplyYZAngleScale = true,
7489
const bool& arg_ApplydEdXScale = true,
90+
<<<<<<< HEAD
91+
=======
92+
const bool& arg_ApplyXXZAngleScale = false,
93+
const bool& arg_ApplyXdQdXScale = false,
94+
const bool& arg_ApplyXZAngledQdXScale = false,
95+
>>>>>>> feature/hhausner_wiremod_v10_MoreScalingEnabled
7596
const double& arg_TickOffset = 0)
7697
: geometry(geom),
7798
wireReadout(wireRead),
@@ -82,6 +103,12 @@ namespace sys {
82103
applyXZAngleScale(arg_ApplyXZAngleScale),
83104
applyYZAngleScale(arg_ApplyYZAngleScale),
84105
applydEdXScale(arg_ApplydEdXScale),
106+
<<<<<<< HEAD
107+
=======
108+
applyXXZAngleScale(arg_ApplyXXZAngleScale),
109+
applyXdQdXScale(arg_ApplyXdQdXScale),
110+
applyXZAngledQdXScale(arg_ApplyXZAngledQdXScale),
111+
>>>>>>> feature/hhausner_wiremod_v10_MoreScalingEnabled
85112
readoutWindowTicks(detProp.ReadOutWindowSize()), // the default A2795 (ICARUS TPC readout board) readout window is 4096 samples
86113
tickOffset(arg_TickOffset) // tick offset is for MC truth, default to zero and set only as necessary
87114
{
@@ -137,6 +164,10 @@ namespace sys {
137164
double dxdr;
138165
double dydr;
139166
double dzdr;
167+
<<<<<<< HEAD
168+
=======
169+
double dqdr;
170+
>>>>>>> feature/hhausner_wiremod_v10_MoreScalingEnabled
140171
double dedr;
141172
ScaleValues_t scales_avg[3];
142173
} TruthProperties_t;
@@ -206,7 +237,6 @@ namespace sys {
206237

207238
void FillROIMatchedEdepMap(std::vector<sim::SimEnergyDeposit> const&, std::vector<recob::Wire> const&, double offset);
208239
void FillROIMatchedHitMap(std::vector<recob::Hit> const&, std::vector<recob::Wire> const&);
209-
void FillROIMatchedIDEMap(std::vector<sim::SimChannel> const& simchVec, std::vector<recob::Wire> const& wireVec, double offset);
210240

211241
std::vector<SubROIProperties_t> CalcSubROIProperties(ROIProperties_t const&, std::vector<const recob::Hit*> const&);
212242

0 commit comments

Comments
 (0)