message: Fix bug on smearing with ESD tracks
diff: @@ -99,6 +99,9 @@ void AliTaskMuonTrackSmearing::UserExec ( Option_t * /*option*/ )
  Int_t nTracks = AliAnalysisMuonUtility::GetNTracks(InputEvent());
  for (Int_t itrack = 0; itrack < nTracks; itrack++) {
  track = AliAnalysisMuonUtility::GetTrack(itrack,InputEvent());
  + // Smear only track parameters for tracks in the muon spectrometer
  + if ( ! AliAnalysisMuonUtility::IsMuonTrack(track) ) continue;
  + // We need the MC info to smear the track
  if ( track->GetLabel() < 0 ) continue;
  genParticle = MCEvent()->GetTrack(track->GetLabel());
  TLorentzVector smearedTrack = fMuonTrackSmearing.GetRecoTrack(genParticle->P(),genParticle->Eta(),genParticle->Phi(),genParticle->Charge(),charge);
  @@ -115,12 +118,15 @@ void AliTaskMuonTrackSmearing::UserExec ( Option_t * /*option*/ )
  Double_t pz = smearedTrack.Pz();
  Double_t slopeY = smearedTrack.Py()/pz;
  Double_t invMomentum = -1./(pz*TMath::Sqrt(1.+slopeY*slopeY));
  -// if ( charge < 0. ) invMomentum *= -1.;
  + // In the ESDMuonTrack the sign is determined from the inverse bending momentum
  + // So, if the charge is negative, the momentum must be multiplied by -1
  + if ( charge < 0. ) invMomentum *= -1.;
  esdTrack->SetInverseBendingMomentum(invMomentum);
  esdTrack->SetThetaX(TMath::ATan(smearedTrack.Px()/pz));
  esdTrack->SetThetaY(TMath::ATan(slopeY));
  smearedTrackList->Add(esdTrack);
  }
  + // AliVParticle* clonedTrack = static_cast<AliVParticle*>(smearedTrackList->Last()); printf("Smear (%g, %g, %g) => (%g, %g, %g) %g => %g\n",track->Px(),track->Py(),track->Pz(), clonedTrack->Px(),clonedTrack->Py(),clonedTrack->Pz(), track->Eta(), clonedTrack->Eta());
  } // loop on tracks
  smearedTrackList->Compress();
  AliAnalysisMuonUtility::SetUseSmearedTracks(kTRUE,kFALSE);
  