diff --git a/src/THcDC.cxx b/src/THcDC.cxx index 0b56793304dfa8096005257903e35e18567f20d5..dc8003b479d3bc20ec4a789d74c2a2b115fca37e 100644 --- a/src/THcDC.cxx +++ b/src/THcDC.cxx @@ -217,6 +217,9 @@ THaAnalysisObject::EStatus THcDC::Init( const TDatime& date ) } fResiduals = new Double_t [fNPlanes]; + fWire_hit_did = new Double_t [fNPlanes]; + fWire_hit_should = new Double_t [fNPlanes]; + // Replace with what we need for Hall C // const DataDest tmp[NDEST] = { @@ -345,6 +348,8 @@ Int_t THcDC::DefineVariables( EMode mode ) { "xp_fp", "XP at focal plane (best chi2 track)", "fXp_fp_best"}, { "yp_fp", "YP at focal plane(best chi2 track) ", "fYp_fp_best"}, { "residual", "Residuals", "fResiduals"}, + { "wireHitDid","Wire did have matched track hit", "fWire_hit_did"}, + { "wireHitShould", "Wire should have matched track hit", "fWire_hit_should"}, { 0 } }; return DefineVarsFromList( vars, mode ); @@ -426,6 +431,8 @@ void THcDC::ClearEvent() for(Int_t i=0;i<fNPlanes;i++) { fResiduals[i] = 1000.0; + fWire_hit_did[i] = 1000.0; + fWire_hit_should[i] = 1000.0; } // fTrackProj->Clear(); @@ -561,6 +568,26 @@ void THcDC::SetFocalPlaneBestTrack(Int_t golden_track_index) Int_t plane = hit->GetPlaneNum() - 1; fResiduals[plane] = tr1->GetResidual(plane); } + EfficiencyPerWire(golden_track_index); +} +// +void THcDC::EfficiencyPerWire(Int_t golden_track_index) +{ + THcDCTrack *tr1 = static_cast<THcDCTrack*>( fDCTracks->At(golden_track_index)); + Double_t track_pos; + for (UInt_t ihit = 0; ihit < UInt_t (tr1->GetNHits()); ihit++) { + THcDCHit *hit = tr1->GetHit(ihit); + Int_t plane = hit->GetPlaneNum() - 1; + track_pos=tr1->GetCoord(plane); + Int_t wire_num = hit->GetWireNum(); + Int_t wire_track_num=round(fPlanes[plane]->CalcWireFromPos(track_pos)); + if ( (wire_num-wire_track_num) ==0) fWire_hit_did[plane]=wire_num; + } + for(Int_t ip=0; ip<fNPlanes;ip++) { + track_pos=tr1->GetCoord(ip); + Int_t wire_should = round(fPlanes[ip]->CalcWireFromPos(track_pos)); + fWire_hit_should[ip]=wire_should; + } } // void THcDC::PrintSpacePoints() diff --git a/src/THcDC.h b/src/THcDC.h index 3398af83b1467dba6ba3657a7ecd243a6794cccd..5bea4f07472ea3e66f61340286c85cd0b116f43a 100644 --- a/src/THcDC.h +++ b/src/THcDC.h @@ -110,6 +110,8 @@ protected: Int_t fN_True_RawHits; Int_t fNSp; // Number of space points Double_t* fResiduals; //[fNPlanes] Array of residuals + Double_t* fWire_hit_did; //[fNPlanes] + Double_t* fWire_hit_should; //[fNPlanes] Double_t fNSperChan; /* TDC bin size */ Double_t fWireVelocity; @@ -183,7 +185,7 @@ protected: void Setup(const char* name, const char* description); void PrintSpacePoints(); void PrintStubs(); - + void EfficiencyPerWire(Int_t golden_track_index); ClassDef(THcDC,0) // Set of Drift Chambers detector }; diff --git a/src/THcDriftChamberPlane.cxx b/src/THcDriftChamberPlane.cxx index 28c4ddffa4fdecfc90c4eb008f8d5385edaa5912..e69bf13fa56d6c67c7e5d92a7ac33344c2ecc0b0 100644 --- a/src/THcDriftChamberPlane.cxx +++ b/src/THcDriftChamberPlane.cxx @@ -299,7 +299,13 @@ Int_t THcDriftChamberPlane::CoarseProcess( TClonesArray& tracks ) return 0; } - +// +Double_t THcDriftChamberPlane::CalcWireFromPos(Double_t pos) { + Double_t wire_num_calc=-1000; + if (fWireOrder==0) wire_num_calc = (pos+fCenter)/(fPitch)+fCentralWire; + if (fWireOrder==1) wire_num_calc = 1-((pos+fCenter)/(fPitch)+fCentralWire-fNWires); + return(wire_num_calc); +} //_____________________________________________________________________________ Int_t THcDriftChamberPlane::FineProcess( TClonesArray& tracks ) { diff --git a/src/THcDriftChamberPlane.h b/src/THcDriftChamberPlane.h index 78b9b22e02de5868a287a2fa498ed3f5ebffc458..805ecce4eeab49df25ca98a04e2500b5e09e0f67 100644 --- a/src/THcDriftChamberPlane.h +++ b/src/THcDriftChamberPlane.h @@ -67,8 +67,8 @@ public: Double_t GetPsi0() { return fPsi0; } Double_t* GetStubCoef() { return fStubCoef; } Double_t* GetPlaneCoef() { return fPlaneCoef; } - THcDriftChamberPlane(); // for ROOT I/O + Double_t CalcWireFromPos(Double_t pos); protected: TClonesArray* fParentHitList; @@ -76,13 +76,13 @@ protected: TClonesArray* fHits; TClonesArray* fWires; + Int_t fWireOrder; Int_t fPlaneNum; Int_t fPlaneIndex; /* Index of this plane within it's chamber */ Int_t fChamberNum; Int_t fUsingTzeroPerWire; Int_t fNRawhits; Int_t fNWires; - Int_t fWireOrder; Int_t fTdcWinMin; Int_t fTdcWinMax; Double_t fPitch;