Skip to content

Commit 74ed205

Browse files
Merge branch 'develop' into feature/hlay_crt_calibration_database_interface
2 parents f2755ba + 417030d commit 74ed205

10 files changed

Lines changed: 61 additions & 21 deletions

File tree

sbndcode/BlipRecoSBND/Alg/BlipRecoAlg.cc

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

360-
// -- SimEnergyDeposits
361-
art::Handle<std::vector<sim::SimEnergyDeposit> > sedHandle;
362-
std::vector<art::Ptr<sim::SimEnergyDeposit> > 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+
// }
367366
// -- SimChannels (usually dropped in reco)
368367
art::Handle<std::vector<sim::SimChannel> > simchanHandle;
369368
std::vector<art::Ptr<sim::SimChannel> > simchanlist;
370-
if (evt.getByLabel(fSimChanProducer,simchanHandle))
369+
if (evt.getByLabel(fSimChanProducer,simchanHandle))
370+
{
371371
art::fill_ptr_vector(simchanlist, simchanHandle);
372+
//Loop over channels to get full sedlist
373+
for(int chIndex=0; chIndex<int(simchanlist.size()); chIndex++)
374+
{
375+
std::vector<geo::WireID> wids = wireReadoutGeom->Get().ChannelToWire( (*(simchanlist[chIndex])).Channel() ); //Not sure why this is a vector, but it should have len 1
376+
const geo::PlaneID& planeID = wids[0].planeID();
377+
if(int(planeID.Plane) != fCaloPlane) continue; //only take calorimetry plane IDE values
378+
std::vector< sim::IDE > TempChIDE = (*simchanlist[chIndex]).TrackIDsAndEnergies(0, 999999999);
379+
for(int ideIndex=0; ideIndex<int(TempChIDE.size()); ideIndex++)
380+
{
381+
//art::fill_ptr_vector(sedlist, simchanHandle.TrackIDsAndEnergies(0, 99999999));
382+
sedlist.push_back( TempChIDE[ideIndex] ); //may need to add a &
383+
}
384+
}
385+
}
372386

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

sbndcode/BlipRecoSBND/Alg/BlipRecoAlg.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "lardataobj/AnalysisBase/BackTrackerMatchingData.h"
3737
#include "larsim/MCCheater/ParticleInventoryService.h"
3838
#include "larcore/Geometry/Geometry.h"
39+
#include "larcorealg/Geometry/WireReadoutGeom.h"
3940
#include "larcorealg/Geometry/GeometryCore.h"
4041
#include "larreco/Calorimetry/CalorimetryAlg.h"
4142
#include "art/Framework/Principal/Event.h"
@@ -117,6 +118,7 @@ namespace blip {
117118
float kDriftVelocity;
118119
float kTickPeriod;
119120
int kNumChannels;
121+
int fCaloPlane;
120122

121123
private:
122124

@@ -172,7 +174,7 @@ namespace blip {
172174
bool fKeepAllClusts[kNplanes];
173175

174176
// --- Calorimetry configs ---
175-
int fCaloPlane;
177+
//int fCaloPlane;
176178
float fCalodEdx;
177179
float fESTAR_p0;
178180
float fESTAR_p1;

sbndcode/BlipRecoSBND/BlipRecoProducer_module.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ BlipRecoProducer::BlipRecoProducer(fhicl::ParameterSet const & pset)
8888
produces< std::vector< recob::SpacePoint > >();
8989
produces< art::Assns < recob::Hit, recob::SpacePoint> >();
9090
produces< std::vector< blip::Blip > >();
91+
produces< std::vector<blip::HitClust> >();
9192

9293
//produces< art::Assns < blip::Blip, recob::SpacePoint > >();
9394
produces< art::Assns < blip::Blip, recob::Hit> >();
@@ -124,6 +125,7 @@ void BlipRecoProducer::produce(art::Event & evt)
124125
std::unique_ptr< art::Assns <blip::Blip, recob::Hit> > assn_blip_hit_v(std::make_unique<art::Assns<blip::Blip, recob::Hit> >() );
125126
std::unique_ptr< std::vector< recob::SpacePoint> > SpacePoint_v(std::make_unique<std::vector<recob::SpacePoint>>());
126127
std::unique_ptr< art::Assns <recob::Hit, recob::SpacePoint> > assn_hit_sps_v(std::make_unique<art::Assns<recob::Hit,recob::SpacePoint>>() );
128+
std::unique_ptr< std::vector< blip::HitClust> > collection_hitclust(std::make_unique<std::vector<blip::HitClust>>());
127129

128130

129131
art::PtrMaker<blip::Blip> makeBlipPtr(evt);
@@ -180,6 +182,12 @@ void BlipRecoProducer::produce(art::Event & evt)
180182
}
181183

182184
}
185+
//adding all the collection hit clusters
186+
for(int iclust=0; iclust<int(fBlipAlg->hitclust.size()); iclust++)
187+
{
188+
if( (fBlipAlg->hitclust)[iclust].Plane != fBlipAlg->fCaloPlane) continue;
189+
collection_hitclust->push_back((fBlipAlg->hitclust)[iclust]);
190+
}
183191

184192
//===========================================
185193
// Put them on the event
@@ -189,6 +197,7 @@ void BlipRecoProducer::produce(art::Event & evt)
189197
evt.put(std::move(blip_v));
190198
//evt.put(std::move(assn_blip_sps_v));
191199
evt.put(std::move(assn_blip_hit_v));
200+
evt.put(std::move(collection_hitclust));
192201
}//END EVENT LOOP
193202

194203
DEFINE_ART_MODULE(BlipRecoProducer)

sbndcode/BlipRecoSBND/Utils/BlipUtils.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,11 @@ 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-
7069
return;
7170

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

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

9190
// If this is an electron that came from another electron, it would
9291
// have already been grouped as part of the contiguous "blip" previously.
@@ -139,7 +138,7 @@ namespace BlipUtils {
139138
simb::MCParticle& part = pinfo.particle;
140139

141140
// Skip neutrons, photons
142-
if( part.PdgCode() == 2112 || part.PdgCode() == 22 ) return;
141+
// if( part.PdgCode() == 2112 || part.PdgCode() == 22 ) return;
143142

144143
// Check that path length isn't zero
145144
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::SimEnergyDeposit>> 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/Utils/classes_def.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<class name="blip::Blip"/>
44
<class name="std::vector<blip::Blip>"/>
55
<class name="blip::HitClust"/>
6+
<class name="std::vector<blip::HitClust>"/>
7+
<class name="art::Wrapper<std::vector<blip::HitClust> >"/>
68
<class name="blip::TrueBlip"/>
79
<class name="std::map<int,TVector3>"/>
810
<class name="art::Assns<blip::Blip,recob::Hit,void>"/>

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: "blipPandoraTrackCopy" #// 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

sbndcode/LightPropagationCorrection/LightPropagationCorrection_module.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ void sbnd::LightPropagationCorrection::produce(art::Event & e)
201201
e.getByLabel(fSPECTDCLabel, tdcHandle);
202202
if (!tdcHandle.isValid() || tdcHandle->size() == 0){
203203
std::cout << "No SPECTDC products found. Skip this event." << std::endl;
204-
return;
204+
ResetSliceInfo();
205+
continue;
205206
}
206207
else{
207208
const std::vector<sbnd::timing::DAQTimestamp> tdc_v(*tdcHandle);

sbndcode/OpDetReco/OpDeconvolution/job/run_decohitfinder_data.fcl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "opdeconvolution_sbnd_data.fcl"
77
#include "sbnd_flashfinder_deco_data.fcl"
88
#include "sbnd_ophitfinder_deco_data.fcl"
9+
#include "wfalign_sbnd_data.fcl"
910

1011
process_name: DecoRecoData
1112

@@ -41,13 +42,15 @@ physics:
4142
{
4243
producers:
4344
{
45+
wfalign: @local::wfalign_data
4446
opdecopmt: @local::SBNDOpDeconvolutionPMT_data
4547
ophitpmt: @local::SBNDDecoOpHitFinderPMT_data
4648
opflashtpc0: @local::SBNDDecoSimpleFlashTPC0_data
4749
opflashtpc1: @local::SBNDDecoSimpleFlashTPC1_data
4850
}
4951

5052
reco: [
53+
wfalign,
5154
opdecopmt,
5255
ophitpmt,
5356
opflashtpc0,

sbndcode/Timing/FrameShift/FrameShift_module.cc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,11 +661,21 @@ void sbnd::FrameShift::produce(art::Event& e)
661661
// + Data: t = 0 = abitrary. All subsystem electronics time is reference to the last PPS
662662

663663
if(_isBeam){
664-
_frame_tdc_rwm += fShiftRWM2Gate; //
665-
_frame_apply_at_caf = _frame_tdc_rwm; // +frame_data2mc
664+
if (_frame_tdc_rwm != 0){
665+
_frame_tdc_rwm += fShiftRWM2Gate; //align RWM signal to gate opening frame
666+
_frame_apply_at_caf = _frame_tdc_rwm; // +frame_data2mc
667+
}else if(_frame_hlt_gate != 0){
668+
_frame_apply_at_caf = _frame_hlt_gate; //+frame_data2mc
669+
}else{
670+
_frame_apply_at_caf = 0;
671+
}
666672
}
667673
else if(_isOffbeam){
668-
_frame_apply_at_caf = _frame_hlt_gate; //+frame_data2mc
674+
if(_frame_hlt_gate != 0){
675+
_frame_apply_at_caf = _frame_hlt_gate; //+frame_data2mc
676+
}else{
677+
_frame_apply_at_caf = 0;
678+
}
669679
}
670680
else if(_isXmuon){
671681
_frame_apply_at_caf = 0;

0 commit comments

Comments
 (0)