--- PamCut/TofCuts/TofDedxHCut/TofDedxHCut.cpp 2011/11/29 10:20:16 1.4 +++ PamCut/TofCuts/TofDedxHCut/TofDedxHCut.cpp 2012/01/03 08:57:21 1.5 @@ -79,16 +79,18 @@ int TofDedxHCut::Check(PamLevel2 *event) { static int trkSeqNo; + static int idx; if (_standAlone) - trkSeqNo = 0; - else { - for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) { - if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == event->GetTrack(0)->GetTrkTrack()->GetSeqNo()) - trkSeqNo = i; - } + trkSeqNo = -1; + else + trkSeqNo = event->GetTrack(0)->GetTrkTrack()->GetSeqNo(); + + for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) { + if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == trkSeqNo) + idx = i; } - float beta = event->GetToFLevel2()->GetToFTrkVar(trkSeqNo)->beta[12]; + float beta = event->GetToFLevel2()->GetToFTrkVar(idx)->beta[12]; static unsigned int auxLayer; static float dEdx; @@ -101,11 +103,11 @@ nLayers = 0; while (auxLayer > 0) { if ((auxLayer & 0x1) == 1) { - dEdx += event->GetToFLevel2()->GetdEdx(trkSeqNo, currLayer, 100); + dEdx += event->GetToFLevel2()->GetdEdx(idx, currLayer, 100); nLayers++; // Patch to exclude S115b if (currLayer == 0) { - ToFTrkVar *tofTrk = event->GetToFLevel2()->GetToFTrkVar(trkSeqNo); + ToFTrkVar *tofTrk = event->GetToFLevel2()->GetToFTrkVar(idx); bool has8 = false, has9 = false; float dedx9 = 0.; for (Int_t ib = 0; ib < tofTrk->npmtadc; ib++) {