Skip to content

Commit 3414827

Browse files
Cleanup
1 parent 6c4e5b6 commit 3414827

1 file changed

Lines changed: 4 additions & 48 deletions

File tree

sbndcode/TPCPMTBarycenterMatching/TPCPMTBarycenterMatching_module.cc

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ 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 fTPCClusterLabel;
229228
bool fCollectionOnly; ///< Only use TPC spacepoints from the collection plane
230229
double fDistanceCandidateFlashes; ///< Maximum distance between candidate flashes to be considered for matching (cm)
231230
std::vector<double> fCalAreaConst; /// Calibration area constants for wire plane
@@ -235,8 +234,6 @@ class TPCPMTBarycenterMatchProducer : public art::EDProducer {
235234
bool fVerbose; ///< Print extra info
236235
bool fFillMatchTree; ///< Fill an output TTree in the supplemental file
237236
bool fDo3DMatching; ///< Wether to perform the matching in 3D or 2D
238-
double fDistanceWeight;
239-
double fAngleWeight;
240237
std::vector<double> fLightChargeRatioBounds; ///< Vector to store the distance between the barycenter of the charge and the barycenter of the light for each slice
241238
double fXError;
242239
double fYError;
@@ -266,7 +263,6 @@ class TPCPMTBarycenterMatchProducer : public art::EDProducer {
266263
double fFlashCenterZ; ///< Weighted mean Z postion of hit PMTs (cm)
267264
double fFlashWidthY; ///< Weighted standard deviation of Y postion of hit PMTs (cm)
268265
double fFlashWidthZ; ///< Weighted standard deviation of Z postion of hit PMTs (cm)
269-
double fFlashLight;
270266
double fDeltaT; ///< | Matched flash time - charge T0 | when available (us)
271267
double fDeltaY; ///< | Matched flash Y center - charge Y center | (cm)
272268
double fDeltaZ; ///< | Matched flash Z center - charge Z center | (cm)
@@ -275,10 +271,7 @@ class TPCPMTBarycenterMatchProducer : public art::EDProducer {
275271
double fDeltaZ_Trigger; ///< | Triggering flash Z center - charge Z center | (cm)
276272
double fRadius_Trigger; ///< Hypotenuse of DeltaY_Trigger and DeltaZ_Trigger (cm)
277273
double fNuScore; ///< NuScore of the slice, if available, otherwise -9999
278-
double fNumElectrons;
279-
double fLightChargeCosine; ///< Cosine of the angle between the charge PCA and the light PCA
280274
TTree* fMatchTree; ///< Tree to store all match information
281-
TTree* fDebugTree; ///< Tree to store debug information
282275
// Geometry service
283276
geo::WireReadoutGeom const& fWireReadout = art::ServiceHandle<geo::WireReadout>()->Get();
284277
opdet::sbndPDMapAlg fPDSMap;
@@ -303,7 +296,6 @@ TPCPMTBarycenterMatchProducer::TPCPMTBarycenterMatchProducer(fhicl::ParameterSet
303296
// More initializers here.
304297
fOpFlashesModuleLabel(p.get<std::vector<std::string>>("OpFlashesModuleLabel")),
305298
fPandoraLabel(p.get<std::string>("PandoraLabel")),
306-
fTPCClusterLabel(p.get<std::string>("TPCClusterLabel")),
307299
fCollectionOnly(p.get<bool>("CollectionOnly", true)),
308300
fDistanceCandidateFlashes(p.get<double>("DistanceCandidateFlashes")), // cm
309301
fCalAreaConst(p.get<std::vector<double>>("CalAreaConst")),
@@ -312,8 +304,6 @@ TPCPMTBarycenterMatchProducer::TPCPMTBarycenterMatchProducer(fhicl::ParameterSet
312304
fVerbose(p.get<bool>("Verbose", false)),
313305
fFillMatchTree(p.get<bool>("FillMatchTree", false)),
314306
fDo3DMatching(p.get<bool>("Do3DMatching",true)),
315-
fDistanceWeight(p.get<double>("DistanceWeight")),
316-
fAngleWeight(p.get<double>("AngleWeight")),
317307
fLightChargeRatioBounds(p.get<std::vector<double>>("LightChargeRatioBounds")),
318308
fXError(p.get<double>("XError")), // cm
319309
fYError(p.get<double>("YError")), // cm
@@ -333,27 +323,7 @@ TPCPMTBarycenterMatchProducer::TPCPMTBarycenterMatchProducer(fhicl::ParameterSet
333323
<< "Module has been missconfigured. Number of OpFlashesModuleLabel must be 2!";
334324
}
335325

336-
art::ServiceHandle<art::TFileService> tfs;
337-
fDebugTree = tfs->make<TTree>("debugTree","TPC Slice - OpFlash Matching Debug");
338-
//Event Info
339-
fDebugTree->Branch("run", &fRun, "run/I" );
340-
fDebugTree->Branch("event", &fEvent, "event/I" );
341-
fDebugTree->Branch("cryo", &fTPC, "cryo/I" );
342-
fDebugTree->Branch("sliceNum", &fSliceNum, "sliceNum/I" );
343-
344-
fDebugTree->Branch("sliceX", &fChargeCenterX, "sliceX/d");
345-
fDebugTree->Branch("sliceY", &fChargeCenterY, "sliceY/d");
346-
fDebugTree->Branch("sliceZ", &fChargeCenterZ, "sliceZ/d");
347-
fDebugTree->Branch("sliceCharge", &fChargeTotal, "sliceCharge/d");
348-
fDebugTree->Branch("sliceElectrons", &fNumElectrons, "fNumElectrons/d" );
349-
fDebugTree->Branch("sliceNuScore", &fNuScore, "sliceNuScore/d");
350-
351-
fDebugTree->Branch("flashTime", &fFlashTimeDebug, "flashTime/d" );
352-
fDebugTree->Branch("flashPEs", &fFlashPEs, "flashPEs/d" );
353-
fDebugTree->Branch("flashLight", &fFlashLight, "flashLight/d" );
354-
fDebugTree->Branch("LightChargeCosine", &fLightChargeCosine, "LightChargeCosine/d" );
355-
356-
326+
art::ServiceHandle<art::TFileService> tfs;
357327
if ( fFillMatchTree ) {
358328
art::ServiceHandle<art::TFileService> tfs;
359329
fMatchTree = tfs->make<TTree>("matchTree","TPC Slice - OpFlash Matching Analysis");
@@ -481,7 +451,7 @@ void TPCPMTBarycenterMatchProducer::produce(art::Event& e)
481451
art::FindManyP<recob::Hit> fmHitsPFPs(pfpHandle, e, fPandoraLabel);
482452
art::FindManyP<recob::Cluster> fmClusterPfp(pfpHandle, e, fPandoraLabel);
483453
::art::Handle<std::vector<recob::Cluster>> clusterHandle;
484-
e.getByLabel(fTPCClusterLabel, clusterHandle);
454+
e.getByLabel(fPandoraLabel, clusterHandle);
485455
art::FindManyP<recob::Hit> cluster_hit_assns (clusterHandle, e, fPandoraLabel);
486456

487457

@@ -605,11 +575,8 @@ void TPCPMTBarycenterMatchProducer::produce(art::Event& e)
605575

606576
//Get the charge of the slice
607577
double sliceCharge = this->GetSliceCharge(tpcHitsVec, det_prop, tpc);
608-
fNumElectrons = sliceCharge;
609-
//if(fNuScore>0.55) std::cout << " Event is " << fEvent << " Slice " << j << " in TPC " << tpc << " has barycenter at (" << fChargeCenterX << ", " << fChargeCenterY << ", " << fChargeCenterZ << ")" << " having used plane " << maxChargePlaneIdx << std::endl;
610578
//Get the visibility map of the charge barycenter
611579
geo::Point_t SliceXYZ = {fChargeCenterX, fChargeCenterY, fChargeCenterZ};
612-
std::cout << " Event " << fEvent<< " slice number " << j << " at tpc " << tpc << " with barycenter at (" << fChargeCenterX << ", " << fChargeCenterY << ", " << fChargeCenterZ << ")" << " with nuscore " << fNuScore << std::endl;
613580
std::vector<double> direct_visibility;
614581
std::vector<double> reflect_visibility;
615582
_semi_model->detectedDirectVisibilities(direct_visibility, SliceXYZ);
@@ -673,7 +640,6 @@ void TPCPMTBarycenterMatchProducer::produce(art::Event& e)
673640
for(size_t i=0; i<candidateFlashIdxs.size(); i++)
674641
{
675642
fFlashTimeDebug=-99999;
676-
fLightChargeCosine = -99999.;
677643
int idx = candidateFlashIdxs[i];
678644
auto & flash = flashVect[idx];
679645
double _currentFlashX = flash->XCenter();
@@ -686,19 +652,13 @@ void TPCPMTBarycenterMatchProducer::produce(art::Event& e)
686652
std::vector<double> ophit_weight;
687653
CreateOpHitList(ophitlist, ophit_z, ophit_y, ophit_weight);
688654

689-
//std::cout << " Light PCA result for flash with idx " << idx << " with distance " << candidateFlashDistances[i] << std::endl;
690655
double FlashLight = this->GetFlashLight(flash->TotalPE(), direct_visibility, reflect_visibility);
691-
fFlashLight = FlashLight;
692-
693656
fFlashTimeDebug = flash->Time();
694657
double lightChargeRatio = (FlashLight/sliceCharge);
695658
std::vector<double> LightPCA = {0.,0.};
696659
GetPCA(ophit_z, ophit_y, ophit_weight, LightPCA);
697-
fLightChargeCosine = abs( ChargePCA[0]*LightPCA[0] + ChargePCA[1]*LightPCA[1] ) / ( std::hypot(ChargePCA[0], ChargePCA[1]) * std::hypot(LightPCA[0], LightPCA[1]) );
698-
double angle = std::acos(fLightChargeCosine)*(180/M_PI);
699-
//double normalized_angle = angle/90.0;
700-
//double normalized_distance = chargeLightDistance[idx]/fDistanceCandidateFlashes;
701-
//double separation = fDistanceWeight*normalized_distance + fAngleWeight*normalized_angle;
660+
double LightChargeCosine = abs( ChargePCA[0]*LightPCA[0] + ChargePCA[1]*LightPCA[1] ) / ( std::hypot(ChargePCA[0], ChargePCA[1]) * std::hypot(LightPCA[0], LightPCA[1]) );
661+
double angle = std::acos(LightChargeCosine)*(180/M_PI);
702662
double chi2;
703663
if(fDo3DMatching) chi2 = std::pow(fChargeCenterX-_currentFlashX, 2)/std::pow(fXError, 2) + std::pow(fChargeCenterY-_currentFlashY, 2)/std::pow(fYError, 2) + std::pow(fChargeCenterZ-_currentFlashZ, 2)/std::pow(fZError, 2) + std::pow(angle, 2)/std::pow(fAngleError, 2);
704664
else
@@ -720,8 +680,6 @@ void TPCPMTBarycenterMatchProducer::produce(art::Event& e)
720680
minChi2 = chi2;
721681
matchIndex = idx;
722682
}
723-
fDebugTree->Fill();
724-
//double separation = fDistanceWeight*distance + fAngleWeight*angle;
725683
}
726684

727685
//std::cout << " Chosen flash is " << matchIndex << std::endl;
@@ -785,15 +743,13 @@ void TPCPMTBarycenterMatchProducer::InitializeSlice() {
785743
fFlashCenterZ = -9999.;
786744
fFlashWidthY = -9999.;
787745
fFlashWidthZ = -9999.;
788-
fFlashLight = -9999.;
789746
fDeltaT = -9999.;
790747
fDeltaY = -9999.;
791748
fDeltaZ = -9999.;
792749
fRadius = -9999.;
793750
fDeltaZ_Trigger = -9999.;
794751
fDeltaY_Trigger = -9999.;
795752
fRadius_Trigger = -9999.;
796-
fNumElectrons = -9999.;
797753
} //End InitializeSlice()
798754

799755

0 commit comments

Comments
 (0)