diff --git a/sbndcode/JobConfigurations/standard/caf/cafmakerjob_sbnd_data_sce.fcl b/sbndcode/JobConfigurations/standard/caf/cafmakerjob_sbnd_data_sce.fcl index 552c9b465..3cee0d077 100644 --- a/sbndcode/JobConfigurations/standard/caf/cafmakerjob_sbnd_data_sce.fcl +++ b/sbndcode/JobConfigurations/standard/caf/cafmakerjob_sbnd_data_sce.fcl @@ -15,6 +15,7 @@ physics.producers.cafmaker.OpT0Label: "opt0finderSCE" physics.producers.cafmaker.TPCPMTBarycenterMatchLabel: "tpcpmtbarycentermatchingSCE" physics.producers.cafmaker.CVNLabel: "cvnSCE" physics.producers.cafmaker.LightCaloLabel: "lightcaloSCE" +physics.producers.cafmaker.CorrectedOpFlashLabel: "lightpropagationcorrectionSCE" physics.producers.cnnid.WireLabel: "sptpc2d:dnnsp" physics.producers.cafmaker.BlipTag: "blipreco" diff --git a/sbndcode/JobConfigurations/standard/reco/reco2_data.fcl b/sbndcode/JobConfigurations/standard/reco/reco2_data.fcl index a5214dbf4..6ee3c15e3 100755 --- a/sbndcode/JobConfigurations/standard/reco/reco2_data.fcl +++ b/sbndcode/JobConfigurations/standard/reco/reco2_data.fcl @@ -43,7 +43,7 @@ physics.reco2: [ pandora, pandoraTrack, blipPandoraCopy, blipPandoraTrackCopy, p cvn, opt0finder, crtveto, crtspacepointmatching, crttrackmatching, tpcpmtbarycentermatching, pandoraSCE, pandoraSCETrack, pandoraSCEShower, pandoraSCEShowerSBN, pandoraSCECaloData, pandoraSCEPidData, pandoraSCELikePidData, cvnSCE, opt0finderSCE, tpcpmtbarycentermatchingSCE, crtspacepointmatchingSCE, crttrackmatchingSCE, - caloskimCalorimetry, blipreco, lightpropagationcorrectionSCE, lightcaloSCE, frameshift] + caloskimCalorimetry, blipreco, frameshift, lightpropagationcorrectionSCE, lightcaloSCE] physics.analyzers.caloskim.G4producer: "" diff --git a/sbndcode/LightPropagationCorrection/LightPropagationCorrection_module.cc b/sbndcode/LightPropagationCorrection/LightPropagationCorrection_module.cc index 80bddb18b..68529d4a4 100644 --- a/sbndcode/LightPropagationCorrection/LightPropagationCorrection_module.cc +++ b/sbndcode/LightPropagationCorrection/LightPropagationCorrection_module.cc @@ -13,7 +13,7 @@ sbnd::LightPropagationCorrection::LightPropagationCorrection(fhicl::ParameterSet fOpFlashLabel_tpc1 ( p.get("OpFlashLabel_tpc1") ), fSpacePointLabel( p.get("SpacePointLabel") ), fOpHitsModuleLabel( p.get("OpHitsModuleLabel") ), - fSPECTDCLabel( p.get("SPECTDCLabel") ), + fFrameShiftInfoLabel( p.get("FrameShiftInfoLabel") ), fFlashMatchingTool( p.get("FlashMatchingTool") ), fSaveCorrectionTree( p.get("SaveCorrectionTree") ), fSpeedOfLight( p.get("SpeedOfLight") ), @@ -128,10 +128,27 @@ void sbnd::LightPropagationCorrection::produce(art::Event & e) std::vector< art::Ptr > sliceVect; art::fill_ptr_vector(sliceVect, sliceHandle); + // Get the FrameShiftInfo product required to go to the RWM/gate reference frame + bool haveFrameShiftInfo = true; + if(!fIsMC) + { + // Data: stream-agnostic -- FrameApplyAtCaf is already resolved per-stream (BNB/Offbeam/Xmuon) by FrameShift_module + art::Handle frameShiftHandle; + e.getByLabel(fFrameShiftInfoLabel, frameShiftHandle); + if (!frameShiftHandle.isValid()){ + std::cout << "No FrameShiftInfo product found. Skip this event." << std::endl; + haveFrameShiftInfo = false; + } + else{ + fFrameApplyAtCaf = frameShiftHandle->FrameApplyAtCaf(); + } + } + // MC: block above is skipped, fFrameApplyAtCaf stays 0 -- no shift applied + //Vector for recob PFParticles std::vector> pfpVect; // --- Get the candidate slices - for(size_t ix=0; ixGetPropagationTimeCorrectionPerChannel(); - - // Get the SPECTDC product required to go to the RWM reference frame - if(!fIsMC) - { - art::Handle> tdcHandle; - e.getByLabel(fSPECTDCLabel, tdcHandle); - if (!tdcHandle.isValid() || tdcHandle->size() == 0){ - std::cout << "No SPECTDC products found. Skip this event." << std::endl; - ResetSliceInfo(); - continue; - } - else{ - const std::vector tdc_v(*tdcHandle); - for (size_t i=0; i> flashFM; if(fFlashMatchingTool == "OpT0Finder" ){ @@ -282,8 +277,6 @@ void sbnd::LightPropagationCorrection::beginJob() fTree->Branch("eventID", &fEvent, "eventID/i"); fTree->Branch("runID", &fRun, "runID/i"); fTree->Branch("subrunID", &fSubrun, "subrunID/i"); - fTree->Branch("RWMTime", &fRWMTime); - fTree->Branch("EventTriggerTime", &fEventTriggerTime); fTree->Branch("NuScore", &fNuScore); fTree->Branch("FMScore", &fFMScore); fTree->Branch("OpFlashTimeOld", &fOpFlashTimeOld); @@ -317,8 +310,7 @@ void sbnd::LightPropagationCorrection::ResetEventVars() fRun = 0; fSubrun = 0; _fNuScore = 0.0; - fRWMTime=0.; - fEventTriggerTime=0.; + fFrameApplyAtCaf=0.; fNuScore.clear(); fFMScore.clear(); fOpFlashTimeOld.clear(); @@ -630,10 +622,11 @@ void sbnd::LightPropagationCorrection::CorrectOpFlash(art::Ptr c newFlashTime = flasht0; particlePropTime = GetAverageParticlePropagationTime()/1000; photonPropTime = GetAveragePhotonPropagationTime()/1000; - correctedOpFlashTiming.OpFlashT0 = originalFlashTime + fEventTriggerTime/1000 - fRWMTime/1000; + double const frameShift_us = fFrameApplyAtCaf/1000.; + correctedOpFlashTiming.OpFlashT0 = originalFlashTime + frameShift_us; correctedOpFlashTiming.NuToFLight = (Zcenter/fSpeedOfLight)/1000; correctedOpFlashTiming.NuToFCharge = (fRecoVz/fSpeedOfLight)/1000; - correctedOpFlashTiming.OpFlashT0Corrected = newFlashTime + fEventTriggerTime/1000 - fRWMTime/1000;; + correctedOpFlashTiming.OpFlashT0Corrected = newFlashTime + frameShift_us; correctedOpFlashTiming.ParticlePropagationTime = particlePropTime; correctedOpFlashTiming.PhotonPropagationTime = photonPropTime; } diff --git a/sbndcode/LightPropagationCorrection/LightPropagationCorrection_module.hh b/sbndcode/LightPropagationCorrection/LightPropagationCorrection_module.hh index c8455e791..584df2760 100644 --- a/sbndcode/LightPropagationCorrection/LightPropagationCorrection_module.hh +++ b/sbndcode/LightPropagationCorrection/LightPropagationCorrection_module.hh @@ -75,7 +75,7 @@ #include "sbnobj/Common/Reco/CRUMBSResult.h" #include "sbnobj/Common/Reco/TPCPMTBarycenterMatch.h" #include "sbnobj/Common/Reco/CorrectedOpFlashTiming.h" -#include "sbnobj/SBND/Timing/DAQTimestamp.hh" +#include "sbnobj/SBND/Timing/FrameShiftInfo.hh" #include "lardataobj/AnalysisBase/T0.h" // Geometry and mapping @@ -174,7 +174,7 @@ private: std::string fSpacePointLabel; std::string fOpHitsModuleLabel; std::string fOpFlashNewLabel; - std::string fSPECTDCLabel; + std::string fFrameShiftInfoLabel; std::string fFlashMatchingTool; bool fSaveCorrectionTree; @@ -232,8 +232,7 @@ private: size_t fNOpChannels; double _fNuScore; double _fFMScore; - double fEventTriggerTime=-999999.; - double fRWMTime=-999999.; + double fFrameApplyAtCaf=0.; // MC: stays 0, no shift applied std::vector fNuScore; std::vector fFMScore; std::vector fOpFlashTimeOld; diff --git a/sbndcode/LightPropagationCorrection/job/sbnd_lightpropagationcorrection_config.fcl b/sbndcode/LightPropagationCorrection/job/sbnd_lightpropagationcorrection_config.fcl index c462c5aea..c7422c38c 100644 --- a/sbndcode/LightPropagationCorrection/job/sbnd_lightpropagationcorrection_config.fcl +++ b/sbndcode/LightPropagationCorrection/job/sbnd_lightpropagationcorrection_config.fcl @@ -17,7 +17,7 @@ LightPropagationCorrection: SpacePointLabel: "pandora" OpT0FinderModuleLabel: "opt0finder" TPCPMTBarycenterFMModuleLabel: "tpcpmtbarycentermatching" - SPECTDCLabel: "tdcdecoder" + FrameShiftInfoLabel: "frameshift" VGroupVUV: @local::sbnd_vuv_timing_parameterization.vuv_vgroup_mean VGroupVIS: @local::sbnd_vis_timing_parameterization.vis_vmean