Skip to content

Commit 3ec91ec

Browse files
author
Jacob McLaughlin
committed
initial draft of simIDE interface
1 parent f0611b9 commit 3ec91ec

4 files changed

Lines changed: 33 additions & 16 deletions

File tree

sbndcode/BlipRecoSBND/Alg/BlipRecoAlg.cc

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -357,18 +357,31 @@ namespace blip {
357357
if (evt.getByLabel(fGeantProducer,pHandle))
358358
art::fill_ptr_vector(plist, pHandle);
359359

360-
// -- SimEnergyDeposits
361-
art::Handle<std::vector<sim::IDE> > sedHandle;
362-
std::vector<art::Ptr<sim::IDE> > sedlist;
363-
if (evt.getByLabel(fSimDepProducer,sedHandle)){
364-
art::fill_ptr_vector(sedlist, sedHandle);
365-
}
366-
360+
// -- SimEnergyDeposits (usually dropped in reco
361+
//art::Handle<std::vector<sim::EnergyDeposit> > sedHandle;
362+
std::vector<sim::IDE > sedlist;
363+
//if (evt.getByLabel(fSimDepProducer,sedHandle)){
364+
// art::fill_ptr_vector(sedlist, sedHandle);
365+
// }
366+
std::cout << " \n\n\n\n\n\n\n\n\n Look here \n\n\n\n\n " << std::endl;
367367
// -- SimChannels (usually dropped in reco)
368368
art::Handle<std::vector<sim::SimChannel> > simchanHandle;
369369
std::vector<art::Ptr<sim::SimChannel> > simchanlist;
370-
if (evt.getByLabel(fSimChanProducer,simchanHandle))
370+
std::cout << fSimChanProducer << " Look at my sim channel handle here " <<std::endl;
371+
if (evt.getByLabel(fSimChanProducer,simchanHandle))
372+
{
371373
art::fill_ptr_vector(simchanlist, simchanHandle);
374+
//Loop over channels to get full sedlist
375+
for(int chIndex=0; chIndex<int(simchanlist.size()); chIndex++)
376+
{
377+
std::vector< sim::IDE > TempChIDE = (*simchanlist[chIndex]).TrackIDsAndEnergies(0, 999999999);
378+
for(int ideIndex=0; ideIndex<int(TempChIDE.size()); ideIndex++)
379+
{
380+
//art::fill_ptr_vector(sedlist, simchanHandle.TrackIDsAndEnergies(0, 99999999));
381+
sedlist.push_back( TempChIDE[ideIndex] ); //may need to add a &
382+
}
383+
}
384+
}
372385

373386
// -- hits (from input module, usually track-masked subset of gaushit)
374387
art::Handle< std::vector<recob::Hit> > hitHandle;

sbndcode/BlipRecoSBND/Utils/BlipUtils.cc

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ namespace BlipUtils {
6161
pinfo.depEnergy = 0;
6262
pinfo.depElectrons = 0;
6363
for(auto& sed : sedvec ) {
64-
if( sed->trackID == part.TrackId() ) {
65-
pinfo.depEnergy += sed->energy;
66-
pinfo.depElectrons += sed->numElectrons;
64+
if( -1*sed.trackID == part.TrackId() || sed.trackID == part.TrackId() ) {
65+
pinfo.depEnergy += sed.energy;
66+
pinfo.depElectrons += sed.numElectrons;
6767
}
6868
}
69-
69+
std::cout << pinfo.depEnergy << " " << pinfo.trackId << std::endl;
7070
return;
7171

7272
}
@@ -86,7 +86,7 @@ namespace BlipUtils {
8686
//std::cout<<"Making true blip for "<<part.TrackId()<<" (PDG "<<part.PdgCode()<<", which deposited "<<pinfo[i].depEnergy<<"\n";
8787

8888
// If this is a photon or neutron, don't even bother!
89-
if( part.PdgCode() == 2112 || part.PdgCode() == 22 ) continue;
89+
//if( part.PdgCode() == 2112 || part.PdgCode() == 22 ) continue;
9090

9191
// If this is an electron that came from another electron, it would
9292
// have already been grouped as part of the contiguous "blip" previously.
@@ -95,7 +95,9 @@ namespace BlipUtils {
9595

9696
// Create the new blip
9797
blip::TrueBlip tb;
98+
std::cout << " making a new blip " << std::endl;
9899
GrowTrueBlip(pinfo[i],tb);
100+
std::cout << tb.Energy << std::endl;
99101
if( !tb.Energy ) continue;
100102

101103
// We want to loop through any contiguous electrons (produced
@@ -112,6 +114,7 @@ namespace BlipUtils {
112114

113115
// Final check -- ensure there was non-negligible number
114116
// of deposted ionization electrons
117+
std::cout << tb.DepElectrons << " total electrons " << std::endl;
115118
if( tb.DepElectrons < 20 ) continue;
116119

117120
// Calculate TPC-specific quantities
@@ -126,6 +129,7 @@ namespace BlipUtils {
126129
tb.DriftTime = tick_calc*clockData.TPCClock().TickPeriod() + clockData.TriggerOffsetTPC();
127130

128131
tb.ID = trueblips.size();
132+
std::cout << "going to push this into holder " << std::endl;
129133
trueblips.push_back(tb);
130134

131135
}
@@ -139,7 +143,7 @@ namespace BlipUtils {
139143
simb::MCParticle& part = pinfo.particle;
140144

141145
// Skip neutrons, photons
142-
if( part.PdgCode() == 2112 || part.PdgCode() == 22 ) return;
146+
// if( part.PdgCode() == 2112 || part.PdgCode() == 22 ) return;
143147

144148
// Check that path length isn't zero
145149
if( !pinfo.pathLength ) return;

sbndcode/BlipRecoSBND/Utils/BlipUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include "TH1D.h"
3939

4040

41-
typedef std::vector<art::Ptr<sim::IDE>> SEDVec_t;
41+
typedef std::vector<sim::IDE> SEDVec_t;
4242

4343
geo::View_t kViews[3]={geo::kU, geo::kV, geo::kW};
4444

sbndcode/BlipRecoSBND/blipreco_configs.fcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ sbnd_blipalg:
99
TrkProducer: "pandoraTrack" #// input recob::Tracks to use for blip reconstruction
1010
GeantProducer: "largeant" #// input sim::MCParticles (getting true particle info)
1111
SimEDepProducer: "ionandscint" #// input sim::SimEnergyDeposits (getting energy/electrons deposited)
12-
SimChanProducer: "simdrift" #// label for sim::SimChannels (getting drifted charge; optional)
12+
SimChanProducer: "simtpc2d:simpleSC:DetSim" #// label for sim::SimChannels (getting drifted charge; optional)
1313
MaxHitTrkLength: 5.0 #// hits in trks > this length will be vetoed [cm]
1414
DoHitFiltering: false #// filter hits based on amp, width, RMS
1515
HitClustWireRange: 1 #// clustering wire width

0 commit comments

Comments
 (0)