Skip to content

Commit 2b44013

Browse files
Add score to the tpcpmt bfm
1 parent 1179fce commit 2b44013

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

sbndcode/TPCPMTBarycenterMatching/TPCPMTBarycenterMatching_module.cc

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ class TPCPMTBarycenterMatchProducer : public art::EDProducer {
225225
std::vector<std::string> fInputTags; ///< Suffix added onto fOpFlashLabel and fPandoraLabel, used by ICARUS for separate cryostat labels but could be empty
226226
std::vector<std::string> fOpFlashesModuleLabel; ///< Label for PMT reconstruction products
227227
std::string fPandoraLabel; ///< Label for Pandora output products
228+
std::string fOpT0Label;
228229
bool fCollectionOnly; ///< Only use TPC spacepoints from the collection plane
229230
double fDistanceCandidateFlashes; ///< Maximum distance between candidate flashes to be considered for matching (cm)
230231
std::vector<double> fCalAreaConst; /// Calibration area constants for wire plane
@@ -266,6 +267,9 @@ class TPCPMTBarycenterMatchProducer : public art::EDProducer {
266267
double fDeltaY; ///< | Matched flash Y center - charge Y center | (cm)
267268
double fDeltaZ; ///< | Matched flash Z center - charge Z center | (cm)
268269
double fRadius; ///< Hypotenuse of DeltaY and DeltaZ *parameter minimized by matching* (cm)
270+
double fChi2; ///< Chi2 to be minimized when matching flash to slice (dimensionless)
271+
double fScore; ///< Score to be maximized when matching flash to slice (dimensionless)
272+
double fAngle; ///< Angle between charge PCA and light PCA (degrees)
269273
double fDeltaY_Trigger; ///< | Triggering flash Y center - charge Y center | (cm)
270274
double fDeltaZ_Trigger; ///< | Triggering flash Z center - charge Z center | (cm)
271275
double fRadius_Trigger; ///< Hypotenuse of DeltaY_Trigger and DeltaZ_Trigger (cm)
@@ -355,9 +359,12 @@ TPCPMTBarycenterMatchProducer::TPCPMTBarycenterMatchProducer(fhicl::ParameterSet
355359
fMatchTree->Branch("deltaY", &fDeltaY, "deltaY/d" );
356360
fMatchTree->Branch("deltaZ", &fDeltaZ, "deltaZ/d" );
357361
fMatchTree->Branch("radius", &fRadius, "radius/d" );
362+
fMatchTree->Branch("angle", &fAngle, "angle/d" );
363+
fMatchTree->Branch("chi2", &fChi2, "chi2/d" );
364+
fMatchTree->Branch("score", &fScore, "score/d" );
358365
fMatchTree->Branch("deltaZ_Trigger", &fDeltaZ_Trigger, "deltaZ_Trigger/d" );
359366
fMatchTree->Branch("deltaY_Trigger", &fDeltaY_Trigger, "deltaY_Trigger/d" );
360-
fMatchTree->Branch("radius_Trigger", &fRadius_Trigger, "dadius_Trigger/d" );
367+
fMatchTree->Branch("radius_Trigger", &fRadius_Trigger, "radius_Trigger/d" );
361368

362369
} //End MatchTree
363370

@@ -450,6 +457,7 @@ void TPCPMTBarycenterMatchProducer::produce(art::Event& e)
450457
// Cluster to Hit assns
451458
art::FindManyP<recob::Hit> cluster_hit_assns (clusterHandle, e, fPandoraLabel);
452459

460+
453461

454462
//For slice...
455463
for ( unsigned j = 0; j < nSlices; j++ ) {
@@ -585,6 +593,11 @@ void TPCPMTBarycenterMatchProducer::produce(art::Event& e)
585593
//For flash...
586594
for ( int m = 0; m < nFlashes; m++ ) {
587595
auto & flash = flashVect[m];
596+
597+
double flashTime = flash->Time();
598+
599+
if(flashTime<fFlashVetoWindow[0] || flashTime>fFlashVetoWindow[1]) continue;
600+
588601
//Find index of flash that minimizes barycenter distance in XYZ place
589602
thisFlashCenterX = flash->XCenter();
590603
thisFlashCenterY = flash->YCenter();
@@ -645,6 +658,7 @@ void TPCPMTBarycenterMatchProducer::produce(art::Event& e)
645658
if(chi2 < minChi2)
646659
{
647660
minChi2 = chi2;
661+
fAngle = angle;
648662
matchIndex = idx;
649663
}
650664
}
@@ -654,6 +668,8 @@ void TPCPMTBarycenterMatchProducer::produce(art::Event& e)
654668
const art::Ptr<recob::OpFlash> flashPtr { flashHandle, unsignedMatchIndex };
655669
//Update match info
656670
updateFlashVars(flashPtr);
671+
fChi2 = minChi2;
672+
fScore = 1./fChi2;
657673
updateMatchInfo(sliceMatchInfo);
658674
sliceMatchInfoVector.push_back(sliceMatchInfo);
659675
art::Ptr<sbn::TPCPMTBarycenterMatch> const infoPtr = makeInfoPtr(matchInfoVector->size());
@@ -710,6 +726,9 @@ void TPCPMTBarycenterMatchProducer::InitializeSlice() {
710726
fDeltaY = -9999.;
711727
fDeltaZ = -9999.;
712728
fRadius = -9999.;
729+
fChi2 = -9999.;
730+
fScore = -99999.;
731+
fAngle = -9999.;
713732
fDeltaZ_Trigger = -9999.;
714733
fDeltaY_Trigger = -9999.;
715734
fRadius_Trigger = -9999.;
@@ -767,6 +786,9 @@ void TPCPMTBarycenterMatchProducer::updateMatchInfo(sbn::TPCPMTBarycenterMatch&
767786
matchInfo.deltaZ = fDeltaZ;
768787
matchInfo.radius = fRadius;
769788
matchInfo.radius_Trigger = fRadius_Trigger;
789+
matchInfo.chi2 = fChi2;
790+
matchInfo.score = fScore;
791+
matchInfo.angle = fAngle;
770792
} //End updateMatchInfo()
771793

772794
void TPCPMTBarycenterMatchProducer::GetPCA(std::vector<double> const&x, std::vector<double> const&y, std::vector<double> const&weight, std::vector<double> & PCA ) {

0 commit comments

Comments
 (0)