@@ -620,8 +620,6 @@ jerror_t DEventSourceREST::Extract_DBeamPhoton(hddm_r::HDDM *record,
620620 {
621621 if (locTAGMiter->getJtag () != tag)
622622 continue ;
623-
624- DBeamPhoton* gamma = new DBeamPhoton ();
625623
626624 // load the counter number (if it exists) and set the energy based on the counter
627625 unsigned int column = 0 ;
@@ -654,12 +652,14 @@ jerror_t DEventSourceREST::Extract_DBeamPhoton(hddm_r::HDDM *record,
654652 continue ;
655653 }
656654
657- double Elo = tagmGeom->getElow (column);
658- double Ehi = tagmGeom->getEhigh (column);
659- double Ebeam = (Elo + Ehi)/2 .;
655+ DBeamPhoton* gamma = new DBeamPhoton ();
656+
657+ double Elo_tagm = tagmGeom->getElow (column);
658+ double Ehi_tagm = tagmGeom->getEhigh (column);
659+ double Ebeam_tagm = (Elo_tagm + Ehi_tagm)/2 .;
660660
661661 // read the rest of the data from the REST file
662- DVector3 mom (0.0 , 0.0 , Ebeam );
662+ DVector3 mom (0.0 , 0.0 , Ebeam_tagm );
663663 gamma->setPID (Gamma);
664664 gamma->setMomentum (mom);
665665 gamma->setPosition (pos);
@@ -682,16 +682,14 @@ jerror_t DEventSourceREST::Extract_DBeamPhoton(hddm_r::HDDM *record,
682682 if (locTAGHiter->getJtag () != tag)
683683 continue ;
684684
685- DBeamPhoton* gamma = new DBeamPhoton ();
686-
687685 // load the counter number (if it exists) and set the energy based on the counter
688686 unsigned int counter = 0 ;
689687 hddm_r::TaghChannelList &locTaghChannelList = locTAGHiter->getTaghChannels ();
690688 if (locTaghChannelList.size () > 0 ) {
691689 // it's easy if the column is already set
692690 counter = locTaghChannelList ().getCounter ();
693691 } else {
694- // if the TAGM column isn't saved in the REST file, then we do one of two things
692+ // if the TAGH column isn't saved in the REST file, then we do one of two things
695693 // 1) if there's no special CCDB context associated with the file, we can just
696694 // reverse engineer the counter, assuming the latest CCDB
697695 // 2) If there is a special CCDB context specified, then use that instead
@@ -715,7 +713,13 @@ jerror_t DEventSourceREST::Extract_DBeamPhoton(hddm_r::HDDM *record,
715713 continue ;
716714 }
717715
718- DVector3 mom (0.0 , 0.0 , locTAGHiter->getE ());
716+ DBeamPhoton* gamma = new DBeamPhoton ();
717+
718+ double Elo_tagh = taghGeom->getElow (counter);
719+ double Ehi_tagh = taghGeom->getEhigh (counter);
720+ double Ebeam_tagh = (Elo_tagh + Ehi_tagh)/2 .;
721+
722+ DVector3 mom (0.0 , 0.0 , Ebeam_tagh);
719723 gamma->setPID (Gamma);
720724 gamma->setMomentum (mom);
721725 gamma->setPosition (pos);
0 commit comments