Skip to content

Commit 9c69a9a

Browse files
Merge pull request #834 from SBNSoftware/feature/acastill_lightpropagationfixes
Feature/acastill lightpropagationfixes
2 parents 2e61dc5 + c0f39c1 commit 9c69a9a

File tree

2 files changed

+20
-29
lines changed

2 files changed

+20
-29
lines changed

sbndcode/LightPropagationCorrection/LightPropagationCorrectionAna_module.cc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ class LightPropagationCorrectionAna : public art::EDAnalyzer {
5353
TTree* fTree; ///< The TTree for storing event information
5454

5555
double fOpFlashT0;
56-
double fUpstreamTime_lightonly;
57-
double fUpstreamTime_tpczcorr;
58-
double fUpstreamTime_propcorr_tpczcorr;
56+
double fNuToFLight;
57+
double fNuToFCharge;
58+
double fOpFlashT0Corrected;
5959

6060
unsigned int _eventID;
6161
unsigned int _runID;
@@ -73,9 +73,9 @@ LightPropagationCorrectionAna::LightPropagationCorrectionAna(fhicl::ParameterSet
7373
void LightPropagationCorrectionAna::analyze(art::Event const& e)
7474
{
7575
fOpFlashT0=-99999.;
76-
fUpstreamTime_lightonly=-99999.;
77-
fUpstreamTime_tpczcorr=-99999.;
78-
fUpstreamTime_propcorr_tpczcorr=-99999.;
76+
fNuToFLight=-99999.;
77+
fNuToFCharge=-99999.;
78+
fOpFlashT0Corrected=-99999.;
7979

8080
_eventID = -1;
8181
_runID = -1;
@@ -118,14 +118,14 @@ void LightPropagationCorrectionAna::analyze(art::Event const& e)
118118

119119
std::cout << " Corrected flash time is " << correctedopflash->OpFlashT0 << std::endl;
120120
std::cout << " Associated with slice id " << slice_v[0]->ID() << std::endl;
121-
std::cout << "Corrected flash time light only " << correctedopflash->UpstreamTime_lightonly << std::endl;
122-
std::cout << "Corrected flash time tpc z corr " << correctedopflash->UpstreamTime_tpczcorr << std::endl;
123-
std::cout << "Corrected flash time prop corr tpc z corr " << correctedopflash->UpstreamTime_propcorr_tpczcorr << std::endl;
121+
std::cout << "Corrected flash time light only " << correctedopflash->NuToFLight << std::endl;
122+
std::cout << "Corrected flash time tpc z corr " << correctedopflash->NuToFCharge << std::endl;
123+
std::cout << "Corrected flash time prop corr tpc z corr " << correctedopflash->OpFlashT0Corrected << std::endl;
124124

125125
fOpFlashT0 = correctedopflash->OpFlashT0;
126-
fUpstreamTime_lightonly = correctedopflash->UpstreamTime_lightonly;
127-
fUpstreamTime_tpczcorr = correctedopflash->UpstreamTime_tpczcorr;
128-
fUpstreamTime_propcorr_tpczcorr = correctedopflash->UpstreamTime_propcorr_tpczcorr;
126+
fNuToFLight = correctedopflash->NuToFLight;
127+
fNuToFCharge = correctedopflash->NuToFCharge;
128+
fOpFlashT0Corrected = correctedopflash->OpFlashT0Corrected;
129129
fTree->Fill();
130130
}
131131
}
@@ -141,9 +141,9 @@ void LightPropagationCorrectionAna::beginJob()
141141
fTree->Branch("subrunID", &_subrunID, "subrunID/i");
142142

143143
fTree->Branch("fOpFlashT0", &fOpFlashT0, "OpFlashT0/d");
144-
fTree->Branch("fUpstreamTime_lightonly", &fUpstreamTime_lightonly, "UpstreamTime_lightonly/d");
145-
fTree->Branch("fUpstreamTime_tpczcorr", &fUpstreamTime_tpczcorr, "UpstreamTime_tpczcorr/d");
146-
fTree->Branch("fUpstreamTime_propcorr_tpczcorr", &fUpstreamTime_propcorr_tpczcorr, "UpstreamTime_propcorr_tpczcorr/d");
144+
fTree->Branch("fNuToFLight", &fNuToFLight, "NuToFLight/d");
145+
fTree->Branch("fNuToFCharge", &fNuToFCharge, "NuToFCharge/d");
146+
fTree->Branch("fOpFlashT0Corrected", &fOpFlashT0Corrected, "OpFlashT0Corrected/d");
147147

148148
}
149149

sbndcode/LightPropagationCorrection/LightPropagationCorrection_module.cc

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ void sbnd::LightPropagationCorrection::produce(art::Event & e)
7474
fEvent = e.id().event();
7575
fRun = e.id().run();
7676
fSubrun = e.id().subRun();
77+
_flashgeo->InitializeFlashGeoAlgo();
7778

7879
std::unique_ptr< std::vector<sbn::CorrectedOpFlashTiming> > correctedOpFlashTimes (new std::vector<sbn::CorrectedOpFlashTiming>);
7980
art::PtrMaker<sbn::CorrectedOpFlashTiming> make_correctedopflashtime_ptr{e};
@@ -128,9 +129,6 @@ void sbnd::LightPropagationCorrection::produce(art::Event & e)
128129
ResetSliceInfo();
129130
// --- Get the slice
130131
auto & slice = sliceVect[ix];
131-
132-
// --- Get the slice nu score and check whether we want to correct for it
133-
134132
// Now I need to get all the hits associated to this flash and get the timing for all of them
135133
// Get the slices PFPs
136134
double _sliceMaxNuScore = -9999.;
@@ -150,11 +148,7 @@ void sbnd::LightPropagationCorrection::produce(art::Event & e)
150148
fRecoVx= xyz_vertex.X();
151149
fRecoVy= xyz_vertex.Y();
152150
fRecoVz= xyz_vertex.Z();
153-
}
154-
// If correct light propagation time
155-
156-
157-
// Get the SP associated to the PFP and then get the hits associated to the SP. ---> Hits associated to the PFP
151+
}
158152
//Get the spacepoints associated to the PFParticle
159153
std::vector<art::Ptr<recob::SpacePoint>> PFPSpacePointsVect = pfp_sp_assns.at(pfp.key());
160154
//Get the SP Hit assns
@@ -170,7 +164,6 @@ void sbnd::LightPropagationCorrection::produce(art::Event & e)
170164
fSpacePointY.push_back(SP->position().Y());
171165
fSpacePointZ.push_back(SP->position().Z());
172166
fSpacePointIntegral.push_back(SPHit.at(0)->Integral());
173-
174167
//Fill Bayrcenter Position
175168
if(SP->position().X() < 0){
176169
fChargeWeightX[0] += SP->position().X() * SPHit.at(0)->Integral();
@@ -299,11 +292,9 @@ void sbnd::LightPropagationCorrection::produce(art::Event & e)
299292
newFlashTime = flasht0;
300293
sbn::CorrectedOpFlashTiming correctedOpFlashTiming;
301294
correctedOpFlashTiming.OpFlashT0 = originalFlashTime + fEventTriggerTime/1000 - fRWMTime/1000;
302-
correctedOpFlashTiming.UpstreamTime_lightonly = originalFlashTime + fEventTriggerTime/1000 - fRWMTime/1000 - (Zcenter/fSpeedOfLight)/1000;
303-
correctedOpFlashTiming.UpstreamTime_tpczcorr = originalFlashTime + fEventTriggerTime/1000 - fRWMTime/1000 - (fRecoVz/fSpeedOfLight)/1000;
304-
correctedOpFlashTiming.UpstreamTime_propcorr_tpczcorr = newFlashTime + fEventTriggerTime/1000 - fRWMTime/1000 - (fRecoVz/fSpeedOfLight)/1000;
305-
correctedOpFlashTiming.FMScore = _fFMScore;
306-
correctedOpFlashTiming.SliceNuScore = _sliceMaxNuScore;
295+
correctedOpFlashTiming.NuToFLight = (Zcenter/fSpeedOfLight)/1000;
296+
correctedOpFlashTiming.NuToFCharge = (fRecoVz/fSpeedOfLight)/1000;
297+
correctedOpFlashTiming.OpFlashT0Corrected = newFlashTime + fEventTriggerTime/1000 - fRWMTime/1000;
307298
correctedOpFlashTimes->emplace_back(std::move(correctedOpFlashTiming));
308299
}
309300

0 commit comments

Comments
 (0)