--- PamCut/CollectionActions/RefitTrackAction/RefitTrackAction.cpp 2010/06/07 13:49:04 1.1.2.5 +++ PamCut/CollectionActions/RefitTrackAction/RefitTrackAction.cpp 2011/11/30 16:59:03 1.1.2.8 @@ -20,7 +20,7 @@ if (event->GetTrkLevel2()->GetNTracks() == 0) return; - // Reload the TRK parameters only if they have been changed (ie., if another instance of + // Reload the TRK alignment parameters only if they have been changed (ie., if another instance of // this class used a different set of parameters). if (_trkParamsFile != _currTrkParamsFile) { TrkParams::Set(_trkParamsFile, 5); @@ -33,6 +33,14 @@ if (!trkTrack) return; + // Check if good clusters have meaningful energy releases + for (UInt_t ip = 0; ip < 6; ip++) { + if (trkTrack->XGood(ip) == 1 && trkTrack->GetDEDX(ip, 0) <= 0.) + trkTrack->xgood[ip] = 0; // Set it to bad + if (trkTrack->YGood(ip) == 1 && trkTrack->GetDEDX(ip, 1) <= 0.) + trkTrack->ygood[ip] = 0; // Set it to bad + } + if (_currEvent != event->GetReadEntry()) { // Saves the original track data if the current event (recorded in the static member _currEvent) is // different from the actually processed event. This way, multiple instances of the class @@ -40,8 +48,8 @@ _currEvent = event->GetReadEntry(); // Save the original cluster status and measured positions for (int i = 0; i < 6; i++) { - _layerXBackup[i] = trkTrack->xgood[0]; - _layerYBackup[i] = trkTrack->ygood[0]; + _layerXBackup[i] = trkTrack->xgood[i]; + _layerYBackup[i] = trkTrack->ygood[i]; _xmBackup[i] = trkTrack->xm[i]; _ymBackup[i] = trkTrack->ym[i]; } @@ -52,18 +60,24 @@ for (int i = 0; i < 6; i++) { trkTrack->xm[i] = _xmBackup[i]; trkTrack->ym[i] = _ymBackup[i]; - _layerXBackup[i] = trkTrack->xgood[0]; - _layerYBackup[i] = trkTrack->ygood[0]; + trkTrack->xgood[i] = _layerXBackup[i]; + trkTrack->ygood[i] = _layerYBackup[i]; } } // Apply the gaussian spread - for (Int_t ip = 0; ip < 6; ip++) { - // gaussian distributed random number Gauss(mean,sigma) (in cm) - trkTrack->xm[ip] += _r3->Gaus(0., _spreadX); - trkTrack->ym[ip] += _r3->Gaus(0., _spreadY); + if (_spreadX != 0.) { + for (Int_t ip = 0; ip < 6; ip++) { + // gaussian distributed random number Gauss(mean,sigma) (in cm) + trkTrack->xm[ip] += _r3->Gaus(0., _spreadX); + } + } + if (_spreadY != 0.) { + for (Int_t ip = 0; ip < 6; ip++) { + trkTrack->ym[ip] += _r3->Gaus(0., _spreadY); + } } // Mask the layers