diff --git a/src/THcDCHit.h b/src/THcDCHit.h index fb886f6b1138ecea0d8ef53b757a4a15786c7d21..c44e53206e89c85f0332155bd441d6f08447e22f 100644 --- a/src/THcDCHit.h +++ b/src/THcDCHit.h @@ -21,6 +21,7 @@ public: fWire(wire), fRawTime(rawtime), fTime(time), fWirePlane(wp), fDist(0.0), ftrDist(kBig) { ConvertTimeToDist(); + fCorrected = 0; } virtual ~THcDCHit() {} @@ -37,6 +38,7 @@ public: Double_t GetDist() const { return fDist; } Double_t GetPos() const { return fWire->GetPos(); } //Position of hit wire Double_t GetdDist() const { return fdDist; } + Int_t GetCorrectedStatus() const { return fCorrected; } THcDriftChamberPlane* GetWirePlane() const { return fWirePlane; } @@ -50,6 +52,7 @@ public: Int_t GetPlaneNum() const { return fWirePlane->GetPlaneNum(); } Int_t GetPlaneIndex() const { return fWirePlane->GetPlaneIndex(); } Int_t GetChamberNum() const { return fWirePlane->GetChamberNum(); } + void SetCorrectedStatus(Int_t c) { fCorrected = c; } protected: static const Double_t kBig; //! @@ -61,6 +64,7 @@ protected: Double_t fDist; // (Perpendicular) Drift Distance Double_t fdDist; // uncertainty in fDist (for chi2 calc) Double_t ftrDist; // (Perpendicular) distance from the track + Int_t fCorrected; // Has this hit been corrected? THcDriftChamber* fChamber; //! Pointer to parent wire plane diff --git a/src/THcDriftChamber.cxx b/src/THcDriftChamber.cxx index fe2a9c51b85acfeb08b7e1a5baeacda44aec3a99..3c5bfae0a0a73e6b752657b81d66f74f1ac7ec17 100644 --- a/src/THcDriftChamber.cxx +++ b/src/THcDriftChamber.cxx @@ -241,7 +241,7 @@ Int_t THcDriftChamber::FindSpacePoints( void ) SelectSpacePoints(); if(fNSpacePoints == 0) cout << "SelectSpacePoints() killed SP" << endl; } - //cout << fNSpacePoints << " Space Points remain" << endl; + cout << fNSpacePoints << " Space Points remain" << endl; // Add these space points to the total list of space points for the // the DC package. Do this in THcDC.cxx. #if 0 @@ -731,12 +731,19 @@ void THcDriftChamber::CorrectHitTimes() // How do we know this correction only gets applied once? Is // it determined that a given hit can only belong to one space point? Double_t time_corr = plane->GetReadoutX() ? - fSpacePoints[isp].y*plane->GetReadoutCorr()/fWireVelocity : - fSpacePoints[isp].x*plane->GetReadoutCorr()/fWireVelocity; + y*plane->GetReadoutCorr()/fWireVelocity : + x*plane->GetReadoutCorr()/fWireVelocity; - hit->SetTime(hit->GetTime() - - plane->GetCentralTime() + plane->GetDriftTimeSign()*time_corr); - hit->ConvertTimeToDist(); + // cout << "Correcting hit " << hit << " " << plane->GetPlaneNum() << " " << isp << "/" << ihit << " " << x << "," << y << endl; + // Fortran ENGINE does not do this check, so hits can get "corrected" + // multiple times if they belong to multiple space points. + // To reproduce the precise ENGINE behavior, remove this if condition. + if(! hit->GetCorrectedStatus()) { + hit->SetTime(hit->GetTime() - plane->GetCentralTime() + + plane->GetDriftTimeSign()*time_corr); + hit->ConvertTimeToDist(); + hit->SetCorrectedStatus(1); + } } } }