Newer
Older
{
// Accumumate statistics for efficiency calculations.
//
// Choose electron events in gas Cherenkov with good Chisq of the best track.
// Project best track to the plane,
// calculate row number for the track,
// accrue number of tracks for the row,
// accrue number of hits for the row, if row is hit.
// Accrue total numbers of tracks and hits for plane.
if(!fCherenkov) return 0;
THaTrack* BestTrack = static_cast<THaTrack*>( tracks[0]);
if (BestTrack->GetChi2()/BestTrack->GetNDoF() > fStatMaxChi2) return 0;
if (fCherenkov->GetCerNPE() < fStatCerMin) return 0;
Double_t XTrk = kBig;
Double_t YTrk = kBig;
Double_t pathl = kBig;
// Track interception with plane. The coordinates are in the calorimeter's
// local system.
fOrigin = GetOrigin();
static_cast<THcShower*>(fParent)->CalcTrackIntercept(BestTrack, pathl, XTrk, YTrk);
// Transform coordiantes to the spectrometer's coordinate system.
XTrk += GetOrigin().X();
YTrk += GetOrigin().Y();
for (Int_t i=0; i<fNelem; i++) {
if (TMath::Abs(XTrk - static_cast<THcShower*>(fParent)->GetXPos(fLayerNum-1,i)) < fStatSlop &&
YTrk > static_cast<THcShower*>(fParent)->GetYPos(fLayerNum-1,1) &&
YTrk < static_cast<THcShower*>(fParent)->GetYPos(fLayerNum-1,0) ) {
fStatNumTrk.at(i)++;
fTotStatNumTrk++;
if (fGoodPosAdcPulseInt.at(i) > 0. || fGoodNegAdcPulseInt.at(i) > 0.) {
fStatNumHit.at(i)++;
fTotStatNumHit++;
}
}
}
if ( static_cast<THcShower*>(fParent)->fdbg_tracks_cal ) {
cout << "---------------------------------------------------------------\n";
cout << "THcShowerPlane::AccumulateStat:" << endl;
cout << " Chi2/NDF = " <<BestTrack->GetChi2()/BestTrack->GetNDoF() << endl;
cout << " HGCER Npe = " << fCherenkov->GetCerNPE() << endl;
cout << " XTrk, YTrk = " << XTrk << " " << YTrk << endl;
for (Int_t i=0; i<fNelem; i++) {
if (TMath::Abs(XTrk - static_cast<THcShower*>(fParent)->GetXPos(fLayerNum-1,i)) < fStatSlop) {
cout << " Module " << i << ", X=" << static_cast<THcShower*>(fParent)->GetXPos(fLayerNum-1,i)
<< " matches track" << endl;
if (fGoodPosAdcPulseInt.at(i) > 0. || fGoodNegAdcPulseInt.at(i) > 0.)
cout << " PulseIntegrals = " << fGoodPosAdcPulseInt.at(i) << " "
<< fGoodNegAdcPulseInt.at(i) << endl;
}
}
cout << "---------------------------------------------------------------\n";
// getchar();
}
return 1;
}