diff --git a/examples/dcresiduals.C b/examples/dcresiduals.C new file mode 100644 index 0000000000000000000000000000000000000000..a5759b968ae9611351c6bd6c2f04e5d29ed03ce3 --- /dev/null +++ b/examples/dcresiduals.C @@ -0,0 +1,33 @@ +{ + TFile* f = new TFile("hodtest.root"); + TTree *T=(TTree*)f->Get("T"); + TCanvas *c1 = new TCanvas("c1", "Drift Chamber Residuals", 800, 1000); + c1->Divide(2,6); + + TH1F* h=new TH1F("h", "Residual", 100, -1.0, 1.0); + + c1->cd(1); + T->Draw("H.dc.residual[0]","H.dc.residual[0] < 999"); + c1->cd(2); + T->Draw("H.dc.residual[1]","H.dc.residual[1] < 999"); + c1->cd(3); + T->Draw("H.dc.residual[2]","H.dc.residual[2] < 999"); + c1->cd(4); + T->Draw("H.dc.residual[3]","H.dc.residual[3] < 999"); + c1->cd(5); + T->Draw("H.dc.residual[4]","H.dc.residual[4] < 999"); + c1->cd(6); + T->Draw("H.dc.residual[5]","H.dc.residual[5] < 999"); + c1->cd(7); + T->Draw("H.dc.residual[6]","H.dc.residual[6] < 999"); + c1->cd(8); + T->Draw("H.dc.residual[7]","H.dc.residual[7] < 999"); + c1->cd(9); + T->Draw("H.dc.residual[8]","H.dc.residual[8] < 999"); + c1->cd(10); + T->Draw("H.dc.residual[9]","H.dc.residual[9] < 999"); + c1->cd(11); + T->Draw("H.dc.residual[10]","H.dc.residual[10] < 999"); + c1->cd(12); + T->Draw("H.dc.residual[11]","H.dc.residual[11] < 999"); +} diff --git a/src/THcDC.cxx b/src/THcDC.cxx index fc4b46abf103069fe39ef5db4a4b777a1855cfee..9db5723dc43b0c49c7d495968efc8b3237b6305d 100644 --- a/src/THcDC.cxx +++ b/src/THcDC.cxx @@ -191,6 +191,8 @@ THaAnalysisObject::EStatus THcDC::Init( const TDatime& date ) fPlaneCoeffs[ip] = fPlanes[ip]->GetPlaneCoef(); } + fResiduals = new Double_t [fNPlanes]; + // Replace with what we need for Hall C // const DataDest tmp[NDEST] = { // { &fRTNhit, &fRANhit, fRT, fRT_c, fRA, fRA_p, fRA_c, fROff, fRPed, fRGain }, @@ -333,7 +335,7 @@ Int_t THcDC::DefineVariables( EMode mode ) { "y", "Y at focal plane", "fDCTracks.THcDCTrack.GetY()"}, { "xp", "YP at focal plane", "fDCTracks.THcDCTrack.GetXP()"}, { "yp", "YP at focal plane", "fDCTracks.THcDCTrack.GetYP()"}, - { "p1residual", "Plane 1 Residual", "fDCTracks.THcDCTrack.GetResidual1()"}, + { "residual", "Residuals", "fResiduals"}, { 0 } }; return DefineVarsFromList( vars, mode ); @@ -406,6 +408,9 @@ void THcDC::ClearEvent() fChambers[i]->Clear(); } + for(Int_t i=0;i<fNPlanes;i++) { + fResiduals[i] = 1000.0; + } // fTrackProj->Clear(); } @@ -859,6 +864,12 @@ void THcDC::TrackFit() } } } + if(fNDCTracks>0) { + for(Int_t ip=0;ip<fNPlanes;ip++) { + THcDCTrack *theDCTrack = static_cast<THcDCTrack*>( fDCTracks->At(0)); + fResiduals[ip] = theDCTrack->GetResidual(ip); + } + } // print tracks if hdebugtrackprint is on } Double_t THcDC::DpsiFun(Double_t ray[4], Int_t plane) diff --git a/src/THcDC.h b/src/THcDC.h index 2f68470d324c7b3e80c19a33915ae4d397ef1290..097a68e138ac36fd18bf7facc5b023f1672711e1 100644 --- a/src/THcDC.h +++ b/src/THcDC.h @@ -80,14 +80,15 @@ protected: TClonesArray* fDCTracks; // Tracks found from stubs (THcDCTrack obj) // Calibration + // Hall C Parameters + Int_t fNPlanes; // Total number of DC planes + char** fPlaneNames; + Int_t fNChambers; + // Per-event data Int_t fNhits; Int_t ntracks_fp; /* Change this to fN something */ - - // Potential Hall C parameters. Mostly here for demonstration - Int_t fNPlanes; - char** fPlaneNames; - Int_t fNChambers; + Double_t* fResiduals; //[fNPlanes] Array of residuals Double_t fNSperChan; /* TDC bin size */ Double_t fWireVelocity;