Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
18b28ec
first draft of adding blips
Jjm321814 Oct 29, 2025
daa5c8e
Added blip library
Jjm321814 Oct 29, 2025
8dfaab0
forgot to add my blip to the vector
Jjm321814 Oct 29, 2025
23c5909
Adding blips to cafmaker
Jjm321814 Oct 30, 2025
6ec65f7
Merge branch 'develop' into feature/AddingBlipToCAF
Nov 10, 2025
3812b04
added blips to cafmaker
Nov 10, 2025
f830082
Merge branch 'develop' into feature/AddingBlipToCAF
Nov 13, 2025
e4cc10e
mistake in the cmakelist
Nov 13, 2025
0c62419
Updating include
Nov 13, 2025
97b9db8
Fixing comments that aren't tabs
Nov 20, 2025
44e03a4
Fixing indentation
Jjm321814 Nov 20, 2025
a44f4c6
part of general tvector3 replacement
Jjm321814 Nov 29, 2025
b6b0f4f
Missed one cmake list update
Jjm321814 Nov 29, 2025
ddda71a
Adjusting fillBlip to account for removed variables
Jjm321814 Nov 30, 2025
05878a3
change to camelcase
Jjm321814 Nov 30, 2025
3b3e41b
Merge branch 'develop' into feature/AddingBlipToCAF
Dec 1, 2025
fe6e410
Removed old code
Jjm321814 Dec 15, 2025
19f6c92
Aligning fcl param code indentation
Jjm321814 Dec 15, 2025
bd6ecab
Changed for loop per suggestion
Jjm321814 Dec 15, 2025
271cf7b
Assorted updated per PR comments
Jjm321814 Dec 15, 2025
5062c12
Compiler issue
Jjm321814 Dec 15, 2025
221712e
Compiler issue
Jjm321814 Dec 15, 2025
41428d5
Merge branch 'develop' into feature/AddingBlipToCAF
Jan 5, 2026
6521093
Adjusting labels for sbnanaobj updates
Jjm321814 Jan 9, 2026
99c3c0e
Merge branch 'develop' into feature/AddingBlipToCAF
Jjm321814 Feb 10, 2026
f41b6b8
fix typo
Jjm321814 Feb 10, 2026
761904f
Updated blipreco label to blipReco
Jjm321814 Feb 23, 2026
274f91f
:q
Jjm321814 Feb 23, 2026
22cc848
Trying to fix CI issues
Jjm321814 Feb 24, 2026
a509692
Revert "Trying to fix CI issues"
Jjm321814 Feb 24, 2026
ebc6432
Revert "Updated blipreco label to blipReco"
Jjm321814 Mar 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sbncode/CAFMaker/CAFMakerParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,10 @@ namespace caf
Comment("Label of CVN scores."),
"cvn"
};
Atom<std::string> fBlipTag { Name("BlipTag"),
Comment("Provide a string to label the blip input"), "blipreco"
};


};
}
Expand Down
14 changes: 14 additions & 0 deletions sbncode/CAFMaker/CAFMaker_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "sbncode/CAFMaker/FillExposure.h"
#include "sbncode/CAFMaker/FillTrigger.h"
#include "sbncode/CAFMaker/Utils.h"
#include "sbncode/CAFMaker/FillBlip.h"

// C/C++ includes
#include <fenv.h>
Expand Down Expand Up @@ -1916,6 +1917,18 @@ void CAFMaker::produce(art::Event& evt) noexcept {
}
}

//Fill blips. art::handle for blips and then call fill blips for each one. Make a vector to hold all of them. I handle for loop in Fill blip
art::Handle<std::vector<blip::Blip>> blipHandle;
std::vector<caf::SRBlip> srblips;
if(evt.getByLabel( fParams.fBlipTag(), blipHandle)) //fill SR blips
{
FillBlip( (*blipHandle), srblips);
//for(int i=0; i<int(*(blipHandle)->size()); i++)
// {
// auto LarBlips = (*(blipHandle))[i];
// FillBlip( (LarBlips) , srblips);
// }
}
// collect the TPC slices
std::vector<art::Ptr<recob::Slice>> slices;
std::vector<std::string> slice_tag_suffixes;
Expand Down Expand Up @@ -2586,6 +2599,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
rec.sbnd_crt_veto = srsbndcrtveto;
rec.opflashes = srflashes;
rec.nopflashes = srflashes.size();
rec.blips = srblips;
rec.sbnd_frames = srsbndframeshiftinfo;
rec.sbnd_timings = srsbndtiminginfo;

Expand Down
2 changes: 2 additions & 0 deletions sbncode/CAFMaker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ art_make_library( LIBRARY_NAME sbncode_CAFMaker
sbnobj::Common_Trigger
sbnobj::SBND_CRT
sbnobj::SBND_Timing
sbndobj_BlipDataTypes
lardataalg::DetectorInfo
art::Framework_Services_System_TriggerNamesService_service
sbncode_Metadata_MetadataSBN_service
#sbndcode_BlipUtils
larsim::Utils
larevt::SpaceCharge
systematicstools::interface
Expand Down
104 changes: 104 additions & 0 deletions sbncode/CAFMaker/FillBlip.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#include "sbncode/CAFMaker/FillBlip.h"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting in a separate file, FillReco is getting unwieldy.


namespace caf
{
void FillBlip( const std::vector<blip::Blip>& LarBlips, std::vector<caf::SRBlip>& CAF_Blips)
{
int NBlips = LarBlips.size();
for(int iBlip=0; iBlip<NBlips; iBlip++)
{
blip::Blip CurrentBlip = LarBlips[iBlip];
caf::SRBlip NewBlip;
NewBlip.ID = CurrentBlip.ID;
NewBlip.isValid = CurrentBlip.isValid;
NewBlip.Cryostat = CurrentBlip.Cryostat;
NewBlip.TPC = CurrentBlip.TPC;
NewBlip.NPlanes = CurrentBlip.NPlanes;
NewBlip.MaxWireSpan = CurrentBlip.MaxWireSpan;
NewBlip.TimeTick = CurrentBlip.TimeTick;
NewBlip.Time = CurrentBlip.Time;
NewBlip.Charge = CurrentBlip.Charge;
NewBlip.Energy = CurrentBlip.Energy/1000.; //convert to GeV
NewBlip.EnergyESTAR = CurrentBlip.EnergyESTAR/1000.; //convert to GeV
NewBlip.EnergyPSTAR = CurrentBlip.EnergyPSTAR/1000.; //convert to GeV
NewBlip.ProxTrkDist = CurrentBlip.ProxTrkDist;
NewBlip.ProxTrkID = CurrentBlip.ProxTrkID;
NewBlip.inCylinder = CurrentBlip.inCylinder;
NewBlip.Position = CurrentBlip.Position;
NewBlip.SigmaYZ = CurrentBlip.SigmaYZ;
NewBlip.dX = CurrentBlip.dX;
NewBlip.dYZ = CurrentBlip.dYZ;
if(CurrentBlip.truth.ID >= 0 ) //MC Blip
{
FillMCTruthBlip( CurrentBlip, NewBlip );
}
FillBlipRealtedHitCluster( CurrentBlip, NewBlip );
CAF_Blips.push_back(NewBlip);
}

}

void FillMCTruthBlip( blip::Blip& LarBlip, caf::SRBlip &CAF_Blip )
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LarBlip is not modified, so it needs to be declared constant:

Suggested change
void FillMCTruthBlip( blip::Blip& LarBlip, caf::SRBlip &CAF_Blip )
void FillMCTruthBlip( blip::Blip const& LarBlip, caf::SRBlip &CAF_Blip )

Also, since the function is dealing only with LarBlip.truth and CAF_Blip.truthBlip, the arguments should be these two rather than LarBlip and CAF_Blip.
Same argument name comment as above, too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this and hitCluster functions

{
//CAF_Blip.truthBlip = LarBlip.truth;
CAF_Blip.truthBlip.ID = LarBlip.truth.ID;
CAF_Blip.truthBlip.Cryostat =LarBlip.truth.Cryostat;
CAF_Blip.truthBlip.TPC =LarBlip.truth.TPC;
CAF_Blip.truthBlip.Time =LarBlip.truth.Time;
CAF_Blip.truthBlip.TimeTick =LarBlip.truth.TimeTick;
CAF_Blip.truthBlip.DriftTime =LarBlip.truth.DriftTime;
CAF_Blip.truthBlip.Energy =LarBlip.truth.Energy;
CAF_Blip.truthBlip.DepElectrons =LarBlip.truth.DepElectrons;
CAF_Blip.truthBlip.NumElectrons =LarBlip.truth.NumElectrons;
CAF_Blip.truthBlip.LeadG4ID =LarBlip.truth.LeadG4ID;
CAF_Blip.truthBlip.LeadG4Index =LarBlip.truth.LeadG4Index;
CAF_Blip.truthBlip.LeadG4PDG =LarBlip.truth.LeadG4PDG;
CAF_Blip.truthBlip.LeadCharge =LarBlip.truth.LeadCharge;
CAF_Blip.truthBlip.Position =LarBlip.truth.Position;
CAF_Blip.truthBlip.Energy = CAF_Blip.truthBlip.Energy/1000.; //convert to GeV
}

void FillBlipRealtedHitCluster(blip::Blip& LarBlip, caf::SRBlip &CAF_Blip)
{
int NumPlanes = sizeof(LarBlip.clusters)/sizeof(LarBlip.clusters[0]);
for(int iPlane=0; iPlane<NumPlanes; iPlane++)
{
CAF_Blip.clusters[iPlane].ID = LarBlip.clusters[iPlane].ID;
CAF_Blip.clusters[iPlane].isValid = LarBlip.clusters[iPlane].isValid;
CAF_Blip.clusters[iPlane].CenterChan = LarBlip.clusters[iPlane].CenterChan;
CAF_Blip.clusters[iPlane].CenterWire = LarBlip.clusters[iPlane].CenterWire;
CAF_Blip.clusters[iPlane].isTruthMatched = LarBlip.clusters[iPlane].isTruthMatched;
CAF_Blip.clusters[iPlane].isMerged = LarBlip.clusters[iPlane].isMerged;
CAF_Blip.clusters[iPlane].isMatched = LarBlip.clusters[iPlane].isMatched;
CAF_Blip.clusters[iPlane].DeadWireSep = LarBlip.clusters[iPlane].DeadWireSep;
CAF_Blip.clusters[iPlane].Cryostat = LarBlip.clusters[iPlane].Cryostat;
CAF_Blip.clusters[iPlane].TPC = LarBlip.clusters[iPlane].TPC;
CAF_Blip.clusters[iPlane].Plane = LarBlip.clusters[iPlane].Plane;
CAF_Blip.clusters[iPlane].NHits = LarBlip.clusters[iPlane].NHits;
CAF_Blip.clusters[iPlane].NWires = LarBlip.clusters[iPlane].NWires;
CAF_Blip.clusters[iPlane].ADCs = LarBlip.clusters[iPlane].ADCs;
CAF_Blip.clusters[iPlane].Amplitude = LarBlip.clusters[iPlane].Amplitude;
CAF_Blip.clusters[iPlane].Charge = LarBlip.clusters[iPlane].Charge;
CAF_Blip.clusters[iPlane].SigmaCharge = LarBlip.clusters[iPlane].SigmaCharge;
CAF_Blip.clusters[iPlane].TimeTick = LarBlip.clusters[iPlane].TimeTick;
CAF_Blip.clusters[iPlane].Time = LarBlip.clusters[iPlane].Time;
CAF_Blip.clusters[iPlane].StartHitTime = LarBlip.clusters[iPlane].StartHitTime;
CAF_Blip.clusters[iPlane].EndHitTime = LarBlip.clusters[iPlane].EndHitTime;
CAF_Blip.clusters[iPlane].StartTime = LarBlip.clusters[iPlane].StartTime;
CAF_Blip.clusters[iPlane].EndTime = LarBlip.clusters[iPlane].EndTime;
CAF_Blip.clusters[iPlane].Timespan = LarBlip.clusters[iPlane].Timespan;
CAF_Blip.clusters[iPlane].RMS = LarBlip.clusters[iPlane].RMS;
CAF_Blip.clusters[iPlane].StartWire = LarBlip.clusters[iPlane].StartWire;
CAF_Blip.clusters[iPlane].EndWire = LarBlip.clusters[iPlane].EndWire;
CAF_Blip.clusters[iPlane].NPulseTrainHits = LarBlip.clusters[iPlane].NPulseTrainHits;
CAF_Blip.clusters[iPlane].GoodnessOfFit = LarBlip.clusters[iPlane].GoodnessOfFit;
CAF_Blip.clusters[iPlane].BlipID = LarBlip.clusters[iPlane].BlipID;
CAF_Blip.clusters[iPlane].EdepID = LarBlip.clusters[iPlane].EdepID;
//These are sets that need to become vectors so we need to do some loops
for(auto HitID : LarBlip.clusters[iPlane].HitIDs) CAF_Blip.clusters[iPlane].HitIDs.push_back(HitID);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend to use the appropriate std::vector member function, assign():

Suggested change
//These are sets that need to become vectors so we need to do some loops
for(auto HitID : LarBlip.clusters[iPlane].HitIDs) CAF_Blip.clusters[iPlane].HitIDs.push_back(HitID);
// These are sets that need to become vectors
CAF_Blip.clusters[iPlane].HitIDs.assign(begin(LarBlip.clusters[iPlane].HitIDs), end(LarBlip.clusters[iPlane].HitIDs));

If this function is changed as recommended above to work on a single cluster, this becomes less wordy and more readable:

Suggested change
//These are sets that need to become vectors so we need to do some loops
for(auto HitID : LarBlip.clusters[iPlane].HitIDs) CAF_Blip.clusters[iPlane].HitIDs.push_back(HitID);
// These are sets that need to become vectors
CAFcluster.HitIDs.assign(begin(LArCluster.HitIDs), end(LArCluster.HitIDs));

same for the next three lines; in fact, you could even write a specific function and use it repeatedly:

Suggested change
//These are sets that need to become vectors so we need to do some loops
for(auto HitID : LarBlip.clusters[iPlane].HitIDs) CAF_Blip.clusters[iPlane].HitIDs.push_back(HitID);
// These are sets that need to become vectors
auto copyToVector = [](auto& dest, auto const& src)
{ dest.assign(begin(src), end(src)); };
copyToVector(CAF_Blip.clusters[iPlane].HitIDs, LarBlip.clusters[iPlane].HitIDs);

etc.

for(auto Wire : LarBlip.clusters[iPlane].Wires) CAF_Blip.clusters[iPlane].Wires.push_back(Wire);
for(auto Chan : LarBlip.clusters[iPlane].Chans) CAF_Blip.clusters[iPlane].Chans.push_back(Chan);
for(auto G4ID : LarBlip.clusters[iPlane].G4IDs) CAF_Blip.clusters[iPlane].G4IDs.push_back(G4ID);
}
}
}
17 changes: 17 additions & 0 deletions sbncode/CAFMaker/FillBlip.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef CAF_FILLBLIP_H
#define CAF_FILLBLIP_H
#include<iostream>
#include "sbnanaobj/StandardRecord/SRBlip.h"
#include "sbnobj/SBND/Blip/BlipDataTypes.h"

#include <vector>

namespace caf
{

void FillBlip( const std::vector<blip::Blip>& LarBlips, std::vector<caf::SRBlip>& CAF_Blips);
void FillMCTruthBlip(blip::Blip& LarBlip, caf::SRBlip& CAF_Blip );
void FillBlipRealtedHitCluster(blip::Blip& LarBlip, caf::SRBlip& CAF_Blip);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In both these functions one of the operands (the first one, I'd wage) must be declared const.
Also, it seems that the only function needed externally (by CAFMaker module) is the first one; the other two do not need to be publicly visible in the header, and their declaration can be either omitted or moved out of the header into the implementation (.cxx) file.

}

#endif