@@ -327,8 +327,8 @@ class CAFMaker : public art::EDProducer {
327327 void FixPMTReferenceTimes (StandardRecord &rec, double PMT_reference_time);
328328 void FixCRTReferenceTimes (StandardRecord &rec, double CRTT0_reference_time, double CRTT1_reference_time);
329329
330- // void SBNDShiftCRTReference(StandardRecord &rec, double SBNDFrame) const;
331- // void SBNDShiftPMTReference(StandardRecord &rec, double SBNDFrame) const;
330+ void SBNDShiftCRTReference (StandardRecord &rec, double SBNDFrame) const ;
331+ void SBNDShiftPMTReference (StandardRecord &rec, double SBNDFrame) const ;
332332
333333 // / Equivalent of FindManyP except a return that is !isValid() prints a
334334 // / messsage and aborts if StrictMode is true.
@@ -516,43 +516,43 @@ void CAFMaker::BlindEnergyParameters(StandardRecord* brec) {
516516 }
517517}
518518
519- // void CAFMaker::SBNDShiftCRTReference(StandardRecord &rec, double SBNDFrame) const {
520- //
521- // //CRT Space Point
522- // for (SRCRTSpacePoint &sp: rec.crt_spacepoints){
523- // sp.time += SBNDFrame; //ns
524- // }
525- //
526- // //CRT Track
527- // for (SRSBNDCRTTrack &trk: rec.sbnd_crt_tracks){
528- // trk.time += SBNDFrame; //ns
529- // }
530- //
531- // //TODO: CRT Space Point and Track Match
532- // for (SRSlice &slc: rec.slc){
533- // for (SRPFP &pfp: slc.reco.pfp){
534- // if(!std::isnan(pfp.trk.crtspacepoint.score)) pfp.trk.crtspacepoint.spacepoint.time += SBNDFrame;
535- //
536- // if(!std::isnan(pfp.trk.crtsbndtrack.score)) pfp.trk.crtsbndtrack.track.time += SBNDFrame;
537- // }
538- // }
539- // }
540- //
541- // void CAFMaker::SBNDShiftPMTReference(StandardRecord &rec, double SBNDFrame) const {
542- //
543- // double SBNDFrame_us = SBNDFrame / 1000.0; //convert ns to us
544- //
545- // //Op Flash
546- // for (SROpFlash &opf: rec.opflashes) {
547- // opf.time += SBNDFrame_us;
548- // opf.firsttime += SBNDFrame_us;
549- // }
550- //
551- // //OpT0 match to slice
552- // for (SRSlice &s: rec.slc) {
553- // s.opt0.time += SBNDFrame_us;
554- // }
555- // }
519+ void CAFMaker::SBNDShiftCRTReference (StandardRecord &rec, double SBNDFrame) const {
520+
521+ // CRT Space Point
522+ for (SRCRTSpacePoint &sp: rec.crt_spacepoints ){
523+ sp.time += SBNDFrame; // ns
524+ }
525+
526+ // CRT Track
527+ for (SRSBNDCRTTrack &trk: rec.sbnd_crt_tracks ){
528+ trk.time += SBNDFrame; // ns
529+ }
530+
531+ // TODO: CRT Space Point and Track Match
532+ for (SRSlice &slc: rec.slc ){
533+ for (SRPFP &pfp: slc.reco .pfp ){
534+ if (!std::isnan (pfp.trk .crtspacepoint .score )) pfp.trk .crtspacepoint .spacepoint .time += SBNDFrame;
535+
536+ if (!std::isnan (pfp.trk .crtsbndtrack .score )) pfp.trk .crtsbndtrack .track .time += SBNDFrame;
537+ }
538+ }
539+ }
540+
541+ void CAFMaker::SBNDShiftPMTReference (StandardRecord &rec, double SBNDFrame) const {
542+
543+ double SBNDFrame_us = SBNDFrame / 1000.0 ; // convert ns to us
544+
545+ // Op Flash
546+ for (SROpFlash &opf: rec.opflashes ) {
547+ opf.time += SBNDFrame_us;
548+ opf.firsttime += SBNDFrame_us;
549+ }
550+
551+ // OpT0 match to slice
552+ for (SRSlice &s: rec.slc ) {
553+ s.opt0 .time += SBNDFrame_us;
554+ }
555+ }
556556
557557void CAFMaker::FixPMTReferenceTimes (StandardRecord &rec, double PMT_reference_time) {
558558 // Fix the flashes
@@ -2586,28 +2586,21 @@ void CAFMaker::produce(art::Event& evt) noexcept {
25862586 FixPMTReferenceTimes (rec, PMT_reference_time);
25872587
25882588 // TODO: TPC?
2589-
2590- // // SBND: Fix the Reference time in data depending on the stream
2591- // // For more information, see:
2592- // // https://sbn-docdb.fnal.gov/cgi-bin/sso/RetrieveFile?docid=43090
2593-
2594- // if (isRealData && (fDet == kSBND) && fSubRunPOT > 0)
2595- // {
2596- // // Fill trigger info
2597- // FillTriggerSBND(srsbndtiminginfo, srtrigger);
2598-
2599- // // Shift timing reference frame
2600- // if (!std::isnan(rec.sbnd_frames.frameApplyAtCaf) && (rec.sbnd_frames.frameApplyAtCaf != 0.0)){
2601- // mf::LogInfo("CAFMaker") << "Setting Reference Timing for timing object in SBND \n"
2602- // << " Shift Apply At Caf Level = " << rec.sbnd_frames.frameApplyAtCaf << " ns\n";
2603- //
2604- // //shift reference frame for CRT objects: crt trk, crt sp, crt sp match, crt trk match
2605- // SBNDShiftCRTReference(rec, rec.sbnd_frames.frameApplyAtCaf);
2606-
2607- // //shift reference frame for PMT objects: opflash, opt0
2608- // SBNDShiftPMTReference(rec, rec.sbnd_frames.frameApplyAtCaf);
2609- // }
2610- // }
2589+
2590+
2591+ if (isRealData && (fDet == kSBND ))
2592+ {
2593+ // Fill trigger info
2594+ FillTriggerSBND (srsbndtiminginfo, srtrigger);
2595+
2596+ // // Legacy: Timing correction is being done at decoding/reconstruction level
2597+ // // SBND: Fix the Reference time in data depending on the stream
2598+ // //shift reference frame for CRT objects: crt trk, crt sp, crt sp match, crt trk match
2599+ // SBNDShiftCRTReference(rec, rec.sbnd_frames.frameApplyAtCaf);
2600+
2601+ // //shift reference frame for PMT objects: opflash, opt0
2602+ // SBNDShiftPMTReference(rec, rec.sbnd_frames.frameApplyAtCaf);
2603+ }
26112604
26122605 // Get metadata information for header
26132606 unsigned int run = evt.run ();
0 commit comments