Skip to content

Commit

Permalink
Push a lot of updated fcl
Browse files Browse the repository at this point in the history
  • Loading branch information
Temigo committed Jun 13, 2022
1 parent aa577de commit 5f5bf0e
Show file tree
Hide file tree
Showing 23 changed files with 895 additions and 63 deletions.
13 changes: 11 additions & 2 deletions SuperaMCParticleCluster.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ namespace larcv {
grp.type = supera::kNeutron;
result[track_id] = grp;
}
/*

std::cout<<"Track ID " << grp.part.track_id() << " PDG " << grp.part.pdg_code() << " " << grp.part.creation_process()
<<" ... parent Track ID " << grp.part.parent_track_id() << " PDG " << grp.part.parent_pdg_code() << std::endl;
*/

}

// fill parentage information
Expand All @@ -245,6 +245,8 @@ namespace larcv {

LARCV_INFO() << "Processing SimEnergyDeposit array: " << sedep_v.size() << std::endl;
size_t bad_sedep_counter = 0;
size_t bad_sedep_counter2 = 0;
size_t bad_sedep_counter3 = 0;
std::set<size_t> missing_trackid;
for(size_t sedep_idx=0; sedep_idx<sedep_v.size(); ++sedep_idx) {
auto const& sedep = sedep_v.at(sedep_idx);
Expand Down Expand Up @@ -273,6 +275,7 @@ namespace larcv {
pt.dedx = pt.e / sqrt(pow(dx,2)+pow(dy,2)+pow(dz,2));
}
int track_id = abs(sedep.TrackID());
if (track_id == 4 || track_id == 8 || track_id == 9 || track_id == 10) std::cout << "Found " << track_id << std::endl;
if(track_id >= ((int)(trackid2index.size()))) {
bad_sedep_counter++;
missing_trackid.insert(track_id);
Expand Down Expand Up @@ -307,13 +310,15 @@ namespace larcv {
else if(track_id >= (int)(true2reco_v.size()) || true2reco_v[track_id].empty()) {
// translation doesn't exist for this voxel
++bad_sedep_counter;
++bad_sedep_counter2;
}
else {
auto const& true2reco_m = true2reco_v[track_id];
auto true2reco_iter = true2reco_m.find(vox_id);
if(true2reco_iter == true2reco_m.end() || true2reco_iter->second.empty()) {
// translation doesn't exist for this voxel
++bad_sedep_counter;
++bad_sedep_counter3;
}
else{
//ctr_b.insert(vox_id);
Expand Down Expand Up @@ -350,8 +355,11 @@ namespace larcv {
LARCV_WARNING() << bad_sedep_counter << " / " << sedep_v.size() << " SimEnergyDeposits "
<< "(from " << missing_trackid.size() << " particles) did not find corresponding MCParticle!"
<< std::endl;
LARCV_WARNING() << bad_sedep_counter << " " << bad_sedep_counter2 << " " << bad_sedep_counter3 << std::endl;
for (auto trackid : missing_trackid) std::cout << trackid << std::endl;
}
//std::cout<<(mgr.get_data<larcv::EventSparseTensor3D>("masked_true")).size()<<" : "<<ctr_a.size()<<" : "<<ctr_b.size()<<std::endl;

}

void SuperaMCParticleCluster::AnalyzeFirstLastStep(const larcv::Voxel3DMeta& meta,
Expand Down Expand Up @@ -1152,6 +1160,7 @@ namespace larcv {

// Build MCParticle List
auto const& larmcp_v = LArData<supera::LArMCParticle_t>();
std::cout << "larmcp_v size = " << larmcp_v.size() << std::endl;
auto const *ev = GetEvent();
_mcpl.Update(larmcp_v,ev->id().run(),ev->id().event());

Expand Down
1 change: 1 addition & 0 deletions SuperaMCTruth.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ namespace larcv {

for(int i=0; i<mct.NParticles(); ++i) {
auto const& mcp = mct.GetParticle(i);
if(mcp.StatusCode() != 1) std::cout << "bad particle: track id = " << mcp.TrackId() << " PDG = " << mcp.PdgCode() << " StatusCode = " << mcp.StatusCode() << std::endl;
if(mcp.StatusCode() != 1) continue;

auto const& pos = mcp.Position(0);
Expand Down
49 changes: 25 additions & 24 deletions SuperaSpacePoint.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ namespace larcv {
_output_label = cfg.get<std::string>("OutputLabel");
_max_debug_dropping = cfg.get<size_t>("MaxDebugForDropping", 0);
_n_planes = cfg.get<size_t>("NumOfPlanes", 3);
_shift_x = cfg.get<float>("ShiftX", 0.);

auto to_drop = cfg.get<std::vector<std::string>>("DropOutput", {});
_drop_output.insert(to_drop.cbegin(), to_drop.cend());
_store_wire_info = _drop_output.count("hit_*") == 0;

_reco_charge_range = cfg.get<std::vector<double>>("RecoChargeRange", {0,9e99});
_reco_charge_range = cfg.get<std::vector<double>>("RecoChargeRange", {0,9e99});
assert(_reco_charge_range.size() == 2);

// for backward compatibility
Expand Down Expand Up @@ -184,7 +185,7 @@ namespace larcv {
|| (i_pt < 1000 && i_pt % 100 == 0)
|| (i_pt < 10000 && i_pt % 1000 ==0)
|| (i_pt % 10000 == 0)) {
LARCV_INFO() << "Processing " << label << ": "
LARCV_INFO() << "Processing " << label << ": "
<< i_pt << "/" << points.size() << '\n';
}

Expand All @@ -199,8 +200,8 @@ namespace larcv {
}

auto *xyz = pt.XYZ();
VoxelID_t vox_id = meta.id(xyz[0], xyz[1], xyz[2]);
if(vox_id == larcv::kINVALID_VOXELID) {
VoxelID_t vox_id = meta.id(xyz[0] + _shift_x, xyz[1], xyz[2]);
if(vox_id == larcv::kINVALID_VOXELID) {
//if (n_dropped < _max_debug_dropping)
// LARCV_DEBUG() << "Dropping space point ("
std::cout << "Dropping space point ("
Expand All @@ -210,13 +211,13 @@ namespace larcv {
<< std::endl;
++n_dropped;
continue;
}
}


// Find the hits associated with the space point
std::vector<art::Ptr<recob::Hit>> hits;
find_hits.get(i_pt, hits);

v_occupancy.emplace(vox_id, 1, true);

// Check if the voxel the space point falls into already exists.
Expand All @@ -241,12 +242,12 @@ namespace larcv {

if (_store_wire_info) {
if (hits.size() > _n_planes) {
//LARCV_WARNING()
//LARCV_WARNING()
std::cout
<< "Dropping space point - "
<< "Wrong number of hits: "
<< hits.size()
<< " (expecting " << _n_planes << ")"
<< " (expecting " << _n_planes << ")"
<< std::endl;
++n_dropped;
continue;
Expand All @@ -273,39 +274,39 @@ namespace larcv {
//v_hit_tpc [plane].emplace(vox_id, hit->WireID().TPC, !replace);
v_hit_key [plane].emplace(vox_id, hit_id, !replace);
}
//std::cout << "Vector sizes before: " << v_hit_charge[0].size() << " "
// << v_hit_charge[1].size() << " "

//std::cout << "Vector sizes before: " << v_hit_charge[0].size() << " "
// << v_hit_charge[1].size() << " "
// << v_hit_charge[2].size() << std::endl;
if (planes.size() != _n_planes) {
//std::cout << "Sizes: " << planes.size() << " " << _n_planes << std::endl;
for (size_t k = 0; k < _n_planes; k++) {
bool exists = false;
for (size_t plane : planes) {
if ( k == plane ) exists = true;
if ( k == plane ) exists = true;
}
//std::cout << "Exists ? " << k << " " << exists << std::endl;
if ( !exists ) {
//std::cout << "Adding missing plane" << std::endl;
v_hit_charge[k].emplace(vox_id, -1, !replace);
v_hit_amp [k].emplace(vox_id, -1, !replace);
v_hit_time [k].emplace(vox_id, -1, !replace);
v_hit_rms [k].emplace(vox_id, -1, !replace);
v_hit_mult [k].emplace(vox_id, -1, !replace);
//v_hit_cryo [k].emplace(vox_id, -1, !replace);
//v_hit_tpc [k].emplace(vox_id, -1, !replace);
v_hit_key [k].emplace(vox_id, -1, !replace);
v_hit_time [k].emplace(vox_id, -1, !replace);
v_hit_rms [k].emplace(vox_id, -1, !replace);
v_hit_mult [k].emplace(vox_id, -1, !replace);
//v_hit_cryo [k].emplace(vox_id, -1, !replace);
//v_hit_tpc [k].emplace(vox_id, -1, !replace);
v_hit_key [k].emplace(vox_id, -1, !replace);
}
}
}
//std::cout << "Vector sizes after: " << v_hit_charge[0].size() << " "
// << v_hit_charge[1].size() << " "
//std::cout << "Vector sizes after: " << v_hit_charge[0].size() << " "
// << v_hit_charge[1].size() << " "
// << v_hit_charge[2].size() << "\n" << std::endl;
}
}

LARCV_INFO() << n_dropped << " out of " << points.size()
<< " SpacePoints dropped from " << label
LARCV_INFO() << n_dropped << " out of " << points.size()
<< " SpacePoints dropped from " << label
<< std::endl;
}

Expand Down Expand Up @@ -366,7 +367,7 @@ namespace larcv {

return true;
}

void SuperaSpacePoint::finalize()
{}

Expand All @@ -388,7 +389,7 @@ namespace larcv {
idx0 = std::max(start, idx0);
idx1 = std::min(stop + 1, idx1);
}

/* std::cout << "Idx " << idx0 << " -> " << idx1 << std::endl; */

auto integrate = [&](const auto& hit)
Expand Down
3 changes: 2 additions & 1 deletion SuperaSpacePoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace larcv {
std::string _output_label;
size_t _max_debug_dropping = 0; // Max debug message for dropping space points
unsigned short _n_planes = 3;
float _shift_x = 0.;
bool _store_wire_info = false;
std::unordered_set<std::string> _drop_output;
std::vector<double> _reco_charge_range;
Expand All @@ -62,7 +63,7 @@ namespace larcv {
class SuperaSpacePointProcessFactory : public ProcessFactoryBase {
public:
/// ctor
SuperaSpacePointProcessFactory() {
SuperaSpacePointProcessFactory() {
ProcessFactory::get().add_factory("SuperaSpacePoint", this);
}
/// dtor
Expand Down
2 changes: 2 additions & 0 deletions job/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
install_fhicl()
add_subdirectory(stages)
add_subdirectory(data)
126 changes: 126 additions & 0 deletions job/data/icarus_supera_data.fcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#include "services_icarus_simulation.fcl"
#include "detsimmodules_ICARUS.fcl"
#include "stage0_icarus_defs.fcl"
#include "stage1_icarus_defs.fcl"
#include "channelmapping_icarus.fcl"

process_name: SuperaData

services:
{
@table::icarus_detsim_services
@table::icarus_gen_services
IFDH: {}
IICARUSChannelMap: @local::icarus_channelmappinggservice
}

source:
{
module_type: RootInput
}

physics:
{

producers:
{
rns: { module_type: RandomNumberSaver }
# Reco producers
@table::icarus_stage0_producers
@table::icarus_stage1_producers
}
analyzers:
{
superaCryoE: {
module_type: "LArSoftSuperaDriver"
supera_params: "supera_data_cryoE.fcl"
out_filename: "larcv_cryoE.root"
unique_filename: false
stream: "data"
Verbosity: 2
StrictDataLoading: false
}
superaCryoW: {
module_type: "LArSoftSuperaDriver"
supera_params: "supera_data_cryoW.fcl"
out_filename: "larcv_cryoW.root"
unique_filename: false
stream: "data"
Verbosity: 2
StrictDataLoading: false
}
}

simulate: [ rns,
daqTPC,
daqTPCROI,
@sequence::icarus_stage0_multiTPC_TPC, # decon1droi, roifinder
@sequence::icarus_stage0_EastHits_TPC,
@sequence::icarus_stage0_WestHits_TPC,
cluster3DCryoE,
cluster3DCryoW]
analyze: [superaCryoE, superaCryoW]
out_stream: [ out1 ]

trigger_paths: [simulate]
#end_paths: [analyze,out_stream]
end_paths: [analyze]
#end_paths: [out_stream]
}


#
# Cluster3D
#
physics.producers.cluster3DCryoE.Hit3DBuilderAlg.SaveMythicalPoints: true
physics.producers.cluster3DCryoW.Hit3DBuilderAlg.SaveMythicalPoints: true

physics.producers.cluster3DCryoE.Hit3DBuilderAlg.MinPHFor2HitPoints: 0.
physics.producers.cluster3DCryoW.Hit3DBuilderAlg.MinPHFor2HitPoints: 0.

physics.producers.cluster3DCryoE.Hit3DBuilderAlg.OutputHistograms: false
physics.producers.cluster3DCryoW.Hit3DBuilderAlg.OutputHistograms: false

#
# Services
#
services.LArPropertiesService.ScintYield: 0
services.LArPropertiesService.ScintByParticleType: false

outputs:
{
out1:
{
module_type: RootOutput
fileName: "larsoft.root"
dataTier: "reco"
compressionLevel: 1
# skim output (if needed)
#outputCommands: [ "drop *",
# "keep *_mcreco_*_*",
# "keep recob::Hit*_gaushit_*_*"
# ]

# Only uncomment if selecting events with nu in active volume
# SelectEvents: [simulate]
}
}

services.TFileService.fileName: "ana.root"

services.message.destinations :
{
STDCOUT:
{
type: "cout" #tells the message service to output this destination to cout
threshold: "INFO" #tells the message service that this destination applies to WARNING and higher level messages
categories:
{
default:
{
limit: 1000 #don't print anything at the infomsg level except the explicitly named categories
reportEvery: 1
}
}
}
}
Loading

0 comments on commit 5f5bf0e

Please sign in to comment.