diff --git a/src/THcExtTarCor.cxx b/src/THcExtTarCor.cxx index bb9adaf8c7a253ced301bf1c0372eb4691dc8a55..a4599db95016fcc34933fe8d5127d8adbd077859 100644 --- a/src/THcExtTarCor.cxx +++ b/src/THcExtTarCor.cxx @@ -128,7 +128,8 @@ Int_t THcExtTarCor::Process( const THaEvData& ) Double_t delta; Double_t p=0; TVector3 pvect; - Double_t xtar_new=vertex[1]; + TVector3 pointing_off=spectro->GetPointingOffset(); + Double_t xtar_new=-vertex[1]; TClonesArray* tracks = spectro->GetTracks(); if( !tracks ){ return -2; @@ -137,19 +138,18 @@ Int_t THcExtTarCor::Process( const THaEvData& ) THaTrack* theTrack = static_cast<THaTrack*>( tracks->At(i) ); if( theTrack == spectro->GetGoldenTrack() ) { // Calculate corrections & recalculate ,,,track parameters - //cout << " orig" << spectro->GetName() << " " <<theTrack->GetTTheta()<< " " << theTrack->GetDp() << endl; - Double_t x_tg = vertex[1]; + Double_t x_tg = -vertex[1]+pointing_off[0]; // units of cm, beam position in spectrometer coordinate system spectro->CalculateTargetQuantities(theTrack,x_tg,xptar,ytar,yptar,delta); p = spectro->GetPcentral() * ( 1.0+delta ); spectro->TransportToLab( p, xptar, yptar, pvect ); Double_t theta=spectro->GetThetaSph(); - xtar_new = x_tg - xptar*ztarg*cos(theta); + xtar_new = x_tg - xptar*ztarg*cos(theta); //units of cm // Get a second-iteration value for x_tg based on the spectro->CalculateTargetQuantities(theTrack,xtar_new,xptar,ytar,yptar,delta); fDeltaDp = delta*100 -theTrack->GetDp(); fDeltaP = p - theTrack->GetP(); fDeltaTh = xptar - theTrack->GetTTheta(); - theTrack->SetTarget(0.0, ytar*100.0, xptar, yptar); + theTrack->SetTarget(xtar_new, ytar*100.0, xptar, yptar); theTrack->SetDp(delta*100.0); // Percent. Double_t ptemp =spectro->GetPcentral()*(1+theTrack->GetDp()/100.0); theTrack->SetMomentum(ptemp); diff --git a/src/THcHallCSpectrometer.cxx b/src/THcHallCSpectrometer.cxx index 0c4cfe7a1a766007a46fecb77ded593d792ff3d2..db697cfc4c5f64deed36b0e42ed197e4ae6a3835 100644 --- a/src/THcHallCSpectrometer.cxx +++ b/src/THcHallCSpectrometer.cxx @@ -207,6 +207,8 @@ Int_t THcHallCSpectrometer::ReadDatabase( const TDatime& date ) {"theta_lab", &fTheta_lab, kDouble }, {"partmass", &fPartMass, kDouble }, {"phi_lab", &fPhi_lab, kDouble, 0, 1}, + {"mispointing_x", &fMispointing_x, kDouble, 0, 1}, + {"mispointing_y", &fMispointing_y, kDouble, 0, 1}, {"sel_using_scin", &fSelUsingScin, kInt, 0, 1}, {"sel_using_prune", &fSelUsingPrune, kInt, 0, 1}, {"sel_ndegreesmin", &fSelNDegreesMin, kDouble, 0, 1}, @@ -238,6 +240,8 @@ Int_t THcHallCSpectrometer::ReadDatabase( const TDatime& date ) fSelUsingPrune = 0; fPhi_lab = 0.; fSatCorr=0.; + fMispointing_x=0.; + fMispointing_y=0.; gHcParms->LoadParmValues((DBRequest*)&list,prefix); EnforcePruneLimits(); @@ -270,9 +274,8 @@ Int_t THcHallCSpectrometer::ReadDatabase( const TDatime& date ) // Computes TRotation fToLabRot and fToTraRot Bool_t bend_down = kFALSE; SetCentralAngles(fTheta_lab, ph, bend_down); - Double_t off_x = 0.0, off_y = 0.0, off_z = 0.0; - fPointingOffset.SetXYZ( off_x, off_y, off_z ); - + Double_t off_z = 0.0; + fPointingOffset.SetXYZ( fMispointing_x, fMispointing_y, off_z ); // ifstream ifile; ifile.open(reconCoeffFilename.c_str()); @@ -388,7 +391,7 @@ Int_t THcHallCSpectrometer::FindVertices( TClonesArray& tracks ) return 0; } // -void THcHallCSpectrometer::CalculateTargetQuantities(THaTrack* track,Double_t& gbeam_y,Double_t& xptar,Double_t& ytar,Double_t& yptar,Double_t& delta) +void THcHallCSpectrometer::CalculateTargetQuantities(THaTrack* track,Double_t& xtar,Double_t& xptar,Double_t& ytar,Double_t& yptar,Double_t& delta) { Double_t hut[5]; Double_t hut_rot[5]; @@ -398,7 +401,7 @@ void THcHallCSpectrometer::CalculateTargetQuantities(THaTrack* track,Double_t& g hut[2] = track->GetY()/100.0 + fZTrueFocus*track->GetPhi() + fDetOffset_y;//m hut[3] = track->GetPhi() + fAngOffset_y;//radians - hut[4] = -gbeam_y/100.0; + hut[4] = xtar/100.0; // Retrieve the focal plane coordnates // Do the transpormation diff --git a/src/THcHallCSpectrometer.h b/src/THcHallCSpectrometer.h index bad08d659fd30fc8be6ecb371c848d97c0b13df9..f92f81b7c14398e56a6da82a9740bd2e0aeab965 100644 --- a/src/THcHallCSpectrometer.h +++ b/src/THcHallCSpectrometer.h @@ -144,6 +144,8 @@ protected: Double_t fPCentralOffset; // Offset Central spectrometer momentum (%) Double_t fTheta_lab; // Central spectrometer angle (deg) Double_t fPhi_lab; // Central spectrometer angle (deg) + Double_t fMispointing_x; // Spectrometer Verticcal Mispointing + Double_t fMispointing_y; // Spectrometer Horizontal Mispointing // For spectrometer central momentum use fPcentral in THaSpectrometer.h // THaScintillator *sc_ref; // calculate time track hits this plane