Skip to content

Commit 40af989

Browse files
author
Ibrahim Safa
committed
Merge branch 'release/v10_01_04'
Version v10_01_04
2 parents 8f94ec0 + bbfe733 commit 40af989

10 files changed

Lines changed: 178 additions & 16 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
1717

1818
find_package(cetmodules 3.20.00 REQUIRED)
19-
project(sbncode VERSION 10.01.03 LANGUAGES CXX)
19+
project(sbncode VERSION 10.01.04 LANGUAGES CXX)
2020

2121
message(STATUS "\n\n ========================== ${PROJECT_NAME} ==========================")
2222

sbncode/CAFMaker/CAFMaker_module.cc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,22 +1552,17 @@ void CAFMaker::produce(art::Event& evt) noexcept {
15521552
}
15531553
}
15541554

1555-
// Get all of the CRTPMT Matches ..
1555+
// Get all of the CRTPMT Matches
15561556
std::vector<caf::SRCRTPMTMatch> srcrtpmtmatches;
1557-
std::cout << "srcrtpmtmatches.size = " << srcrtpmtmatches.size() << "\n";
15581557
art::Handle<std::vector<sbn::crt::CRTPMTMatching>> crtpmtmatch_handle;
15591558
GetByLabelStrict(evt, fParams.CRTPMTLabel(), crtpmtmatch_handle);
15601559
if(crtpmtmatch_handle.isValid()){
1561-
std::cout << "valid handle! label: " << fParams.CRTPMTLabel() << "\n";
15621560
const std::vector<sbn::crt::CRTPMTMatching> &crtpmtmatches = *crtpmtmatch_handle;
15631561
for (unsigned i = 0; i < crtpmtmatches.size(); i++) {
15641562
srcrtpmtmatches.emplace_back();
1565-
FillCRTPMTMatch(crtpmtmatches[i],srcrtpmtmatches.back());
1563+
FillCRTPMTMatch(crtpmtmatches[i], srcrtpmtmatches.back());
15661564
}
15671565
}
1568-
else{
1569-
std::cout << "crtpmtmatch_handle.isNOTValid!\n";
1570-
}
15711566

15721567
// Get all of the OpFlashes
15731568
std::vector<caf::SROpFlash> srflashes;

sbncode/CAFMaker/FillReco.cxx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,25 @@ namespace caf
157157
srmatch.flashPosition = SRVector3D (match.flashPosition.X(), match.flashPosition.Y(), match.flashPosition.Z());
158158
srmatch.flashYWidth = match.flashYWidth;
159159
srmatch.flashZWidth = match.flashZWidth;
160-
srmatch.flashClassification = static_cast<int>(match.flashClassification);
160+
unsigned int topen = 0, topex = 0, sideen = 0, sideex = 0;
161161
for(const auto& matchedCRTHit : match.matchedCRTHits){
162-
std::cout << "CRTPMTTimeDiff = "<< matchedCRTHit.PMTTimeDiff << "\n";
163162
caf::SRMatchedCRT matchedCRT;
164163
matchedCRT.PMTTimeDiff = matchedCRTHit.PMTTimeDiff;
165164
matchedCRT.time = matchedCRTHit.time;
166165
matchedCRT.sys = matchedCRTHit.sys;
167166
matchedCRT.region = matchedCRTHit.region;
168167
matchedCRT.position = SRVector3D(matchedCRTHit.position.X(), matchedCRTHit.position.Y(), matchedCRTHit.position.Z());
168+
if(matchedCRTHit.PMTTimeDiff < 0){
169+
if(matchedCRTHit.sys == 0) topen++;
170+
else if(matchedCRTHit.sys == 1) sideen++;
171+
}
172+
else if(matchedCRTHit.PMTTimeDiff >= 0){
173+
if(matchedCRTHit.sys == 0) topex++;
174+
else if(matchedCRTHit.sys == 1) sideex++;
175+
}
169176
srmatch.matchedCRTHits.push_back(matchedCRT);
170177
}
178+
srmatch.flashClassification = static_cast<int>(sbn::crt::assignFlashClassification(topen, topex, sideen, sideex, 0, 0));
171179
}
172180

173181

sbncode/CAFMaker/FillReco.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ namespace caf
222222
caf::SROpFlash &srflash,
223223
bool allowEmpty = false);
224224
void FillCRTPMTMatch(const sbn::crt::CRTPMTMatching &match,
225-
caf::SRCRTPMTMatch &srmatch,
226-
bool allowEmpty = false);
225+
caf::SRCRTPMTMatch &srmatch,
226+
bool allowEmpty = false);
227227

228228
void FillTPCPMTBarycenterMatch(const sbn::TPCPMTBarycenterMatch *matchInfo,
229229
caf::SRSlice& slice);

sbncode/DetSim/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ set( MODULE_LIBRARIES
3232
)
3333

3434
cet_build_plugin(AdjustSimForTrigger art::module LIBRARIES ${MODULE_LIBRARIES})
35+
cet_build_plugin(FilterSimEnergyDeposits art::module LIBRARIES ${MODULE_LIBRARIES})
36+
37+
add_subdirectory(fcl)
3538

3639
#install_headers()
3740
install_fhicl()
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/**
2+
* @file sbncode/DetSim/FilterSimEnergyDeposits_module.cc
3+
* @date October 17, 2024
4+
* @author Jacob Zettlemoyer
5+
*/
6+
7+
#include "art/Framework/Core/EDProducer.h"
8+
#include "art/Framework/Core/ModuleMacros.h"
9+
#include "art/Framework/Principal/Event.h"
10+
#include "canvas/Utilities/InputTag.h"
11+
#include "fhiclcpp/ParameterSet.h"
12+
#include "messagefacility/MessageLogger/MessageLogger.h"
13+
#include "larcore/Geometry/Geometry.h"
14+
#include "larcore/Geometry/WireReadout.h"
15+
#include "larcorealg/Geometry/GeometryCore.h"
16+
#include "larcorealg/Geometry/WireReadoutGeom.h"
17+
#include "larcore/CoreUtils/ServiceUtil.h"
18+
#include "larcorealg/Geometry/BoxBoundedGeo.h"
19+
20+
#include "lardataobj/Simulation/SimEnergyDeposit.h"
21+
22+
#include <memory>
23+
24+
class FilterSimEnergyDeposits;
25+
26+
27+
class FilterSimEnergyDeposits : public art::EDProducer {
28+
public:
29+
explicit FilterSimEnergyDeposits(fhicl::ParameterSet const& p);
30+
// The compiler-generated destructor is fine for non-base
31+
// classes without bare pointers or other resource use.
32+
33+
// Plugins should not be copied or assigned.
34+
FilterSimEnergyDeposits(FilterSimEnergyDeposits const&) = delete;
35+
FilterSimEnergyDeposits(FilterSimEnergyDeposits&&) = delete;
36+
FilterSimEnergyDeposits& operator=(FilterSimEnergyDeposits const&) = delete;
37+
FilterSimEnergyDeposits& operator=(FilterSimEnergyDeposits&&) = delete;
38+
// Required functions.
39+
void produce(art::Event& e) override;
40+
41+
private:
42+
43+
// Declare member data here.
44+
45+
art::InputTag fInitSimEnergyDepositLabel;
46+
geo::BoxBoundedGeo fBox;
47+
static constexpr auto kModuleName = "FilterSimEnergyDeposit";
48+
double ShiftX(double z) const;
49+
double fA;
50+
double fB;
51+
double fC;
52+
53+
};
54+
55+
56+
FilterSimEnergyDeposits::FilterSimEnergyDeposits(fhicl::ParameterSet const& p)
57+
: EDProducer{p}
58+
, fInitSimEnergyDepositLabel{p.get<art::InputTag>("InitSimEnergyDepositLabel", "undefined")}
59+
, fBox{p.get<double>("P1_X"), p.get<double>("P2_X"),
60+
p.get<double>("P1_Y"), p.get<double>("P2_Y"),
61+
p.get<double>("P1_Z"), p.get<double>("P2_Z")}
62+
, fA{p.get<double>("A")}
63+
, fB{p.get<double>("B")}
64+
, fC{p.get<double>("C")}
65+
{
66+
// Call appropriate produces<>() functions here.
67+
// Call appropriate consumes<>() for any products to be retrieved by this module.
68+
produces<std::vector<sim::SimEnergyDeposit>>();
69+
}
70+
71+
72+
double FilterSimEnergyDeposits::ShiftX(double z) const
73+
{
74+
//known as a "Hill equation" from fitting distribution of angle corrected tracks looking at the deflection as it gets closer to z = 0
75+
double a = fA;
76+
double b = fB;
77+
double c = fC;
78+
double num = a*std::pow(z, b);
79+
double denom = c + std::pow(z, b);
80+
return num/denom;
81+
}
82+
83+
void FilterSimEnergyDeposits::produce(art::Event& e)
84+
{
85+
auto const& simEDeps =
86+
e.getProduct<std::vector<sim::SimEnergyDeposit>>(fInitSimEnergyDepositLabel);
87+
auto pSimEDeps = std::make_unique<std::vector<sim::SimEnergyDeposit>>();
88+
pSimEDeps->reserve(simEDeps.size());
89+
90+
for(auto const& sedep : simEDeps)
91+
{
92+
if(fBox.ContainsPosition(sedep.Start()))
93+
continue;
94+
art::ServiceHandle<geo::Geometry const> geom;
95+
geo::TPCGeo const* TPC = geom->PositionToTPCptr(sedep.MidPoint());
96+
if(!TPC) {
97+
mf::LogVerbatim(kModuleName) << "TPC ID not found! Not performing a shift!";
98+
}
99+
const int numphotons = sedep.NumPhotons();
100+
const int numelectrons = sedep.NumElectrons();
101+
const double syratio = sedep.ScintYieldRatio();
102+
const double energy = sedep.Energy();
103+
geo::Point_t start = sedep.Start();
104+
geo::Point_t end = sedep.End();
105+
if (TPC) {
106+
auto const& wireReadout = art::ServiceHandle<geo::WireReadout const>()->Get();
107+
auto const& referencePlane = wireReadout.FirstPlane(TPC->ID());
108+
referencePlane.DriftPoint(start, ShiftX(std::abs(sedep.Start().Z())));
109+
referencePlane.DriftPoint(end, ShiftX(std::abs(sedep.End().Z())));
110+
}
111+
const double startT = sedep.StartT();
112+
const double endT = sedep.EndT();
113+
const int thisID = sedep.TrackID();
114+
const int thisPDG = sedep.PdgCode();
115+
const int origID = sedep.OrigTrackID();
116+
pSimEDeps->push_back(sim::SimEnergyDeposit(numphotons,
117+
numelectrons,
118+
syratio,
119+
energy,
120+
start,
121+
end,
122+
startT,
123+
endT,
124+
thisID,
125+
thisPDG,
126+
origID));
127+
}
128+
e.put(std::move(pSimEDeps));
129+
}
130+
131+
DEFINE_ART_MODULE(FilterSimEnergyDeposits)

sbncode/DetSim/fcl/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
install_fhicl()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
BEGIN_PROLOG
2+
3+
simedepfilter_ind1gap: {
4+
module_type: "FilterSimEnergyDeposits"
5+
InitSimEnergyDepositLabel: "ionization"
6+
P1_X: -400 #cm, create a box that spans the full x,y range. Not super-precise.
7+
P1_Y: -200 #cm, create a box that spans the full x,y range. Not super-precise.
8+
P1_Z: -2 #cm, one edge of the filtered gap based on the 37 mm total size of the wire gap
9+
P2_X: 400 #cm, create a box that spans the full x,y range. Not super-precise.
10+
P2_Y: 200 #cm, create a box that spans the full x,y range. Not super-precise.
11+
P2_Z: 2 #cm, other edge of the filtered gap based on the 37 mm total size of the wire gap
12+
#From SBN doc-db 38701:
13+
A: -0.431172
14+
B: -2.52724
15+
C: 0.22043
16+
}
17+
18+
19+
END_PROLOG

sbncode/EventGenerator/MeVPrtl/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,9 @@ generators for the Higgs Portal and a HNL decaying to a mu+pi final
33
state.
44

55
Documentation on the event generators for SBN is here:
6+
67
https://sbn-docdb.fnal.gov/cgi-bin/sso/ShowDocument?docid=22100
8+
9+
and here:
10+
11+
https://sbn-docdb.fnal.gov/cgi-bin/sso/ShowDocument?docid=32019.

ups/product_deps

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,13 @@ libdir fq_dir lib
254254
product version qual flags <table_format=2>
255255
genie_xsec v3_04_00 -
256256
larcv2 v2_2_6 -
257-
larsoft v10_01_03 -
257+
larsoft v10_01_04 -
258258
sbnanaobj v09_23_02_01 -
259-
sbndaq_artdaq_core v1_10_03 -
259+
sbndaq_artdaq_core v1_10_04 -
260260
sbndata v01_07 -
261-
sbnobj v10_00_00 -
261+
sbnobj v10_00_01 -
262262
systematicstools v01_04_04 -
263-
nusystematics v1_05_03 -
263+
nusystematics v1_05_04 -
264264
cetmodules v3_24_01 - only_for_build
265265
end_product_list
266266
####################################

0 commit comments

Comments
 (0)