--- PamCut/CollectionActions/Histo2DActions/TofDedxVsRigHistoAction/TofDedxVsRigHistoAction.cpp 2011/07/28 13:27:46 1.1 +++ PamCut/CollectionActions/Histo2DActions/TofDedxVsRigHistoAction/TofDedxVsRigHistoAction.cpp 2012/01/03 08:45:27 1.1.2.3 @@ -77,58 +77,60 @@ static float dEdxLayer; static unsigned int badLayers; - int trkSeqNo = 0; + static int trkSeqNo; + static int idx; + trkSeqNo = event->GetTrack(0)->GetTrkTrack()->GetSeqNo(); for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) { - if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == event->GetTrack(0)->GetTrkTrack()->GetSeqNo()) - trkSeqNo = i; + if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == trkSeqNo) + idx = i; } dEdx = 0.; badLayers = 0; if ((_layers & S11) == S11) { - dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 0, 100); + dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 0, 100); if (dEdxLayer > 0. && dEdxLayer < 4090) dEdx += dEdxLayer; else badLayers++; } if ((_layers & S12) == S12) { - dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 1, 100); + dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 1, 100); if (dEdxLayer > 0. && dEdxLayer < 4090) dEdx += dEdxLayer; else badLayers++; } if ((_layers & S21) == S21) { - dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 2, 100); + dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 2, 100); if (dEdxLayer > 0. && dEdxLayer < 4090) dEdx += dEdxLayer; else badLayers++; } if ((_layers & S22) == S22) { - dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 3, 100); + dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 3, 100); if (dEdxLayer > 0. && dEdxLayer < 4090) dEdx += dEdxLayer; else badLayers++; } if ((_layers & S31) == S31) { - dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 4, 100); + dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 4, 100); if (dEdxLayer > 0. && dEdxLayer < 4090) dEdx += dEdxLayer; else badLayers++; } if ((_layers & S32) == S32) { - dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 5, 100); + dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 5, 100); if (dEdxLayer > 0. && dEdxLayer < 4090) dEdx += dEdxLayer; else badLayers++; } - if (badLayers != _nLayers) { - dEdx /= _nLayers - badLayers; + if (badLayers == 0) { + dEdx /= _nLayers; Fill(event->GetTrack(0)->GetTrkTrack()->GetRigidity(), dEdx); } else